Ticket #146 -> Fallo al copiar y pegar en un presupuesto conceptos desde una hoja de Excel.
git-svn-id: https://192.168.0.254/svn/Proyectos.Tecsitel_FactuGES2/trunk@648 0c75b7a4-871f-7646-8a2f-f78d34cc349f
This commit is contained in:
parent
fee2708366
commit
da33b733df
@ -112,6 +112,7 @@ contains
|
|||||||
ClipboardUtils in 'Utiles\ClipboardUtils.pas',
|
ClipboardUtils in 'Utiles\ClipboardUtils.pas',
|
||||||
uGridClipboardUtils in 'Utiles\uGridClipboardUtils.pas',
|
uGridClipboardUtils in 'Utiles\uGridClipboardUtils.pas',
|
||||||
uReferenciasUtils in 'Utiles\uReferenciasUtils.pas',
|
uReferenciasUtils in 'Utiles\uReferenciasUtils.pas',
|
||||||
uEMailUtils in 'Utiles\uEMailUtils.pas';
|
uEMailUtils in 'Utiles\uEMailUtils.pas',
|
||||||
|
uSaveClipboard in 'Utiles\uSaveClipboard.pas';
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|||||||
@ -53,57 +53,6 @@
|
|||||||
<DelphiCompile Include="Base.dpk">
|
<DelphiCompile Include="Base.dpk">
|
||||||
<MainSource>MainSource</MainSource>
|
<MainSource>MainSource</MainSource>
|
||||||
</DelphiCompile>
|
</DelphiCompile>
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\adortl.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\cxDataD11.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\cxEditorsD11.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\cxExportD11.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\cxExtEditorsD11.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\cxGridD11.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\cxIntl6D11.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\cxIntlPrintSys3D11.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\cxLibraryD11.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\cxPageControlD11.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\DataAbstract_Core_D11.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\dbrtl.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\dclIndyCore.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\designide.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\dsnap.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\dxGDIPlusD11.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\dxPSCoreD11.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\dxThemeD11.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\GUISDK_D11.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\IndyCore.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\IndyProtocols.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\IndySystem.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\Jcl.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\JclVcl.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\JSDialog100.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\JvCmpD11R.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\JvCoreD11R.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\JvCtrlsD11R.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\JvDlgsD11R.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\JvMMD11R.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\JvNetD11R.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\JvPageCompsD11R.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\JvStdCtrlsD11R.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\JvSystemD11R.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\pckMD5.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\pckUCDataConnector.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\pckUserControl_RT.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\PngComponentsD10.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\PNG_D10.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\RemObjects_Core_D11.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\RemObjects_Indy_D11.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\rtl.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\TB2k_D10.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\tbx_d10.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\vcl.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\vclactnband.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\vcldb.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\vcljpg.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\VclSmp.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\vclx.dcp" />
|
|
||||||
<DCCReference Include="..\Modulos\Presupuestos de cliente\xmlrtl.dcp" />
|
|
||||||
<DCCReference Include="..\Servicios\FactuGES_Intf.pas" />
|
<DCCReference Include="..\Servicios\FactuGES_Intf.pas" />
|
||||||
<DCCReference Include="Conexion\uConfigurarConexion.pas">
|
<DCCReference Include="Conexion\uConfigurarConexion.pas">
|
||||||
<Form>fConfigurarConexion</Form>
|
<Form>fConfigurarConexion</Form>
|
||||||
@ -128,12 +77,56 @@
|
|||||||
<Form>dmBase</Form>
|
<Form>dmBase</Form>
|
||||||
<DesignClass>TDataModule</DesignClass>
|
<DesignClass>TDataModule</DesignClass>
|
||||||
</DCCReference>
|
</DCCReference>
|
||||||
|
<DCCReference Include="Utiles\adortl.dcp" />
|
||||||
<DCCReference Include="Utiles\ClassRegistry\uClassRegistryUtils.pas" />
|
<DCCReference Include="Utiles\ClassRegistry\uClassRegistryUtils.pas" />
|
||||||
<DCCReference Include="Utiles\ClassRegistry\uEditorRegistryUtils.pas" />
|
<DCCReference Include="Utiles\ClassRegistry\uEditorRegistryUtils.pas" />
|
||||||
<DCCReference Include="Utiles\ClassRegistry\uInformeRegistryUtils.pas" />
|
<DCCReference Include="Utiles\ClassRegistry\uInformeRegistryUtils.pas" />
|
||||||
<DCCReference Include="Utiles\ClassRegistry\uViewRegistryUtils.pas" />
|
<DCCReference Include="Utiles\ClassRegistry\uViewRegistryUtils.pas" />
|
||||||
<DCCReference Include="Utiles\ClipboardUtils.pas" />
|
<DCCReference Include="Utiles\ClipboardUtils.pas" />
|
||||||
<DCCReference Include="Utiles\Ctltortf.pas" />
|
<DCCReference Include="Utiles\Ctltortf.pas" />
|
||||||
|
<DCCReference Include="Utiles\cxDataD11.dcp" />
|
||||||
|
<DCCReference Include="Utiles\cxEditorsD11.dcp" />
|
||||||
|
<DCCReference Include="Utiles\cxExportD11.dcp" />
|
||||||
|
<DCCReference Include="Utiles\cxExtEditorsD11.dcp" />
|
||||||
|
<DCCReference Include="Utiles\cxGridD11.dcp" />
|
||||||
|
<DCCReference Include="Utiles\cxIntl6D11.dcp" />
|
||||||
|
<DCCReference Include="Utiles\cxIntlPrintSys3D11.dcp" />
|
||||||
|
<DCCReference Include="Utiles\cxLibraryD11.dcp" />
|
||||||
|
<DCCReference Include="Utiles\cxPageControlD11.dcp" />
|
||||||
|
<DCCReference Include="Utiles\DataAbstract_Core_D11.dcp" />
|
||||||
|
<DCCReference Include="Utiles\dbrtl.dcp" />
|
||||||
|
<DCCReference Include="Utiles\dclIndyCore.dcp" />
|
||||||
|
<DCCReference Include="Utiles\designide.dcp" />
|
||||||
|
<DCCReference Include="Utiles\dsnap.dcp" />
|
||||||
|
<DCCReference Include="Utiles\dxGDIPlusD11.dcp" />
|
||||||
|
<DCCReference Include="Utiles\dxPSCoreD11.dcp" />
|
||||||
|
<DCCReference Include="Utiles\dxThemeD11.dcp" />
|
||||||
|
<DCCReference Include="Utiles\GUISDK_D11.dcp" />
|
||||||
|
<DCCReference Include="Utiles\IndyCore.dcp" />
|
||||||
|
<DCCReference Include="Utiles\IndyProtocols.dcp" />
|
||||||
|
<DCCReference Include="Utiles\IndySystem.dcp" />
|
||||||
|
<DCCReference Include="Utiles\Jcl.dcp" />
|
||||||
|
<DCCReference Include="Utiles\JclVcl.dcp" />
|
||||||
|
<DCCReference Include="Utiles\JSDialog100.dcp" />
|
||||||
|
<DCCReference Include="Utiles\JvCmpD11R.dcp" />
|
||||||
|
<DCCReference Include="Utiles\JvCoreD11R.dcp" />
|
||||||
|
<DCCReference Include="Utiles\JvCtrlsD11R.dcp" />
|
||||||
|
<DCCReference Include="Utiles\JvDlgsD11R.dcp" />
|
||||||
|
<DCCReference Include="Utiles\JvMMD11R.dcp" />
|
||||||
|
<DCCReference Include="Utiles\JvNetD11R.dcp" />
|
||||||
|
<DCCReference Include="Utiles\JvPageCompsD11R.dcp" />
|
||||||
|
<DCCReference Include="Utiles\JvStdCtrlsD11R.dcp" />
|
||||||
|
<DCCReference Include="Utiles\JvSystemD11R.dcp" />
|
||||||
|
<DCCReference Include="Utiles\pckMD5.dcp" />
|
||||||
|
<DCCReference Include="Utiles\pckUCDataConnector.dcp" />
|
||||||
|
<DCCReference Include="Utiles\pckUserControl_RT.dcp" />
|
||||||
|
<DCCReference Include="Utiles\PngComponentsD10.dcp" />
|
||||||
|
<DCCReference Include="Utiles\PNG_D10.dcp" />
|
||||||
|
<DCCReference Include="Utiles\RemObjects_Core_D11.dcp" />
|
||||||
|
<DCCReference Include="Utiles\RemObjects_Indy_D11.dcp" />
|
||||||
|
<DCCReference Include="Utiles\rtl.dcp" />
|
||||||
|
<DCCReference Include="Utiles\TB2k_D10.dcp" />
|
||||||
|
<DCCReference Include="Utiles\tbx_d10.dcp" />
|
||||||
<DCCReference Include="Utiles\uAppInfoUtils.pas" />
|
<DCCReference Include="Utiles\uAppInfoUtils.pas" />
|
||||||
<DCCReference Include="Utiles\uCalculosUtils.pas" />
|
<DCCReference Include="Utiles\uCalculosUtils.pas" />
|
||||||
<DCCReference Include="Utiles\uDataTableUtils.pas" />
|
<DCCReference Include="Utiles\uDataTableUtils.pas" />
|
||||||
@ -150,8 +143,16 @@
|
|||||||
<DCCReference Include="Utiles\uPasswordUtils.pas" />
|
<DCCReference Include="Utiles\uPasswordUtils.pas" />
|
||||||
<DCCReference Include="Utiles\uReferenciasUtils.pas" />
|
<DCCReference Include="Utiles\uReferenciasUtils.pas" />
|
||||||
<DCCReference Include="Utiles\uRTFUtils.pas" />
|
<DCCReference Include="Utiles\uRTFUtils.pas" />
|
||||||
|
<DCCReference Include="Utiles\uSaveClipboard.pas" />
|
||||||
<DCCReference Include="Utiles\uSistemaFunc.pas" />
|
<DCCReference Include="Utiles\uSistemaFunc.pas" />
|
||||||
<DCCReference Include="Utiles\uStringsUtils.pas" />
|
<DCCReference Include="Utiles\uStringsUtils.pas" />
|
||||||
|
<DCCReference Include="Utiles\vcl.dcp" />
|
||||||
|
<DCCReference Include="Utiles\vclactnband.dcp" />
|
||||||
|
<DCCReference Include="Utiles\vcldb.dcp" />
|
||||||
|
<DCCReference Include="Utiles\vcljpg.dcp" />
|
||||||
|
<DCCReference Include="Utiles\VclSmp.dcp" />
|
||||||
|
<DCCReference Include="Utiles\vclx.dcp" />
|
||||||
|
<DCCReference Include="Utiles\xmlrtl.dcp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
<!-- EurekaLog First Line
|
<!-- EurekaLog First Line
|
||||||
|
|||||||
Binary file not shown.
@ -135,8 +135,9 @@ begin
|
|||||||
else
|
else
|
||||||
TargetURL := ROChannel.TargetURL;
|
TargetURL := ROChannel.TargetURL;
|
||||||
end;
|
end;
|
||||||
if AHTTPChannel.Encryption.EncryptionMethod <> tetNone then
|
|
||||||
ShowMessage('funcionando');
|
{ if AHTTPChannel.Encryption.EncryptionMethod <> tetNone then
|
||||||
|
ShowMessage('funcionando');}
|
||||||
|
|
||||||
ACoService.ServiceName := 'srvLogin';
|
ACoService.ServiceName := 'srvLogin';
|
||||||
ACoService.Message := AROBinMessage;
|
ACoService.Message := AROBinMessage;
|
||||||
|
|||||||
@ -6,17 +6,21 @@ uses
|
|||||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||||
Dialogs, cxGrid;
|
Dialogs, cxGrid;
|
||||||
|
|
||||||
procedure PegarSeleccionGridDesdePortapapeles (AGrid : TcxGrid);
|
procedure PegarAlGridDesdePortapapeles (AGrid : TcxGrid);
|
||||||
procedure CopiarSeleccionGridAlPortapapeles (AGrid : TcxGrid);
|
procedure CopiarSeleccionGridAlPortapapeles (AGrid : TcxGrid);
|
||||||
procedure CortarSeleccionGridAlPortapapeles (AGrid : TcxGrid);
|
procedure CortarSeleccionGridAlPortapapeles (AGrid : TcxGrid);
|
||||||
function HayDatosEnPortapapeles: Boolean;
|
function HayDatosEnPortapapeles(AFormat: Cardinal = 0): Boolean;
|
||||||
|
|
||||||
|
|
||||||
procedure CopiarGridAlPortapapelesRTF (AGrid : TcxGrid; const ASoloSeleccion : Boolean = false);
|
procedure CopiarGridAlPortapapelesRTF (AGrid : TcxGrid; const ASoloSeleccion : Boolean = false);
|
||||||
procedure CopiarGridAlPortapapelesHTML (AGrid : TcxGrid; const ASoloSeleccion : Boolean = false);
|
procedure CopiarGridAlPortapapelesHTML (AGrid : TcxGrid; const ASoloSeleccion : Boolean = false);
|
||||||
procedure CopiarGridAlPortapapelesTXT (AGrid : TcxGrid; const ASoloSeleccion : Boolean = false);
|
procedure CopiarGridAlPortapapelesTXT (AGrid : TcxGrid; const ASoloSeleccion : Boolean = false);
|
||||||
procedure CopiarGridAlPortapapelesExcel (AGrid : TcxGrid; const ASoloSeleccion : Boolean = false);
|
procedure CopiarGridAlPortapapelesExcel (AGrid : TcxGrid; const ASoloSeleccion : Boolean = false);
|
||||||
|
|
||||||
|
var
|
||||||
|
CF_FACTUGES : Cardinal;
|
||||||
|
CF_RTF : Cardinal;
|
||||||
|
CF_HTML: Cardinal;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
@ -26,6 +30,20 @@ uses
|
|||||||
cxGridTableView, cxGridDBTableView, cxGridDBDataDefinitions, uGridStatusUtils;
|
cxGridTableView, cxGridDBTableView, cxGridDBDataDefinitions, uGridStatusUtils;
|
||||||
|
|
||||||
|
|
||||||
|
procedure RegistrarFormatos;
|
||||||
|
begin
|
||||||
|
CF_FACTUGES := RegisterClipboardFormat ('FactuGES Format');
|
||||||
|
if CF_FACTUGES = 0 then
|
||||||
|
raise Exception.Create('Error al registrar formato CF_FACTUGES');
|
||||||
|
|
||||||
|
CF_HTML := RegisterClipboardFormat ('HTML Format');
|
||||||
|
if CF_HTML = 0 then
|
||||||
|
raise Exception.Create('Error al registrar formato CF_HTML');
|
||||||
|
|
||||||
|
CF_RTF := RegisterClipboardFormat('Rich Text Format');
|
||||||
|
if CF_RTF = 0 then
|
||||||
|
raise Exception.Create('Error al registrar formato CF_RTF (CopiarSeleccionGridAlPortapapelesRTF)');
|
||||||
|
end;
|
||||||
|
|
||||||
procedure RenumerarCampoPosicion(ADataSet : TDataSet);
|
procedure RenumerarCampoPosicion(ADataSet : TDataSet);
|
||||||
var
|
var
|
||||||
@ -47,6 +65,31 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function _BuscarColumna (AView: TcxGridDBTableView;
|
||||||
|
const AName, ATypeValue : String; var AIndex : Integer) : Boolean;
|
||||||
|
var
|
||||||
|
i : Integer;
|
||||||
|
bNombreOk : Boolean;
|
||||||
|
begin
|
||||||
|
AIndex := -1;
|
||||||
|
Result := False;
|
||||||
|
for i := 0 to AView.ItemCount - 1 do
|
||||||
|
begin
|
||||||
|
if (AView.Items[i].DataBinding is TcxGridItemDBDataBinding) then
|
||||||
|
with (AView.Items[i].DataBinding as TcxGridItemDBDataBinding) do
|
||||||
|
bNombreOk := (FieldName = AName)
|
||||||
|
else
|
||||||
|
bNombreOk := (AView.Items[i].Caption = AName);
|
||||||
|
|
||||||
|
if bNombreOk and (AView.Items[i].DataBinding.ValueType = ATypeValue) then
|
||||||
|
begin
|
||||||
|
AIndex := i;
|
||||||
|
Result := True;
|
||||||
|
Break;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{$REGION 'LoadGridRowsFromStream'}
|
{$REGION 'LoadGridRowsFromStream'}
|
||||||
procedure LoadGridRowsFromStream(AView : TcxGridDBTableView; AStream: TStream;
|
procedure LoadGridRowsFromStream(AView : TcxGridDBTableView; AStream: TStream;
|
||||||
@ -67,31 +110,6 @@ var
|
|||||||
AValue : Variant;
|
AValue : Variant;
|
||||||
AIndex : integer;
|
AIndex : integer;
|
||||||
|
|
||||||
function _BuscarColumna (const AName, ATypeValue : String; var AIndex : Integer) : Boolean;
|
|
||||||
var
|
|
||||||
i : Integer;
|
|
||||||
bNombreOk : Boolean;
|
|
||||||
begin
|
|
||||||
AIndex := -1;
|
|
||||||
Result := False;
|
|
||||||
for i := 0 to AView.ItemCount - 1 do
|
|
||||||
begin
|
|
||||||
if (AView.Items[i].DataBinding is TcxGridItemDBDataBinding) then
|
|
||||||
with (AView.Items[i].DataBinding as TcxGridItemDBDataBinding) do
|
|
||||||
bNombreOk := (FieldName = AName)
|
|
||||||
else
|
|
||||||
bNombreOk := (AView.Items[i].Caption = AName);
|
|
||||||
|
|
||||||
if bNombreOk and (AView.Items[i].DataBinding.ValueType = ATypeValue) then
|
|
||||||
begin
|
|
||||||
AIndex := i;
|
|
||||||
Result := True;
|
|
||||||
Break;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if not Assigned(AView) then
|
if not Assigned(AView) then
|
||||||
raise Exception.Create('Vista no asignada (SaveGridViewToStream)');
|
raise Exception.Create('Vista no asignada (SaveGridViewToStream)');
|
||||||
@ -150,7 +168,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
AValue := AReader.ReadVariant;
|
AValue := AReader.ReadVariant;
|
||||||
if (Pos(AValueNameList[iCols], AView.DataController.KeyFieldNames) = 0) then
|
if (Pos(AValueNameList[iCols], AView.DataController.KeyFieldNames) = 0) then
|
||||||
if _BuscarColumna(AValueNameList[iCols], AValueTypeList[iCols], AIndex) then
|
if _BuscarColumna(AView, AValueNameList[iCols], AValueTypeList[iCols], AIndex) then
|
||||||
begin
|
begin
|
||||||
if AIndex <> -1 then
|
if AIndex <> -1 then
|
||||||
ADataSet.FieldByName(AView.DataController.GetItemField(AIndex).FieldName).Value := AValue;
|
ADataSet.FieldByName(AView.DataController.GetItemField(AIndex).FieldName).Value := AValue;
|
||||||
@ -317,11 +335,12 @@ var
|
|||||||
AFicheroTMP : String;
|
AFicheroTMP : String;
|
||||||
AStringList : TStringList;
|
AStringList : TStringList;
|
||||||
HTMLText : String;
|
HTMLText : String;
|
||||||
CF_HTML : Cardinal;
|
|
||||||
begin
|
begin
|
||||||
if not Assigned(AGrid) then
|
if not Assigned(AGrid) then
|
||||||
raise Exception.Create('Vista no asignada (CopiarSeleccionGridAlPortapapelesTXT)');
|
raise Exception.Create('Vista no asignada (CopiarSeleccionGridAlPortapapelesTXT)');
|
||||||
|
|
||||||
|
RegistrarFormatos;
|
||||||
|
|
||||||
AFicheroTMP := DarFicheroHTMLTemporal;
|
AFicheroTMP := DarFicheroHTMLTemporal;
|
||||||
ExportGridToHTML(AFicheroTMP, AGrid, True, not ASoloSeleccion);
|
ExportGridToHTML(AFicheroTMP, AGrid, True, not ASoloSeleccion);
|
||||||
|
|
||||||
@ -333,11 +352,6 @@ begin
|
|||||||
HTMLText := AStringList.Text;
|
HTMLText := AStringList.Text;
|
||||||
AStringList.Insert(0, GetHeader(HTMLText));
|
AStringList.Insert(0, GetHeader(HTMLText));
|
||||||
AStringList.Add(GetFooter);
|
AStringList.Add(GetFooter);
|
||||||
|
|
||||||
CF_HTML := RegisterClipboardFormat ('HTML Format');
|
|
||||||
if CF_HTML = 0 then
|
|
||||||
raise Exception.Create('Error al registrar formato CF_HTML (CopiarSeleccionGridAlPortapapelesHTML)');
|
|
||||||
|
|
||||||
CopyStringsToClipboard(CF_HTML, AStringList);
|
CopyStringsToClipboard(CF_HTML, AStringList);
|
||||||
finally
|
finally
|
||||||
FreeANDNIL(AStringList);
|
FreeANDNIL(AStringList);
|
||||||
@ -350,19 +364,15 @@ procedure CopiarGridAlPortapapelesRTF (AGrid : TcxGrid; const ASoloSeleccion : B
|
|||||||
var
|
var
|
||||||
ARTFConv : TCtrlToRTF;
|
ARTFConv : TCtrlToRTF;
|
||||||
AStringList : TStringList;
|
AStringList : TStringList;
|
||||||
CF_RTF : Cardinal;
|
|
||||||
begin
|
begin
|
||||||
if not Assigned(AGrid) then
|
if not Assigned(AGrid) then
|
||||||
raise Exception.Create('Grid no asignado (CopiarSeleccionGridAlPortapapelesTXT)');
|
raise Exception.Create('Grid no asignado (CopiarSeleccionGridAlPortapapelesTXT)');
|
||||||
|
|
||||||
|
RegistrarFormatos;
|
||||||
ARTFConv := TCtrlToRTF.Create(NIL);
|
ARTFConv := TCtrlToRTF.Create(NIL);
|
||||||
try
|
try
|
||||||
ARTFConv.cxGridViewToRTF(TcxGridTableView(AGrid.ActiveView));
|
ARTFConv.cxGridViewToRTF(TcxGridTableView(AGrid.ActiveView));
|
||||||
|
|
||||||
CF_RTF := RegisterClipboardFormat('Rich Text Format');
|
|
||||||
if CF_RTF = 0 then
|
|
||||||
raise Exception.Create('Error al registrar formato CF_RTF (CopiarSeleccionGridAlPortapapelesRTF)');
|
|
||||||
|
|
||||||
AStringList := TStringList.Create;
|
AStringList := TStringList.Create;
|
||||||
try
|
try
|
||||||
AStringList.Add(ARTFConv.RTFText);
|
AStringList.Add(ARTFConv.RTFText);
|
||||||
@ -399,11 +409,12 @@ procedure CopiarGridAlPortapapelesExcel (AGrid : TcxGrid; const ASoloSeleccion :
|
|||||||
var
|
var
|
||||||
AFicheroTMP : String;
|
AFicheroTMP : String;
|
||||||
AStream : TFileStream;
|
AStream : TFileStream;
|
||||||
CF_HTML : Cardinal;
|
|
||||||
begin
|
begin
|
||||||
if not Assigned(AGrid) then
|
if not Assigned(AGrid) then
|
||||||
raise Exception.Create('Vista no asignada (CopiarSeleccionGridAlPortapapelesTXT)');
|
raise Exception.Create('Vista no asignada (CopiarSeleccionGridAlPortapapelesTXT)');
|
||||||
|
|
||||||
|
RegistrarFormatos;
|
||||||
|
|
||||||
AFicheroTMP := DarFicheroExcelTemporal;
|
AFicheroTMP := DarFicheroExcelTemporal;
|
||||||
ExportGridToExcel(AFicheroTMP, AGrid, True, not ASoloSeleccion);
|
ExportGridToExcel(AFicheroTMP, AGrid, True, not ASoloSeleccion);
|
||||||
|
|
||||||
@ -411,10 +422,6 @@ begin
|
|||||||
begin
|
begin
|
||||||
AStream := TFileStream.Create(AFicheroTMP, fmOpenRead);
|
AStream := TFileStream.Create(AFicheroTMP, fmOpenRead);
|
||||||
try
|
try
|
||||||
CF_HTML := RegisterClipboardFormat ('HTML Format');
|
|
||||||
if CF_HTML = 0 then
|
|
||||||
raise Exception.Create('Error al registrar formato CF_HTML (CopiarSeleccionGridAlPortapapelesHTML)');
|
|
||||||
|
|
||||||
CopyStreamToClipboard(CF_HTML, AStream);
|
CopyStreamToClipboard(CF_HTML, AStream);
|
||||||
finally
|
finally
|
||||||
FreeANDNIL(AStream);
|
FreeANDNIL(AStream);
|
||||||
@ -427,12 +434,13 @@ end;
|
|||||||
procedure CopiarSeleccionGridAlPortapapeles (AGrid : TcxGrid);
|
procedure CopiarSeleccionGridAlPortapapeles (AGrid : TcxGrid);
|
||||||
var
|
var
|
||||||
AMemStream : TMemoryStream;
|
AMemStream : TMemoryStream;
|
||||||
CF_FACTUGES : Cardinal;
|
|
||||||
AGridStatus : TcxGridStatus;
|
AGridStatus : TcxGridStatus;
|
||||||
begin
|
begin
|
||||||
if not Assigned(AGrid) then
|
if not Assigned(AGrid) then
|
||||||
raise Exception.Create('Grid no asignado (CopiarSeleccionGridAlPortapapelesTXT)');
|
raise Exception.Create('Grid no asignado (CopiarSeleccionGridAlPortapapelesTXT)');
|
||||||
|
|
||||||
|
RegistrarFormatos;
|
||||||
|
|
||||||
AGridStatus := TcxGridStatus.Create(TcxGridDBTableView(AGrid.ActiveView));
|
AGridStatus := TcxGridStatus.Create(TcxGridDBTableView(AGrid.ActiveView));
|
||||||
Clipboard.Open;
|
Clipboard.Open;
|
||||||
try
|
try
|
||||||
@ -443,9 +451,6 @@ begin
|
|||||||
AMemStream := TMemoryStream.Create;
|
AMemStream := TMemoryStream.Create;
|
||||||
try
|
try
|
||||||
SaveGridRowsToStream(TcxGridDBTableView(AGrid.ActiveView), AMemStream, AGrid.ActiveView.Name, True);
|
SaveGridRowsToStream(TcxGridDBTableView(AGrid.ActiveView), AMemStream, AGrid.ActiveView.Name, True);
|
||||||
CF_FACTUGES := RegisterClipboardFormat ('FactuGES Format');
|
|
||||||
if CF_FACTUGES = 0 then
|
|
||||||
raise Exception.Create('Error al registrar formato CF_HTML (CopiarSeleccionGridAlPortapapelesHTML)');
|
|
||||||
CopyStreamToClipboard(CF_FACTUGES, AMemStream);
|
CopyStreamToClipboard(CF_FACTUGES, AMemStream);
|
||||||
finally
|
finally
|
||||||
FreeAndNil(AMemStream);
|
FreeAndNil(AMemStream);
|
||||||
@ -474,16 +479,13 @@ end;
|
|||||||
procedure PegarSeleccionGridDesdePortapapeles (AGrid : TcxGrid);
|
procedure PegarSeleccionGridDesdePortapapeles (AGrid : TcxGrid);
|
||||||
var
|
var
|
||||||
AMemStream : TMemoryStream;
|
AMemStream : TMemoryStream;
|
||||||
CF_FACTUGES : Cardinal;
|
|
||||||
ACaption : String;
|
ACaption : String;
|
||||||
AGridStatus : TcxGridStatus;
|
AGridStatus : TcxGridStatus;
|
||||||
begin
|
begin
|
||||||
if not Assigned(AGrid) then
|
if not Assigned(AGrid) then
|
||||||
raise Exception.Create('Grid no asignado (PegarSeleccionGridDesdePortapapeles)');
|
raise Exception.Create('Grid no asignado (PegarSeleccionGridDesdePortapapeles)');
|
||||||
|
|
||||||
CF_FACTUGES := RegisterClipboardFormat ('FactuGES Format');
|
RegistrarFormatos;
|
||||||
if CF_FACTUGES = 0 then
|
|
||||||
raise Exception.Create('Error al registrar formato CF_FACTUGES (PegarSeleccionGridDesdePortapapeles)');
|
|
||||||
|
|
||||||
if not Clipboard.HasFormat(CF_FACTUGES) then
|
if not Clipboard.HasFormat(CF_FACTUGES) then
|
||||||
raise Exception.Create('No hay nada en el portapapeles');
|
raise Exception.Create('No hay nada en el portapapeles');
|
||||||
@ -505,15 +507,122 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function HayDatosEnPortapapeles: Boolean;
|
|
||||||
var
|
|
||||||
CF_FACTUGES : Cardinal;
|
|
||||||
begin
|
|
||||||
CF_FACTUGES := RegisterClipboardFormat ('FactuGES Format');
|
|
||||||
if CF_FACTUGES = 0 then
|
|
||||||
raise Exception.Create('Error al registrar formato CF_FACTUGES (HayDatosEnPortapapeles)');
|
|
||||||
|
|
||||||
Result := Clipboard.HasFormat(CF_FACTUGES);
|
procedure PegarTextoDesdePortapapeles (AGrid : TcxGrid);
|
||||||
|
var
|
||||||
|
ACaption : String;
|
||||||
|
AGridStatus : TcxGridStatus;
|
||||||
|
ATextList : TStringList;
|
||||||
|
|
||||||
|
ADataSet : TDataSet;
|
||||||
|
AColumnID: Integer;
|
||||||
|
|
||||||
|
ARecordID : Integer;
|
||||||
|
ARecordIndex : Integer;
|
||||||
|
bEstabaVacia : Boolean;
|
||||||
|
AView : TcxGridDBTableView;
|
||||||
|
|
||||||
|
iContador : Integer;
|
||||||
|
begin
|
||||||
|
if not Assigned(AGrid) then
|
||||||
|
raise Exception.Create('Grid no asignado (PegarTextoDesdePortapapeles)');
|
||||||
|
|
||||||
|
RegistrarFormatos;
|
||||||
|
|
||||||
|
if not Clipboard.HasFormat(CF_TEXT) then
|
||||||
|
raise Exception.Create('No hay nada en el portapapeles');
|
||||||
|
|
||||||
|
AView := TcxGridDBTableView(AGrid.ActiveView);
|
||||||
|
|
||||||
|
|
||||||
|
AGridStatus := TcxGridStatus.Create(TcxGridDBTableView(AGrid.ActiveView));
|
||||||
|
Clipboard.Open;
|
||||||
|
try
|
||||||
|
ATextList := TStringList.Create;
|
||||||
|
try
|
||||||
|
CopyStringsFromClipboard(CF_TEXT, ATextList);
|
||||||
|
|
||||||
|
ADataSet := AView.DataController.DataSource.DataSet;
|
||||||
|
bEstabaVacia := ADataSet.IsEmpty;
|
||||||
|
|
||||||
|
AView.DataController.BeginUpdate;
|
||||||
|
try
|
||||||
|
// Localizar el punto donde se empieza a insertar
|
||||||
|
if not bEstabaVacia then
|
||||||
|
begin
|
||||||
|
ARecordIndex := AView.DataController.FocusedRecordIndex;
|
||||||
|
if ARecordIndex >= 0 then
|
||||||
|
begin
|
||||||
|
ARecordID := AView.DataController.GetRecordId(ARecordIndex);
|
||||||
|
ADataSet.Locate(AView.DataController.KeyFieldNames, ARecordID, []);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
for iContador := 0 to ATextList.Count - 1 do
|
||||||
|
begin
|
||||||
|
// Insertar una tupla de la forma adecuada
|
||||||
|
if bEstabaVacia then
|
||||||
|
ADataSet.Append
|
||||||
|
else begin
|
||||||
|
{if iContador > 0 then
|
||||||
|
ADataSet.Next;}
|
||||||
|
ADataSet.Insert;
|
||||||
|
end;
|
||||||
|
|
||||||
|
try
|
||||||
|
ADataSet.Edit;
|
||||||
|
ADataSet.FieldByName('CONCEPTO').AsString := ATextList[iContador];
|
||||||
|
finally
|
||||||
|
ADataSet.Post;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
RenumerarCampoPosicion(ADataSet);
|
||||||
|
finally
|
||||||
|
AView.DataController.EndUpdate;
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
FreeANDNIL(ATextList);
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
Clipboard.Close;
|
||||||
|
AGridStatus.Restore(TcxGridDBTableView(AGrid.ActiveView));
|
||||||
|
FreeAndNil(AGridStatus);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function HayDatosEnPortapapeles(AFormat: Cardinal): Boolean;
|
||||||
|
begin
|
||||||
|
RegistrarFormatos;
|
||||||
|
|
||||||
|
if AFormat = 0 then
|
||||||
|
Result := Clipboard.HasFormat(CF_FACTUGES) or Clipboard.HasFormat(CF_TEXT)
|
||||||
|
else
|
||||||
|
Result := Clipboard.HasFormat(AFormat);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure PegarAlGridDesdePortapapeles (AGrid : TcxGrid);
|
||||||
|
begin
|
||||||
|
{ Aqui se determina qué hacer. Si en el portapapeles hay datos en formato...
|
||||||
|
1. CF_FACTUGES -> pegar conceptos
|
||||||
|
2. CF_TEXT -> tratar y pegar texto plano
|
||||||
|
}
|
||||||
|
|
||||||
|
RegistrarFormatos;
|
||||||
|
|
||||||
|
if Clipboard.HasFormat(CF_FACTUGES) then
|
||||||
|
begin
|
||||||
|
PegarSeleccionGridDesdePortapapeles(AGrid);
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if Clipboard.HasFormat(CF_TEXT) then
|
||||||
|
begin
|
||||||
|
PegarTextoDesdePortapapeles(AGrid);
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|||||||
270
Source/Base/Utiles/uSaveClipboard.pas
Normal file
270
Source/Base/Utiles/uSaveClipboard.pas
Normal file
@ -0,0 +1,270 @@
|
|||||||
|
unit uSaveClipboard;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Windows, Messages, SysUtils, Classes, Graphics, RichEdit, Clipbrd,
|
||||||
|
registry, ActiveX, ShellAPI, ShlObj;
|
||||||
|
|
||||||
|
type
|
||||||
|
|
||||||
|
TSaveClipboard = class(TObject)
|
||||||
|
private
|
||||||
|
FTxt, FRTF, FHTML, FOEMText, FCSV : string;
|
||||||
|
FUnicodeText : WideString;
|
||||||
|
FBitmap : TBitmap;
|
||||||
|
FMetafile : TMetafile;
|
||||||
|
CF_RTF, CF_HTML, CF_CSV : UINT;
|
||||||
|
FFiles : TStringList;
|
||||||
|
procedure ClearBuffer;
|
||||||
|
public
|
||||||
|
constructor Create;reintroduce;
|
||||||
|
destructor Destroy;override;
|
||||||
|
procedure Save;
|
||||||
|
procedure Restore;
|
||||||
|
|
||||||
|
property PlainText : String read FTxt write FTxt;
|
||||||
|
property RTFText : String read FRTF write FRTF;
|
||||||
|
property CSVText : String read FCSV write FCSV;
|
||||||
|
property HTMLText : String read FHTML write FHTML;
|
||||||
|
property OEMText : String read FOEMText write FOEMText;
|
||||||
|
property UnicodeText : WideString read FUnicodeText write FUnicodeText;
|
||||||
|
property Bitmap : TBitmap read FBitmap write FBitmap;
|
||||||
|
property Metafile : TMetafile read FMetafile write FMetafile;
|
||||||
|
end;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
uses
|
||||||
|
Dialogs;
|
||||||
|
|
||||||
|
{ TSaveClipboard }
|
||||||
|
|
||||||
|
procedure TSaveClipboard.ClearBuffer;
|
||||||
|
begin
|
||||||
|
FTxt:='';
|
||||||
|
FRTF:='';
|
||||||
|
FHTML:='';
|
||||||
|
FCSV := '';
|
||||||
|
FOEMText:='';
|
||||||
|
FUnicodeText:='';
|
||||||
|
FBitmap.Free;
|
||||||
|
FBitmap:=nil;
|
||||||
|
FMetafile.Free;
|
||||||
|
FMetafile:=nil;
|
||||||
|
FFiles.Clear;
|
||||||
|
end;
|
||||||
|
|
||||||
|
constructor TSaveClipboard.Create;
|
||||||
|
begin
|
||||||
|
inherited Create;
|
||||||
|
FFiles := TStringList.Create;
|
||||||
|
ClearBuffer;
|
||||||
|
CF_RTF := RegisterClipboardFormat(RichEdit.CF_RTF);
|
||||||
|
CF_HTML := {16;//}RegisterClipboardFormat('HTML Format');
|
||||||
|
CF_CSV := RegisterClipboardFormat('CSV');
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TSaveClipboard.Destroy;
|
||||||
|
begin
|
||||||
|
ClearBuffer;
|
||||||
|
FFiles.Free;
|
||||||
|
inherited;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure CopyClipboardData(Format : UINT; Buffer : pointer; Length :
|
||||||
|
integer);
|
||||||
|
var Data:THandle;
|
||||||
|
DataPtr: Pointer;
|
||||||
|
begin
|
||||||
|
Data := GlobalAlloc(GMEM_MOVEABLE+GMEM_DDESHARE, Length);
|
||||||
|
try
|
||||||
|
DataPtr := GlobalLock(Data);
|
||||||
|
try
|
||||||
|
CopyMemory(DataPtr, Buffer, Length);
|
||||||
|
SetClipboardData(Format, Data);
|
||||||
|
finally
|
||||||
|
GlobalUnlock(Data);
|
||||||
|
end;
|
||||||
|
except
|
||||||
|
GlobalFree(Data);
|
||||||
|
raise;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TSaveClipboard.Restore;
|
||||||
|
const NULL : Char = #0;
|
||||||
|
var //Data:THandle;
|
||||||
|
//DataPtr: Pointer;
|
||||||
|
DF : TDropFiles;
|
||||||
|
i : integer;
|
||||||
|
begin
|
||||||
|
try
|
||||||
|
Clipboard.Clear;
|
||||||
|
Clipboard.Open;
|
||||||
|
//text
|
||||||
|
if Length(FTxt) > 0 then Clipboard.AsText:=FTxt;
|
||||||
|
//OEM text
|
||||||
|
if Length(FOEMText) > 0 then CopyClipboardData(CF_OEMTEXT,
|
||||||
|
PChar(FOEMText), Length(FOEMText)+1);
|
||||||
|
//HTML text
|
||||||
|
if Length(FHTML) > 0 then CopyClipboardData(CF_HTML, PChar(FHTML),
|
||||||
|
Length(FHTML)+1);
|
||||||
|
|
||||||
|
//CSV text
|
||||||
|
if Length(FCSV) > 0 then
|
||||||
|
CopyClipboardData(CF_CSV, PChar(FCSV), Length(FCSV)+1);
|
||||||
|
|
||||||
|
//Unicode text
|
||||||
|
if Length(FUnicodeText) > 0 then CopyClipboardData(CF_UNICODETEXT,
|
||||||
|
PWideChar(FUnicodeText), 2*Length(FUnicodeText)+2);
|
||||||
|
//RTF
|
||||||
|
if Length(FRTF) > 0 then CopyClipboardData(CF_RTF, PChar(FRTF),
|
||||||
|
Length(FRTF)+1);
|
||||||
|
//BMP
|
||||||
|
if FBitmap <> nil then Clipboard.Assign(FBitmap);
|
||||||
|
//Metafile
|
||||||
|
if FMetafile <> nil then Clipboard.Assign(FMetafile);
|
||||||
|
//files
|
||||||
|
if FFiles.Count > 0 then begin
|
||||||
|
DF.pFiles:=SizeOf(DF);
|
||||||
|
DF.pt.x:=0;
|
||||||
|
DF.pt.y:=0;
|
||||||
|
DF.fNC:=false;
|
||||||
|
DF.fWide:=false;
|
||||||
|
with TMemoryStream.Create do
|
||||||
|
try
|
||||||
|
Write(DF, SizeOf(DF));
|
||||||
|
for i:=0 to FFiles.Count-1 do begin
|
||||||
|
Write(FFiles[i][1], Length(FFiles[i]));
|
||||||
|
Write(NULL, SizeOf(NULL));
|
||||||
|
end;
|
||||||
|
Write(NULL, SizeOf(NULL));
|
||||||
|
CopyClipboardData(CF_HDROP, Memory, Size);
|
||||||
|
finally
|
||||||
|
Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
Clipboard.Close;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TSaveClipboard.Save;
|
||||||
|
var Data:THandle;
|
||||||
|
p : pointer;
|
||||||
|
Count, i : integer;
|
||||||
|
Buffer : array[0..MAX_PATH] of Char;
|
||||||
|
AList : TStringLIst;
|
||||||
|
begin
|
||||||
|
|
||||||
|
{ AList := TStringList.Create;
|
||||||
|
try
|
||||||
|
AList.Add('Lista ----------');
|
||||||
|
//GetClipboardFormatName(CF_HTML, @Buffer, SizeOf(Buffer));
|
||||||
|
for i:=0 to Clipboard.FormatCount-1 do begin
|
||||||
|
if Clipboard.Formats[i] = 0 then beep;
|
||||||
|
GetClipboardFormatName(Clipboard.Formats[i], @Buffer, SizeOf(Buffer));
|
||||||
|
AList.Add(Buffer);
|
||||||
|
end;
|
||||||
|
ShowMessage(AList.Text);
|
||||||
|
finally
|
||||||
|
FreeANDNIL(AList);
|
||||||
|
end;}
|
||||||
|
|
||||||
|
|
||||||
|
ClearBuffer;
|
||||||
|
//text
|
||||||
|
if Clipboard.HasFormat(CF_TEXT) then FTxt:=Clipboard.AsText;
|
||||||
|
//RTF
|
||||||
|
if Clipboard.HasFormat(CF_RTF) then
|
||||||
|
begin
|
||||||
|
Clipboard.Open;
|
||||||
|
Data := GetClipboardData(CF_RTF);
|
||||||
|
if Data <> 0 then begin
|
||||||
|
FRTF := PChar(GlobalLock(Data));
|
||||||
|
GlobalUnlock(Data);
|
||||||
|
end;
|
||||||
|
Clipboard.Close;
|
||||||
|
end;
|
||||||
|
|
||||||
|
//CSV
|
||||||
|
if Clipboard.HasFormat(CF_CSV) then
|
||||||
|
begin
|
||||||
|
Clipboard.Open;
|
||||||
|
Data := GetClipboardData(CF_CSV);
|
||||||
|
if Data <> 0 then begin
|
||||||
|
FCSV := PChar(GlobalLock(Data));
|
||||||
|
GlobalUnlock(Data);
|
||||||
|
end;
|
||||||
|
Clipboard.Close;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
//HTML
|
||||||
|
if Clipboard.HasFormat(CF_HTML) then begin
|
||||||
|
Clipboard.Open;
|
||||||
|
Data := GetClipboardData(CF_HTML);
|
||||||
|
if Data <> 0 then begin
|
||||||
|
FHTML := PChar(GlobalLock(Data));
|
||||||
|
GlobalUnlock(Data);
|
||||||
|
end;
|
||||||
|
Clipboard.Close;
|
||||||
|
end;
|
||||||
|
|
||||||
|
//OEM Text
|
||||||
|
if Clipboard.HasFormat(CF_OEMTEXT) then begin
|
||||||
|
Clipboard.Open;
|
||||||
|
Data := GetClipboardData(CF_OEMTEXT);
|
||||||
|
if Data <> 0 then begin
|
||||||
|
FOEMText := PChar(GlobalLock(Data));
|
||||||
|
GlobalUnlock(Data);
|
||||||
|
end;
|
||||||
|
Clipboard.Close;
|
||||||
|
end;
|
||||||
|
//Unicode
|
||||||
|
if Clipboard.HasFormat(CF_UNICODETEXT) then begin
|
||||||
|
Clipboard.Open;
|
||||||
|
Data := GetClipboardData(CF_UNICODETEXT);
|
||||||
|
if Data <> 0 then begin
|
||||||
|
FUnicodeText := PWideChar(GlobalLock(Data));
|
||||||
|
GlobalUnlock(Data);
|
||||||
|
end;
|
||||||
|
Clipboard.Close;
|
||||||
|
end;
|
||||||
|
//Bitmap
|
||||||
|
if Clipboard.HasFormat(CF_BITMAP) then
|
||||||
|
try
|
||||||
|
FBitmap:=TBitmap.Create;
|
||||||
|
FBitmap.Assign(Clipboard);
|
||||||
|
except
|
||||||
|
FBitmap.Free;
|
||||||
|
end;
|
||||||
|
//metafile
|
||||||
|
if Clipboard.HasFormat(CF_METAFILEPICT) then
|
||||||
|
try
|
||||||
|
FMetafile:=TMetafile.Create;
|
||||||
|
FMetafile.Assign(Clipboard);
|
||||||
|
except
|
||||||
|
FMetafile.Free;
|
||||||
|
end;
|
||||||
|
//files
|
||||||
|
if Clipboard.HasFormat(CF_HDROP) then begin
|
||||||
|
Clipboard.Open;
|
||||||
|
Data := GetClipboardData(CF_HDROP);
|
||||||
|
if Data <> 0 then begin
|
||||||
|
p := PChar(GlobalLock(Data));
|
||||||
|
Count:=DragQueryFile(HDROP(p), $FFFFFFFF, nil, 0);
|
||||||
|
for i:=0 to Count-1 do begin
|
||||||
|
DragQueryFile(HDROP(p), i, @Buffer, SizeOf(Buffer));
|
||||||
|
if strlen(PChar(@Buffer)) > 0 then FFiles.Add(PChar(@Buffer));
|
||||||
|
end;
|
||||||
|
GlobalUnlock(Data);
|
||||||
|
end;
|
||||||
|
Clipboard.Close;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
||||||
@ -58,30 +58,30 @@
|
|||||||
<DelphiCompile Include="GUIBase.dpk">
|
<DelphiCompile Include="GUIBase.dpk">
|
||||||
<MainSource>MainSource</MainSource>
|
<MainSource>MainSource</MainSource>
|
||||||
</DelphiCompile>
|
</DelphiCompile>
|
||||||
<DCCReference Include="..\Modulos\Pedidos a proveedor\Base.dcp" />
|
<DCCReference Include="C:\Documents and Settings\Usuario\Base.dcp" />
|
||||||
<DCCReference Include="..\Modulos\Pedidos a proveedor\cxLibraryD11.dcp" />
|
<DCCReference Include="C:\Documents and Settings\Usuario\cxLibraryD11.dcp" />
|
||||||
<DCCReference Include="..\Modulos\Pedidos a proveedor\cxTreeListD11.dcp" />
|
<DCCReference Include="C:\Documents and Settings\Usuario\cxTreeListD11.dcp" />
|
||||||
<DCCReference Include="..\Modulos\Pedidos a proveedor\dbrtl.dcp" />
|
<DCCReference Include="C:\Documents and Settings\Usuario\dbrtl.dcp" />
|
||||||
<DCCReference Include="..\Modulos\Pedidos a proveedor\dxBarD11.dcp" />
|
<DCCReference Include="C:\Documents and Settings\Usuario\dxBarD11.dcp" />
|
||||||
<DCCReference Include="..\Modulos\Pedidos a proveedor\dxBarExtItemsD11.dcp" />
|
<DCCReference Include="C:\Documents and Settings\Usuario\dxBarExtItemsD11.dcp" />
|
||||||
<DCCReference Include="..\Modulos\Pedidos a proveedor\dxComnD11.dcp" />
|
<DCCReference Include="C:\Documents and Settings\Usuario\dxComnD11.dcp" />
|
||||||
<DCCReference Include="..\Modulos\Pedidos a proveedor\dxGDIPlusD11.dcp" />
|
<DCCReference Include="C:\Documents and Settings\Usuario\dxGDIPlusD11.dcp" />
|
||||||
<DCCReference Include="..\Modulos\Pedidos a proveedor\dxLayoutControlD11.dcp" />
|
<DCCReference Include="C:\Documents and Settings\Usuario\dxLayoutControlD11.dcp" />
|
||||||
<DCCReference Include="..\Modulos\Pedidos a proveedor\dxPSCoreD11.dcp" />
|
<DCCReference Include="C:\Documents and Settings\Usuario\dxPSCoreD11.dcp" />
|
||||||
<DCCReference Include="..\Modulos\Pedidos a proveedor\dxPScxCommonD11.dcp" />
|
<DCCReference Include="C:\Documents and Settings\Usuario\dxPScxCommonD11.dcp" />
|
||||||
<DCCReference Include="..\Modulos\Pedidos a proveedor\dxPScxGrid6LnkD11.dcp" />
|
<DCCReference Include="C:\Documents and Settings\Usuario\dxPScxGrid6LnkD11.dcp" />
|
||||||
<DCCReference Include="..\Modulos\Pedidos a proveedor\dxPsPrVwAdvD11.dcp" />
|
<DCCReference Include="C:\Documents and Settings\Usuario\dxPsPrVwAdvD11.dcp" />
|
||||||
<DCCReference Include="..\Modulos\Pedidos a proveedor\dxThemeD11.dcp" />
|
<DCCReference Include="C:\Documents and Settings\Usuario\dxThemeD11.dcp" />
|
||||||
<DCCReference Include="..\Modulos\Pedidos a proveedor\frx11.dcp" />
|
<DCCReference Include="C:\Documents and Settings\Usuario\frx11.dcp" />
|
||||||
<DCCReference Include="..\Modulos\Pedidos a proveedor\frxe11.dcp" />
|
<DCCReference Include="C:\Documents and Settings\Usuario\frxe11.dcp" />
|
||||||
<DCCReference Include="..\Modulos\Pedidos a proveedor\fs11.dcp" />
|
<DCCReference Include="C:\Documents and Settings\Usuario\fs11.dcp" />
|
||||||
<DCCReference Include="..\Modulos\Pedidos a proveedor\JvAppFrmD11R.dcp" />
|
<DCCReference Include="C:\Documents and Settings\Usuario\JvAppFrmD11R.dcp" />
|
||||||
<DCCReference Include="..\Modulos\Pedidos a proveedor\JvCtrlsD11R.dcp" />
|
<DCCReference Include="C:\Documents and Settings\Usuario\JvCtrlsD11R.dcp" />
|
||||||
<DCCReference Include="..\Modulos\Pedidos a proveedor\rtl.dcp" />
|
<DCCReference Include="C:\Documents and Settings\Usuario\rtl.dcp" />
|
||||||
<DCCReference Include="..\Modulos\Pedidos a proveedor\vcl.dcp" />
|
<DCCReference Include="C:\Documents and Settings\Usuario\vcl.dcp" />
|
||||||
<DCCReference Include="..\Modulos\Pedidos a proveedor\vcldb.dcp" />
|
<DCCReference Include="C:\Documents and Settings\Usuario\vcldb.dcp" />
|
||||||
<DCCReference Include="..\Modulos\Pedidos a proveedor\vcljpg.dcp" />
|
<DCCReference Include="C:\Documents and Settings\Usuario\vcljpg.dcp" />
|
||||||
<DCCReference Include="..\Modulos\Pedidos a proveedor\vclx.dcp" />
|
<DCCReference Include="C:\Documents and Settings\Usuario\vclx.dcp" />
|
||||||
<DCCReference Include="uDialogBase.pas">
|
<DCCReference Include="uDialogBase.pas">
|
||||||
<Form>fDialogBase</Form>
|
<Form>fDialogBase</Form>
|
||||||
</DCCReference>
|
</DCCReference>
|
||||||
|
|||||||
Binary file not shown.
@ -64,7 +64,7 @@ inherited frViewDetallesBase: TfrViewDetallesBase
|
|||||||
DroppedDownWidth = 145
|
DroppedDownWidth = 145
|
||||||
MaxMRUCount = 0
|
MaxMRUCount = 0
|
||||||
FontName = 'Tahoma'
|
FontName = 'Tahoma'
|
||||||
ItemIndex = 42
|
ItemIndex = 39
|
||||||
Options = [foTrueTypeOnly, foNoOEMFonts, foScalableOnly, foWysiWyg]
|
Options = [foTrueTypeOnly, foNoOEMFonts, foScalableOnly, foWysiWyg]
|
||||||
Sorted = True
|
Sorted = True
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
@ -293,6 +293,7 @@ inherited frViewDetallesBase: TfrViewDetallesBase
|
|||||||
DataBinding.FieldName = 'CONCEPTO'
|
DataBinding.FieldName = 'CONCEPTO'
|
||||||
PropertiesClassName = 'TcxRichEditProperties'
|
PropertiesClassName = 'TcxRichEditProperties'
|
||||||
Properties.AllowObjects = True
|
Properties.AllowObjects = True
|
||||||
|
Properties.SelectionBar = True
|
||||||
Width = 237
|
Width = 237
|
||||||
end
|
end
|
||||||
object cxGridViewCANTIDAD: TcxGridDBColumn
|
object cxGridViewCANTIDAD: TcxGridDBColumn
|
||||||
@ -533,18 +534,21 @@ inherited frViewDetallesBase: TfrViewDetallesBase
|
|||||||
object actDetallesCortar: TAction
|
object actDetallesCortar: TAction
|
||||||
Category = 'Editar'
|
Category = 'Editar'
|
||||||
Caption = 'Cortar'
|
Caption = 'Cortar'
|
||||||
|
ShortCut = 16472
|
||||||
OnExecute = actDetallesCortarExecute
|
OnExecute = actDetallesCortarExecute
|
||||||
OnUpdate = actDetallesCortarUpdate
|
OnUpdate = actDetallesCortarUpdate
|
||||||
end
|
end
|
||||||
object actDetallesCopiar: TAction
|
object actDetallesCopiar: TAction
|
||||||
Category = 'Editar'
|
Category = 'Editar'
|
||||||
Caption = 'Copiar'
|
Caption = 'Copiar'
|
||||||
|
ShortCut = 16451
|
||||||
OnExecute = actDetallesCopiarExecute
|
OnExecute = actDetallesCopiarExecute
|
||||||
OnUpdate = actDetallesCopiarUpdate
|
OnUpdate = actDetallesCopiarUpdate
|
||||||
end
|
end
|
||||||
object actDetallesPegar: TAction
|
object actDetallesPegar: TAction
|
||||||
Category = 'Editar'
|
Category = 'Editar'
|
||||||
Caption = 'Pegar'
|
Caption = 'Pegar'
|
||||||
|
ShortCut = 16470
|
||||||
OnExecute = actDetallesPegarExecute
|
OnExecute = actDetallesPegarExecute
|
||||||
OnUpdate = actDetallesPegarUpdate
|
OnUpdate = actDetallesPegarUpdate
|
||||||
end
|
end
|
||||||
@ -583,6 +587,7 @@ inherited frViewDetallesBase: TfrViewDetallesBase
|
|||||||
object actSeleccionarTodo: TAction
|
object actSeleccionarTodo: TAction
|
||||||
Category = 'Editar'
|
Category = 'Editar'
|
||||||
Caption = 'Seleccionar todo'
|
Caption = 'Seleccionar todo'
|
||||||
|
ShortCut = 16449
|
||||||
OnExecute = actSeleccionarTodoExecute
|
OnExecute = actSeleccionarTodoExecute
|
||||||
OnUpdate = actSeleccionarTodoUpdate
|
OnUpdate = actSeleccionarTodoUpdate
|
||||||
end
|
end
|
||||||
|
|||||||
@ -12,7 +12,7 @@ uses
|
|||||||
uGridStatusUtils, uControllerDetallesBase, cxCurrencyEdit,
|
uGridStatusUtils, uControllerDetallesBase, cxCurrencyEdit,
|
||||||
ExtCtrls, Grids, DBGrids, StdCtrls,
|
ExtCtrls, Grids, DBGrids, StdCtrls,
|
||||||
ExtActns, StdActns, cxRichEdit, JvExStdCtrls, JvCombobox, JvColorCombo,
|
ExtActns, StdActns, cxRichEdit, JvExStdCtrls, JvCombobox, JvColorCombo,
|
||||||
TB2Item, TBX, TB2Dock, TB2Toolbar, uDAInterfaces,
|
TB2Item, TBX, TB2Dock, TB2Toolbar, uDAInterfaces, cxContainer,
|
||||||
Menus, cxGridCustomPopupMenu, cxGridPopupMenu;
|
Menus, cxGridCustomPopupMenu, cxGridPopupMenu;
|
||||||
|
|
||||||
type
|
type
|
||||||
@ -214,6 +214,8 @@ type
|
|||||||
|
|
||||||
function DarPosicionCAMPO(const Nombre:String): Integer;
|
function DarPosicionCAMPO(const Nombre:String): Integer;
|
||||||
function DarListaSeleccionados: TIntegerArray;
|
function DarListaSeleccionados: TIntegerArray;
|
||||||
|
|
||||||
|
procedure DoPasteText(Sender: TObject; AText: string);
|
||||||
protected
|
protected
|
||||||
function HayQueRecalcular(AItem: TcxCustomGridTableItem): Boolean; virtual;
|
function HayQueRecalcular(AItem: TcxCustomGridTableItem): Boolean; virtual;
|
||||||
function EsTipoEditable(AItem: TcxCustomGridTableItem): Boolean; virtual;
|
function EsTipoEditable(AItem: TcxCustomGridTableItem): Boolean; virtual;
|
||||||
@ -246,11 +248,40 @@ implementation
|
|||||||
{$R *.dfm}
|
{$R *.dfm}
|
||||||
|
|
||||||
uses
|
uses
|
||||||
uDMBase, uCalculosUtils, dxOffice11, uSistemaFunc, uGridClipboardUtils;
|
uDMBase, uCalculosUtils, dxOffice11, uSistemaFunc, uGridClipboardUtils,
|
||||||
|
Clipbrd;
|
||||||
|
|
||||||
|
type
|
||||||
|
TOnPaste = procedure(Sender: TObject; AText: string) of object;
|
||||||
|
|
||||||
|
TcxMyRichEdit = class(TcxRichEdit)
|
||||||
|
private
|
||||||
|
FOnPaste: TOnPaste;
|
||||||
|
FOldWndProc : TWndMethod;
|
||||||
|
FGrid: TcxGrid;
|
||||||
|
procedure InnerControlWindowProc(var Message: TMessage);
|
||||||
|
procedure FInnerRichOnKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||||
|
protected
|
||||||
|
procedure DoPaste; virtual;
|
||||||
|
procedure Initialize; override;
|
||||||
|
procedure HookInnerControl;
|
||||||
|
public
|
||||||
|
procedure PasteFromClipboard; override;
|
||||||
|
destructor Destroy; override;
|
||||||
|
property _Grid : TcxGrid read FGrid write FGrid;
|
||||||
|
property OnPaste: TOnPaste read FOnPaste write FOnPaste;
|
||||||
|
end;
|
||||||
|
|
||||||
|
TcxMyRichEditProperties = class(TcxRichEditProperties)
|
||||||
|
public
|
||||||
|
class function GetContainerClass: TcxContainerClass; override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
var
|
var
|
||||||
_FRecalculando : Boolean;
|
_FRecalculando : Boolean;
|
||||||
_FRecalcular : Boolean;
|
_FRecalcular : Boolean;
|
||||||
|
_FPegando : Boolean;
|
||||||
|
|
||||||
function EnumFontsProc(var LogFont: TLogFont; var TextMetric: TTextMetric;
|
function EnumFontsProc(var LogFont: TLogFont; var TextMetric: TTextMetric;
|
||||||
FontType: Integer; Data: Pointer): Integer; stdcall;
|
FontType: Integer; Data: Pointer): Integer; stdcall;
|
||||||
@ -270,6 +301,7 @@ begin
|
|||||||
if bEsMultiSelect then
|
if bEsMultiSelect then
|
||||||
_FocusedView.OptionsSelection.MultiSelect := False;
|
_FocusedView.OptionsSelection.MultiSelect := False;
|
||||||
|
|
||||||
|
ShowHourglassCursor;
|
||||||
_FocusedView.BeginUpdate;
|
_FocusedView.BeginUpdate;
|
||||||
try
|
try
|
||||||
if _FocusedView.Controller.EditingController.IsEditing then
|
if _FocusedView.Controller.EditingController.IsEditing then
|
||||||
@ -285,6 +317,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
_FocusedView.EndUpdate;
|
_FocusedView.EndUpdate;
|
||||||
|
HideHourglassCursor;
|
||||||
|
|
||||||
// Dejo la propiedad MultiSelect como estaba
|
// Dejo la propiedad MultiSelect como estaba
|
||||||
if bEsMultiSelect then
|
if bEsMultiSelect then
|
||||||
@ -308,6 +341,7 @@ begin
|
|||||||
if bEsMultiSelect then
|
if bEsMultiSelect then
|
||||||
_FocusedView.OptionsSelection.MultiSelect := False;
|
_FocusedView.OptionsSelection.MultiSelect := False;
|
||||||
|
|
||||||
|
ShowHourglassCursor;
|
||||||
_FocusedView.BeginUpdate;
|
_FocusedView.BeginUpdate;
|
||||||
try
|
try
|
||||||
if _FocusedView.Controller.EditingController.IsEditing then
|
if _FocusedView.Controller.EditingController.IsEditing then
|
||||||
@ -317,6 +351,7 @@ begin
|
|||||||
Controller.Add(FDetalles, TIPO_DETALLE_DESCUENTO);
|
Controller.Add(FDetalles, TIPO_DETALLE_DESCUENTO);
|
||||||
finally
|
finally
|
||||||
_FocusedView.EndUpdate;
|
_FocusedView.EndUpdate;
|
||||||
|
HideHourglassCursor;
|
||||||
|
|
||||||
// Dejo la propiedad MultiSelect como estaba
|
// Dejo la propiedad MultiSelect como estaba
|
||||||
if bEsMultiSelect then
|
if bEsMultiSelect then
|
||||||
@ -340,6 +375,7 @@ begin
|
|||||||
if bEsMultiSelect then
|
if bEsMultiSelect then
|
||||||
_FocusedView.OptionsSelection.MultiSelect := False;
|
_FocusedView.OptionsSelection.MultiSelect := False;
|
||||||
|
|
||||||
|
ShowHourglassCursor;
|
||||||
_FocusedView.BeginUpdate;
|
_FocusedView.BeginUpdate;
|
||||||
try
|
try
|
||||||
if _FocusedView.Controller.EditingController.IsEditing then
|
if _FocusedView.Controller.EditingController.IsEditing then
|
||||||
@ -349,7 +385,8 @@ begin
|
|||||||
Controller.Add(FDetalles, TIPO_DETALLE_CONCEPTO);
|
Controller.Add(FDetalles, TIPO_DETALLE_CONCEPTO);
|
||||||
finally
|
finally
|
||||||
_FocusedView.EndUpdate;
|
_FocusedView.EndUpdate;
|
||||||
|
HideHourglassCursor;
|
||||||
|
|
||||||
// Dejo la propiedad MultiSelect como estaba
|
// Dejo la propiedad MultiSelect como estaba
|
||||||
if bEsMultiSelect then
|
if bEsMultiSelect then
|
||||||
_FocusedView.OptionsSelection.MultiSelect := bEsMultiSelect;
|
_FocusedView.OptionsSelection.MultiSelect := bEsMultiSelect;
|
||||||
@ -366,6 +403,7 @@ begin
|
|||||||
if bEsMultiSelect then
|
if bEsMultiSelect then
|
||||||
_FocusedView.OptionsSelection.MultiSelect := False;
|
_FocusedView.OptionsSelection.MultiSelect := False;
|
||||||
|
|
||||||
|
ShowHourglassCursor;
|
||||||
_FocusedView.BeginUpdate;
|
_FocusedView.BeginUpdate;
|
||||||
try
|
try
|
||||||
if _FocusedView.Controller.EditingController.IsEditing then
|
if _FocusedView.Controller.EditingController.IsEditing then
|
||||||
@ -375,7 +413,8 @@ begin
|
|||||||
Controller.Add(FDetalles, TIPO_DETALLE_SUBTOTAL);
|
Controller.Add(FDetalles, TIPO_DETALLE_SUBTOTAL);
|
||||||
finally
|
finally
|
||||||
_FocusedView.EndUpdate;
|
_FocusedView.EndUpdate;
|
||||||
|
HideHourglassCursor;
|
||||||
|
|
||||||
// Dejo la propiedad MultiSelect como estaba
|
// Dejo la propiedad MultiSelect como estaba
|
||||||
if bEsMultiSelect then
|
if bEsMultiSelect then
|
||||||
_FocusedView.OptionsSelection.MultiSelect := bEsMultiSelect;
|
_FocusedView.OptionsSelection.MultiSelect := bEsMultiSelect;
|
||||||
@ -398,6 +437,7 @@ begin
|
|||||||
if bEsMultiSelect then
|
if bEsMultiSelect then
|
||||||
cxGridView.OptionsSelection.MultiSelect := False;
|
cxGridView.OptionsSelection.MultiSelect := False;
|
||||||
|
|
||||||
|
ShowHourglassCursor;
|
||||||
_FocusedView.BeginUpdate;
|
_FocusedView.BeginUpdate;
|
||||||
try
|
try
|
||||||
if _FocusedView.Controller.EditingController.IsEditing then
|
if _FocusedView.Controller.EditingController.IsEditing then
|
||||||
@ -407,6 +447,7 @@ begin
|
|||||||
Controller.Add(FDetalles, TIPO_DETALLE_TITULO);
|
Controller.Add(FDetalles, TIPO_DETALLE_TITULO);
|
||||||
finally
|
finally
|
||||||
_FocusedView.EndUpdate;
|
_FocusedView.EndUpdate;
|
||||||
|
HideHourglassCursor;
|
||||||
|
|
||||||
// Dejo la propiedad MultiSelect como estaba
|
// Dejo la propiedad MultiSelect como estaba
|
||||||
if bEsMultiSelect then
|
if bEsMultiSelect then
|
||||||
@ -425,6 +466,7 @@ var
|
|||||||
AuxTop, AuxRow:Integer;
|
AuxTop, AuxRow:Integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
ShowHourglassCursor;
|
||||||
_FocusedView.BeginUpdate;
|
_FocusedView.BeginUpdate;
|
||||||
try
|
try
|
||||||
if Assigned(Controller) and Assigned(FDetalles) then
|
if Assigned(Controller) and Assigned(FDetalles) then
|
||||||
@ -448,6 +490,7 @@ begin
|
|||||||
end
|
end
|
||||||
finally
|
finally
|
||||||
_FocusedView.EndUpdate;
|
_FocusedView.EndUpdate;
|
||||||
|
HideHourglassCursor;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
SeleccionarFilaActual;
|
SeleccionarFilaActual;
|
||||||
@ -503,6 +546,11 @@ begin
|
|||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TfrViewDetallesBase.DoPasteText(Sender: TObject; AText: string);
|
||||||
|
begin
|
||||||
|
ShowMessage(AText);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TfrViewDetallesBase.ContraerTodo;
|
procedure TfrViewDetallesBase.ContraerTodo;
|
||||||
begin
|
begin
|
||||||
if Assigned(_FocusedView) then
|
if Assigned(_FocusedView) then
|
||||||
@ -526,7 +574,7 @@ begin
|
|||||||
CurEdit := Nil;
|
CurEdit := Nil;
|
||||||
FUpdating := False;
|
FUpdating := False;
|
||||||
// cxGridView.OptionsView.RowSeparatorColor := dmBase.StyleManager.Colors.ButtonSeparatorColor;
|
// cxGridView.OptionsView.RowSeparatorColor := dmBase.StyleManager.Colors.ButtonSeparatorColor;
|
||||||
|
cxGridViewDESCRIPCION.PropertiesClass := TcxMyRichEditProperties;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrViewDetallesBase.CustomViewDestroy(Sender: TObject);
|
procedure TfrViewDetallesBase.CustomViewDestroy(Sender: TObject);
|
||||||
@ -548,7 +596,7 @@ begin
|
|||||||
inherited;
|
inherited;
|
||||||
cxGridView.BeginUpdate;
|
cxGridView.BeginUpdate;
|
||||||
try
|
try
|
||||||
Case Key of
|
case Key of
|
||||||
VK_DOWN : begin
|
VK_DOWN : begin
|
||||||
//En el caso de ser la última fila hacemos un append nosotros no el grid
|
//En el caso de ser la última fila hacemos un append nosotros no el grid
|
||||||
//ya que se saltaria la lógica del controllerDetallesBase
|
//ya que se saltaria la lógica del controllerDetallesBase
|
||||||
@ -580,8 +628,7 @@ begin
|
|||||||
: begin
|
: begin
|
||||||
//En el caso de ser la última fila hacemos un append nosotros no el grid
|
//En el caso de ser la última fila hacemos un append nosotros no el grid
|
||||||
//ya que se saltaria la lógica del controllerDetallesBase
|
//ya que se saltaria la lógica del controllerDetallesBase
|
||||||
if cxGridView.Controller.IsFinish
|
if cxGridView.Controller.IsFinish and AItem.IsLast then
|
||||||
and AItem.IsLast then
|
|
||||||
begin
|
begin
|
||||||
Key := 0;
|
Key := 0;
|
||||||
if Sender.Controller.EditingController.IsEditing then
|
if Sender.Controller.EditingController.IsEditing then
|
||||||
@ -648,6 +695,15 @@ var
|
|||||||
ARecord: TcxCustomGridRecord;
|
ARecord: TcxCustomGridRecord;
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
|
||||||
|
if AEdit is TcxMyRichEdit then
|
||||||
|
begin
|
||||||
|
TcxMyRichEdit(AEdit).OnPaste := DoPasteText;
|
||||||
|
TcxMyRichEdit(AEdit)._Grid := _Grid;
|
||||||
|
end;
|
||||||
|
|
||||||
|
Exit; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
if AEdit is TcxRichEdit then
|
if AEdit is TcxRichEdit then
|
||||||
begin
|
begin
|
||||||
ARecord := AItem.FocusedCellViewInfo.GridRecord;
|
ARecord := AItem.FocusedCellViewInfo.GridRecord;
|
||||||
@ -1068,6 +1124,7 @@ end;
|
|||||||
procedure TfrViewDetallesBase.actDetallesCortarExecute(Sender: TObject);
|
procedure TfrViewDetallesBase.actDetallesCortarExecute(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
ShowHourglassCursor;
|
ShowHourglassCursor;
|
||||||
|
Application.ProcessMessages;
|
||||||
try
|
try
|
||||||
CortarSeleccionGridAlPortapapeles(_Grid);
|
CortarSeleccionGridAlPortapapeles(_Grid);
|
||||||
finally
|
finally
|
||||||
@ -1083,24 +1140,17 @@ end;
|
|||||||
|
|
||||||
procedure TfrViewDetallesBase.actDetallesPegarExecute(Sender: TObject);
|
procedure TfrViewDetallesBase.actDetallesPegarExecute(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
{ if cxGridViewDESCRIPCION.Focused then
|
ShowHourglassCursor;
|
||||||
TcxRichEdit(cxGridViewDESCRIPCION).PasteSpecial
|
try
|
||||||
else begin}
|
PegarAlGridDesdePortapapeles(_Grid);
|
||||||
ShowHourglassCursor;
|
finally
|
||||||
try
|
HideHourglassCursor;
|
||||||
PegarSeleccionGridDesdePortapapeles(_Grid);
|
end;
|
||||||
finally
|
|
||||||
HideHourglassCursor;
|
|
||||||
end;
|
|
||||||
// end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrViewDetallesBase.actDetallesPegarUpdate(Sender: TObject);
|
procedure TfrViewDetallesBase.actDetallesPegarUpdate(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
{ if cxGridViewDESCRIPCION.Focused then
|
|
||||||
(Sender as TAction).Enabled := True
|
|
||||||
else}
|
|
||||||
(Sender as TAction).Enabled := HayDatosEnPortapapeles;
|
(Sender as TAction).Enabled := HayDatosEnPortapapeles;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1130,8 +1180,82 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TcxMyRichEdit }
|
||||||
|
|
||||||
|
destructor TcxMyRichEdit.Destroy;
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TcxMyRichEdit.DoPaste;
|
||||||
|
begin
|
||||||
|
if Assigned(FOnPaste) then
|
||||||
|
FOnPaste(Self, Self.Text);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TcxMyRichEdit.FInnerRichOnKeyDown(Sender: TObject; var Key: Word;
|
||||||
|
Shift: TShiftState);
|
||||||
|
begin
|
||||||
|
if ((Shift = [ssShift]) and (Key = VK_INSERT)) then
|
||||||
|
begin
|
||||||
|
PasteFromClipboard;
|
||||||
|
Key := 0;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TcxMyRichEdit.HookInnerControl;
|
||||||
|
begin
|
||||||
|
{ Desviamos los mensajes que recibe el componente RichEdit interno de la columna
|
||||||
|
a un procedimiento nuestro para interceptar los mensajes de pegar del portapapeles
|
||||||
|
y así en vez de ejecutar el 'paste' por defecto de Windows,
|
||||||
|
hacemos nuestro 'paste'.}
|
||||||
|
FOldWndProc := InnerRich.WindowProc;
|
||||||
|
InnerRich.WindowProc := InnerControlWindowProc;
|
||||||
|
InnerRich.OnKeyDown := FInnerRichOnKeyDown;
|
||||||
|
// InnerRich.PopupMenu := ;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TcxMyRichEdit.Initialize;
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
if Assigned(InnerRich) then
|
||||||
|
HookInnerControl;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TcxMyRichEdit.InnerControlWindowProc(var Message: TMessage);
|
||||||
|
begin
|
||||||
|
case Message.msg of
|
||||||
|
WM_PASTE: if not _FPegando then
|
||||||
|
PasteFromClipboard;
|
||||||
|
else
|
||||||
|
FOldWndProc(Message);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TcxMyRichEdit.PasteFromClipboard;
|
||||||
|
begin
|
||||||
|
_FPegando := True;
|
||||||
|
try
|
||||||
|
//if HayDatosEnPortapapeles(CF_FACTUGES) then
|
||||||
|
PegarAlGridDesdePortapapeles(FGrid);
|
||||||
|
//else
|
||||||
|
//inherited;
|
||||||
|
DoPaste;
|
||||||
|
finally
|
||||||
|
_FPegando := False;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TcxMyRichEditProperties }
|
||||||
|
|
||||||
|
class function TcxMyRichEditProperties.GetContainerClass: TcxContainerClass;
|
||||||
|
begin
|
||||||
|
Result := TcxMyRichEdit;
|
||||||
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
_FRecalculando := False;
|
_FRecalculando := False;
|
||||||
_FRecalcular := False;
|
_FRecalcular := False;
|
||||||
|
_FPegando := False;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|||||||
@ -167,8 +167,11 @@ inherited frViewRichEditor: TfrViewRichEditor
|
|||||||
Top = 26
|
Top = 26
|
||||||
Align = alClient
|
Align = alClient
|
||||||
ParentFont = False
|
ParentFont = False
|
||||||
|
Properties.AllowObjects = True
|
||||||
Properties.HideSelection = False
|
Properties.HideSelection = False
|
||||||
Properties.ScrollBars = ssVertical
|
Properties.ScrollBars = ssVertical
|
||||||
|
Properties.SelectionBar = True
|
||||||
|
Properties.StreamModes = [resmPlainRtf]
|
||||||
Properties.OnChange = RichEditPropertiesChange
|
Properties.OnChange = RichEditPropertiesChange
|
||||||
Properties.OnSelectionChange = RichEditPropertiesSelectionChange
|
Properties.OnSelectionChange = RichEditPropertiesSelectionChange
|
||||||
Style.Font.Charset = DEFAULT_CHARSET
|
Style.Font.Charset = DEFAULT_CHARSET
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user