diff options
-rw-r--r-- | Repository.mk | 1 | ||||
-rw-r--r-- | sw/Executable_tiledrendering.mk | 38 | ||||
-rw-r--r-- | sw/Module_sw.mk | 1 | ||||
-rw-r--r-- | sw/qa/tiledrendering/tiledrendering.cxx | 101 |
4 files changed, 141 insertions, 0 deletions
diff --git a/Repository.mk b/Repository.mk index 5a92fd676246..666a534b68e6 100644 --- a/Repository.mk +++ b/Repository.mk @@ -99,6 +99,7 @@ $(eval $(call gb_Helper_register_executables,OOO, \ kdefilepicker \ ) \ ui-previewer \ + tiledrendering \ $(if $(filter DESKTOP,$(BUILD_TYPE)),unopkg_bin) \ xpdfimport \ $(if $(filter WNT,$(OS)), \ diff --git a/sw/Executable_tiledrendering.mk b/sw/Executable_tiledrendering.mk new file mode 100644 index 000000000000..c39b88b3ace3 --- /dev/null +++ b/sw/Executable_tiledrendering.mk @@ -0,0 +1,38 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# 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/. +# + +$(eval $(call gb_Executable_Executable,tiledrendering)) + +$(eval $(call gb_Executable_use_external,tiledrendering,boost_headers)) + +$(eval $(call gb_Executable_use_api,tiledrendering,\ + offapi \ + udkapi \ +)) + +$(eval $(call gb_Executable_use_static_libraries,tiledrendering,\ + vclmain \ +)) + +$(eval $(call gb_Executable_use_libraries,tiledrendering,\ + comphelper \ + cppu \ + cppuhelper \ + sal \ + tl \ + ucbhelper \ + vcl \ + sw \ +)) + +$(eval $(call gb_Executable_add_exception_objects,tiledrendering,\ + sw/qa/tiledrendering/tiledrendering \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk index fe83466d22ec..59f16b5b19b8 100644 --- a/sw/Module_sw.mk +++ b/sw/Module_sw.mk @@ -21,6 +21,7 @@ $(eval $(call gb_Module_Module,sw)) $(eval $(call gb_Module_add_targets,sw,\ AllLangResTarget_sw \ + Executable_tiledrendering \ Library_msword \ Library_sw \ Library_swd \ diff --git a/sw/qa/tiledrendering/tiledrendering.cxx b/sw/qa/tiledrendering/tiledrendering.cxx new file mode 100644 index 000000000000..923c79dfb946 --- /dev/null +++ b/sw/qa/tiledrendering/tiledrendering.cxx @@ -0,0 +1,101 @@ +/* -*- 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/. + */ + +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/lang/XMultiComponentFactory.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/ucb/UniversalContentBroker.hpp> +#include <comphelper/processfactory.hxx> +#include <cppuhelper/bootstrap.hxx> +#include <osl/file.hxx> +#include <vcl/builder.hxx> +#include <vcl/dialog.hxx> +#include <vcl/help.hxx> +#include <vcl/svapp.hxx> +#include <vcl/vclmain.hxx> + +class UIPreviewApp : public Application +{ +public: + virtual void Init(); + virtual int Main(); +}; + +using namespace com::sun::star; + +void UIPreviewApp::Init() +{ + uno::Reference<uno::XComponentContext> xContext = + cppu::defaultBootstrap_InitialComponentContext(); + uno::Reference<lang::XMultiComponentFactory> xFactory = + xContext->getServiceManager(); + uno::Reference<lang::XMultiServiceFactory> xSFactory = + uno::Reference<lang::XMultiServiceFactory> (xFactory, uno::UNO_QUERY_THROW); + comphelper::setProcessServiceFactory(xSFactory); + + // Create UCB (for backwards compatibility, in case some code still uses + // plain createInstance w/o args directly to obtain an instance): + ::ucb::UniversalContentBroker::create( + comphelper::getProcessComponentContext() ); +} + +int UIPreviewApp::Main() +{ + std::vector<OUString> uifiles; + for (sal_uInt16 i = 0; i < GetCommandLineParamCount(); ++i) + { + OUString aFileUrl; + osl::File::getFileURLFromSystemPath(GetCommandLineParam(i), aFileUrl); + uifiles.push_back(aFileUrl); + } + + if (uifiles.empty()) + { + fprintf(stderr, "Usage: ui-previewer file.ui\n"); + return EXIT_FAILURE; + } + + // turn on tooltips + Help::EnableQuickHelp(); + + try + { + Dialog *pDialog = new Dialog(DIALOG_NO_PARENT, WB_STDDIALOG); + + { + VclBuilder aBuilder(pDialog, OUString(), uifiles[0]); + Dialog *pRealDialog = dynamic_cast<Dialog*>(aBuilder.get_widget_root()); + + if (!pRealDialog) + pRealDialog = pDialog; + + if (pRealDialog) + { + pRealDialog->SetText(OUString("LibreOffice ui-previewer")); + pRealDialog->SetStyle(pDialog->GetStyle()|WB_CLOSEABLE); + pRealDialog->Execute(); + } + } + + delete pDialog; + } + catch (const uno::Exception &e) + { + fprintf(stderr, "fatal error: %s\n", OUStringToOString(e.Message, osl_getThreadTextEncoding()).getStr()); + } + + return EXIT_SUCCESS; +} + +void vclmain::createApplication() +{ + static UIPreviewApp aApp; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |