.OfficeAutomation: Added EnableCommandVars

git-svn-id: svn://ultimatepp.org/upp/trunk@6419 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
koldo 2013-10-11 19:58:39 +00:00
parent fa743802c8
commit f1e7ecf56d
5 changed files with 49 additions and 3 deletions

View file

@ -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;
}

View file

@ -1,6 +1,8 @@
#ifndef _OfficeAutomation_h
#define _OfficeAutomation_h
#include <Functions4U/Functions4U.h>
using namespace Upp;
#include "OfficeAutomationMethods.h"

View file

@ -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); \
\

View file

@ -60,6 +60,9 @@ bool OfficeDoc::WriteText(String value) {return (static_cast<DocPlugin *>(GetDat
bool DocPlugin::Select() {return false;}
bool OfficeDoc::Select() {return (static_cast<DocPlugin *>(GetData()))->Select();}
bool DocPlugin::EnableCommandVars(bool) {return false;}
bool OfficeDoc::EnableCommandVars(bool enable) {return (static_cast<DocPlugin *>(GetData()))->EnableCommandVars(enable);}
bool DocPlugin::Replace(String search, String replace) {return false;}
bool OfficeDoc::Replace(String search, String replace) {return (static_cast<DocPlugin *>(GetData()))->Replace(search, replace);}

View file

@ -237,6 +237,9 @@ bool OfficeSheet::Select(String range) {return (static_cast<SheetPlugin *>(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<SheetPlugin *>(GetData()))->Select(fromX, fromY, toX, toY);}
bool SheetPlugin::EnableCommandVars(bool) {return false;}
bool OfficeSheet::EnableCommandVars(bool enable) {return (static_cast<DocPlugin *>(GetData()))->EnableCommandVars(enable);}
void SheetPlugin::DefMatrix(int width, int height) {}
void OfficeSheet::DefMatrix(int width, int height) {(static_cast<SheetPlugin *>(GetData()))->DefMatrix(width, height);}