chart2/source/inc/CharacterProperties.hxx                |    3 
 chart2/source/tools/CharacterProperties.cxx              |   39 ------
 include/svx/annotation/AnnotationObject.hxx              |    1 
 include/vcl/window.hxx                                   |    1 
 sd/source/ui/inc/SlideshowLayerRenderer.hxx              |   15 --
 sd/source/ui/inc/ViewShellManager.hxx                    |    5 
 sd/source/ui/sidebar/MasterPageContainer.cxx             |   14 --
 sd/source/ui/sidebar/MasterPageContainer.hxx             |    4 
 sd/source/ui/sidebar/MasterPagesSelector.hxx             |    2 
 sd/source/ui/view/ViewShellManager.cxx                   |   18 ---
 slideshow/source/engine/slide/layermanager.cxx           |    8 -
 slideshow/source/engine/slide/layermanager.hxx           |    6 -
 svx/source/annotation/AnnotationObject.cxx               |    6 -
 sw/source/core/access/accpara.hxx                        |    7 -
 sw/source/writerfilter/ooxml/OOXMLFastContextHandler.hxx |    2 
 vcl/headless/svpvd.cxx                                   |   86 ++++++++++-----
 vcl/inc/DropdownBox.hxx                                  |    1 
 vcl/inc/IPrioritable.hxx                                 |    1 
 vcl/inc/OptionalBox.hxx                                  |    1 
 vcl/inc/headless/svpvd.hxx                               |    1 
 vcl/inc/salvd.hxx                                        |   14 +-
 vcl/qt5/QtVirtualDevice.cxx                              |   29 ++++-
 vcl/source/control/DropdownBox.cxx                       |    2 
 vcl/source/gdi/virdev.cxx                                |    1 
 vcl/source/window/OptionalBox.cxx                        |    2 
 vcl/source/window/window2.cxx                            |    5 
 26 files changed, 93 insertions(+), 181 deletions(-)

New commits:
commit 6c8c2ce7c3d6ecb57fa0736447c8aeff287c92f4
Author:     Noel Grandin <[email protected]>
AuthorDate: Thu Jan 16 13:32:04 2025 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Thu Jan 16 16:47:08 2025 +0100

    loplugin:unusedmethods
    
    Change-Id: I8041b975ee8e1cb0a75c43c6332f315627847033
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180343
    Reviewed-by: Noel Grandin <[email protected]>
    Tested-by: Jenkins

diff --git a/chart2/source/inc/CharacterProperties.hxx 
b/chart2/source/inc/CharacterProperties.hxx
index 40367f9b943d..cbc77c3859c0 100644
--- a/chart2/source/inc/CharacterProperties.hxx
+++ b/chart2/source/inc/CharacterProperties.hxx
@@ -126,9 +126,6 @@ namespace CharacterProperties
     UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) void AddDefaultsToMap( 
::chart::tPropertyValueMap & rOutMap );
 
     UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) bool IsCharacterPropertyHandle( 
sal_Int32 nHandle );
-
-    UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) css::awt::FontDescriptor 
createFontDescriptorFromPropertySet(
-        const css::uno::Reference< css::beans::XMultiPropertySet > & 
xMultiPropSet );
 }
 
 } //  namespace chart
diff --git a/chart2/source/tools/CharacterProperties.cxx 
b/chart2/source/tools/CharacterProperties.cxx
index e407b7efeecb..1d042ae30f7c 100644
--- a/chart2/source/tools/CharacterProperties.cxx
+++ b/chart2/source/tools/CharacterProperties.cxx
@@ -418,45 +418,6 @@ bool CharacterProperties::IsCharacterPropertyHandle( 
sal_Int32 nHandle )
              nHandle < CharacterProperties::FAST_PROPERTY_ID_END_CHAR_PROP );
 }
 
