summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2022-01-13 22:11:04 +0100
committerJan-Marek Glogowski <glogow@fbihome.de>2022-01-14 08:47:15 +0100
commitfa7389b430f242706b1bcea430f82fffa112fb9b (patch)
tree301146f407b840044b0c660cc9652a62a114527c
parenta4d770731f4e5228ef1101c286d1815cf94a1fd9 (diff)
iOS+Android+SVP "merge" all SalData instances
It's always the same code. Change-Id: I2385d0bda24939b964306e27a3df99ea44356eac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128401 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
-rw-r--r--vcl/android/androidinst.cxx14
-rw-r--r--vcl/headless/headlessinst.cxx12
-rw-r--r--vcl/headless/svpdata.cxx14
-rw-r--r--vcl/inc/headless/svpdata.hxx25
-rw-r--r--vcl/ios/iosinst.cxx16
5 files changed, 34 insertions, 47 deletions
diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx
index dd8a76dce9d6..73760c460be5 100644
--- a/vcl/android/androidinst.cxx
+++ b/vcl/android/androidinst.cxx
@@ -14,7 +14,7 @@
#include <android/androidinst.hxx>
#include <headless/svpdummies.hxx>
-#include <unx/gendata.hxx>
+#include <headless/svpdata.hxx>
#include <osl/detail/android-bootstrap.h>
#include <rtl/strbuf.hxx>
#include <vcl/settings.hxx>
@@ -26,14 +26,6 @@
// Horrible hack
static int viewWidth = 1, viewHeight = 1;
-class AndroidSalData : public GenericUnixSalData
-{
-public:
- explicit AndroidSalData(SalInstance *pInstance) : GenericUnixSalData(pInstance) {}
- virtual void ErrorTrapPush() {}
- virtual bool ErrorTrapPop( bool ) { return false; }
-};
-
void AndroidSalInstance::GetWorkArea(tools::Rectangle& rRect)
{
rRect = tools::Rectangle( Point( 0, 0 ),
@@ -44,7 +36,7 @@ AndroidSalInstance *AndroidSalInstance::getInstance()
{
if (!ImplGetSVData())
return NULL;
- AndroidSalData *pData = static_cast<AndroidSalData *>(ImplGetSVData()->mpSalData);
+ SvpSalData *pData = static_cast<SvpSalData *>(ImplGetSVData()->mpSalData);
if (!pData)
return NULL;
return static_cast<AndroidSalInstance *>(pData->m_pInstance);
@@ -169,7 +161,7 @@ extern "C" SalInstance *create_SalInstance()
{
LOGI("Android: CreateSalInstance!");
AndroidSalInstance* pInstance = new AndroidSalInstance( std::make_unique<SvpSalYieldMutex>() );
- new AndroidSalData( pInstance );
+ new SvpSalData(pInstance);
return pInstance;
}
diff --git a/vcl/headless/headlessinst.cxx b/vcl/headless/headlessinst.cxx
index 913403041e2f..f0692e3e7273 100644
--- a/vcl/headless/headlessinst.cxx
+++ b/vcl/headless/headlessinst.cxx
@@ -8,7 +8,7 @@
*/
#include <headless/svpinst.hxx>
#include <headless/svpdummies.hxx>
-#include <unx/gendata.hxx>
+#include <headless/svpdata.hxx>
#include <unistd.h>
class HeadlessSalInstance : public SvpSalInstance
@@ -45,14 +45,6 @@ SalSystem *HeadlessSalInstance::CreateSalSystem()
return new HeadlessSalSystem();
}
-class HeadlessSalData : public GenericUnixSalData
-{
-public:
- explicit HeadlessSalData(SalInstance *pInstance) : GenericUnixSalData(pInstance) {}
- virtual void ErrorTrapPush() override {}
- virtual bool ErrorTrapPop( bool ) override { return false; }
-};
-
void SalAbort( const OUString& rErrorText, bool bDumpCore )
{
OUString aError( rErrorText );
@@ -88,7 +80,7 @@ SalData::~SalData()
SalInstance *CreateSalInstance()
{
HeadlessSalInstance* pInstance = new HeadlessSalInstance(std::make_unique<SvpSalYieldMutex>());
- new HeadlessSalData( pInstance );
+ new SvpSalData(pInstance);
pInstance->AcquireYieldMutex();
return pInstance;
}
diff --git a/vcl/headless/svpdata.cxx b/vcl/headless/svpdata.cxx
index f30f0f5728c8..ab9fa5e22f0a 100644
--- a/vcl/headless/svpdata.cxx
+++ b/vcl/headless/svpdata.cxx
@@ -7,21 +7,9 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#include <unx/gendata.hxx>
+#include <headless/svpdata.hxx>
#include <headless/svpinst.hxx>
-namespace {
-
-class SvpSalData : public GenericUnixSalData
-{
-public:
- explicit SvpSalData(SalInstance *pInstance) : GenericUnixSalData(pInstance) {}
- virtual void ErrorTrapPush() override {}
- virtual bool ErrorTrapPop( bool /*bIgnoreError*/ = true ) override { return false; }
-};
-
-}
-
// plugin factory function
SalInstance* svp_create_SalInstance()
{
diff --git a/vcl/inc/headless/svpdata.hxx b/vcl/inc/headless/svpdata.hxx
new file mode 100644
index 000000000000..bcffac25dd14
--- /dev/null
+++ b/vcl/inc/headless/svpdata.hxx
@@ -0,0 +1,25 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <unx/gendata.hxx>
+
+class SvpSalData : public GenericUnixSalData
+{
+public:
+ explicit SvpSalData(SalInstance* pInstance)
+ : GenericUnixSalData(pInstance)
+ {
+ }
+ virtual void ErrorTrapPush() override {}
+ virtual bool ErrorTrapPop(bool /*bIgnoreError*/ = true) override { return false; }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/ios/iosinst.cxx b/vcl/ios/iosinst.cxx
index 2eff5234de2b..eda4d5782614 100644
--- a/vcl/ios/iosinst.cxx
+++ b/vcl/ios/iosinst.cxx
@@ -22,6 +22,7 @@
#include <postmac.h>
#include "ios/iosinst.hxx"
+#include <headless/svpdata.hxx>
#include "headless/svpdummies.hxx"
#include "unx/gendata.hxx"
#include "quartz/utils.h"
@@ -31,17 +32,6 @@
// Totally wrong of course but doesn't seem to harm much in the iOS app.
static int viewWidth = 1, viewHeight = 1;
-class IosSalData : public GenericUnixSalData
-{
-public:
- explicit IosSalData(SalInstance *pInstance)
- : GenericUnixSalData(pInstance)
- {
- }
- virtual void ErrorTrapPush() {}
- virtual bool ErrorTrapPop( bool ) { return false; }
-};
-
void IosSalInstance::GetWorkArea( tools::Rectangle& rRect )
{
rRect = tools::Rectangle( Point( 0, 0 ),
@@ -52,7 +42,7 @@ IosSalInstance *IosSalInstance::getInstance()
{
if (!ImplGetSVData())
return NULL;
- IosSalData *pData = static_cast<IosSalData *>(ImplGetSVData()->mpSalData);
+ SvpSalData *pData = static_cast<SvpSalData *>(ImplGetSVData()->mpSalData);
if (!pData)
return NULL;
return static_cast<IosSalInstance *>(pData->m_pInstance);
@@ -172,7 +162,7 @@ SalData::~SalData()
SalInstance *CreateSalInstance()
{
IosSalInstance* pInstance = new IosSalInstance( std::make_unique<SvpSalYieldMutex>() );
- new IosSalData( pInstance );
+ new SvpSalData(pInstance);
pInstance->AcquireYieldMutex();
return pInstance;
}