calc: on editing invalidation of view with different zoom is wrong
[LibreOffice.git] / shell / source / win32 / workbench / TestSmplMail.cxx
blob18b1741e838f30a4bcab587a20ee9034ecb55894
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <com/sun/star/lang/XComponent.hpp>
21 #include <com/sun/star/registry/XSimpleRegistry.hpp>
22 #include <com/sun/star/system/XSimpleMailClientSupplier.hpp>
23 #include <cppuhelper/servicefactory.hxx>
24 #include <rtl/ustring.hxx>
25 #include <sal/types.h>
26 #include <osl/diagnose.h>
28 #include <stdio.h>
30 #include <windows.h>
32 #include <osl/file.hxx>
35 // namespaces
38 using namespace ::cppu ;
39 using namespace ::com::sun::star::uno ;
40 using namespace ::com::sun::star::lang ;
41 using namespace std ;
42 using namespace com::sun::star::system;
44 #define RDB_SYSPATH "D:\\Projects\\gsl\\shell\\wntmsci7\\bin\\applicat.rdb"
47 // global variables
50 Reference< XMultiServiceFactory > g_xFactory;
53 // main
56 // int SAL_CALL main(int nArgc, char* Argv[], char* pEnv[] )
57 // make Warning free, leave out typename
58 int SAL_CALL main(int , char*, char* )
61 // get the global service-manager
64 // Get global factory for uno services.
65 OUString rdbName = OUString( RDB_SYSPATH );
66 Reference< XMultiServiceFactory > g_xFactory( createRegistryServiceFactory( rdbName ) );
68 // Print a message if an error occurred.
69 if ( g_xFactory.is() == sal_False )
71 OSL_FAIL("Can't create RegistryServiceFactory");
72 return(-1);
75 printf("Creating RegistryServiceFactory successful\n");
78 // try to get an Interface to a XFilePicker Service
81 try
83 Reference< XSimpleMailClientSupplier > xSmplMailClientSuppl(
84 g_xFactory->createInstance("com.sun.star.system.SimpleSystemMail"), UNO_QUERY );
86 if ( !xSmplMailClientSuppl.is() )
88 OSL_FAIL( "Error creating SimpleSystemMail Service" );
89 return(-1);
92 Reference< XSimpleMailClient > xSmplMailClient(
93 xSmplMailClientSuppl->querySimpleMailClient( ) );
95 if ( xSmplMailClient.is( ) )
97 Reference< XSimpleMailMessage > xSmplMailMsg(
98 xSmplMailClient->createSimpleMailMessage( ) );
100 if ( xSmplMailMsg.is( ) )
102 xSmplMailMsg->setRecipient( OUString("tino.rachui@germany.sun.com") );
103 xSmplMailMsg->setOriginator( OUString("tino.rachui@germany.sun.com") );
105 Sequence<OUString> ccRecips { "tino.rachui@germany.sun.com" };
107 xSmplMailMsg->setCcRecipient( ccRecips );
109 Sequence<OUString> bccRecips { "tino.rachui@germany.sun.com" };
111 xSmplMailMsg->setBccRecipient( bccRecips );
113 xSmplMailMsg->setSubject( OUString("Mapi Test") );
115 Sequence< OUString > attachments( 2 );
117 OUString aFile("D:\\Projects\\gsl\\shell\\wntmsci7\\bin\\testprx.exe");
118 OUString aFileURL;
120 osl::FileBase::getFileURLFromSystemPath( aFile, aFileURL );
121 attachments[0] = aFileURL;
123 aFile = "D:\\Projects\\gsl\\shell\\wntmsci7\\bin\\testsyssh.exe";
124 osl::FileBase::getFileURLFromSystemPath( aFile, aFileURL );
126 attachments[1] = aFile;
128 xSmplMailMsg->setAttachement( attachments );
130 xSmplMailClient->sendSimpleMailMessage( xSmplMailMsg, 0 );
134 catch( Exception& )
139 // shutdown
142 // Cast factory to XComponent
143 Reference< XComponent > xComponent( g_xFactory, UNO_QUERY );
145 // Print a message if an error occurred.
146 if ( xComponent.is() == sal_False )
148 OSL_FAIL("Error shutting down");
151 // Dispose and clear factory
152 xComponent->dispose();
153 g_xFactory.clear();
155 printf("Test successful\n");
157 return 0;
160 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */