Kaydet (Commit) f35b1958 authored tarafından Caolán McNamara's avatar Caolán McNamara

convert pdf warn dialog to .ui

Change-Id: I379c7f06ae87bee5571c1f2ef5053b3b863d6e61
üst 53849235
...@@ -19,6 +19,7 @@ $(eval $(call gb_UIConfig_add_uifiles,filter,\ ...@@ -19,6 +19,7 @@ $(eval $(call gb_UIConfig_add_uifiles,filter,\
filter/uiconfig/ui/pdfuserinterfacepage \ filter/uiconfig/ui/pdfuserinterfacepage \
filter/uiconfig/ui/pdfviewpage \ filter/uiconfig/ui/pdfviewpage \
filter/uiconfig/ui/testxmlfilter \ filter/uiconfig/ui/testxmlfilter \
filter/uiconfig/ui/warnpdfdialog \
filter/uiconfig/ui/xmlfiltersettings \ filter/uiconfig/ui/xmlfiltersettings \
filter/uiconfig/ui/xmlfiltertabpagegeneral \ filter/uiconfig/ui/xmlfiltertabpagegeneral \
filter/uiconfig/ui/xmlfiltertabpagetransformation \ filter/uiconfig/ui/xmlfiltertabpagetransformation \
......
...@@ -1450,15 +1450,18 @@ IMPL_LINK_NOARG(ImpPDFTabLinksPage, ClickRbOpnLnksBrowserHdl) ...@@ -1450,15 +1450,18 @@ IMPL_LINK_NOARG(ImpPDFTabLinksPage, ClickRbOpnLnksBrowserHdl)
return 0; return 0;
} }
ImplErrorDialog::ImplErrorDialog( const std::set< vcl::PDFWriter::ErrorCode >& rErrors ) : ImplErrorDialog::ImplErrorDialog(const std::set< vcl::PDFWriter::ErrorCode >& rErrors)
ModalDialog( NULL, PDFFilterResId( RID_PDF_ERROR_DLG ) ), : MessageDialog(NULL, "WarnPDFDialog", "filter/ui/warnpdfdialog.ui")
maFI( this, 0 ),
maProcessText( this, PDFFilterResId( FT_PROCESS ) ),
maErrors( this, WB_BORDER | WB_AUTOVSCROLL ),
maExplanation( this, WB_WORDBREAK ),
maButton( this, WB_DEFBUTTON )
{ {
get(m_pErrors, "errors");
get(m_pExplanation, "message");
Size aSize(LogicToPixel(Size(100, 75), MapMode(MAP_APPFONT)));
m_pErrors->set_width_request(aSize.Width());
m_pErrors->set_height_request(aSize.Height());
m_pExplanation->set_width_request(aSize.Width());
m_pExplanation->set_height_request(aSize.Height());
// load images // load images
Image aWarnImg( BitmapEx( PDFFilterResId( IMG_WARN ) ) ); Image aWarnImg( BitmapEx( PDFFilterResId( IMG_WARN ) ) );
Image aErrImg( BitmapEx( PDFFilterResId( IMG_ERR ) ) ); Image aErrImg( BitmapEx( PDFFilterResId( IMG_ERR ) ) );
...@@ -1470,30 +1473,30 @@ ImplErrorDialog::ImplErrorDialog( const std::set< vcl::PDFWriter::ErrorCode >& r ...@@ -1470,30 +1473,30 @@ ImplErrorDialog::ImplErrorDialog( const std::set< vcl::PDFWriter::ErrorCode >& r
{ {
case vcl::PDFWriter::Warning_Transparency_Omitted_PDFA: case vcl::PDFWriter::Warning_Transparency_Omitted_PDFA:
{ {
sal_uInt16 nPos = maErrors.InsertEntry( OUString( PDFFilterResId( STR_WARN_TRANSP_PDFA_SHORT ) ), sal_uInt16 nPos = m_pErrors->InsertEntry( OUString( PDFFilterResId( STR_WARN_TRANSP_PDFA_SHORT ) ),
aWarnImg ); aWarnImg );
maErrors.SetEntryData( nPos, new OUString( PDFFilterResId( STR_WARN_TRANSP_PDFA ) ) ); m_pErrors->SetEntryData( nPos, new OUString( PDFFilterResId( STR_WARN_TRANSP_PDFA ) ) );
} }
break; break;
case vcl::PDFWriter::Warning_Transparency_Omitted_PDF13: case vcl::PDFWriter::Warning_Transparency_Omitted_PDF13:
{ {
sal_uInt16 nPos = maErrors.InsertEntry( OUString( PDFFilterResId( STR_WARN_TRANSP_VERSION_SHORT ) ), sal_uInt16 nPos = m_pErrors->InsertEntry( OUString( PDFFilterResId( STR_WARN_TRANSP_VERSION_SHORT ) ),
aWarnImg ); aWarnImg );
maErrors.SetEntryData( nPos, new OUString( PDFFilterResId( STR_WARN_TRANSP_VERSION ) ) ); m_pErrors->SetEntryData( nPos, new OUString( PDFFilterResId( STR_WARN_TRANSP_VERSION ) ) );
} }
break; break;
case vcl::PDFWriter::Warning_FormAction_Omitted_PDFA: case vcl::PDFWriter::Warning_FormAction_Omitted_PDFA:
{ {
sal_uInt16 nPos = maErrors.InsertEntry( OUString( PDFFilterResId( STR_WARN_FORMACTION_PDFA_SHORT ) ), sal_uInt16 nPos = m_pErrors->InsertEntry( OUString( PDFFilterResId( STR_WARN_FORMACTION_PDFA_SHORT ) ),
aWarnImg ); aWarnImg );
maErrors.SetEntryData( nPos, new OUString( PDFFilterResId( STR_WARN_FORMACTION_PDFA ) ) ); m_pErrors->SetEntryData( nPos, new OUString( PDFFilterResId( STR_WARN_FORMACTION_PDFA ) ) );
} }
break; break;
case vcl::PDFWriter::Warning_Transparency_Converted: case vcl::PDFWriter::Warning_Transparency_Converted:
{ {
sal_uInt16 nPos = maErrors.InsertEntry( OUString( PDFFilterResId( STR_WARN_TRANSP_CONVERTED_SHORT ) ), sal_uInt16 nPos = m_pErrors->InsertEntry( OUString( PDFFilterResId( STR_WARN_TRANSP_CONVERTED_SHORT ) ),
aWarnImg ); aWarnImg );
maErrors.SetEntryData( nPos, new OUString( PDFFilterResId( STR_WARN_TRANSP_CONVERTED ) ) ); m_pErrors->SetEntryData( nPos, new OUString( PDFFilterResId( STR_WARN_TRANSP_CONVERTED ) ) );
} }
break; break;
default: default:
...@@ -1501,55 +1504,27 @@ ImplErrorDialog::ImplErrorDialog( const std::set< vcl::PDFWriter::ErrorCode >& r ...@@ -1501,55 +1504,27 @@ ImplErrorDialog::ImplErrorDialog( const std::set< vcl::PDFWriter::ErrorCode >& r
} }
} }
FreeResource(); if( m_pErrors->GetEntryCount() > 0 )
if( maErrors.GetEntryCount() > 0 )
{ {
maErrors.SelectEntryPos( 0 ); m_pErrors->SelectEntryPos( 0 );
OUString* pStr = reinterpret_cast<OUString*>(maErrors.GetEntryData( 0 )); OUString* pStr = reinterpret_cast<OUString*>(m_pErrors->GetEntryData( 0 ));
maExplanation.SetText( pStr ? *pStr : OUString() ); m_pExplanation->SetText( pStr ? *pStr : OUString() );
} }
// adjust layout m_pErrors->SetSelectHdl( LINK( this, ImplErrorDialog, SelectHdl ) );
Image aWarnImage( WarningBox::GetStandardImage() );
Size aImageSize( aWarnImage.GetSizePixel() );
Size aDlgSize( GetSizePixel() );
aImageSize.Width() += 6;
aImageSize.Height() += 6;
maFI.SetImage( aWarnImage );
maFI.SetPosSizePixel( Point( 5, 5 ), aImageSize );
maFI.Show();
maProcessText.SetStyle( maProcessText.GetStyle() | WB_VCENTER );
maProcessText.SetPosSizePixel( Point( aImageSize.Width() + 10, 5 ),
Size( aDlgSize.Width() - aImageSize.Width() - 15, aImageSize.Height() ) );
Point aErrorLBPos( 5, aImageSize.Height() + 10 );
Size aErrorLBSize( aDlgSize.Width()/2 - 10, aDlgSize.Height() - aErrorLBPos.Y() - 35 );
maErrors.SetPosSizePixel( aErrorLBPos, aErrorLBSize );
maErrors.SetSelectHdl( LINK( this, ImplErrorDialog, SelectHdl ) );
maErrors.Show();
maExplanation.SetPosSizePixel( Point( aErrorLBPos.X() + aErrorLBSize.Width() + 5, aErrorLBPos.Y() ),
Size( aDlgSize.Width() - aErrorLBPos.X() - aErrorLBSize.Width() - 10, aErrorLBSize.Height() ) );
maExplanation.Show();
maButton.SetPosSizePixel( Point( (aDlgSize.Width() - 50)/2, aDlgSize.Height() - 30 ),
Size( 50, 25 ) );
maButton.Show();
} }
ImplErrorDialog::~ImplErrorDialog() ImplErrorDialog::~ImplErrorDialog()
{ {
// free strings again // free strings again
for( sal_uInt16 n = 0; n < maErrors.GetEntryCount(); n++ ) for( sal_uInt16 n = 0; n < m_pErrors->GetEntryCount(); n++ )
delete (OUString*)maErrors.GetEntryData( n ); delete (OUString*)m_pErrors->GetEntryData( n );
} }
IMPL_LINK_NOARG(ImplErrorDialog, SelectHdl) IMPL_LINK_NOARG(ImplErrorDialog, SelectHdl)
{ {
OUString* pStr = reinterpret_cast<OUString*>(maErrors.GetEntryData( maErrors.GetSelectEntryPos() )); OUString* pStr = reinterpret_cast<OUString*>(m_pErrors->GetEntryData( m_pErrors->GetSelectEntryPos() ));
maExplanation.SetText( pStr ? *pStr : OUString() ); m_pExplanation->SetText( pStr ? *pStr : OUString() );
return 0; return 0;
} }
......
...@@ -19,32 +19,25 @@ ...@@ -19,32 +19,25 @@
#include <filter.hrc> #include <filter.hrc>
#define RID_PDF_WARNPDFAPASSWORD (RID_PDF_DIALOG_START + 6) #define RID_PDF_WARNPDFAPASSWORD (RID_PDF_DIALOG_START + 6)
//strings for PDF security, user password management //strings for PDF security, user password management
#define STR_PDF_EXPORT_UDPWD (RID_PDF_DIALOG_START + 7) #define STR_PDF_EXPORT_UDPWD (RID_PDF_DIALOG_START + 7)
//strings for PDF security, owner password management //strings for PDF security, owner password management
#define STR_PDF_EXPORT_ODPWD (RID_PDF_DIALOG_START + 10) #define STR_PDF_EXPORT_ODPWD (RID_PDF_DIALOG_START + 8)
#define RID_PDF_ERROR_DLG (RID_PDF_DIALOG_START + 11) #define STR_WARN_TRANSP_PDFA (RID_PDF_DIALOG_START + 9)
#define FT_PROCESS 1 #define STR_WARN_TRANSP_PDFA_SHORT (RID_PDF_DIALOG_START + 10)
#define IMG_WARN 2 #define STR_WARN_TRANSP_VERSION (RID_PDF_DIALOG_START + 11)
#define IMG_ERR 3 #define STR_WARN_TRANSP_VERSION_SHORT (RID_PDF_DIALOG_START + 12)
#define STR_WARN_TRANSP_PDFA 4 #define STR_WARN_FORMACTION_PDFA (RID_PDF_DIALOG_START + 13)
#define STR_WARN_TRANSP_PDFA_SHORT 5 #define STR_WARN_FORMACTION_PDFA_SHORT (RID_PDF_DIALOG_START + 14)
#define STR_WARN_TRANSP_VERSION 6 #define STR_WARN_TRANSP_CONVERTED (RID_PDF_DIALOG_START + 15)
#define STR_WARN_TRANSP_VERSION_SHORT 7 #define STR_WARN_TRANSP_CONVERTED_SHORT (RID_PDF_DIALOG_START + 16)
#define STR_WARN_FORMACTION_PDFA 8 #define IMG_WARN (RID_PDF_DIALOG_START + 17)
#define STR_WARN_FORMACTION_PDFA_SHORT 9 #define IMG_ERR (RID_PDF_DIALOG_START + 18)
#define STR_WARN_TRANSP_CONVERTED 10
#define STR_WARN_TRANSP_CONVERTED_SHORT 11 //ATTENTION: maximum allowed value is (RID_PDF_DIALOG_START + 19)
//ATTENTION: maximum allowed value is( RID_PDF_DIALOG_START + 19)
#define FL_GENERAL_VERTICAL 157
#define FL_INITVIEW_VERTICAL 158
#define FL_VPREFER_VERTICAL 158
#define FL_SECURITY_VERTICAL 160
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -54,14 +54,10 @@ public: ...@@ -54,14 +54,10 @@ public:
PDFFilterResId( sal_uInt32 nId ); PDFFilterResId( sal_uInt32 nId );
}; };
class ImplErrorDialog : public ModalDialog class ImplErrorDialog : public MessageDialog
{ {
FixedImage maFI; ListBox* m_pErrors;
FixedText maProcessText; FixedText* m_pExplanation;
ListBox maErrors;
FixedText maExplanation;
OKButton maButton;
DECL_LINK(SelectHdl, void *); DECL_LINK(SelectHdl, void *);
public: public:
......
...@@ -39,64 +39,54 @@ WarningBox RID_PDF_WARNPDFAPASSWORD ...@@ -39,64 +39,54 @@ WarningBox RID_PDF_WARNPDFAPASSWORD
Message[ en-US ] = "PDF/A does not allow encryption. The exported PDF file will not be password protected."; Message[ en-US ] = "PDF/A does not allow encryption. The exported PDF file will not be password protected.";
}; };
ModalDialog RID_PDF_ERROR_DLG String STR_WARN_TRANSP_PDFA_SHORT
{ {
HelpID = "filter:ModalDialog:RID_PDF_ERROR_DLG"; Text [en-US] = "PDF/A transparency";
OutputSize = TRUE; };
SVLook = TRUE;
Moveable = TRUE; String STR_WARN_TRANSP_PDFA
Text [en-US] = "Problems during PDF export"; {
Size = MAP_APPFONT( 200, 150 ); Text [en-US] = "PDF/A forbids transparency. A transparent object was painted opaque instead.";
};
FixedText FT_PROCESS
{ String STR_WARN_TRANSP_VERSION_SHORT
WordBreak = TRUE; {
Pos = MAP_APPFONT( 5, 5 ); Text [en-US] = "PDF version conflict";
Size = MAP_APPFONT( 210, 24 ); };
Text [en-US] = "During PDF export the following problems occurred:";
}; String STR_WARN_TRANSP_VERSION
{
Bitmap IMG_WARN Text [en-US] = "Transparency is not supported in PDF versions earlier than PDF 1.4. A transparent object was painted opaque instead";
{ };
File = "ballgreen_7.png";
}; String STR_WARN_FORMACTION_PDFA_SHORT
Bitmap IMG_ERR {
{ Text [en-US] = "PDF/A form action";
File = "ballred_7.png"; };
};
String STR_WARN_FORMACTION_PDFA
String STR_WARN_TRANSP_PDFA_SHORT {
{ Text [en-US] = "A form control contained an action not supported by the PDF/A standard. The action was skipped";
Text [en-US] = "PDF/A transparency"; };
};
String STR_WARN_TRANSP_PDFA String STR_WARN_TRANSP_CONVERTED
{ {
Text [en-US] = "PDF/A forbids transparency. A transparent object was painted opaque instead."; Text [en-US] = "Some objects were converted to an image in order to remove transparencies, because the target PDF format does not support transparencies. Possibly better results can be achieved if you remove the transparent objects before exporting.";
}; };
String STR_WARN_TRANSP_VERSION_SHORT
{ String STR_WARN_TRANSP_CONVERTED_SHORT
Text [en-US] = "PDF version conflict"; {
}; Text [en-US] = "Transparencies removed";
String STR_WARN_TRANSP_VERSION };
{
Text [en-US] = "Transparency is not supported in PDF versions earlier than PDF 1.4. A transparent object was painted opaque instead"; Bitmap IMG_WARN
}; {
String STR_WARN_FORMACTION_PDFA_SHORT File = "ballgreen_7.png";
{ };
Text [en-US] = "PDF/A form action";
}; Bitmap IMG_ERR
String STR_WARN_FORMACTION_PDFA {
{ File = "ballred_7.png";
Text [en-US] = "A form control contained an action not supported by the PDF/A standard. The action was skipped";
};
String STR_WARN_TRANSP_CONVERTED
{
Text [en-US] = "Some objects were converted to an image in order to remove transparencies, because the target PDF format does not support transparencies. Possibly better results can be achieved if you remove the transparent objects before exporting.";
};
String STR_WARN_TRANSP_CONVERTED_SHORT
{
Text [en-US] = "Transparencies removed";
};
}; };
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.16.1 -->
<interface>
<requires lib="gtk+" version="3.6"/>
<object class="GtkMessageDialog" id="WarnPDFDialog">
<property name="can_focus">False</property>
<property name="border_width">12</property>
<property name="type">popup</property>
<property name="title" translatable="yes">Problems during PDF export</property>
<property name="resizable">False</property>
<property name="type_hint">dialog</property>
<property name="skip_taskbar_hint">True</property>
<property name="message_type">warning</property>
<property name="buttons">ok</property>
<property name="text" translatable="yes">During PDF export the following problems occurred:</property>
<child internal-child="vbox">
<object class="GtkBox" id="messagedialog-vbox">
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="orientation">vertical</property>
<property name="spacing">24</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="messagedialog-action_area">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="column_spacing">12</property>
<property name="column_homogeneous">True</property>
<child>
<object class="GtkLabel" id="message">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="wrap">True</property>
<property name="width_chars">30</property>
<property name="max_width_chars">30</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkTreeView" id="errors:border">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection1"/>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
</object>
</interface>
...@@ -2208,6 +2208,7 @@ bool MessageDialog::set_property(const OString &rKey, const OString &rValue) ...@@ -2208,6 +2208,7 @@ bool MessageDialog::set_property(const OString &rKey, const OString &rValue)
} }
else if (rKey == "buttons") else if (rKey == "buttons")
{ {
fprintf(stderr, "vcl.layout buttons type mode %s", rValue.getStr());
VclButtonsType eMode = VCL_BUTTONS_NONE; VclButtonsType eMode = VCL_BUTTONS_NONE;
if (rValue.equals("none")) if (rValue.equals("none"))
eMode = VCL_BUTTONS_NONE; eMode = VCL_BUTTONS_NONE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment