IPXV_FormatConverter Interface

From PDF XChange PDF SDK
Jump to: navigation, search
m (Automatic page editing by robot)
(Label ToWrite removed)
(2 intermediate revisions by 2 users not shown)
Line 3: Line 3:
 
{{#customTitle:IPXV_FormatConverter Interface}}
 
{{#customTitle:IPXV_FormatConverter Interface}}
 
{{#parentPage:PXV:PXV_Interfaces|IPXV_FormatConverter|interface}}
 
{{#parentPage:PXV:PXV_Interfaces|IPXV_FormatConverter|interface}}
{{ToWrite}}
+
 
 
{{ToReview}}
 
{{ToReview}}
  
=== XXX => PDF ===
+
<tt>IPXV_FormatConverter</tt> interface is a base for two other interfaces - [[PXV:IPXV_ImportConverter|IPXV_ImportConverter]] and [[PXV:IPXV_ExportConverter|IPXV_ExportConverter]] - that are used to have an ability to open from and save to files other than PDF.
 +
All converters should be registered using methods [[PXV:IPXV_Inst_RegisterImportConverter|IPXV_Inst::RegisterImportConverter]] and [[PXV:IPXV_Inst_RegisterExportConverter|IPXV_Inst::RegisterExportConverter]].
  
<pre class="brush:cpp; gutter:false">
+
This interface defines common properties and methods for both Import and Export converters. Parameters are restored by the Editor before use and stored automatically when they were changed in Editor's UI (Open/Save dialog, Preferences).
IAFS_File* pInputFile;
+
</pre>
+
 
+
# маючи pInputFile беремо в нього розширення через його Name. якщо нема, то на п.4
+
# по цьому розширенню шукаємо конвертер. якщо нема то на п.4
+
# питаємо в конвертера через CheckFormat валідність файла. якщо результат CheckFormatResult_OK, то на п.6
+
# послідовно викликаємо CheckFormat у зареєстрованих конвертерів для пошуку конветера якщо може опрацювати файл
+
# якщо жодної форматки не підібрано - вихід з помилкою "Unknown File Format"
+
# нехай наш конвертер - pConverter; викликаємо в нього <code>CreateParams(&pParams);</code>
+
# <code>pConverter->Prepare(pInputFile, pParams, hWndParent);</code> викликається в головному потоці
+
# <code>pConverter->Convert(pInputFile, pParams, pProgress, &pOutFile);</code> може викликатись в окремому потоці. pOutFile може бути: IStream, IAFS_File, або повністю готовий IPXC_Document;
+
# якщо pOutFile не є IPXC_Document, то вважаємо що в pOutFile нормальний PDF file, який і пробуємо відкрити
+
 
+
=== PDF => XXX ===
+
 
+
<pre class="brush:cpp; gutter:false">
+
IPXC_Document* pSource;
+
</pre>
+
 
+
# при Save As (Export) будуємо стрічку для фільтра для діалога
+
# світимо діалог з кнопкою "Settings..." на діалозі
+
# при натисканні Settings, викликається Callback (який знає про pSource, про вибрану на данний момент форматку):
+
## в форматки викликається CreateParams(&pParams)
+
## викликається ShowPrefsDlg(pSource, pParams, SaveDlg.HWND)
+
## параметри що повернулись зберігаються до переключення форматки і використовуються при наступному натисканні Settings та при конвертації
+
# отримавши IDOK від діалога, якщо в нас немає ще pParams, то беремо їх в вибраного конвертера через <code>CreateParams(&pParams)</code>
+
# викликаємо в головному потоці <code>pConverter->Prepare(pSource, pParams, DocView.HWND);</code>
+
# <code>pConverter->Convert(pSource, pParams, pProgress, NULL);</code> передаємо останнім параметром NULL оскільки нам непотрібні результуючі файли
+
 
+
=== Preferences ===
+
# використовуючи get_Name, get_Description, etc, показуємо список зареєстрованих конвертерів.
+
# при виборі конвертера зі списку дивимось його флажки і якщо встановлено <code>HasPreferences</code>, то дозволяється "Settings..." кнопка, при натисканні якої викликаємо
+
 
+
<pre class="brush:cpp; gutter:false">
+
ShowPrefsDlg(NULL, NULL, PrefsDlg.HWND);
+
</pre>
+
  
 
== Methods ==
 
== Methods ==
Line 61: Line 26:
 
| [[PXV:IPXV_FormatConverter_FilterName|FilterName]]
 
| [[PXV:IPXV_FormatConverter_FilterName|FilterName]]
 
| [[PXV:IPXV_FormatConverter_Icon|Icon]]
 
| [[PXV:IPXV_FormatConverter_Icon|Icon]]
| [[PXV:IPXV_FormatConverter_Name|Name]]
+
| [[PXV:IPXV_FormatConverter_MIME|MIME]]
 
|-
 
|-
 
| [[PXV:IPXV_FormatConverter_Extensions|Extensions]]
 
| [[PXV:IPXV_FormatConverter_Extensions|Extensions]]
 
| [[PXV:IPXV_FormatConverter_Flags|Flags]]
 
| [[PXV:IPXV_FormatConverter_Flags|Flags]]
| [[PXV:IPXV_FormatConverter_MIME|MIME]]
+
| [[PXV:IPXV_FormatConverter_ID|ID]]
|  
+
| [[PXV:IPXV_FormatConverter_Name|Name]]
 
|}
 
|}

Revision as of 02:01, 27 April 2017


IPXV_FormatConverter interface is a base for two other interfaces - IPXV_ImportConverter and IPXV_ExportConverter - that are used to have an ability to open from and save to files other than PDF. All converters should be registered using methods IPXV_Inst::RegisterImportConverter and IPXV_Inst::RegisterExportConverter.

This interface defines common properties and methods for both Import and Export converters. Parameters are restored by the Editor before use and stored automatically when they were changed in Editor's UI (Open/Save dialog, Preferences).

Methods

CreateParams ShowPrefsDlg

Properties

Description FilterName Icon MIME
Extensions Flags ID Name