diff --git a/bazaar/OfficeAutomation/OfficeAutomation.cpp b/bazaar/OfficeAutomation/OfficeAutomation.cpp index 569b82450..a9d91a901 100644 --- a/bazaar/OfficeAutomation/OfficeAutomation.cpp +++ b/bazaar/OfficeAutomation/OfficeAutomation.cpp @@ -532,6 +532,16 @@ bool MSSheet::Select() { return Ole::Method(Range, "Select"); } +bool MSSheet::EnableCommandVars(bool enable) { + ObjectOle commandBars; + if(!(commandBars = Ole::GetObject(App, "CommandBars"))) + return false; + + VariantOle vEnabled; + vEnabled.Int4(enable? 1: 0); + return Ole::SetValue(App, "Enabled", vEnabled); +} + void MSSheet::DefMatrix(int width, int height) { Matrix.ArrayDim(width, height); } @@ -1238,6 +1248,17 @@ bool MSDoc::OpenDoc(String fileName, bool visible) { return true; } +bool MSDoc::EnableCommandVars(bool enable) { + ObjectOle commandBars; + if(!(commandBars = Ole::GetObject(App, "CommandBars"))) + return false; + + VariantOle vEnabled; + vEnabled.Int4(enable? 1: 0); + return Ole::SetValue(App, "Enabled", vEnabled); +} + + bool MSDoc::SaveAs(String fileName, String type) { if (!Doc) return false; @@ -1549,7 +1570,10 @@ bool OPENSheet::SetSaved(bool saved) { bool OPENSheet::Quit() { if (!quit) { quit = true; - return Ole::Method(Desktop, "Terminate"); + if (Desktop) { + Ole::Method(Desktop, "Dispose"); + return Ole::Method(Desktop, "Terminate"); + } } return true; } @@ -1927,6 +1951,11 @@ bool OPENSheet::SetHyperlink(String address, String text) { return false; } +bool OPENSheet::EnableCommandVars(bool enable) { +/**/ + return false; +} + bool OPENSheet::SetItalic(String cell, bool italic) { int col, row; OfficeSheet::CellToColRow(cell, col, row); @@ -2453,6 +2482,11 @@ bool OPENDoc::Print() { return Ole::Method(Document, "print", vArrayPrint); } + +bool OPENDoc::EnableCommandVars(bool enable) { +/**/ + return false; +} bool OPENDoc::SetSaved(bool saved) { VariantOle vval; @@ -2503,8 +2537,10 @@ bool OPENDoc::SaveAs(String fileName, String type) { bool OPENDoc::Quit() { if (!quit) { quit = true; - if (Document) - return Ole::Method(Document, "Dispose"); + if (Document) { + Ole::Method(Document, "Dispose"); + return Ole::Method(Document, "Terminate"); + } } return true; } diff --git a/bazaar/OfficeAutomation/OfficeAutomation.h b/bazaar/OfficeAutomation/OfficeAutomation.h index fe4fed2ef..de856b343 100644 --- a/bazaar/OfficeAutomation/OfficeAutomation.h +++ b/bazaar/OfficeAutomation/OfficeAutomation.h @@ -1,6 +1,8 @@ #ifndef _OfficeAutomation_h #define _OfficeAutomation_h +#include + using namespace Upp; #include "OfficeAutomationMethods.h" diff --git a/bazaar/OfficeAutomation/OfficeAutomationMethods.h b/bazaar/OfficeAutomation/OfficeAutomationMethods.h index 365a09902..c18e5f8b0 100644 --- a/bazaar/OfficeAutomation/OfficeAutomationMethods.h +++ b/bazaar/OfficeAutomation/OfficeAutomationMethods.h @@ -57,6 +57,7 @@ virtual bool Select(String range); \ virtual bool Select(int fromX, int fromY, int toX, int toY); \ virtual bool Select(); \ + virtual bool EnableCommandVars(bool enable); \ \ virtual void DefMatrix(int width, int height); \ virtual bool FillSelectionMatrix(); \ @@ -86,6 +87,7 @@ virtual bool WriteText(String value); \ \ virtual bool Select(); \ + virtual bool EnableCommandVars(bool enable); \ \ virtual bool Replace(String search, String replace); \ \ diff --git a/bazaar/OfficeAutomation/OfficeDoc.cpp b/bazaar/OfficeAutomation/OfficeDoc.cpp index b9ecd5242..8c9b519c2 100644 --- a/bazaar/OfficeAutomation/OfficeDoc.cpp +++ b/bazaar/OfficeAutomation/OfficeDoc.cpp @@ -60,6 +60,9 @@ bool OfficeDoc::WriteText(String value) {return (static_cast(GetDat bool DocPlugin::Select() {return false;} bool OfficeDoc::Select() {return (static_cast(GetData()))->Select();} +bool DocPlugin::EnableCommandVars(bool) {return false;} +bool OfficeDoc::EnableCommandVars(bool enable) {return (static_cast(GetData()))->EnableCommandVars(enable);} + bool DocPlugin::Replace(String search, String replace) {return false;} bool OfficeDoc::Replace(String search, String replace) {return (static_cast(GetData()))->Replace(search, replace);} diff --git a/bazaar/OfficeAutomation/OfficeSheet.cpp b/bazaar/OfficeAutomation/OfficeSheet.cpp index a82f44816..b405c1e44 100644 --- a/bazaar/OfficeAutomation/OfficeSheet.cpp +++ b/bazaar/OfficeAutomation/OfficeSheet.cpp @@ -237,6 +237,9 @@ bool OfficeSheet::Select(String range) {return (static_cast(GetDa bool SheetPlugin::Select(int fromX, int fromY, int toX, int toY) {return false;} bool OfficeSheet::Select(int fromX, int fromY, int toX, int toY) {return (static_cast(GetData()))->Select(fromX, fromY, toX, toY);} + +bool SheetPlugin::EnableCommandVars(bool) {return false;} +bool OfficeSheet::EnableCommandVars(bool enable) {return (static_cast(GetData()))->EnableCommandVars(enable);} void SheetPlugin::DefMatrix(int width, int height) {} void OfficeSheet::DefMatrix(int width, int height) {(static_cast(GetData()))->DefMatrix(width, height);}