-awt::FontDescriptor CharacterProperties::createFontDescriptorFromPropertySet(
-    const uno::Reference< beans::XMultiPropertySet > & xMultiPropSet )
-{
-    awt::FontDescriptor aResult;
-    // Note: keep this sorted!
-    uno::Sequence< OUString > aPropNameSeq{
-        u"CharFontCharSet"_ustr,   // CharSet
-        u"CharFontFamily"_ustr,    // Family
-        u"CharFontName"_ustr,      // Name
-        u"CharFontPitch"_ustr,     // Pitch
-        u"CharFontStyleName"_ustr, // StyleName
-        u"CharHeight"_ustr,        // Height
-        u"CharPosture"_ustr,       // Slant
-        u"CharStrikeout"_ustr,     // Strikeout
-        u"CharUnderline"_ustr,     // Underline
-        u"CharWeight"_ustr,        // Weight
-        u"CharWordMode"_ustr};     // WordLineMode
-    uno::Sequence< uno::Any > aValues( xMultiPropSet->getPropertyValues( 
aPropNameSeq ));
-
-    sal_Int32 i=0;
-    // Note keep this sorted according to the list above (comments are the 
fieldnames)
-    aValues[ i++ ]  >>= aResult.CharSet;
-    aValues[ i++ ]  >>= aResult.Family;
-    aValues[ i++ ]  >>= aResult.Name;
-    aValues[ i++ ]  >>= aResult.Pitch;
-    aValues[ i++ ]  >>= aResult.StyleName;
-    float fCharHeight = 0;
-    aValues[ i++ ]  >>= fCharHeight;
-    aResult.Height = static_cast< sal_Int16 >( fCharHeight );
-    aValues[ i++ ]  >>= aResult.Slant;
-    aValues[ i++ ]  >>= aResult.Strikeout;
-    aValues[ i++ ]  >>= aResult.Underline;
-    aValues[ i++ ]  >>= aResult.Weight;
-    aValues[ i++ ]  >>= aResult.WordLineMode;
-    OSL_ASSERT( i == aValues.getLength());
-
-    return aResult;
-}
-
 } //  namespace chart
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/annotation/AnnotationObject.hxx 
b/include/svx/annotation/AnnotationObject.hxx
index 674d1290b9af..79732042465f 100644
--- a/include/svx/annotation/AnnotationObject.hxx
+++ b/include/svx/annotation/AnnotationObject.hxx
@@ -32,7 +32,6 @@ private:
     sdr::annotation::AnnotationViewData maViewData;
 
 public:
-    AnnotationObject(SdrModel& rSdrModel);
     AnnotationObject(SdrModel& rSdrModel, AnnotationObject const& rSource);
     AnnotationObject(SdrModel& rSdrModel, tools::Rectangle const& rRectangle,
                      sdr::annotation::AnnotationViewData const& 
aAnnotationViewData);
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 31d0cdfde720..9ea6cd449bb2 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -768,7 +768,6 @@ public:
     SAL_DLLPRIVATE bool                 IsDockingWindow() const;
     bool                                IsDialog() const;
     bool                                IsMenuFloatingWindow() const;
-    bool                                IsToolbarFloatingWindow() const;
     bool                                IsNativeFrame() const;
     bool                                IsTopWindow() const;
     SystemWindow*                       GetSystemWindow() const;
diff --git a/sd/source/ui/inc/SlideshowLayerRenderer.hxx 
b/sd/source/ui/inc/SlideshowLayerRenderer.hxx
index 48490c981512..858ab08178b8 100644
--- a/sd/source/ui/inc/SlideshowLayerRenderer.hxx
+++ b/sd/source/ui/inc/SlideshowLayerRenderer.hxx
@@ -135,21 +135,6 @@ struct RenderState
     {
         return maObjectsDone.find(pObject) != maObjectsDone.end();
     }
-
-    static std::string getObjectHash(SdrObject* pObject)
-    {
-        css::uno::Reference<css::drawing::XShape> xShape = 
GetXShapeForSdrObject(pObject);
-        if (xShape.is())
-        {
-            css::uno::Reference<css::uno::XInterface> xRef;
-            css::uno::Any(xShape) >>= xRef;
-            if (xRef.is())
-                return GetInterfaceHash(xRef);
-        }
-
-        SAL_WARN("sd", "RenderState::getObjectHash: failed");
-        return std::string();
-    }
 };
 
 /** Renders a slide */
diff --git a/sd/source/ui/inc/ViewShellManager.hxx 
b/sd/source/ui/inc/ViewShellManager.hxx
index 929877ad1484..68672781761b 100644
--- a/sd/source/ui/inc/ViewShellManager.hxx
+++ b/sd/source/ui/inc/ViewShellManager.hxx
@@ -83,11 +83,6 @@ public:
     void SetOverridingMainShell(const std::shared_ptr<ViewShell>& pViewShell);
     std::shared_ptr<ViewShell> GetOverridingMainShell();
 
-    /** Activate the given shell which is not a view shell.  For view shells
-        use the ActivateViewShell() method.
-    */
-    void ActivateShell(SfxShell* pShell);
-
     /** Activate the given shell, putting it at the bottom of the stack 
instead of
         the top.
      */
diff --git a/sd/source/ui/sidebar/MasterPageContainer.cxx 
b/sd/source/ui/sidebar/MasterPageContainer.cxx
index e34d979b243d..ed3445824153 100644
--- a/sd/source/ui/sidebar/MasterPageContainer.cxx
+++ b/sd/source/ui/sidebar/MasterPageContainer.cxx
@@ -77,7 +77,6 @@ public:
     void AddChangeListener (const Link<MasterPageContainerChangeEvent&,void>& 
rLink);
     void RemoveChangeListener (const 
Link<MasterPageContainerChangeEvent&,void>& rLink);
     void UpdatePreviewSizePixel();
-    const Size& GetPreviewSizePixel (PreviewSize eSize) const;
 
     bool HasToken (Token aToken) const;
     SharedMasterPageDescriptor GetDescriptor (MasterPageContainer::Token 
aToken) const;
@@ -230,11 +229,6 @@ void MasterPageContainer::SetPreviewSize (PreviewSize 
eSize)
         NIL_TOKEN);
 }
 
-Size const & MasterPageContainer::GetPreviewSizePixel() const
-{
-    return mpImpl->GetPreviewSizePixel(mePreviewSize);
-}
-
 MasterPageContainer::Token MasterPageContainer::PutMasterPage (
     const std::shared_ptr<MasterPageDescriptor>& rDescriptor)
 {
@@ -580,14 +574,6 @@ void 
MasterPageContainer::Implementation::UpdatePreviewSizePixel()
     }
 }
 
