summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Specht <oliver.specht@cib.de>2016-05-13 16:26:42 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-05-20 07:27:38 +0000
commit247e418485c276bb9e8dcb84a6e11b90191482a3 (patch)
tree12d91c23091a04935457418ef16a1b4aa98474fd
parentdebbf41208d1fabf7ede667fcafee285d7f22e14 (diff)
tdf#64748: added placeholder option to pdf export dialog in Writer
This patch introduces a setting 'Export placeholders' to File/Export as PDF. It works like the related printer setting. Change-Id: I3a11a4601b1244b57e55c9b73b58116d355e105c Reviewed-on: https://gerrit.libreoffice.org/24976 Reviewed-by: Oliver Specht <oliver.specht@cib.de> Tested-by: Oliver Specht <oliver.specht@cib.de> Reviewed-on: https://gerrit.libreoffice.org/25053 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r--filter/source/pdf/impdialog.cxx14
-rw-r--r--filter/source/pdf/impdialog.hxx2
-rw-r--r--filter/source/pdf/pdfexport.cxx6
-rw-r--r--filter/source/pdf/pdfexport.hxx1
-rw-r--r--filter/source/pdf/pdffilter.cxx1
-rw-r--r--filter/uiconfig/ui/pdfgeneralpage.ui25
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/Common.xcs6
-rw-r--r--sw/inc/printdata.hxx2
-rw-r--r--sw/inc/unotxdoc.hxx2
-rw-r--r--sw/source/core/view/printdata.cxx4
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx20
11 files changed, 69 insertions, 14 deletions
diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx
index 1fe1474e9ca7..f1c86a8a5ec0 100644
--- a/filter/source/pdf/impdialog.cxx
+++ b/filter/source/pdf/impdialog.cxx
@@ -86,6 +86,7 @@ ImpPDFTabDialog::ImpPDFTabDialog(vcl::Window* pParent, Sequence< PropertyValue >
mbExportNotesPages( false ),
mbUseTransitionEffects( false ),
mbIsSkipEmptyPages( true ),
+ mbIsExportPlaceholders( false ),
mbAddStream( false ),
mnFormsType( 0 ),
mbExportFormFields( true ),
@@ -201,6 +202,7 @@ ImpPDFTabDialog::ImpPDFTabDialog(vcl::Window* pParent, Sequence< PropertyValue >
mnOpenBookmarkLevels = maConfigItem.ReadInt32( "OpenBookmarkLevels", -1 );
mbUseTransitionEffects = maConfigItem.ReadBool( "UseTransitionEffects", true );
mbIsSkipEmptyPages = maConfigItem.ReadBool( "IsSkipEmptyPages", false );
+ mbIsExportPlaceholders = maConfigItem.ReadBool( "ExportPlaceholders", false );
mbAddStream = maConfigItem.ReadBool( "IsAddStream", false );
mnFormsType = maConfigItem.ReadInt32( "FormsType", 0 );
@@ -401,6 +403,7 @@ Sequence< PropertyValue > ImpPDFTabDialog::GetFilterData()
maConfigItem.WriteBool( "ExportHiddenSlides", mbExportHiddenSlides );
maConfigItem.WriteBool( "UseTransitionEffects", mbUseTransitionEffects );
maConfigItem.WriteBool( "IsSkipEmptyPages", mbIsSkipEmptyPages );
+ maConfigItem.WriteBool( "ExportPlaceholders", mbIsExportPlaceholders );
maConfigItem.WriteBool( "IsAddStream", mbAddStream );
/*
@@ -541,6 +544,7 @@ ImpPDFTabGeneralPage::ImpPDFTabGeneralPage(vcl::Window* pParent, const SfxItemSe
get(mpCbExportNotes, "comments");
get(mpCbExportNotesPages, "notes");
get(mpCbExportEmptyPages, "emptypages");
+ get(mpCbExportPlaceholders, "exportplaceholders" );
get(mpCbViewPDF, "viewpdf");
get(mpCbWatermark, "watermark");
@@ -578,6 +582,7 @@ void ImpPDFTabGeneralPage::dispose()
mpCbViewPDF.clear();
mpCbExportNotesPages.clear();
mpCbExportEmptyPages.clear();
+ mpCbExportPlaceholders.clear();
mpCbAddStream.clear();
mpCbWatermark.clear();
mpFtWatermark.clear();
@@ -601,6 +606,7 @@ void ImpPDFTabGeneralPage::SetFilterConfigItem( ImpPDFTabDialog* paParent )
mbIsWriter = paParent->mbIsWriter;
mpCbExportEmptyPages->Enable( mbIsWriter );
+ mpCbExportPlaceholders->Enable( mbIsWriter );
mpRbLosslessCompression->SetToggleHdl( LINK( this, ImpPDFTabGeneralPage, ToggleCompressionHdl ) );
const bool bUseLosslessCompression = paParent->mbUseLosslessCompression;
@@ -668,8 +674,13 @@ void ImpPDFTabGeneralPage::SetFilterConfigItem( ImpPDFTabDialog* paParent )
mpCbExportHiddenSlides->Show(false);
mpCbExportHiddenSlides->Check(false);
}
-
+ mpCbExportPlaceholders->Show(mbIsWriter);
+ if( !mbIsWriter )
+ {
+ mpCbExportPlaceholders->Check(false);
+ }
mpCbExportEmptyPages->Check(!paParent->mbIsSkipEmptyPages);
+ mpCbExportPlaceholders->Check(paParent->mbIsExportPlaceholders);
mpCbAddStream->Show();
mpCbAddStream->Check(paParent->mbAddStream);
@@ -696,6 +707,7 @@ void ImpPDFTabGeneralPage::GetFilterConfigItem( ImpPDFTabDialog* paParent )
paParent->mbExportHiddenSlides = mpCbExportHiddenSlides->IsChecked();
paParent->mbIsSkipEmptyPages = !mpCbExportEmptyPages->IsChecked();
+ paParent->mbIsExportPlaceholders = mpCbExportPlaceholders->IsChecked();
paParent->mbAddStream = mpCbAddStream->IsVisible() && mpCbAddStream->IsChecked();
paParent->mbIsRangeChecked = false;
diff --git a/filter/source/pdf/impdialog.hxx b/filter/source/pdf/impdialog.hxx
index f4d916ec92de..72938b0718ee 100644
--- a/filter/source/pdf/impdialog.hxx
+++ b/filter/source/pdf/impdialog.hxx
@@ -106,6 +106,7 @@ protected:
bool mbExportNotesPages;
bool mbUseTransitionEffects;
bool mbIsSkipEmptyPages;
+ bool mbIsExportPlaceholders;
bool mbAddStream;
sal_Int32 mnFormsType;
bool mbExportFormFields;
@@ -220,6 +221,7 @@ class ImpPDFTabGeneralPage : public SfxTabPage
VclPtr<CheckBox> mpCbExportNotesPages;
VclPtr<CheckBox> mpCbExportEmptyPages;
+ VclPtr<CheckBox> mpCbExportPlaceholders;
VclPtr<CheckBox> mpCbAddStream;
VclPtr<CheckBox> mpCbWatermark;
diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx
index 5a6704165d2a..a55bdc943b78 100644
--- a/filter/source/pdf/pdfexport.cxx
+++ b/filter/source/pdf/pdfexport.cxx
@@ -553,6 +553,8 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
rFilterData[ nData ].Value >>= maSignCertificate;
else if ( rFilterData[ nData ].Name == "SignatureTSA" )
rFilterData[ nData ].Value >>= msSignTSA;
+ else if ( rFilterData[ nData ].Name == "ExportPlaceholders" )
+ rFilterData[ nData ].Value >>= mbExportPlaceholders;
}
aContext.URL = aURL.GetMainURL(INetURLObject::DECODE_TO_IURI);
@@ -820,7 +822,7 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
pPDFExtOutDevData->SetIsReduceImageResolution( mbReduceImageResolution );
pPDFExtOutDevData->SetIsExportNamedDestinations( mbExportBmkToDest );
- Sequence< PropertyValue > aRenderOptions( 6 );
+ Sequence< PropertyValue > aRenderOptions( 7 );
aRenderOptions[ 0 ].Name = "RenderDevice";
aRenderOptions[ 0 ].Value <<= Reference< awt::XDevice >( pXDevice );
aRenderOptions[ 1 ].Name = "ExportNotesPages";
@@ -834,6 +836,8 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
aRenderOptions[ 4 ].Value <<= mbSkipEmptyPages;
aRenderOptions[ 5 ].Name = "PageRange";
aRenderOptions[ 5 ].Value <<= aPageRange;
+ aRenderOptions[ 6 ].Name = "ExportPlaceholders";
+ aRenderOptions[ 6 ].Value <<= mbExportPlaceholders;
if( !aPageRange.isEmpty() || !aSelection.hasValue() )
{
diff --git a/filter/source/pdf/pdfexport.hxx b/filter/source/pdf/pdfexport.hxx
index 75ac0aa4e776..7e8528f34c60 100644
--- a/filter/source/pdf/pdfexport.hxx
+++ b/filter/source/pdf/pdfexport.hxx
@@ -47,6 +47,7 @@ private:
bool mbUseTaggedPDF;
sal_Int32 mnPDFTypeSelection;
bool mbExportNotes;
+ bool mbExportPlaceholders;
bool mbViewPDF;
bool mbExportNotesPages;
bool mbUseTransitionEffects;
diff --git a/filter/source/pdf/pdffilter.cxx b/filter/source/pdf/pdffilter.cxx
index 6d24356ff934..7104ad9cfde4 100644
--- a/filter/source/pdf/pdffilter.cxx
+++ b/filter/source/pdf/pdffilter.cxx
@@ -70,6 +70,7 @@ bool PDFFilter::implExport( const Sequence< PropertyValue >& rDescriptor )
aCfgItem.ReadBool( "UseTaggedPDF", false );
aCfgItem.ReadInt32( "SelectPdfVersion", 0 );
aCfgItem.ReadBool( "ExportNotes", false );
+ aCfgItem.ReadBool( "ExportPlaceholders", false );
aCfgItem.ReadBool( "ExportNotesPages", false );
aCfgItem.ReadBool( "UseTransitionEffects", true );
aCfgItem.ReadBool( "IsSkipEmptyPages", false );
diff --git a/filter/uiconfig/ui/pdfgeneralpage.ui b/filter/uiconfig/ui/pdfgeneralpage.ui
index 7ba4a250dd4a..8a46e0fcb5e7 100644
--- a/filter/uiconfig/ui/pdfgeneralpage.ui
+++ b/filter/uiconfig/ui/pdfgeneralpage.ui
@@ -578,8 +578,8 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="comments">
- <property name="label" translatable="yes">_Export comments</property>
+ <object class="GtkCheckButton" id="exportplaceholders">
+ <property name="label" translatable="yes">Expo_rt placeholders</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -593,6 +593,21 @@
</packing>
</child>
<child>
+ <object class="GtkCheckButton" id="comments">
+ <property name="label" translatable="yes">_Export comments</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">7</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkCheckButton" id="emptypages">
<property name="label" translatable="yes">Exp_ort automatically inserted blank pages</property>
<property name="visible">True</property>
@@ -604,7 +619,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">9</property>
+ <property name="top_attach">10</property>
</packing>
</child>
<child>
@@ -619,7 +634,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">10</property>
+ <property name="top_attach">11</property>
</packing>
</child>
<child>
@@ -649,7 +664,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">7</property>
+ <property name="top_attach">8</property>
</packing>
</child>
</object>
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index ed958b8a4def..8662cfc72810 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -5121,6 +5121,12 @@
</info>
<value>true</value>
</prop>
+ <prop oor:name="ExportPlaceholders" oor:type="xs:boolean" oor:nillable="false">
+ <info>
+ <desc>Specifies if placeholder fields are exported to PDF.</desc>
+ </info>
+ <value>true</value>
+ </prop>
<prop oor:name="OpenBookmarkLevels" oor:type="xs:int" oor:nillable="false">
<info>
<desc>Specifies how many bookmark levels should be opened in the
diff --git a/sw/inc/printdata.hxx b/sw/inc/printdata.hxx
index 52710893ffdc..6651090b04fc 100644
--- a/sw/inc/printdata.hxx
+++ b/sw/inc/printdata.hxx
@@ -261,7 +261,7 @@ public:
bool IsViewOptionAdjust() const { return m_pViewOptionAdjust != nullptr; }
bool NeedNewViewOptionAdjust( const SwViewShell& ) const;
void ViewOptionAdjustStart( SwViewShell &rSh, const SwViewOption &rViewOptions);
- void ViewOptionAdjust( SwPrintData const* const pPrtOptions );
+ void ViewOptionAdjust( SwPrintData const* const pPrtOptions, bool setShowPlaceHoldersInPDF );
void ViewOptionAdjustStop();
void ViewOptionAdjustCrashPreventionKludge();
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index 87386bbd193a..9435920efd38 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -607,7 +607,7 @@ class SwViewOptionAdjust_Impl
public:
SwViewOptionAdjust_Impl( SwViewShell& rSh, const SwViewOption &rViewOptions );
~SwViewOptionAdjust_Impl();
- void AdjustViewOptions( SwPrintData const* const pPrtOptions );
+ void AdjustViewOptions( SwPrintData const* const pPrtOptions, bool setShowPlaceHoldersInPDF );
bool checkShell( const SwViewShell& rCompare ) const
{ return &rCompare == m_pShell; }
void DontTouchThatViewShellItSmellsFunny() { m_pShell = nullptr; }
diff --git a/sw/source/core/view/printdata.cxx b/sw/source/core/view/printdata.cxx
index 009d8e40016b..7d335262d1cd 100644
--- a/sw/source/core/view/printdata.cxx
+++ b/sw/source/core/view/printdata.cxx
@@ -93,9 +93,9 @@ void SwRenderData::ViewOptionAdjustStart(
new SwViewOptionAdjust_Impl( rSh, rViewOptions ));
}
-void SwRenderData::ViewOptionAdjust(SwPrintData const*const pPrtOptions)
+void SwRenderData::ViewOptionAdjust(SwPrintData const*const pPrtOptions, bool setShowPlaceHoldersInPDF)
{
- m_pViewOptionAdjust->AdjustViewOptions( pPrtOptions );
+ m_pViewOptionAdjust->AdjustViewOptions( pPrtOptions, setShowPlaceHoldersInPDF );
}
void SwRenderData::ViewOptionAdjustStop()
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index d9432d6b5391..d08766ad3791 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -2545,7 +2545,21 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount(
// PDF export should not make use of the SwPrtOptions
const SwPrintData *pPrtOptions = (bIsPDFExport)
? nullptr : m_pRenderData->GetSwPrtOptions();
- m_pRenderData->ViewOptionAdjust( pPrtOptions );
+ bool setShowPlaceHoldersInPDF = false;
+ if(bIsPDFExport)
+ {
+ const sal_Int32 nLen = rxOptions.getLength();
+ const beans::PropertyValue *pProps = rxOptions.getConstArray();
+ for (sal_Int32 i = 0; i < nLen; ++i)
+ {
+ if (pProps[i].Name.equalsAscii( "ExportPlaceholders" ))
+ {
+ pProps[i].Value >>= setShowPlaceHoldersInPDF;
+ break;
+ }
+ }
+ }
+ m_pRenderData->ViewOptionAdjust( pPrtOptions, setShowPlaceHoldersInPDF );
}
// since printing now also use the API for PDF export this option
@@ -4248,7 +4262,7 @@ SwViewOptionAdjust_Impl::~SwViewOptionAdjust_Impl()
}
void
-SwViewOptionAdjust_Impl::AdjustViewOptions(SwPrintData const*const pPrtOptions)
+SwViewOptionAdjust_Impl::AdjustViewOptions(SwPrintData const*const pPrtOptions, bool setShowPlaceHoldersInPDF)
{
// to avoid unnecessary reformatting the view options related to the content
// below should only change if necessary, that is if respective content is present
@@ -4285,7 +4299,7 @@ SwViewOptionAdjust_Impl::AdjustViewOptions(SwPrintData const*const pPrtOptions)
if (bContainsPlaceHolders)
{
// should always be printed in PDF export!
- bVal = !pPrtOptions || pPrtOptions->m_bPrintTextPlaceholder;
+ bVal = !pPrtOptions ? setShowPlaceHoldersInPDF : pPrtOptions->m_bPrintTextPlaceholder;
aRenderViewOptions.SetShowPlaceHolderFields( bVal );
}