summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-06-19 18:13:27 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-06-22 11:16:25 +0200
commit801f24f0b87c3d159cc68e1cbb2d4a7ebc34b5ea (patch)
tree82874b5156752f5b82a4bf95acd3f926c9f0ce54 /sd
parent5095443d20dc8f474372fb217939526b11156917 (diff)
LOK: return used format in Document::getTextSelection()
This allows requesting text/html, with falling back to plain text if necessary. Conflicts: libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx Reviewed-on: https://gerrit.libreoffice.org/16377 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org> (cherry picked from commit af7cbebd8eed82b81e00e6c2e0dc6c2c467ad8e2) Change-Id: Ie6d4e0e173311ba018553043b6a869abf193bf6f
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/tiledrendering/tiledrendering.cxx5
-rw-r--r--sd/source/ui/inc/ViewShell.hxx2
-rw-r--r--sd/source/ui/inc/unomodel.hxx2
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx4
-rw-r--r--sd/source/ui/view/viewshel.cxx6
5 files changed, 12 insertions, 7 deletions
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index dad7c3e3c8cc..8ed091998ef1 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -302,10 +302,11 @@ void SdTiledRenderingTest::testGetTextSelection()
ESelection aWordSelection(0, 0, 0, 5);
rEditView.SetSelection(aWordSelection);
// Did we indeed manage to copy the selected text?
- CPPUNIT_ASSERT_EQUAL(OString("Shape"), pXImpressDocument->getTextSelection("text/plain;charset=utf-8"));
+ OString aUsedFormat;
+ CPPUNIT_ASSERT_EQUAL(OString("Shape"), pXImpressDocument->getTextSelection("text/plain;charset=utf-8", aUsedFormat));
// Make sure returned RTF is not empty.
- CPPUNIT_ASSERT(!OString(pXImpressDocument->getTextSelection("text/richtext")).isEmpty());
+ CPPUNIT_ASSERT(!OString(pXImpressDocument->getTextSelection("text/richtext", aUsedFormat)).isEmpty());
}
void SdTiledRenderingTest::testSetGraphicSelection()
diff --git a/sd/source/ui/inc/ViewShell.hxx b/sd/source/ui/inc/ViewShell.hxx
index 7b534de1fdbb..343651569226 100644
--- a/sd/source/ui/inc/ViewShell.hxx
+++ b/sd/source/ui/inc/ViewShell.hxx
@@ -450,7 +450,7 @@ public:
/// Allows adjusting the point or mark of the selection to a document coordinate.
void SetCursorMm100Position(const Point& rPosition, bool bPoint, bool bClearMark);
/// Gets the currently selected text.
- OString GetTextSelection(const OString& aMimeType);
+ OString GetTextSelection(const OString& aMimeType, OString& rUsedMimeType);
/// Allows starting or ending a graphic move or resize action.
void SetGraphicMm100Position(bool bStart, const Point& rPosition);
diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx
index 2793ca09617b..009fb672cf27 100644
--- a/sd/source/ui/inc/unomodel.hxx
+++ b/sd/source/ui/inc/unomodel.hxx
@@ -252,7 +252,7 @@ public:
/// @see vcl::ITiledRenderable::setTextSelection().
virtual void setTextSelection(int nType, int nX, int nY) SAL_OVERRIDE;
/// @see vcl::ITiledRenderable::getTextSelection().
- virtual OString getTextSelection(const char* pMimeType) SAL_OVERRIDE;
+ virtual OString getTextSelection(const char* pMimeType, OString& rUsedMimeType) SAL_OVERRIDE;
/// @see vcl::ITiledRenderable::setGraphicSelection().
virtual void setGraphicSelection(int nType, int nX, int nY) SAL_OVERRIDE;
/// @see lok::Document::resetSelection().
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 5885cbde444d..a50f95e96f75 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2462,7 +2462,7 @@ void SdXImpressDocument::setTextSelection(int nType, int nX, int nY)
}
}
-OString SdXImpressDocument::getTextSelection(const char* pMimeType)
+OString SdXImpressDocument::getTextSelection(const char* pMimeType, OString& rUsedMimeType)
{
SolarMutexGuard aGuard;
@@ -2470,7 +2470,7 @@ OString SdXImpressDocument::getTextSelection(const char* pMimeType)
if (!pViewShell)
return OString();
- return pViewShell->GetTextSelection(pMimeType);
+ return pViewShell->GetTextSelection(pMimeType, rUsedMimeType);
}
void SdXImpressDocument::setGraphicSelection(int nType, int nX, int nY)
diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx
index 2552090a0247..6978288fc848 100644
--- a/sd/source/ui/view/viewshel.cxx
+++ b/sd/source/ui/view/viewshel.cxx
@@ -555,7 +555,7 @@ void ViewShell::SetCursorMm100Position(const Point& rPosition, bool bPoint, bool
}
}
-OString ViewShell::GetTextSelection(const OString& _aMimeType)
+OString ViewShell::GetTextSelection(const OString& _aMimeType, OString& rUsedMimeType)
{
SdrView* pSdrView = GetView();
if (!pSdrView)
@@ -587,6 +587,9 @@ OString ViewShell::GetTextSelection(const OString& _aMimeType)
else
aFlavor.DataType = cppu::UnoType< uno::Sequence<sal_Int8> >::get();
+ if (!xTransferable->isDataFlavorSupported(aFlavor))
+ return OString();
+
uno::Any aAny(xTransferable->getTransferData(aFlavor));
OString aRet;
@@ -606,6 +609,7 @@ OString ViewShell::GetTextSelection(const OString& _aMimeType)
aRet = OString(reinterpret_cast<sal_Char*>(aSequence.getArray()), aSequence.getLength());
}
+ rUsedMimeType = _aMimeType;
return aRet;
}