summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorRiccardo Magliocchetti <riccardo.magliocchetti@gmail.com>2012-02-10 17:28:49 +0100
committerMichael Meeks <michael.meeks@suse.com>2012-02-17 16:44:56 +0000
commit2130deb2d13f7cbb5b5e55c061ad794e47e6999d (patch)
tree8d612af075ed67d74a69aa1294159ed7de18c21d /vcl
parenta818fa05c34bb2e969e2fe1972d9a52774538beb (diff)
Introduce headless switch for X / cairo / toolkit less build
The plan is to reduce dependencies to be easier to deploy libreoffice server side in headless mode.
Diffstat (limited to 'vcl')
-rw-r--r--vcl/Library_vcl.mk60
-rw-r--r--vcl/Module_vcl.mk6
-rw-r--r--vcl/headless/headlessinst.cxx135
-rw-r--r--vcl/inc/generic/gendata.hxx3
-rw-r--r--vcl/inc/svsys.h1
-rw-r--r--vcl/null/printerinfomanager.cxx4
-rw-r--r--vcl/unx/generic/plugadapt/salplug.cxx4
-rw-r--r--vcl/unx/generic/printer/ppdparser.cxx2
-rw-r--r--vcl/vcl.headless.component40
9 files changed, 251 insertions, 4 deletions
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index c21a3d4de6b2..3ac253db3aeb 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -36,6 +36,8 @@ else ifeq ($(GUIBASE),android)
$(eval $(call gb_Library_set_componentfile,vcl,vcl/vcl.android))
else ifeq ($(OS),IOS)
$(eval $(call gb_Library_set_componentfile,vcl,vcl/vcl.ios))
+else ifeq ($(GUIBASE),headless)
+$(eval $(call gb_Library_set_componentfile,vcl,vcl/vcl.headless))
else
$(eval $(call gb_Library_set_componentfile,vcl,vcl/vcl.unx))
endif
@@ -434,6 +436,64 @@ $(eval $(call gb_Library_use_externals,vcl,\
))
endif
+ifeq ($(GUIBASE),headless)
+$(eval $(call gb_Library_add_cxxflags,vcl,\
+ $$(FREETYPE_CFLAGS) \
+))
+$(eval $(call gb_Library_add_defs,vcl,\
+ -DHEADLESS \
+ -DSAL_DLLPREFIX=\"$(gb_Library_SYSPRE)\" \
+ -DSAL_DLLPOSTFIX=\"$(gb_Library_OOOEXT)\" \
+ -D_XSALSET_LIBNAME=\"$(call gb_Library_get_runtime_filename,spa)\" \
+))
+$(eval $(call gb_Library_add_exception_objects,vcl,\
+ vcl/generic/app/gensys \
+ vcl/generic/app/geninst \
+ vcl/generic/app/gendisp \
+ vcl/generic/print/bitmap_gfx \
+ vcl/generic/print/common_gfx \
+ vcl/generic/print/glyphset \
+ vcl/generic/print/printerjob \
+ vcl/generic/print/psputil \
+ vcl/generic/print/genpspgraphics \
+ vcl/generic/print/genprnpsp \
+ vcl/generic/print/text_gfx \
+ vcl/generic/fontmanager/fontsubst \
+ vcl/generic/glyphs/gcach_ftyp \
+ vcl/generic/glyphs/gcach_layout \
+ vcl/generic/glyphs/gcach_rbmp \
+ vcl/generic/glyphs/glyphcache \
+ vcl/generic/fontmanager/fontcache \
+ vcl/generic/fontmanager/fontconfig \
+ vcl/generic/fontmanager/fontmanager \
+ vcl/generic/fontmanager/helper \
+ vcl/generic/fontmanager/parseAFM \
+ vcl/unx/generic/printer/jobdata \
+ vcl/unx/generic/printer/ppdparser \
+ vcl/null/printerinfomanager \
+ vcl/headless/headlessinst \
+ vcl/headless/svpbmp \
+ vcl/headless/svpdummies \
+ vcl/headless/svpelement \
+ vcl/headless/svpframe \
+ vcl/headless/svpgdi \
+ vcl/headless/svpinst \
+ vcl/headless/svpdata \
+ vcl/headless/svpprn \
+ vcl/headless/svptext \
+ vcl/headless/svpvd \
+))
+
+$(eval $(call gb_Library_add_linked_libs,vcl,\
+ basebmp \
+))
+
+$(eval $(call gb_Library_use_externals,vcl,\
+ fontconfig \
+ freetype \
+))
+endif
+
ifeq ($(GUIBASE),android)
$(eval $(call gb_Library_add_libs,vcl,\
-llog \
diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk
index 0a91f8795cc8..f9b86ed6fdf5 100644
--- a/vcl/Module_vcl.mk
+++ b/vcl/Module_vcl.mk
@@ -67,6 +67,12 @@ $(eval $(call gb_Module_add_targets,vcl,\
endif
endif
+ifeq ($(GUIBASE),headless)
+$(eval $(call gb_Module_add_targets,vcl,\
+ Library_vclplug_svp \
+))
+endif
+
ifeq ($(GUIBASE),aqua)
$(eval $(call gb_Module_add_targets,vcl,\
Package_osx \
diff --git a/vcl/headless/headlessinst.cxx b/vcl/headless/headlessinst.cxx
new file mode 100644
index 000000000000..bde892fa7c23
--- /dev/null
+++ b/vcl/headless/headlessinst.cxx
@@ -0,0 +1,135 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2012 Novell, Inc.
+ * Michael Meeks <michael.meeks@suse.com> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+#include <headless/svpinst.hxx>
+#include <headless/svpdummies.hxx>
+#include <generic/gendata.hxx>
+
+class HeadlessSalInstance : public SvpSalInstance
+{
+public:
+ HeadlessSalInstance( SalYieldMutex *pMutex );
+ virtual ~HeadlessSalInstance();
+
+ virtual SalSystem* CreateSalSystem();
+};
+
+HeadlessSalInstance::HeadlessSalInstance( SalYieldMutex *pMutex ) :
+ SvpSalInstance( pMutex)
+{
+}
+
+HeadlessSalInstance::~HeadlessSalInstance()
+{
+}
+
+class HeadlessSalSystem : public SvpSalSystem {
+#if 0
+public:
+ AndroidSalSystem() : SvpSalSystem() {}
+ virtual ~AndroidSalSystem() {}
+ virtual int ShowNativeDialog( const rtl::OUString& rTitle,
+ const rtl::OUString& rMessage,
+ const std::list< rtl::OUString >& rButtons,
+ int nDefButton )
+ {
+ (void)rButtons; (void)nDefButton;
+ __android_log_print(ANDROID_LOG_INFO, "LibreOffice - dialog '%s': '%s'",
+ rtl::OUStringToOString(rTitle, RTL_TEXTENCODING_ASCII_US).getStr(),
+ rtl::OUStringToOString(rMessage, RTL_TEXTENCODING_ASCII_US).getStr());
+ return 0;
+ }
+#endif
+};
+
+SalSystem *HeadlessSalInstance::CreateSalSystem()
+{
+ return new HeadlessSalSystem();
+}
+
+class HeadlessSalData : public SalGenericData
+{
+public:
+ HeadlessSalData( SalInstance *pInstance ) : SalGenericData( SAL_DATA_HEADLESS, pInstance ) {}
+ virtual void ErrorTrapPush() {}
+ virtual bool ErrorTrapPop( bool ) { return false; }
+};
+
+// All the interesting stuff is slaved from the AndroidSalInstance
+void InitSalData() {}
+void DeInitSalData() {}
+void InitSalMain() {}
+void DeInitSalMain() {}
+
+void SalAbort( const rtl::OUString& rErrorText, bool bDumpCore )
+{
+ rtl::OUString aError( rErrorText );
+ if( aError.isEmpty() )
+ aError = rtl::OUString::createFromAscii("Unknown application error");
+ ::fprintf( stderr, "%s\n", rtl::OUStringToOString(rErrorText, osl_getThreadTextEncoding()).getStr() );
+
+ ::fprintf( stderr, "SalAbort: '%s'",
+ rtl::OUStringToOString(aError, RTL_TEXTENCODING_ASCII_US).getStr());
+ if( bDumpCore )
+ abort();
+ else
+ _exit(1);
+}
+
+const OUString& SalGetDesktopEnvironment()
+{
+ static rtl::OUString aEnv( RTL_CONSTASCII_USTRINGPARAM( "headless" ) );
+ return aEnv;
+}
+
+SalData::SalData() :
+ m_pInstance( 0 ),
+ m_pPlugin( 0 ),
+ m_pPIManager(0 )
+{
+}
+
+SalData::~SalData()
+{
+}
+
+// This is our main entry point:
+SalInstance *CreateSalInstance()
+{
+ HeadlessSalInstance* pInstance = new HeadlessSalInstance( new SalYieldMutex() );
+ new HeadlessSalData( pInstance );
+ return pInstance;
+}
+
+void DestroySalInstance( SalInstance *pInst )
+{
+ pInst->ReleaseYieldMutex();
+ delete pInst;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/generic/gendata.hxx b/vcl/inc/generic/gendata.hxx
index f76b70f11a93..f6e2668a261c 100644
--- a/vcl/inc/generic/gendata.hxx
+++ b/vcl/inc/generic/gendata.hxx
@@ -40,7 +40,8 @@ class GtkSalDisplay;
enum SalGenericDataType { SAL_DATA_GTK, SAL_DATA_GTK3,
SAL_DATA_KDE3, SAL_DATA_KDE4,
SAL_DATA_UNX, SAL_DATA_SVP,
- SAL_DATA_ANDROID, SAL_DATA_IOS };
+ SAL_DATA_ANDROID, SAL_DATA_IOS,
+ SAL_DATA_HEADLESS };
class VCL_DLLPUBLIC SalGenericData : public SalData
{
diff --git a/vcl/inc/svsys.h b/vcl/inc/svsys.h
index 0976282bc898..0fbb9ce81a5a 100644
--- a/vcl/inc/svsys.h
+++ b/vcl/inc/svsys.h
@@ -39,6 +39,7 @@
#include "ios/svsys.h"
#elif defined ANDROID
#include "android/svsys.h"
+#elif defined HEADLESS
#else
#include "unx/svsys.h"
#endif
diff --git a/vcl/null/printerinfomanager.cxx b/vcl/null/printerinfomanager.cxx
index 4616c1003fa4..e5adda76e650 100644
--- a/vcl/null/printerinfomanager.cxx
+++ b/vcl/null/printerinfomanager.cxx
@@ -60,7 +60,11 @@ PrinterInfoManager::PrinterInfoManager( Type eType ) :
m_bUseIncludeFeature( false ),
m_bUseJobPatch( true ),
m_aSystemDefaultPaper( RTL_CONSTASCII_USTRINGPARAM( "A4" ) ),
+#ifdef HEADLESS
+ m_bDisableCUPS( true )
+#else
m_bDisableCUPS( false )
+#endif
{
// initSystemDefaultPaper();
}
diff --git a/vcl/unx/generic/plugadapt/salplug.cxx b/vcl/unx/generic/plugadapt/salplug.cxx
index 916dbe2f1d17..6b5279af975a 100644
--- a/vcl/unx/generic/plugadapt/salplug.cxx
+++ b/vcl/unx/generic/plugadapt/salplug.cxx
@@ -53,7 +53,7 @@ static oslModule pCloseModule = NULL;
static SalInstance* tryInstance( const OUString& rModuleBase, bool bForce = false )
{
SalInstance* pInst = NULL;
-#ifndef ANDROID
+#if !defined(ANDROID) || !defined(HEADLESS)
// Disable gtk3 plugin load except in experimental mode for now.
if( !bForce &&
rModuleBase.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "gtk3" ) ) &&
@@ -129,7 +129,7 @@ static SalInstance* tryInstance( const OUString& rModuleBase, bool bForce = fals
return pInst;
}
-#ifndef ANDROID
+#if !defined(ANDROID) || !defined(HEADLESS)
static DesktopType get_desktop_environment()
{
diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx
index fdb0f4ed3bd5..36a53b6aa65b 100644
--- a/vcl/unx/generic/printer/ppdparser.cxx
+++ b/vcl/unx/generic/printer/ppdparser.cxx
@@ -655,7 +655,7 @@ const PPDParser* PPDParser::getParser( const String& rFile )
PrinterInfoManager& rMgr = PrinterInfoManager::get();
if( rMgr.getType() == PrinterInfoManager::CUPS )
{
-#ifndef ANDROID
+#if !defined(ANDROID) && !defined(HEADLESS)
pNewParser = const_cast<PPDParser*>(static_cast<CUPSManager&>(rMgr).createCUPSParser( aFile ));
#endif
}
diff --git a/vcl/vcl.headless.component b/vcl/vcl.headless.component
new file mode 100644
index 000000000000..885b1f039e79
--- /dev/null
+++ b/vcl/vcl.headless.component
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary" prefix="vcl"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.frame.VCLSessionManagerClient">
+ <service name="com.sun.star.frame.SessionManagerClient"/>
+ </implementation>
+ <implementation name="vcl::DisplayAccess">
+ <service name="com.sun.star.awt.DisplayAccess"/>
+ </implementation>
+ <implementation name="vcl::FontIdentificator">
+ <service name="com.sun.star.awt.FontIdentificator"/>
+ </implementation>
+</component>