[Libreoffice-commits] core.git: 2 commits - include/svx svx/source svx/uiconfig sw/source

Caolán McNamara caolanm at redhat.com
Fri Apr 21 11:12:05 UTC 2017


 include/svx/galtheme.hxx         |    3 +++
 svx/source/gallery2/galbrws2.cxx |   32 ++++++++++++++++++++++++++++++++
 svx/source/gallery2/galtheme.cxx |    6 ++++++
 svx/uiconfig/ui/gallerymenu2.ui  |   22 ++++++++++++++++++++++
 sw/source/filter/ww8/ww8scan.cxx |    4 +---
 5 files changed, 64 insertions(+), 3 deletions(-)

New commits:
commit 151a0cec2946b9b8db24d452875071b564d05193
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Apr 21 11:31:02 2017 +0100

    ofz#1202 fix oom
    
    Change-Id: I9b7b318af112fb9226bf8d2b54ea2a306eee4251

diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 4ce475c18952..49a2f46f227d 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -3430,7 +3430,7 @@ void WW8PLCFx_SEPX::GetSprms(WW8PLCFxDesc* p)
     else
     {
         sal_uInt32 nPo =  SVBT32ToUInt32( static_cast<sal_uInt8*>(pData)+2 );
-        if (nPo == 0xFFFFFFFF)
+        if (nPo == 0xFFFFFFFF || !checkSeek(*pStrm, nPo))
         {
             p->nStartPos = p->nEndPos = WW8_CP_MAX;   // Sepx empty
             p->pMemPos = nullptr;
@@ -3438,8 +3438,6 @@ void WW8PLCFx_SEPX::GetSprms(WW8PLCFxDesc* p)
         }
         else
         {
-            pStrm->Seek( nPo );
-
             // read len
             if (GetFIBVersion() <= ww::eWW2)    // eWW6 ?, docs say yes, but...
             {
commit d581ef6ee2d448ff30b77236006b6355f41f7449
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Apr 21 11:15:39 2017 +0100

    restore copy/paste menu entries
    
    Change-Id: Ie1dab6857dd6efdb816a11997ef32f0cc3497047

diff --git a/include/svx/galtheme.hxx b/include/svx/galtheme.hxx
index 3659e68b1d70..003c013fe365 100644
--- a/include/svx/galtheme.hxx
+++ b/include/svx/galtheme.hxx
@@ -198,8 +198,11 @@ public:
 
     SAL_DLLPRIVATE bool         InsertTransferable( const css::uno::Reference< css::datatransfer::XTransferable >& rxTransferable, sal_uIntPtr nInsertPos );
 
+    SAL_DLLPRIVATE void         CopyToClipboard( vcl::Window* pWindow, sal_uIntPtr nPos );
     SAL_DLLPRIVATE void         StartDrag( vcl::Window* pWindow, sal_uIntPtr nPos );
 
+public:
+
     SAL_DLLPRIVATE SvStream&    WriteData( SvStream& rOut ) const;
     SAL_DLLPRIVATE SvStream&    ReadData( SvStream& rIn );
     static void                 InsertAllThemes( ListBox& rListBox );
diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx
index 2cce206440f8..a09b0436d9be 100644
--- a/svx/source/gallery2/galbrws2.cxx
+++ b/svx/source/gallery2/galbrws2.cxx
@@ -247,11 +247,18 @@ void GalleryThemePopup::ExecutePopup( vcl::Window *pWindow, const ::Point &aPos
     {
         mpPopupMenu->EnableItem(mpPopupMenu->GetItemId("delete"), false);
         mpPopupMenu->EnableItem(mpPopupMenu->GetItemId("title"), false);
+        if (mpTheme->IsReadOnly())
+            mpPopupMenu->EnableItem(mpPopupMenu->GetItemId("paste"), false);
+
+        if (!mpTheme->GetObjectCount())
+            mpPopupMenu->EnableItem(mpPopupMenu->GetItemId("copy"), false);
     }
     else
     {
         mpPopupMenu->EnableItem(mpPopupMenu->GetItemId("delete"), !mbPreview);
         mpPopupMenu->EnableItem(mpPopupMenu->GetItemId("title"));
+        mpPopupMenu->EnableItem(mpPopupMenu->GetItemId("copy"));
+        mpPopupMenu->EnableItem(mpPopupMenu->GetItemId("paste"));
     }
 
     // update status
@@ -1131,6 +1138,31 @@ void GalleryBrowser2::Execute(const OString &rIdent)
                 }
             }
         }
+        else if (rIdent == "copy")
+        {
+            vcl::Window* pWindow;
+
+            switch( GetMode() )
+            {
+                case GALLERYBROWSERMODE_ICON: pWindow = static_cast<vcl::Window*>(mpIconView); break;
+                case GALLERYBROWSERMODE_LIST: pWindow = static_cast<vcl::Window*>(mpListView); break;
+                case GALLERYBROWSERMODE_PREVIEW: pWindow = static_cast<vcl::Window*>(mpPreview); break;
+
+                default:
+                    pWindow = nullptr;
+                break;
+            }
+
+            mpCurTheme->CopyToClipboard( pWindow, mnCurActionPos );
+        }
+        else if (rIdent == "paste")
+        {
+            if( !mpCurTheme->IsReadOnly() )
+            {
+                TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( this ) );
+                mpCurTheme->InsertTransferable( aDataHelper.GetTransferable(), mnCurActionPos );
+             }
+        }
     }
 }
 
diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx
index 0139756651d2..9ec3adf6333f 100644
--- a/svx/source/gallery2/galtheme.cxx
+++ b/svx/source/gallery2/galtheme.cxx
@@ -1264,6 +1264,12 @@ bool GalleryTheme::InsertTransferable( const uno::Reference< datatransfer::XTran
     return bRet;
 }
 
+void GalleryTheme::CopyToClipboard( vcl::Window* pWindow, sal_uIntPtr nPos )
+{
+    GalleryTransferable* pTransferable = new GalleryTransferable( this, nPos, false );
+    pTransferable->CopyToClipboard( pWindow );
+}
+
 void GalleryTheme::StartDrag( vcl::Window* pWindow, sal_uIntPtr nPos )
 {
     GalleryTransferable* pTransferable = new GalleryTransferable( this, nPos, true );
diff --git a/svx/uiconfig/ui/gallerymenu2.ui b/svx/uiconfig/ui/gallerymenu2.ui
index 3fda767be80b..6b389617e54a 100644
--- a/svx/uiconfig/ui/gallerymenu2.ui
+++ b/svx/uiconfig/ui/gallerymenu2.ui
@@ -61,5 +61,27 @@
         <property name="label" translatable="yes">_Delete</property>
       </object>
     </child>
+    <child>
+      <object class="GtkSeparatorMenuItem" id="menuitem4">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="copy">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">_Copy</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="paste">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">_Insert</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
   </object>
 </interface>


More information about the Libreoffice-commits mailing list