Skip to content

Instantly share code, notes, and snippets.

@stephensmitchell
Created December 19, 2024 02:16
Show Gist options
  • Save stephensmitchell/15015ed4ecaa15613f218674a345a8cb to your computer and use it in GitHub Desktop.
Save stephensmitchell/15015ed4ecaa15613f218674a345a8cb to your computer and use it in GitHub Desktop.
AlibreOOConnect snippet
#pragma once
#include "frmconfiguration.h"
#include "frmparameter.h"
#include <ctype.h>
namespace AlibreOOConnect {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace unoidl::com::sun::star::lang;
using namespace unoidl::com::sun::star::uno;
using namespace unoidl::com::sun::star::sheet;
using namespace unoidl::com::sun::star::table;
using namespace unoidl::com::sun::star::bridge;
using namespace uno::util;
using namespace AlibreX;
/// <summary>
/// Zusammenfassung für Form1
///
/// Warnung: Wenn Sie den Namen dieser Klasse ändern, müssen Sie auch
/// die Ressourcendateiname-Eigenschaft für das Tool zur Kompilierung verwalteter Ressourcen ändern,
/// das allen RESX-Dateien zugewiesen ist, von denen diese Klasse abhängt.
/// Anderenfalls können die Designer nicht korrekt mit den lokalisierten Ressourcen
/// arbeiten, die diesem Formular zugewiesen sind.
/// Summary description for Form1
///
/// Warning: If you change the name of this class, you must also
/// Change the Resource File Name property for the managed resource compiler tool,
/// All the resx files is allocated by this class depends on.
/// Otherwise, the designer can not correctly resources with localized
/// Work that are associated with this form.
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
this->context= Bootstrap::bootstrap();
this->factory = (XMultiServiceFactory^)this->context->getServiceManager();
this->desktop = (unoidl::com::sun::star::frame::XDesktop^)this->factory->createInstance("com.sun.star.frame.Desktop");
this->loader = (unoidl::com::sun::star::frame::XComponentLoader^) this->desktop;
try {
this->hook=(AlibreX::IAutomationHook^)System::Runtime::InteropServices::Marshal::GetActiveObject("AlibreX.AutomationHook");
this->root=(IADRoot^)this->hook->Root;
}
catch (System::Exception^ ex)
{
MessageBox::Show("Alibre Design is not running! Please start Alibre Design first.","Error",MessageBoxButtons::OK);
this->Close();
return;
}
this->checkBox1->Checked = true;
this->TopMost = checkBox1->Checked;
this->refreshsessions();
this->bearbeitenToolStripMenuItem->Enabled = false;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment