diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2016-02-09 09:21:53 +1100 |
---|---|---|
committer | Chris Sherlock <chris.sherlock79@gmail.com> | 2016-02-09 08:11:34 +0000 |
commit | 538f276ae0414ea34ede6090b5f56e8fecd6fc65 (patch) | |
tree | efbfb952f3236a6f56540ddae6a896c8c73774a0 /filter | |
parent | f12e483589888f87843026ceff5ae3c1e615ca02 (diff) |
Formatting changes across all modules
+ Removed comment cruft
+ Tab formatting in number of files
+ Some commented out code removed
+ Tab characters replaced with spaces
+ Newline cleanup in quite a few files
+ Tweak header guard #endifs
Change-Id: I3208ff2f047da890edcc49b73389aca22442f5fc
Reviewed-on: https://gerrit.libreoffice.org/22221
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
Diffstat (limited to 'filter')
27 files changed, 730 insertions, 875 deletions
diff --git a/filter/source/flash/impswfdialog.cxx b/filter/source/flash/impswfdialog.cxx index 120bdcd030b4..3bca31968594 100644 --- a/filter/source/flash/impswfdialog.cxx +++ b/filter/source/flash/impswfdialog.cxx @@ -24,10 +24,6 @@ using namespace com::sun::star::uno; using namespace com::sun::star::beans; - -// - ImpPDFDialog - - - ImpSWFDialog::ImpSWFDialog( vcl::Window* pParent, Sequence< PropertyValue >& rFilterData ) : ModalDialog( pParent, "ImpSWFDialog", "filter/ui/impswfdialog.ui" ), @@ -57,12 +53,12 @@ ImpSWFDialog::ImpSWFDialog( vcl::Window* pParent, Sequence< PropertyValue >& rFi } - ImpSWFDialog::~ImpSWFDialog() { disposeOnce(); } + void ImpSWFDialog::dispose() { mpNumFldQuality.clear(); @@ -95,7 +91,8 @@ Sequence< PropertyValue > ImpSWFDialog::GetFilterData() return aRet; } -// AS: This is called whenever the user toggles one of the checkboxes + +/// This is called whenever the user toggles one of the checkboxes IMPL_LINK_TYPED( ImpSWFDialog, OnToggleCheckbox, CheckBox&, rBox, void ) { if (&rBox == mpCheckExportAll) diff --git a/filter/source/flash/impswfdialog.hxx b/filter/source/flash/impswfdialog.hxx index d21e2a384639..3cef0c180e0a 100644 --- a/filter/source/flash/impswfdialog.hxx +++ b/filter/source/flash/impswfdialog.hxx @@ -32,12 +32,10 @@ #include <vcl/FilterConfigItem.hxx> -// - ImpSWFDialog - - - class ResMgr; namespace vcl { class Window; } + class ImpSWFDialog : public ModalDialog { private: diff --git a/filter/source/flash/swfdialog.cxx b/filter/source/flash/swfdialog.cxx index 5d8f26914288..e15f3308b3c3 100644 --- a/filter/source/flash/swfdialog.cxx +++ b/filter/source/flash/swfdialog.cxx @@ -38,20 +38,16 @@ using namespace ::com::sun::star::frame; using namespace ::com::sun::star::view; using namespace ::com::sun::star::document; - -// - PDFDialog functions - - - #define SERVICE_NAME "com.sun.star.Impress.FlashExportDialog" - OUString SWFDialog_getImplementationName () throw (RuntimeException) { return OUString ( SERVICE_NAME ); } + Sequence< OUString > SAL_CALL SWFDialog_getSupportedServiceNames() throw (RuntimeException) { @@ -60,34 +56,25 @@ Sequence< OUString > SAL_CALL SWFDialog_getSupportedServiceNames() } - Reference< XInterface > SAL_CALL SWFDialog_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw( Exception ) { return static_cast<cppu::OWeakObject*>(new SWFDialog( comphelper::getComponentContext(rSMgr) )); } - - #undef SERVICE_NAME - -// - SWFDialog - - - SWFDialog::SWFDialog( const Reference< XComponentContext> &rxContext ) : OGenericUnoDialog( rxContext ) { } - SWFDialog::~SWFDialog() { } - Any SAL_CALL SWFDialog::queryInterface( const Type& rType ) throw (RuntimeException, std::exception) { @@ -102,7 +89,6 @@ Any SAL_CALL SWFDialog::queryInterface( const Type& rType ) } - void SAL_CALL SWFDialog::acquire() throw () { @@ -110,7 +96,6 @@ void SAL_CALL SWFDialog::acquire() } - void SAL_CALL SWFDialog::release() throw () { @@ -118,7 +103,6 @@ void SAL_CALL SWFDialog::release() } - Sequence< sal_Int8 > SAL_CALL SWFDialog::getImplementationId() throw(RuntimeException, std::exception) { @@ -126,7 +110,6 @@ Sequence< sal_Int8 > SAL_CALL SWFDialog::getImplementationId() } - OUString SAL_CALL SWFDialog::getImplementationName() throw (RuntimeException, std::exception) { @@ -134,7 +117,6 @@ OUString SAL_CALL SWFDialog::getImplementationName() } - Sequence< OUString > SAL_CALL SWFDialog::getSupportedServiceNames() throw (RuntimeException, std::exception) { @@ -142,7 +124,6 @@ Sequence< OUString > SAL_CALL SWFDialog::getSupportedServiceNames() } - VclPtr<Dialog> SWFDialog::createDialog( vcl::Window* pParent ) { VclPtr<Dialog> pRet; @@ -176,7 +157,6 @@ VclPtr<Dialog> SWFDialog::createDialog( vcl::Window* pParent ) } - void SWFDialog::executedDialog( sal_Int16 nExecutionResult ) { if( nExecutionResult && m_pDialog ) @@ -186,7 +166,6 @@ void SWFDialog::executedDialog( sal_Int16 nExecutionResult ) } - Reference< XPropertySetInfo > SAL_CALL SWFDialog::getPropertySetInfo() throw(RuntimeException, std::exception) { @@ -209,7 +188,6 @@ Reference< XPropertySetInfo > SAL_CALL SWFDialog::getPropertySetInfo() } - Sequence< PropertyValue > SAL_CALL SWFDialog::getPropertyValues() throw ( RuntimeException, std::exception ) { @@ -231,7 +209,6 @@ Sequence< PropertyValue > SAL_CALL SWFDialog::getPropertyValues() } - void SAL_CALL SWFDialog::setPropertyValues( const Sequence< PropertyValue >& rProps ) throw ( UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException, std::exception ) { @@ -248,7 +225,6 @@ void SAL_CALL SWFDialog::setPropertyValues( const Sequence< PropertyValue >& rPr } - void SAL_CALL SWFDialog::setSourceDocument( const Reference< XComponent >& xDoc ) throw(IllegalArgumentException, RuntimeException, std::exception) { diff --git a/filter/source/flash/swfdialog.hxx b/filter/source/flash/swfdialog.hxx index 6d6cb84d01ca..50034d5a9369 100644 --- a/filter/source/flash/swfdialog.hxx +++ b/filter/source/flash/swfdialog.hxx @@ -26,12 +26,10 @@ #include <svtools/genericunodialog.hxx> -// - SWFDialog - - - namespace vcl { class Window; } class ResMgr; + class SWFDialog : public ::svt::OGenericUnoDialog, public ::comphelper::OPropertyArrayUsageHelper< SWFDialog >, public css::beans::XPropertyAccess, @@ -76,7 +74,6 @@ public: }; - -#endif // SWFDialog_HXX +#endif // INCLUDED_FILTER_SOURCE_FLASH_SWFDIALOG_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/graphicfilter/egif/egif.cxx b/filter/source/graphicfilter/egif/egif.cxx index 51f47babab4f..3ba9ff0d8874 100644 --- a/filter/source/graphicfilter/egif/egif.cxx +++ b/filter/source/graphicfilter/egif/egif.cxx @@ -28,17 +28,15 @@ #include "giflzwc.hxx" #include <memory> -// - GIFWriter - - class GIFWriter { Bitmap aAccBmp; SvStream& m_rGIF; BitmapReadAccess* m_pAcc; - sal_uLong nMinPercent; - sal_uLong nMaxPercent; - sal_uLong nLastPercent; + sal_uLong nMinPercent; + sal_uLong nMaxPercent; + sal_uLong nLastPercent; long nActX; long nActY; sal_Int32 nInterlaced; @@ -73,6 +71,7 @@ public: bool WriteGIF( const Graphic& rGraphic, FilterConfigItem* pConfigItem ); }; + GIFWriter::GIFWriter(SvStream &rStream) : m_rGIF(rStream) , m_pAcc(nullptr) @@ -88,7 +87,6 @@ GIFWriter::GIFWriter(SvStream &rStream) } - bool GIFWriter::WriteGIF(const Graphic& rGraphic, FilterConfigItem* pFilterConfigItem) { if ( pFilterConfigItem ) @@ -177,7 +175,6 @@ bool GIFWriter::WriteGIF(const Graphic& rGraphic, FilterConfigItem* pFilterConfi } - void GIFWriter::WriteBitmapEx( const BitmapEx& rBmpEx, const Point& rPoint, bool bExtended, long nTimer, Disposal eDisposal ) { @@ -207,7 +204,6 @@ void GIFWriter::WriteBitmapEx( const BitmapEx& rBmpEx, const Point& rPoint, } - void GIFWriter::WriteAnimation( const Animation& rAnimation ) { const sal_uInt16 nCount = rAnimation.Count(); @@ -232,7 +228,6 @@ void GIFWriter::WriteAnimation( const Animation& rAnimation ) } - void GIFWriter::MayCallback( sal_uLong nPercent ) { if ( xStatusIndicator.is() ) @@ -247,7 +242,6 @@ void GIFWriter::MayCallback( sal_uLong nPercent ) } - bool GIFWriter::CreateAccess( const BitmapEx& rBmpEx ) { if( bStatus ) @@ -281,7 +275,6 @@ bool GIFWriter::CreateAccess( const BitmapEx& rBmpEx ) } - void GIFWriter::DestroyAccess() { Bitmap::ReleaseAccess( m_pAcc ); @@ -289,7 +282,6 @@ void GIFWriter::DestroyAccess() } - void GIFWriter::WriteSignature( bool bGIF89a ) { if( bStatus ) @@ -302,7 +294,6 @@ void GIFWriter::WriteSignature( bool bGIF89a ) } - void GIFWriter::WriteGlobalHeader( const Size& rSize ) { if( bStatus ) @@ -332,7 +323,6 @@ void GIFWriter::WriteGlobalHeader( const Size& rSize ) } - void GIFWriter::WriteLoopExtension( const Animation& rAnimation ) { DBG_ASSERT( rAnimation.Count() > 0, "Animation has no bitmaps!" ); @@ -365,7 +355,6 @@ void GIFWriter::WriteLoopExtension( const Animation& rAnimation ) } - void GIFWriter::WriteLogSizeExtension( const Size& rSize100 ) { // writer PrefSize in 100th-mm as ApplicationExtension @@ -384,7 +373,6 @@ void GIFWriter::WriteLogSizeExtension( const Size& rSize100 ) } - void GIFWriter::WriteImageExtension( long nTimer, Disposal eDisposal ) { if( bStatus ) @@ -416,7 +404,6 @@ void GIFWriter::WriteImageExtension( long nTimer, Disposal eDisposal ) } - void GIFWriter::WriteLocalHeader() { if( bStatus ) @@ -448,7 +435,6 @@ void GIFWriter::WriteLocalHeader() } - void GIFWriter::WritePalette() { if( bStatus && m_pAcc->HasPalette() ) @@ -475,7 +461,6 @@ void GIFWriter::WritePalette() } - void GIFWriter::WriteAccess() { GIFLZWCompressor aCompressor; @@ -548,7 +533,6 @@ void GIFWriter::WriteAccess() } - void GIFWriter::WriteTerminator() { if( bStatus ) @@ -568,7 +552,4 @@ egiGraphicExport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfi return aWriter.WriteGIF(rGraphic, pConfigItem); } - - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/graphicfilter/egif/giflzwc.cxx b/filter/source/graphicfilter/egif/giflzwc.cxx index d74fa0db4bfc..7f5709a5ad62 100644 --- a/filter/source/graphicfilter/egif/giflzwc.cxx +++ b/filter/source/graphicfilter/egif/giflzwc.cxx @@ -22,9 +22,6 @@ #include "giflzwc.hxx" -// - GIFImageDataOutputStream - - - class GIFImageDataOutputStream { private: @@ -47,7 +44,6 @@ public: }; - inline void GIFImageDataOutputStream::FlushBitsBufsFullBytes() { while (nBitsBufSize>=8) @@ -62,7 +58,6 @@ inline void GIFImageDataOutputStream::FlushBitsBufsFullBytes() } - inline void GIFImageDataOutputStream::WriteBits( sal_uInt16 nCode, sal_uInt16 nCodeLen ) { if( nBitsBufSize+nCodeLen>32 ) @@ -73,7 +68,6 @@ inline void GIFImageDataOutputStream::WriteBits( sal_uInt16 nCode, sal_uInt16 nC } - GIFImageDataOutputStream::GIFImageDataOutputStream( SvStream & rGIF, sal_uInt8 nLZWDataSize ) : rStream(rGIF) { @@ -85,8 +79,6 @@ GIFImageDataOutputStream::GIFImageDataOutputStream( SvStream & rGIF, sal_uInt8 n } - - GIFImageDataOutputStream::~GIFImageDataOutputStream() { WriteBits(0,7); @@ -97,7 +89,6 @@ GIFImageDataOutputStream::~GIFImageDataOutputStream() } - void GIFImageDataOutputStream::FlushBlockBuf() { if( nBlockBufSize ) @@ -109,22 +100,16 @@ void GIFImageDataOutputStream::FlushBlockBuf() } -// - GIFLZWCTreeNode - - - struct GIFLZWCTreeNode { GIFLZWCTreeNode* pBrother; // next node which has the same father GIFLZWCTreeNode* pFirstChild; // first - sal_uInt16 nCode; // the code for the string of pixel values which comes about - sal_uInt16 nValue; // the pixel value + sal_uInt16 nCode; // the code for the string of pixel values which comes about + sal_uInt16 nValue; // the pixel value }; -// - GIFLZWCompressor - - - GIFLZWCompressor::GIFLZWCompressor() : pIDOS(nullptr), pTable(nullptr), pPrefix(nullptr), nDataSize(0), nClearCode(0), nEOICode(0), nTableSize(0), nCodeSize(0) @@ -132,14 +117,12 @@ GIFLZWCompressor::GIFLZWCompressor() } - GIFLZWCompressor::~GIFLZWCompressor() { if (pIDOS!=nullptr) EndCompression(); } - void GIFLZWCompressor::StartCompression( SvStream& rGIF, sal_uInt16 nPixelSize ) { if( !pIDOS ) @@ -171,14 +154,13 @@ void GIFLZWCompressor::StartCompression( SvStream& rGIF, sal_uInt16 nPixelSize ) } - void GIFLZWCompressor::Compress( sal_uInt8* pSrc, sal_uLong nSize ) { if( pIDOS ) { - GIFLZWCTreeNode* p; - sal_uInt16 i; - sal_uInt8 nV; + GIFLZWCTreeNode* p; + sal_uInt16 i; + sal_uInt8 nV; if( !pPrefix && nSize ) { @@ -231,7 +213,6 @@ void GIFLZWCompressor::Compress( sal_uInt8* pSrc, sal_uLong nSize ) } - void GIFLZWCompressor::EndCompression() { if( pIDOS ) diff --git a/filter/source/graphicfilter/egif/giflzwc.hxx b/filter/source/graphicfilter/egif/giflzwc.hxx index bfe9784803d3..1d0f1e21d3bc 100644 --- a/filter/source/graphicfilter/egif/giflzwc.hxx +++ b/filter/source/graphicfilter/egif/giflzwc.hxx @@ -23,12 +23,10 @@ #include <vcl/bitmapaccess.hxx> -// - GIFLZWCompressor - - - class GIFImageDataOutputStream; struct GIFLZWCTreeNode; + class GIFLZWCompressor { private: diff --git a/filter/source/graphicfilter/etiff/etiff.cxx b/filter/source/graphicfilter/etiff/etiff.cxx index 4bf1b2d1ae01..4214f0d7a8aa 100644 --- a/filter/source/graphicfilter/etiff/etiff.cxx +++ b/filter/source/graphicfilter/etiff/etiff.cxx @@ -43,9 +43,6 @@ #define ColorMap 320 -// - TIFFWriter - - - struct TIFFLZWCTreeNode { @@ -55,6 +52,7 @@ struct TIFFLZWCTreeNode sal_uInt16 nValue; // pixel value }; + class TIFFWriter { private: @@ -62,7 +60,7 @@ private: SvStream& m_rOStm; sal_uInt32 mnStreamOfs; - bool mbStatus; + bool mbStatus; BitmapReadAccess* mpAcc; sal_uInt32 mnWidth, mnHeight, mnColors; @@ -107,14 +105,13 @@ private: public: - explicit TIFFWriter(SvStream &rStream); - ~TIFFWriter(); + explicit TIFFWriter(SvStream &rStream); + ~TIFFWriter(); bool WriteTIFF( const Graphic& rGraphic, FilterConfigItem* pFilterConfigItem ); }; - TIFFWriter::TIFFWriter(SvStream &rStream) : m_rOStm(rStream) , mnStreamOfs(0) @@ -147,10 +144,12 @@ TIFFWriter::TIFFWriter(SvStream &rStream) { } + TIFFWriter::~TIFFWriter() { } + bool TIFFWriter::WriteTIFF( const Graphic& rGraphic, FilterConfigItem* pFilterConfigItem) { if ( pFilterConfigItem ) @@ -239,7 +238,6 @@ bool TIFFWriter::WriteTIFF( const Graphic& rGraphic, FilterConfigItem* pFilterCo } - void TIFFWriter::ImplCallback( sal_uInt32 nPercent ) { if ( xStatusIndicator.is() ) @@ -254,8 +252,6 @@ void TIFFWriter::ImplCallback( sal_uInt32 nPercent ) } - - bool TIFFWriter::ImplWriteHeader( bool bMultiPage ) { mnTagCount = 0; @@ -302,7 +298,7 @@ bool TIFFWriter::ImplWriteHeader( bool bMultiPage ) mnBitmapPos = m_rOStm.Tell(); ImplWriteTag( StripOffsets, 4, 1, 0 ); ImplWriteTag( SamplesPerPixel, 3, 1, ( mnBitsPerPixel == 24 ) ? 3 : 1 ); - ImplWriteTag( RowsPerStrip, 4, 1, mnHeight ); //0xffffffff ); + ImplWriteTag( RowsPerStrip, 4, 1, mnHeight ); mnStripByteCountPos = m_rOStm.Tell(); ImplWriteTag( StripByteCounts, 4, 1, ( ( mnWidth * mnBitsPerPixel * mnHeight ) + 7 ) >> 3 ); mnXResPos = m_rOStm.Tell(); @@ -330,7 +326,6 @@ bool TIFFWriter::ImplWriteHeader( bool bMultiPage ) } - void TIFFWriter::ImplWritePalette() { sal_uInt16 i; @@ -357,7 +352,6 @@ void TIFFWriter::ImplWritePalette() } - void TIFFWriter::ImplWriteBody() { sal_uInt8 nTemp = 0; @@ -365,8 +359,8 @@ void TIFFWriter::ImplWriteBody() sal_uLong j, x, y; sal_uLong nGfxBegin = m_rOStm.Tell(); - m_rOStm.Seek( mnBitmapPos + 8 ); // the strip offset tag entry needs the offset - m_rOStm.WriteUInt32( nGfxBegin - mnStreamOfs ); // to the bitmap data + m_rOStm.Seek( mnBitmapPos + 8 ); // the strip offset tag entry needs the offset + m_rOStm.WriteUInt32( nGfxBegin - mnStreamOfs ); // to the bitmap data m_rOStm.Seek( nGfxBegin ); StartCompression(); @@ -464,7 +458,6 @@ void TIFFWriter::ImplWriteBody() } - void TIFFWriter::ImplWriteResolution( sal_uLong nStreamPos, sal_uInt32 nResolutionUnit ) { sal_uLong nCurrentPos = m_rOStm.Tell(); @@ -476,7 +469,6 @@ void TIFFWriter::ImplWriteResolution( sal_uLong nStreamPos, sal_uInt32 nResoluti } - void TIFFWriter::ImplWriteTag( sal_uInt16 nTagID, sal_uInt16 nDataType, sal_uInt32 nNumberOfItems, sal_uInt32 nValue) { mnTagCount++; @@ -490,7 +482,6 @@ void TIFFWriter::ImplWriteTag( sal_uInt16 nTagID, sal_uInt16 nDataType, sal_uInt } - inline void TIFFWriter::WriteBits( sal_uInt16 nCode, sal_uInt16 nCodeLen ) { dwShift |= ( nCode << ( nOffset - nCodeLen ) ); @@ -508,7 +499,6 @@ inline void TIFFWriter::WriteBits( sal_uInt16 nCode, sal_uInt16 nCodeLen ) } - void TIFFWriter::StartCompression() { sal_uInt16 i; @@ -535,7 +525,6 @@ void TIFFWriter::StartCompression() } - void TIFFWriter::Compress( sal_uInt8 nCompThis ) { TIFFLZWCTreeNode* p; @@ -589,7 +578,6 @@ void TIFFWriter::Compress( sal_uInt8 nCompThis ) } - void TIFFWriter::EndCompression() { if( pPrefix ) @@ -600,7 +588,6 @@ void TIFFWriter::EndCompression() } - extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL etiGraphicExport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pFilterConfigItem ) { diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx index 1fe1474e9ca7..fda658b6d978 100644 --- a/filter/source/pdf/impdialog.cxx +++ b/filter/source/pdf/impdialog.cxx @@ -49,17 +49,14 @@ PDFFilterResId::PDFFilterResId( sal_uInt32 nId ) : ResId( nId, getPDFFilterResMg } -// - ImpPDFDialog - - - using namespace ::com::sun::star; using namespace ::com::sun::star::uno; -// tabbed PDF dialog implementation -// please note: the default used here are the same as per specification, -// they should be the same in PDFFilter::implExport and in PDFExport::PDFExport - +/** Tabbed PDF dialog implementation + Please note: the default used here are the same as per specification, + They should be the same in PDFFilter::implExport and in PDFExport::PDFExport + */ ImpPDFTabDialog::ImpPDFTabDialog(vcl::Window* pParent, Sequence< PropertyValue >& rFilterData, const Reference< XComponent >& rxDoc) : SfxTabDialog(pParent, "PdfOptionsDialog","filter/ui/pdfoptionsdialog.ui"), @@ -125,9 +122,8 @@ ImpPDFTabDialog::ImpPDFTabDialog(vcl::Window* pParent, Sequence< PropertyValue > mbExportBmkToPDFDestination( false ), mbSignPDF( false ) - { -// check for selection + // check for selection try { Reference< frame::XController > xController( Reference< frame::XModel >( rxDoc, UNO_QUERY )->getCurrentController() ); @@ -164,7 +160,7 @@ ImpPDFTabDialog::ImpPDFTabDialog(vcl::Window* pParent, Sequence< PropertyValue > } } -// check if source document is a presentation + // check if source document is a presentation try { Reference< XServiceInfo > xInfo( rxDoc, UNO_QUERY ); @@ -180,7 +176,7 @@ ImpPDFTabDialog::ImpPDFTabDialog(vcl::Window* pParent, Sequence< PropertyValue > { } -//get the CTL (Complex Text Layout) from general options, returns sal_True if we have a CTL font on our hands. + // get the CTL (Complex Text Layout) from general options, returns sal_True if we have a CTL font on our hands. mbUseCTLFont = maConfigI18N.ReadBool( "CTLFont", false ); mbUseLosslessCompression = maConfigItem.ReadBool( "UseLosslessCompression", false ); @@ -209,7 +205,7 @@ ImpPDFTabDialog::ImpPDFTabDialog(vcl::Window* pParent, Sequence< PropertyValue > mnFormsType = 0; mbAllowDuplicateFieldNames = maConfigItem.ReadBool( "AllowDuplicateFieldNames", false ); -//prepare values for the Viewer tab page + // prepare values for the Viewer tab page mbHideViewerToolbar = maConfigItem.ReadBool( "HideViewerToolbar", false ); mbHideViewerMenubar = maConfigItem.ReadBool( "HideViewerMenubar", false ); mbHideViewerWindowControls = maConfigItem.ReadBool( "HideViewerWindowControls", false ); @@ -227,13 +223,13 @@ ImpPDFTabDialog::ImpPDFTabDialog(vcl::Window* pParent, Sequence< PropertyValue > if( mnInitialPage < 1 ) mnInitialPage = 1; -//prepare values for the security tab page + // prepare values for the security tab page mnPrint = maConfigItem.ReadInt32( "Printing", 2 ); mnChangesAllowed = maConfigItem.ReadInt32( "Changes", 4 ); mbCanCopyOrExtract = maConfigItem.ReadBool( "EnableCopyingOfContent", true ); mbCanExtractForAccessibility = maConfigItem.ReadBool( "EnableTextAccessForAccessibilityTools", true ); -//prepare values for relative links + // prepare values for relative links mbExportRelativeFsysLinks = maConfigItem.ReadBool( "ExportLinksRelativeFsys", false ); mnViewPDFMode = maConfigItem.ReadInt32( "PDFViewSelection", 0 ); @@ -241,24 +237,24 @@ ImpPDFTabDialog::ImpPDFTabDialog(vcl::Window* pParent, Sequence< PropertyValue > mbConvertOOoTargets = maConfigItem.ReadBool( "ConvertOOoTargetToPDFTarget", false ); mbExportBmkToPDFDestination = maConfigItem.ReadBool( "ExportBookmarksToPDFDestination", false ); -//prepare values for digital signatures + // prepare values for digital signatures mbSignPDF = maConfigItem.ReadBool( "SignPDF", false ); -//queue the tab pages for later creation (created when first shown) + // queue the tab pages for later creation (created when first shown) mnSigningPageId = AddTabPage("digitalsignatures", ImpPDFTabSigningPage::Create, nullptr); mnSecurityPageId = AddTabPage("security", ImpPDFTabSecurityPage::Create, nullptr); mnLinksPage = AddTabPage("links", ImpPDFTabLinksPage::Create, nullptr); mnInterfacePageId = AddTabPage("userinterface", ImpPDFTabViewerPage::Create, nullptr); mnViewPageId = AddTabPage("initialview", ImpPDFTabOpnFtrPage::Create, nullptr); - //last queued is the first to be displayed (or so it seems..) + // last queued is the first to be displayed (or so it seems..) mnGeneralPageId = AddTabPage("general", ImpPDFTabGeneralPage::Create, nullptr ); - //get the string property value (from sfx2/source/dialog/mailmodel.cxx) to overwrite the text for the Ok button + // get the string property value (from sfx2/source/dialog/mailmodel.cxx) to overwrite the text for the Ok button OUString sOkButtonText = maConfigItem.ReadString( "_OkButtonString", OUString() ); - //change text on the Ok button: get the relevant string from resources, update it on the button - //according to the exported pdf file destination: send as e-mail or write to file? + // change text on the Ok button: get the relevant string from resources, update it on the button + // according to the exported pdf file destination: send as e-mail or write to file? if (!sOkButtonText.isEmpty()) { GetOKButton().SetText(sOkButtonText); @@ -266,11 +262,12 @@ ImpPDFTabDialog::ImpPDFTabDialog(vcl::Window* pParent, Sequence< PropertyValue > GetCancelButton().SetClickHdl(LINK(this, ImpPDFTabDialog, CancelHdl)); -//remove the reset button, not needed in this tabbed dialog + // remove the reset button, not needed in this tabbed dialog RemoveResetButton(); } + ImpPDFTabSecurityPage* ImpPDFTabDialog::getSecurityPage() const { SfxTabPage* pSecurityPage = GetTabPage(mnSecurityPageId); @@ -281,6 +278,7 @@ ImpPDFTabSecurityPage* ImpPDFTabDialog::getSecurityPage() const return nullptr; } + ImpPDFTabLinksPage* ImpPDFTabDialog::getLinksPage() const { SfxTabPage* pLinksPage = GetTabPage(mnLinksPage); @@ -291,6 +289,7 @@ ImpPDFTabLinksPage* ImpPDFTabDialog::getLinksPage() const return nullptr; } + ImpPDFTabGeneralPage* ImpPDFTabDialog::getGeneralPage() const { SfxTabPage* pGeneralPage = GetTabPage(mnGeneralPageId); @@ -301,6 +300,7 @@ ImpPDFTabGeneralPage* ImpPDFTabDialog::getGeneralPage() const return nullptr; } + IMPL_LINK_NOARG_TYPED(ImpPDFTabDialog, CancelHdl, Button*, void) { EndDialog(); @@ -312,10 +312,11 @@ ImpPDFTabDialog::~ImpPDFTabDialog() disposeOnce(); } + void ImpPDFTabDialog::dispose() { -//delete the pages, needed because otherwise the child tab pages -//don't get destroyed + // delete the pages, needed because otherwise the child tab pages + // don't get destroyed RemoveTabPage(mnGeneralPageId); RemoveTabPage(mnInterfacePageId); RemoveTabPage(mnViewPageId); @@ -360,15 +361,15 @@ void ImpPDFTabDialog::PageCreated( sal_uInt16 _nId, short ImpPDFTabDialog::Ok( ) { -//here the whole mechanism of the base class is not used -//when Ok is hit, the user means 'convert to PDF', so simply close with ok + // here the whole mechanism of the base class is not used + // when Ok is hit, the user means 'convert to PDF', so simply close with ok return RET_OK; } Sequence< PropertyValue > ImpPDFTabDialog::GetFilterData() { -// updating the FilterData sequence and storing FilterData to configuration + // updating the FilterData sequence and storing FilterData to configuration if( GetTabPage(mnGeneralPageId) ) static_cast<ImpPDFTabGeneralPage*>( GetTabPage(mnGeneralPageId) )->GetFilterConfigItem( this ); if( GetTabPage(mnInterfacePageId) ) @@ -382,7 +383,7 @@ Sequence< PropertyValue > ImpPDFTabDialog::GetFilterData() if( GetTabPage(mnSigningPageId) ) static_cast<ImpPDFTabSigningPage*>( GetTabPage(mnSigningPageId) )->GetFilterConfigItem( this ); -//prepare the items to be returned + // prepare the items to be returned maConfigItem.WriteBool( "UseLosslessCompression", mbUseLosslessCompression ); maConfigItem.WriteInt32("Quality", mnQuality ); maConfigItem.WriteBool( "ReduceImageResolution", mbReduceImageResolution ); @@ -440,7 +441,7 @@ Sequence< PropertyValue > ImpPDFTabDialog::GetFilterData() Sequence< PropertyValue > aRet( maConfigItem.GetFilterData() ); - // OMG, this is horrible coding style... + // FIXME: OMG, this is horrible coding style... int nElementAdded = 12; aRet.realloc( aRet.getLength() + nElementAdded ); @@ -554,6 +555,7 @@ ImpPDFTabGeneralPage::~ImpPDFTabGeneralPage() disposeOnce(); } + void ImpPDFTabGeneralPage::dispose() { mpRbAll.clear(); @@ -586,11 +588,12 @@ void ImpPDFTabGeneralPage::dispose() SfxTabPage::dispose(); } + void ImpPDFTabGeneralPage::SetFilterConfigItem( ImpPDFTabDialog* paParent ) { mpaParent = paParent; -//init this class data + // init this class data mpRbRange->SetToggleHdl( LINK( this, ImpPDFTabGeneralPage, TogglePagesHdl ) ); mpRbAll->Check(); @@ -634,12 +637,13 @@ void ImpPDFTabGeneralPage::SetFilterConfigItem( ImpPDFTabDialog* paParent ) mpCbExportFormFields->SetToggleHdl( LINK( this, ImpPDFTabGeneralPage, ToggleExportFormFieldsHdl ) ); -// get the form values, for use with PDF/A-1 selection interface + // get the form values, for use with PDF/A-1 selection interface mbTaggedPDFUserSelection = paParent->mbUseTaggedPDF; mbExportFormFieldsUserSelection = paParent->mbExportFormFields; if( !mpCbPDFA1b->IsChecked() ) - {// the value for PDF/A set by the ToggleExportPDFAHdl method called before + { + // the value for PDF/A set by the ToggleExportPDFAHdl method called before mpCbTaggedPDF->Check( mbTaggedPDFUserSelection ); mpCbExportFormFields->Check( mbExportFormFieldsUserSelection ); } @@ -675,14 +679,13 @@ void ImpPDFTabGeneralPage::SetFilterConfigItem( ImpPDFTabDialog* paParent ) mpCbAddStream->Check(paParent->mbAddStream); mpCbAddStream->SetToggleHdl( LINK( this, ImpPDFTabGeneralPage, ToggleAddStreamHdl ) ); - // init addstream dependencies - ToggleAddStreamHdl(*mpCbAddStream); + ToggleAddStreamHdl(*mpCbAddStream); // init addstream dependencies } void ImpPDFTabGeneralPage::GetFilterConfigItem( ImpPDFTabDialog* paParent ) { -// updating the FilterData sequence and storing FilterData to configuration + // updating the FilterData sequence and storing FilterData to configuration paParent->mbUseLosslessCompression = mpRbLosslessCompression->IsChecked(); paParent->mnQuality = static_cast<sal_Int32>(mpNfQuality->GetValue()); paParent->mbReduceImageResolution = mpCbReduceImageResolution->IsChecked(); @@ -804,19 +807,19 @@ IMPL_LINK_NOARG_TYPED(ImpPDFTabGeneralPage, ToggleAddStreamHdl, CheckBox&, void) IMPL_LINK_NOARG_TYPED(ImpPDFTabGeneralPage, ToggleExportPDFAHdl, CheckBox&, void) { - //set the security page status (and its controls as well) + // set the security page status (and its controls as well) ImpPDFTabSecurityPage* pSecPage = mpaParent ? mpaParent->getSecurityPage() : nullptr; if (pSecPage) { pSecPage->ImplPDFASecurityControl(!mpCbPDFA1b->IsChecked()); } -//PDF/A-1 needs tagged PDF, so force disable the control, will be forced in pdfexport. + // PDF/A-1 needs tagged PDF, so force disable the control, will be forced in pdfexport. bool bPDFA1Sel = mpCbPDFA1b->IsChecked(); mpFormsFrame->Enable(bPDFA1Sel); if(bPDFA1Sel) { -//store the values of subordinate controls + // store the values of subordinate controls mbTaggedPDFUserSelection = mpCbTaggedPDF->IsChecked(); mpCbTaggedPDF->Check(); mpCbTaggedPDF->Enable(false); @@ -826,12 +829,13 @@ IMPL_LINK_NOARG_TYPED(ImpPDFTabGeneralPage, ToggleExportPDFAHdl, CheckBox&, void } else { -//retrieve the values of subordinate controls + // retrieve the values of subordinate controls mpCbTaggedPDF->Enable(); mpCbTaggedPDF->Check( mbTaggedPDFUserSelection ); mpCbExportFormFields->Check( mbExportFormFieldsUserSelection ); mpCbExportFormFields->Enable(); } + // PDF/A-1 doesn't allow launch action, so enable/disable the selection on // Link page ImpPDFTabLinksPage* pLinksPage = mpaParent ? mpaParent->getLinksPage() : nullptr; @@ -846,7 +850,8 @@ IMPL_LINK_NOARG_TYPED(ImpPDFTabGeneralPage, ToggleExportPDFAHdl, CheckBox&, void } } -// the option features tab page + +/// The option features tab page ImpPDFTabOpnFtrPage::ImpPDFTabOpnFtrPage(vcl::Window* pParent, const SfxItemSet& rCoreSet) : SfxTabPage(pParent, "PdfViewPage","filter/ui/pdfviewpage.ui", &rCoreSet) , mbUseCTLFont(false) @@ -880,6 +885,7 @@ ImpPDFTabOpnFtrPage::~ImpPDFTabOpnFtrPage() disposeOnce(); } + void ImpPDFTabOpnFtrPage::dispose() { mpRbOpnPageOnly.clear(); @@ -900,6 +906,7 @@ void ImpPDFTabOpnFtrPage::dispose() SfxTabPage::dispose(); } + VclPtr<SfxTabPage> ImpPDFTabOpnFtrPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet) { @@ -1014,28 +1021,30 @@ void ImpPDFTabOpnFtrPage::SetFilterConfigItem( const ImpPDFTabDialog* paParent } } + IMPL_LINK_NOARG_TYPED(ImpPDFTabOpnFtrPage, ToggleRbPgLyContinueFacingHdl, RadioButton&, void) { ToggleRbPgLyContinueFacingHdl(); } + void ImpPDFTabOpnFtrPage::ToggleRbPgLyContinueFacingHdl() { mpCbPgLyFirstOnLeft->Enable( mpRbPgLyContinueFacing->IsChecked() ); } + IMPL_LINK_NOARG_TYPED( ImpPDFTabOpnFtrPage, ToggleRbMagnHdl, RadioButton&, void ) { mpNumZoom->Enable( mpRbMagnZoom->IsChecked() ); } -// The Viewer preferences tab page - +/// The Viewer preferences tab page ImpPDFTabViewerPage::ImpPDFTabViewerPage( vcl::Window* pParent, const SfxItemSet& rCoreSet ) - : SfxTabPage(pParent, "PdfUserInterfacePage","filter/ui/pdfuserinterfacepage.ui", &rCoreSet) - , mbIsPresentation(false) +: SfxTabPage(pParent, "PdfUserInterfacePage","filter/ui/pdfuserinterfacepage.ui", &rCoreSet) + , mbIsPresentation(false) { get(m_pCbResWinInit,"resize"); get(m_pCbCenterWindow,"center"); @@ -1053,11 +1062,13 @@ ImpPDFTabViewerPage::ImpPDFTabViewerPage( vcl::Window* pParent, m_pRbVisibleBookmarkLevels->SetToggleHdl( LINK( this, ImpPDFTabViewerPage, ToggleRbBookmarksHdl ) ); } + ImpPDFTabViewerPage::~ImpPDFTabViewerPage() { disposeOnce(); } + void ImpPDFTabViewerPage::dispose() { m_pCbResWinInit.clear(); @@ -1074,11 +1085,13 @@ void ImpPDFTabViewerPage::dispose() SfxTabPage::dispose(); } + IMPL_LINK_NOARG_TYPED( ImpPDFTabViewerPage, ToggleRbBookmarksHdl, RadioButton&, void ) { m_pNumBookmarkLevels->Enable( m_pRbVisibleBookmarkLevels->IsChecked() ); } + VclPtr<SfxTabPage> ImpPDFTabViewerPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet) { @@ -1127,7 +1140,8 @@ void ImpPDFTabViewerPage::SetFilterConfigItem( const ImpPDFTabDialog* paParent } } -// The Security preferences tab page + +/// The Security preferences tab page ImpPDFTabSecurityPage::ImpPDFTabSecurityPage(vcl::Window* i_pParent, const SfxItemSet& i_rCoreSet) : SfxTabPage(i_pParent, "PdfSecurityPage","filter/ui/pdfsecuritypage.ui", &i_rCoreSet) , msUserPwdTitle( PDFFilterResId( STR_PDF_EXPORT_UDPWD ) ) @@ -1171,6 +1185,7 @@ ImpPDFTabSecurityPage::~ImpPDFTabSecurityPage() disposeOnce(); } + void ImpPDFTabSecurityPage::dispose() { mpPbSetPwd.clear(); @@ -1196,6 +1211,7 @@ void ImpPDFTabSecurityPage::dispose() SfxTabPage::dispose(); } + VclPtr<SfxTabPage> ImpPDFTabSecurityPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet) { @@ -1205,22 +1221,22 @@ VclPtr<SfxTabPage> ImpPDFTabSecurityPage::Create( vcl::Window* pParent, void ImpPDFTabSecurityPage::GetFilterConfigItem( ImpPDFTabDialog* paParent ) { -// please note that in PDF/A-1a mode even if this are copied back, -// the security settings are forced disabled in PDFExport::Export + // please note that in PDF/A-1a mode even if this are copied back, + // the security settings are forced disabled in PDFExport::Export paParent->mbEncrypt = mbHaveUserPassword; paParent->mxPreparedPasswords = mxPreparedPasswords; paParent->mbRestrictPermissions = mbHaveOwnerPassword; paParent->maPreparedOwnerPassword = maPreparedOwnerPassword; -//verify print status + // verify print status paParent->mnPrint = 0; if( mpRbPrintLowRes->IsChecked() ) paParent->mnPrint = 1; else if( mpRbPrintHighRes->IsChecked() ) paParent->mnPrint = 2; -//verify changes permitted + // verify changes permitted paParent->mnChangesAllowed = 0; if( mpRbChangesInsDel->IsChecked() ) @@ -1237,7 +1253,6 @@ void ImpPDFTabSecurityPage::GetFilterConfigItem( ImpPDFTabDialog* paParent ) } - void ImpPDFTabSecurityPage::SetFilterConfigItem( const ImpPDFTabDialog* paParent ) { switch( paParent->mnPrint ) @@ -1277,7 +1292,7 @@ void ImpPDFTabSecurityPage::SetFilterConfigItem( const ImpPDFTabDialog* paParen mpCbEnableCopy->Check( paParent->mbCanCopyOrExtract ); mpCbEnableAccessibility->Check( paParent->mbCanExtractForAccessibility ); -// set the status of this windows, according to the PDFA selection + // set the status of this windows, according to the PDFA selection enablePermissionControls(); ImpPDFTabGeneralPage* pGeneralPage = paParent->getGeneralPage(); @@ -1286,6 +1301,7 @@ void ImpPDFTabSecurityPage::SetFilterConfigItem( const ImpPDFTabDialog* paParen ImplPDFASecurityControl(!pGeneralPage->IsPdfaSelected()); } + IMPL_LINK_NOARG_TYPED(ImpPDFTabSecurityPage, ClickmaPbSetPwdHdl, Button*, void) { ScopedVclPtrInstance< SfxPasswordDialog > aPwdDialog( this, &msUserPwdTitle ); @@ -1295,7 +1311,7 @@ IMPL_LINK_NOARG_TYPED(ImpPDFTabSecurityPage, ClickmaPbSetPwdHdl, Button*, void) aPwdDialog->SetText(msStrSetPwd); aPwdDialog->SetGroup2Text(msOwnerPwdTitle); aPwdDialog->AllowAsciiOnly(); - if( aPwdDialog->Execute() == RET_OK ) //OK issued get password and set it + if( aPwdDialog->Execute() == RET_OK ) // OK issued get password and set it { OUString aUserPW( aPwdDialog->GetPassword() ); OUString aOwnerPW( aPwdDialog->GetPassword2() ); @@ -1376,14 +1392,13 @@ void ImpPDFTabSecurityPage::enablePermissionControls() // This tab page is under control of the PDF/A-1a checkbox: -// implement a method to do it. - +// TODO: implement a method to do it. void ImpPDFTabSecurityPage::ImplPDFASecurityControl( bool bEnableSecurity ) { if( bEnableSecurity ) { Enable(); -//after enable, check the status of control as if the dialog was initialized + // after enable, check the status of control as if the dialog was initialized } else Enable( false ); @@ -1392,8 +1407,7 @@ void ImpPDFTabSecurityPage::ImplPDFASecurityControl( bool bEnableSecurity ) } -// The link preferences tab page (relative and other stuff) - +/// The link preferences tab page (relative and other stuff) ImpPDFTabLinksPage::ImpPDFTabLinksPage( vcl::Window* pParent, const SfxItemSet& rCoreSet ) : SfxTabPage( pParent, "PdfLinksPage","filter/ui/pdflinkspage.ui",&rCoreSet ), @@ -1416,6 +1430,7 @@ ImpPDFTabLinksPage::~ImpPDFTabLinksPage() disposeOnce(); } + void ImpPDFTabLinksPage::dispose() { m_pCbExprtBmkrToNmDst.clear(); @@ -1427,6 +1442,7 @@ void ImpPDFTabLinksPage::dispose() SfxTabPage::dispose(); } + VclPtr<SfxTabPage> ImpPDFTabLinksPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet) { @@ -1488,6 +1504,7 @@ void ImpPDFTabLinksPage::SetFilterConfigItem( const ImpPDFTabDialog* paParent ) mbOpnLnksBrowserUserState = true; break; } + // now check the status of PDF/A selection // and set the link action accordingly // PDF/A-1 doesn't allow launch action on links @@ -1498,22 +1515,23 @@ void ImpPDFTabLinksPage::SetFilterConfigItem( const ImpPDFTabDialog* paParent ) } -// called from general tab, with PDFA/1 selection status -// retrieves/store the status of Launch action selection +/** Called from general tab, with PDFA/1 selection status. + Retrieves/store the status of Launch action selection. + */ void ImpPDFTabLinksPage::ImplPDFALinkControl( bool bEnableLaunch ) { -// set the value and position of link type selection + // set the value and position of link type selection if( bEnableLaunch ) { m_pRbOpnLnksLaunch->Enable(); -//restore user state with no PDF/A-1 selected + // restore user state with no PDF/A-1 selected m_pRbOpnLnksDefault->Check( mbOpnLnksDefaultUserState ); m_pRbOpnLnksLaunch->Check( mbOpnLnksLaunchUserState ); m_pRbOpnLnksBrowser->Check( mbOpnLnksBrowserUserState ); } else { -//save user state with no PDF/A-1 selected + // save user state with no PDF/A-1 selected mbOpnLnksDefaultUserState = m_pRbOpnLnksDefault->IsChecked(); mbOpnLnksLaunchUserState = m_pRbOpnLnksLaunch->IsChecked(); mbOpnLnksBrowserUserState = m_pRbOpnLnksBrowser->IsChecked(); @@ -1524,8 +1542,7 @@ void ImpPDFTabLinksPage::ImplPDFALinkControl( bool bEnableLaunch ) } -// reset the memory of Launch action present -// when PDF/A-1 was requested +/// Reset the memory of Launch action present when PDF/A-1 was requested IMPL_LINK_NOARG_TYPED(ImpPDFTabLinksPage, ClickRbOpnLnksDefaultHdl, Button*, void) { mbOpnLnksDefaultUserState = m_pRbOpnLnksDefault->IsChecked(); @@ -1534,8 +1551,7 @@ IMPL_LINK_NOARG_TYPED(ImpPDFTabLinksPage, ClickRbOpnLnksDefaultHdl, Button*, voi } -// reset the memory of a launch action present -// when PDF/A-1 was requested +/// Reset the memory of a launch action present when PDF/A-1 was requested IMPL_LINK_NOARG_TYPED(ImpPDFTabLinksPage, ClickRbOpnLnksBrowserHdl, Button*, void) { mbOpnLnksDefaultUserState = m_pRbOpnLnksDefault->IsChecked(); @@ -1543,6 +1559,7 @@ IMPL_LINK_NOARG_TYPED(ImpPDFTabLinksPage, ClickRbOpnLnksBrowserHdl, Button*, voi mbOpnLnksBrowserUserState = m_pRbOpnLnksBrowser->IsChecked(); } + ImplErrorDialog::ImplErrorDialog(const std::set< vcl::PDFWriter::ErrorCode >& rErrors) : MessageDialog(nullptr, "WarnPDFDialog", "filter/ui/warnpdfdialog.ui") { @@ -1614,11 +1631,13 @@ ImplErrorDialog::ImplErrorDialog(const std::set< vcl::PDFWriter::ErrorCode >& rE m_pErrors->SetSelectHdl( LINK( this, ImplErrorDialog, SelectHdl ) ); } + ImplErrorDialog::~ImplErrorDialog() { disposeOnce(); } + void ImplErrorDialog::dispose() { // free strings again @@ -1629,6 +1648,7 @@ void ImplErrorDialog::dispose() MessageDialog::dispose(); } + IMPL_LINK_NOARG_TYPED(ImplErrorDialog, SelectHdl, ListBox&, void) { OUString* pStr = static_cast<OUString*>(m_pErrors->GetSelectEntryData()); @@ -1636,8 +1656,7 @@ IMPL_LINK_NOARG_TYPED(ImplErrorDialog, SelectHdl, ListBox&, void) } -// The digital signatures tab page - +/// The digital signatures tab page ImpPDFTabSigningPage::ImpPDFTabSigningPage(vcl::Window* pParent, const SfxItemSet& rCoreSet) : SfxTabPage(pParent, "PdfSignPage","filter/ui/pdfsignpage.ui", &rCoreSet) , maSignCertificate() @@ -1662,6 +1681,7 @@ ImpPDFTabSigningPage::~ImpPDFTabSigningPage() disposeOnce(); } + void ImpPDFTabSigningPage::dispose() { mpEdSignCert.clear(); @@ -1674,6 +1694,7 @@ void ImpPDFTabSigningPage::dispose() SfxTabPage::dispose(); } + IMPL_LINK_NOARG_TYPED( ImpPDFTabSigningPage, ClickmaPbSignCertSelect, Button*, void ) { @@ -1712,6 +1733,7 @@ IMPL_LINK_NOARG_TYPED( ImpPDFTabSigningPage, ClickmaPbSignCertSelect, Button*, v } } + IMPL_LINK_NOARG_TYPED( ImpPDFTabSigningPage, ClickmaPbSignCertClear, Button*, void ) { mpEdSignCert->SetText(""); diff --git a/filter/source/pdf/impdialog.hxx b/filter/source/pdf/impdialog.hxx index cd2587b3aa10..103bc061a100 100644 --- a/filter/source/pdf/impdialog.hxx +++ b/filter/source/pdf/impdialog.hxx @@ -20,27 +20,23 @@ #ifndef INCLUDED_FILTER_SOURCE_PDF_IMPDIALOG_HXX #define INCLUDED_FILTER_SOURCE_PDF_IMPDIALOG_HXX -#include "pdffilter.hxx" - -#include "vcl/dialog.hxx" -#include "vcl/button.hxx" -#include "vcl/fixed.hxx" -#include "vcl/field.hxx" -#include "vcl/edit.hxx" -#include "vcl/layout.hxx" -#include "vcl/lstbox.hxx" -#include "vcl/combobox.hxx" -#include "vcl/group.hxx" -#include "vcl/pdfwriter.hxx" - +#include <sfx2/tabdlg.hxx> + +#include <vcl/dialog.hxx> +#include <vcl/button.hxx> +#include <vcl/fixed.hxx> +#include <vcl/field.hxx> +#include <vcl/edit.hxx> +#include <vcl/layout.hxx> +#include <vcl/lstbox.hxx> +#include <vcl/combobox.hxx> +#include <vcl/group.hxx> +#include <vcl/pdfwriter.hxx> #include <vcl/FilterConfigItem.hxx> -#include "sfx2/tabdlg.hxx" - -#include "com/sun/star/beans/NamedValue.hpp" - +#include "pdffilter.hxx" -// - ImpPDFDialog - +#include <com/sun/star/beans/NamedValue.hpp> class ImpPDFTabGeneralPage; @@ -48,29 +44,35 @@ class ImpPDFTabViewerPage; class ImpPDFTabOpnFtrPage; class ImpPDFTabLinksPage; + class PDFFilterResId : public ResId { public: - explicit PDFFilterResId( sal_uInt32 nId ); + explicit PDFFilterResId( sal_uInt32 nId ); }; + class ImplErrorDialog : public MessageDialog { - VclPtr<ListBox> m_pErrors; - VclPtr<FixedText> m_pExplanation; +private: + VclPtr<ListBox> m_pErrors; + VclPtr<FixedText> m_pExplanation; DECL_LINK_TYPED(SelectHdl, ListBox&, void); - public: - explicit ImplErrorDialog( const std::set< vcl::PDFWriter::ErrorCode >& ); - virtual ~ImplErrorDialog(); - virtual void dispose() override; + +public: + explicit ImplErrorDialog( const std::set< vcl::PDFWriter::ErrorCode >& ); + virtual ~ImplErrorDialog(); + + virtual void dispose() override; }; + class ImpPDFTabSecurityPage; class ImpPDFTabLinksPage; -//class tabbed dialog +/// Class tabbed dialog class ImpPDFTabDialog : public SfxTabDialog { private: @@ -81,81 +83,81 @@ private: DECL_LINK_TYPED(CancelHdl, Button*, void); - sal_uInt16 mnSigningPageId; - sal_uInt16 mnSecurityPageId; - sal_uInt16 mnLinksPage; - sal_uInt16 mnInterfacePageId; - sal_uInt16 mnViewPageId; - sal_uInt16 mnGeneralPageId; + sal_uInt16 mnSigningPageId; + sal_uInt16 mnSecurityPageId; + sal_uInt16 mnLinksPage; + sal_uInt16 mnInterfacePageId; + sal_uInt16 mnViewPageId; + sal_uInt16 mnGeneralPageId; protected: -//the following data are the configuration used throughout the dialog and pages - bool mbIsPresentation; - bool mbIsWriter; - bool mbSelectionPresent; - bool mbUseCTLFont; - bool mbUseLosslessCompression; - sal_Int32 mnQuality; - bool mbReduceImageResolution; - sal_Int32 mnMaxImageResolution; - bool mbUseTaggedPDF; - sal_Int32 mnPDFTypeSelection; - bool mbExportNotes; - bool mbViewPDF; - bool mbExportNotesPages; - bool mbUseTransitionEffects; - bool mbIsSkipEmptyPages; - bool mbAddStream; - sal_Int32 mnFormsType; - bool mbExportFormFields; - bool mbAllowDuplicateFieldNames; - bool mbExportBookmarks; - bool mbExportHiddenSlides; - sal_Int32 mnOpenBookmarkLevels; - - bool mbHideViewerToolbar; - bool mbHideViewerMenubar; - bool mbHideViewerWindowControls; - bool mbResizeWinToInit; - bool mbCenterWindow; - bool mbOpenInFullScreenMode; - bool mbDisplayPDFDocumentTitle; - sal_Int32 mnMagnification; - sal_Int32 mnInitialView; - sal_Int32 mnZoom; - sal_Int32 mnInitialPage; - - sal_Int32 mnPageLayout; - bool mbFirstPageLeft; - - bool mbEncrypt; - - bool mbRestrictPermissions; + // the following data are the configuration used throughout the dialog and pages + bool mbIsPresentation; + bool mbIsWriter; + bool mbSelectionPresent; + bool mbUseCTLFont; + bool mbUseLosslessCompression; + sal_Int32 mnQuality; + bool mbReduceImageResolution; + sal_Int32 mnMaxImageResolution; + bool mbUseTaggedPDF; + sal_Int32 mnPDFTypeSelection; + bool mbExportNotes; + bool mbViewPDF; + bool mbExportNotesPages; + bool mbUseTransitionEffects; + bool mbIsSkipEmptyPages; + bool mbAddStream; + sal_Int32 mnFormsType; + bool mbExportFormFields; + bool mbAllowDuplicateFieldNames; + bool mbExportBookmarks; + bool mbExportHiddenSlides; + sal_Int32 mnOpenBookmarkLevels; + + bool mbHideViewerToolbar; + bool mbHideViewerMenubar; + bool mbHideViewerWindowControls; + bool mbResizeWinToInit; + bool mbCenterWindow; + bool mbOpenInFullScreenMode; + bool mbDisplayPDFDocumentTitle; + sal_Int32 mnMagnification; + sal_Int32 mnInitialView; + sal_Int32 mnZoom; + sal_Int32 mnInitialPage; + + sal_Int32 mnPageLayout; + bool mbFirstPageLeft; + + bool mbEncrypt; + + bool mbRestrictPermissions; css::uno::Sequence< css::beans::NamedValue > maPreparedOwnerPassword; - sal_Int32 mnPrint; - sal_Int32 mnChangesAllowed; - bool mbCanCopyOrExtract; - bool mbCanExtractForAccessibility; + sal_Int32 mnPrint; + sal_Int32 mnChangesAllowed; + bool mbCanCopyOrExtract; + bool mbCanExtractForAccessibility; css::uno::Reference< css::beans::XMaterialHolder > mxPreparedPasswords; - bool mbIsRangeChecked; - OUString msPageRange; - bool mbSelectionIsChecked; + bool mbIsRangeChecked; + OUString msPageRange; + bool mbSelectionIsChecked; - bool mbExportRelativeFsysLinks; - sal_Int32 mnViewPDFMode; - bool mbConvertOOoTargets; - bool mbExportBmkToPDFDestination; + bool mbExportRelativeFsysLinks; + sal_Int32 mnViewPDFMode; + bool mbConvertOOoTargets; + bool mbExportBmkToPDFDestination; - bool mbSignPDF; - OUString msSignPassword; - OUString msSignLocation; - OUString msSignContact; - OUString msSignReason; + bool mbSignPDF; + OUString msSignPassword; + OUString msSignLocation; + OUString msSignContact; + OUString msSignReason; css::uno::Reference< css::security::XCertificate > maSignCertificate; - OUString msSignTSA; + OUString msSignTSA; - OUString maWatermarkText; + OUString maWatermarkText; public: @@ -166,69 +168,69 @@ public: friend class ImpPDFTabLinksPage; friend class ImpPDFTabSigningPage; - ImpPDFTabDialog( vcl::Window* pParent, - Sequence< PropertyValue >& rFilterData, - const css::uno::Reference< XComponent >& rDoc - ); - virtual ~ImpPDFTabDialog(); - virtual void dispose() override; + ImpPDFTabDialog( vcl::Window* pParent, + Sequence< PropertyValue >& rFilterData, + const css::uno::Reference< XComponent >& rDoc); + virtual ~ImpPDFTabDialog(); + + virtual void dispose() override; Sequence< PropertyValue > GetFilterData(); - ImpPDFTabSecurityPage* getSecurityPage() const; - ImpPDFTabLinksPage* getLinksPage() const; - ImpPDFTabGeneralPage* getGeneralPage() const; + ImpPDFTabSecurityPage* getSecurityPage() const; + ImpPDFTabLinksPage* getLinksPage() const; + ImpPDFTabGeneralPage* getGeneralPage() const; protected: - virtual void PageCreated( sal_uInt16 _nId, - SfxTabPage& _rPage ) override; + virtual void PageCreated( sal_uInt16 _nId, SfxTabPage& _rPage ) override; virtual short Ok() override; }; -//class tab page general + +/// Class tab page general class ImpPDFTabGeneralPage : public SfxTabPage { - friend class ImpPDFTabLinksPage; + friend class ImpPDFTabLinksPage; - VclPtr<RadioButton> mpRbAll; - VclPtr<RadioButton> mpRbRange; - VclPtr<RadioButton> mpRbSelection; - VclPtr<Edit> mpEdPages; + VclPtr<RadioButton> mpRbAll; + VclPtr<RadioButton> mpRbRange; + VclPtr<RadioButton> mpRbSelection; + VclPtr<Edit> mpEdPages; - VclPtr<RadioButton> mpRbLosslessCompression; - VclPtr<RadioButton> mpRbJPEGCompression; - VclPtr<VclContainer> mpQualityFrame; - VclPtr<MetricField> mpNfQuality; - VclPtr<CheckBox> mpCbReduceImageResolution; - VclPtr<ComboBox> mpCoReduceImageResolution; + VclPtr<RadioButton> mpRbLosslessCompression; + VclPtr<RadioButton> mpRbJPEGCompression; + VclPtr<VclContainer> mpQualityFrame; + VclPtr<MetricField> mpNfQuality; + VclPtr<CheckBox> mpCbReduceImageResolution; + VclPtr<ComboBox> mpCoReduceImageResolution; - VclPtr<CheckBox> mpCbPDFA1b; - VclPtr<CheckBox> mpCbTaggedPDF; - bool mbTaggedPDFUserSelection; + VclPtr<CheckBox> mpCbPDFA1b; + VclPtr<CheckBox> mpCbTaggedPDF; + bool mbTaggedPDFUserSelection; - VclPtr<CheckBox> mpCbExportFormFields; - bool mbExportFormFieldsUserSelection; - VclPtr<VclContainer> mpFormsFrame; - VclPtr<ListBox> mpLbFormsFormat; - VclPtr<CheckBox> mpCbAllowDuplicateFieldNames; + VclPtr<CheckBox> mpCbExportFormFields; + bool mbExportFormFieldsUserSelection; + VclPtr<VclContainer> mpFormsFrame; + VclPtr<ListBox> mpLbFormsFormat; + VclPtr<CheckBox> mpCbAllowDuplicateFieldNames; - VclPtr<CheckBox> mpCbExportBookmarks; - VclPtr<CheckBox> mpCbExportHiddenSlides; - VclPtr<CheckBox> mpCbExportNotes; - VclPtr<CheckBox> mpCbViewPDF; - VclPtr<CheckBox> mpCbExportNotesPages; + VclPtr<CheckBox> mpCbExportBookmarks; + VclPtr<CheckBox> mpCbExportHiddenSlides; + VclPtr<CheckBox> mpCbExportNotes; + VclPtr<CheckBox> mpCbViewPDF; + VclPtr<CheckBox> mpCbExportNotesPages; - VclPtr<CheckBox> mpCbExportEmptyPages; - VclPtr<CheckBox> mpCbAddStream; + VclPtr<CheckBox> mpCbExportEmptyPages; + VclPtr<CheckBox> mpCbAddStream; - VclPtr<CheckBox> mpCbWatermark; - VclPtr<FixedText> mpFtWatermark; - VclPtr<Edit> mpEdWatermark; + VclPtr<CheckBox> mpCbWatermark; + VclPtr<FixedText> mpFtWatermark; + VclPtr<Edit> mpEdWatermark; - bool mbIsPresentation; - bool mbIsWriter; + bool mbIsPresentation; + bool mbIsWriter; - VclPtr<ImpPDFTabDialog> mpaParent; + VclPtr<ImpPDFTabDialog> mpaParent; DECL_LINK_TYPED( TogglePagesHdl, RadioButton&, void ); DECL_LINK_TYPED( ToggleCompressionHdl, RadioButton&, void ); @@ -236,127 +238,124 @@ class ImpPDFTabGeneralPage : public SfxTabPage DECL_LINK_TYPED( ToggleWatermarkHdl, CheckBox&, void ); DECL_LINK_TYPED( ToggleAddStreamHdl, CheckBox&, void ); DECL_LINK_TYPED( ToggleExportFormFieldsHdl, CheckBox&, void ); - void TogglePagesHdl(); + + void TogglePagesHdl(); public: DECL_LINK_TYPED( ToggleExportPDFAHdl, CheckBox&, void ); - ImpPDFTabGeneralPage( vcl::Window* pParent, - const SfxItemSet& rSet ); - virtual ~ImpPDFTabGeneralPage(); - virtual void dispose() override; + ImpPDFTabGeneralPage( vcl::Window* pParent, const SfxItemSet& rSet ); + virtual ~ImpPDFTabGeneralPage(); - static VclPtr<SfxTabPage> Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet); + virtual void dispose() override; + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet); - void GetFilterConfigItem(ImpPDFTabDialog* paParent); - void SetFilterConfigItem(ImpPDFTabDialog* paParent); - bool IsPdfaSelected() const { return mpCbPDFA1b->IsChecked(); } + void GetFilterConfigItem(ImpPDFTabDialog* paParent); + void SetFilterConfigItem(ImpPDFTabDialog* paParent); + bool IsPdfaSelected() const { return mpCbPDFA1b->IsChecked(); } }; -//class tab page viewer +/// Class tab page viewer class ImpPDFTabOpnFtrPage : public SfxTabPage { - VclPtr<RadioButton> mpRbOpnPageOnly; - VclPtr<RadioButton> mpRbOpnOutline; - VclPtr<RadioButton> mpRbOpnThumbs; - VclPtr<NumericField> mpNumInitialPage; - - VclPtr<RadioButton> mpRbMagnDefault; - VclPtr<RadioButton> mpRbMagnFitWin; - VclPtr<RadioButton> mpRbMagnFitWidth; - VclPtr<RadioButton> mpRbMagnFitVisible; - VclPtr<RadioButton> mpRbMagnZoom; - VclPtr<NumericField> mpNumZoom; - - VclPtr<RadioButton> mpRbPgLyDefault; - VclPtr<RadioButton> mpRbPgLySinglePage; - VclPtr<RadioButton> mpRbPgLyContinue; - VclPtr<RadioButton> mpRbPgLyContinueFacing; - VclPtr<CheckBox> mpCbPgLyFirstOnLeft; - - bool mbUseCTLFont; + VclPtr<RadioButton> mpRbOpnPageOnly; + VclPtr<RadioButton> mpRbOpnOutline; + VclPtr<RadioButton> mpRbOpnThumbs; + VclPtr<NumericField> mpNumInitialPage; + + VclPtr<RadioButton> mpRbMagnDefault; + VclPtr<RadioButton> mpRbMagnFitWin; + VclPtr<RadioButton> mpRbMagnFitWidth; + VclPtr<RadioButton> mpRbMagnFitVisible; + VclPtr<RadioButton> mpRbMagnZoom; + VclPtr<NumericField> mpNumZoom; + + VclPtr<RadioButton> mpRbPgLyDefault; + VclPtr<RadioButton> mpRbPgLySinglePage; + VclPtr<RadioButton> mpRbPgLyContinue; + VclPtr<RadioButton> mpRbPgLyContinueFacing; + VclPtr<CheckBox> mpCbPgLyFirstOnLeft; + + bool mbUseCTLFont; DECL_LINK_TYPED( ToggleRbPgLyContinueFacingHdl, RadioButton&, void ); DECL_LINK_TYPED( ToggleRbMagnHdl, RadioButton&, void ); - void ToggleRbPgLyContinueFacingHdl(); + + void ToggleRbPgLyContinueFacingHdl(); public: - ImpPDFTabOpnFtrPage( vcl::Window* pParent, - const SfxItemSet& rSet ); + ImpPDFTabOpnFtrPage( vcl::Window* pParent, const SfxItemSet& rSet ); + virtual ~ImpPDFTabOpnFtrPage(); - virtual ~ImpPDFTabOpnFtrPage(); - virtual void dispose() override; - static VclPtr<SfxTabPage> Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet ); + virtual void dispose() override; + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ); void GetFilterConfigItem( ImpPDFTabDialog* paParent); void SetFilterConfigItem( const ImpPDFTabDialog* paParent ); }; -//class tab page viewer +/// Class tab page viewer class ImpPDFTabViewerPage : public SfxTabPage { - VclPtr<CheckBox> m_pCbResWinInit; - VclPtr<CheckBox> m_pCbCenterWindow; - VclPtr<CheckBox> m_pCbOpenFullScreen; - VclPtr<CheckBox> m_pCbDispDocTitle; + VclPtr<CheckBox> m_pCbResWinInit; + VclPtr<CheckBox> m_pCbCenterWindow; + VclPtr<CheckBox> m_pCbOpenFullScreen; + VclPtr<CheckBox> m_pCbDispDocTitle; - VclPtr<CheckBox> m_pCbHideViewerMenubar; - VclPtr<CheckBox> m_pCbHideViewerToolbar; - VclPtr<CheckBox> m_pCbHideViewerWindowControls; + VclPtr<CheckBox> m_pCbHideViewerMenubar; + VclPtr<CheckBox> m_pCbHideViewerToolbar; + VclPtr<CheckBox> m_pCbHideViewerWindowControls; - VclPtr<CheckBox> m_pCbTransitionEffects; - bool mbIsPresentation; + VclPtr<CheckBox> m_pCbTransitionEffects; + bool mbIsPresentation; - VclPtr<RadioButton> m_pRbAllBookmarkLevels; - VclPtr<RadioButton> m_pRbVisibleBookmarkLevels; - VclPtr<NumericField> m_pNumBookmarkLevels; + VclPtr<RadioButton> m_pRbAllBookmarkLevels; + VclPtr<RadioButton> m_pRbVisibleBookmarkLevels; + VclPtr<NumericField> m_pNumBookmarkLevels; DECL_LINK_TYPED( ToggleRbBookmarksHdl, RadioButton&, void ); + public: - ImpPDFTabViewerPage( vcl::Window* pParent, - const SfxItemSet& rSet ); + ImpPDFTabViewerPage( vcl::Window* pParent, const SfxItemSet& rSet ); + virtual ~ImpPDFTabViewerPage(); - virtual ~ImpPDFTabViewerPage(); - virtual void dispose() override; - static VclPtr<SfxTabPage> Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet ); + virtual void dispose() override; + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ); void GetFilterConfigItem( ImpPDFTabDialog* paParent); void SetFilterConfigItem( const ImpPDFTabDialog* paParent ); }; -//class security tab page +/// Class security tab page class ImpPDFTabSecurityPage : public SfxTabPage { - VclPtr<PushButton> mpPbSetPwd; - OUString msStrSetPwd; + VclPtr<PushButton> mpPbSetPwd; + OUString msStrSetPwd; - VclPtr<VclContainer> mpUserPwdSet; - VclPtr<VclContainer> mpUserPwdUnset; - VclPtr<VclContainer> mpUserPwdPdfa; + VclPtr<VclContainer> mpUserPwdSet; + VclPtr<VclContainer> mpUserPwdUnset; + VclPtr<VclContainer> mpUserPwdPdfa; - VclPtr<VclContainer> mpOwnerPwdSet; - VclPtr<VclContainer> mpOwnerPwdUnset; - VclPtr<VclContainer> mpOwnerPwdPdfa; + VclPtr<VclContainer> mpOwnerPwdSet; + VclPtr<VclContainer> mpOwnerPwdUnset; + VclPtr<VclContainer> mpOwnerPwdPdfa; - VclPtr<VclContainer> mpPrintPermissions; - VclPtr<RadioButton> mpRbPrintNone; - VclPtr<RadioButton> mpRbPrintLowRes; - VclPtr<RadioButton> mpRbPrintHighRes; + VclPtr<VclContainer> mpPrintPermissions; + VclPtr<RadioButton> mpRbPrintNone; + VclPtr<RadioButton> mpRbPrintLowRes; + VclPtr<RadioButton> mpRbPrintHighRes; - VclPtr<VclContainer> mpChangesAllowed; - VclPtr<RadioButton> mpRbChangesNone; - VclPtr<RadioButton> mpRbChangesInsDel; - VclPtr<RadioButton> mpRbChangesFillForm; - VclPtr<RadioButton> mpRbChangesComment; - VclPtr<RadioButton> mpRbChangesAnyNoCopy; + VclPtr<VclContainer> mpChangesAllowed; + VclPtr<RadioButton> mpRbChangesNone; + VclPtr<RadioButton> mpRbChangesInsDel; + VclPtr<RadioButton> mpRbChangesFillForm; + VclPtr<RadioButton> mpRbChangesComment; + VclPtr<RadioButton> mpRbChangesAnyNoCopy; - VclPtr<VclContainer> mpContent; - VclPtr<CheckBox> mpCbEnableCopy; - VclPtr<CheckBox> mpCbEnableAccessibility; + VclPtr<VclContainer> mpContent; + VclPtr<CheckBox> mpCbEnableCopy; + VclPtr<CheckBox> mpCbEnableAccessibility; OUString msUserPwdTitle; @@ -369,82 +368,77 @@ class ImpPDFTabSecurityPage : public SfxTabPage DECL_LINK_TYPED( ClickmaPbSetPwdHdl, Button*, void ); - void enablePermissionControls(); + void enablePermissionControls(); public: - ImpPDFTabSecurityPage( vcl::Window* pParent, - const SfxItemSet& rSet ); - - virtual ~ImpPDFTabSecurityPage(); - virtual void dispose() override; - static VclPtr<SfxTabPage> Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet ); - - void GetFilterConfigItem( ImpPDFTabDialog* paParent); - void SetFilterConfigItem( const ImpPDFTabDialog* paParent ); - void ImplPDFASecurityControl( bool bEnableSecurity ); - bool hasPassword() const { return mbHaveOwnerPassword || mbHaveUserPassword; } + ImpPDFTabSecurityPage( vcl::Window* pParent, const SfxItemSet& rSet ); + virtual ~ImpPDFTabSecurityPage(); + + virtual void dispose() override; + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ); + + void GetFilterConfigItem( ImpPDFTabDialog* paParent); + void SetFilterConfigItem( const ImpPDFTabDialog* paParent ); + void ImplPDFASecurityControl( bool bEnableSecurity ); + bool hasPassword() const { return mbHaveOwnerPassword || mbHaveUserPassword; } }; -//class to implement the relative link stuff + +/// Implements the relative link stuff class ImpPDFTabLinksPage : public SfxTabPage { - VclPtr<CheckBox> m_pCbExprtBmkrToNmDst; - VclPtr<CheckBox> m_pCbOOoToPDFTargets; - VclPtr<CheckBox> m_pCbExportRelativeFsysLinks; + VclPtr<CheckBox> m_pCbExprtBmkrToNmDst; + VclPtr<CheckBox> m_pCbOOoToPDFTargets; + VclPtr<CheckBox> m_pCbExportRelativeFsysLinks; - VclPtr<RadioButton> m_pRbOpnLnksDefault; - bool mbOpnLnksDefaultUserState; - VclPtr<RadioButton> m_pRbOpnLnksLaunch; - bool mbOpnLnksLaunchUserState; - VclPtr<RadioButton> m_pRbOpnLnksBrowser; - bool mbOpnLnksBrowserUserState; + VclPtr<RadioButton> m_pRbOpnLnksDefault; + bool mbOpnLnksDefaultUserState; + VclPtr<RadioButton> m_pRbOpnLnksLaunch; + bool mbOpnLnksLaunchUserState; + VclPtr<RadioButton> m_pRbOpnLnksBrowser; + bool mbOpnLnksBrowserUserState; DECL_LINK_TYPED( ClickRbOpnLnksDefaultHdl, Button*, void ); DECL_LINK_TYPED( ClickRbOpnLnksBrowserHdl, Button*, void ); public: - ImpPDFTabLinksPage( vcl::Window* pParent, - const SfxItemSet& rSet ); + ImpPDFTabLinksPage( vcl::Window* pParent, const SfxItemSet& rSet ); + virtual ~ImpPDFTabLinksPage(); - virtual ~ImpPDFTabLinksPage(); - virtual void dispose() override; - static VclPtr<SfxTabPage> Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet ); + virtual void dispose() override; + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ); - void GetFilterConfigItem( ImpPDFTabDialog* paParent); - void SetFilterConfigItem( const ImpPDFTabDialog* paParent ); + void GetFilterConfigItem( ImpPDFTabDialog* paParent); + void SetFilterConfigItem( const ImpPDFTabDialog* paParent ); - void ImplPDFALinkControl( bool bEnableLaunch ); + void ImplPDFALinkControl( bool bEnableLaunch ); }; //class to implement the digital signing class ImpPDFTabSigningPage : public SfxTabPage { - VclPtr<Edit> mpEdSignCert; - VclPtr<PushButton> mpPbSignCertSelect; - VclPtr<PushButton> mpPbSignCertClear; - VclPtr<Edit> mpEdSignPassword; - VclPtr<Edit> mpEdSignLocation; - VclPtr<Edit> mpEdSignContactInfo; - VclPtr<Edit> mpEdSignReason; - VclPtr<ListBox> mpLBSignTSA; + VclPtr<Edit> mpEdSignCert; + VclPtr<PushButton> mpPbSignCertSelect; + VclPtr<PushButton> mpPbSignCertClear; + VclPtr<Edit> mpEdSignPassword; + VclPtr<Edit> mpEdSignLocation; + VclPtr<Edit> mpEdSignContactInfo; + VclPtr<Edit> mpEdSignReason; + VclPtr<ListBox> mpLBSignTSA; css::uno::Reference< css::security::XCertificate > maSignCertificate; DECL_LINK_TYPED( ClickmaPbSignCertSelect, Button*, void ); DECL_LINK_TYPED( ClickmaPbSignCertClear, Button*, void ); public: - ImpPDFTabSigningPage( vcl::Window* pParent, - const SfxItemSet& rSet ); + ImpPDFTabSigningPage( vcl::Window* pParent, const SfxItemSet& rSet ); + virtual ~ImpPDFTabSigningPage(); - virtual ~ImpPDFTabSigningPage(); - virtual void dispose() override; - static VclPtr<SfxTabPage> Create( vcl::Window* pParent, - const SfxItemSet* rAttrSet ); + virtual void dispose() override; + static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet ); - void GetFilterConfigItem( ImpPDFTabDialog* paParent); - void SetFilterConfigItem( const ImpPDFTabDialog* paParent ); + void GetFilterConfigItem( ImpPDFTabDialog* paParent); + void SetFilterConfigItem( const ImpPDFTabDialog* paParent ); }; #endif // INCLUDED_FILTER_SOURCE_PDF_IMPDIALOG_HXX diff --git a/filter/source/pdf/pdfdialog.cxx b/filter/source/pdf/pdfdialog.cxx index 4c517cd3ead9..76d8952dc161 100644 --- a/filter/source/pdf/pdfdialog.cxx +++ b/filter/source/pdf/pdfdialog.cxx @@ -30,20 +30,16 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; - -// - PDFDialog functions - - - #define SERVICE_NAME "com.sun.star.document.PDFDialog" - OUString PDFDialog_getImplementationName () throw (RuntimeException) { return OUString ( "com.sun.star.comp.PDF.PDFDialog" ); } + Sequence< OUString > SAL_CALL PDFDialog_getSupportedServiceNames() throw (RuntimeException) { @@ -52,7 +48,6 @@ Sequence< OUString > SAL_CALL PDFDialog_getSupportedServiceNames() } - Reference< XInterface > SAL_CALL PDFDialog_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw( Exception ) { @@ -64,7 +59,6 @@ Reference< XInterface > SAL_CALL PDFDialog_createInstance( const Reference< XMul #undef SERVICE_NAME -// - PDFDialog - PDFDialog::PDFDialog( const Reference< XComponentContext > &rxContext ) diff --git a/filter/source/pdf/pdfdialog.hxx b/filter/source/pdf/pdfdialog.hxx index f10e0430a696..70ed93cac052 100644 --- a/filter/source/pdf/pdfdialog.hxx +++ b/filter/source/pdf/pdfdialog.hxx @@ -26,16 +26,9 @@ #include <cppuhelper/implbase.hxx> -// - PDFDialog - - - namespace vcl { class Window; } -typedef ::cppu::ImplInheritanceHelper < - ::svt::OGenericUnoDialog, - XPropertyAccess, - XExporter - > PDFDialog_Base; +typedef ::cppu::ImplInheritanceHelper < ::svt::OGenericUnoDialog, XPropertyAccess, XExporter > PDFDialog_Base; class PDFDialog : public PDFDialog_Base, public ::comphelper::OPropertyArrayUsageHelper< PDFDialog > @@ -60,10 +53,11 @@ protected: using OPropertySetHelper::getPropertyValues; virtual Sequence< PropertyValue > SAL_CALL getPropertyValues( ) throw (RuntimeException, std::exception) override; using OPropertySetHelper::setPropertyValues; - virtual void SAL_CALL setPropertyValues( const Sequence< PropertyValue >& aProps ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException, std::exception) override; + virtual void SAL_CALL setPropertyValues( const Sequence< PropertyValue >& aProps ) + throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException, std::exception) override; - // XExporter - virtual void SAL_CALL setSourceDocument( const Reference< XComponent >& xDoc ) throw(IllegalArgumentException, RuntimeException, std::exception) override; + // XExporter + virtual void SAL_CALL setSourceDocument( const Reference< XComponent >& xDoc ) throw (IllegalArgumentException, RuntimeException, std::exception) override; public: @@ -72,7 +66,6 @@ public: }; - OUString PDFDialog_getImplementationName () throw (RuntimeException); Sequence< OUString > SAL_CALL PDFDialog_getSupportedServiceNames() throw (RuntimeException); Reference< XInterface > SAL_CALL PDFDialog_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw( Exception ); diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx index d0f5796694cb..000bcb3deed4 100644 --- a/filter/source/pdf/pdfexport.cxx +++ b/filter/source/pdf/pdfexport.cxx @@ -18,63 +18,60 @@ */ -#include "pdfexport.hxx" -#include "impdialog.hxx" - -#include "pdf.hrc" #include <osl/file.hxx> -#include "tools/urlobj.hxx" -#include "tools/fract.hxx" -#include "tools/poly.hxx" -#include "vcl/mapmod.hxx" -#include "vcl/virdev.hxx" -#include "vcl/metaact.hxx" -#include "vcl/gdimtf.hxx" -#include "vcl/jobset.hxx" -#include "vcl/bitmapaccess.hxx" -#include "vcl/svapp.hxx" -#include "toolkit/awt/vclxdevice.hxx" +#include <tools/urlobj.hxx> +#include <tools/fract.hxx> +#include <tools/poly.hxx> +#include <vcl/mapmod.hxx> +#include <vcl/virdev.hxx> +#include <vcl/metaact.hxx> +#include <vcl/gdimtf.hxx> +#include <vcl/jobset.hxx> +#include <vcl/bitmapaccess.hxx> +#include <vcl/svapp.hxx> #include <vcl/FilterConfigItem.hxx> #include <vcl/graphicfilter.hxx> #include <vcl/settings.hxx> -#include "svl/solar.hrc" -#include "comphelper/sequence.hxx" -#include "comphelper/string.hxx" -#include "comphelper/storagehelper.hxx" -#include "unotools/streamwrap.hxx" -#include "com/sun/star/io/XSeekable.hpp" - -#include "basegfx/polygon/b2dpolygon.hxx" -#include "basegfx/polygon/b2dpolypolygon.hxx" -#include "basegfx/polygon/b2dpolygontools.hxx" - -#include "unotools/saveopt.hxx" - -#include "vcl/graphictools.hxx" -#include "com/sun/star/beans/XPropertySet.hpp" -#include "com/sun/star/configuration/theDefaultProvider.hpp" -#include "com/sun/star/awt/Rectangle.hpp" -#include "com/sun/star/awt/XDevice.hpp" -#include "com/sun/star/util/MeasureUnit.hpp" -#include "com/sun/star/frame/XModel.hpp" -#include "com/sun/star/frame/ModuleManager.hpp" -#include "com/sun/star/frame/XStorable.hpp" -#include "com/sun/star/frame/XController.hpp" -#include "com/sun/star/document/XDocumentProperties.hpp" -#include "com/sun/star/document/XDocumentPropertiesSupplier.hpp" -#include "com/sun/star/container/XNameAccess.hpp" -#include "com/sun/star/view/XViewSettingsSupplier.hpp" -#include "com/sun/star/task/XInteractionRequest.hpp" -#include "com/sun/star/task/PDFExportException.hpp" - -#include "unotools/configmgr.hxx" -#include "cppuhelper/exc_hlp.hxx" +#include <vcl/graphictools.hxx> +#include <svl/solar.hrc> +#include <comphelper/sequence.hxx> +#include <comphelper/string.hxx> +#include <comphelper/storagehelper.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/polygon/b2dpolypolygon.hxx> +#include <basegfx/polygon/b2dpolygontools.hxx> +#include <toolkit/awt/vclxdevice.hxx> +#include <unotools/streamwrap.hxx> +#include <unotools/saveopt.hxx> +#include <unotools/configmgr.hxx> +#include <cppuhelper/exc_hlp.hxx> #include <cppuhelper/compbase.hxx> -#include "cppuhelper/basemutex.hxx" +#include <cppuhelper/basemutex.hxx> + +#include "pdfexport.hxx" +#include "impdialog.hxx" +#include "pdf.hrc" + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/configuration/theDefaultProvider.hpp> +#include <com/sun/star/awt/Rectangle.hpp> +#include <com/sun/star/awt/XDevice.hpp> +#include <com/sun/star/util/MeasureUnit.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> +#include <com/sun/star/frame/XStorable.hpp> +#include <com/sun/star/frame/XController.hpp> +#include <com/sun/star/document/XDocumentProperties.hpp> +#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/view/XViewSettingsSupplier.hpp> +#include <com/sun/star/task/XInteractionRequest.hpp> +#include <com/sun/star/task/PDFExportException.hpp> +#include <com/sun/star/io/XSeekable.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/drawing/XShapes.hpp> +#include <com/sun/star/graphic/XGraphicProvider.hpp> -#include "com/sun/star/lang/XServiceInfo.hpp" -#include "com/sun/star/drawing/XShapes.hpp" -#include "com/sun/star/graphic/XGraphicProvider.hpp" #include <memory> using namespace ::com::sun::star; @@ -85,9 +82,6 @@ using namespace ::com::sun::star::view; using namespace ::com::sun::star::graphic; -// - PDFExport - - - PDFExport::PDFExport( const Reference< XComponent >& rxSrcDoc, const Reference< task::XStatusIndicator >& rxStatusIndicator, const Reference< task::XInteractionHandler >& rxIH, @@ -138,7 +132,7 @@ PDFExport::PDFExport( const Reference< XComponent >& rxSrcDoc, mbCanCopyOrExtract ( true ), mbCanExtractForAccessibility( true ), -//--->i56629 + // #i56629 mbExportRelativeFsysLinks ( false ), mnDefaultLinkAction ( 0 ), mbConvertOOoTargetToPDFTarget( false ), @@ -148,13 +142,11 @@ PDFExport::PDFExport( const Reference< XComponent >& rxSrcDoc, } - PDFExport::~PDFExport() { } - bool PDFExport::ExportSelection( vcl::PDFWriter& rPDFWriter, Reference< css::view::XRenderable >& rRenderable, const Any& rSelection, @@ -246,7 +238,7 @@ bool PDFExport::ExportSelection( vcl::PDFWriter& rPDFWriter, } else { - bRet = true; // #i18334# SJ: nPageCount == 0, + bRet = true; // #i18334# nPageCount == 0, rPDFWriter.NewPage( 10000, 10000 ); // creating dummy page rPDFWriter.SetMapMode( MAP_100TH_MM ); } @@ -260,10 +252,14 @@ bool PDFExport::ExportSelection( vcl::PDFWriter& rPDFWriter, class PDFExportStreamDoc : public vcl::PDFOutputStream { +private: + Reference< XComponent > m_xSrcDoc; Sequence< beans::NamedValue > m_aPreparedPassword; - public: - PDFExportStreamDoc( const Reference< XComponent >& xDoc, const Sequence<beans::NamedValue>& rPwd ) + +public: + + PDFExportStreamDoc( const Reference< XComponent >& xDoc, const Sequence<beans::NamedValue>& rPwd ) : m_xSrcDoc( xDoc ), m_aPreparedPassword( rPwd ) {} @@ -272,10 +268,12 @@ class PDFExportStreamDoc : public vcl::PDFOutputStream virtual void write( const Reference< XOutputStream >& xStream ) override; }; + PDFExportStreamDoc::~PDFExportStreamDoc() { } + void PDFExportStreamDoc::write( const Reference< XOutputStream >& xStream ) { Reference< css::frame::XStorable > xStore( m_xSrcDoc, UNO_QUERY ); @@ -301,6 +299,7 @@ void PDFExportStreamDoc::write( const Reference< XOutputStream >& xStream ) } } + static OUString getMimetypeForDocument( const Reference< XComponentContext >& xContext, const Reference< XComponent >& xDoc ) throw() { @@ -373,6 +372,7 @@ static OUString getMimetypeForDocument( const Reference< XComponentContext >& xC return aDocMimetype; } + bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >& rFilterData ) { INetURLObject aURL( rFile ); @@ -473,7 +473,7 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >& rFilterData[ nData ].Value >>= mnFormsFormat; else if ( rFilterData[ nData ].Name == "AllowDuplicateFieldNames" ) rFilterData[ nData ].Value >>= mbAllowDuplicateFieldNames; -//viewer properties + // viewer properties else if ( rFilterData[ nData ].Name == "HideViewerToolbar" ) rFilterData[ nData ].Value >>= mbHideViewerToolbar; else if ( rFilterData[ nData ].Name == "HideViewerMenubar" ) @@ -504,7 +504,7 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >& rFilterData[ nData ].Value >>= mbAddStream; else if ( rFilterData[ nData ].Name == "Watermark" ) rFilterData[ nData ].Value >>= msWatermark; -//now all the security related properties... + // now all the security related properties... else if ( rFilterData[ nData ].Name == "EncryptFile" ) rFilterData[ nData ].Value >>= mbEncrypt; else if ( rFilterData[ nData ].Name == "DocumentOpenPassword" ) @@ -525,15 +525,15 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >& rFilterData[ nData ].Value >>= mbCanCopyOrExtract; else if ( rFilterData[ nData ].Name == "EnableTextAccessForAccessibilityTools" ) rFilterData[ nData ].Value >>= mbCanExtractForAccessibility; -//--->i56629 links extra (relative links and other related stuff) - else if ( rFilterData[ nData ].Name == "ExportLinksRelativeFsys" ) - rFilterData[ nData ].Value >>= mbExportRelativeFsysLinks; - else if ( rFilterData[ nData ].Name == "PDFViewSelection" ) - rFilterData[ nData ].Value >>= mnDefaultLinkAction; - else if ( rFilterData[ nData ].Name == "ConvertOOoTargetToPDFTarget" ) - rFilterData[ nData ].Value >>= mbConvertOOoTargetToPDFTarget; - else if ( rFilterData[ nData ].Name == "ExportBookmarksToPDFDestination" ) - rFilterData[ nData ].Value >>= mbExportBmkToDest; + // i56629 links extra (relative links and other related stuff) + else if ( rFilterData[ nData ].Name == "ExportLinksRelativeFsys" ) + rFilterData[ nData ].Value >>= mbExportRelativeFsysLinks; + else if ( rFilterData[ nData ].Name == "PDFViewSelection" ) + rFilterData[ nData ].Value >>= mnDefaultLinkAction; + else if ( rFilterData[ nData ].Name == "ConvertOOoTargetToPDFTarget" ) + rFilterData[ nData ].Value >>= mbConvertOOoTargetToPDFTarget; + else if ( rFilterData[ nData ].Name == "ExportBookmarksToPDFDestination" ) + rFilterData[ nData ].Value >>= mbExportBmkToDest; else if ( rFilterData[ nData ].Name == "ExportBookmarks" ) rFilterData[ nData ].Value >>= mbExportBookmarks; else if ( rFilterData[ nData ].Name == "ExportHiddenSlides" ) @@ -555,9 +555,10 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >& else if ( rFilterData[ nData ].Name == "SignatureTSA" ) rFilterData[ nData ].Value >>= msSignTSA; } + aContext.URL = aURL.GetMainURL(INetURLObject::DECODE_TO_IURI); -//set the correct version, depending on user request + // set the correct version, depending on user request switch( mnPDFTypeSelection ) { default: @@ -566,22 +567,18 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >& break; case 1: aContext.Version = vcl::PDFWriter::PDF_A_1; - //force the tagged PDF as well - mbUseTaggedPDF = true; - //force disabling of form conversion - mbExportFormFields = false; - // PDF/A does not allow transparencies - mbRemoveTransparencies = true; - // no encryption - mbEncrypt = false; + mbUseTaggedPDF = true; // force the tagged PDF as well + mbExportFormFields = false; // force disabling of form conversion + mbRemoveTransparencies = true; // PDF/A does not allow transparencies + mbEncrypt = false; // no encryption xEnc.clear(); break; } -//copy in context the values default in the constructor or set by the FilterData sequence of properties + // copy in context the values default in the constructor or set by the FilterData sequence of properties aContext.Tagged = mbUseTaggedPDF; -//values used in viewer + // values used in viewer aContext.HideViewerToolbar = mbHideViewerToolbar; aContext.HideViewerMenubar = mbHideViewerMenubar; aContext.HideViewerWindowControls = mbHideViewerWindowControls; @@ -645,26 +642,25 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >& aContext.FirstPageLeft = mbFirstPageLeft; -//check if PDF/A, which does not allow encryption + // check if PDF/A, which does not allow encryption if( aContext.Version != vcl::PDFWriter::PDF_A_1 ) { -//set values needed in encryption -//set encryption level, fixed, but here it can set by the UI if needed. -// true is 128 bit, false 40 -//note that in 40 bit mode the UI needs reworking, since the current UI is meaningfull only for -//128bit security mode + // set values needed in encryption + // set encryption level, fixed, but here it can set by the UI if needed. + // true is 128 bit, false 40 + // note that in 40 bit mode the UI needs reworking, since the current UI is meaningfull only for + // 128bit security mode aContext.Encryption.Security128bit = true; -//set check for permission change password -// if not enabled and no permission password, force permissions to default as if PDF where without encryption + // set check for permission change password + // if not enabled and no permission password, force permissions to default as if PDF where without encryption if( mbRestrictPermissions && (xEnc.is() || !aPermissionPassword.isEmpty()) ) { - mbEncrypt = true; -//permission set as desired, done after + mbEncrypt = true; // permission set as desired, done after } else { -//force permission to default + // force permission to default mnPrintAllowed = 2 ; mnChangesAllowed = 4 ; mbCanCopyOrExtract = true; @@ -673,7 +669,7 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >& switch( mnPrintAllowed ) { - case 0: //initialized when aContext is build, means no printing + case 0: // initialized when aContext is build, means no printing break; default: case 2: @@ -685,7 +681,7 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >& switch( mnChangesAllowed ) { - case 0: //already in struct PDFSecPermissions CTOR + case 0: // already in struct PDFSecPermissions CTOR break; case 1: aContext.Encryption.CanAssemble = true; @@ -740,41 +736,42 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >& } aContext.AllowDuplicateFieldNames = mbAllowDuplicateFieldNames; - //get model + // get model Reference< frame::XModel > xModel( mxSrcDoc, UNO_QUERY ); { -//---> i56629 Relative link stuff -//set the base URL of the file: -//then base URL + // #i56629: Relative link stuff + // set the base URL of the file: then base URL aContext.BaseURL = xModel->getURL(); -//relative link option is private to PDF Export filter and limited to local filesystem only + // relative link option is private to PDF Export filter and limited to local filesystem only aContext.RelFsys = mbExportRelativeFsysLinks; -//determine the default acton for PDF links + // determine the default acton for PDF links switch( mnDefaultLinkAction ) { default: -//default: URI, without fragment conversion (the bookmark in PDF may not work) + // default: URI, without fragment conversion (the bookmark in PDF may not work) case 0: aContext.DefaultLinkAction = vcl::PDFWriter::URIAction; break; -//view PDF through the reader application case 1: + // view PDF through the reader application aContext.ForcePDFAction = true; aContext.DefaultLinkAction = vcl::PDFWriter::LaunchAction; break; -//view PDF through an Internet browser case 2: + // view PDF through an Internet browser aContext.DefaultLinkAction = vcl::PDFWriter::URIActionDestination; break; } aContext.ConvertOOoTargetToPDFTarget = mbConvertOOoTargetToPDFTarget; -// check for Link Launch action, not allowed on PDF/A-1 -// this code chunk checks when the filter is called from scripting + + // check for Link Launch action, not allowed on PDF/A-1 + // this code chunk checks when the filter is called from scripting if( aContext.Version == vcl::PDFWriter::PDF_A_1 && aContext.DefaultLinkAction == vcl::PDFWriter::LaunchAction ) - { //force the similar allowed URI action + { + // force the similar allowed URI action aContext.DefaultLinkAction = vcl::PDFWriter::URIActionDestination; - //and remove the remote goto action forced on PDF file + // and remove the remote goto action forced on PDF file aContext.ForcePDFAction = false; } } @@ -787,7 +784,7 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >& aContext.SignCertificate = maSignCertificate; aContext.SignTSA = msSignTSA; -// all context data set, time to create the printing device + // all context data set, time to create the printing device std::unique_ptr<vcl::PDFWriter> pPDFWriter(new vcl::PDFWriter( aContext, xEnc )); OutputDevice* pOut = pPDFWriter->GetReferenceDevice(); @@ -852,7 +849,7 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >& if ( aCreator == "Writer" ) { - //i92835 if Writer is in web layout mode this has to be switched to normal view and back to web view in the end + // #i92835: if Writer is in web layout mode this has to be switched to normal view and back to web view in the end try { Reference< view::XViewSettingsSupplier > xVSettingsSupplier( xModel->getCurrentController(), uno::UNO_QUERY_THROW ); @@ -880,9 +877,9 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >& if ( mbExportNotesPages && aCreator == "Impress" ) { - uno::Reference< drawing::XShapes > xShapes; // sj: do not allow to export notes when - if ( ! ( aSelection >>= xShapes ) ) // exporting a selection -> todo: in the dialog - bSecondPassForImpressNotes = true; // the export notes checkbox needs to be disabled + uno::Reference< drawing::XShapes > xShapes; // do not allow to export notes when exporting a selection + if ( ! ( aSelection >>= xShapes ) ) // TODO: in the dialog the export notes checkbox needs to be disabled + bSecondPassForImpressNotes = true; } if( aPageRange.isEmpty() ) @@ -958,6 +955,7 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >& return bRet; } + namespace { @@ -975,12 +973,14 @@ public: virtual uno::Sequence< uno::Reference< task::XInteractionContinuation > > SAL_CALL getContinuations() throw (uno::RuntimeException, std::exception) override; }; + PDFErrorRequest::PDFErrorRequest( const task::PDFExportException& i_rExc ) : PDFErrorRequestBase( m_aMutex ), maExc( i_rExc ) { } + uno::Any SAL_CALL PDFErrorRequest::getRequest() throw (uno::RuntimeException, std::exception) { osl::MutexGuard const guard( m_aMutex ); @@ -990,12 +990,14 @@ uno::Any SAL_CALL PDFErrorRequest::getRequest() throw (uno::RuntimeException, st return aRet; } + uno::Sequence< uno::Reference< task::XInteractionContinuation > > SAL_CALL PDFErrorRequest::getContinuations() throw (uno::RuntimeException, std::exception) { return uno::Sequence< uno::Reference< task::XInteractionContinuation > >(); } -} // namespace +} // end anonymous namespace + void PDFExport::showErrors( const std::set< vcl::PDFWriter::ErrorCode >& rErrors ) { @@ -1009,7 +1011,6 @@ void PDFExport::showErrors( const std::set< vcl::PDFWriter::ErrorCode >& rErrors } - bool PDFExport::ImplExportPage( vcl::PDFWriter& rWriter, vcl::PDFExtOutDevData& rPDFExtOutDevData, const GDIMetaFile& rMtf ) { const Size aSizePDF( OutputDevice::LogicToLogic( rMtf.GetPrefSize(), rMtf.GetPrefMapMode(), MAP_POINT ) ); @@ -1051,7 +1052,6 @@ bool PDFExport::ImplExportPage( vcl::PDFWriter& rWriter, vcl::PDFExtOutDevData& } - void PDFExport::ImplWriteWatermark( vcl::PDFWriter& rWriter, const Size& rPageSize ) { vcl::Font aFont( OUString( "Helvetica" ), Size( 0, 3*rPageSize.Height()/4 ) ); @@ -1119,5 +1119,4 @@ void PDFExport::ImplWriteWatermark( vcl::PDFWriter& rWriter, const Size& rPageSi rWriter.Pop(); } - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/pdf/pdfexport.hxx b/filter/source/pdf/pdfexport.hxx index cdba3a6215d8..688ccadd86a4 100644 --- a/filter/source/pdf/pdfexport.hxx +++ b/filter/source/pdf/pdfexport.hxx @@ -32,9 +32,6 @@ class Size; namespace vcl { class PDFWriter; } -// - PDFExport - - - class PDFExport { private: @@ -45,31 +42,31 @@ private: Reference< task::XInteractionHandler > mxIH; bool mbUseTaggedPDF; - sal_Int32 mnPDFTypeSelection; + sal_Int32 mnPDFTypeSelection; bool mbExportNotes; bool mbViewPDF; bool mbExportNotesPages; bool mbUseTransitionEffects; bool mbExportBookmarks; bool mbExportHiddenSlides; - sal_Int32 mnOpenBookmarkLevels; + sal_Int32 mnOpenBookmarkLevels; bool mbUseLosslessCompression; bool mbReduceImageResolution; bool mbSkipEmptyPages; bool mbAddStream; - sal_Int32 mnMaxImageResolution; - sal_Int32 mnQuality; - sal_Int32 mnFormsFormat; + sal_Int32 mnMaxImageResolution; + sal_Int32 mnQuality; + sal_Int32 mnFormsFormat; bool mbExportFormFields; bool mbAllowDuplicateFieldNames; - sal_Int32 mnProgressValue; + sal_Int32 mnProgressValue; bool mbRemoveTransparencies; OUString msWatermark; -//these variable are here only to have a location in filter/pdf to set the default -//to be used by the macro (when the FilterData are set by the macro itself) + // these variable are here only to have a location in filter/pdf to set the default + // to be used by the macro (when the FilterData are set by the macro itself) bool mbHideViewerToolbar; bool mbHideViewerMenubar; bool mbHideViewerWindowControls; @@ -77,57 +74,58 @@ private: bool mbCenterWindow; bool mbOpenInFullScreenMode; bool mbDisplayPDFDocumentTitle; - sal_Int32 mnPDFDocumentMode; - sal_Int32 mnPDFDocumentAction; - sal_Int32 mnZoom; - sal_Int32 mnInitialPage; - sal_Int32 mnPDFPageLayout; + sal_Int32 mnPDFDocumentMode; + sal_Int32 mnPDFDocumentAction; + sal_Int32 mnZoom; + sal_Int32 mnInitialPage; + sal_Int32 mnPDFPageLayout; bool mbFirstPageLeft; bool mbEncrypt; bool mbRestrictPermissions; - sal_Int32 mnPrintAllowed; - sal_Int32 mnChangesAllowed; + sal_Int32 mnPrintAllowed; + sal_Int32 mnChangesAllowed; bool mbCanCopyOrExtract; bool mbCanExtractForAccessibility; -//--->i56629 + // #i56629 bool mbExportRelativeFsysLinks; - sal_Int32 mnDefaultLinkAction; + sal_Int32 mnDefaultLinkAction; bool mbConvertOOoTargetToPDFTarget; bool mbExportBmkToDest; bool ImplExportPage( vcl::PDFWriter& rWriter, vcl::PDFExtOutDevData& rPDFExtOutDevData, - const GDIMetaFile& rMtf ); + const GDIMetaFile& rMtf ); bool mbSignPDF; - OUString msSignLocation; - OUString msSignContact; - OUString msSignReason; - OUString msSignPassword; + OUString msSignLocation; + OUString msSignContact; + OUString msSignReason; + OUString msSignPassword; Reference< security::XCertificate > maSignCertificate; - OUString msSignTSA; + OUString msSignTSA; + + void ImplWriteWatermark( vcl::PDFWriter& rWriter, const Size& rPageSize ); - void ImplWriteWatermark( vcl::PDFWriter& rWriter, const Size& rPageSize ); public: - PDFExport( const Reference< XComponent >& rxSrcDoc, - const Reference< task::XStatusIndicator >& xStatusIndicator, - const Reference< task::XInteractionHandler >& xIH, - const Reference< uno::XComponentContext >& xFact ); - ~PDFExport(); + PDFExport( const Reference< XComponent >& rxSrcDoc, + const Reference< task::XStatusIndicator >& xStatusIndicator, + const Reference< task::XInteractionHandler >& xIH, + const Reference< uno::XComponentContext >& xFact ); + ~PDFExport(); bool ExportSelection( vcl::PDFWriter& rPDFWriter, - Reference< css::view::XRenderable >& rRenderable, - const Any& rSelection, - const StringRangeEnumerator& rRangeEnum, - Sequence< PropertyValue >& rRenderOptions, - sal_Int32 nPageCount ); + Reference< css::view::XRenderable >& rRenderable, + const Any& rSelection, + const StringRangeEnumerator& rRangeEnum, + Sequence< PropertyValue >& rRenderOptions, + sal_Int32 nPageCount ); bool Export( const OUString& rFile, const Sequence< PropertyValue >& rFilterData ); - void showErrors( const std::set<vcl::PDFWriter::ErrorCode>& ); + void showErrors( const std::set<vcl::PDFWriter::ErrorCode>& ); }; -#endif +#endif // INCLUDED_FILTER_SOURCE_PDF_PDFEXPORT_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/pdf/pdffilter.cxx b/filter/source/pdf/pdffilter.cxx index 6d24356ff934..e587ba12d152 100644 --- a/filter/source/pdf/pdffilter.cxx +++ b/filter/source/pdf/pdffilter.cxx @@ -26,16 +26,18 @@ #include <vcl/FilterConfigItem.hxx> #include <memory> -// - PDFFilter - + PDFFilter::PDFFilter( const Reference< XComponentContext > &rxContext ) : mxContext( rxContext ) { } + PDFFilter::~PDFFilter() { } + bool PDFFilter::implExport( const Sequence< PropertyValue >& rDescriptor ) { Reference< XOutputStream > xOStm; @@ -59,7 +61,7 @@ bool PDFFilter::implExport( const Sequence< PropertyValue >& rDescriptor ) } /* we don't get FilterData if we are exporting directly - to pdf, but we have to use the last user settings (especially for the CompressMode) */ + to pdf, but we have to use the last user settings (especially for the CompressMode) */ if ( !aFilterData.getLength() ) { FilterConfigItem aCfgItem( "Office.Common/Filter/PDF/Export/" ); @@ -87,12 +89,12 @@ bool PDFFilter::implExport( const Sequence< PropertyValue >& rDescriptor ) aCfgItem.ReadInt32( "PageLayout", 0 ); aCfgItem.ReadBool( "FirstPageOnLeft", false ); aCfgItem.ReadBool( "IsAddStream", false ); -// -// the encryption is not available when exporting directly, since the encryption is off by default and the selection -// (encrypt or not) is not persistent; it's available through macro though, -// provided the correct property values are set, see help -// -// now, the relative link stuff + + // the encryption is not available when exporting directly, since the encryption is off by default and the selection + // (encrypt or not) is not persistent; it's available through macro though, + // provided the correct property values are set, see help + + // now, the relative link stuff aCfgItem.ReadBool( "ExportLinksRelativeFsys", false ); aCfgItem.ReadInt32("PDFViewSelection", 0 ); aCfgItem.ReadBool( "ConvertOOoTargetToPDFTarget", false ); @@ -103,6 +105,7 @@ bool PDFFilter::implExport( const Sequence< PropertyValue >& rDescriptor ) aCfgItem.ReadInt32( "OpenBookmarkLevels", -1 ); aFilterData = aCfgItem.GetFilterData(); } + if( mxSrcDoc.is() && xOStm.is() ) { PDFExport aExport( mxSrcDoc, xStatusIndicator, xIH, mxContext ); @@ -131,7 +134,10 @@ bool PDFFilter::implExport( const Sequence< PropertyValue >& rDescriptor ) class FocusWindowWaitCursor { +private: + VclPtr<vcl::Window> m_pFocusWindow; + public: FocusWindowWaitCursor() : m_pFocusWindow( Application::GetFocusWindow() ) @@ -142,6 +148,7 @@ public: m_pFocusWindow->EnterWait(); } } + ~FocusWindowWaitCursor() { if( m_pFocusWindow ) @@ -154,12 +161,14 @@ public: DECL_LINK_TYPED( DestroyedLink, VclWindowEvent&, void ); }; + IMPL_LINK_TYPED( FocusWindowWaitCursor, DestroyedLink, VclWindowEvent&, rEvent, void ) { if( rEvent.GetId() == VCLEVENT_OBJECT_DYING ) m_pFocusWindow = nullptr; } + sal_Bool SAL_CALL PDFFilter::filter( const Sequence< PropertyValue >& rDescriptor ) throw (RuntimeException, std::exception) { @@ -171,13 +180,11 @@ sal_Bool SAL_CALL PDFFilter::filter( const Sequence< PropertyValue >& rDescripto } - void SAL_CALL PDFFilter::cancel( ) throw (RuntimeException, std::exception) { } - void SAL_CALL PDFFilter::setSourceDocument( const Reference< XComponent >& xDoc ) throw (IllegalArgumentException, RuntimeException, std::exception) { @@ -185,31 +192,32 @@ void SAL_CALL PDFFilter::setSourceDocument( const Reference< XComponent >& xDoc } - void SAL_CALL PDFFilter::initialize( const css::uno::Sequence< css::uno::Any >& ) throw (Exception, RuntimeException, std::exception) { } + OUString PDFFilter_getImplementationName () throw (RuntimeException) { return OUString ( "com.sun.star.comp.PDF.PDFFilter" ); } + Sequence< OUString > SAL_CALL PDFFilter_getSupportedServiceNames( ) throw (RuntimeException) { Sequence<OUString> aRet { "com.sun.star.document.PDFFilter" }; return aRet; } + Reference< XInterface > SAL_CALL PDFFilter_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw( Exception ) { return static_cast<cppu::OWeakObject*>(new PDFFilter( comphelper::getComponentContext(rSMgr) )); } - OUString SAL_CALL PDFFilter::getImplementationName() throw (RuntimeException, std::exception) { @@ -217,7 +225,6 @@ OUString SAL_CALL PDFFilter::getImplementationName() } - sal_Bool SAL_CALL PDFFilter::supportsService( const OUString& rServiceName ) throw (RuntimeException, std::exception) { @@ -225,7 +232,6 @@ sal_Bool SAL_CALL PDFFilter::supportsService( const OUString& rServiceName ) } - css::uno::Sequence< OUString > SAL_CALL PDFFilter::getSupportedServiceNames( ) throw (RuntimeException, std::exception) { return PDFFilter_getSupportedServiceNames(); diff --git a/filter/source/pdf/pdffilter.hxx b/filter/source/pdf/pdffilter.hxx index 637fb3937b99..df52a406932e 100644 --- a/filter/source/pdf/pdffilter.hxx +++ b/filter/source/pdf/pdffilter.hxx @@ -49,18 +49,12 @@ using namespace ::com::sun::star::document; using namespace ::com::sun::star::io; -// - PDFFilter - - - -class PDFFilter : public cppu::WeakImplHelper < XFilter, - XExporter, - XInitialization, - XServiceInfo > +class PDFFilter : public cppu::WeakImplHelper < XFilter, XExporter, XInitialization, XServiceInfo > { private: - Reference< XComponentContext > mxContext; - Reference< XComponent > mxSrcDoc; + Reference< XComponentContext > mxContext; + Reference< XComponent > mxSrcDoc; bool implExport( const Sequence< PropertyValue >& rDescriptor ); @@ -88,22 +82,18 @@ public: }; - OUString PDFFilter_getImplementationName () throw ( RuntimeException ); - bool SAL_CALL PDFFilter_supportsService( const OUString& ServiceName ) throw ( RuntimeException ); - Sequence< OUString > SAL_CALL PDFFilter_getSupportedServiceNames( ) throw ( RuntimeException ); - Reference< XInterface > SAL_CALL PDFFilter_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw ( Exception ); diff --git a/filter/source/pdf/pdfinteract.cxx b/filter/source/pdf/pdfinteract.cxx index bae82a81d3ab..28c69e7437a2 100644 --- a/filter/source/pdf/pdfinteract.cxx +++ b/filter/source/pdf/pdfinteract.cxx @@ -25,21 +25,24 @@ #include "com/sun/star/task/PDFExportException.hpp" #include <cppuhelper/supportsservice.hxx> -// - PDFInteractionHandler - + PDFInteractionHandler::PDFInteractionHandler() { } + PDFInteractionHandler::~PDFInteractionHandler() { } + void SAL_CALL PDFInteractionHandler::handle( const Reference< task::XInteractionRequest >& i_xRequest ) throw (RuntimeException, std::exception) { handleInteractionRequest( i_xRequest ); } + sal_Bool SAL_CALL PDFInteractionHandler::handleInteractionRequest( const Reference< task::XInteractionRequest >& i_xRequest ) throw (RuntimeException, std::exception) { @@ -60,35 +63,41 @@ sal_Bool SAL_CALL PDFInteractionHandler::handleInteractionRequest( const Referen return bHandled; } + OUString PDFInteractionHandler_getImplementationName () throw (RuntimeException) { return OUString ( "com.sun.star.comp.PDF.PDFExportInteractionHandler" ); } + Sequence< OUString > SAL_CALL PDFInteractionHandler_getSupportedServiceNames( ) throw (RuntimeException) { Sequence<OUString> aRet { "com.sun.star.filter.pdfexport.PDFExportInteractionHandler" }; return aRet; } + Reference< XInterface > SAL_CALL PDFInteractionHandler_createInstance( const Reference< XMultiServiceFactory > & ) throw( Exception ) { return static_cast<cppu::OWeakObject*>(new PDFInteractionHandler); } + OUString SAL_CALL PDFInteractionHandler::getImplementationName() throw (RuntimeException, std::exception) { return PDFInteractionHandler_getImplementationName(); } + sal_Bool SAL_CALL PDFInteractionHandler::supportsService( const OUString& rServiceName ) throw (RuntimeException, std::exception) { return cppu::supportsService( this, rServiceName ); } + css::uno::Sequence< OUString > SAL_CALL PDFInteractionHandler::getSupportedServiceNames( ) throw (RuntimeException, std::exception) { return PDFInteractionHandler_getSupportedServiceNames(); diff --git a/filter/source/pdf/pdfinteract.hxx b/filter/source/pdf/pdfinteract.hxx index 99a80cca3be0..fe4a600260c5 100644 --- a/filter/source/pdf/pdfinteract.hxx +++ b/filter/source/pdf/pdfinteract.hxx @@ -20,19 +20,17 @@ #ifndef INCLUDED_FILTER_SOURCE_PDF_PDFINTERACT_HXX #define INCLUDED_FILTER_SOURCE_PDF_PDFINTERACT_HXX -#include "com/sun/star/lang/XServiceInfo.hpp" #include <cppuhelper/implbase.hxx> -#include "com/sun/star/lang/XMultiServiceFactory.hpp" -#include "com/sun/star/task/XInteractionHandler2.hpp" + +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/task/XInteractionHandler2.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; -// - PDFFilter - - - class PDFInteractionHandler : public cppu::WeakImplHelper < task::XInteractionHandler2, XServiceInfo > { @@ -47,6 +45,7 @@ protected: // XIniteractionHandler2 virtual sal_Bool SAL_CALL handleInteractionRequest( const Reference< task::XInteractionRequest >& ) throw(RuntimeException, std::exception) override; + public: PDFInteractionHandler(); @@ -54,22 +53,18 @@ public: }; - OUString PDFInteractionHandler_getImplementationName () throw ( RuntimeException ); - bool SAL_CALL PDFInteractionHandler_supportsService( const OUString& ServiceName ) throw ( RuntimeException ); - Sequence< OUString > SAL_CALL PDFInteractionHandler_getSupportedServiceNames( ) throw ( RuntimeException ); - Reference< XInterface > SAL_CALL PDFInteractionHandler_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw ( Exception ); diff --git a/filter/source/svg/impsvgdialog.cxx b/filter/source/svg/impsvgdialog.cxx index 98be90cb3290..592ed457421a 100644 --- a/filter/source/svg/impsvgdialog.cxx +++ b/filter/source/svg/impsvgdialog.cxx @@ -19,21 +19,19 @@ #include "impsvgdialog.hxx" + #include <cstdio> using namespace com::sun::star::uno; using namespace com::sun::star::beans; + inline sal_Int32 implMap( vcl::Window& /*rWnd*/, sal_Int32 nVal ) { - //return( rWnd.LogicToLogic( Size( nVal, nVal ) ).Height(), MAP_APPFONT, MAP_APPFONT ); return( nVal << 1 ); } -// - ImpSVGDialog - - - ImpSVGDialog::ImpSVGDialog( vcl::Window* pParent, Sequence< PropertyValue >& rFilterData ) : ModalDialog( pParent ), maFI( VclPtr<FixedLine>::Create(this) ), @@ -91,12 +89,12 @@ ImpSVGDialog::ImpSVGDialog( vcl::Window* pParent, Sequence< PropertyValue >& rFi } - ImpSVGDialog::~ImpSVGDialog() { disposeOnce(); } + void ImpSVGDialog::dispose() { maFI.disposeAndClear(); @@ -111,7 +109,6 @@ void ImpSVGDialog::dispose() } - Sequence< PropertyValue > ImpSVGDialog::GetFilterData() { maConfigItem.WriteBool( SVG_PROP_TINYPROFILE, maCBTinyProfile->IsChecked() ); @@ -122,7 +119,6 @@ Sequence< PropertyValue > ImpSVGDialog::GetFilterData() } - IMPL_LINK_TYPED( ImpSVGDialog, OnToggleCheckbox, CheckBox&, rBox, void ) { if( &rBox == maCBTinyProfile.get() ) diff --git a/filter/source/svg/impsvgdialog.hxx b/filter/source/svg/impsvgdialog.hxx index 2d7be2ff33e6..d3a7b31f42bc 100644 --- a/filter/source/svg/impsvgdialog.hxx +++ b/filter/source/svg/impsvgdialog.hxx @@ -20,15 +20,15 @@ #ifndef INCLUDED_FILTER_SOURCE_SVG_IMPSVGDIALOG_HXX #define INCLUDED_FILTER_SOURCE_SVG_IMPSVGDIALOG_HXX -#include <com/sun/star/uno/Sequence.h> -#include <com/sun/star/beans/PropertyValue.hpp> - #include <vcl/dialog.hxx> #include <vcl/button.hxx> #include <vcl/fixed.hxx> #include <vcl/field.hxx> -#include <svtools/stdctrl.hxx> #include <vcl/FilterConfigItem.hxx> +#include <svtools/stdctrl.hxx> + +#include <com/sun/star/uno/Sequence.h> +#include <com/sun/star/beans/PropertyValue.hpp> #define SVG_EXPORTFILTER_CONFIGPATH "Office.Common/Filter/SVG/Export/" #define SVG_PROP_TINYPROFILE "TinyMode" @@ -38,12 +38,10 @@ #define SVG_PROP_POSITIONED_CHARACTERS "UsePositionedCharacters" -// - ImpSVGDialog - - - class ResMgr; namespace vcl { class Window; } + class ImpSVGDialog : public ModalDialog { private: diff --git a/filter/source/svg/svgdialog.cxx b/filter/source/svg/svgdialog.cxx index c10f892e312b..1564a480d24e 100644 --- a/filter/source/svg/svgdialog.cxx +++ b/filter/source/svg/svgdialog.cxx @@ -42,15 +42,13 @@ using namespace ::com::sun::star::view; using namespace ::com::sun::star::document; -// - SVGDialog functions - - - OUString SVGDialog_getImplementationName () throw (RuntimeException) { return OUString ( SVG_DIALOG_IMPLEMENTATION_NAME ); } + Sequence< OUString > SAL_CALL SVGDialog_getSupportedServiceNames() throw (RuntimeException) { @@ -59,7 +57,6 @@ Sequence< OUString > SAL_CALL SVGDialog_getSupportedServiceNames() } - Reference< XInterface > SAL_CALL SVGDialog_createInstance( const Reference< XMultiServiceFactory > & rSMgr ) throw( Exception ) { @@ -67,22 +64,17 @@ Reference< XInterface > SAL_CALL SVGDialog_createInstance( const Reference< XMul } -// - SVGDialog - - - SVGDialog::SVGDialog( const Reference< XComponentContext > &rxContext ) : OGenericUnoDialog( rxContext ) { } - SVGDialog::~SVGDialog() { } - Any SAL_CALL SVGDialog::queryInterface( const Type& rType ) throw (RuntimeException, std::exception) { @@ -98,7 +90,6 @@ Any SAL_CALL SVGDialog::queryInterface( const Type& rType ) } - void SAL_CALL SVGDialog::acquire() throw () { @@ -106,7 +97,6 @@ void SAL_CALL SVGDialog::acquire() } - void SAL_CALL SVGDialog::release() throw () { @@ -114,7 +104,6 @@ void SAL_CALL SVGDialog::release() } - Sequence< sal_Int8 > SAL_CALL SVGDialog::getImplementationId() throw(RuntimeException, std::exception) { @@ -122,7 +111,6 @@ Sequence< sal_Int8 > SAL_CALL SVGDialog::getImplementationId() } - OUString SAL_CALL SVGDialog::getImplementationName() throw (RuntimeException, std::exception) { @@ -130,7 +118,6 @@ OUString SAL_CALL SVGDialog::getImplementationName() } - Sequence< OUString > SAL_CALL SVGDialog::getSupportedServiceNames() throw (RuntimeException, std::exception) { @@ -138,7 +125,6 @@ Sequence< OUString > SAL_CALL SVGDialog::getSupportedServiceNames() } - VclPtr<Dialog> SVGDialog::createDialog( vcl::Window* pParent ) { if( mxSrcDoc.is() ) @@ -148,7 +134,6 @@ VclPtr<Dialog> SVGDialog::createDialog( vcl::Window* pParent ) } - void SVGDialog::executedDialog( sal_Int16 nExecutionResult ) { if( nExecutionResult && m_pDialog ) @@ -158,7 +143,6 @@ void SVGDialog::executedDialog( sal_Int16 nExecutionResult ) } - Reference< XPropertySetInfo > SAL_CALL SVGDialog::getPropertySetInfo() throw(RuntimeException, std::exception) { @@ -182,7 +166,6 @@ Reference< XPropertySetInfo > SAL_CALL SVGDialog::getPropertySetInfo() } - Sequence< PropertyValue > SAL_CALL SVGDialog::getPropertyValues() throw ( RuntimeException, std::exception ) { @@ -206,7 +189,6 @@ Sequence< PropertyValue > SAL_CALL SVGDialog::getPropertyValues() } - void SAL_CALL SVGDialog::setPropertyValues( const Sequence< PropertyValue >& rProps ) throw ( UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException, std::exception ) { @@ -223,7 +205,6 @@ void SAL_CALL SVGDialog::setPropertyValues( const Sequence< PropertyValue >& rPr } - void SAL_CALL SVGDialog::setSourceDocument( const Reference< XComponent >& xDoc ) throw(IllegalArgumentException, RuntimeException, std::exception) { diff --git a/filter/source/svg/svgdialog.hxx b/filter/source/svg/svgdialog.hxx index 1f1553d71880..0dad0f74ad19 100644 --- a/filter/source/svg/svgdialog.hxx +++ b/filter/source/svg/svgdialog.hxx @@ -28,9 +28,6 @@ #include <memory> -// - SVGDialog - - - class ResMgr; class SVGDialog : public ::svt::OGenericUnoDialog, @@ -77,26 +74,22 @@ public: }; - OUString SVGDialog_getImplementationName () throw ( css::uno::RuntimeException ); - bool SAL_CALL SVGDialog_supportsService( const OUString& ServiceName ) throw ( css::uno::RuntimeException ); - css::uno::Sequence< OUString > SAL_CALL SVGDialog_getSupportedServiceNames( ) throw ( css::uno::RuntimeException ); - css::uno::Reference< css::uno::XInterface > SAL_CALL SVGDialog_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory > & rSMgr) throw ( css::uno::Exception ); -#endif // SVGDialog_HXX +#endif // INCLUDED_FILTER_SOURCE_SVG_SVGDIALOG_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx index ce4aeecfacfb..7caf71d94b57 100644 --- a/filter/source/svg/svgexport.cxx +++ b/filter/source/svg/svgexport.cxx @@ -59,7 +59,6 @@ using namespace ::xmloff::token; // - ooo elements and attributes - - #define NSPREFIX "ooo:" // ooo xml elements @@ -99,13 +98,9 @@ static const char aOOOAttrTextAdjust[] = NSPREFIX "text-adjust"; static const char constSvgNamespace[] = "http://www.w3.org/2000/svg"; - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * - Text Field Class Hierarchy - * - * * - * This is a set of classes for exporting text field meta info. * - * * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/** Text Field Class Hierarchy + This is a set of classes for exporting text field meta info. + */ class TextField { @@ -145,6 +140,7 @@ protected: } }; + class FixedTextField : public TextField { public: @@ -171,6 +167,7 @@ public: virtual ~FixedTextField() {} }; + class FixedDateTimeField : public FixedTextField { public: @@ -186,6 +183,7 @@ public: virtual ~FixedDateTimeField() {} }; + class FooterField : public FixedTextField { public: @@ -202,6 +200,7 @@ public: virtual ~FooterField() {} }; + class VariableTextField : public TextField { public: @@ -212,6 +211,7 @@ public: virtual ~VariableTextField() {} }; + class VariableDateTimeField : public VariableTextField { public: @@ -310,17 +310,13 @@ public: virtual ~VariableDateTimeField() {} }; + bool operator==( const TextField & aLhsTextField, const TextField & aRhsTextField ) { return aLhsTextField.equalTo( aRhsTextField ); } - - -// - SVGExport - - - SVGExport::SVGExport( const css::uno::Reference< css::uno::XComponentContext >& rContext, const Reference< XDocumentHandler >& rxHandler, @@ -379,23 +375,18 @@ SVGExport::SVGExport( } - SVGExport::~SVGExport() { GetDocHandler()->endDocument(); } -// - ObjectRepresentation - - - ObjectRepresentation::ObjectRepresentation() : mpMtf( nullptr ) { } - ObjectRepresentation::ObjectRepresentation( const Reference< XInterface >& rxObject, const GDIMetaFile& rMtf ) : mxObject( rxObject ), @@ -404,7 +395,6 @@ ObjectRepresentation::ObjectRepresentation( const Reference< XInterface >& rxObj } - ObjectRepresentation::ObjectRepresentation( const ObjectRepresentation& rPresentation ) : mxObject( rPresentation.mxObject ), mpMtf( rPresentation.mpMtf ? new GDIMetaFile( *rPresentation.mpMtf ) : nullptr ) @@ -412,14 +402,12 @@ ObjectRepresentation::ObjectRepresentation( const ObjectRepresentation& rPresent } - ObjectRepresentation::~ObjectRepresentation() { delete mpMtf; } - ObjectRepresentation& ObjectRepresentation::operator=( const ObjectRepresentation& rPresentation ) { // Check for self-assignment @@ -432,7 +420,6 @@ ObjectRepresentation& ObjectRepresentation::operator=( const ObjectRepresentatio } - namespace { @@ -466,7 +453,8 @@ BitmapChecksum GetBitmapChecksum( const MetaAction* pAction ) return nChecksum; } -} +} // end anonymous namespace + void MetaBitmapActionGetPoint( const MetaAction* pAction, Point& rPt ) { @@ -497,7 +485,6 @@ void MetaBitmapActionGetPoint( const MetaAction* pAction, Point& rPt ) } - size_t HashBitmap::operator()( const ObjectRepresentation& rObjRep ) const { const GDIMetaFile& aMtf = rObjRep.GetRepresentation(); @@ -513,7 +500,6 @@ size_t HashBitmap::operator()( const ObjectRepresentation& rObjRep ) const } - bool EqualityBitmap::operator()( const ObjectRepresentation& rObjRep1, const ObjectRepresentation& rObjRep2 ) const { @@ -533,19 +519,15 @@ bool EqualityBitmap::operator()( const ObjectRepresentation& rObjRep1, } - -// - SVGFilter - - - bool SVGFilter::implExport( const Sequence< PropertyValue >& rDescriptor ) throw (RuntimeException, std::exception) { - Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ) ; - Reference< XOutputStream > xOStm; - std::unique_ptr<SvStream> pOStm; - sal_Int32 nLength = rDescriptor.getLength(); - const PropertyValue* pValue = rDescriptor.getConstArray(); - bool bRet = false; + Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ) ; + Reference< XOutputStream > xOStm; + std::unique_ptr<SvStream> pOStm; + sal_Int32 nLength = rDescriptor.getLength(); + const PropertyValue* pValue = rDescriptor.getConstArray(); + bool bRet = false; maFilterData.realloc( 0 ); @@ -628,11 +610,11 @@ bool SVGFilter::implExport( const Sequence< PropertyValue >& rDescriptor ) if( mpSdrModel ) { - //fdo#62682 The maNewFieldHdl can end up getting copied - //into various other outliners which live past this - //method, so get the full list of outliners and restore - //the maOldFieldHdl for all that have ended up using - //maNewFieldHdl + // fdo#62682 The maNewFieldHdl can end up getting copied + // into various other outliners which live past this + // method, so get the full list of outliners and restore + // the maOldFieldHdl for all that have ended up using + // maNewFieldHdl std::vector<SdrOutliner*> aOutliners(mpSdrModel->GetActiveOutliners()); for (auto aIter = aOutliners.begin(); aIter != aOutliners.end(); ++aIter) { @@ -655,7 +637,6 @@ bool SVGFilter::implExport( const Sequence< PropertyValue >& rDescriptor ) } - Reference< XWriter > SVGFilter::implCreateExportDocumentHandler( const Reference< XOutputStream >& rxOStm ) { Reference< XWriter > xSaxWriter; @@ -670,7 +651,6 @@ Reference< XWriter > SVGFilter::implCreateExportDocumentHandler( const Reference } - bool SVGFilter::implLookForFirstVisiblePage() { sal_Int32 nCurPage = 0, nLastPage = mSelectedPages.getLength() - 1; @@ -916,11 +896,7 @@ bool SVGFilter::implExportDocument() } - -// Append aField to aFieldSet if it is not already present in the set -// and create the field id sFieldId - - +/// Append aField to aFieldSet if it is not already present in the set and create the field id sFieldId template< typename TextFieldType > OUString implGenerateFieldId( std::vector< TextField* > & aFieldSet, const TextFieldType & aField, @@ -949,7 +925,6 @@ OUString implGenerateFieldId( std::vector< TextField* > & aFieldSet, } - void SVGFilter::implGenerateMetaData() { sal_Int32 nCount = mSelectedPages.getLength(); @@ -967,11 +942,8 @@ void SVGFilter::implGenerateMetaData() mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrUsePositionedChars, "true" ); } - /* - * Add a (global) Page Numbering Type attribute for the document - */ - // NOTE: - // at present pSdrModel->GetPageNumType() returns always SVX_ARABIC + // Add a (global) Page Numbering Type attribute for the document + // NOTE: at present pSdrModel->GetPageNumType() returns always SVX_ARABIC // so the following code fragment is pretty unuseful sal_Int32 nPageNumberingType = SVX_ARABIC; SvxDrawPage* pSvxDrawPage = SvxDrawPage::getImplementation( mSelectedPages[0] ); @@ -1001,10 +973,10 @@ void SVGFilter::implGenerateMetaData() case SVX_ROMAN_LOWER: sNumberingType = "roman-lower"; break; - // arabic numbering type is the default, so we do not append any attribute for it case SVX_ARABIC: - // in case the numbering type is not handled we fall back on arabic numbering + // arabic numbering type is the default, so we do not append any attribute for it default: + // in case the numbering type is not handled we fall back on arabic numbering break; } if( !sNumberingType.isEmpty() ) @@ -1069,18 +1041,15 @@ void SVGFilter::implGenerateMetaData() bool bDateTimeVisibility = true; // default: visible bool bFooterVisibility = true; // default: visible - /* - * Page Number Field - */ + // Page Number Field xPropSet->getPropertyValue( "IsPageNumberVisible" ) >>= bPageNumberVisibility; bPageNumberVisibility = bPageNumberVisibility && ( nPageNumberingType != SVX_NUMBER_NONE ); if( bPageNumberVisibility ) // visibility default value: 'hidden' { mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrPageNumberVisibility, "visible" ); } - /* - * Date/Time Field - */ + + // Date/Time Field xPropSet->getPropertyValue( "IsDateTimeVisible" ) >>= bDateTimeVisibility; if( bDateTimeVisibility ) // visibility default value: 'visible' { @@ -1106,9 +1075,8 @@ void SVGFilter::implGenerateMetaData() { mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrDateTimeVisibility, "hidden" ); } - /* - * Footer Field - */ + + // Footer Field xPropSet->getPropertyValue( "IsFooterVisible" ) >>= bFooterVisibility; if( bFooterVisibility ) // visibility default value: 'visible' { @@ -1167,6 +1135,7 @@ void SVGFilter::implGenerateMetaData() } } } + // text fields are used only for generating meta info so we don't need them anymore for( size_t i = 0; i < aFieldSet.size(); ++i ) { @@ -1180,7 +1149,6 @@ void SVGFilter::implGenerateMetaData() } - void SVGFilter::implExportAnimations() { mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", "presentation-animations" ); @@ -1241,7 +1209,6 @@ void SVGFilter::implExportAnimations() } - void SVGFilter::implExportTextShapeIndex() { mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", "TextShapeIndex" ); @@ -1267,7 +1234,6 @@ void SVGFilter::implExportTextShapeIndex() } - void SVGFilter::implEmbedBulletGlyphs() { mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", "EmbeddedBulletChars" ); @@ -1296,7 +1262,6 @@ void SVGFilter::implEmbedBulletGlyphs() } - void SVGFilter::implEmbedBulletGlyph( sal_Unicode cBullet, const OUString & sPathData ) { OUString sId = "bullet-char-template(" + OUString::number( (sal_Int32)cBullet ) + ")"; @@ -1315,10 +1280,9 @@ void SVGFilter::implEmbedBulletGlyph( sal_Unicode cBullet, const OUString & sPat } - /** SVGFilter::implExportTextEmbeddedBitmaps - * We export bitmaps embedded into text shapes, such as those used by list - * items with image style, only once in a specific <defs> element. + We export bitmaps embedded into text shapes, such as those used by list + items with image style, only once in a specific defs element. */ void SVGFilter::implExportTextEmbeddedBitmaps() { @@ -1384,7 +1348,6 @@ void SVGFilter::implExportTextEmbeddedBitmaps() } - #define SVGFILTER_EXPORT_SVGSCRIPT( z, n, aFragment ) \ xExtDocHandler->unknown( aFragment ## n ); @@ -1404,7 +1367,6 @@ void SVGFilter::implGenerateScript() } - Any SVGFilter::implSafeGetPagePropSet( const OUString & sPropertyName, const Reference< XPropertySet > & rxPropSet, const Reference< XPropertySetInfo > & rxPropSetInfo ) @@ -1418,13 +1380,8 @@ Any SVGFilter::implSafeGetPagePropSet( const OUString & sPropertyName, } - -/* SVGFilter::implGetPagePropSet - * - * We collect info on master page elements visibility, - * and placeholder text shape content. - * This method is used when exporting a single page - * as implGenerateMetaData is not invoked. +/** We collect info on master page elements visibility, and placeholder text shape content. + This method is used when exporting a single page as implGenerateMetaData is not invoked. */ void SVGFilter::implGetPagePropSet( const Reference< XDrawPage > & rxPage ) { @@ -1438,9 +1395,7 @@ void SVGFilter::implGetPagePropSet( const Reference< XDrawPage > & rxPage ) mVisiblePagePropSet.nDateTimeFormat = SVXDATEFORMAT_B; mVisiblePagePropSet.nPageNumberingType = SVX_ARABIC; - /* We collect info on master page elements visibility, - * and placeholder text shape content. - */ + // We collect info on master page elements visibility, and placeholder text shape content. Reference< XPropertySet > xPropSet( rxPage, UNO_QUERY ); if( xPropSet.is() ) { @@ -1476,8 +1431,6 @@ void SVGFilter::implGetPagePropSet( const Reference< XDrawPage > & rxPage ) } - - bool SVGFilter::implExportMasterPages( const std::vector< Reference< XDrawPage > > & rxPages, sal_Int32 nFirstPage, sal_Int32 nLastPage ) { @@ -1531,7 +1484,6 @@ bool SVGFilter::implExportMasterPages( const std::vector< Reference< XDrawPage > } - void SVGFilter::implExportDrawPages( const SVGFilter::XDrawPageSequence & rxPages, sal_Int32 nFirstPage, sal_Int32 nLastPage ) { @@ -1725,13 +1677,10 @@ bool SVGFilter::implExportPage( const OUString & sPageId, } - - -bool SVGFilter::implExportShapes( const Reference< XShapes >& rxShapes, - bool bMaster ) +bool SVGFilter::implExportShapes( const Reference< XShapes >& rxShapes, bool bMaster ) { Reference< XShape > xShape; - bool bRet = false; + bool bRet = false; for( sal_Int32 i = 0, nCount = rxShapes->getCount(); i < nCount; ++i ) { @@ -1746,11 +1695,10 @@ bool SVGFilter::implExportShapes( const Reference< XShapes >& rxShapes, -bool SVGFilter::implExportShape( const Reference< XShape >& rxShape, - bool bMaster ) +bool SVGFilter::implExportShape( const Reference< XShape >& rxShape, bool bMaster ) { - Reference< XPropertySet > xShapePropSet( rxShape, UNO_QUERY ); - bool bRet = false; + Reference< XPropertySet > xShapePropSet( rxShape, UNO_QUERY ); + bool bRet = false; if( xShapePropSet.is() ) { @@ -1923,7 +1871,6 @@ bool SVGFilter::implExportShape( const Reference< XShape >& rxShape, } - bool SVGFilter::implCreateObjects() { if (mbExportShapeSelection) @@ -2008,7 +1955,6 @@ bool SVGFilter::implCreateObjectsFromShapes( const Reference< XDrawPage > & rxPa } - bool SVGFilter::implCreateObjectsFromShape( const Reference< XDrawPage > & rxPage, const Reference< XShape >& rxShape ) { bool bRet = false; @@ -2126,7 +2072,6 @@ bool SVGFilter::implCreateObjectsFromShape( const Reference< XDrawPage > & rxPag } - void SVGFilter::implCreateObjectsFromBackground( const Reference< XDrawPage >& rxDrawPage ) { Reference< XGraphicExportFilter > xExporter = drawing::GraphicExportFilter::create( mxContext ); @@ -2152,7 +2097,6 @@ void SVGFilter::implCreateObjectsFromBackground( const Reference< XDrawPage >& r } - OUString SVGFilter::implGetClassFromShape( const Reference< XShape >& rxShape ) { OUString aRet; @@ -2183,7 +2127,6 @@ OUString SVGFilter::implGetClassFromShape( const Reference< XShape >& rxShape ) } - void SVGFilter::implRegisterInterface( const Reference< XInterface >& rxIf ) { if( rxIf.is() ) @@ -2191,14 +2134,12 @@ void SVGFilter::implRegisterInterface( const Reference< XInterface >& rxIf ) } - const OUString & SVGFilter::implGetValidIDFromInterface( const Reference< XInterface >& rxIf ) { return (mpSVGExport->getInterfaceToIdentifierMapper()).getIdentifier( rxIf ); } - OUString SVGFilter::implGetInterfaceName( const Reference< XInterface >& rxIf ) { Reference< XNamed > xNamed( rxIf, UNO_QUERY ); @@ -2211,7 +2152,6 @@ OUString SVGFilter::implGetInterfaceName( const Reference< XInterface >& rxIf ) } - IMPL_LINK_TYPED( SVGFilter, CalcFieldHdl, EditFieldInfo*, pInfo, void ) { bool bFieldProcessed = false; @@ -2398,7 +2338,6 @@ IMPL_LINK_TYPED( SVGFilter, CalcFieldHdl, EditFieldInfo*, pInfo, void ) } - void SVGExport::writeMtf( const GDIMetaFile& rMtf ) { const Size aSize( OutputDevice::LogicToLogic( rMtf.GetPrefSize(), rMtf.GetPrefMapMode(), MAP_MM ) ); diff --git a/filter/source/svg/svgfontexport.cxx b/filter/source/svg/svgfontexport.cxx index ebc5513cd7b3..121704a93738 100644 --- a/filter/source/svg/svgfontexport.cxx +++ b/filter/source/svg/svgfontexport.cxx @@ -22,7 +22,6 @@ #include "svgfilter.hxx" #include "svgwriter.hxx" - #include <vcl/unohelp.hxx> #include <vcl/font.hxx> #include <vcl/outdev.hxx> @@ -31,9 +30,6 @@ static const sal_Int32 nFontEM = 2048; -// - SVGFontExport - - - SVGFontExport::SVGFontExport( SVGExport& rExport, const ::std::vector< ObjectRepresentation >& rObjects ) : mrExport( rExport ), maObjects( rObjects ), @@ -42,13 +38,11 @@ SVGFontExport::SVGFontExport( SVGExport& rExport, const ::std::vector< ObjectRep } - SVGFontExport::~SVGFontExport() { } - SVGFontExport::GlyphSet& SVGFontExport::implGetGlyphSet( const vcl::Font& rFont ) { FontWeight eWeight( WEIGHT_NORMAL ); @@ -75,11 +69,10 @@ SVGFontExport::GlyphSet& SVGFontExport::implGetGlyphSet( const vcl::Font& rFont } - void SVGFontExport::implCollectGlyphs() { ScopedVclPtrInstance< VirtualDevice > pVDev; - ObjectVector::const_iterator aIter( maObjects.begin() ); + ObjectVector::const_iterator aIter( maObjects.begin() ); pVDev->EnableOutput( false ); @@ -176,7 +169,6 @@ void SVGFontExport::implCollectGlyphs() } - void SVGFontExport::implEmbedFont( const vcl::Font& rFont ) { if( mrExport.IsEmbedFonts() ) @@ -258,7 +250,6 @@ void SVGFontExport::implEmbedFont( const vcl::Font& rFont ) } - void SVGFontExport::implEmbedGlyph( OutputDevice& rOut, const OUString& rCellStr ) { tools::PolyPolygon aPolyPoly; @@ -293,7 +284,6 @@ void SVGFontExport::implEmbedGlyph( OutputDevice& rOut, const OUString& rCellStr } - void SVGFontExport::EmbedFonts() { implCollectGlyphs(); @@ -331,7 +321,6 @@ void SVGFontExport::EmbedFonts() } - OUString SVGFontExport::GetMappedFontName( const OUString& rFontName ) const { sal_Int32 nNextTokenPos( 0 ); diff --git a/filter/source/svg/svgfontexport.hxx b/filter/source/svg/svgfontexport.hxx index 771d565f173c..576e813696e2 100644 --- a/filter/source/svg/svgfontexport.hxx +++ b/filter/source/svg/svgfontexport.hxx @@ -31,10 +31,6 @@ #include <tools/fontenum.hxx> -// - SVGFontExport - - - - class ObjectRepresentation; class SVGExport; namespace vcl { class Font; } @@ -43,12 +39,12 @@ class OutputDevice; class SVGFontExport { - typedef ::std::vector< ObjectRepresentation > ObjectVector; + typedef ::std::vector< ObjectRepresentation > ObjectVector; typedef ::std::set< OUString, ::std::greater< OUString > > GlyphSet; - typedef ::std::map< FontItalic, GlyphSet > FontItalicMap; - typedef ::std::map< FontWeight, FontItalicMap > FontWeightMap; - typedef ::std::map< OUString, FontWeightMap > FontNameMap; - typedef FontNameMap GlyphTree; + typedef ::std::map< FontItalic, GlyphSet > FontItalicMap; + typedef ::std::map< FontWeight, FontItalicMap > FontWeightMap; + typedef ::std::map< OUString, FontWeightMap > FontNameMap; + typedef FontNameMap GlyphTree; private: @@ -71,6 +67,6 @@ public: OUString GetMappedFontName( const OUString& rFontName ) const; }; -#endif +#endif // INCLUDED_FILTER_SOURCE_SVG_SVGFONTEXPORT_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx index 46b69d9e15fd..89d954d6bbbb 100644 --- a/filter/source/svg/svgwriter.cxx +++ b/filter/source/svg/svgwriter.cxx @@ -101,17 +101,20 @@ SVGAttributeWriter::SVGAttributeWriter( SVGExport& rExport, SVGFontExport& rFont { } + SVGAttributeWriter::~SVGAttributeWriter() { delete mpElemPaint; delete mpElemFont; } + double SVGAttributeWriter::ImplRound( double fValue, sal_Int32 nDecs ) { return floor( fValue * pow( 10.0, (int)nDecs ) + 0.5 ) / pow( 10.0, (int)nDecs ); } + void SVGAttributeWriter::ImplGetColorStr( const Color& rColor, OUString& rColorStr ) { if( rColor.GetTransparency() == 255 ) @@ -123,6 +126,7 @@ void SVGAttributeWriter::ImplGetColorStr( const Color& rColor, OUString& rColorS } } + void SVGAttributeWriter::AddColorAttr( const char* pColorAttrName, const char* pColorOpacityAttrName, const Color& rColor ) @@ -140,6 +144,7 @@ void SVGAttributeWriter::AddColorAttr( const char* pColorAttrName, mrExport.AddAttribute( XML_NAMESPACE_NONE, pColorOpacityAttrName, aColorOpacity ); } + void SVGAttributeWriter::AddPaintAttr( const Color& rLineColor, const Color& rFillColor, const Rectangle* pObjBoundRect, const Gradient* pFillGradient ) { @@ -163,6 +168,7 @@ void SVGAttributeWriter::AddPaintAttr( const Color& rLineColor, const Color& rFi AddColorAttr( aXMLAttrStroke, aXMLAttrStrokeOpacity, rLineColor ); } + void SVGAttributeWriter::AddGradientDef( const Rectangle& rObjRect, const Gradient& rGradient, OUString& rGradientId ) { if( rObjRect.GetWidth() && rObjRect.GetHeight() && @@ -284,6 +290,7 @@ void SVGAttributeWriter::AddGradientDef( const Rectangle& rObjRect, const Gradie rGradientId.clear(); } + void SVGAttributeWriter::SetFontAttr( const vcl::Font& rFont ) { if( rFont != maCurFont ) @@ -351,6 +358,7 @@ void SVGAttributeWriter::SetFontAttr( const vcl::Font& rFont ) } } + void SVGAttributeWriter::startFontSettings() { endFontSettings(); @@ -364,6 +372,7 @@ void SVGAttributeWriter::startFontSettings() } } + void SVGAttributeWriter::endFontSettings() { if( mpElemFont ) @@ -373,6 +382,7 @@ void SVGAttributeWriter::endFontSettings() } } + void SVGAttributeWriter::setFontFamily() { if( mrExport.IsUsePositionedCharacters() ) @@ -401,57 +411,62 @@ void SVGAttributeWriter::setFontFamily() } } + SVGTextWriter::SVGTextWriter( SVGExport& rExport ) - : mrExport( rExport ), - mpContext( nullptr ), - mpVDev( nullptr ), - mbIsTextShapeStarted( false ), - mrTextShape(), - msShapeId(), - mrParagraphEnumeration(), - mrCurrentTextParagraph(), - mrTextPortionEnumeration(), - mrCurrentTextPortion(), - mpTextEmbeddedBitmapMtf( nullptr ), - mpTargetMapMode( nullptr ), - mpTextShapeElem( nullptr ), - mpTextParagraphElem( nullptr ), - mpTextPositionElem( nullptr ), - mnLeftTextPortionLength( 0 ), - maTextPos(0,0), - mnTextWidth(0), - mbPositioningNeeded( false ), - mbIsNewListItem( false ), - meNumberingType(0), - mcBulletChar(0), - maBulletListItemMap(), - mbIsListLevelStyleImage( false ), - mbLineBreak( false ), - mbIsURLField( false ), - msUrl(), - mbIsPlaceholderShape( false ), - mbIWS( false ), - maCurrentFont(), - maParentFont() +: mrExport( rExport ), + mpContext( nullptr ), + mpVDev( nullptr ), + mbIsTextShapeStarted( false ), + mrTextShape(), + msShapeId(), + mrParagraphEnumeration(), + mrCurrentTextParagraph(), + mrTextPortionEnumeration(), + mrCurrentTextPortion(), + mpTextEmbeddedBitmapMtf( nullptr ), + mpTargetMapMode( nullptr ), + mpTextShapeElem( nullptr ), + mpTextParagraphElem( nullptr ), + mpTextPositionElem( nullptr ), + mnLeftTextPortionLength( 0 ), + maTextPos(0,0), + mnTextWidth(0), + mbPositioningNeeded( false ), + mbIsNewListItem( false ), + meNumberingType(0), + mcBulletChar(0), + maBulletListItemMap(), + mbIsListLevelStyleImage( false ), + mbLineBreak( false ), + mbIsURLField( false ), + msUrl(), + mbIsPlaceholderShape( false ), + mbIWS( false ), + maCurrentFont(), + maParentFont() { } + SVGTextWriter::~SVGTextWriter() { endTextParagraph(); } + void SVGTextWriter::implRegisterInterface( const Reference< XInterface >& rxIf ) { if( rxIf.is() ) (mrExport.getInterfaceToIdentifierMapper()).registerReference( rxIf ); } + const OUString & SVGTextWriter::implGetValidIDFromInterface( const Reference< XInterface >& rxIf ) { return (mrExport.getInterfaceToIdentifierMapper()).getIdentifier( rxIf ); } + void SVGTextWriter::implMap( const Size& rSz, Size& rDstSz ) const { if( mpVDev && mpTargetMapMode ) @@ -460,6 +475,7 @@ void SVGTextWriter::implMap( const Size& rSz, Size& rDstSz ) const OSL_FAIL( "SVGTextWriter::implMap: invalid virtual device or map mode." ); } + void SVGTextWriter::implMap( const Point& rPt, Point& rDstPt ) const { if( mpVDev && mpTargetMapMode ) @@ -468,6 +484,7 @@ void SVGTextWriter::implMap( const Point& rPt, Point& rDstPt ) const OSL_FAIL( "SVGTextWriter::implMap: invalid virtual device or map mode." ); } + void SVGTextWriter::implSetCurrentFont() { if( mpVDev ) @@ -485,6 +502,7 @@ void SVGTextWriter::implSetCurrentFont() } } + template< typename SubType > bool SVGTextWriter::implGetTextPosition( const MetaAction* pAction, Point& raPos, bool& rbEmpty ) { @@ -499,6 +517,7 @@ bool SVGTextWriter::implGetTextPosition( const MetaAction* pAction, Point& raPos return false; } + template<> bool SVGTextWriter::implGetTextPosition<MetaTextRectAction>( const MetaAction* pAction, Point& raPos, bool& rbEmpty ) { @@ -513,6 +532,7 @@ bool SVGTextWriter::implGetTextPosition<MetaTextRectAction>( const MetaAction* p return false; } + template< typename SubType > bool SVGTextWriter::implGetTextPositionFromBitmap( const MetaAction* pAction, Point& raPos, bool& rbEmpty ) { @@ -522,6 +542,7 @@ bool SVGTextWriter::implGetTextPositionFromBitmap( const MetaAction* pAction, Po return true; } + /** setTextPosition * Set the start position of the next line of text. In case no text is found * the current action index is updated to the index value we reached while @@ -655,6 +676,7 @@ sal_Int32 SVGTextWriter::setTextPosition( const GDIMetaFile& rMtf, sal_uLong& nC } } + void SVGTextWriter::setTextProperties( const GDIMetaFile& rMtf, sal_uLong nCurAction ) { sal_uLong nCount = rMtf.GetActionSize(); @@ -723,6 +745,7 @@ void SVGTextWriter::setTextProperties( const GDIMetaFile& rMtf, sal_uLong nCurAc } } + void SVGTextWriter::addFontAttributes( bool bIsTextContainer ) { implSetCurrentFont(); @@ -837,6 +860,7 @@ void SVGTextWriter::addFontAttributes( bool bIsTextContainer ) } } + void SVGTextWriter::implSetFontFamily() { sal_Int32 nNextTokenPos( 0 ); @@ -858,6 +882,7 @@ void SVGTextWriter::implSetFontFamily() mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrFontFamily, sFontFamily ); } + void SVGTextWriter::createParagraphEnumeration() { if( mrTextShape.is() ) @@ -881,6 +906,7 @@ void SVGTextWriter::createParagraphEnumeration() } } + bool SVGTextWriter::nextParagraph() { mrTextPortionEnumeration.clear(); @@ -1036,6 +1062,7 @@ bool SVGTextWriter::nextParagraph() return false; } + bool SVGTextWriter::nextTextPortion() { mrCurrentTextPortion.clear(); @@ -1157,6 +1184,7 @@ bool SVGTextWriter::nextTextPortion() return false; } + void SVGTextWriter::startTextShape() { if( mpTextShapeElem ) @@ -1189,6 +1217,7 @@ void SVGTextWriter::startTextShape() } } + void SVGTextWriter::endTextShape() { endTextParagraph(); @@ -1211,6 +1240,7 @@ void SVGTextWriter::endTextShape() } + void SVGTextWriter::startTextParagraph() { endTextParagraph(); @@ -1247,6 +1277,7 @@ void SVGTextWriter::startTextParagraph() } } + void SVGTextWriter::endTextParagraph() { mrCurrentTextPortion.clear(); @@ -1263,6 +1294,7 @@ void SVGTextWriter::endTextParagraph() } + void SVGTextWriter::startTextPosition( bool bExportX, bool bExportY ) { endTextPosition(); @@ -1276,6 +1308,7 @@ void SVGTextWriter::startTextPosition( bool bExportX, bool bExportY ) mpTextPositionElem = new SvXMLElementExport( mrExport, XML_NAMESPACE_NONE, aXMLElemTspan, mbIWS, mbIWS ); } + void SVGTextWriter::endTextPosition() { if( mpTextPositionElem ) @@ -1285,6 +1318,7 @@ void SVGTextWriter::endTextPosition() } } + void SVGTextWriter::implExportHyperlinkIds() { if( !msHyperlinkIdList.isEmpty() ) @@ -1296,6 +1330,7 @@ void SVGTextWriter::implExportHyperlinkIds() } } + void SVGTextWriter::implWriteBulletChars() { if( maBulletListItemMap.empty() ) @@ -1351,11 +1386,11 @@ void SVGTextWriter::implWriteBulletChars() } // close aBulletCharElem } - // clear the map maBulletListItemMap.clear(); } + template< typename MetaBitmapActionType > void SVGTextWriter::writeBitmapPlaceholder( const MetaBitmapActionType* pAction ) { @@ -1383,6 +1418,7 @@ void SVGTextWriter::writeBitmapPlaceholder( const MetaBitmapActionType* pAction endTextPosition(); } + void SVGTextWriter::implWriteEmbeddedBitmaps() { if( mpTextEmbeddedBitmapMtf && mpTextEmbeddedBitmapMtf->GetActionSize() ) @@ -1461,6 +1497,7 @@ void SVGTextWriter::implWriteEmbeddedBitmaps() } } + void SVGTextWriter::writeTextPortion( const Point& rPos, const OUString& rText, bool bApplyMapping ) @@ -1545,6 +1582,7 @@ void SVGTextWriter::writeTextPortion( const Point& rPos, } } + void SVGTextWriter::implWriteTextPortion( const Point& rPos, const OUString& rText, Color aTextColor, @@ -1661,6 +1699,7 @@ void SVGTextWriter::implWriteTextPortion( const Point& rPos, mnTextWidth += mpVDev->GetTextWidth( sTextContent ); } + SVGActionWriter::SVGActionWriter( SVGExport& rExport, SVGFontExport& rFontExport ) : mnCurGradientId( 1 ), mnCurMaskId( 1 ), @@ -1679,12 +1718,14 @@ SVGActionWriter::SVGActionWriter( SVGExport& rExport, SVGFontExport& rFontExport maTextWriter.setVirtualDevice( mpVDev, maTargetMapMode ); } + SVGActionWriter::~SVGActionWriter() { DBG_ASSERT( !mpContext, "Not all contexts are closed" ); mpVDev.disposeAndClear(); } + long SVGActionWriter::ImplMap( sal_Int32 nVal ) const { Size aSz( nVal, nVal ); @@ -1692,16 +1733,19 @@ long SVGActionWriter::ImplMap( sal_Int32 nVal ) const return ImplMap( aSz, aSz ).Width(); } + Point& SVGActionWriter::ImplMap( const Point& rPt, Point& rDstPt ) const { return( rDstPt = OutputDevice::LogicToLogic( rPt, mpVDev->GetMapMode(), maTargetMapMode ) ); } + Size& SVGActionWriter::ImplMap( const Size& rSz, Size& rDstSz ) const { return( rDstSz = OutputDevice::LogicToLogic( rSz, mpVDev->GetMapMode(), maTargetMapMode ) ); } + Rectangle& SVGActionWriter::ImplMap( const Rectangle& rRect, Rectangle& rDstRect ) const { Point aTL( rRect.TopLeft() ); @@ -1710,6 +1754,7 @@ Rectangle& SVGActionWriter::ImplMap( const Rectangle& rRect, Rectangle& rDstRect return( rDstRect = Rectangle( ImplMap( aTL, aTL ), ImplMap( aSz, aSz ) ) ); } + tools::Polygon& SVGActionWriter::ImplMap( const tools::Polygon& rPoly, tools::Polygon& rDstPoly ) const { rDstPoly = tools::Polygon( rPoly.GetSize() ); @@ -1723,6 +1768,7 @@ tools::Polygon& SVGActionWriter::ImplMap( const tools::Polygon& rPoly, tools::Po return rDstPoly; } + tools::PolyPolygon& SVGActionWriter::ImplMap( const tools::PolyPolygon& rPolyPoly, tools::PolyPolygon& rDstPolyPoly ) const { tools::Polygon aPoly; @@ -1737,6 +1783,7 @@ tools::PolyPolygon& SVGActionWriter::ImplMap( const tools::PolyPolygon& rPolyPol return rDstPolyPoly; } + OUString SVGActionWriter::GetPathString( const tools::PolyPolygon& rPolyPoly, bool bLine ) { OUString aPathData; @@ -1802,6 +1849,7 @@ OUString SVGActionWriter::GetPathString( const tools::PolyPolygon& rPolyPoly, bo return aPathData; } + BitmapChecksum SVGActionWriter::GetChecksum( const MetaAction* pAction ) { GDIMetaFile aMtf; @@ -1811,6 +1859,7 @@ BitmapChecksum SVGActionWriter::GetChecksum( const MetaAction* pAction ) return aMtf.GetChecksum(); } + void SVGActionWriter::ImplWriteLine( const Point& rPt1, const Point& rPt2, const Color* pLineColor, bool bApplyMapping ) { @@ -1843,6 +1892,7 @@ void SVGActionWriter::ImplWriteLine( const Point& rPt1, const Point& rPt2, } } + void SVGActionWriter::ImplWriteRect( const Rectangle& rRect, long nRadX, long nRadY, bool bApplyMapping ) { @@ -1869,6 +1919,7 @@ void SVGActionWriter::ImplWriteRect( const Rectangle& rRect, long nRadX, long nR } } + void SVGActionWriter::ImplWriteEllipse( const Point& rCenter, long nRadX, long nRadY, bool bApplyMapping ) { @@ -1889,6 +1940,7 @@ void SVGActionWriter::ImplWriteEllipse( const Point& rCenter, long nRadX, long n } } + void SVGActionWriter::ImplAddLineAttr( const LineInfo &rAttrs, bool bApplyMapping ) { @@ -1944,6 +1996,7 @@ void SVGActionWriter::ImplAddLineAttr( const LineInfo &rAttrs, } + void SVGActionWriter::ImplWritePolyPolygon( const tools::PolyPolygon& rPolyPoly, bool bLineOnly, bool bApplyMapping ) { @@ -1963,6 +2016,7 @@ void SVGActionWriter::ImplWritePolyPolygon( const tools::PolyPolygon& rPolyPoly, } } + void SVGActionWriter::ImplWriteShape( const SVGShapeDescriptor& rShape, bool bApplyMapping ) { tools::PolyPolygon aPolyPoly; @@ -2054,6 +2108,7 @@ void SVGActionWriter::ImplWriteShape( const SVGShapeDescriptor& rShape, bool bAp ImplWritePolyPolygon( aPolyPoly, bLineOnly, false ); } + void SVGActionWriter::ImplWritePattern( const tools::PolyPolygon& rPolyPoly, const Hatch* pHatch, const Gradient* pGradient, @@ -2111,6 +2166,7 @@ void SVGActionWriter::ImplWritePattern( const tools::PolyPolygon& rPolyPoly, } } + void SVGActionWriter::ImplWriteGradientEx( const tools::PolyPolygon& rPolyPoly, const Gradient& rGradient, sal_uInt32 nWriteFlags) { @@ -2125,6 +2181,7 @@ void SVGActionWriter::ImplWriteGradientEx( const tools::PolyPolygon& rPolyPoly, } } + void SVGActionWriter::ImplWriteGradientLinear( const tools::PolyPolygon& rPolyPoly, const Gradient& rGradient ) { @@ -2232,6 +2289,7 @@ void SVGActionWriter::ImplWriteGradientLinear( const tools::PolyPolygon& rPolyPo } } + void SVGActionWriter::ImplWriteGradientStop( const Color& rColor, double fOffset ) { mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrOffset, OUString::number( fOffset ) ); @@ -2247,6 +2305,7 @@ void SVGActionWriter::ImplWriteGradientStop( const Color& rColor, double fOffset } } + Color SVGActionWriter::ImplGetColorWithIntensity( const Color& rColor, sal_uInt16 nIntensity ) { @@ -2256,6 +2315,7 @@ Color SVGActionWriter::ImplGetColorWithIntensity( const Color& rColor, return Color( nNewRed, nNewGreen, nNewBlue); } + Color SVGActionWriter::ImplGetGradientColor( const Color& rStartColor, const Color& rEndColor, double fOffset ) @@ -2275,6 +2335,7 @@ Color SVGActionWriter::ImplGetGradientColor( const Color& rStartColor, return Color( (sal_uInt8)nNewRed, (sal_uInt8)nNewGreen, (sal_uInt8)nNewBlue ); } + void SVGActionWriter::ImplWriteMask( GDIMetaFile& rMtf, const Point& rDestPt, const Size& rDestSize, @@ -2334,6 +2395,7 @@ void SVGActionWriter::ImplWriteMask( GDIMetaFile& rMtf, } } + void SVGActionWriter::ImplWriteText( const Point& rPos, const OUString& rText, const long* pDXArray, long nWidth, bool bApplyMapping ) @@ -2424,6 +2486,7 @@ void SVGActionWriter::ImplWriteText( const Point& rPos, const OUString& rText, } } + void SVGActionWriter::ImplWriteText( const Point& rPos, const OUString& rText, const long* pDXArray, long nWidth, Color aTextColor, bool bApplyMapping ) @@ -2608,6 +2671,7 @@ void SVGActionWriter::ImplWriteText( const Point& rPos, const OUString& rText, } } + void SVGActionWriter::ImplWriteBmp( const BitmapEx& rBmpEx, const Point& rPt, const Size& rSz, const Point& rSrcPt, const Size& rSrcSz, @@ -2659,6 +2723,7 @@ void SVGActionWriter::ImplWriteBmp( const BitmapEx& rBmpEx, } } + void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf, sal_uInt32 nWriteFlags, const OUString* pElementId, @@ -3587,6 +3652,7 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf, } } + vcl::Font SVGActionWriter::ImplSetCorrectFontHeight() const { vcl::Font aFont( mpVDev->GetFont() ); @@ -3599,6 +3665,7 @@ vcl::Font SVGActionWriter::ImplSetCorrectFontHeight() const return aFont; } + void SVGActionWriter::WriteMetaFile( const Point& rPos100thmm, const Size& rSize100thmm, const GDIMetaFile& rMtf, @@ -3641,9 +3708,6 @@ void SVGActionWriter::WriteMetaFile( const Point& rPos100thmm, } -// - SVGWriter - - - SVGWriter::SVGWriter( const Sequence<Any>& args, const Reference< XComponentContext >& rxCtx ) : mxContext(rxCtx) { @@ -3652,13 +3716,11 @@ SVGWriter::SVGWriter( const Sequence<Any>& args, const Reference< XComponentCont } - SVGWriter::~SVGWriter() { } - void SAL_CALL SVGWriter::write( const Reference<XDocumentHandler>& rxDocHandler, const Sequence<sal_Int8>& rMtfSeq ) throw( RuntimeException, std::exception ) { diff --git a/filter/source/svg/svgwriter.hxx b/filter/source/svg/svgwriter.hxx index 9d9f3e463a46..441aeedd3d42 100644 --- a/filter/source/svg/svgwriter.hxx +++ b/filter/source/svg/svgwriter.hxx @@ -69,22 +69,17 @@ using namespace ::com::sun::star::style; using namespace ::com::sun::star::svg; using namespace ::com::sun::star::xml::sax; - - #define SVG_DTD_STRING "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">" #define SVGWRITER_WRITE_FILL 0x00000001 #define SVGWRITER_WRITE_TEXT 0x00000002 #define SVGWRITER_NO_SHAPE_COMMENTS 0x01000000 - -// - SVGAttributeWriter - - - class SVGActionWriter; class SVGExport; class SVGFontExport; + class SVGAttributeWriter { private: @@ -143,15 +138,11 @@ struct SVGShapeDescriptor }; - class SVGAttributeWriter; class SVGExport; class GDIMetaFile; - -// - BulletListItemInfo - - struct BulletListItemInfo { long nFontSize; @@ -161,9 +152,6 @@ struct BulletListItemInfo }; - -// - SVGTextWriter - - class SVGTextWriter { public: @@ -270,9 +258,6 @@ class SVGTextWriter }; -// - SVGActionWriter - - - class SVGActionWriter { private: @@ -366,6 +351,7 @@ public: const GDIMetaFile* pTextEmbeddedBitmapMtf = nullptr ); }; + class SVGWriter : public cppu::WeakImplHelper< XSVGWriter > { private: @@ -383,6 +369,6 @@ public: const Sequence<sal_Int8>& rMtfSeq ) throw( RuntimeException, std::exception ) override; }; -#endif +#endif // INCLUDED_FILTER_SOURCE_SVG_SVGWRITER_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |