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>
43#include <osl/endian.h>
73#include <osl/file.hxx>
108#include <strings.hrc>
135#include <osl/diagnose.h>
157using namespace ::
svx;
163void collectUIInformation(
const OUString& rAction,
const OUString& aParameters)
166 aDescription.
aAction = rAction;
167 aDescription.
aParameters = {{
"parameters", aParameters}};
168 aDescription.
aID =
"writer_edit";
169 aDescription.
aKeyWord =
"SwEditWinUIObject";
170 aDescription.
aParent =
"MainWindow";
185 bool m_bDelBookmark : 1;
186 bool m_bInDisconnect : 1;
193 virtual ~SwTransferDdeLink()
override;
198 virtual ::sfx2::SvBaseLink::UpdateResult
DataChanged(
199 const OUString& rMimeType,
const css::uno::Any & rValue )
override;
200 virtual void Closed()
override;
228class SwTrnsfrActionAndUndo
242 pContext->remember();
246 ~SwTrnsfrActionAndUndo() COVERITY_NOEXCEPT_FALSE
256 : m_pWrtShell( &rSh ),
257 m_pCreatorView( nullptr ),
258 m_pOrigGraphic( nullptr ),
360 uno::Reference < embed::XEmbeddedObject > xObj;
367 xObj =
static_cast<SwOLENode*
>(pNd)->GetOLEObj().GetOleRef();
368 nAspect =
static_cast<SwOLENode*
>(pNd)->GetAspect();
383 return static_cast<SwOLENode*
>(pNd)->GetGraphic();
414 rSrcWrtShell.
Copy(rDest);
419 void lclCheckAndPerformRotation(
Graphic& aGraphic)
422 if ( !aMetadata.
read(aGraphic) )
429 aTransform.rotate( aRotation );
436 sal_Int32 nTextLength = 0;
460 nTextLength += pTextNode->
GetText().getLength();
461 if (nTextLength >= 1024 * 512)
539 aContentAtPos.
sStr );
552 else if( !rURL.
GetURL().isEmpty() )
563 sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT;
564 uno::Reference < embed::XEmbeddedObject > xObj =
FindOLEObj( nAspect );
577 if ( nFormat == SotClipboardFormatId::GDIMETAFILE )
588 case SotClipboardFormatId::LINK:
593 case SotClipboardFormatId::OBJECTDESCRIPTOR:
594 case SotClipboardFormatId::LINKSRCDESCRIPTOR:
598 case SotClipboardFormatId::DRAWING:
606 case SotClipboardFormatId::STRING:
612 case SotClipboardFormatId::RTF:
618 case SotClipboardFormatId::RICHTEXT:
625 case SotClipboardFormatId::HTML:
632 case SotClipboardFormatId::SVXB:
637 case SotClipboardFormatId::GDIMETAFILE:
641 case SotClipboardFormatId::BITMAP:
642 case SotClipboardFormatId::PNG:
648 case SotClipboardFormatId::SVIM:
653 case SotClipboardFormatId::INET_IMAGE:
658 case SotClipboardFormatId::SOLK:
659 case SotClipboardFormatId::NETSCAPE_BOOKMARK:
660 case SotClipboardFormatId::FILEGRPDESCRIPTOR:
661 case SotClipboardFormatId::FILECONTENT:
662 case SotClipboardFormatId::UNIFORMRESOURCELOCATOR:
663 case SotClipboardFormatId::SIMPLE_FILE:
668 case SotClipboardFormatId::EMBED_SOURCE:
673 SfxObjectCreateMode::EMBEDDED );
688 void* pObject, sal_uInt32 nObjectType,
694 switch( nObjectType )
700 xStream->SetBufferSize( 16348 );
743 uno::Reference< embed::XStorage > xWorkStore =
749 SfxMedium aMedium( xWorkStore, OUString() );
753 uno::Reference< embed::XTransactedObject > xTransact( xWorkStore, uno::UNO_QUERY );
754 if ( xTransact.is() )
757 xStream->SetBufferSize( 0xff00 );
758 xStream->WriteStream( *pTempStream );
760 xWorkStore->dispose();
763 catch (
const uno::Exception&)
773 xStream->SetBufferSize( 1024 );
774 SwTransferDdeLink* pDdeLnk =
static_cast<SwTransferDdeLink*
>(
pObject);
775 if( pDdeLnk->WriteData( *
xStream ) )
800 xWrt->SetAsciiOptions( aAOpt );
803 xWrt->m_bUCS2_WithStartChar =
false;
812 xWrt->m_bWriteClipboardDoc =
true;
814 xWrt->SetShowProgress(
false);
816#if defined(DEBUGPASTE)
818 "PASTEBUFFER.debug"), StreamMode::WRITE|StreamMode::TRUNC);
819 SwWriter aDbgWrt( aPasteDebug, *pDoc );
820 aDbgWrt.
Write( xWrt );
836 int nRet =
Copy(
true );
839 collectUIInformation(
"CUT",
"parameter");
876 std::vector< ::sw::mark::IMark* > vDdeMarks;
884 vDdeMarks.push_back(*ppMark);
888 for (
const auto& rpMark : vDdeMarks)
896 std::optional<SwWait> oWait;
908 assert(&rSrc == &rPaM.
GetDoc());
923 SwPosition aPos(aIdx, 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 );
1014#if HAVE_FEATURE_DESKTOP
1015 AddFormat( SotClipboardFormatId::OBJECTDESCRIPTOR );
1016 AddFormat( SotClipboardFormatId::GDIMETAFILE );
1019 sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT;
1020 uno::Reference < embed::XEmbeddedObject > xObj =
FindOLEObj( nAspect );
1029 for(
const auto& rItem : aVector )
1040 std::optional<SwWait> oWait;
1087#if HAVE_FEATURE_DESKTOP
1089 AddFormat( SotClipboardFormatId::EMBED_SOURCE );
1096#if HAVE_FEATURE_DESKTOP
1097 AddFormat( SotClipboardFormatId::RICHTEXT );
1098 AddFormat( SotClipboardFormatId::HTML );
1102 AddFormat( SotClipboardFormatId::STRING );
1106 AddFormat( SotClipboardFormatId::DRAWING );
1109#if HAVE_FEATURE_DESKTOP
1110 AddFormat( SotClipboardFormatId::GDIMETAFILE );
1111 AddFormat( SotClipboardFormatId::BITMAP );
1129 AddFormat( SotClipboardFormatId::STRING );
1130#if HAVE_FEATURE_DESKTOP
1131 AddFormat( SotClipboardFormatId::SOLK );
1132 AddFormat( SotClipboardFormatId::NETSCAPE_BOOKMARK );
1133 AddFormat( SotClipboardFormatId::FILECONTENT );
1134 AddFormat( SotClipboardFormatId::FILEGRPDESCRIPTOR );
1136 AddFormat( SotClipboardFormatId::UNIFORMRESOURCELOCATOR );
1144 if( !bIsCut && bDDELink &&
1148#if HAVE_FEATURE_DESKTOP
1149 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 );
1262 AddFormat( SotClipboardFormatId::OBJECTDESCRIPTOR );
1275 : m_rWrtShell(rWrtShell)
1304 beans::PropertyValue aPropertyValue;
1314 aPropertyValue.Name =
"TextGraphicObject";
1315 aPropertyValue.Value
1345 aPropertyValue.Name =
"TextRange";
1348 aPropertyValue.Value <<= uno::Reference<text::XTextRange>(xTextRange);
1353 if (aPropertyValue.Name.isEmpty())
1357 uno::Sequence<beans::PropertyValue>
aEvent{ aPropertyValue };
1360 catch (
const uno::Exception& rException)
1363 "SwPasteContext::~SwPasteContext: uncaught exception: " << rException.Message);
1383 sal_uInt16 nSourceOptions =
1384 (( SotExchangeDest::DOC_TEXTFRAME == nDestination ||
1385 SotExchangeDest::SWDOC_FREE_AREA == nDestination ||
1386 SotExchangeDest::DOC_TEXTFRAME_WEB == nDestination ||
1387 SotExchangeDest::SWDOC_FREE_AREA_WEB == nDestination )
1398 nFormat, nEventAction, SotClipboardFormatId::NONE,
1411 if (nFormat != SotClipboardFormatId::RICHTEXT)
1416 if (!rData.
HasFormat(SotClipboardFormatId::EMBED_SOURCE))
1421 if (!rData.
HasFormat(SotClipboardFormatId::OBJECTDESCRIPTOR))
1440 nFormat = SotClipboardFormatId::EMBED_SOURCE;
1448 while ( nIdx-- > 0 && sText[nIdx] ==
'\t' )
1463 bool bSingleCellTable =
false;
1471 sal_uInt16 nSourceOptions =
1472 (( SotExchangeDest::DOC_TEXTFRAME == nDestination ||
1473 SotExchangeDest::SWDOC_FREE_AREA == nDestination ||
1474 SotExchangeDest::DOC_TEXTFRAME_WEB == nDestination ||
1475 SotExchangeDest::SWDOC_FREE_AREA_WEB == nDestination )
1485 nFormat, nEventAction, SotClipboardFormatId::NONE,
1491 if (rData.
HasFormat(SotClipboardFormatId::HTML_SIMPLE) && rData.
HasFormat(SotClipboardFormatId::HTML_NO_COMMENT)
1492 && rData.
HasFormat(SotClipboardFormatId::BITMAP) && nFormat == SotClipboardFormatId::FILE_LIST)
1493 nFormat = SotClipboardFormatId::BITMAP;
1500 rData.
HasFormat( SotClipboardFormatId::SYLK_BIGCAPS ) ) )
1504 if( rData.
GetString( SotClipboardFormatId::STRING, aExpand ))
1507 const sal_Int32 nRows = nNewlines ? nNewlines-1 : 0;
1512 bSingleCellTable =
true;
1517 if (!bSingleCellTable && rData.
HasFormat( SotClipboardFormatId::HTML ) &&
1521 sal_uInt32 nLevel = 0;
1532 OUString sPreviousTableName;
1538 if ( sTableName == sPreviousTableName )
1540 sPreviousTableName = sTableName;
1542 pDispatch->
Execute(FN_INSERT_NNBSP, SfxCallMode::SYNCHRON);
1552 nDestination,
false,
false,
nullptr, 0,
false, nAnchorType, bIgnoreComments, &aPasteContext, ePasteTable) )
1554 bool bFoundTemporaryTable =
false;
1558 bFoundTemporaryTable =
true;
1560 pDispatch->
Execute(SID_COPY, SfxCallMode::SYNCHRON);
1562 for(sal_uInt32
a = 0;
a < 1 + (nLevel * 2);
a++)
1563 pDispatch->
Execute(SID_UNDO, SfxCallMode::SYNCHRON);
1566 if (!bFoundTemporaryTable)
1575 pDispatch->
Execute(SID_PASTE, SfxCallMode::SYNCHRON);
1578 for(sal_uInt32
a = 0;
a < (nLevel * 2);
a++)
1579 pDispatch->
Execute(SID_UNDO, SfxCallMode::SYNCHRON);
1585 rData.
HasFormat( SotClipboardFormatId::HTML ) &&
1591 if( rData.
GetString( SotClipboardFormatId::HTML, aExpand ) && (nIdx = aExpand.indexOf(
"<table")) > -1 )
1601 bool bShifted =
lcl_getLevel(aExpand, aExpand.indexOf(
"<thead")) == nTableLevel + 1;
1603 sal_Int32 nSelectedRowsOrCols = 0;
1604 const OUString sSearchRowOrCol = bRowMode ? OUString(
"</tr>") : OUString(
"<col ");
1605 while((nIdx = aExpand.indexOf(sSearchRowOrCol, nIdx)) > -1)
1608 if (
lcl_getLevel(aExpand, nIdx) == nTableLevel + (bShifted ? 2 : 1) &&
1610 !aExpand.match(
"<tr></tr>", nIdx - 4) )
1612 ++nSelectedRowsOrCols;
1617 bool bStartTableBoxNode =
1625 if (!bStartTableBoxNode)
1642 pDispatch->
Execute(nDispatchSlot, SfxCallMode::SYNCHRON);
1646 if ( nSelectedRowsOrCols > 1 )
1648 SfxInt16Item aCountItem( nDispatchSlot, nSelectedRowsOrCols-1 );
1651 SfxCallMode::SYNCHRON|SfxCallMode::RECORD,
1652 { &aCountItem, &aAfter });
1660 nDestination,
false,
false,
nullptr, 0,
false, nAnchorType, bIgnoreComments, &aPasteContext );
1670 if (pMark !=
nullptr)
1683 if( rData.
HasFormat( SotClipboardFormatId::RTF ) )
1686 nFormat = SotClipboardFormatId::RTF;
1688 else if( rData.
HasFormat( SotClipboardFormatId::RICHTEXT ) )
1691 nFormat = SotClipboardFormatId::RICHTEXT;
1699 collectUIInformation(
"PASTE",
"parameter");
1703 nDestination,
false,
false,
nullptr, 0,
false, nAnchorType, bIgnoreComments, &aPasteContext, ePasteTable);
1711 const Point* pPt,
sal_Int8 nDropAction,
1712 bool bPasteSelection,
RndStdIds nAnchorType,
1713 bool bIgnoreComments,
1718 std::unique_ptr<SwTrnsfrActionAndUndo, o3tl::default_delete<SwTrnsfrActionAndUndo>> pAction;
1722 bool bCallAutoCaption =
false;
1729 switch( nDestination )
1731 case SotExchangeDest::DOC_LNKD_GRAPH_W_IMAP:
1732 case SotExchangeDest::DOC_LNKD_GRAPHOBJ:
1733 case SotExchangeDest::DOC_GRAPH_W_IMAP:
1734 case SotExchangeDest::DOC_GRAPHOBJ:
1735 case SotExchangeDest::DOC_OLEOBJ:
1736 case SotExchangeDest::DOC_DRAWOBJ:
1737 case SotExchangeDest::DOC_URLBUTTON:
1738 case SotExchangeDest::DOC_GROUPOBJ:
1759 bool bDelSel =
false;
1760 switch( nDestination )
1762 case SotExchangeDest::DOC_TEXTFRAME:
1763 case SotExchangeDest::SWDOC_FREE_AREA:
1764 case SotExchangeDest::DOC_TEXTFRAME_WEB:
1765 case SotExchangeDest::SWDOC_FREE_AREA_WEB:
1774 pAction.reset(
new SwTrnsfrActionAndUndo(&rSh,
true, pContext));
1780 bool bPrivateDrop(pPt);
1783 if (bPasteSelection)
1787 bPrivateDrop =
nullptr != pTrans;
1789 bool bNeedToSelectBeforePaste(
false);
1794 bPrivateDrop =
false;
1795 bNeedToSelectBeforePaste =
true;
1806 bPrivateDrop =
false;
1807 bNeedToSelectBeforePaste =
true;
1817 else if( !pPt && pTunneledTrans &&
1821 bRet = pTunneledTrans->PrivatePaste(rSh, pContext, ePasteTable);
1827 pAction.reset(
new SwTrnsfrActionAndUndo( &rSh ));
1831 bool bMsg =
nullptr == pPt;
1838 OSL_ENSURE( pPt,
"EXCHG_OUT_ACTION_INSERT_PRIVATE: what should happen here?" );
1842 OSL_ENSURE( pPt,
"EXCHG_OUT_ACTION_MOVE_PRIVATE: what should happen here?" );
1856 case SotClipboardFormatId::DRAWING:
1859 nActionFlags, bNeedToSelectBeforePaste);
1862 case SotClipboardFormatId::HTML:
1863 case SotClipboardFormatId::HTML_SIMPLE:
1864 case SotClipboardFormatId::HTML_NO_COMMENT:
1865 case SotClipboardFormatId::RTF:
1866 case SotClipboardFormatId::RICHTEXT:
1867 case SotClipboardFormatId::STRING:
1869 nFormat, bMsg, bIgnoreComments );
1872 case SotClipboardFormatId::NETSCAPE_BOOKMARK:
1884 case SotClipboardFormatId::SD_OLE:
1886 nActionFlags, bMsg );
1889 case SotClipboardFormatId::SVIM:
1893 case SotClipboardFormatId::SVXB:
1894 case SotClipboardFormatId::BITMAP:
1895 case SotClipboardFormatId::PNG:
1896 case SotClipboardFormatId::GDIMETAFILE:
1899 nActionFlags, nDropAction, bNeedToSelectBeforePaste);
1902 case SotClipboardFormatId::XFORMS:
1903 case SotClipboardFormatId::SBA_FIELDDATAEXCHANGE:
1904 case SotClipboardFormatId::SBA_DATAEXCHANGE:
1905 case SotClipboardFormatId::SBA_CTRLDATAEXCHANGE:
1911 case SotClipboardFormatId::SIMPLE_FILE:
1918 pPt, nActionFlags,
nullptr );
1921 case SotClipboardFormatId::FILE_LIST:
1928 case SotClipboardFormatId::SONLK:
1932 if( aBkmk.
Paste( rData ) )
1949 case SotClipboardFormatId::INET_IMAGE:
1950 case SotClipboardFormatId::NETSCAPE_IMAGE:
1957 OSL_ENSURE( pPt,
"unknown format" );
1963 bool graphicInserted;
1968 if( graphicInserted )
1969 bCallAutoCaption =
true;
1975 nActionFlags,bMsg );
1987 OUString sURL, sDesc;
1988 if( SotClipboardFormatId::SIMPLE_FILE == nFormat )
1990 if( rData.
GetString( nFormat, sURL ) && !sURL.isEmpty() )
1993 if( sDesc.isEmpty() )
2020 case SotClipboardFormatId::DRAWING:
2023 nActionFlags, bNeedToSelectBeforePaste);
2025 case SotClipboardFormatId::SVXB:
2026 case SotClipboardFormatId::GDIMETAFILE:
2027 case SotClipboardFormatId::BITMAP:
2028 case SotClipboardFormatId::PNG:
2029 case SotClipboardFormatId::NETSCAPE_BOOKMARK:
2030 case SotClipboardFormatId::SIMPLE_FILE:
2031 case SotClipboardFormatId::FILEGRPDESCRIPTOR:
2032 case SotClipboardFormatId::UNIFORMRESOURCELOCATOR:
2035 nActionFlags, nDropAction, bNeedToSelectBeforePaste);
2038 OSL_FAIL(
"unknown format" );
2046 nActionFlags, bNeedToSelectBeforePaste);
2054 nActionFlags, nDropAction, bNeedToSelectBeforePaste, nAnchorType );
2060 nActionFlags, bNeedToSelectBeforePaste);
2069 nActionFlags, nDropAction, bNeedToSelectBeforePaste);
2077 OSL_FAIL(
"unknown action" );
2089 if( bCallAutoCaption )
2109 bLink = !aDummy.isEmpty();
2111 if( bLink && bIMap )
2112 nRet = SotExchangeDest::DOC_LNKD_GRAPH_W_IMAP;
2114 nRet = SotExchangeDest::DOC_LNKD_GRAPHOBJ;
2116 nRet = SotExchangeDest::DOC_GRAPH_W_IMAP;
2118 nRet = SotExchangeDest::DOC_GRAPHOBJ;
2124 nRet = SotExchangeDest::DOC_TEXTFRAME_WEB;
2126 nRet = SotExchangeDest::DOC_TEXTFRAME;
2128 case OBJCNT_OLE: nRet = SotExchangeDest::DOC_OLEOBJ;
break;
2131 case OBJCNT_SIMPLE: nRet = SotExchangeDest::DOC_DRAWOBJ;
break;
2139 nRet = SotExchangeDest::SWDOC_FREE_AREA_WEB;
2141 nRet = SotExchangeDest::SWDOC_FREE_AREA;
2162 case SotClipboardFormatId::STRING:
2171 pStream->
SetEndian( SvStreamEndian::BIG );
2173 pStream->
SetEndian( SvStreamEndian::LITTLE );
2187 if( ( SotClipboardFormatId::HTML_SIMPLE == nFormat ) ||
2188 ( SotClipboardFormatId::HTML_NO_COMMENT == nFormat ) )
2190 pStream = aMSE40ClpObj.
IsValid( *xStrm );
2195 ( nFormat == SotClipboardFormatId::HTML_NO_COMMENT );
2200 pStream = xStrm.
get();
2201 if( SotClipboardFormatId::RTF == nFormat || SotClipboardFormatId::RICHTEXT == nFormat)
2213 if( pStream && pRead )
2222 if (bIgnoreComments)
2226 pResId = STR_ERROR_CLPBRD_READ;
2238 pResId = STR_CLPBRD_FORMAT_ERROR;
2241 if( pStream && !xStrm.
is() )
2247 VclMessageType::Info, VclButtonsType::Ok,
2259 uno::Reference < io::XInputStream > xStrm;
2260 uno::Reference < embed::XStorage > xStore;
2265 if( rData.
HasFormat( SotClipboardFormatId::EMBEDDED_OBJ ) )
2266 nId = SotClipboardFormatId::EMBEDDED_OBJ;
2267 else if( rData.
HasFormat( SotClipboardFormatId::EMBED_SOURCE ) &&
2268 rData.
HasFormat( SotClipboardFormatId::OBJECTDESCRIPTOR ))
2269 nId = SotClipboardFormatId::EMBED_SOURCE;
2271 nId = SotClipboardFormatId::NONE;
2273 if (
nId != SotClipboardFormatId::NONE)
2288 case SotClipboardFormatId::STARWRITER_60:
2289 case SotClipboardFormatId::STARWRITERWEB_60:
2290 case SotClipboardFormatId::STARWRITERGLOB_60:
2291 case SotClipboardFormatId::STARWRITER_8:
2292 case SotClipboardFormatId::STARWRITERWEB_8:
2293 case SotClipboardFormatId::STARWRITERGLOB_8:
2302 catch (
const uno::Exception&)
2309 catch (
const uno::Exception&)
2318 SwReader aReader(xStore, OUString(), rPAM);
2324 VclMessageType::Info, VclButtonsType::Ok,
2325 SwResId(STR_ERROR_CLPBRD_READ)));
2332 uno::Reference< embed::XStorage > xTmpStor;
2333 uno::Reference < embed::XEmbeddedObject > xObj;
2341 OSL_ENSURE( !xStrm.is(),
"An object without descriptor in clipboard!");
2348 xStrm = rData.
GetInputStream(SotClipboardFormatId::EMBED_SOURCE_OLE, OUString());
2350 xStrm = rData.
GetInputStream(SotClipboardFormatId::EMBEDDED_OBJ_OLE, OUString());
2358 uno::Reference < embed::XEmbedObjectClipboardCreator > xClipboardCreator =
2359 embed::MSOLEObjectSystemCreator::create( ::comphelper::getProcessComponentContext() );
2361 embed::InsertedObjectInfo aInfo = xClipboardCreator->createInstanceInitFromClipboard(
2364 uno::Sequence< beans::PropertyValue >() );
2368 xObj = aInfo.Object;
2370 catch (
const uno::Exception&)
2375 else if (rData.
HasFormat(SotClipboardFormatId::SIMPLE_FILE))
2378 if (rData.
GetString(nFormat, sFile) && !sFile.isEmpty())
2389 if ( xStrm.is() && !xObj.is() )
2402 if (rData.
GetGDIMetaFile(SotClipboardFormatId::GDIMETAFILE, aMetafile, 100000))
2404 nGrFormat = SotClipboardFormatId::GDIMETAFILE;
2405 aGraphic = aMetafile;
2409 if ( nGrFormat != SotClipboardFormatId::NONE )
2411 DataFlavor aDataFlavor;
2413 xObjRef.
SetGraphic( aGraphic, aDataFlavor.MimeType );
2415 else if ( aObjDesc.
mnViewAspect == embed::Aspects::MSOLE_ICON )
2420 MapMode aMapMode( MapUnit::Map100thMM );
2429 if ( aObjDesc.
mnViewAspect == embed::Aspects::MSOLE_ICON )
2435 MapMode aMapMode( MapUnit::Map100thMM );
2436 aSize = xObjRef.
GetSize( &aMapMode );
2447 aSz = xObj->getVisualAreaSize( aObjDesc.
mnViewAspect );
2449 catch (
const embed::NoVisualAreaSizeException&)
2454 if ( aSz.Width != aSize.
Width() || aSz.Height != aSize.
Height() )
2456 aSz.Width = aSize.
Width();
2457 aSz.Height = aSize.
Height();
2470 catch (
const uno::Exception&)
2479 if( bRet && ( nActionFlags & SotExchangeActionFlags::InsertTargetUrl) )
2491 const Point* pPt,
bool bInsertGRF )
2495 if( ( rData.
HasFormat( SotClipboardFormatId::INET_IMAGE ) &&
2496 rData.
GetINetImage( SotClipboardFormatId::INET_IMAGE, aINetImg )) ||
2497 ( rData.
HasFormat( SotClipboardFormatId::NETSCAPE_IMAGE ) &&
2498 rData.
GetINetImage( SotClipboardFormatId::NETSCAPE_IMAGE, aINetImg )) )
2500 if( !aINetImg.
GetImageURL().isEmpty() && bInsertGRF )
2513 lclCheckAndPerformRotation(aGraphic);
2530 rSh.
ReRead(sURL, OUString(), &aGraphic);
2535 rSh.
Paste( aGraphic, OUString() );
2537 rSh.
ReRead(sURL, OUString(), &aGraphic);
2602 rSh.SwCursorShell::SetCursor( *pPt,
true );
2611 OUString aApp, aTopic, aItem;
2617 OSL_ENSURE(
false,
"DDE Data not found." );
2621 rtl_TextEncoding eEncoding = osl_getThreadTextEncoding();
2632 if( !rData.
HasFormat( SotClipboardFormatId::RTF ) &&
2633 !rData.
HasFormat( SotClipboardFormatId::RICHTEXT ) &&
2634 !rData.
HasFormat( SotClipboardFormatId::HTML ) &&
2635 !rData.
HasFormat( SotClipboardFormatId::STRING ) &&
2636 (rData.
HasFormat( nFormat = SotClipboardFormatId::GDIMETAFILE ) ||
2637 rData.
HasFormat( nFormat = SotClipboardFormatId::BITMAP )) )
2640 bool bRet = rData.
GetGraphic( nFormat, aGrf );
2643 OUString sLnkTyp(
"DDE");
2645 rWrtShell.
ReRead( aCmd, sLnkTyp, &aGrf );
2656 bool bDoublePaste =
false;
2661 aName = aApp + OUString::number(
i );
2671 bDoublePaste =
true;
2682 while( !bDoublePaste );
2693 if( rData.
GetString( SotClipboardFormatId::STRING, aExpand ))
2699 if( !aExpand.isEmpty() &&
2700 ( rData.
HasFormat( SotClipboardFormatId::SYLK ) ||
2701 rData.
HasFormat( SotClipboardFormatId::SYLK_BIGCAPS ) ) )
2703 sal_Int32 nRows = nNewlines ? nNewlines-1 : 0;
2704 if (!aExpand.endsWith(
"\n"))
2714 VclMessageType::Info, VclButtonsType::Ok,
2715 SwResId(STR_TABLE_TOO_LARGE)));
2723 if( !nRows || !nCols )
2728 VclMessageType::Info, VclButtonsType::Ok,
2738 pDDETyp, nRows, nCols );
2740 else if( nNewlines > 1 )
2765 if( !pDDETyp && !bDoublePaste )
2789 if(bNeedToSelectBeforePaste && pPt)
2796 rSh.
Paste( *xStrm, nAction, pPt );
2799 if( bRet && ( nActionFlags & SotExchangeActionFlags::InsertTargetUrl ))
2813 bool bCheckForGrf =
false, bCheckForImageMap =
false;
2817 case SotClipboardFormatId::BITMAP:
2818 case SotClipboardFormatId::PNG:
2819 case SotClipboardFormatId::GDIMETAFILE:
2820 bRet = rData.
GetGraphic( nFormat, aGraphic );
2823 case SotClipboardFormatId::SVXB:
2831 bRet = (GraphicType::NONE != aGraphic.
GetType() && GraphicType::Default != aGraphic.
GetType());
2837 case SotClipboardFormatId::NETSCAPE_BOOKMARK:
2838 case SotClipboardFormatId::FILEGRPDESCRIPTOR:
2839 case SotClipboardFormatId::UNIFORMRESOURCELOCATOR:
2844 nFormat = SotClipboardFormatId::NETSCAPE_BOOKMARK;
2846 bCheckForGrf =
true;
2850 case SotClipboardFormatId::SIMPLE_FILE:
2853 bRet = rData.
GetString( nFormat, sText );
2871 if (sText.startsWithIgnoreAsciiCase(
"file:"))
2875 osl::FileBase::getSystemPathFromFileURL(sText, sSysPath);
2877 DWORD nCopied = GetLongPathNameW(o3tl::toW(sSysPath.getStr()),
2878 o3tl::toW(
aBuf.get()), 32767);
2879 if (nCopied && nCopied < 32767)
2886 bCheckForGrf =
true;
2893 bRet = rData.
GetGraphic( nFormat, aGraphic );
2905 SotClipboardFormatId::SIMPLE_FILE == nFormat &&
2910 nFormat = SotClipboardFormatId::NETSCAPE_BOOKMARK;
2915 if(pPt && bNeedToSelectBeforePaste)
2927 lclCheckAndPerformRotation(aGraphic);
2942 rSh.
InsertGraphic(sURL, OUString(), aGraphic,
nullptr, nAnchorType);
2954 rSh.
Paste( aGraphic, sURL );
2963 rSh.
ReRead(sURL, OUString(), &aGraphic);
2971 if( SotClipboardFormatId::NETSCAPE_BOOKMARK == nFormat )
2986 rSh.
Paste( aGraphic, sURL );
2991 rSh.
ReRead(sURL, OUString(), &aGraphic);
3012 ( SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::ReplaceImageMap ) )
3015 if( nActionFlags & SotExchangeActionFlags::InsertTargetUrl )
3018 else if( bCheckForImageMap )
3023 StreamMode::STD_READ );
3025 if( pStream !=
nullptr &&
3029 aMap.GetIMapObjectCount() )
3048 if( rData.
HasFormat( SotClipboardFormatId::SVIM ))
3057 if( rData.
GetImageMap( SotClipboardFormatId::SVIM, aImageMap ) &&
3058 ( !pOld || aImageMap != *pOld ))
3060 aURL.SetMap( &aImageMap );
3074 if( rData.
GetString( nFormat, sFile ) && !sFile.isEmpty() )
3081 aURL.SetSmartProtocol( INetProtocol::File );
3082 aURL.SetSmartURL( sFile );
3094 aURL2.
SetURL( sFile,
false );
3095 if( aURL2.
GetName().isEmpty() )
3105 sDesc.isEmpty() ? sFile : sDesc);
3117 bool * graphicInserted)
3120 pPt, nActionFlags, 0,
false);
3121 if (graphicInserted !=
nullptr) {
3122 *graphicInserted = bRet;
3126 OUString sFile, sDesc;
3127 if( rData.
GetString( nFormat, sFile ) && !sFile.isEmpty() )
3129#if HAVE_FEATURE_AVMEDIA
3137 const SfxStringItem aMediaURLItem( SID_INSERT_AVMEDIA, aMediaURLStr );
3139 SID_INSERT_AVMEDIA, SfxCallMode::SYNCHRON,
3140 { &aMediaURLItem });
3170 PasteOLE(rData, rSh, nFormat, nActionFlags,
nullptr == pPt);
3179 aURL.SetSmartProtocol( INetProtocol::File );
3180 aURL.SetSmartURL( sFile );
3192 aURL2.
SetURL( sFile,
false );
3193 if( aURL2.
GetName().isEmpty() )
3203 sDesc.isEmpty() ? sFile : sDesc );
3216 const Point* pDragPt,
bool bMsg )
3220 if( rData.
GetString( nFormat, sText ) && !sText.isEmpty() )
3222 sal_uInt16 nWh = SotClipboardFormatId::SBA_CTRLDATAEXCHANGE == nFormat
3224 : SotClipboardFormatId::SBA_DATAEXCHANGE == nFormat
3232 bool bHaveColumnDescriptor = OColumnTransferable::canExtractColumnDescriptor(rVector, ColumnTransferFormatFlags::COLUMN_DESCRIPTOR | ColumnTransferFormatFlags::CONTROL_EXCHANGE);
3233 if ( SotClipboardFormatId::XFORMS == nFormat )
3237 if (pFmView && pDragPt)
3239 const OXFormsDescriptor &rDesc = OXFormsTransferable::extractDescriptor(rData);
3243 rSh.SwFEShell::InsertDrawObj( *pObj, *pDragPt );
3249 std::unique_ptr<SfxUnoAnyItem> pConnectionItem;
3250 std::unique_ptr<SfxUnoAnyItem> pCursorItem;
3251 std::unique_ptr<SfxUnoAnyItem> pColumnItem;
3252 std::unique_ptr<SfxUnoAnyItem> pSourceItem;
3253 std::unique_ptr<SfxUnoAnyItem> pCommandItem;
3254 std::unique_ptr<SfxUnoAnyItem> pCommandTypeItem;
3255 std::unique_ptr<SfxUnoAnyItem> pColumnNameItem;
3256 std::unique_ptr<SfxUnoAnyItem> pSelectionItem;
3258 bool bDataAvailable =
true;
3259 ODataAccessDescriptor aDesc;
3260 if(bHaveColumnDescriptor)
3261 aDesc = OColumnTransferable::extractColumnDescriptor(rData);
3262 else if(ODataAccessObjectTransferable::canExtractObjectDescriptor(rVector) )
3263 aDesc = ODataAccessObjectTransferable::extractObjectDescriptor(rData);
3265 bDataAvailable =
false;
3267 if ( bDataAvailable )
3285 nWh, SfxCallMode::ASYNCHRON,
3286 { &aDataDesc, pConnectionItem.get(), pColumnItem.get(),
3287 pSourceItem.get(), pCommandItem.get(), pCommandTypeItem.get(),
3288 pColumnNameItem.get(), pSelectionItem.get(),
3289 pCursorItem.get() });
3295 if (pFmView && bHaveColumnDescriptor && pDragPt)
3299 rSh.SwFEShell::InsertDrawObj( *pObj, *pDragPt );
3307 VclMessageType::Info, VclButtonsType::Ok,
3308 SwResId(STR_CLPBRD_FORMAT_ERROR)));
3316 const Point* pPt,
bool bMsg )
3320 if( rData.
GetFileList( SotClipboardFormatId::FILE_LIST, aFileList ) &&
3329 pHlp->CopyString( SotClipboardFormatId::SIMPLE_FILE, aFileList.
GetFile(
n ));
3333 pPt, SotExchangeActionFlags::NONE,
nullptr ))
3343 if( !sFlyNm.isEmpty() )
3349 VclMessageType::Info, VclButtonsType::Ok,
3350 SwResId(STR_CLPBRD_FORMAT_ERROR)));
3357 OUString& rFileName, OUString* pTitle )
3359 bool bIsURLFile =
false;
3363 rFileName = aBkmk.
GetURL();
3370 if( rFileName.getLength()>4 && rFileName.endsWithIgnoreAsciiCase(
".url") )
3372 OSL_ENSURE(
false,
"how do we read today .URL - Files?" );
3384 return aClipboardFormatItem.
Count() > 0;
3403 nPrivateFormat = SotClipboardFormatId::EMBED_SOURCE;
3405 if( pClipboard && nPrivateFormat == nFormat )
3412 sal_uInt16 nSourceOptions =
3413 (( SotExchangeDest::DOC_TEXTFRAME == nDestination ||
3414 SotExchangeDest::SWDOC_FREE_AREA == nDestination ||
3415 SotExchangeDest::DOC_TEXTFRAME_WEB == nDestination ||
3416 SotExchangeDest::SWDOC_FREE_AREA_WEB == nDestination )
3425 nFormat, nEventAction, nFormat,
3431 nDestination,
true,
false );
3447 nEventAction, nFormat,
3459 SotClipboardFormatId::HTML,
3460 SotClipboardFormatId::HTML_SIMPLE,
3461 SotClipboardFormatId::HTML_NO_COMMENT,
3462 SotClipboardFormatId::RTF,
3463 SotClipboardFormatId::RICHTEXT,
3464 SotClipboardFormatId::STRING,
3465 SotClipboardFormatId::SONLK,
3466 SotClipboardFormatId::NETSCAPE_BOOKMARK,
3467 SotClipboardFormatId::DRAWING,
3468 SotClipboardFormatId::SVXB,
3469 SotClipboardFormatId::GDIMETAFILE,
3470 SotClipboardFormatId::BITMAP,
3471 SotClipboardFormatId::SVIM,
3472 SotClipboardFormatId::FILEGRPDESCRIPTOR,
3473 SotClipboardFormatId::NONE
3495 pResId = STR_PRIVATETEXT;
3497 pResId = STR_PRIVATEGRAPHIC;
3499 pResId = STR_PRIVATEOLE;
3503 if (STR_PRIVATEOLE == pResId || STR_PRIVATEGRAPHIC == pResId)
3508 aFlavorEx.
mnSotId = SotClipboardFormatId::EMBED_SOURCE;
3509 aFormats.insert( aFormats.begin(), aFlavorEx );
3513 pDlg->Insert( SotClipboardFormatId::EMBED_SOURCE, OUString() );
3518 if( rData.
HasFormat( SotClipboardFormatId::OBJECTDESCRIPTOR ) )
3521 SotClipboardFormatId::OBJECTDESCRIPTOR, aDesc );
3525 pDlg->Insert( SotClipboardFormatId::EMBED_SOURCE, OUString() );
3527 pDlg->Insert( SotClipboardFormatId::LINK_SOURCE, OUString() );
3531 pDlg->Insert( SotClipboardFormatId::LINK,
SwResId(STR_DDEFORMAT) );
3535 pDlg->Insert( *pIds, OUString() );
3549 pResId = STR_PRIVATETEXT;
3551 pResId = STR_PRIVATEGRAPHIC;
3553 pResId = STR_PRIVATEOLE;
3562 if (rData.
HasFormat(SotClipboardFormatId::OBJECTDESCRIPTOR))
3565 SotClipboardFormatId::OBJECTDESCRIPTOR, aDesc);
3575 if ( rData.
HasFormat(nFormat = SotClipboardFormatId::EMBED_SOURCE_OLE) || rData.
HasFormat(nFormat = SotClipboardFormatId::EMBEDDED_OBJ_OLE) )
3577 OUString
sName,sSource;
3599 AddFormat( SotClipboardFormatId::SVXB );
3603 AddFormat( SotClipboardFormatId::GDIMETAFILE );
3605 AddFormat( SotClipboardFormatId::BITMAP );
3612 AddFormat( SotClipboardFormatId::EMBED_SOURCE );
3614 AddFormat( SotClipboardFormatId::OBJECTDESCRIPTOR );
3615 AddFormat( SotClipboardFormatId::GDIMETAFILE );
3635 AddFormat( SotClipboardFormatId::EMBED_SOURCE );
3641 AddFormat( SotClipboardFormatId::RICHTEXT );
3642 AddFormat( SotClipboardFormatId::HTML );
3645 AddFormat( SotClipboardFormatId::STRING );
3649 AddFormat( SotClipboardFormatId::DRAWING );
3652 AddFormat( SotClipboardFormatId::GDIMETAFILE );
3654 AddFormat( SotClipboardFormatId::BITMAP );
3663 AddFormat( SotClipboardFormatId::STRING );
3664 AddFormat( SotClipboardFormatId::SOLK );
3665 AddFormat( SotClipboardFormatId::NETSCAPE_BOOKMARK );
3666 AddFormat( SotClipboardFormatId::FILECONTENT );
3667 AddFormat( SotClipboardFormatId::FILEGRPDESCRIPTOR );
3668 AddFormat( SotClipboardFormatId::UNIFORMRESOURCELOCATOR );
3680 AddFormat( SotClipboardFormatId::OBJECTDESCRIPTOR );
3690 AddFormat( SotClipboardFormatId::STRING );
3691 AddFormat( SotClipboardFormatId::SOLK );
3692 AddFormat( SotClipboardFormatId::NETSCAPE_BOOKMARK );
3693 AddFormat( SotClipboardFormatId::FILECONTENT );
3694 AddFormat( SotClipboardFormatId::FILEGRPDESCRIPTOR );
3695 AddFormat( SotClipboardFormatId::UNIFORMRESOURCELOCATOR );
3709 AddFormat( SotClipboardFormatId::SVIM );
3711 else if( !rURL.
GetURL().isEmpty() )
3715 AddFormat( SotClipboardFormatId::INET_IMAGE );
3731 SW_MOD()->m_pDragDrop =
this;
3738 nDragOptions &= ~DND_ACTION_MOVE;
3790bool lcl_checkClassification(
SwDoc* pSourceDoc,
SwDoc* pDestinationDoc)
3792 if (!pSourceDoc || !pDestinationDoc)
3797 if (!pSourceShell || !pDestinationShell)
3810 OSL_ENSURE( !rShell.
ActionPend(),
"Paste must never have an ActionPend" );
3816 SwTrnsfrActionAndUndo aAction( &rShell );
3818 bool bKillPaMs =
false;
3841 rShell.SwCursorShell::SetCursor( aPt,
true );
3853 bool bInWrd =
false, bEndWrd =
false, bSttWrd =
false,
3862 bSmart = bInWrd || bEndWrd;
3866 if (!bSttWrd && (bInWrd || bEndWrd))
3867 rShell.SwEditShell::Insert(
' ');
3880 if( bRet && bSmart && ((bInWrd && !bEndWrd )|| bSttWrd) )
3881 rShell.SwEditShell::Insert(
' ');
3887 bool bMove,
bool bIsXSelection )
3890 bool bInWrd =
false;
3891 bool bEndWrd =
false;
3892 bool bSttWrd =
false;
3893 bool bSttPara =
false;
3894 bool bTableSel =
false;
3895 bool bTableMove =
false;
3896 bool bFrameSel =
false;
3981 sal_Int32 nSelRows = !rBoxes.
back()
3985 bool bSelUpToDown = rBoxes.
back() && rBoxes.
back()->GetUpper() ==
3995 rSrcSh.
StartUndo( eUndoId, &aRewriter );
4002 pDispatch->
Execute(SID_COPY, SfxCallMode::SYNCHRON);
4006 rSh.SwCursorShell::SetCursor(rDragPt,
false);
4023 if (bNeedTrack && pMark !=
nullptr)
4026 if ( !bNeedTrack && !bPasteIntoTable )
4041 for (sal_Int32 nDeleted = 0; bNeedTrack && nDeleted < nSelRows;)
4044 if ( !rSh.
Up(
false) )
4069 if (pMarkMoveFrom !=
nullptr)
4076 if ( bNeedTrack || ( bSelUpToDown && nSelRows > 1 ) )
4080 for (sal_Int32 nDeleted = 0; nDeleted < nSelRows -
int(!bNeedTrack);)
4097 bool bMoved =
false;
4099 bMoved = rSh.
Up(
false);
4101 bMoved = rSh.
Down(
false);
4110 for (sal_Int32 nDeleted = 0; nDeleted < nSelRows; ++nDeleted)
4119 if (pMark !=
nullptr)
4153 rSrcSh.
StartUndo( eUndoId, &aRewriter );
4159 if( &rSrcSh != &rSh )
4162 rSh.SwCursorShell::SetCursor( rDragPt,
true );
4165 else if( !bTableSel && !bFrameSel )
4176 rSh.SwCursorShell::CreateCursor();
4178 rSh.SwCursorShell::SetCursor( rDragPt,
true,
false );
4194 if( &rSrcSh == &rSh )
4197 rSh.SwCursorShell::SetCursor( aSttPt,
true );
4212 rSrcSh.SwCursorShell::SetCursor( aSttPt,
true );
4228 bool bRet = rSrcSh.SwFEShell::Copy(rSh, aSttPt, rDragPt, bMove,
4231 if( !bIsXSelection )
4234 if ( bRet && bMove && !bFrameSel )
4244 rSh.SwCursorShell::DestroyCursor();
4257 if( &rSh == &rSrcSh && ( bTableSel || rSh.
IsBlockMode() ) )
4260 rSrcSh.SwCursorShell::SetCursor(rDragPt);
4265 if( bRet && !bTableSel && !bFrameSel )
4267 if( (bInWrd || bEndWrd) &&
4271 if ( bSttWrd || (bInWrd && !bEndWrd))
4272 rSh.SwEditShell::Insert(
' ', bIsXSelection);
4273 if ( !bSttWrd || (bInWrd && !bSttPara) )
4277 rSh.SwEditShell::Insert(
' ', bIsXSelection);
4284 if( &rSrcSh == &rSh && !rSh.
IsAddMode() )
4286 rSh.SwCursorShell::DestroyCursor();
4292 rSh.SwCursorShell::ClearMark();
4298 rSh.SwCursorShell::CreateCursor();
4307 else if ( bRet && bTableMove )
4313 if( bRet && bMove && bFrameSel )
4336 pNew->m_pCreatorView = _pCreatorView;
4339 pNew->CopyToPrimarySelection();
4360 : m_rTransfer(rTrans)
4361 , m_pDocShell(nullptr)
4363 , m_bDelBookmark(false)
4364 , m_bInDisconnect(false)
4387 m_bDelBookmark =
true;
4401 m_xRefObj = m_pDocShell->DdeCreateLinkSource( m_sName );
4402 if( m_xRefObj.is() )
4404 m_xRefObj->AddConnectAdvise(
this );
4405 m_xRefObj->AddDataAdvise(
this,
4407 ADVISEMODE_NODATA | ADVISEMODE_ONLYONCE );
4408 m_nOldTimeOut = m_xRefObj->GetUpdateTimeout();
4409 m_xRefObj->SetUpdateTimeout( 0 );
4413SwTransferDdeLink::~SwTransferDdeLink()
4415 if( m_xRefObj.is() )
4423 if( !m_bInDisconnect )
4425 if( FindDocShell() && m_pDocShell->GetView() )
4426 m_rTransfer.RemoveDDELinkFormat( m_pDocShell->GetView()->GetEditWin() );
4432bool SwTransferDdeLink::WriteData(
SvStream& rStrm )
4434 if( !m_xRefObj.is() || !FindDocShell() )
4437 rtl_TextEncoding eEncoding = osl_getThreadTextEncoding();
4441 m_pDocShell->GetTitle(SFX_TITLE_FULLNAME), eEncoding));
4444 std::unique_ptr<char[]> pMem(
new char[ aAppNm.getLength() + aTopic.getLength() +
aName.getLength() + 4 ]);
4446 sal_Int32 nLen = aAppNm.getLength();
4447 memcpy( pMem.get(), aAppNm.getStr(), nLen );
4449 memcpy( pMem.get() + nLen, aTopic.getStr(), aTopic.getLength() );
4450 nLen = nLen + aTopic.getLength();
4452 memcpy( pMem.get() + nLen,
aName.getStr(),
aName.getLength() );
4453 nLen = nLen +
aName.getLength();
4479 OUString sMarkName = pMark->
GetName();
4491 ::sw::mark::InsertMode::New);
4495 m_bDelBookmark =
false;
4499void SwTransferDdeLink::Disconnect(
bool bRemoveDataAdvise )
4503 bool bOldDisconnect = m_bInDisconnect;
4504 m_bInDisconnect =
true;
4507 if( m_bDelBookmark && m_xRefObj.is() && FindDocShell() )
4509 SwDoc* pDoc = m_pDocShell->GetDoc();
4526 m_bDelBookmark =
false;
4529 if( m_xRefObj.is() )
4531 m_xRefObj->SetUpdateTimeout( m_nOldTimeOut );
4532 m_xRefObj->RemoveConnectAdvise(
this );
4533 if( bRemoveDataAdvise )
4538 m_xRefObj->RemoveAllDataAdvise(
this );
4541 m_bInDisconnect = bOldDisconnect;
4544bool SwTransferDdeLink::FindDocShell()
4549 if( pTmpSh == m_pDocShell )
4551 if( m_pDocShell->GetDoc() )
4558 m_pDocShell =
nullptr;
4562void SwTransferDdeLink::Closed()
4564 if( !m_bInDisconnect && m_xRefObj.is() )
4566 m_xRefObj->RemoveAllDataAdvise(
this );
4567 m_xRefObj->RemoveConnectAdvise(
this );
@ CheckPosInFly
check if target position is in fly anchored at source range
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
static OUString GetAppName()
OUString GetFile(size_t nIndex) const
static GraphicFilter & GetGraphicFilter()
static ErrCode LoadGraphic(const OUString &rPath, const OUString &rFilter, Graphic &rGraphic, GraphicFilter *pFilter=nullptr, sal_uInt16 *pDeterminedFormat=nullptr)
void SetPrefMapMode(const MapMode &rPrefMapMode)
bool IsSupportedGraphic() const
const GDIMetaFile & GetGDIMetaFile() const
GraphicType GetType() const
BitmapEx GetBitmapEx(const GraphicConversionParameters &rParameters=GraphicConversionParameters()) const
void SetPrefSize(const Size &rPrefSize)
virtual bool CopyRange(SwPaM &rPam, SwPosition &rPos, SwCopyFlags flags) const =0
Copy a selected content range to a position.
virtual const SwDrawModel * GetDrawModel() const =0
Draw Model and id accessors.
virtual void LockExpFields()=0
wrapper iterator: wraps iterator of implementation while hiding MarkBase class; only IMark instances ...
Provides access to the marks of a document.
virtual const_iterator_t getAllMarksEnd() const =0
returns a STL-like random access iterator to the end of the sequence of marks.
virtual const_iterator_t findMark(const OUString &rMark) const =0
Finds a mark by name.
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.
virtual std::unique_ptr< ILazyDeleter > deleteMark(const IDocumentMarkAccess::const_iterator_t &ppMark, bool isMoveNodes)=0
Deletes a mark.
virtual const_iterator_t getAllMarksBegin() const =0
returns a STL-like random access iterator to the begin of the sequence of marks.
static SW_DLLPUBLIC MarkType GetType(const ::sw::mark::IMark &rMark)
Returns the MarkType used to create the mark.
static bool IsRedlineOn(const RedlineFlags eM)
virtual void SetRedlineFlags_intern(RedlineFlags eMode)=0
Set a new redline mode.
virtual void SetRedlineFlags(RedlineFlags eMode)=0
Set a new redline mode.
virtual RedlineFlags GetRedlineFlags() const =0
Query the currently set redline mode.
virtual void ResetModified()=0
virtual bool IsModified() const =0
Changes of document?
const OUString & GetDescription() const
const OUString & GetURL() const
const OUString & GetImageURL() const
const OUString & GetTargetFrame() const
const OUString & GetTargetURL() const
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
bool SetSmartURL(std::u16string_view rTheAbsURIRef, EncodeMechanism eMechanism=EncodeMechanism::WasEncoded, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8, FSysStyle eStyle=FSysStyle::Detect)
bool Paste(const TransferableDataHelper &rData)
RegionMode GetDefaultDragType() const
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
void SetReadUTF8(bool bSet)
void SetIgnoreHTMLComments(bool bSet)
SwgReaderOption & GetReaderOpt()
sal_uInt16 GetMasterPageCount() const
const SfxItemPool & GetItemPool() const
const SdrPage * GetPage(sal_uInt16 nPgNum) const
sal_uInt16 GetPageCount() const
const SfxPoolItem & GetMergedItem(const sal_uInt16 nWhich) const
void SetMergedItem(const SfxPoolItem &rItem)
static bool ShowPasteInfo(SfxClassificationCheckPasteResult eResult)
static SfxClassificationCheckPasteResult CheckPaste(const css::uno::Reference< css::document::XDocumentProperties > &xSource, const css::uno::Reference< css::document::XDocumentProperties > &xDestination)
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
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 * >())
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
const INetURLObject & GetURLObject() const
comphelper::EmbeddedObjectContainer & GetEmbeddedObjectContainer() const
css::uno::Reference< css::document::XDocumentProperties > getDocProperties() const
void FillTransferableObjectDescriptor(TransferableObjectDescriptor &rDesc) const
virtual bool DoSaveCompleted(SfxMedium *pNewStor=nullptr, bool bRegisterRecent=true)
static OUString CreateShellID(const SfxObjectShell *pShell)
virtual void SetVisArea(const tools::Rectangle &rVisArea)
bool isContentExtractionLocked() const
static SAL_WARN_UNUSED_RESULT SfxObjectShell * GetNext(const SfxObjectShell &rPrev, const std::function< bool(const SfxObjectShell *)> &isObjectShell=nullptr, bool bOnlyVisible=true)
SfxMedium * GetMedium() const
bool DoSaveObjectAs(SfxMedium &rNewStor, bool bCommit)
void SetupStorage(const css::uno::Reference< css::embed::XStorage > &xStorage, sal_Int32 nVersion, bool bTemplate) const
static SAL_WARN_UNUSED_RESULT SfxObjectShell * GetFirst(const std::function< bool(const SfxObjectShell *)> &isObjectShell=nullptr, bool bOnlyVisible=true)
SfxObjectCreateMode GetCreateMode() const
SfxDispatcher * GetDispatcher()
SfxViewFrame & GetViewFrame() const
virtual SfxObjectShell * GetObjectShell() override
constexpr tools::Long Height() const
constexpr tools::Long Width() const
static bool GetFormatDataFlavor(SotClipboardFormatId nFormat, css::datatransfer::DataFlavor &rFlavor)
static SotClipboardFormatId GetFormat(const css::datatransfer::DataFlavor &rFlavor)
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)
static SotClipboardFormatId GetFormatID(css::uno::Reference< css::embed::XStorage > const &xStorage)
static bool GetEmbeddedName(const TransferableDataHelper &rData, OUString &_rName, OUString &_rSource, SotClipboardFormatId const &_nFormat)
void SetEndian(SvStreamEndian SvStreamEndian)
std::size_t WriteBytes(const void *pData, std::size_t nSize)
sal_uInt32 GetHeight() const
void SetCharSet(rtl_TextEncoding nVal)
virtual sal_Int32 Len() const
void Push()
store a copy of the current cursor on the cursor stack
const SwTableNode * IsCursorInTable() const
bool GoPrevCursor()
go to the previous SSelection
const SwRect & GetCharRect() const
const Link< LinkParamNone *, void > & GetChgLnk() const
Point & GetCursorDocPos() const
bool IsInWord(sal_Int16 nWordType=css::i18n::WordType::ANYWORD_IGNOREWHITESPACES) const
::sw::mark::IMark * SetBookmark(const vcl::KeyCode &, const OUString &rName, IDocumentMarkAccess::MarkType eMark=IDocumentMarkAccess::MarkType::BOOKMARK)
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
bool ExtendSelection(bool bEnd=true, sal_Int32 nCount=1)
extend current SSelection by n characters
bool ShouldWait() const
Should WaitPtr be switched on for the clipboard?
bool GoNextCursor()
go to the next SSelection
SwPaM * CreateCursor()
delete the current cursor and make the following into the current
void EndAction(const bool bIdleEnd=false)
bool TestCurrPam(const Point &rPt, bool bTstHit=false)
Search in the selected area for a Selection that covers the given point.
const SwShellTableCursor * GetTableCursor() const
void DestroyCursor()
transform TableCursor to normal cursor, nullify Tablemode
void SetChgLnk(const Link< LinkParamNone *, void > &rLnk)
bool HasReadonlySel(bool isReplace=false) const
bool GetContentAtPos(const Point &rPt, SwContentAtPos &rContentAtPos, bool bSetCursor=false, SwRect *pFieldRect=nullptr)
bool IsStartWord(sal_Int16 nWordType=css::i18n::WordType::ANYWORD_IGNOREWHITESPACES) const
void SaveTableBoxContent(const SwPosition *pPos=nullptr)
void UnSetVisibleCursor()
OUString const & GetCmd() const
SfxLinkUpdateMode GetType() const
SwDoc & GetDoc()
Document is created after calling Read(...).
static SwTableNode * IsInTable(const SwNode &)
void ReplaceDefaults(const SwDoc &rSource)
void SetClipBoard(bool bNew)
IDocumentState const & getIDocumentState() const
void ReplaceCompatibilityOptions(const SwDoc &rSource)
bool InsertGlossary(SwTextBlocks &rBlock, const OUString &rEntry, SwPaM &rPaM, SwCursorShell *pShell=nullptr)
inserts an AutoText block
void SetOle2Link(const Link< bool, void > &rLink)
IDocumentContentOperations const & getIDocumentContentOperations() const
IDocumentUndoRedo & GetIDocumentUndoRedo()
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
void SetRowNotTracked(const SwCursor &rCursor, const SvxPrintItem &rNotTracked, bool bAll=false, bool bIns=false)
rNotTracked = false means that the row was deleted or inserted with its tracked cell content bAll: de...
IDocumentRedlineAccess const & getIDocumentRedlineAccess() 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...
IDocumentMarkAccess * getIDocumentMarkAccess()
const Link< bool, void > & GetOle2Link() const
OUString GetUniqueSectionName(const OUString *pChkStr=nullptr) const
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
const SfxObjectShellLock & GetTmpDocShell() const
void ReplaceStyles(const SwDoc &rSource, bool bIncludePageStyles=true)
::sw::MetaFieldManager & GetMetaFieldManager()
SwDocShell * GetDocShell()
sal_uInt16 GetCntType() const
Determine form of content. Return Type at CurrentCursor->SPoint.
virtual void CalcLayout() override
To enable set up of StartActions and EndActions.
void StartAllAction()
For all views of this document.
size_t GetFieldTypeCount(SwFieldIds nResId=SwFieldIds::Unknown) const
count field types with a ResId, if SwFieldIds::Unknown count all
bool IsModified() const
Changes in document?
SwSection const * InsertSection(SwSectionData &rNewData, SfxItemSet const *const =nullptr)
void DelINetAttrWithText()
If cursor is in an INetAttribute it will be deleted completely including the descriptive text (needed...
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.
SwUndoId StartUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Undo: set up Undo parenthesis, return nUndoId of this parenthesis.
bool Delete(bool isArtificialSelection=false)
Delete content of all ranges.
void RemoveFieldType(size_t nField)
delete field type
OUString Calculate()
Calculates selection.
SwFrameFormat * GetTableFormat()
bool InsertURL(const SwFormatINetFormat &rFormat, const OUString &rStr, bool bKeepSelection=false)
void InsertDDETable(const SwInsertTableOptions &rInsTableOpts, SwDDEFieldType *pDDEType, sal_uInt16 nRows, sal_uInt16 nCols)
SwFieldType * GetFieldType(size_t nField, SwFieldIds nResId=SwFieldIds::Unknown) const
get field types with a ResId, if 0 get all
SwFieldType * InsertFieldType(const SwFieldType &)
insert field type
SwUndoId EndUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Closes parenthesis of nUndoId, not used by UI.
void DoUndo(bool bOn=true)
Undo.
const Graphic * GetGraphic(bool bWait=true) const
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.
static tools::Long GetDDStartPosX()
static tools::Long GetDDStartPosY()
bool SetFlyFrameAttr(SfxItemSet &rSet)
FlyProtectFlags IsSelObjProtected(FlyProtectFlags eType) const
Which Protection is set at selected object?
comphelper::OInterfaceContainerHelper3< css::text::XPasteListener > & GetPasteListeners()
OUString GetFlyName() const
bool Paste(SwDoc &rClpDoc, bool bNestedTable=false)
bool IsFrameSelected() const
void SetTableInsertMode(SwTable::SearchType eFlag)
void SetTableCopied(bool bCopied)
const SwFrameFormat * GetFormatFromObj(const Point &rPt, SwRect **pRectToFill=nullptr) const
bool DeleteTableSel()
Current selection, may be whole table.
ObjCntType GetObjCntTypeOfSelection() const
void ReplaceSdrObj(const OUString &rGrfName, const Graphic *pGrf)
bool GetDrawObjGraphic(SotClipboardFormatId nFormat, Graphic &rGrf) const
Get selected DrawObj as graphics (MetaFile/Bitmap).
void Copy(SwDoc &rClpDoc, const OUString *pNewClpText=nullptr)
Copy and Paste methods for internal clipboard.
SwRect GetObjRect() const
For adjustment of PosAttr when anchor changes.
bool HasWholeTabSelection() const
bool GetFlyFrameAttr(SfxItemSet &rSet) const
size_t IsObjSelected() const
bool SelectObj(const Point &rSelPt, sal_uInt8 nFlag=0, SdrObject *pObj=nullptr)
If an object has been given, exactly this object is selected (instead of searching over position).
bool IsInsideSelectedObj(const Point &rPt)
returns enum values
SwTable::SearchType GetTableInsertMode() const
bool GetTableCopied() const
const SwFrameFormat * GetFlyFrameFormat() const
Get FlyFrameFormat; for UI macro linkage at Flys.
Instances of SwFields and those derived from it occur 0 to n times.
virtual OUString GetName() const
Only in derived classes.
static std::shared_ptr< const SfxFilter > GetFileFilter(const OUString &rFileName)
Detect for the given file which filter should be used.
SwTransferable * m_pXSelection
SwTransferable * m_pDragDrop
Marks a node in the document model.
Base class of the Writer document model elements.
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
SwNodeOffset GetIndex() const
const SwStartNode * FindTableBoxStartNode() const
SwTableBox * GetTableBox() const
If node is in a table return the respective table box.
SwTableNode * FindTableNode()
Search table node, in which it is.
const SwStartNode * StartOfSectionNode() const
SwContentNode * GetContentNode()
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
SwContentNode * GoNext(SwNodeIndex *) const
PaM is Point and Mark: a selection of the document model.
SwNode & GetPointNode() const
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
const SwPosition * GetPoint() const
const SwPosition * Start() const
Tracks the boundaries of pasted content and notifies listeners.
sal_Int32 m_nStartContent
SwPasteContext(SwWrtShell &rWrtShell)
std::optional< SwPaM > m_oPaM
ErrCode Read(const Reader &)
Of course Writer needs its own rectangles.