浏览代码

* Patch by Ludo:

- Added the optional creation of a lazarus design/runtime package for the activex container.
- Added full files in case diff doesn't work.

Fixes to typelib importer:
- avoid duplicate enum members (translated to const) (Office10\MSWORD.OLB)
- don't make TEventSink or TActiveXContainer descendants if interface does not descend from IDispatch (VBA6\VBE6EXT.OLB)
- add type declaration for coclass interface pointing to default interface
- fixed property setter for array properties
- added typecasting for byref interface event parameters
- typecasting workaround for pvarVal^ and pbstrVal^ "Can't take the address of constant expressions" error caused by var type mismatch OLEVariant <> Variant and POleStr<>WideString
- reverted to the use of OLEVariant. POLEVariant isn't automatable in trunk but PVariant isn't automatable in 2.6.0 neither.
- added byref VT_INT, VT_UINT, VT_DECIMAL event parameter support (Office10\MSWORD.OLB)
- replace the use of TOleEnum with LongWord. Definition in ActiveX (type TOleEnum = type LongWord;) prohibits casting of OleVariant to TOleEnum.(Office10\MSOUTL.OLB)
- disambiguate method name for INVOKE_PROPERTYPUT and INVOKE_PROPERTYPUTREF on same property (ado\msado25.tlb)
- postpone interface declaration until full declaration of ancestor class.

git-svn-id: trunk@20157 -
marco 13 年之前
父节点
当前提交
6182f2d25d
共有 2 个文件被更改,包括 515 次插入176 次删除
  1. 492 169
      packages/winunits-base/src/typelib.pas
  2. 23 7
      utils/importtl/importtl.pas

文件差异内容过多而无法显示
+ 492 - 169
packages/winunits-base/src/typelib.pas


+ 23 - 7
utils/importtl/importtl.pas

@@ -6,24 +6,25 @@ uses
   classes,typelib,sysutils;
   classes,typelib,sysutils;
 
 
 var
 var
-  unitname:string;
+  unitname,sPackageSource,sPackageRegUnitSource:string;
   sTL,sOutDir:string;
   sTL,sOutDir:string;
   F:text;
   F:text;
   slDep:TStringList;
   slDep:TStringList;
   i:integer;
   i:integer;
-  bNoRecurse,bHelp, bActivex:boolean;
-
+  bNoRecurse,bHelp,bActiveX,bPackage:boolean;
 begin
 begin
   slDep:=TStringList.Create;
   slDep:=TStringList.Create;
   bNoRecurse:=false;
   bNoRecurse:=false;
   bHelp:=false;
   bHelp:=false;
   bActiveX:=false;
   bActiveX:=false;
+  bPackage:=false;
   i:=1;
   i:=1;
   while i<=Paramcount do
   while i<=Paramcount do
     begin
     begin
     if pos('-n',ParamStr(i))>0 then bNoRecurse:=true
     if pos('-n',ParamStr(i))>0 then bNoRecurse:=true
     else if pos('-a',ParamStr(i))>0 then bActiveX:=true
     else if pos('-a',ParamStr(i))>0 then bActiveX:=true
     else if pos('-h',ParamStr(i))>0 then bHelp:=true
     else if pos('-h',ParamStr(i))>0 then bHelp:=true
+    else if pos('-p',ParamStr(i))>0 then bPackage:=true
     else if pos('-d',ParamStr(i))>0 then
     else if pos('-d',ParamStr(i))>0 then
       begin
       begin
       sOutDir:=trim(copy(ParamStr(i), pos('-d',ParamStr(i))+2, 260));  // windows MAX_PATH
       sOutDir:=trim(copy(ParamStr(i), pos('-d',ParamStr(i))+2, 260));  // windows MAX_PATH
@@ -54,17 +55,32 @@ begin
     writeln('  -d dir: set output directory. Default: current directory.');
     writeln('  -d dir: set output directory. Default: current directory.');
     writeln('  -n    : do not recurse typelibs. Default: create bindingss for all');
     writeln('  -n    : do not recurse typelibs. Default: create bindingss for all');
     writeln('          dependencies.');
     writeln('          dependencies.');
+    writeln('  -p    : create lazarus package for ActiveXContainer descendants');
     exit;
     exit;
     end;
     end;
   slDep.Add(paramstr(Paramcount));
   slDep.Add(paramstr(Paramcount));
   i:=0;
   i:=0;
   repeat
   repeat
     writeln('Reading typelib from '+slDep[i]+ ' ...');
     writeln('Reading typelib from '+slDep[i]+ ' ...');
-    sTL:=ImportTypelib(slDep[i],unitname,slDep,bActiveX);
-    bActiveX:=false;  //don't create ActiveXContainer descendants in descendants
+    sTL:=ImportTypelib(slDep[i],unitname,slDep,bActiveX,bPackage,sPackageSource,sPackageRegUnitSource);
     unitname:=sOutDir+unitname;
     unitname:=sOutDir+unitname;
-    writeln('Writing to '+unitname);
-    AssignFile(F,unitname);
+    if (bPackage) and (sPackageSource<>'') then
+      begin
+      writeln('Writing package file to '+unitname+'P.lpk' );
+      AssignFile(F,unitname+'P.lpk');
+      Rewrite(F);
+      Write(F,sPackageSource);
+      CloseFile(F);
+      writeln('Writing package registration file to '+unitname+'Preg.pas');
+      AssignFile(F,unitname+'Preg.pas');
+      Rewrite(F);
+      Write(F,sPackageSource);
+      CloseFile(F);
+      end;
+    bActiveX:=false;  //don't create ActiveXContainer descendants in descendants
+    bPackage:=false;
+    writeln('Writing to '+unitname+'.pas');
+    AssignFile(F,unitname+'.pas');
     Rewrite(F);
     Rewrite(F);
     Write(F,sTL);
     Write(F,sTL);
     CloseFile(F);
     CloseFile(F);

部分文件因为文件数量过多而无法显示