[Libreoffice-commits] core.git: include/vcl sd/source vcl/source
include/vcl/commandevent.hxx|2 +- sd/source/ui/view/viewshel.cxx |2 +- vcl/source/control/imivctl1.cxx |2 +- 3 files changed, 3 insertions(+), 3 deletions(-) New commits: commit b4dd91f3a10610924e736445e17506b49b619a70 Author: sahil AuthorDate: Sun Aug 13 14:17:20 2023 +0530 Commit: Hossein CommitDate: Tue Sep 5 22:51:55 2023 +0200 tdf#114441 - Convert use of sal_uLong to better integer types Updated scrolling related variables to double from sal_uLong Change-Id: Ibf4bb3d55b074b5d2e369e4bc708b87bdfa302b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155644 Tested-by: Jenkins Reviewed-by: Hossein diff --git a/include/vcl/commandevent.hxx b/include/vcl/commandevent.hxx index fc6ba290793f..9491137acea8 100644 --- a/include/vcl/commandevent.hxx +++ b/include/vcl/commandevent.hxx @@ -139,7 +139,7 @@ enum class CommandWheelMode }; // Magic value used in mnLines field in CommandWheelData -#define COMMAND_WHEEL_PAGESCROLL(sal_uLong(0x)) +#define COMMAND_WHEEL_PAGESCROLL(double(0x)) class VCL_DLLPUBLIC CommandWheelData { diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index d4007eb77510..91fa6a2e4b53 100644 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx @@ -736,7 +736,7 @@ bool ViewShell::HandleScrollCommand(const CommandEvent& rCEvt, ::sd::Window* pWi { if( mpContentWindow.get() == pWin ) { -sal_uLong nScrollLines = pData->GetScrollLines(); +double nScrollLines = pData->GetScrollLines(); if(IsPageFlipMode()) nScrollLines = COMMAND_WHEEL_PAGESCROLL; CommandWheelData aWheelData( pData->GetDelta(),pData->GetNotchDelta(), diff --git a/vcl/source/control/imivctl1.cxx b/vcl/source/control/imivctl1.cxx index ae297a82e107..1364dc4f44d0 100644 --- a/vcl/source/control/imivctl1.cxx +++ b/vcl/source/control/imivctl1.cxx @@ -1844,7 +1844,7 @@ bool SvxIconChoiceCtrl_Impl::HandleScrollCommand( const CommandEvent& rCmd ) const CommandWheelData* pData = rCmd.GetWheelData(); if( pData && (CommandWheelMode::SCROLL == pData->GetMode()) && !pData->IsHorz() ) { -sal_uLong nScrollLines = pData->GetScrollLines(); +double nScrollLines = pData->GetScrollLines(); if( nScrollLines == COMMAND_WHEEL_PAGESCROLL ) { nScrollDY = GetScrollBarPageSize( aVisSize.Width() );
[Libreoffice-commits] core.git: include/vcl sd/source vcl/source
include/vcl/pdfread.hxx| 20 +++- sd/source/ui/view/sdview4.cxx |6 ++ vcl/source/filter/ipdf/pdfread.cxx |9 +++-- vcl/source/pdf/PdfConfig.cxx |5 - 4 files changed, 36 insertions(+), 4 deletions(-) New commits: commit 266e6b76763d16bcb1dcf67bab2478a7d2d7b8fc Author: Tor Lillqvist AuthorDate: Wed Feb 2 16:29:34 2022 +0200 Commit: Miklos Vajna CommitDate: Thu Feb 3 14:43:53 2022 +0100 Make inserted or pasted PDF sharper on macOS When inserting a PDF file as an image or pasting PDF data from the clipboard on a Retina iMac the resulting rendered image did not look sharp. Using a surprisingly large extra scaling factor helps. The exact reasons for this are unknown. It isn't enough to use a scaling factor of just 2 (which is the HiDI ("Retina") scale factor on my iMac). Possibly the fuzziness is related to what Pdfium uses to render text. Also, look at CountDPIScaleFactor() in vcl/source/window/window.cxx. The GetDPIScaleFactor() function lies on macOS even more than it does on other platforms. It claims that the DPI scale percentage is always 100. But in fact most Macs nowadays have a Retina display so it would make more sense, in theory, to at least always return 200 instead. That wouldn't be any more wrong. But that causes regressions in the UI rendering, like needlessly large icons in the toolbars. Change-Id: Idc694f742c4ac32a5a134f8d206cf4eee467c39a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129369 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/include/vcl/pdfread.hxx b/include/vcl/pdfread.hxx index 084bd3f913b5..72508a548293 100644 --- a/include/vcl/pdfread.hxx +++ b/include/vcl/pdfread.hxx @@ -1,4 +1,4 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* * This file is part of the LibreOffice project. * @@ -42,6 +42,24 @@ importPdfVectorGraphicData(SvStream& rStream, /// Imports a PDF stream into rGraphic. VCL_DLLPUBLIC bool ImportPDF(SvStream& rStream, Graphic& rGraphic); +// When inserting a PDF file as an image or pasting PDF data from the clipboard, at least on a +// Retina iMac, the resulting rendered image does not look sharp without this surprisingly large +// extra scaling factor. Exact reasons unknown. And it isn't enough to have it be just 2 (which is +// the actual Retina factor on my iMac). Possibly the fuzziness is related to what Pdfium uses to +// render text. + +// Also, look at CountDPIScaleFactor() in vcl/source/window/window.cxx. The GetDPIScaleFactor() API +// lies on macOS even more than it does on other platforms, it claims that the DPI scale factor is +// always 1. But in fact most Macs nowadays have a HiDPI ("Retina") display. But we can't just "fix" +// things by making GetDPIScaleFactor() always return 2 on macOS, even if that wouldn't be any more +// wrong, because that then causes other regressions that I have no time to look into now. + +#ifdef MACOSX +constexpr int PDF_INSERT_MAGIC_SCALE_FACTOR = 8; +#else +constexpr int PDF_INSERT_MAGIC_SCALE_FACTOR = 1; +#endif + struct PDFGraphicAnnotation { OUString maAuthor; diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx index 80a653b7b9c8..5b7d5387d2c8 100644 --- a/sd/source/ui/view/sdview4.cxx +++ b/sd/source/ui/view/sdview4.cxx @@ -30,6 +30,8 @@ #include #include #include +#include +#include #include #include #include @@ -197,6 +199,10 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction, } sal_Int32 nPreferredDPI = mrDoc.getImagePreferredDPI(); + +if (rGraphic.GetGfxLink().GetType() == GfxLinkType::NativePdf && nPreferredDPI == 0 && vcl::PDF_INSERT_MAGIC_SCALE_FACTOR > 1) +nPreferredDPI = Application::GetDefaultDevice()->GetDPIX() * vcl::PDF_INSERT_MAGIC_SCALE_FACTOR; + if (nPreferredDPI > 0) { auto nWidth = o3tl::convert(aSizePixel.Width() / double(nPreferredDPI), o3tl::Length::in, o3tl::Length::mm100); diff --git a/vcl/source/filter/ipdf/pdfread.cxx b/vcl/source/filter/ipdf/pdfread.cxx index a69d10c7cafc..0780e1c9baaa 100644 --- a/vcl/source/filter/ipdf/pdfread.cxx +++ b/vcl/source/filter/ipdf/pdfread.cxx @@ -7,6 +7,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include +#include #include #include @@ -156,8 +158,11 @@ size_t RenderPDFBitmaps(const void* pBuffer, int nSize, std::vector& r } // Returned unit is points, convert that to pixel. -const size_t nPageWidth = pointToPixel(nPageWidthPoints, fResolutionDPI); -const size_t nPageHeight = pointToPixel(nPageHeightPoints, fResolutionDPI); + +const size_t nPageWidth += pointToPixel(nPageWidthPoin
[Libreoffice-commits] core.git: include/vcl sd/source vcl/source
include/vcl/graphicfilter.hxx| 13 +++-- sd/source/filter/grf/sdgrffilter.cxx |4 ++-- sd/source/ui/func/fuinsert.cxx |2 +- vcl/source/filter/graphicfilter.cxx |8 4 files changed, 10 insertions(+), 17 deletions(-) New commits: commit 8ea426bfa978d338683bf4c715d358187a527ccd Author: Noel Grandin AuthorDate: Thu Jul 22 11:49:00 2021 +0200 Commit: Noel Grandin CommitDate: Thu Jul 22 15:47:48 2021 +0200 no need to allocate the error separately in GraphicFilter Change-Id: I26c43cb72580d9cc384b3c4b70e43f47d3db0198 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119367 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx index d153c9d97648..833007e28088 100644 --- a/include/vcl/graphicfilter.hxx +++ b/include/vcl/graphicfilter.hxx @@ -256,14 +256,6 @@ public: static OUString GetImportFormatShortName( GraphicFileFormat nFormat ); }; -/** Information about errors during the GraphicFilter operation. */ -struct FilterErrorEx -{ -ErrCode nStreamError; - -FilterErrorEx() : nStreamError( ERRCODE_NONE ) {} -}; - /** Class to import and export graphic formats. */ class VCL_DLLPUBLIC GraphicFilter { @@ -341,7 +333,7 @@ public: // Setting sizeLimit limits how much will be read from the stream. Graphic ImportUnloadedGraphic(SvStream& rIStream, sal_uInt64 sizeLimit = 0, const Size* pSizeHint = nullptr); -const FilterErrorEx&GetLastError() const { return *pErrorEx;} +const ErrCode& GetLastError() const { return *mxErrorEx;} voidResetLastError(); Link GetFilterCallback() const; @@ -393,7 +385,8 @@ private: DECL_LINK( FilterCallback, ConvertData&, bool ); -std::unique_ptr pErrorEx; +/** Information about errors during the GraphicFilter operation. */ +std::optional mxErrorEx; boolbUseConfig; }; diff --git a/sd/source/filter/grf/sdgrffilter.cxx b/sd/source/filter/grf/sdgrffilter.cxx index 103cc37ca606..ebceaee3b10a 100644 --- a/sd/source/filter/grf/sdgrffilter.cxx +++ b/sd/source/filter/grf/sdgrffilter.cxx @@ -149,7 +149,7 @@ bool SdGRFFilter::Import() ErrCode nReturn = pIStm ? rGraphicFilter.ImportGraphic( aGraphic, aFileName, *pIStm, nFilter ) : ErrCode(1); if( nReturn ) -HandleGraphicFilterError( nReturn, rGraphicFilter.GetLastError().nStreamError ); +HandleGraphicFilterError( nReturn, rGraphicFilter.GetLastError() ); else { if( mrDocument.GetPageCount() == 0 ) @@ -292,7 +292,7 @@ bool SdGRFFilter::Export() if ( !bRet && xInteractionHandler.is() ) SdGRFFilter::HandleGraphicFilterError( static_cast< SdGRFFilter_ImplInteractionHdl* >( xInteractionHandler.get() )->GetErrorCode(), - rGraphicFilter.GetLastError().nStreamError ); +rGraphicFilter.GetLastError() ); } } } diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx index 01434b40f141..07d1417e0161 100644 --- a/sd/source/ui/func/fuinsert.cxx +++ b/sd/source/ui/func/fuinsert.cxx @@ -190,7 +190,7 @@ void FuInsertGraphic::DoExecute( SfxRequest& rReq ) } else { -SdGRFFilter::HandleGraphicFilterError( nError, GraphicFilter::GetGraphicFilter().GetLastError().nStreamError ); +SdGRFFilter::HandleGraphicFilterError( nError, GraphicFilter::GetGraphicFilter().GetLastError() ); } } diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index 9ffd3601d714..1be4c82e7c4e 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -335,7 +335,7 @@ GraphicFilter::~GraphicFilter() delete pConfig; } -pErrorEx.reset(); +mxErrorEx.reset(); } void GraphicFilter::ImplInit() @@ -358,12 +358,12 @@ void GraphicFilter::ImplInit() osl::FileBase::getSystemPathFromFileURL(url, aFilterPath); } -pErrorEx.reset( new FilterErrorEx ); +mxErrorEx = ERRCODE_NONE; } ErrCode GraphicFilter::ImplSetError( ErrCode nError, const SvStream* pStm ) { -pErrorEx->nStreamError = pStm ? pStm->GetError() : ERRCODE_NONE; +mxErrorEx = pStm ? pStm->GetError() : ERRCODE_NONE; return nError; } @@ -1850,7 +1850,7 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& r void GraphicFilter::ResetLastError() { -pErrorEx->nStreamError = ERRCODE_NONE; +mxErrorEx = ERRCODE_NONE; } Link GraphicFilter::GetFilterCallback() const ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: include/vcl sd/source vcl/source
include/vcl/pdf/PDFAnnotationMarker.hxx |6 ++ sd/source/filter/pdf/sdpdffilter.cxx| 13 + vcl/source/filter/ipdf/pdfread.cxx | 24 +++- 3 files changed, 42 insertions(+), 1 deletion(-) New commits: commit 354080769f34207e3c850c61e62e8af346964463 Author: Tomaž Vajngerl AuthorDate: Thu Oct 15 14:35:26 2020 +0200 Commit: Tomaž Vajngerl CommitDate: Sun Oct 18 21:23:10 2020 +0200 sd: support line PDF annot. as custom marker This renderes the line marker, but line start and end symbol is for now not supported. Change-Id: Ibf099f54b4bc047b22dae32c705982c8cb24388b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104377 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/include/vcl/pdf/PDFAnnotationMarker.hxx b/include/vcl/pdf/PDFAnnotationMarker.hxx index 2c525f85cbd5..d797115437e9 100644 --- a/include/vcl/pdf/PDFAnnotationMarker.hxx +++ b/include/vcl/pdf/PDFAnnotationMarker.hxx @@ -45,6 +45,12 @@ struct VCL_DLLPUBLIC PDFAnnotationMarkerPolygon : public PDFAnnotationMarker basegfx::B2DPolygon maPolygon; }; +struct VCL_DLLPUBLIC PDFAnnotationMarkerLine : public PDFAnnotationMarker +{ +basegfx::B2DPoint maLineStart; +basegfx::B2DPoint maLineEnd; +}; + enum class PDFTextMarkerType { Highlight, diff --git a/sd/source/filter/pdf/sdpdffilter.cxx b/sd/source/filter/pdf/sdpdffilter.cxx index e903c015d4be..4b52f9e4b574 100644 --- a/sd/source/filter/pdf/sdpdffilter.cxx +++ b/sd/source/filter/pdf/sdpdffilter.cxx @@ -170,6 +170,19 @@ bool SdPdfFilter::Import() if (rCustomAnnotationMarker.maFillColor.GetTransparency() == 0) rCustomAnnotationMarker.maFillColor.SetTransparency(0x90); } +else if (rPDFAnnotation.meSubType == vcl::pdf::PDFAnnotationSubType::Line) +{ +auto* pMarker = static_cast( +rPDFAnnotation.mpMarker.get()); + +basegfx::B2DPolygon aPoly; +aPoly.append(pMarker->maLineStart); +aPoly.append(pMarker->maLineEnd); +rCustomAnnotationMarker.maPolygons.push_back(aPoly); + +rCustomAnnotationMarker.mnLineWidth = pMarker->mnWidth; +rCustomAnnotationMarker.maFillColor = COL_TRANSPARENT; +} } } } diff --git a/vcl/source/filter/ipdf/pdfread.cxx b/vcl/source/filter/ipdf/pdfread.cxx index 9be28fcf0c9b..3ccad9b10ecc 100644 --- a/vcl/source/filter/ipdf/pdfread.cxx +++ b/vcl/source/filter/ipdf/pdfread.cxx @@ -259,7 +259,8 @@ findAnnotations(const std::unique_ptr& pPage, basegfx::B2D || eSubtype == vcl::pdf::PDFAnnotationSubType::Circle || eSubtype == vcl::pdf::PDFAnnotationSubType::Square || eSubtype == vcl::pdf::PDFAnnotationSubType::Ink -|| eSubtype == vcl::pdf::PDFAnnotationSubType::Highlight) +|| eSubtype == vcl::pdf::PDFAnnotationSubType::Highlight +|| eSubtype == vcl::pdf::PDFAnnotationSubType::Line) { OUString sAuthor = pAnnotation->getString(vcl::pdf::constDictionaryKeyTitle); OUString sText = pAnnotation->getString(vcl::pdf::constDictionaryKeyContents); @@ -394,6 +395,27 @@ findAnnotations(const std::unique_ptr& pPage, basegfx::B2D } } } +else if (eSubtype == vcl::pdf::PDFAnnotationSubType::Line) +{ +auto const& rLineGeometry = pAnnotation->getLineGeometry(); +if (!rLineGeometry.empty()) +{ +double x, y; +auto pMarker = std::make_shared(); +rPDFGraphicAnnotation.mpMarker = pMarker; + +x = convertPointToMm100(rLineGeometry[0].getX()); +y = convertPointToMm100(aPageSize.getY() - rLineGeometry[0].getY()); +pMarker->maLineStart = basegfx::B2DPoint(x, y); + +x = convertPointToMm100(rLineGeometry[1].getX()); +y = convertPointToMm100(aPageSize.getY() - rLineGeometry[1].getY()); +pMarker->maLineEnd = basegfx::B2DPoint(x, y); + +float fWidth = pAnnotation->getBorderWidth(); +pMarker->mnWidth = convertPointToMm100(fWidth); +} +} } } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: include/vcl sd/source vcl/source
include/vcl/pdf/PDFAnnotationMarker.hxx | 19 + sd/source/filter/pdf/sdpdffilter.cxx| 13 + vcl/source/filter/ipdf/pdfread.cxx | 45 +++- 3 files changed, 76 insertions(+), 1 deletion(-) New commits: commit 7ea49126e7a247ac60ad45ab420106fe4be574ea Author: Tomaž Vajngerl AuthorDate: Thu Oct 15 12:23:08 2020 +0200 Commit: Tomaž Vajngerl CommitDate: Sun Oct 18 21:22:03 2020 +0200 sd: support text annotation PDF annot. as custom marker This one is special as it annotates text. Normally the annotation would be present behind the text, but this is not possible in this case, so the best alternative is to use a transparent rectangle over the text. Change-Id: Ib115efa4a5994e17dcf9d7b02591ccae26800928 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104369 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/include/vcl/pdf/PDFAnnotationMarker.hxx b/include/vcl/pdf/PDFAnnotationMarker.hxx index f2841b09db6c..2c525f85cbd5 100644 --- a/include/vcl/pdf/PDFAnnotationMarker.hxx +++ b/include/vcl/pdf/PDFAnnotationMarker.hxx @@ -45,6 +45,25 @@ struct VCL_DLLPUBLIC PDFAnnotationMarkerPolygon : public PDFAnnotationMarker basegfx::B2DPolygon maPolygon; }; +enum class PDFTextMarkerType +{ +Highlight, +Underline, +Squiggly, +StrikeOut +}; + +struct VCL_DLLPUBLIC PDFAnnotationMarkerHighlight : public PDFAnnotationMarker +{ +std::vector maQuads; +PDFTextMarkerType meTextMarkerType; + +PDFAnnotationMarkerHighlight(PDFTextMarkerType eTextMarkerType) +: meTextMarkerType(eTextMarkerType) +{ +} +}; + } // namespace vcl::pdf /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/filter/pdf/sdpdffilter.cxx b/sd/source/filter/pdf/sdpdffilter.cxx index b2866dd1701d..5e190f8a0117 100644 --- a/sd/source/filter/pdf/sdpdffilter.cxx +++ b/sd/source/filter/pdf/sdpdffilter.cxx @@ -154,6 +154,19 @@ bool SdPdfFilter::Import() rCustomAnnotationMarker.mnLineWidth = pMarker->mnWidth; rCustomAnnotationMarker.maFillColor = pMarker->maFillColor; } +else if (rPDFAnnotation.meSubType == vcl::pdf::PDFAnnotationSubType::Highlight) +{ +if (rCustomAnnotationMarker.maLineColor.GetTransparency() == 0) + rCustomAnnotationMarker.maLineColor.SetTransparency(0x90); +auto* pMarker = static_cast( +rPDFAnnotation.mpMarker.get()); +for (auto const& rPolygon : pMarker->maQuads) +rCustomAnnotationMarker.maPolygons.push_back(rPolygon); +rCustomAnnotationMarker.mnLineWidth = 1; +rCustomAnnotationMarker.maFillColor = rPDFAnnotation.maColor; +if (rCustomAnnotationMarker.maFillColor.GetTransparency() == 0) + rCustomAnnotationMarker.maFillColor.SetTransparency(0x90); +} } } } diff --git a/vcl/source/filter/ipdf/pdfread.cxx b/vcl/source/filter/ipdf/pdfread.cxx index a0e9b51e28a8..9be28fcf0c9b 100644 --- a/vcl/source/filter/ipdf/pdfread.cxx +++ b/vcl/source/filter/ipdf/pdfread.cxx @@ -258,7 +258,8 @@ findAnnotations(const std::unique_ptr& pPage, basegfx::B2D || eSubtype == vcl::pdf::PDFAnnotationSubType::Polygon || eSubtype == vcl::pdf::PDFAnnotationSubType::Circle || eSubtype == vcl::pdf::PDFAnnotationSubType::Square -|| eSubtype == vcl::pdf::PDFAnnotationSubType::Ink) +|| eSubtype == vcl::pdf::PDFAnnotationSubType::Ink +|| eSubtype == vcl::pdf::PDFAnnotationSubType::Highlight) { OUString sAuthor = pAnnotation->getString(vcl::pdf::constDictionaryKeyTitle); OUString sText = pAnnotation->getString(vcl::pdf::constDictionaryKeyContents); @@ -351,6 +352,48 @@ findAnnotations(const std::unique_ptr& pPage, basegfx::B2D pMarker->maFillColor = pAnnotation->getInteriorColor(); } } +else if (eSubtype == vcl::pdf::PDFAnnotationSubType::Highlight) +{ +size_t nCount = pAnnotation->getAttachmentPointsCount(); +if (nCount > 0) +{ +auto pMarker = std::make_shared( +vcl::pdf::PDFTextMarkerType::Highlight); +rPDFGraphicAnnotation.mpMarker = pMarker; +for (size_t i = 0; i < nCount; ++i) +{ +auto aAttachmentPoints = pAnnotation->getAttachmentPoints(i); +if (!aAttachmentPoints.empty()) +{ +double x,
[Libreoffice-commits] core.git: include/vcl sd/source vcl/source
include/vcl/pdfwriter.hxx |2 sd/source/ui/unoidl/unomodel.cxx | 12 + vcl/source/gdi/pdfwriter_impl.cxx | 78 -- 3 files changed, 55 insertions(+), 37 deletions(-) New commits: commit 235c54e115b66c880d3da0b8018f8ef29d20bc42 Author: Tomaž Vajngerl AuthorDate: Sat Jun 20 09:16:11 2020 +0200 Commit: Tomaž Vajngerl CommitDate: Mon Jun 22 08:14:10 2020 +0200 pdf export: add support for modification time/date in annotations Previously the modification date was written to the annotation "title" as string, together with the username. This is however not neccessary as PDF supports the modification date perfectly fine. Change-Id: I6f55e4fe63d9c3c81ec557f6cfd3387f011e67c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96766 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx index 12f4a8e1e805..f635a924507b 100644 --- a/include/vcl/pdfwriter.hxx +++ b/include/vcl/pdfwriter.hxx @@ -32,6 +32,7 @@ #include #include +#include #include #include @@ -64,6 +65,7 @@ struct PDFNote { OUString Title; // optional title for the popup containing the note OUString Contents; // contents of the note +css::util::DateTime maModificationDate; }; class VCL_DLLPUBLIC PDFOutputStream diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index fba4d8f68e6f..c72ef5725b89 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -1556,24 +1556,18 @@ static void ImplPDFExportComments( const uno::Reference< drawing::XDrawPage >& x uno::Reference< office::XAnnotationAccess > xAnnotationAccess( xPage, uno::UNO_QUERY_THROW ); uno::Reference< office::XAnnotationEnumeration > xAnnotationEnumeration( xAnnotationAccess->createAnnotationEnumeration() ); -LanguageType eLanguage = Application::GetSettings().GetLanguageTag().getLanguageType(); while( xAnnotationEnumeration->hasMoreElements() ) { uno::Reference< office::XAnnotation > xAnnotation( xAnnotationEnumeration->nextElement() ); geometry::RealPoint2D aRealPoint2D( xAnnotation->getPosition() ); uno::Reference< text::XText > xText( xAnnotation->getTextRange() ); -util::DateTime aDateTime( xAnnotation->getDateTime() ); - -Date aDate( aDateTime.Day, aDateTime.Month, aDateTime.Year ); -::tools::Time aTime( ::tools::Time::EMPTY ); -OUString aStr = SvxDateTimeField::GetFormatted( aDate, aTime, -SvxDateFormat::B, SvxTimeFormat::AppDefault, -*(SD_MOD()->GetNumberFormatter()), eLanguage ); vcl::PDFNote aNote; -aNote.Title = xAnnotation->getAuthor() + ", " + aStr; +aNote.Title = xAnnotation->getAuthor(); aNote.Contents = xText->getString(); +aNote.maModificationDate = xAnnotation->getDateTime(); + rPDFExtOutDevData.CreateNote( ::tools::Rectangle( Point( static_cast< long >( aRealPoint2D.X * 100 ), static_cast< long >( aRealPoint2D.Y * 100 ) ), Size( 1000, 1000 ) ), aNote ); } diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index c7e56544f58a..c7c6b5cccfbc 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -561,6 +561,49 @@ void PDFWriterImpl::appendNonStrokingColor( const Color& rColor, OStringBuffer& } } +namespace +{ + +void appendPdfTimeDate(OStringBuffer & rBuffer, +sal_Int16 year, sal_uInt16 month, sal_uInt16 day, sal_uInt16 hours, sal_uInt16 minutes, sal_uInt16 seconds, sal_uInt32 tzDelta) +{ +rBuffer.append("D:"); +rBuffer.append(char('0' + ((year / 1000) % 10))); +rBuffer.append(char('0' + ((year / 100) % 10))); +rBuffer.append(char('0' + ((year / 10) % 10))); +rBuffer.append(char('0' + (year % 10))); +rBuffer.append(char('0' + ((month / 10) % 10))); +rBuffer.append(char('0' + (month % 10))); +rBuffer.append(char('0' + ((day / 10) % 10))); +rBuffer.append(char('0' + (day % 10))); +rBuffer.append(char('0' + ((hours / 10) % 10))); +rBuffer.append(char('0' + (hours % 10))); +rBuffer.append(char('0' + ((minutes / 10) % 10))); +rBuffer.append(char('0' + (minutes % 10))); +rBuffer.append(char('0' + ((seconds / 10) % 10))); +rBuffer.append(char('0' + (seconds % 10))); + +if (tzDelta == 0) +{ +rBuffer.append("Z"); +} +else +{ +if (tzDelta > 0 ) +rBuffer.append("+"); +else +rBuffer.append("-"); + +rBuffer.append(char('0' + ((tzDelta / 36000) % 10))); +rBuffer.append(char('0' + ((tzDelta / 3600) % 10))); +rBuffer.append("'"); +rBuffer.append(char('0' + ((tzD
[Libreoffice-commits] core.git: include/vcl sd/source vcl/source
include/vcl/pdfread.hxx | 16 ++-- sd/source/filter/pdf/sdpdffilter.cxx | 26 -- vcl/source/filter/ipdf/pdfread.cxx | 31 ++- 3 files changed, 68 insertions(+), 5 deletions(-) New commits: commit 3870dd43e94c440a5094a57c47d3b7565658d73c Author: Tomaž Vajngerl AuthorDate: Thu Jun 18 13:30:38 2020 +0200 Commit: Tomaž Vajngerl CommitDate: Sun Jun 21 13:32:08 2020 +0200 sd: support adding PDF text / pop-up annotations as comments Change-Id: I3e072f011089864f3349a470a32412cc33bcc022 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96758 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/include/vcl/pdfread.hxx b/include/vcl/pdfread.hxx index a65d230279b9..d79115f40249 100644 --- a/include/vcl/pdfread.hxx +++ b/include/vcl/pdfread.hxx @@ -14,6 +14,7 @@ #include #include #include +#include namespace com::sun::star::uno { @@ -31,16 +32,27 @@ VCL_DLLPUBLIC size_t RenderPDFBitmaps(const void* pBuffer, int nSize, std::vecto /// Imports a PDF stream into rGraphic as VectorGraphicData. VCL_DLLPUBLIC bool ImportPDF(SvStream& rStream, Graphic& rGraphic); +struct PDFGraphicAnnotation +{ +OUString maAuthor; +OUString maText; +// In HMM +basegfx::B2DRectangle maRectangle; +}; + struct PDFGraphicResult { Graphic maGraphic; - // Size in HMM Size maSize; -PDFGraphicResult(Graphic const& rGraphic, Size const& rSize) +std::vector maAnnotations; + +PDFGraphicResult(Graphic const& rGraphic, Size const& rSize, + std::vector const& aAnnotations) : maGraphic(rGraphic) , maSize(rSize) +, maAnnotations(aAnnotations) { } }; diff --git a/sd/source/filter/pdf/sdpdffilter.cxx b/sd/source/filter/pdf/sdpdffilter.cxx index 2b09bc9e828e..da989974bc87 100644 --- a/sd/source/filter/pdf/sdpdffilter.cxx +++ b/sd/source/filter/pdf/sdpdffilter.cxx @@ -29,6 +29,11 @@ #include #include +#include +#include + +using namespace css; + SdPdfFilter::SdPdfFilter(SfxMedium& rMedium, sd::DrawDocShell& rDocShell) : SdFilter(rMedium, rDocShell) { @@ -65,11 +70,28 @@ bool SdPdfFilter::Import() // Make the page size match the rendered image. pPage->SetSize(aSizeHMM); -Point aPosition(0, 0); SdrGrafObj* pSdrGrafObj = new SdrGrafObj(pPage->getSdrModelFromSdrPage(), rGraphic, - tools::Rectangle(aPosition, aSizeHMM)); + tools::Rectangle(Point(), aSizeHMM)); pPage->InsertObject(pSdrGrafObj); + +for (auto const& rPDFAnnotation : rPDFGraphicResult.maAnnotations) +{ +uno::Reference xAnnotation; +pPage->createAnnotation(xAnnotation); + +xAnnotation->setAuthor(rPDFAnnotation.maAuthor); + +uno::Reference xText(xAnnotation->getTextRange()); +xText->setString(rPDFAnnotation.maText); +// position is in mm not 100thmm +geometry::RealPoint2D aUnoPosition(rPDFAnnotation.maRectangle.getMinX() / 100.0, + rPDFAnnotation.maRectangle.getMinY() / 100.00); +geometry::RealSize2D aUnoSize(rPDFAnnotation.maRectangle.getWidth() / 100.0, + rPDFAnnotation.maRectangle.getHeight() / 100.00); +xAnnotation->setPosition(aUnoPosition); +xAnnotation->setSize(aUnoSize); +} } return true; diff --git a/vcl/source/filter/ipdf/pdfread.cxx b/vcl/source/filter/ipdf/pdfread.cxx index 9845c6c387c4..b5e63937bf00 100644 --- a/vcl/source/filter/ipdf/pdfread.cxx +++ b/vcl/source/filter/ipdf/pdfread.cxx @@ -278,7 +278,36 @@ size_t ImportPDFUnloaded(const OUString& rURL, std::vector& rG Graphic aGraphic(aVectorGraphicDataPtr); aGraphic.SetGfxLink(pGfxLink); -rGraphics.emplace_back(std::move(aGraphic), Size(nPageWidth, nPageHeight)); +auto pPage = pPdfDocument->openPage(nPageIndex); + +std::vector aPDFGraphicAnnotations; +for (int nAnnotation = 0; nAnnotation < pPage->getAnnotationCount(); nAnnotation++) +{ +auto pAnnotation = pPage->getAnnotation(nAnnotation); +if (pAnnotation && pAnnotation->getSubType() == 1 /*FPDF_ANNOT_TEXT*/ +&& pAnnotation->hasKey(vcl::pdf::constDictionaryKeyPopup)) +{ +OUString sAuthor = pAnnotation->getString(vcl::pdf::constDictionaryKeyTitle); +OUString sText = pAnnotation->getString(vcl::pdf::constDictionaryKeyContents); +auto pPopupAnnotation = pAnnotation->getLinked(vcl::pdf::constDictionaryKeyPopup); + +basegfx::B2DRectangle rRectangle = pAnnotation->getRectangle(); +basegfx::B2DRectangle rRectangleHMM( +convertPoi
[Libreoffice-commits] core.git: include/vcl sd/source vcl/source
include/vcl/pdfread.hxx | 18 -- sd/source/filter/pdf/sdpdffilter.cxx |8 vcl/source/filter/ipdf/pdfread.cxx |2 +- 3 files changed, 21 insertions(+), 7 deletions(-) New commits: commit 03f0ea92bc381ef5a8df7de1ae9edf4aed45a3b2 Author: Tomaž Vajngerl AuthorDate: Mon Jun 15 14:07:04 2020 +0200 Commit: Tomaž Vajngerl CommitDate: Sat Jun 20 14:24:01 2020 +0200 vcl: add PDFGraphicResult instead of std::pair in ImportPDFUnloaded ImportPDFUnloaded returned graphics as a vector of std::pair with Graphic and Size. Instead, use a new struct PDFGraphicResult, so it can be extended in the future. Change-Id: Idda00a3b98a8efcbd9b8c8d0ee3982becfdc1d7f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96755 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/include/vcl/pdfread.hxx b/include/vcl/pdfread.hxx index ba0eb1ca85be..a65d230279b9 100644 --- a/include/vcl/pdfread.hxx +++ b/include/vcl/pdfread.hxx @@ -13,13 +13,13 @@ #include #include #include +#include namespace com::sun::star::uno { template class Sequence; } class Bitmap; -class Graphic; namespace vcl { @@ -31,10 +31,24 @@ VCL_DLLPUBLIC size_t RenderPDFBitmaps(const void* pBuffer, int nSize, std::vecto /// Imports a PDF stream into rGraphic as VectorGraphicData. VCL_DLLPUBLIC bool ImportPDF(SvStream& rStream, Graphic& rGraphic); +struct PDFGraphicResult +{ +Graphic maGraphic; + +// Size in HMM +Size maSize; + +PDFGraphicResult(Graphic const& rGraphic, Size const& rSize) +: maGraphic(rGraphic) +, maSize(rSize) +{ +} +}; + /// Import PDF as Graphic images (1 per page), but not loaded yet. /// Returns the number of pages read. VCL_DLLPUBLIC size_t ImportPDFUnloaded(const OUString& rURL, - std::vector>& rGraphics); + std::vector& rGraphics); } #endif // INCLUDED_VCL_SOURCE_FILTER_IPDF_PDFREAD_HXX diff --git a/sd/source/filter/pdf/sdpdffilter.cxx b/sd/source/filter/pdf/sdpdffilter.cxx index 55d21f4057b8..2b09bc9e828e 100644 --- a/sd/source/filter/pdf/sdpdffilter.cxx +++ b/sd/source/filter/pdf/sdpdffilter.cxx @@ -41,7 +41,7 @@ bool SdPdfFilter::Import() const OUString aFileName( mrMedium.GetURLObject().GetMainURL(INetURLObject::DecodeMechanism::NONE)); -std::vector> aGraphics; +std::vector aGraphics; if (vcl::ImportPDFUnloaded(aFileName, aGraphics) == 0) return false; @@ -52,10 +52,10 @@ bool SdPdfFilter::Import() mrDocument.DuplicatePage(0); } -for (const std::pair& aPair : aGraphics) +for (vcl::PDFGraphicResult const& rPDFGraphicResult : aGraphics) { -const Graphic& rGraphic = aPair.first; -const Size& aSizeHMM = aPair.second; +const Graphic& rGraphic = rPDFGraphicResult.maGraphic; +const Size& aSizeHMM = rPDFGraphicResult.maSize; const sal_Int32 nPageNumber = rGraphic.getPageNumber(); assert(nPageNumber >= 0 && o3tl::make_unsigned(nPageNumber) < aGraphics.size()); diff --git a/vcl/source/filter/ipdf/pdfread.cxx b/vcl/source/filter/ipdf/pdfread.cxx index 10caf1a975f5..9845c6c387c4 100644 --- a/vcl/source/filter/ipdf/pdfread.cxx +++ b/vcl/source/filter/ipdf/pdfread.cxx @@ -224,7 +224,7 @@ bool ImportPDF(SvStream& rStream, Graphic& rGraphic) return true; } -size_t ImportPDFUnloaded(const OUString& rURL, std::vector>& rGraphics) +size_t ImportPDFUnloaded(const OUString& rURL, std::vector& rGraphics) { #if HAVE_FEATURE_PDFIUM std::unique_ptr xStream( ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: include/vcl sd/source vcl/source
include/vcl/pdfread.hxx | 18 +++--- sd/source/filter/pdf/sdpdffilter.cxx | 17 - vcl/source/filter/ipdf/pdfread.cxx | 13 - 3 files changed, 15 insertions(+), 33 deletions(-) New commits: commit 489b18edd6dc87287f260ba87d95abcc95d87932 Author: Tomaž Vajngerl AuthorDate: Sun Mar 29 16:30:19 2020 +0200 Commit: Tomaž Vajngerl CommitDate: Sun Mar 29 22:19:32 2020 +0200 pdfium: fix setting the size of the document when opening PDF When loading the pages of PDF, the size of the document was set to the wrong value. Size returned by ImportPDFUnloaded was in pixels, which is not really useful considering the svx and sd core uses 100th mm as the unit and converting it to a device dependent pixel will just bring grief. Also we don't need to know the size in pixels until we actually render. This change removes DPI as the parameter to the ImportPDFUnloaded and changes the code to get the size of the page from the PDF as points and converts that to 100th mm. Change-Id: I0c0db23d2775e2897ba7621ef6320a974c0b9275 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91330 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/include/vcl/pdfread.hxx b/include/vcl/pdfread.hxx index b56e8139447d..ba0eb1ca85be 100644 --- a/include/vcl/pdfread.hxx +++ b/include/vcl/pdfread.hxx @@ -14,19 +14,10 @@ #include #include -namespace com -{ -namespace sun -{ -namespace star -{ -namespace uno +namespace com::sun::star::uno { template class Sequence; } -} -} -} class Bitmap; class Graphic; @@ -40,13 +31,10 @@ VCL_DLLPUBLIC size_t RenderPDFBitmaps(const void* pBuffer, int nSize, std::vecto /// Imports a PDF stream into rGraphic as VectorGraphicData. VCL_DLLPUBLIC bool ImportPDF(SvStream& rStream, Graphic& rGraphic); -/// Import PDF as Graphic images (1 per page), all unloaded. -/// Since Graphic is unloaded, we need to return the page size (in pixels) separately. -/// Does not set rPdfData if no conversion is done. +/// Import PDF as Graphic images (1 per page), but not loaded yet. /// Returns the number of pages read. VCL_DLLPUBLIC size_t ImportPDFUnloaded(const OUString& rURL, - std::vector>& rGraphics, - double fResolutionDPI = 96.); + std::vector>& rGraphics); } #endif // INCLUDED_VCL_SOURCE_FILTER_IPDF_PDFREAD_HXX diff --git a/sd/source/filter/pdf/sdpdffilter.cxx b/sd/source/filter/pdf/sdpdffilter.cxx index 22df932e7ee8..55d21f4057b8 100644 --- a/sd/source/filter/pdf/sdpdffilter.cxx +++ b/sd/source/filter/pdf/sdpdffilter.cxx @@ -41,11 +41,8 @@ bool SdPdfFilter::Import() const OUString aFileName( mrMedium.GetURLObject().GetMainURL(INetURLObject::DecodeMechanism::NONE)); -// Rendering resolution. -const double dResolutionDPI = 96.0; - std::vector> aGraphics; -if (vcl::ImportPDFUnloaded(aFileName, aGraphics, dResolutionDPI) == 0) +if (vcl::ImportPDFUnloaded(aFileName, aGraphics) == 0) return false; // Add as many pages as we need up-front. @@ -58,26 +55,20 @@ bool SdPdfFilter::Import() for (const std::pair& aPair : aGraphics) { const Graphic& rGraphic = aPair.first; -const Size& aSize = aPair.second; +const Size& aSizeHMM = aPair.second; const sal_Int32 nPageNumber = rGraphic.getPageNumber(); assert(nPageNumber >= 0 && o3tl::make_unsigned(nPageNumber) < aGraphics.size()); // Create the page and insert the Graphic. SdPage* pPage = mrDocument.GetSdPage(nPageNumber, PageKind::Standard); -Size aGraphicSize(OutputDevice::LogicToLogic(aSize, rGraphic.GetPrefMapMode(), - MapMode(MapUnit::Map100thMM))); - -// Resize to original size based on 72 dpi to preserve page size. -aGraphicSize = Size(aGraphicSize.Width() * 72.0 / dResolutionDPI, -aGraphicSize.Height() * 72.0 / dResolutionDPI); // Make the page size match the rendered image. -pPage->SetSize(aGraphicSize); +pPage->SetSize(aSizeHMM); Point aPosition(0, 0); SdrGrafObj* pSdrGrafObj = new SdrGrafObj(pPage->getSdrModelFromSdrPage(), rGraphic, - tools::Rectangle(aPosition, aGraphicSize)); + tools::Rectangle(aPosition, aSizeHMM)); pPage->InsertObject(pSdrGrafObj); } diff --git a/vcl/source/filter/ipdf/pdfread.cxx b/vcl/source/filter/ipdf/pdfread.cxx index b85a79d86e4a..8a90b0ab93ca 100644 --- a/vcl/source/filter/ipdf/pdfread.cxx +++ b/vcl/source/filter/ipdf/pdfread.cxx @@ -234,8 +234,7 @@ bool ImportPDF(SvStream& rStream, Graphic& rGraphic) return true; } -size_t ImportPDFUnloaded(const OUString& rURL, std::vect
[Libreoffice-commits] core.git: include/vcl sd/source vcl/source
include/vcl/pdfread.hxx | 12 +- sd/source/filter/pdf/sdpdffilter.cxx | 36 +++--- vcl/source/filter/ipdf/pdfread.cxx | 70 +++ 3 files changed, 95 insertions(+), 23 deletions(-) New commits: commit 9194f019afb0599d5e72476786fabfa996e07f20 Author: Ashod Nakashian AuthorDate: Sat Jun 9 13:09:35 2018 -0400 Commit: Ashod Nakashian CommitDate: Sun Aug 25 13:31:53 2019 +0200 pdfium: Import PDF with unloaded images. Reviewed-on: https://gerrit.libreoffice.org/56268 Reviewed-by: Ashod Nakashian Tested-by: Ashod Nakashian (cherry picked from commit e07561d2ae743b208a0807ef32d7f011614b73e5) Change-Id: I5e4a16ff38b9643127ce16879b35f456c13bcff8 Reviewed-on: https://gerrit.libreoffice.org/77688 Tested-by: Jenkins Reviewed-by: Ashod Nakashian diff --git a/include/vcl/pdfread.hxx b/include/vcl/pdfread.hxx index 1de9cfc9b259..1e555d9841c7 100644 --- a/include/vcl/pdfread.hxx +++ b/include/vcl/pdfread.hxx @@ -11,6 +11,7 @@ #define INCLUDED_VCL_SOURCE_FILTER_IPDF_PDFREAD_HXX #include +#include #include namespace com @@ -45,7 +46,16 @@ VCL_DLLPUBLIC bool ImportPDF(SvStream& rStream, Bitmap& rBitmap, size_t nPageInd VCL_DLLPUBLIC bool ImportPDF(SvStream& rStream, Graphic& rGraphic, double fResolutionDPI = 96.); VCL_DLLPUBLIC size_t ImportPDF(const OUString& rURL, std::vector& rBitmaps, - css::uno::Sequence& rPdfData, double fResolutionDPI = 96.); + css::uno::Sequence& rPdfData, + const double fResolutionDPI = 96.); + +/// Import PDF as Graphic images (1 per page), all unloaded. +/// Since Graphic is unloaded, we need to return the page size (in pixels) separately. +/// Does not set rPdfData if no conversion is done. +/// Returns the number of pages read. +VCL_DLLPUBLIC size_t ImportPDFUnloaded(const OUString& rURL, + std::vector>& rGraphics, + const double fResolutionDPI = 96.); } #endif // INCLUDED_VCL_SOURCE_FILTER_IPDF_PDFREAD_HXX diff --git a/sd/source/filter/pdf/sdpdffilter.cxx b/sd/source/filter/pdf/sdpdffilter.cxx index 3fe38252b626..0cf7baa9dd6c 100644 --- a/sd/source/filter/pdf/sdpdffilter.cxx +++ b/sd/source/filter/pdf/sdpdffilter.cxx @@ -54,37 +54,29 @@ bool SdPdfFilter::Import() // Rendering resolution. const double dResolutionDPI = 96.; -uno::Sequence aPdfData; -std::vector aBitmaps; -if (vcl::ImportPDF(aFileName, aBitmaps, aPdfData, dResolutionDPI) == 0) +std::vector> aGraphics; +if (vcl::ImportPDFUnloaded(aFileName, aGraphics, dResolutionDPI) == 0) return false; -// Prepare the link with the PDF stream. -const size_t nGraphicContentSize = aPdfData.getLength(); -std::unique_ptr pGraphicContent(new sal_uInt8[nGraphicContentSize]); -memcpy(pGraphicContent.get(), aPdfData.get(), nGraphicContentSize); -std::shared_ptr pGfxLink(std::make_shared( -std::move(pGraphicContent), nGraphicContentSize, GfxLinkType::NativePdf)); -auto pPdfData = std::make_shared>(aPdfData); - +// Add as many pages as we need up-front. mrDocument.CreateFirstPages(); -for (size_t i = 0; i < aBitmaps.size() - 1; ++i) +for (size_t i = 0; i < aGraphics.size() - 1; ++i) { mrDocument.DuplicatePage(0); } -size_t nPageNumber = 0; -for (const Bitmap& aBitmap : aBitmaps) +for (const std::pair& aPair : aGraphics) { -// Create the Graphic and link the original PDF stream. -Graphic aGraphic(aBitmap); -aGraphic.setPdfData(pPdfData); -aGraphic.setPageNumber(nPageNumber); -aGraphic.SetGfxLink(pGfxLink); +const Graphic& rGraphic = aPair.first; +const Size& aSize = aPair.second; + +const sal_Int32 nPageNumber = rGraphic.getPageNumber(); +if (nPageNumber < 0 || static_cast(nPageNumber) >= aGraphics.size()) +continue; // Page is out of range // Create the page and insert the Graphic. -SdPage* pPage = mrDocument.GetSdPage(nPageNumber++, PageKind::Standard); -Size aGrfSize(OutputDevice::LogicToLogic(aGraphic.GetPrefSize(), aGraphic.GetPrefMapMode(), +SdPage* pPage = mrDocument.GetSdPage(nPageNumber, PageKind::Standard); +Size aGrfSize(OutputDevice::LogicToLogic(aSize, rGraphic.GetPrefMapMode(), MapMode(MapUnit::Map100thMM))); // Resize to original size based on 72 dpi to preserve page size. @@ -95,7 +87,7 @@ bool SdPdfFilter::Import() pPage->SetSize(aGrfSize); Point aPos(0, 0); -pPage->InsertObject(new SdrGrafObj(pPage->getSdrModelFromSdrPage(), aGraphic, +pPage->InsertObject(new SdrGrafObj(pPage->getSdrModelFromSdrPage(), rGraphic, tools::Rectang
[Libreoffice-commits] core.git: include/vcl sd/source vcl/source
include/vcl/image.hxx |3 +++ sd/source/ui/controller/slidelayoutcontroller.cxx |2 +- vcl/source/control/fixed.cxx |2 +- vcl/source/image/Image.cxx|5 + vcl/source/window/builder.cxx |4 ++-- vcl/source/window/msgbox.cxx |8 6 files changed, 16 insertions(+), 8 deletions(-) New commits: commit 0f104bf33530467380044b9eb4cd3f8bd9c283f1 Author: Noel Grandin AuthorDate: Fri Dec 7 14:25:36 2018 +0200 Commit: Noel Grandin CommitDate: Fri Dec 7 20:14:45 2018 +0100 utility constructor for Image "private:graphicrepository" urls Change-Id: I118039f4e47818a43da9302ce3550ea800522675 Reviewed-on: https://gerrit.libreoffice.org/64765 Reviewed-by: Michael Meeks Tested-by: Jenkins diff --git a/include/vcl/image.hxx b/include/vcl/image.hxx index 17bfce780461..c115a676102d 100644 --- a/include/vcl/image.hxx +++ b/include/vcl/image.hxx @@ -45,6 +45,8 @@ namespace vcl #define IMAGELIST_IMAGE_NOTFOUND(sal_uInt16(0x)) +enum class StockImage { Yes }; + class SAL_WARN_UNUSED VCL_DLLPUBLIC Image { friend class ::OutputDevice; @@ -54,6 +56,7 @@ public: explicit Image( const BitmapEx& rBitmapEx ); explicit Image( const css::uno::Reference< css::graphic::XGraphic >& rxGraphic ); explicit Image( const OUString &rPNGFileUrl ); +explicit Image( StockImage, const OUString &rPNGFilePath ); SizeGetSizePixel() const; diff --git a/sd/source/ui/controller/slidelayoutcontroller.cxx b/sd/source/ui/controller/slidelayoutcontroller.cxx index 6f4ba93c1e92..27d597b2172f 100644 --- a/sd/source/ui/controller/slidelayoutcontroller.cxx +++ b/sd/source/ui/controller/slidelayoutcontroller.cxx @@ -132,7 +132,7 @@ static void fillLayoutValueSet( ValueSet* pValue, const snewfoil_value_info_layo for( ; pInfo->mpStrResId; pInfo++ ) { OUString aText(SdResId(pInfo->mpStrResId)); -Image aImg("private:graphicrepository/" + OUString::createFromAscii(pInfo->msBmpResId)); +Image aImg(StockImage::Yes, OUString::createFromAscii(pInfo->msBmpResId)); pValue->InsertItem(static_cast(pInfo->maAutoLayout)+1, aImg, aText); aLayoutItemSize.setWidth( std::max( aLayoutItemSize.Width(), aImg.GetSizePixel().Width() ) ); aLayoutItemSize.setHeight( std::max( aLayoutItemSize.Height(), aImg.GetSizePixel().Height() ) ); diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx index 7423859045d5..365c421e9b34 100644 --- a/vcl/source/control/fixed.cxx +++ b/vcl/source/control/fixed.cxx @@ -951,7 +951,7 @@ void FixedImage::SetModeImage( const Image& rImage ) Image FixedImage::loadThemeImage(const OUString &rFileName) { -return Image("private:graphicrepository/" + rFileName); +return Image(StockImage::Yes, rFileName); } bool FixedImage::set_property(const OString &rKey, const OUString &rValue) diff --git a/vcl/source/image/Image.cxx b/vcl/source/image/Image.cxx index ecb514c5bbac..e22f5f814304 100644 --- a/vcl/source/image/Image.cxx +++ b/vcl/source/image/Image.cxx @@ -70,6 +70,11 @@ Image::Image(const OUString & rFileUrl) } } +Image::Image(StockImage, const OUString & rFileUrl) +: mpImplData(new ImplImage(rFileUrl)) +{ +} + void Image::ImplInit(const BitmapEx& rBitmapEx) { if (!rBitmapEx.IsEmpty()) diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 8ff3f0621d2a..210982ddb365 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -676,7 +676,7 @@ VclBuilder::VclBuilder(vcl::Window *pParent, const OUString& sUIDir, const OUStr SAL_WARN_IF(eType != SymbolType::IMAGE, "vcl.layout", "unimplemented symbol type for radiobuttons"); if (eType == SymbolType::IMAGE) { -Image const aImage("private:graphicrepository/" + +Image const aImage(StockImage::Yes, mapStockToImageResource(rImageInfo.m_sStock)); if (!elem.m_bRadio) pTargetButton->SetModeImage(aImage); @@ -721,7 +721,7 @@ VclBuilder::VclBuilder(vcl::Window *pParent, const OUString& sUIDir, const OUStr if (eType != SymbolType::IMAGE) continue; -Image const aImage("private:graphicrepository/" + +Image const aImage(StockImage::Yes, mapStockToImageResource(rImageInfo.m_sStock)); pImage->SetImage(aImage); } diff --git a/vcl/source/window/msgbox.cxx b/vcl/source/window/msgbox.cxx index 31307c542a9c..23f7ca2f5e73 100644 --- a/vcl/source/window/msgbox.cxx +++ b/vcl/source/window/msgbox.cxx @@ -40,10 +40,10 @@ static void ImplInitMsgBoxImageList() std::vector &rImages = pSVData->maWinData.maMsgBoxImgList; if (rImages.empty())
[Libreoffice-commits] core.git: include/vcl sd/source vcl/source
include/vcl/pdfextoutdevdata.hxx|4 +- include/vcl/pdfwriter.hxx |5 --- sd/source/ui/unoidl/unomodel.cxx| 14 - vcl/source/gdi/pdfextoutdevdata.cxx |2 - vcl/source/gdi/pdfwriter_impl.cxx | 52 ++-- 5 files changed, 15 insertions(+), 62 deletions(-) New commits: commit 76e0f23171d899ef567b04b555a748b60f99353c Author: Noel Grandin Date: Wed Feb 8 15:00:15 2017 +0200 convert DestAreaType to scoped enum and drop read-only enumerators Change-Id: Ibc4c2a99448a83fc179e2779f8f3e5c8f034ae7b Reviewed-on: https://gerrit.libreoffice.org/34059 Reviewed-by: Noel Grandin Tested-by: Noel Grandin diff --git a/include/vcl/pdfextoutdevdata.hxx b/include/vcl/pdfextoutdevdata.hxx index 566ff2a..2305814 100644 --- a/include/vcl/pdfextoutdevdata.hxx +++ b/include/vcl/pdfextoutdevdata.hxx @@ -226,7 +226,7 @@ public: /** provides detailed information about a destination range which previously has been registered using RegisterDest. */ -voidDescribeRegisteredDest( sal_Int32 nDestId, const Rectangle& rRect, sal_Int32 nPageNr, PDFWriter::DestAreaType eType = PDFWriter::XYZ ); +voidDescribeRegisteredDest( sal_Int32 nDestId, const Rectangle& rRect, sal_Int32 nPageNr, PDFWriter::DestAreaType eType = PDFWriter::DestAreaType::XYZ ); //<---i56629 @@ -246,7 +246,7 @@ public: the destination id (to be used in SetLinkDest) or -1 if page id does not exist */ -sal_Int32 CreateDest( const Rectangle& rRect, sal_Int32 nPageNr = -1, PDFWriter::DestAreaType eType = PDFWriter::XYZ ); +sal_Int32 CreateDest( const Rectangle& rRect, sal_Int32 nPageNr = -1, PDFWriter::DestAreaType eType = PDFWriter::DestAreaType::XYZ ); /** Create a new link on a page @param rRect diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx index 75f1230..d75b4ac 100644 --- a/include/vcl/pdfwriter.hxx +++ b/include/vcl/pdfwriter.hxx @@ -107,10 +107,7 @@ public: enum PDFVersion { PDF_1_2, PDF_1_3, PDF_1_4, PDF_1_5, PDF_A_1 };//i59651, PDF/A-1b & -1a, only -1b implemented for now // for the meaning of DestAreaType please look at PDF Reference Manual // version 1.4 section 8.2.1, page 475 -enum DestAreaType { XYZ, Fit, FitHorizontal, FitVertical, -FitRectangle, FitPageBoundingBox, FitPageBoundingBoxHorizontal, -FitPageBoundingBoxVertical -}; +enum class DestAreaType { XYZ, FitRectangle }; // for a definition of structural element types please refer to // PDF Reference, 3rd ed. section 9.7.4 diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index a7099f2..d529736 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -1657,14 +1657,14 @@ void ImplPDFExportShapeInteraction( const uno::Reference< drawing::XShape >& xSh case presentation::ClickAction_LASTPAGE : { sal_Int32 nCount = rDoc.GetSdPageCount( PageKind::Standard ); -sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, nCount - 1, vcl::PDFWriter::FitRectangle ); +sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, nCount - 1, vcl::PDFWriter::DestAreaType::FitRectangle ); sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect ); rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId ); } break; case presentation::ClickAction_FIRSTPAGE : { -sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, 0, vcl::PDFWriter::FitRectangle ); +sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, 0, vcl::PDFWriter::DestAreaType::FitRectangle ); sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect ); rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId ); } @@ -1674,7 +1674,7 @@ void ImplPDFExportShapeInteraction( const uno::Reference< drawing::XShape >& xSh sal_Int32 nDestPage = rPDFExtOutDevData.GetCurrentPageNumber(); if ( nDestPage ) nDestPage--; -sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, nDestPage, vcl::PDFWriter::FitRectangle ); +sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, nDestPage, vcl::PDFWriter::DestAreaType::FitRectangle ); sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect ); rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId ); } @@ -1685,7 +1685,7 @@ void ImplPDFExportShapeInteraction( const uno::Reference< drawing::XShape >& xS
[Libreoffice-commits] core.git: include/vcl sd/source vcl/source
include/vcl/pdfwriter.hxx |5 ++--- sd/source/ui/unoidl/unomodel.cxx | 30 +++--- vcl/source/gdi/pdfwriter_impl.cxx | 38 -- 3 files changed, 33 insertions(+), 40 deletions(-) New commits: commit 4ccdf7932e84bd78a366bb4ae2785c63e33a9403 Author: Noel Grandin Date: Wed Feb 8 14:49:07 2017 +0200 convert PDFWriter::PageTransition to scoped enum and drop some read-only enumerators Change-Id: I96380efec90abe02fa02c3f766f2b6180723da0d Reviewed-on: https://gerrit.libreoffice.org/34058 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx index 29aecc7..75f1230 100644 --- a/include/vcl/pdfwriter.hxx +++ b/include/vcl/pdfwriter.hxx @@ -177,7 +177,7 @@ public: Disc, Circle, Square, Decimal, UpperRoman, LowerRoman, UpperAlpha, LowerAlpha }; -enum PageTransition +enum class PageTransition { Regular, SplitHorizontalInward, SplitHorizontalOutward, @@ -185,8 +185,7 @@ public: BlindsHorizontal, BlindsVertical, BoxInward, BoxOutward, WipeLeftToRight, WipeBottomToTop, WipeRightToLeft, WipeTopToBottom, -Dissolve, -GlitterLeftToRight, GlitterTopToBottom, GlitterTopLeftToBottomRight +Dissolve }; enum WidgetType diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index ff7fce0..a7099f2 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -2036,7 +2036,7 @@ void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& r } } presentation::FadeEffect eFe; -vcl::PDFWriter::PageTransition eType = vcl::PDFWriter::Regular; +vcl::PDFWriter::PageTransition eType = vcl::PDFWriter::PageTransition::Regular; if ( xPagePropSet->getPropertySetInfo( )->hasPropertyByName( sEffect ) ) { aAny = xPagePropSet->getPropertyValue( sEffect ); @@ -2046,11 +2046,11 @@ void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& r { case presentation::FadeEffect_HORIZONTAL_LINES : case presentation::FadeEffect_HORIZONTAL_CHECKERBOARD : -case presentation::FadeEffect_HORIZONTAL_STRIPES : eType = vcl::PDFWriter::BlindsHorizontal; break; +case presentation::FadeEffect_HORIZONTAL_STRIPES : eType = vcl::PDFWriter::PageTransition::BlindsHorizontal; break; case presentation::FadeEffect_VERTICAL_LINES : case presentation::FadeEffect_VERTICAL_CHECKERBOARD : -case presentation::FadeEffect_VERTICAL_STRIPES : eType = vcl::PDFWriter::BlindsVertical; break; +case presentation::FadeEffect_VERTICAL_STRIPES : eType = vcl::PDFWriter::PageTransition::BlindsVertical; break; case presentation::FadeEffect_UNCOVER_TO_RIGHT : case presentation::FadeEffect_UNCOVER_TO_UPPERRIGHT : @@ -2058,7 +2058,7 @@ void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& r case presentation::FadeEffect_FADE_FROM_UPPERLEFT : case presentation::FadeEffect_MOVE_FROM_UPPERLEFT : case presentation::FadeEffect_FADE_FROM_LEFT : -case presentation::FadeEffect_MOVE_FROM_LEFT : eType = vcl::PDFWriter::WipeLeftToRight; break; +case presentation::FadeEffect_MOVE_FROM_LEFT : eType = vcl::PDFWriter::PageTransition::WipeLeftToRight; break; case presentation::FadeEffect_UNCOVER_TO_BOTTOM : case presentation::FadeEffect_UNCOVER_TO_LOWERRIGHT : @@ -2066,7 +2066,7 @@ void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& r case presentatio
[Libreoffice-commits] core.git: include/vcl sd/source vcl/source
include/vcl/pdfextoutdevdata.hxx|4 +- include/vcl/pdfwriter.hxx |2 + sd/source/ui/unoidl/unomodel.cxx|9 - vcl/source/gdi/pdfextoutdevdata.cxx | 16 + vcl/source/gdi/pdfwriter.cxx|5 +++ vcl/source/gdi/pdfwriter_impl.cxx | 60 vcl/source/gdi/pdfwriter_impl.hxx | 11 ++ 7 files changed, 99 insertions(+), 8 deletions(-) New commits: commit 4ad249af88d15f2c8a09f0721a59d82718fcc201 Author: Miklos Vajna Date: Wed Jan 4 15:28:41 2017 +0100 tdf#105093 sd PDF export: handle embedded videos In practie embedded files always have a temp file URL, so from the PDF export's point of view they are still URLs, just at the end the contents of the URL is embedded to the PDF, not just the URL itself. So add a SetScreenStream() that's similar to SetScreenURL(), but it's for embedded, not linked videos. Change-Id: Ifcc60357ef0f5fed0bdec02e0c84cb16ee147781 Reviewed-on: https://gerrit.libreoffice.org/32727 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/include/vcl/pdfextoutdevdata.hxx b/include/vcl/pdfextoutdevdata.hxx index e3a05d9..566ff2a 100644 --- a/include/vcl/pdfextoutdevdata.hxx +++ b/include/vcl/pdfextoutdevdata.hxx @@ -298,8 +298,10 @@ public: */ sal_Int32 SetLinkURL( sal_Int32 nLinkId, const OUString& rURL ); -/// Set URL for a Screen annotation. +/// Set URL for a linked Screen annotation. void SetScreenURL(sal_Int32 nScreenId, const OUString& rURL); +/// Set URL for an embedded Screen annotation. +void SetScreenStream(sal_Int32 nScreenId, const OUString& rURL); /** Create a new outline item diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx index 888cddb..29aecc7 100644 --- a/include/vcl/pdfwriter.hxx +++ b/include/vcl/pdfwriter.hxx @@ -979,6 +979,8 @@ The following structure describes the permissions used in PDF security /// Sets the URL of a linked screen annotation. void SetScreenURL(sal_Int32 nScreenId, const OUString& rURL); +/// Sets the URL of an embedded screen annotation. +void SetScreenStream(sal_Int32 nScreenId, const OUString& rURL); /** Resolve link in logical structure diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 073e70d..d305a29 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -1660,7 +1660,14 @@ void ImplPDFExportShapeInteraction( const uno::Reference< drawing::XShape >& xSh if (!aMediaURL.isEmpty()) { sal_Int32 nScreenId = rPDFExtOutDevData.CreateScreen(aLinkRect, rPDFExtOutDevData.GetCurrentPageNumber()); -rPDFExtOutDevData.SetScreenURL(nScreenId, aMediaURL); +if (aMediaURL.startsWith("vnd.sun.star.Package:")) +{ +OUString aTempFileURL; +xShapePropSet->getPropertyValue("PrivateTempFileURL") >>= aTempFileURL; +rPDFExtOutDevData.SetScreenStream(nScreenId, aTempFileURL); +} +else +rPDFExtOutDevData.SetScreenURL(nScreenId, aMediaURL); } } diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx b/vcl/source/gdi/pdfextoutdevdata.cxx index 0649b45..386e6837 100644 --- a/vcl/source/gdi/pdfextoutdevdata.cxx +++ b/vcl/source/gdi/pdfextoutdevdata.cxx @@ -40,6 +40,7 @@ struct PDFExtOutDevDataSync SetLinkDest, SetLinkURL, SetScreenURL, +SetScreenStream, RegisterDest, CreateOutlineItem, SetOutlineItemParent, @@ -217,6 +218,13 @@ void GlobalSyncData::PlayGlobalActions( PDFWriter& rWriter ) mParaOUStrings.pop_front(); } break; +case PDFExtOutDevDataSync::SetScreenStream: +{ +sal_Int32 nScreenId = GetMappedId(); +rWriter.SetScreenStream(nScreenId, mParaOUStrings.front()); +mParaOUStrings.pop_front(); +} +break; case PDFExtOutDevDataSync::RegisterDest : { const sal_Int32 nDestId = mParaInts.front(); @@ -518,6 +526,7 @@ bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIMtfAc case PDFExtOutDevDataSync::SetLinkDest: case PDFExtOutDevDataSync::SetLinkURL: case PDFExtOutDevDataSync::SetScreenURL: +case PDFExtOutDevDataSync::SetScreenStream: case PDFExtOutDevDataSync::RegisterDest: case PDFExtOutDevDataSync::CreateOutlineItem: case PDFExtOutDevDataSync::SetOutlineItemParent: @@ -726,6 +735,13 @@ void PDFExtOutDevData::SetScreenURL(sal_Int32 nScreenId, const OUStri
[Libreoffice-commits] core.git: include/vcl sd/source vcl/source
include/vcl/pdfextoutdevdata.hxx|8 +++ include/vcl/pdfwriter.hxx |7 ++ sd/source/ui/unoidl/unomodel.cxx| 12 vcl/source/gdi/pdfextoutdevdata.cxx | 40 +++ vcl/source/gdi/pdfwriter.cxx| 11 vcl/source/gdi/pdfwriter_impl.cxx | 91 vcl/source/gdi/pdfwriter_impl.hxx | 14 + 7 files changed, 183 insertions(+) New commits: commit 9d6a749bc664f1876c938afb9eba4adc9f6ee09a Author: Miklos Vajna Date: Mon Jan 2 17:28:57 2017 +0100 tdf#104841 sd PDF export: handle linked videos Use the screen annotation markup for this purpose. Change-Id: I129111cbe08c19c2f3b3ae046408ff9b2a28520c Reviewed-on: https://gerrit.libreoffice.org/32654 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/include/vcl/pdfextoutdevdata.hxx b/include/vcl/pdfextoutdevdata.hxx index 7095b90..1a0c941 100644 --- a/include/vcl/pdfextoutdevdata.hxx +++ b/include/vcl/pdfextoutdevdata.hxx @@ -262,6 +262,10 @@ public: -1 if page id does not exist */ sal_Int32 CreateLink( const Rectangle& rRect, sal_Int32 nPageNr = -1 ); + +/// Create a Screen annotation. +sal_Int32 CreateScreen(const Rectangle& rRect); + /** Set the destination for a link will change a URL type link to a dest link if necessary @@ -293,6 +297,10 @@ public: -1 in case the link id does not exist */ sal_Int32 SetLinkURL( sal_Int32 nLinkId, const OUString& rURL ); + +/// Set URL for a Screen annotation. +void SetScreenURL(sal_Int32 nScreenId, const OUString& rURL); + /** Create a new outline item @param nParent diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx index 67eee15..888cddb 100644 --- a/include/vcl/pdfwriter.hxx +++ b/include/vcl/pdfwriter.hxx @@ -927,6 +927,9 @@ The following structure describes the permissions used in PDF security */ sal_Int32 CreateLink( const Rectangle& rRect, sal_Int32 nPageNr ); +/// Creates a screen annotation. +sal_Int32 CreateScreen(const Rectangle& rRect, sal_Int32 nPageNr); + /** creates a destination which is not intended to be referred to by a link, but by a public destination Id. Form widgets, for instance, might refer to a destination, without ever actually creating a source link to @@ -973,6 +976,10 @@ The following structure describes the permissions used in PDF security service; the result will then appear literally in the PDF file produced */ void SetLinkURL( sal_Int32 nLinkId, const OUString& rURL ); + +/// Sets the URL of a linked screen annotation. +void SetScreenURL(sal_Int32 nScreenId, const OUString& rURL); + /** Resolve link in logical structure If a link is created after the corresponding visual appearance was drawn diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 0da6543..cb269d6 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -1652,6 +1652,18 @@ void ImplPDFExportShapeInteraction( const uno::Reference< drawing::XShape >& xSh awt::Size aShapeSize( xShape->getSize() ); Rectangle aLinkRect( Point( aShapePos.X, aShapePos.Y ), Size( aShapeSize.Width, aShapeSize.Height ) ); +// Handle linked videos. +if (xShape->getShapeType() == "com.sun.star.drawing.MediaShape") +{ +OUString aMediaURL; +xShapePropSet->getPropertyValue("MediaURL") >>= aMediaURL; +if (!aMediaURL.isEmpty()) +{ +sal_Int32 nScreenId = rPDFExtOutDevData.CreateScreen(aLinkRect); +rPDFExtOutDevData.SetScreenURL(nScreenId, aMediaURL); +} +} + presentation::ClickAction eCa; uno::Any aAny( xShapePropSet->getPropertyValue( "OnClick" ) ); if ( aAny >>= eCa ) diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx b/vcl/source/gdi/pdfextoutdevdata.cxx index 73d9232..f85c981 100644 --- a/vcl/source/gdi/pdfextoutdevdata.cxx +++ b/vcl/source/gdi/pdfextoutdevdata.cxx @@ -36,8 +36,10 @@ struct PDFExtOutDevDataSync enum Action{CreateNamedDest, CreateDest, CreateLink, +CreateScreen, SetLinkDest, SetLinkURL, +SetScreenURL, RegisterDest, CreateOutlineItem, SetOutlineItemParent, @@ -183,6 +185,17 @@ void GlobalSyncData::PlayGlobalActions( PDFWriter& rWriter ) rWriter.Pop(); } break; +case PDFExtOutDevDataSync::CreateScreen: +{ +rWriter.Push(PushFlags::MAPMODE); +rWriter.SetMapMode(mParaMapModes.front()); +mParaMapModes.pop_fron
[Libreoffice-commits] core.git: include/vcl sd/source vcl/source
include/vcl/dialog.hxx |5 + sd/source/ui/dlg/brkdlg.cxx |9 +++-- vcl/source/window/dialog.cxx | 18 +++--- 3 files changed, 23 insertions(+), 9 deletions(-) New commits: commit b07163d73a28e7792011edddf246726919364a26 Author: Armin Le Grand Date: Fri Sep 30 12:40:47 2016 +0200 tdf#102852 Fixed BreakDlg Needed to ensure correct return value in dialog and that it repaints Change-Id: I029d10b6699629b2f2f8651f6d96ceceba7a3d8c Reviewed-on: https://gerrit.libreoffice.org/29401 Tested-by: Jenkins Reviewed-by: Armin Le Grand diff --git a/include/vcl/dialog.hxx b/include/vcl/dialog.hxx index da3aa7e..0d763bd 100644 --- a/include/vcl/dialog.hxx +++ b/include/vcl/dialog.hxx @@ -100,6 +100,11 @@ public: virtual void PrePaint(vcl::RenderContext& rRenderContext) override; virtual void PostPaint(vcl::RenderContext& rRenderContext) override; +// ensureRepaint - triggers Application::Yield until the dialog is +// completely repainted. Sometimes needed for dialogs showing progress +// during actions +void ensureRepaint(); + // Screenshot interface virtual std::vector getAllPageUIXMLDescriptions() const; virtual bool selectPageByUIXMLDescription(const OString& rUIXMLDescription); diff --git a/sd/source/ui/dlg/brkdlg.cxx b/sd/source/ui/dlg/brkdlg.cxx index be0c2d5..516a3bc 100644 --- a/sd/source/ui/dlg/brkdlg.cxx +++ b/sd/source/ui/dlg/brkdlg.cxx @@ -145,8 +145,13 @@ IMPL_LINK( BreakDlg, UpDate, void*, nInit, bool ) m_pFiInsInfo->SetText(info); } -Application::Reschedule(); -return bCancel; +// make sure dialog gets painted, it is intended to +// show the progress to the user. Also necessary to +// provide a clickable cancel button +ensureRepaint(); + +// return okay-value (-> !cancel) +return !bCancel; } /** diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index 5884a73..eef4c5a 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -863,14 +863,8 @@ bool Dialog::selectPageByUIXMLDescription(const OString& /*rUIXMLDescription*/) return true; } -Bitmap Dialog::createScreenshot() +void Dialog::ensureRepaint() { -// same prerequisites as in Execute() -setDeferredProperties(); -ImplAdjustNWFSizes(); -Show(); -ToTop(); - // ensure repaint Invalidate(); mbPaintComplete = false; @@ -879,6 +873,16 @@ Bitmap Dialog::createScreenshot() { Application::Yield(); } +} + +Bitmap Dialog::createScreenshot() +{ +// same prerequisites as in Execute() +setDeferredProperties(); +ImplAdjustNWFSizes(); +Show(); +ToTop(); +ensureRepaint(); return GetBitmap(Point(), GetOutputSizePixel()); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: include/vcl sd/source vcl/source
include/vcl/bitmap.hxx | 19 +-- sd/source/ui/dlg/vectdlg.cxx |2 +- vcl/source/gdi/bitmap3.cxx |4 ++-- vcl/source/gdi/impvect.cxx | 14 +++--- vcl/source/gdi/impvect.hxx |4 ++-- vcl/source/outdev/text.cxx |2 +- 6 files changed, 26 insertions(+), 19 deletions(-) New commits: commit 220c9fc2e9fa8c83a1851e3f73682d8300f6dff1 Author: Noel Grandin Date: Wed May 6 11:45:37 2015 +0200 convert BMP_VECTORIZE constants to scoped enum Change-Id: Ifa6614f6a17356481a335a686e9ea0f9b983c5c5 Reviewed-on: https://gerrit.libreoffice.org/15647 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx index 8ee2c87..a9f2146 100644 --- a/include/vcl/bitmap.hxx +++ b/include/vcl/bitmap.hxx @@ -71,10 +71,17 @@ namespace o3tl template<> struct typed_flags : is_typed_flags {}; } -#define BMP_VECTORIZE_INNER 0x0001UL -#define BMP_VECTORIZE_OUTER 0x0002UL -#define BMP_VECTORIZE_BOUND_ONLY0x0004UL -#define BMP_VECTORIZE_REDUCE_EDGES 0x0008UL +enum class BmpVectorizeFlags +{ +Inner = 0x0001, +Outer = 0x0002, +BoundOnly = 0x0004, +ReduceEdges = 0x0008, +}; +namespace o3tl +{ +template<> struct typed_flags : is_typed_flags {}; +} #define BMP_COL_TRANS Color( 252, 3, 251 ) @@ -721,7 +728,7 @@ public: */ boolVectorize( tools::PolyPolygon& rPolyPoly, -sal_uLong nFlags = BMP_VECTORIZE_OUTER, +BmpVectorizeFlags nFlags = BmpVectorizeFlags::Outer, const Link<>* pProgress = NULL ); /** Convert the bitmap to a meta file @@ -748,7 +755,7 @@ public: boolVectorize( GDIMetaFile& rMtf, sal_uInt8 cReduce = 0, -sal_uLong nFlags = BMP_VECTORIZE_INNER, +BmpVectorizeFlags nFlags = BmpVectorizeFlags::Inner, const Link<>* pProgress = NULL ); /** Change various global color characteristics diff --git a/sd/source/ui/dlg/vectdlg.cxx b/sd/source/ui/dlg/vectdlg.cxx index 99271d2..1865ac5 100644 --- a/sd/source/ui/dlg/vectdlg.cxx +++ b/sd/source/ui/dlg/vectdlg.cxx @@ -159,7 +159,7 @@ void SdVectorizeDlg::Calculate( Bitmap& rBmp, GDIMetaFile& rMtf ) if( !!aTmp ) { const Link<> aPrgsHdl( LINK( this, SdVectorizeDlg, ProgressHdl ) ); -aTmp.Vectorize( rMtf, (sal_uInt8) m_pMtReduce->GetValue(), BMP_VECTORIZE_OUTER | BMP_VECTORIZE_REDUCE_EDGES, &aPrgsHdl ); +aTmp.Vectorize( rMtf, (sal_uInt8) m_pMtReduce->GetValue(), BmpVectorizeFlags::Outer | BmpVectorizeFlags::ReduceEdges, &aPrgsHdl ); if( m_pCbFillHoles->IsChecked() ) { diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx index 4ed1aab..9a656d6 100644 --- a/vcl/source/gdi/bitmap3.cxx +++ b/vcl/source/gdi/bitmap3.cxx @@ -2445,12 +2445,12 @@ void Bitmap::ImplMedianCut( sal_uLong* pColBuf, BitmapPalette& rPal, } } -bool Bitmap::Vectorize( tools::PolyPolygon& rPolyPoly, sal_uLong nFlags, const Link<>* pProgress ) +bool Bitmap::Vectorize( tools::PolyPolygon& rPolyPoly, BmpVectorizeFlags nFlags, const Link<>* pProgress ) { return ImplVectorizer::ImplVectorize( *this, rPolyPoly, nFlags, pProgress ); } -bool Bitmap::Vectorize( GDIMetaFile& rMtf, sal_uInt8 cReduce, sal_uLong nFlags, const Link<>* pProgress ) +bool Bitmap::Vectorize( GDIMetaFile& rMtf, sal_uInt8 cReduce, BmpVectorizeFlags nFlags, const Link<>* pProgress ) { return ImplVectorizer::ImplVectorize( *this, rMtf, cReduce, nFlags, pProgress ); } diff --git a/vcl/source/gdi/impvect.cxx b/vcl/source/gdi/impvect.cxx index fb64021..166f0be 100644 --- a/vcl/source/gdi/impvect.cxx +++ b/vcl/source/gdi/impvect.cxx @@ -52,7 +52,7 @@ class ImplChain; namespace ImplVectorizer { ImplVectMap* ImplExpand( BitmapReadAccess* pRAcc, const Color& rColor ); -void ImplCalculate( ImplVectMap* pMap, tools::PolyPolygon& rPolyPoly, sal_uInt8 cReduce, sal_uLong nFlags ); +void ImplCalculate( ImplVectMap* pMap, tools::PolyPolygon& rPolyPoly, sal_uInt8 cReduce, BmpVectorizeFlags nFlags ); bool ImplGetChain( ImplVectMap* pMap, const Point& rStartPt, ImplChain& rChain ); bool ImplIsUp( ImplVectMap* pMap, long nY, long nX ); void ImplLimitPolyPoly( tools::PolyPolygon& rPolyPoly ); @@ -634,7 +634,7 @@ void ImplChain::ImplPostProcess( const ImplPointArray& rArr ) namespace ImplVectorizer { bool ImplVectorize( const Bitmap& rColorBmp, GDIMetaFile& rMtf, -sal_uInt8 cReduce, sal_uLong nFlags, const Link<>* pProgress ) +sal_uInt8 cReduce, BmpVectorizeFlags nFlags, c
[Libreoffice-commits] core.git: include/vcl sd/source vcl/source
include/vcl/svapp.hxx| 21 +++-- sd/source/ui/slideshow/slideshowimpl.cxx |8 vcl/source/app/svapp.cxx | 10 -- 3 files changed, 27 insertions(+), 12 deletions(-) New commits: commit 1d621d363cf966648fc5ed551dbc95de3e70e89c Author: Chris Sherlock Date: Sun Jan 19 13:13:07 2014 +1100 Change EnableNoYieldMode(bool) to better names It makes no sense to disable something via an Enable function. I have split the function into Enable and Disable functions, and update the code accordingly. Conflicts: include/vcl/svapp.hxx Change-Id: Ic05d69796f43e802a4a2a16aaca44433b6eaa018 Reviewed-on: https://gerrit.libreoffice.org/7525 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx index 0432a17..8e7b053 100644 --- a/include/vcl/svapp.hxx +++ b/include/vcl/svapp.hxx @@ -469,17 +469,26 @@ public: "No yield" mode prevents @Yield from waiting for events. @remarks This was originally implemented in OOo bug 98792 to improve -Impress slideshows. For some reason, to \em disable no yield mode, you -call on EnableNoYieldMode +Impress slideshows. - @param i_bNoYield If set to false, then "no yield" mode is turned off. -If set to true, then "no yield" mode is turned on. + @see DisableNoYieldMode, Execute, Quit, Reschedule, Yield, EndYield, GetSolarMutex, + GetMainThreadIdentifier, ReleaseSolarMutex, AcquireSolarMutex, + AddPostYieldListener, RemovePostYieldListener +*/ +static void EnableNoYieldMode(); - @see Execute, Quit, Reschedule, Yield, EndYield, GetSolarMutex, +/** @Brief Disables "no yield" mode + + "No yield" mode prevents @Yield from waiting for events. + + @remarks This was originally implemented in OOo bug 98792 to improve +Impress slideshows. + + @see EnableNoYieldMode, Execute, Quit, Reschedule, Yield, EndYield, GetSolarMutex, GetMainThreadIdentifier, ReleaseSolarMutex, AcquireSolarMutex, AddPostYieldListener, RemovePostYieldListener */ -static void EnableNoYieldMode( bool i_bNoYield ); +static void DisableNoYieldMode(); /** Add a listener for yield events diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index 87e6435..2bc4d72 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -760,7 +760,7 @@ void SAL_CALL SlideshowImpl::disposing() setActiveXToolbarsVisible( sal_True ); -Application::EnableNoYieldMode(false); +Application::DisableNoYieldMode(); Application::RemovePostYieldListener(LINK(this, SlideshowImpl, PostYieldListener)); mbDisposed = true; @@ -1855,7 +1855,7 @@ IMPL_LINK_NOARG(SlideshowImpl, PostYieldListener) // prevent me from deletion when recursing (App::Reschedule does) const rtl::Reference this_(this); -Application::EnableNoYieldMode(false); +Application::DisableNoYieldMode(); Application::RemovePostYieldListener(LINK(this, SlideshowImpl, PostYieldListener)); Application::Reschedule(true); // fix for fdo#32861 - process // *all* outstanding events after @@ -1896,7 +1896,7 @@ sal_Int32 SlideshowImpl::updateSlideShow (void) if (::basegfx::fTools::equalZero(fUpdate)) { // Use post yield listener for short update intervalls. -Application::EnableNoYieldMode(true); +Application::EnableNoYieldMode(); Application::AddPostYieldListener(LINK(this, SlideshowImpl, PostYieldListener)); } else @@ -1917,7 +1917,7 @@ sal_Int32 SlideshowImpl::updateSlideShow (void) // integer may lead to zero value.) OSL_ASSERT(static_cast(fUpdate * 1000.0) > 0); -Application::EnableNoYieldMode(false); +Application::DisableNoYieldMode(); Application::RemovePostYieldListener(LINK(this, SlideshowImpl, PostYieldListener)); // Use a timer for the asynchronous callback. diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 6d345f3..a754856 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -986,10 +986,16 @@ void Application::RemoveIdleHdl( const Link& rLink ) pSVData->maAppData.mpIdleMgr->RemoveIdleHdl( rLink ); } -void Application::EnableNoYieldMode( bool i_bNoYield ) +void Application::EnableNoYieldMode() { ImplSVData* pSVData = ImplGetSVData(); -pSVData->maAppData.mbNoYield = i_bNoYield; +pSVData->maAppData.mbNoYield = true; +} + +void Application::DisableNoYieldMode() +{ +ImplSVData* pSVData = ImplGetSVData(); +pSVData-