[Libreoffice-commits] core.git: 2 commits - canvas/source dbaccess/source desktop/source include/vcl sw/source vcl/qt5 vcl/source vcl/unx

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri Oct 4 18:38:47 UTC 2019


 canvas/source/directx/dx_textlayout_drawhelper.cxx |    4 ++--
 dbaccess/source/ui/control/FieldDescControl.cxx    |    4 ++--
 dbaccess/source/ui/misc/WCPage.cxx                 |    4 +---
 desktop/source/lib/init.cxx                        |    4 ++--
 include/vcl/virdev.hxx                             |    2 +-
 include/vcl/weld.hxx                               |    1 +
 sw/source/uibase/uno/unotxdoc.cxx                  |    2 +-
 vcl/qt5/Qt5SvpSurface.cxx                          |    3 ++-
 vcl/source/gdi/virdev.cxx                          |    4 ++--
 vcl/unx/generic/gdi/cairo_xlib_cairo.cxx           |    2 +-
 vcl/unx/gtk3/cairo_gtk3_cairo.cxx                  |    3 ++-
 11 files changed, 17 insertions(+), 16 deletions(-)

New commits:
commit 66df5e5bb0fc19c28c99592b562be8778438057c
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Oct 3 17:11:46 2019 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Oct 4 20:38:00 2019 +0200

    Related: tdf#127529 make it harder to misunderstand this VirtualDevice ctor
    
    Change-Id: I250bc68da118a994a2e0ff8ab9eb11112827756d
    Reviewed-on: https://gerrit.libreoffice.org/80158
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/canvas/source/directx/dx_textlayout_drawhelper.cxx b/canvas/source/directx/dx_textlayout_drawhelper.cxx
index c751b941e8b5..71c4c7e3a904 100644
--- a/canvas/source/directx/dx_textlayout_drawhelper.cxx
+++ b/canvas/source/directx/dx_textlayout_drawhelper.cxx
@@ -80,7 +80,7 @@ namespace dxcanvas
         SystemGraphicsData aSystemGraphicsData;
         aSystemGraphicsData.nSize = sizeof(SystemGraphicsData);
         aSystemGraphicsData.hDC = reinterpret_cast< ::HDC >(hdc);
-        ScopedVclPtrInstance<VirtualDevice> xVirtualDevice(&aSystemGraphicsData, Size(1, 1), DeviceFormat::DEFAULT);
+        ScopedVclPtrInstance<VirtualDevice> xVirtualDevice(aSystemGraphicsData, Size(1, 1), DeviceFormat::DEFAULT);
 
         // disable font antialiasing - GDI does not handle alpha
         // surfaces properly.
@@ -241,7 +241,7 @@ namespace dxcanvas
         SystemGraphicsData aSystemGraphicsData;
         aSystemGraphicsData.nSize = sizeof(SystemGraphicsData);
         aSystemGraphicsData.hDC = reinterpret_cast< ::HDC >(GetDC( nullptr ));
-        ScopedVclPtrInstance<VirtualDevice> xVirtualDevice(&aSystemGraphicsData, Size(1, 1), DeviceFormat::DEFAULT);
+        ScopedVclPtrInstance<VirtualDevice> xVirtualDevice(aSystemGraphicsData, Size(1, 1), DeviceFormat::DEFAULT);
 
         // create the font
         const css::rendering::FontRequest& rFontRequest = rCanvasFont->getFontRequest();
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index b9aca6845c22..e468c3ed23f7 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1773,7 +1773,7 @@ void paintTileToCGContext(ITiledRenderable* pDocument,
     SystemGraphicsData aData;
     aData.rCGContext = reinterpret_cast<CGContextRef>(rCGContext);
 
-    ScopedVclPtrInstance<VirtualDevice> pDevice(&aData, Size(1, 1), DeviceFormat::DEFAULT);
+    ScopedVclPtrInstance<VirtualDevice> pDevice(aData, Size(1, 1), DeviceFormat::DEFAULT);
     pDevice->SetBackground(Wallpaper(COL_TRANSPARENT));
     pDevice->SetOutputSizePixel(nCanvasSize);
     pDocument->paintTile(*pDevice, nCanvasSize.Width(), nCanvasSize.Height(),
@@ -4732,7 +4732,7 @@ static void doc_paintWindowDPI(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKW
     SystemGraphicsData aData;
     aData.rCGContext = cgc;
 
-    ScopedVclPtrInstance<VirtualDevice> pDevice(&aData, Size(1, 1), DeviceFormat::DEFAULT);
+    ScopedVclPtrInstance<VirtualDevice> pDevice(aData, Size(1, 1), DeviceFormat::DEFAULT);
     pDevice->SetBackground(Wallpaper(COL_TRANSPARENT));
 
     pDevice->SetOutputSizePixel(Size(nWidth, nHeight));
diff --git a/include/vcl/virdev.hxx b/include/vcl/virdev.hxx
index 2ae778eb73ba..9baba707e23a 100644
--- a/include/vcl/virdev.hxx
+++ b/include/vcl/virdev.hxx
@@ -145,7 +145,7 @@ public:
         Any rendering will happen directly on the context and not on any intermediate bitmap.
         Note: This might not be supported on all platforms !
      */
-    explicit VirtualDevice(const SystemGraphicsData *pData, const Size &rSize,
+    explicit VirtualDevice(const SystemGraphicsData& rData, const Size &rSize,
                            DeviceFormat eFormat);
 
     virtual             ~VirtualDevice() override;
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 4ec9e293f74b..19c71ccea2db 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3628,7 +3628,7 @@ void SAL_CALL SwXTextDocument::paintTile( const ::css::uno::Any& Parent, ::sal_I
     sal_Int64 nWindowHandle;
     Parent >>= nWindowHandle;
     aData.hWnd = reinterpret_cast<HWND>(nWindowHandle);
-    ScopedVclPtrInstance<VirtualDevice> xDevice(&aData, Size(1, 1), DeviceFormat::DEFAULT);
+    ScopedVclPtrInstance<VirtualDevice> xDevice(aData, Size(1, 1), DeviceFormat::DEFAULT);
     paintTile(*xDevice, nOutputWidth, nOutputHeight, nTilePosX, nTilePosY, nTileWidth, nTileHeight);
     #else
     // TODO: support other platforms
diff --git a/vcl/qt5/Qt5SvpSurface.cxx b/vcl/qt5/Qt5SvpSurface.cxx
index 00f6004bd2a0..3e300755a992 100644
--- a/vcl/qt5/Qt5SvpSurface.cxx
+++ b/vcl/qt5/Qt5SvpSurface.cxx
@@ -65,7 +65,8 @@ void Qt5SvpSurface::flush() const
 
 VclPtr<VirtualDevice> Qt5SvpSurface::createVirtualDevice() const
 {
-    return VclPtrInstance<VirtualDevice>(nullptr, Size(1, 1), DeviceFormat::DEFAULT);
+    //TODO allow creating a VirtualDevice to draw to the current surface
+    return VclPtrInstance<VirtualDevice>(DeviceFormat::DEFAULT);
 }
 
 } // namespace cairo
diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx
index 3d16815b2557..a2bbcdff8f03 100644
--- a/vcl/source/gdi/virdev.cxx
+++ b/vcl/source/gdi/virdev.cxx
@@ -210,7 +210,7 @@ VirtualDevice::VirtualDevice(const OutputDevice* pCompDev, DeviceFormat eFormat,
     ImplInitVirDev(pCompDev ? pCompDev : Application::GetDefaultDevice(), 0, 0);
 }
 
-VirtualDevice::VirtualDevice(const SystemGraphicsData *pData, const Size &rSize,
+VirtualDevice::VirtualDevice(const SystemGraphicsData& rData, const Size &rSize,
                              DeviceFormat eFormat)
     : OutputDevice(OUTDEV_VIRDEV)
     , meFormat(eFormat)
@@ -218,7 +218,7 @@ VirtualDevice::VirtualDevice(const SystemGraphicsData *pData, const Size &rSize,
 {
     SAL_INFO( "vcl.virdev", "VirtualDevice::VirtualDevice( " << static_cast<int>(eFormat) << " )" );
 
-    ImplInitVirDev(Application::GetDefaultDevice(), rSize.Width(), rSize.Height(), pData);
+    ImplInitVirDev(Application::GetDefaultDevice(), rSize.Width(), rSize.Height(), &rData);
 }
 
 VirtualDevice::~VirtualDevice()
diff --git a/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx b/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx
index 1ec6f2b67fb4..760a8d595903 100644
--- a/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx
+++ b/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx
@@ -255,7 +255,7 @@ namespace cairo
         int width = cairo_xlib_surface_get_width(mpSurface.get());
         int height = cairo_xlib_surface_get_height(mpSurface.get());
 
-        return VclPtr<VirtualDevice>::Create(&aSystemGraphicsData,
+        return VclPtr<VirtualDevice>::Create(aSystemGraphicsData,
                               Size(width, height),
                               getFormat());
     }
diff --git a/vcl/unx/gtk3/cairo_gtk3_cairo.cxx b/vcl/unx/gtk3/cairo_gtk3_cairo.cxx
index 73a650e2757c..9b273ea16cf5 100644
--- a/vcl/unx/gtk3/cairo_gtk3_cairo.cxx
+++ b/vcl/unx/gtk3/cairo_gtk3_cairo.cxx
@@ -108,7 +108,8 @@ namespace cairo
 
     VclPtr<VirtualDevice> Gtk3Surface::createVirtualDevice() const
     {
-        return VclPtrInstance<VirtualDevice>(nullptr, Size(1, 1), DeviceFormat::DEFAULT);
+        //TODO allow creating a VirtualDevice to draw to the current surface
+        return VclPtrInstance<VirtualDevice>(DeviceFormat::DEFAULT);
     }
 
 }
commit a7411c2ee537355dc8051b7059e3a4d0bc708c04
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Oct 4 10:34:24 2019 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Oct 4 20:37:32 2019 +0200

    document 0 len case of set_max_length
    
    Change-Id: I8300ff2d68f35da38e2314eefa7f2a2184981eab
    Reviewed-on: https://gerrit.libreoffice.org/80194
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/dbaccess/source/ui/control/FieldDescControl.cxx b/dbaccess/source/ui/control/FieldDescControl.cxx
index b9e20c788516..222cfe3808f9 100644
--- a/dbaccess/source/ui/control/FieldDescControl.cxx
+++ b/dbaccess/source/ui/control/FieldDescControl.cxx
@@ -496,7 +496,7 @@ void OFieldDescControl::ActivateAggregate( EControlType eType )
             return;
         m_nPos++;
         {
-            sal_Int32 nMax = EDIT_NOLIMIT;
+            sal_Int32 nMax(0);
             OUString aTmpString;
             try
             {
@@ -516,7 +516,7 @@ void OFieldDescControl::ActivateAggregate( EControlType eType )
             m_xColumnName = std::make_unique<OPropColumnEditCtrl>(
                     m_xBuilder->weld_entry("ColumnName"), aTmpString,
                     STR_HELP_DEFAULT_VALUE, FIELD_PROPERTY_COLUMNNAME);
-            m_xColumnName->set_max_length(nMax ? nMax : EDIT_NOLIMIT);
+            m_xColumnName->set_max_length(nMax);
             m_xColumnName->setCheck( isSQL92CheckEnabled(getConnection()) );
         }
 
diff --git a/dbaccess/source/ui/misc/WCPage.cxx b/dbaccess/source/ui/misc/WCPage.cxx
index 4ab6480ca136..d5f30a2d08ed 100644
--- a/dbaccess/source/ui/misc/WCPage.cxx
+++ b/dbaccess/source/ui/misc/WCPage.cxx
@@ -63,8 +63,6 @@ OCopyTable::OCopyTable(weld::Container* pPage, OCopyTableWizard* pWizard)
     , m_xFT_KeyName(m_xBuilder->weld_label("keynamelabel"))
     , m_xEdKeyName(m_xBuilder->weld_entry("keyname"))
 {
-    m_xEdTableName->set_max_length(EDIT_NOLIMIT);
-
     if ( m_pParent->m_xDestConnection.is() )
     {
         if (!m_pParent->supportsViews())
@@ -88,7 +86,7 @@ OCopyTable::OCopyTable(weld::Container* pPage, OCopyTableWizard* pWizard)
         m_xEdKeyName->set_text(m_pParent->createUniqueName("ID"));
 
         const sal_Int32 nMaxLen = m_pParent->getMaxColumnNameLength();
-        m_xEdKeyName->set_max_length(nMaxLen ? nMaxLen : EDIT_NOLIMIT);
+        m_xEdKeyName->set_max_length(nMaxLen);
     }
 
     SetPageTitle(DBA_RES(STR_COPYTABLE_TITLE_COPY));
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 67050d3f30ce..327e3762cf3d 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -1153,6 +1153,7 @@ public:
     virtual OUString get_text() const = 0;
     virtual void set_width_chars(int nChars) = 0;
     virtual int get_width_chars() const = 0;
+    // The maximum length of the entry. Use 0 for no maximum
     virtual void set_max_length(int nChars) = 0;
     // nEndPos can be -1 in order to select all text
     virtual void select_region(int nStartPos, int nEndPos) = 0;


More information about the Libreoffice-commits mailing list