-const Size& MasterPageContainer::Implementation::GetPreviewSizePixel 
(PreviewSize eSize) const
-{
-    if (eSize == SMALL)
-        return maSmallPreviewSizePixel;
-    else
-        return maLargePreviewSizePixel;
-}
-
 MasterPageContainer::Token MasterPageContainer::Implementation::PutMasterPage (
     const SharedMasterPageDescriptor& rpDescriptor)
 {
diff --git a/sd/source/ui/sidebar/MasterPageContainer.hxx 
b/sd/source/ui/sidebar/MasterPageContainer.hxx
index d9d3cc2311a7..18e476c0303d 100644
--- a/sd/source/ui/sidebar/MasterPageContainer.hxx
+++ b/sd/source/ui/sidebar/MasterPageContainer.hxx
@@ -76,10 +76,6 @@ public:
     */
     PreviewSize GetPreviewSize() const { return mePreviewSize; }
 
-    /** Return the preview size in pixels.
-    */
-    Size const& GetPreviewSizePixel() const;
-
     enum PreviewState
     {
         PS_AVAILABLE,
diff --git a/sd/source/ui/sidebar/MasterPagesSelector.hxx 
b/sd/source/ui/sidebar/MasterPagesSelector.hxx
index 9407bf6c2f87..28c1761ccbf2 100644
--- a/sd/source/ui/sidebar/MasterPagesSelector.hxx
+++ b/sd/source/ui/sidebar/MasterPagesSelector.hxx
@@ -57,8 +57,6 @@ public:
 
     virtual void LateInit();
 
-    sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
-
     /** Make the selector empty.  This method clear the value set from any
         entries. Override this method to add functionality, especially to
         destroy objects set as data items at the value set.
diff --git a/sd/source/ui/view/ViewShellManager.cxx 
b/sd/source/ui/view/ViewShellManager.cxx
index 0e6076efb1ce..ecd8687d4fb6 100644
--- a/sd/source/ui/view/ViewShellManager.cxx
+++ b/sd/source/ui/view/ViewShellManager.cxx
@@ -107,7 +107,6 @@ public:
     void ActivateViewShell (
         ViewShell* pViewShell);
     void DeactivateViewShell (const ViewShell& rShell);
-    void ActivateShell (SfxShell& rShell);
     void ActivateLowPriorityShell (SfxShell& rShell);
     void DeactivateShell (const SfxShell& rShell);
     void ActivateShell (const ShellDescriptor& rDescriptor);
@@ -313,12 +312,6 @@ void ViewShellManager::InvalidateAllSubShells (ViewShell 
const * pViewShell)
         mpImpl->InvalidateAllSubShells(pViewShell);
 }
 
-void ViewShellManager::ActivateShell (SfxShell* pShell)
-{
-    if (mbValid && pShell!=nullptr)
-        mpImpl->ActivateShell(*pShell);
-}
-
 void ViewShellManager::ActivateLowPriorityShell (SfxShell* pShell)
 {
     if (mbValid && pShell!=nullptr)
@@ -495,17 +488,6 @@ void ViewShellManager::Implementation::DeactivateViewShell 
(const ViewShell& rSh
     DestroyViewShell(aDescriptor);
 }
 
-void ViewShellManager::Implementation::ActivateShell (SfxShell& rShell)
-{
-    ::osl::MutexGuard aGuard (maMutex);
-
-    // Create a new shell or recycle on in the cache.
-    ShellDescriptor aDescriptor;
-    aDescriptor.mpShell = &rShell;
-
-    ActivateShell(aDescriptor);
-}
-
 void ViewShellManager::Implementation::ActivateLowPriorityShell (SfxShell& 
rShell)
 {
     ::osl::MutexGuard aGuard (maMutex);
diff --git a/slideshow/source/engine/slide/layermanager.cxx 
b/slideshow/source/engine/slide/layermanager.cxx
index 5857de99997d..947b4f2580b6 100644
--- a/slideshow/source/engine/slide/layermanager.cxx
+++ b/slideshow/source/engine/slide/layermanager.cxx
@@ -299,14 +299,6 @@ namespace slideshow::internal
             mbLayerAssociationDirty = true;
         }
 
-        void LayerManager::removeAllShapes()
-        {
-            while( !maAllShapes.empty() )
-            {
-                removeShape(maAllShapes.begin()->first);
-            }
-        }
-
         ShapeSharedPtr LayerManager::lookupShape( const uno::Reference< 
drawing::XShape >& xShape ) const
         {
             ENSURE_OR_THROW( xShape.is(), "LayerManager::lookupShape(): 
invalid Shape" );
diff --git a/slideshow/source/engine/slide/layermanager.hxx 
b/slideshow/source/engine/slide/layermanager.hxx
index df6f02baa381..1969f0cccbb0 100644
--- a/slideshow/source/engine/slide/layermanager.hxx
+++ b/slideshow/source/engine/slide/layermanager.hxx
@@ -120,12 +120,6 @@ namespace slideshow::internal
              */
             bool removeShape( const ShapeSharedPtr& rShape );
 
-            /** Remove all shapes from this object
-
-                This method removes all shapes from the page.
-             */
-            void removeAllShapes();
-
             /** Lookup a Shape from an XShape model object
 
                 This method looks up the internal shape map for one
diff --git a/svx/source/annotation/AnnotationObject.cxx 
b/svx/source/annotation/AnnotationObject.cxx
index 88e63d5565ad..75de32522e92 100644
--- a/svx/source/annotation/AnnotationObject.cxx
+++ b/svx/source/annotation/AnnotationObject.cxx
@@ -109,12 +109,6 @@ Color getColorLight(sal_uInt16 aAuthorIndex)
 }
 }
 
-AnnotationObject::AnnotationObject(SdrModel& rSdrModel)
-    : SdrRectObj(rSdrModel)
-{
-    setup();
-}
-
 AnnotationObject::AnnotationObject(SdrModel& rSdrModel, AnnotationObject 
const& rSource)
     : SdrRectObj(rSdrModel, rSource)
 {
diff --git a/sw/source/core/access/accpara.hxx 
b/sw/source/core/access/accpara.hxx
index 6cef4039e915..260b6236db50 100644
--- a/sw/source/core/access/accpara.hxx
+++ b/sw/source/core/access/accpara.hxx
@@ -235,8 +235,6 @@ public:
     SwAccessibleParagraph( std::shared_ptr<SwAccessibleMap> const& pInitMap,
                            const SwTextFrame& rTextFrame );
 
-    inline operator css::accessibility::XAccessibleText *();
-
     virtual bool HasCursor() override;   // required by map to remember that 
object
 
     css::uno::Sequence< css::style::TabStop > GetCurrentTabStop( sal_Int32 
nIndex  );
@@ -374,11 +372,6 @@ public:
     virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL 
getRunAttributes( sal_Int32 nIndex, const css::uno::Sequence< OUString >& 
aRequestedAttributes ) override;
 };
 
-inline SwAccessibleParagraph::operator css::accessibility::XAccessibleText *()
-{
-    return static_cast< css::accessibility::XAccessibleEditableText * >( this 
);
-}
-
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/writerfilter/ooxml/OOXMLFastContextHandler.hxx 
b/sw/source/writerfilter/ooxml/OOXMLFastContextHandler.hxx
index 49abfde529ce..0e91ff15e5a0 100644
--- a/sw/source/writerfilter/ooxml/OOXMLFastContextHandler.hxx
+++ b/sw/source/writerfilter/ooxml/OOXMLFastContextHandler.hxx
@@ -538,8 +538,6 @@ protected:
     virtual void setToken(Token_t nToken) override;
     virtual Token_t getToken() const override;
 
-    bool isWriterFrameDetected() const { return mbIsWriterFrameDetected;}
-
 private:
     css::uno::Reference<css::xml::sax::XFastContextHandler> mxWrappedContext;
     rtl::Reference<OOXMLFastContextHandlerShape> mxShapeHandler;
diff --git a/vcl/inc/DropdownBox.hxx b/vcl/inc/DropdownBox.hxx
index 0e3c3e315561..a66a841100eb 100644
--- a/vcl/inc/DropdownBox.hxx
+++ b/vcl/inc/DropdownBox.hxx
@@ -39,7 +39,6 @@ public:
 
     void HideContent() override;
     void ShowContent() override;
-    bool IsHidden() override;
 
 private:
     DECL_LINK(PBClickHdl, Button*, void);
diff --git a/vcl/inc/IPrioritable.hxx b/vcl/inc/IPrioritable.hxx
index 0b8dec9ec095..0ad53dd9c076 100644
--- a/vcl/inc/IPrioritable.hxx
+++ b/vcl/inc/IPrioritable.hxx
@@ -40,7 +40,6 @@ public:
 
     virtual void HideContent() = 0;
     virtual void ShowContent() = 0;
-    virtual bool IsHidden() = 0;
 
 private:
     int m_nPriority;
diff --git a/vcl/inc/OptionalBox.hxx b/vcl/inc/OptionalBox.hxx
index 05ab1cbf0cff..6ba0a4f4ce77 100644
--- a/vcl/inc/OptionalBox.hxx
+++ b/vcl/inc/OptionalBox.hxx
@@ -33,7 +33,6 @@ public:
 
     void HideContent() override;
     void ShowContent() override;
-    bool IsHidden() override;
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/control/DropdownBox.cxx 
b/vcl/source/control/DropdownBox.cxx
index 6aaf2e553ace..b1895ecbdf9d 100644
--- a/vcl/source/control/DropdownBox.cxx
+++ b/vcl/source/control/DropdownBox.cxx
@@ -65,8 +65,6 @@ void DropdownBox::HideContent()
     }
 }
 
-bool DropdownBox::IsHidden() { return !m_bInFullView; }
-
 void DropdownBox::ShowContent()
 {
     if (!m_bInFullView)
diff --git a/vcl/source/window/OptionalBox.cxx 
b/vcl/source/window/OptionalBox.cxx
index 28055f7e210e..53ffe41afe39 100644
--- a/vcl/source/window/OptionalBox.cxx
+++ b/vcl/source/window/OptionalBox.cxx
@@ -57,6 +57,4 @@ void OptionalBox::ShowContent()
     }
 }
 
-bool OptionalBox::IsHidden() { return !m_bInFullView; }
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index 173edb8932e0..616ff93da13c 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -1075,11 +1075,6 @@ bool Window::IsMenuFloatingWindow() const
     return mpWindowImpl && mpWindowImpl->mbMenuFloatingWindow;
 }
 
-bool Window::IsToolbarFloatingWindow() const
-{
-    return mpWindowImpl && mpWindowImpl->mbToolbarFloatingWindow;
-}
-
 bool Window::IsNativeFrame() const
 {
     if( mpWindowImpl->mbFrame )
commit 2507d08388dd03547d2c5fc5aeedc5aa0f166bd1
Author:     Noel Grandin <[email protected]>
AuthorDate: Thu Jan 16 15:04:20 2025 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Thu Jan 16 16:46:54 2025 +0100

    split the SetSizeUsingBuffer code paths
    
    into one that uses pBuffer and one that does not, to make it easier to
    understand, and easier to validate.
    Consequently, add some asserts to the parts of the resulting code paths
    that look like bogus.
    
    Change-Id: I9060f780df678e03688e34f49ef5fa2d437a082c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180350
    Reviewed-by: Noel Grandin <[email protected]>
    Tested-by: Jenkins

diff --git a/vcl/headless/svpvd.cxx b/vcl/headless/svpvd.cxx
index d2b96f6253cf..eb991be08109 100644
--- a/vcl/headless/svpvd.cxx
+++ b/vcl/headless/svpvd.cxx
@@ -64,7 +64,28 @@ void SvpSalVirtualDevice::ReleaseGraphics( SalGraphics* 
pGraphics )
 
 bool SvpSalVirtualDevice::SetSize( tools::Long nNewDX, tools::Long nNewDY )
 {
-    return SetSizeUsingBuffer(nNewDX, nNewDY, nullptr);
+    if (nNewDX == 0)
+        nNewDX = 1;
+    if (nNewDY == 0)
+        nNewDY = 1;
+
+    if (m_pSurface && m_aFrameSize.getX() == nNewDX && m_aFrameSize.getY() == 
nNewDY)
+        return true;
+
+    bool bSuccess = true;
+
+    m_aFrameSize = basegfx::B2IVector(nNewDX, nNewDY);
+
+    if (m_bOwnsSurface)
+        bSuccess = CreateSurface(nNewDX, nNewDY);
+
+    assert(m_pSurface);
+
+    // update device in existing graphics
+    for (auto const& graphic : m_aGraphics)
+        graphic->setSurface(m_pSurface, m_aFrameSize);
+
+    return bSuccess;
 }
 
 bool SvpSalVirtualDevice::CreateSurface(tools::Long nNewDX, tools::Long 
nNewDY, sal_uInt8 *const pBuffer)
@@ -74,21 +95,30 @@ bool SvpSalVirtualDevice::CreateSurface(tools::Long nNewDX, 
tools::Long nNewDY,
         cairo_surface_destroy(m_pSurface);
     }
 
-    if (pBuffer)
+    // The buffer should only be set by 
VirtualDevice::SetOutputSizePixelScaleOffsetAndLOKBuffer()
+    // when used to draw a tile for LOK. It cannot be used for something else, 
because otherwise
+    // this would need a way to detect whether this is a tiled paint that 
needs LOK handling
+    // or whether it's that something else that just might happen to be called 
with LOK active.
+    assert(comphelper::LibreOfficeKit::isActive());
+    // Force scaling of the painting
+    double fScale = comphelper::LibreOfficeKit::getDPIScale();
+
+    m_pSurface = cairo_image_surface_create_for_data(pBuffer, 
CAIRO_FORMAT_ARGB32,
+                        nNewDX, nNewDY, 
cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, nNewDX));
+    dl_cairo_surface_set_device_scale(m_pSurface, fScale, fScale);
+
+    SAL_WARN_IF(cairo_surface_status(m_pSurface) != CAIRO_STATUS_SUCCESS, 
"vcl", "surface of size " << nNewDX << " by " << nNewDY << " creation failed 
with status of: " << cairo_status_to_string(cairo_surface_status(m_pSurface)));
+    return cairo_surface_status(m_pSurface) == CAIRO_STATUS_SUCCESS;
+}
+
+bool SvpSalVirtualDevice::CreateSurface(tools::Long nNewDX, tools::Long nNewDY)
+{
+    if (m_pSurface)
     {
-        // The buffer should only be set by 
VirtualDevice::SetOutputSizePixelScaleOffsetAndLOKBuffer()
-        // when used to draw a tile for LOK. It cannot be used for something 
else, because otherwise
-        // this would need a way to detect whether this is a tiled paint that 
needs LOK handling
-        // or whether it's that something else that just might happen to be 
called with LOK active.
-        assert(comphelper::LibreOfficeKit::isActive());
-        // Force scaling of the painting
-        double fScale = comphelper::LibreOfficeKit::getDPIScale();
-
-        m_pSurface = cairo_image_surface_create_for_data(pBuffer, 
CAIRO_FORMAT_ARGB32,
-                            nNewDX, nNewDY, 
cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, nNewDX));
-        dl_cairo_surface_set_device_scale(m_pSurface, fScale, fScale);
+        cairo_surface_destroy(m_pSurface);
     }
-    else if(nNewDX <= 32 && nNewDY <= 32)
+
+    if(nNewDX <= 32 && nNewDY <= 32)
     {
         double fXScale, fYScale;
         dl_cairo_surface_get_device_scale(m_pRefSurface, &fXScale, &fYScale);
@@ -115,27 +145,31 @@ bool SvpSalVirtualDevice::CreateSurface(tools::Long 
nNewDX, tools::Long nNewDY,
 bool SvpSalVirtualDevice::SetSizeUsingBuffer( tools::Long nNewDX, tools::Long 
nNewDY,
         sal_uInt8 *const pBuffer)
 {
-    bool bSuccess = true;
-
     if (nNewDX == 0)
         nNewDX = 1;
     if (nNewDY == 0)
         nNewDY = 1;
 
-    if (!m_pSurface || m_aFrameSize.getX() != nNewDX ||
-                       m_aFrameSize.getY() != nNewDY)
+    if (m_pSurface && m_aFrameSize.getX() == nNewDX && m_aFrameSize.getY() == 
nNewDY)
     {
-        m_aFrameSize = basegfx::B2IVector(nNewDX, nNewDY);
+        assert(false && "this means that the pBuffer parameter is going to be 
ignored");
+        return true;
+    }
 
-        if (m_bOwnsSurface)
-            bSuccess = CreateSurface(nNewDX, nNewDY, pBuffer);
+    bool bSuccess = true;
 
-        assert(m_pSurface);
+    m_aFrameSize = basegfx::B2IVector(nNewDX, nNewDY);
 
-        // update device in existing graphics
-        for (auto const& graphic : m_aGraphics)
-            graphic->setSurface(m_pSurface, m_aFrameSize);
-    }
+    if (m_bOwnsSurface)
+        bSuccess = CreateSurface(nNewDX, nNewDY, pBuffer);
+    else
+        assert(false && "this means that the pBuffer parameter is going to be 
ignored");
+
+    assert(m_pSurface);
+
+    // update device in existing graphics
+    for (auto const& graphic : m_aGraphics)
+        graphic->setSurface(m_pSurface, m_aFrameSize);
 
     return bSuccess;
 }
diff --git a/vcl/inc/headless/svpvd.hxx b/vcl/inc/headless/svpvd.hxx
index f1666b689aca..245634d229d9 100644
--- a/vcl/inc/headless/svpvd.hxx
+++ b/vcl/inc/headless/svpvd.hxx
@@ -37,6 +37,7 @@ class VCL_DLLPUBLIC SvpSalVirtualDevice : public 
SalVirtualDevice
     std::vector< SvpSalGraphics* >      m_aGraphics;
 
     bool CreateSurface(tools::Long nNewDX, tools::Long nNewDY, sal_uInt8 
*const pBuffer);
+    bool CreateSurface(tools::Long nNewDX, tools::Long nNewDY);
 
 protected:
     SvpSalGraphics* AddGraphics(SvpSalGraphics* aGraphics);
diff --git a/vcl/inc/salvd.hxx b/vcl/inc/salvd.hxx
index d1035feaebdd..daa790bc482e 100644
--- a/vcl/inc/salvd.hxx
+++ b/vcl/inc/salvd.hxx
@@ -44,13 +44,13 @@ public:
     virtual bool            SetSize( tools::Long nNewDX, tools::Long nNewDY ) 
= 0;
 
     // Set new size using a buffer at the given address
-    virtual bool            SetSizeUsingBuffer( tools::Long nNewDX, 
tools::Long nNewDY,
-                                                sal_uInt8 * /* pBuffer */)
-        {
-            // Only the headless virtual device has an implementation that uses
-            // pBuffer (and bTopDown).
-            return SetSize( nNewDX, nNewDY );
-        }
+    virtual bool            SetSizeUsingBuffer( tools::Long /*nNewDX*/, 
tools::Long /*nNewDY*/,
+                                                sal_uInt8 * /*pBuffer*/)
+    {
+        // Only the headless virtual device has an implementation.
+        assert(false && "unsupported");
+        return false;
+    }
 };
 
 #endif // INCLUDED_VCL_INC_SALVD_HXX
