[Libreoffice-commits] core.git: desktop/source include/vcl sc/inc sc/source sd/source sw/inc sw/source

Miklos Vajna vmiklos at collabora.co.uk
Wed Oct 28 08:45:44 UTC 2015


 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(-)

New commits:
commit bfd79be417358822023691cf7b7b2946906100ca
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Oct 28 09:44:37 2015 +0100

    vcl: getWindow() -> setClipboard() in ITiledRenderable
    
    It's cleaner to let the apps do this themselves than exposing their
    underlying vcl::Window.
    
    Change-Id: Iff2442dd325fa65a0cf3ad4aa7f918542dab1e4c

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 85ed95d..8f12ee2 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1009,14 +1009,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 4fa2338..8ae719e 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 3ee6e61..ea924a8 100644
--- a/sc/inc/docuno.hxx
+++ b/sc/inc/docuno.hxx
@@ -399,8 +399,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 8391905..c6070f1 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -845,15 +845,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 03dc445..1e1d65f 100644
--- a/sd/source/ui/inc/unomodel.hxx
+++ b/sd/source/ui/inc/unomodel.hxx
@@ -259,8 +259,8 @@ public:
     virtual void setGraphicSelection(int nType, int nX, int nY) 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 8c3d0a3..c840f78 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2533,15 +2533,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 196f60d..d5c5eb9 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -431,8 +431,8 @@ public:
     virtual void resetSelection() 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 6831198..43a5b32 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3139,11 +3139,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()


More information about the Libreoffice-commits mailing list