Kaydet (Commit) edf1f755 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

tdf#124752: Reduce number of formats offered on clipboard on mobile devices

It seems a bit pointless to offer formats that no other app will use.

Change-Id: I54474a4ba40d91c184592cede4224cbfbb78d518
üst e1cd536e
...@@ -826,8 +826,10 @@ int SwTransferable::PrepareForCopy( bool bIsCut ) ...@@ -826,8 +826,10 @@ int SwTransferable::PrepareForCopy( bool bIsCut )
SwDoc *const pDoc = lcl_GetDoc(*m_pClpDocFac); SwDoc *const pDoc = lcl_GetDoc(*m_pClpDocFac);
m_pWrtShell->Copy( pDoc ); m_pWrtShell->Copy( pDoc );
#if HAVE_FEATURE_DESKTOP
if (m_pOrigGraphic && !m_pOrigGraphic->GetBitmapEx().IsEmpty()) if (m_pOrigGraphic && !m_pOrigGraphic->GetBitmapEx().IsEmpty())
AddFormat( SotClipboardFormatId::SVXB ); AddFormat( SotClipboardFormatId::SVXB );
#endif
PrepareOLE( m_aObjDesc ); PrepareOLE( m_aObjDesc );
AddFormat( SotClipboardFormatId::OBJECTDESCRIPTOR ); AddFormat( SotClipboardFormatId::OBJECTDESCRIPTOR );
...@@ -835,9 +837,11 @@ int SwTransferable::PrepareForCopy( bool bIsCut ) ...@@ -835,9 +837,11 @@ int SwTransferable::PrepareForCopy( bool bIsCut )
const Graphic* pGrf = m_pWrtShell->GetGraphic(); const Graphic* pGrf = m_pWrtShell->GetGraphic();
if( pGrf && pGrf->IsSupportedGraphic() ) if( pGrf && pGrf->IsSupportedGraphic() )
{ {
AddFormat( SotClipboardFormatId::GDIMETAFILE );
AddFormat( SotClipboardFormatId::PNG ); AddFormat( SotClipboardFormatId::PNG );
#if HAVE_FEATURE_DESKTOP
AddFormat( SotClipboardFormatId::GDIMETAFILE );
AddFormat( SotClipboardFormatId::BITMAP ); AddFormat( SotClipboardFormatId::BITMAP );
#endif
} }
m_eBufferType = TransferBufferType::Graphic; m_eBufferType = TransferBufferType::Graphic;
m_pWrtShell->GetGrfNms( &sGrfNm, nullptr ); m_pWrtShell->GetGrfNms( &sGrfNm, nullptr );
...@@ -857,8 +861,9 @@ int SwTransferable::PrepareForCopy( bool bIsCut ) ...@@ -857,8 +861,9 @@ int SwTransferable::PrepareForCopy( bool bIsCut )
m_aObjDesc.maSize = OutputDevice::LogicToLogic(m_pWrtShell->GetObjSize(), MapMode(MapUnit::MapTwip), MapMode(MapUnit::Map100thMM)); m_aObjDesc.maSize = OutputDevice::LogicToLogic(m_pWrtShell->GetObjSize(), MapMode(MapUnit::MapTwip), MapMode(MapUnit::Map100thMM));
// <-- // <--
PrepareOLE( m_aObjDesc ); PrepareOLE( m_aObjDesc );
AddFormat( SotClipboardFormatId::OBJECTDESCRIPTOR );
#if HAVE_FEATURE_DESKTOP
AddFormat( SotClipboardFormatId::OBJECTDESCRIPTOR );
AddFormat( SotClipboardFormatId::GDIMETAFILE ); AddFormat( SotClipboardFormatId::GDIMETAFILE );
// Fetch the formats supported via embedtransferhelper as well // Fetch the formats supported via embedtransferhelper as well
...@@ -876,6 +881,7 @@ int SwTransferable::PrepareForCopy( bool bIsCut ) ...@@ -876,6 +881,7 @@ int SwTransferable::PrepareForCopy( bool bIsCut )
AddFormat( rItem ); AddFormat( rItem );
} }
} }
#endif
m_eBufferType = TransferBufferType::Ole; m_eBufferType = TransferBufferType::Ole;
} }
// Is there anything to provide anyway? // Is there anything to provide anyway?
...@@ -938,15 +944,19 @@ int SwTransferable::PrepareForCopy( bool bIsCut ) ...@@ -938,15 +944,19 @@ int SwTransferable::PrepareForCopy( bool bIsCut )
bDDELink = m_pWrtShell->HasWholeTabSelection(); bDDELink = m_pWrtShell->HasWholeTabSelection();
} }
#if HAVE_FEATURE_DESKTOP
//When someone needs it, we 'OLE' him something //When someone needs it, we 'OLE' him something
AddFormat( SotClipboardFormatId::EMBED_SOURCE ); AddFormat( SotClipboardFormatId::EMBED_SOURCE );
#endif
//put RTF ahead of the OLE's Metafile to have less loss //put RTF ahead of the OLE's Metafile to have less loss
if( !m_pWrtShell->IsObjSelected() ) if( !m_pWrtShell->IsObjSelected() )
{ {
AddFormat( SotClipboardFormatId::RTF ); AddFormat( SotClipboardFormatId::RTF );
#if HAVE_FEATURE_DESKTOP
AddFormat( SotClipboardFormatId::RICHTEXT ); AddFormat( SotClipboardFormatId::RICHTEXT );
AddFormat( SotClipboardFormatId::HTML ); AddFormat( SotClipboardFormatId::HTML );
#endif
} }
if( m_pWrtShell->IsSelection() ) if( m_pWrtShell->IsSelection() )
AddFormat( SotClipboardFormatId::STRING ); AddFormat( SotClipboardFormatId::STRING );
...@@ -956,9 +966,11 @@ int SwTransferable::PrepareForCopy( bool bIsCut ) ...@@ -956,9 +966,11 @@ int SwTransferable::PrepareForCopy( bool bIsCut )
AddFormat( SotClipboardFormatId::DRAWING ); AddFormat( SotClipboardFormatId::DRAWING );
if ( nSelection & SelectionType::DrawObject ) if ( nSelection & SelectionType::DrawObject )
{ {
#if HAVE_FEATURE_DESKTOP
AddFormat( SotClipboardFormatId::GDIMETAFILE ); AddFormat( SotClipboardFormatId::GDIMETAFILE );
AddFormat( SotClipboardFormatId::PNG );
AddFormat( SotClipboardFormatId::BITMAP ); AddFormat( SotClipboardFormatId::BITMAP );
#endif
AddFormat( SotClipboardFormatId::PNG );
} }
m_eBufferType = static_cast<TransferBufferType>( TransferBufferType::Graphic | m_eBufferType ); m_eBufferType = static_cast<TransferBufferType>( TransferBufferType::Graphic | m_eBufferType );
...@@ -975,10 +987,12 @@ int SwTransferable::PrepareForCopy( bool bIsCut ) ...@@ -975,10 +987,12 @@ int SwTransferable::PrepareForCopy( bool bIsCut )
if( m_pWrtShell->GetURLFromButton( sURL, sDesc ) ) if( m_pWrtShell->GetURLFromButton( sURL, sDesc ) )
{ {
AddFormat( SotClipboardFormatId::STRING ); AddFormat( SotClipboardFormatId::STRING );
#if HAVE_FEATURE_DESKTOP
AddFormat( SotClipboardFormatId::SOLK ); AddFormat( SotClipboardFormatId::SOLK );
AddFormat( SotClipboardFormatId::NETSCAPE_BOOKMARK ); AddFormat( SotClipboardFormatId::NETSCAPE_BOOKMARK );
AddFormat( SotClipboardFormatId::FILECONTENT ); AddFormat( SotClipboardFormatId::FILECONTENT );
AddFormat( SotClipboardFormatId::FILEGRPDESCRIPTOR ); AddFormat( SotClipboardFormatId::FILEGRPDESCRIPTOR );
#endif
AddFormat( SotClipboardFormatId::UNIFORMRESOURCELOCATOR ); AddFormat( SotClipboardFormatId::UNIFORMRESOURCELOCATOR );
m_eBufferType = TransferBufferType::InetField | m_eBufferType; m_eBufferType = TransferBufferType::InetField | m_eBufferType;
nRet = 1; nRet = 1;
...@@ -991,7 +1005,9 @@ int SwTransferable::PrepareForCopy( bool bIsCut ) ...@@ -991,7 +1005,9 @@ int SwTransferable::PrepareForCopy( bool bIsCut )
nullptr != ( pDShell = m_pWrtShell->GetDoc()->GetDocShell()) && nullptr != ( pDShell = m_pWrtShell->GetDoc()->GetDocShell()) &&
SfxObjectCreateMode::STANDARD == pDShell->GetCreateMode() ) SfxObjectCreateMode::STANDARD == pDShell->GetCreateMode() )
{ {
#if HAVE_FEATURE_DESKTOP
AddFormat( SotClipboardFormatId::LINK ); AddFormat( SotClipboardFormatId::LINK );
#endif
m_xDdeLink = new SwTrnsfrDdeLink( *this, *m_pWrtShell ); m_xDdeLink = new SwTrnsfrDdeLink( *this, *m_pWrtShell );
} }
...@@ -1002,7 +1018,9 @@ int SwTransferable::PrepareForCopy( bool bIsCut ) ...@@ -1002,7 +1018,9 @@ int SwTransferable::PrepareForCopy( bool bIsCut )
m_aObjDesc.maSize = OutputDevice::LogicToLogic(aSz, MapMode(MapUnit::MapTwip), MapMode(MapUnit::Map100thMM)); m_aObjDesc.maSize = OutputDevice::LogicToLogic(aSz, MapMode(MapUnit::MapTwip), MapMode(MapUnit::Map100thMM));
PrepareOLE( m_aObjDesc ); PrepareOLE( m_aObjDesc );
#if HAVE_FEATURE_DESKTOP
AddFormat( SotClipboardFormatId::OBJECTDESCRIPTOR ); AddFormat( SotClipboardFormatId::OBJECTDESCRIPTOR );
#endif
} }
else else
nRet = 0; nRet = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment