cui/source/customize/macropg.cxx |   49 +++++++++++++++++++--------------------
 cui/source/inc/macropg.hxx       |    2 -
 vcl/inc/quartz/salgdi.h          |    2 -
 vcl/osx/salprn.cxx               |    2 -
 vcl/quartz/salgdi.cxx            |   11 +++++++-
 5 files changed, 36 insertions(+), 30 deletions(-)

New commits:
commit f03a35c81f9b7f5a622e72229bd318eb9055ff20
Author:     Caolán McNamara <[email protected]>
AuthorDate: Fri Dec 9 10:30:34 2022 +0000
Commit:     Caolán McNamara <[email protected]>
CommitDate: Fri Dec 9 20:36:37 2022 +0000

    drop unnecessary pThis indirection
    
    Change-Id: I28c338a4f09036c9365937af99cb85fd4be95901
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143858
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/cui/source/customize/macropg.cxx b/cui/source/customize/macropg.cxx
index db36fe10713a..a1fe3dab39dc 100644
--- a/cui/source/customize/macropg.cxx
+++ b/cui/source/customize/macropg.cxx
@@ -375,20 +375,19 @@ IMPL_LINK_NOARG( SvxMacroTabPage_, SelectEvent_Impl, 
weld::TreeView&, void)
 
 IMPL_LINK( SvxMacroTabPage_, AssignDeleteHdl_Impl, weld::Button&, rBtn, void )
 {
-    GenericHandler_Impl(this, &rBtn);
+    GenericHandler_Impl(&rBtn);
 }
 
 IMPL_LINK_NOARG( SvxMacroTabPage_, DoubleClickHdl_Impl, weld::TreeView&, bool)
 {
-    GenericHandler_Impl(this, nullptr);
+    GenericHandler_Impl(nullptr);
     return true;
 }
 
 // handler for double click on the listbox, and for the assign/delete buttons
-void SvxMacroTabPage_::GenericHandler_Impl(SvxMacroTabPage_* pThis, const 
weld::Button* pBtn)
+void SvxMacroTabPage_::GenericHandler_Impl(const weld::Button* pBtn)
 {
-    SvxMacroTabPage_Impl*    pImpl = pThis->mpImpl.get();
-    weld::TreeView& rListBox = *pImpl->xEventLB;
+    weld::TreeView& rListBox = *mpImpl->xEventLB;
     int nEntry = rListBox.get_selected_index();
     if (nEntry == -1)
     {
@@ -396,16 +395,16 @@ void 
SvxMacroTabPage_::GenericHandler_Impl(SvxMacroTabPage_* pThis, const weld::
         return;
     }
 
-    const bool bAssEnabled = pBtn != pImpl->xDeletePB.get() && 
pImpl->xAssignPB->get_sensitive();
+    const bool bAssEnabled = pBtn != mpImpl->xDeletePB.get() && 
mpImpl->xAssignPB->get_sensitive();
 
     OUString sEventName = rListBox.get_id(nEntry);
 
     OUString sEventURL;
     OUString sEventType;
-    if(pThis->bAppEvents)
+    if (bAppEvents)
     {
-        EventsHash::iterator h_it = pThis->m_appEventsHash.find(sEventName);
-        if(h_it != pThis->m_appEventsHash.end() )
+        EventsHash::iterator h_it = m_appEventsHash.find(sEventName);
+        if (h_it != m_appEventsHash.end() )
         {
             sEventType = h_it->second.first;
             sEventURL = h_it->second.second;
@@ -413,8 +412,8 @@ void 
SvxMacroTabPage_::GenericHandler_Impl(SvxMacroTabPage_* pThis, const weld::
     }
     else
     {
-        EventsHash::iterator h_it = pThis->m_docEventsHash.find(sEventName);
-        if(h_it != pThis->m_docEventsHash.end() )
+        EventsHash::iterator h_it = m_docEventsHash.find(sEventName);
+        if (h_it != m_docEventsHash.end() )
         {
             sEventType = h_it->second.first;
             sEventURL = h_it->second.second;
@@ -423,57 +422,57 @@ void 
SvxMacroTabPage_::GenericHandler_Impl(SvxMacroTabPage_* pThis, const weld::
 
     bool bDoubleClick = (pBtn == nullptr);
     bool bUNOAssigned = sEventURL.startsWith( aVndSunStarUNO );
-    if( pBtn == pImpl->xDeletePB.get() )
+    if (pBtn == mpImpl->xDeletePB.get())
     {
         // delete pressed
         sEventType =  "Script" ;
         sEventURL.clear();
-        if(!pThis->bAppEvents)
-            pThis->bDocModified = true;
+        if (!bAppEvents)
+            bDocModified = true;
     }
     else if (   (   ( pBtn != nullptr )
-                &&  ( pBtn == pImpl->xAssignComponentPB.get() )
+                &&  ( pBtn == mpImpl->xAssignComponentPB.get() )
                 )
             ||  (   bDoubleClick
                 &&  bUNOAssigned
                 )
             )
     {
-        AssignComponentDialog aAssignDlg(pThis->GetFrameWeld(), sEventURL);
+        AssignComponentDialog aAssignDlg(GetFrameWeld(), sEventURL);
 
         short ret = aAssignDlg.run();
         if( ret )
         {
             sEventType = "UNO";
             sEventURL = aAssignDlg.getURL();
-            if(!pThis->bAppEvents)
-                pThis->bDocModified = true;
+            if (!bAppEvents)
+                bDocModified = true;
         }
     }
     else if( bAssEnabled )
     {
         // assign pressed
-        SvxScriptSelectorDialog aDlg(pThis->GetFrameWeld(), pThis->GetFrame());
+        SvxScriptSelectorDialog aDlg(GetFrameWeld(), GetFrame());
         short ret = aDlg.run();
         if ( ret )
         {
             sEventType = "Script";
             sEventURL = aDlg.GetScriptURL();
-            if(!pThis->bAppEvents)
-                pThis->bDocModified = true;
+            if (!bAppEvents)
+                bDocModified = true;
         }
     }
 
     // update the hashes
-    if(pThis->bAppEvents)
+    if (bAppEvents)
     {
-        EventsHash::iterator h_it = pThis->m_appEventsHash.find(sEventName);
+        EventsHash::iterator h_it = m_appEventsHash.find(sEventName);
         h_it->second.first = sEventType;
         h_it->second.second = sEventURL;
     }
     else
     {
-        EventsHash::iterator h_it = pThis->m_docEventsHash.find(sEventName);
+        EventsHash::iterator h_it = m_docEventsHash.find(sEventName);
         h_it->second.first = sEventType;
         h_it->second.second = sEventURL;
     }
@@ -484,7 +483,7 @@ void 
SvxMacroTabPage_::GenericHandler_Impl(SvxMacroTabPage_* pThis, const weld::
     rListBox.select(nEntry );
     rListBox.scroll_to_row(nEntry);
 
-    pThis->EnableButtons();
+    EnableButtons();
 }
 
 // pass in the XNameReplace.
diff --git a/cui/source/inc/macropg.hxx b/cui/source/inc/macropg.hxx
index 39e4ef284384..ef9e16c51bba 100644
--- a/cui/source/inc/macropg.hxx
+++ b/cui/source/inc/macropg.hxx
@@ -55,7 +55,7 @@ class SvxMacroTabPage_ : public SfxTabPage
     DECL_LINK( AssignDeleteHdl_Impl, weld::Button&, void );
     DECL_LINK( DoubleClickHdl_Impl, weld::TreeView&, bool );
 
-    static void GenericHandler_Impl( SvxMacroTabPage_* pThis, const 
weld::Button* pBtn );
+    void GenericHandler_Impl(const weld::Button* pBtn);
 
     css::uno::Reference< css::container::XNameReplace > m_xAppEvents;
 protected:
commit 9da2bf0a76974f685d867594015fed9f08bd7084
Author:     Patrick Luby <[email protected]>
AuthorDate: Wed Dec 7 14:24:57 2022 -0500
Commit:     Caolán McNamara <[email protected]>
CommitDate: Fri Dec 9 20:36:26 2022 +0000

    tdf#146842 Do not use Skia for printing
    
    Skia does not work with a native print graphics contexts. I am not sure why 
but from what I can see, the Skia implementation drawing to a bitmap buffer. 
However, in an NSPrintOperation, the print view's backing buffer is 
CGPDFContext so even if this bug could be solved by blitting the Skia bitmap 
buffer, the printed PDF would not have selectable text so always disable Skia 
for print graphics contexts.
    
    Change-Id: I214ba83b6e368af3ef51ea770b093612d04047a0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143798
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>
    (cherry picked from commit de3f13e2175564316eb5a62dee65e9ff8f31b460)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143856

diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h
index 61ff01c12e3a..9e070c4215ce 100644
--- a/vcl/inc/quartz/salgdi.h
+++ b/vcl/inc/quartz/salgdi.h
@@ -454,7 +454,7 @@ class AquaSalGraphics : public SalGraphicsAutoDelegateToImpl
     rtl::Reference<CoreTextFont>            mpFont[MAX_FALLBACK];
 
 public:
-                            AquaSalGraphics();
+                            AquaSalGraphics(bool bPrinter = false);
     virtual                 ~AquaSalGraphics() override;
 
     void                    SetVirDevGraphics(SalVirtualDevice* 
pVirDev,CGLayerHolder const &rLayer, CGContextRef, int nBitDepth = 0);
diff --git a/vcl/osx/salprn.cxx b/vcl/osx/salprn.cxx
index bec30a35b562..e9101e390085 100644
--- a/vcl/osx/salprn.cxx
+++ b/vcl/osx/salprn.cxx
@@ -71,7 +71,7 @@ AquaSalInfoPrinter::AquaSalInfoPrinter( const 
SalPrinterQueueInfo& i_rQueue ) :
         [mpPrintInfo setOrientation: NSPaperOrientationPortrait];
     }
 
-    mpGraphics = new AquaSalGraphics();
+    mpGraphics = new AquaSalGraphics(true);
 
     const int nWidth = 100, nHeight = 100;
     mpContextMemory.reset(new (std::nothrow) sal_uInt8[nWidth * 4 * nHeight]);
diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx
index 1058b7bc31e9..571e44f23e71 100644
--- a/vcl/quartz/salgdi.cxx
+++ b/vcl/quartz/salgdi.cxx
@@ -137,14 +137,21 @@ sal_IntPtr CoreTextFontFace::GetFontId() const
     return reinterpret_cast<sal_IntPtr>(mxFontDescriptor);
 }
 
-AquaSalGraphics::AquaSalGraphics()
+AquaSalGraphics::AquaSalGraphics(bool bPrinter)
     : mnRealDPIX( 0 )
     , mnRealDPIY( 0 )
 {
     SAL_INFO( "vcl.quartz", "AquaSalGraphics::AquaSalGraphics() this=" << this 
);
 
 #if HAVE_FEATURE_SKIA
-    if(SkiaHelper::isVCLSkiaEnabled())
+    // tdf#146842 Do not use Skia for printing
+    // Skia does not work with a native print graphics contexts. I am not sure
+    // why but from what I can see, the Skia implementation drawing to a bitmap
+    // buffer. However, in an NSPrintOperation, the print view's backing buffer
+    // is CGPDFContext so even if this bug could be solved by blitting the
+    // Skia bitmap buffer, the printed PDF would not have selectable text so
+    // always disable Skia for print graphics contexts.
+    if(!bPrinter && SkiaHelper::isVCLSkiaEnabled())
         mpBackend.reset(new AquaSkiaSalGraphicsImpl(*this, maShared));
 #else
     if(false)

Reply via email to