diff --git a/vcl/qt5/QtVirtualDevice.cxx b/vcl/qt5/QtVirtualDevice.cxx
index c9db9fb5d0e5..68c7c4a5add2 100644
--- a/vcl/qt5/QtVirtualDevice.cxx
+++ b/vcl/qt5/QtVirtualDevice.cxx
@@ -45,7 +45,29 @@ void QtVirtualDevice::ReleaseGraphics(SalGraphics* pGraphics)
 
 bool QtVirtualDevice::SetSize(tools::Long nNewDX, tools::Long nNewDY)
 {
-    return SetSizeUsingBuffer(nNewDX, nNewDY, nullptr);
+    if (nNewDX == 0)
+        nNewDX = 1;
+    if (nNewDY == 0)
+        nNewDY = 1;
+
+    if (m_pImage && m_aFrameSize.width() == nNewDX && m_aFrameSize.height() == 
nNewDY)
+        return true;
+
+    m_aFrameSize = QSize(nNewDX, nNewDY);
+
+    nNewDX *= m_fScale;
+    nNewDY *= m_fScale;
+
+    m_pImage.reset(new QImage(nNewDX, nNewDY, Qt_DefaultFormat32));
+
+    m_pImage->fill(Qt::transparent);
+    m_pImage->setDevicePixelRatio(m_fScale);
+
+    // update device in existing graphics
+    for (auto pQtGraph : m_aGraphics)
+        pQtGraph->ChangeQImage(m_pImage.get());
+
+    return true;
 }
 
 bool QtVirtualDevice::SetSizeUsingBuffer(tools::Long nNewDX, tools::Long 
nNewDY, sal_uInt8* pBuffer)
@@ -63,10 +85,7 @@ bool QtVirtualDevice::SetSizeUsingBuffer(tools::Long nNewDX, 
tools::Long nNewDY,
     nNewDX *= m_fScale;
     nNewDY *= m_fScale;
 
-    if (pBuffer)
-        m_pImage.reset(new QImage(pBuffer, nNewDX, nNewDY, 
Qt_DefaultFormat32));
-    else
-        m_pImage.reset(new QImage(nNewDX, nNewDY, Qt_DefaultFormat32));
+    m_pImage.reset(new QImage(pBuffer, nNewDX, nNewDY, Qt_DefaultFormat32));
 
     m_pImage->fill(Qt::transparent);
     m_pImage->setDevicePixelRatio(m_fScale);
diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx
index 9615cb8fa01e..6c44cb110fce 100644
--- a/vcl/source/gdi/virdev.cxx
+++ b/vcl/source/gdi/virdev.cxx
@@ -291,6 +291,7 @@ bool VirtualDevice::InnerImplSetOutputSizePixel( const 
Size& rNewSize, bool bEra
     }
     else
     {
+        assert(!pBuffer && "passing pBuffer without bErase is not supported");
         std::unique_ptr<SalVirtualDevice> pNewVirDev;
         ImplSVData*         pSVData = ImplGetSVData();
 

Reply via email to