From 857dfce43c26d197beaa330cd4f005ce2cfb5360 Mon Sep 17 00:00:00 2001
From: Miklos Vajna <vmiklos@collabora.co.uk>
Date: Wed, 28 Oct 2015 09:44:37 +0100
Subject: [PATCH 239/398] vcl: getWindow() -> setClipboard() in
ITiledRenderable
It's cleaner to let the apps do this themselves than exposing their
underlying vcl::Window.
Change-Id: Iff2442dd325fa65a0cf3ad4aa7f918542dab1e4c
(cherry picked from commit bfd79be417358822023691cf7b7b2946906100ca)
---
desktop/source/lib/init.cxx | 9 +--------
include/vcl/ITiledRenderable.hxx | 4 ++--
sc/inc/docuno.hxx | 4 ++--
sc/source/ui/unoobj/docuno.cxx | 6 +++---
sd/source/ui/inc/unomodel.hxx | 4 ++--
sd/source/ui/unoidl/unomodel.cxx | 6 +++---
sw/inc/unotxdoc.hxx | 4 ++--
sw/source/uibase/uno/unotxdoc.cxx | 4 ++--
8 files changed, 17 insertions(+), 24 deletions(-)
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 75df1528fd51..80c3d0389504 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1008,14 +1008,7 @@ static bool doc_paste(LibreOfficeKitDocument* pThis, const char* pMimeType, cons
uno::Reference<datatransfer::XTransferable> xTransferable(new LOKTransferable(pMimeType, pData, nSize));
uno::Reference<datatransfer::clipboard::XClipboard> xClipboard(new LOKClipboard());
xClipboard->setContents(xTransferable, uno::Reference<datatransfer::clipboard::XClipboardOwner>());
- vcl::Window* pWindow = pDoc->getWindow();
- if (!pWindow)
- {
- gImpl->maLastExceptionMsg = "Document did not provide a window";
- return false;
- }
-
- pWindow->SetClipboard(xClipboard);
+ pDoc->setClipboard(xClipboard);
if (!pDoc->isMimeTypeSupported())
{
if (gImpl)
diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index 4fa23386bfbc..8ae719edf752 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -148,8 +148,8 @@ public:
return OUString();
}
- /// Returns the current vcl::Window of the component.
- virtual vcl::Window* getWindow() = 0;
+ /// Sets the clipboard of the component.
+ virtual void setClipboard(const css::uno::Reference<css::datatransfer::clipboard::XClipboard>& xClipboard) = 0;
/// If the current contents of the clipboard is something we can paste.
virtual bool isMimeTypeSupported() = 0;
diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx
index 1e3aae1d302b..a8595b00c36e 100644
--- a/sc/inc/docuno.hxx
+++ b/sc/inc/docuno.hxx
@@ -416,8 +416,8 @@ public:
/// @see lok::Document::resetSelection().
virtual void resetSelection() override;
- /// @see vcl::ITiledRenderable::getWindow().
- virtual vcl::Window* getWindow() override;
+ /// @see vcl::ITiledRenderable::setClipboard().
+ virtual void setClipboard(const css::uno::Reference<css::datatransfer::clipboard::XClipboard>& xClipboard) override;
/// @see vcl::ITiledRenderable::isMimeTypeSupported().
virtual bool isMimeTypeSupported() override;
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index af6bd11ba742..d58d6a900856 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -846,15 +846,15 @@ void ScModelObj::resetSelection()
pDocShell->GetDocument().GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, "");
}
-vcl::Window* ScModelObj::getWindow()
+void ScModelObj::setClipboard(const uno::Reference<datatransfer::clipboard::XClipboard>& xClipboard)
{
SolarMutexGuard aGuard;
ScViewData* pViewData = ScDocShell::GetViewData();
if (!pViewData)
- return 0;
+ return;
- return pViewData->GetActiveWin();
+ pViewData->GetActiveWin()->SetClipboard(xClipboard);
}
bool ScModelObj::isMimeTypeSupported()
diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx
index 741cfd356e39..8178aab1f1fa 100644
--- a/sd/source/ui/inc/unomodel.hxx
+++ b/sd/source/ui/inc/unomodel.hxx
@@ -258,8 +258,8 @@ public:
virtual void setGraphicSelection(int nType, int nX, int nY) SAL_OVERRIDE;
/// @see lok::Document::resetSelection().
virtual void resetSelection() override;
- /// @see vcl::ITiledRenderable::getWindow().
- virtual vcl::Window* getWindow() override;
+ /// @see vcl::ITiledRenderable::setClipboard().
+ virtual void setClipboard(const css::uno::Reference<css::datatransfer::clipboard::XClipboard>& xClipboard) override;
/// @see vcl::ITiledRenderable::isMimeTypeSupported().
virtual bool isMimeTypeSupported() override;
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 31954b68f114..d2c6b5e37603 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2539,15 +2539,15 @@ void SdXImpressDocument::resetSelection()
pSdrView->UnmarkAll();
}
-vcl::Window* SdXImpressDocument::getWindow()
+void SdXImpressDocument::setClipboard(const uno::Reference<datatransfer::clipboard::XClipboard>& xClipboard)
{
SolarMutexGuard aGuard;
DrawViewShell* pViewShell = GetViewShell();
if (!pViewShell)
- return 0;
+ return;
- return pViewShell->GetActiveWindow();
+ pViewShell->GetActiveWindow()->SetClipboard(xClipboard);
}
bool SdXImpressDocument::isMimeTypeSupported()
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index 180ceb891b89..85605d56c60f 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -434,8 +434,8 @@ public:
virtual void resetSelection() SAL_OVERRIDE;
/// @see vcl::ITiledRenderable::getPartPageRectangles().
virtual OUString getPartPageRectangles() override;
- /// @see vcl::ITiledRenderable::getWindow().
- virtual vcl::Window* getWindow() override;
+ /// @see vcl::ITiledRenderable::setClipboard().
+ virtual void setClipboard(const css::uno::Reference<css::datatransfer::clipboard::XClipboard>& xClipboard) override;
/// @see vcl::ITiledRenderable::isMimeTypeSupported().
virtual bool isMimeTypeSupported() override;
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index b50096bbbaa8..4de023d1275c 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3188,11 +3188,11 @@ OUString SwXTextDocument::getPartPageRectangles()
return pWrtShell->getPageRectangles();
}
-vcl::Window* SwXTextDocument::getWindow()
+void SwXTextDocument::setClipboard(const uno::Reference<datatransfer::clipboard::XClipboard>& xClipboard)
{
SolarMutexGuard aGuard;
- return &pDocShell->GetView()->GetEditWin();
+ pDocShell->GetView()->GetEditWin().SetClipboard(xClipboard);
}
bool SwXTextDocument::isMimeTypeSupported()
--
2.12.0