I downloaded HB-Report (https://sourceforge.net/projects/hb-reports/), but when I try to use it in a FireMonkey Android project, the PlatformExtensions gives an error. When I try to add the Android extension to the unit, a different error shows.
For more detail, download the component, I'm trying to use this component on Android.
This is the unit:
{*****************************************************************************}
{ }
{ This file is part of the HBReports components Library }
{ }
{ See the file COPYING.LGPL.txt included in this distribution, }
{ for details about the Licence and Copyright. }
{ }
{ This code is distributed in the hope that it will be useful, }
{ but WITHOUT ANY WARRANTY; without even the implied warranty of }
{ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. }
{ }
{ Author: Leslie John Kaye : www.leskaye.com }
{ }
{ Abstract: }
{ Platform extensions }
{ }
{*****************************************************************************}
unit FMX.PlatformExtensions;
interface
uses
System.Classes,
{$IFDEF MSWINDOWS}
System.AnsiStrings, Winapi.Windows//, WinProcs
{$ENDIF}
{$IFDEF MACOS)}
Macapi.CoreFoundation, Macapi.Foundation, MacApi.Appkit
{$ENDIF MACOS}
{$ifdef Android}
FMX.Helpers.Android, AndroidAPI.Helpers,
AndroidApi.JNI.GraphicsContentViewText,
AndroidApi.JNI.Net, AndroidApi.JNI.JavaTypes;
{$endif Android}
type
TPlatformExtensions = class(TObject)
public
class procedure GetSystemFonts(FontList: TStrings);
end;
var
PlatformExtensions:TPlatformExtensions;
implementation
{ TPlatformExtensions }
class procedure TPlatformExtensions.GetSystemFonts(FontList: TStrings);
{$ifdef Android}
{$IFDEF MSWINDOWS}
var
Context: HDC;
Font: TLogFont;
function EnumFontsList(var LogFont: TLogFont; var TextMetric: TTextMetric;
FontType: Integer; Data: Pointer): Integer; stdcall;
var
List: TStrings;
FName: string;
begin
List := TStrings(Data);
FName := LogFont.lfFaceName;
if (List.Count = 0) or (List.IndexOf(FName) <> List.Count-1) then
List.Add(FName);
Result := 1;
end;
begin
Context := GetDC(0);
FillChar(Font, sizeof(Font), 0);
Font.lfCharset := DEFAULT_CHARSET;
EnumFontFamiliesEx(Context, Font, @EnumFontsList, Winapi.Windows.LPARAM(FontList), 0);
ReleaseDC(0, Context);
{$ENDIF}
{$IFDEF MACOS)}
var
Manager: NsFontManager;
List: NSArray;
Item: NSString;
I: Integer;
begin
Manager := TNsFontManager.Wrap(TNsFontManager.OCClass.sharedFontManager);
List := Manager.availableFontFamilies;
if (List <> nil) and (List.Count > 0) then
begin
for I := 0 to List.Count-1 do
begin
Item := TNSString.Wrap(List.objectAtIndex(I));
FontList.Add(String(Item.UTF8String));
end;
end;
{$ENDIF MACOS}
//end;
initialization
PlatformExtensions := TPlatformExtensions.Create;
finalization
PlatformExtensions.Free;
end.
Checking project dependencies...
Compiling Project1.dproj (Debug, Android)
dccaarm command line for "Project1.dpr"
c:\program files (x86)\embarcadero\studio\20.0\bin\dccaarm.exe -$O- --no-config -M -Q -TX.so -AGenerics.Collections=System.Generics.Collections;
Generics.Defaults=System.Generics.Defaults;WinTypes=Winapi.Windows;WinProcs=Winapi.Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE -DDEBUG
-E.\Android\Debug -I"c:\program files (x86)\embarcadero\studio\20.0\lib\Android\debug";"c:\program files
(x86)\embarcadero\studio\20.0\lib\Android\Release" -LEC:\Users\Public\Documents\Embarcadero\Studio\20.0\Bpl\Android
-LNC:\Users\Public\Documents\Embarcadero\Studio\20.0\Dcp\Android -NU.\Android\Debug -NSSystem;Xml;Data;Datasnap;Web;Soap; -O"c:\program files
(x86)\embarcadero\studio\20.0\lib\Android\Release" -R"c:\program files (x86)\embarcadero\studio\20.0\lib\Android\Release" -U"c:\program files
(x86)\embarcadero\studio\20.0\lib\Android\debug";"c:\program files (x86)\embarcadero\studio\20.0\lib\Android\Release"
--linker:C:\Users\Public\Documents\Embarcadero\Studio\20.0\PlatformSDKs\android-ndk-r17b\toolchains\arm-linux-androideabi-4.9\prebuilt\windows\bin\arm-linux-androideabi-ld.exe
-V -VN -NO.\Android\Debug Project1.dpr
[DCC Error] FMX.PlatformExtensions.pas(99): E2029 'BEGIN' expected but 'INITIALIZATION' found
[DCC Fatal Error] FMX.PlatformExtensions.pas(51): E2280 Unterminated conditional directive
Failed