summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-08-23 12:18:40 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-08-23 12:20:23 +0200
commit7190adcd400aee9125fee4e559410c5f346e1058 (patch)
tree7a2aa596786c67beaf911fb58eaaf2521ea555c9
parentd239bf6d79e93f650a4241fcd2da0cb77c9cb95b (diff)
external data: test application for my UI workfeature/external-data-ui
Change-Id: I9da2f9d29a209cefaac3e1af429e606a47792039
-rw-r--r--Repository.mk1
-rw-r--r--sc/Executable_tabview.mk41
-rw-r--r--sc/Module_sc.mk1
-rw-r--r--sc/inc/document.hxx2
-rw-r--r--sc/inc/fillinfo.hxx2
-rw-r--r--sc/source/ui/inc/output.hxx2
-rw-r--r--sc/workben/tabview.cxx158
7 files changed, 204 insertions, 3 deletions
diff --git a/Repository.mk b/Repository.mk
index 623e956bd282..8d7d147424e7 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -56,6 +56,7 @@ $(eval $(call gb_Helper_register_executables,NONE, \
sp2bv \
svg2odf \
svidl \
+ tabview \
$(if $(ENABLE_ONLINE_UPDATE_MAR),\
test_updater_dialog \
) \
diff --git a/sc/Executable_tabview.mk b/sc/Executable_tabview.mk
new file mode 100644
index 000000000000..f7ac50f04a55
--- /dev/null
+++ b/sc/Executable_tabview.mk
@@ -0,0 +1,41 @@
+# -*- 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,tabview))
+
+$(eval $(call gb_Executable_use_api,tabview,\
+ offapi \
+ udkapi \
+))
+
+$(eval $(call gb_Executable_use_external,tabview,boost_headers))
+
+$(eval $(call gb_Executable_set_include,tabview,\
+ $$(INCLUDE) \
+ -I$(SRCDIR)/sc/inc \
+ -I$(SRCDIR)/sc/source/ui/inc \
+))
+
+$(eval $(call gb_Executable_use_libraries,tabview,\
+ tl \
+ sal \
+ sc \
+ scui \
+ vcl \
+ cppu \
+ cppuhelper \
+ comphelper \
+))
+
+$(eval $(call gb_Executable_add_exception_objects,tabview,\
+ sc/workben/tabview \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk
index 766069c2676d..3a2537194852 100644
--- a/sc/Module_sc.mk
+++ b/sc/Module_sc.mk
@@ -14,6 +14,7 @@ $(eval $(call gb_Module_add_targets,sc,\
Library_sc \
Library_scd \
Library_scfilt \
+ Executable_tabview \
$(call gb_Helper_optional,DESKTOP,Library_scui) \
$(call gb_Helper_optional,OPENCL,Package_opencl) \
Package_res_xml \
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 67e8ed4a3ba3..719bcac172b3 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1875,7 +1875,7 @@ public:
void SetSrcCharSet( rtl_TextEncoding eNew ) { eSrcSet = eNew; }
void UpdateFontCharSet();
- void FillInfo( ScTableInfo& rTabInfo, SCCOL nCol1, SCROW nRow1,
+ SC_DLLPUBLIC void FillInfo( ScTableInfo& rTabInfo, SCCOL nCol1, SCROW nRow1,
SCCOL nCol2, SCROW nRow2, SCTAB nTab, double fColScale,
double fRowScale, bool bPageMode, bool bFormulaMode,
const ScMarkData* pMarkData = nullptr );
diff --git a/sc/inc/fillinfo.hxx b/sc/inc/fillinfo.hxx
index 53de02b0eca5..82d4c197d8c9 100644
--- a/sc/inc/fillinfo.hxx
+++ b/sc/inc/fillinfo.hxx
@@ -188,7 +188,7 @@ struct RowInfo
bool bChanged:1; // TRUE, if not tested
};
-struct ScTableInfo
+struct SC_DLLPUBLIC ScTableInfo
{
svx::frame::Array maArray;
std::unique_ptr<RowInfo[]>
diff --git a/sc/source/ui/inc/output.hxx b/sc/source/ui/inc/output.hxx
index acc7ec251264..a48d4a2b5892 100644
--- a/sc/source/ui/inc/output.hxx
+++ b/sc/source/ui/inc/output.hxx
@@ -57,7 +57,7 @@ enum ScOutputType { OUTTYPE_WINDOW, OUTTYPE_PRINTER };
class ScFieldEditEngine;
-class ScOutputData
+class SC_DLLPUBLIC ScOutputData
{
friend class ScDrawStringsVars;
friend class ScGridWindow;
diff --git a/sc/workben/tabview.cxx b/sc/workben/tabview.cxx
new file mode 100644
index 000000000000..a010b3ac207d
--- /dev/null
+++ b/sc/workben/tabview.cxx
@@ -0,0 +1,158 @@
+/* -*- 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 <sal/main.h>
+#include <tools/extendapplicationenvironment.hxx>
+
+#include <cppuhelper/bootstrap.hxx>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <vcl/svapp.hxx>
+#include <vcl/window.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/outdev.hxx>
+#include <vcl/virdev.hxx>
+
+#include "output.hxx"
+#include "document.hxx"
+#include "fillinfo.hxx"
+#include "scdll.hxx"
+
+using namespace ::com::sun::star;
+
+class CalcTestApp : public Application
+{
+public:
+ virtual int Main() override;
+ virtual void Exception( ExceptionCategory nCategory ) override;
+};
+
+class TestWindow : public Dialog
+{
+ std::unique_ptr<ScDocument> mpDoc;
+ public:
+ TestWindow() :
+ Dialog( nullptr ),
+ mpDoc(new ScDocument)
+ {
+ mpDoc->InsertTab(0, "test");
+ mpDoc->SetValue(0, 0, 0, 10);
+ mpDoc->SetValue(2, 2, 0, 10);
+ SetText( "OutDev grinding" );
+ SetSizePixel( Size( 1024, 1024 ) );
+ EnablePaint( true );
+ Show();
+ }
+
+ ~TestWindow()
+ {
+ disposeOnce();
+ }
+
+ void dispose() override
+ {
+ Dialog::dispose();
+ }
+
+ virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
+};
+
+void TestWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&)
+{
+ rRenderContext.SetFillColor(Color(0, 255, 255));
+ rRenderContext.DrawRect(tools::Rectangle(0, 0, 100, 100));
+ ScTableInfo aTableInfo;
+ mpDoc->FillInfo(aTableInfo, 0, 0, 10, 10, 0, 0.06666, 0.06666, false, false);
+ ScOutputData aOutput(&rRenderContext, OUTTYPE_WINDOW, aTableInfo, mpDoc.get(), 0,
+ 0, 0, 0, 0, 10, 10, 0.06666, 0.06666);
+
+ aOutput.SetGridColor(COL_BLACK);
+ aOutput.SetSolidBackground(true);
+ aOutput.DrawClear();
+ aOutput.DrawDocumentBackground();
+ aOutput.DrawGrid(rRenderContext, true, false);
+ aOutput.DrawStrings();
+
+ fflush(stdout);
+}
+
+void CalcTestApp::Exception( ExceptionCategory nCategory )
+{
+ switch( nCategory )
+ {
+ case ExceptionCategory::ResourceNotLoaded:
+ Abort( "Error: could not load language resources.\nPlease check your installation.\n" );
+ break;
+ default: break;
+ }
+}
+
+int CalcTestApp::Main()
+{
+ ScDLL::Init();
+ ScGlobal::Init();
+ ScopedVclPtrInstance<TestWindow> aWindow;
+ aWindow->Execute();
+ return 0;
+}
+
+SAL_IMPLEMENT_MAIN()
+{
+ try
+ {
+ bool bHelp = false;
+
+ for( sal_uInt16 i = 0; i < Application::GetCommandLineParamCount(); i++ )
+ {
+ OUString aParam = Application::GetCommandLineParam( i );
+
+ if( aParam == "--help" || aParam == "-h" )
+ bHelp = true;
+ }
+
+ if( bHelp )
+ {
+ printf( "sc\n" );
+ return EXIT_SUCCESS;
+ }
+
+ tools::extendApplicationEnvironment();
+
+ uno::Reference< uno::XComponentContext > xContext = cppu::defaultBootstrap_InitialComponentContext();
+ uno::Reference< lang::XMultiServiceFactory > xServiceManager( xContext->getServiceManager(), uno::UNO_QUERY );
+
+ if( !xServiceManager.is() )
+ Application::Abort( "Failed to bootstrap" );
+
+ comphelper::setProcessServiceFactory( xServiceManager );
+
+ InitVCL();
+
+ CalcTestApp aApp;
+ aApp.Main();
+
+ DeInitVCL();
+ }
+ catch (const css::uno::Exception& e)
+ {
+ SAL_WARN("vcl.app", "Fatal exception: " << e.Message);
+ return EXIT_FAILURE;
+ }
+ catch (const std::exception& e)
+ {
+ SAL_WARN("vcl.app", "Fatal exception: " << e.what());
+ return EXIT_FAILURE;
+ }
+
+ return EXIT_SUCCESS;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */