Turns out there was already a function MSWordStyles::CreateStyleId()
doing the same thing as FilterChars(), presumably better.
Change-Id: Idd0129c753841b86bd026e1300aa57a56721c89e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146609
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
(a) It is not obvious what DeviceFormat::DEFAULT means
(b) There are two parameters (each with two states), but only really 2
possible overall states
So
(1) use more useful names
(2) combine the two parameters into one enum
Change-Id: Ic0595b39e032cc9e019b88326389d055b977da00
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146589
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This changes the hybrid mode so that the ODF document is written
as an PDF compatible file attachment into the PDF document. It also
keeps writing the /AdditionalStreams element into the trailer to
keep backwards compatibility for now.
Change-Id: Ica31159cfbd591c6741e3da62c42d1fefd085696
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146053
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
And simplify the latter, to always use "CDATA" type (as the former did).
"CDATA" was used in all cases but one, where an empty string was used.
Change-Id: I1b3bfae40e29628e4094d9a6e58a69a66865874c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145526
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Without a correctly formatted ID, LO was unable to import
the shape into the spreadsheet. Now at least the button
shows up and can be pressed.
MS Word already showed the button before the patch,
so nothing there has changed. That suggests that our
problem may be more during import.
This code path is also followed by DOC and DOCX formats,
but they do completely different things with the results.
This is super nasty code...
Change-Id: I383736a7de9c3e94b427d5747e5949c0348dcecd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145509
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
on modern hardware, these are less efficient than regular alpha
channels.
Also, this greatly simplies the range of stuff that vcl needs to deal
with, which will make the upcoming transparency->alpha patch easier to
deal with.
Enhance vcl::CreateFromData to convert incoming 1-bit data to 8-bit
image.
Change-Id: I35829da750029fe373d0d2911a669d10bab6ad23
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145321
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This was somehow possible already when the document was printed with
comments in margin before - but it was not possible to set this option
when exporting a PDF via dialog or API.
To use this setting via API, set the "ExportNotesInMargin" property.
Change-Id: I97a80c5b3b3b2cde669496fd881a41ea0acc5c28
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143234
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
The watermark direction is currently either 0 degrees for landscape
pages or 270 degrees for portrait pages.
The problem is many people expect 45 degrees rotation angle or some
custom angle in general, and we provide no way to control it.
Fix the problem by adding a new "WatermarkRotateAngle" PDF export filter
option to specify the rotation angle explicitly. Note that the watermark
text is still centered, and the text size is decreased to still fit the page
boundaries. To keep things simple, do this shrinking by going with a
size that matches the shorter dimension of the page, instead of some
more complex iterative approach.
Example cmdline usage:
soffice --convert-to pdf:writer_pdf_Export:'{"Watermark":{"type":"string","value":"draft"}, "WatermarkRotateAngle":{"type":"long","value":"450"}}' test.odt
Change-Id: I1fee14c333e68c92cf4c65ec100e04dcf024f907
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143229
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
The font name of the watermark text is currently hardwired to Helvetica,
a sans-serif font.
The problem is that this looks bad in case your document uses serif or
monospace fonts. Or perhaps your document uses a single font and you
want to make sure that the watermark uses exactly the same font.
Fix the problem by adding a new "WatermarkFontName" PDF export filter
option to specify the font name explicitly.
Example cmdline usage:
soffice --convert-to pdf:writer_pdf_Export:'{"Watermark":{"type":"string","value":"draft"}, "WatermarkFontName":{"type":"string","value":"Times"}}' test.odt
Change-Id: I2f065e1517236695b0a95369bdcd803125018587
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143143
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
The font height of the watermark text is currently automatic: we start
with a value based on the page size and then decrease it till the text
fits.
The problem is that sometimes you want a smaller value, but specifying
this was not possible.
Fix the problem by adding a new "WatermarkFontHeight" PDF export filter
option to specify the font size explicitly.
Example cmdline usage:
soffice --convert-to pdf:writer_pdf_Export:'{"Watermark":{"type":"string","value":"draft"}, "WatermarkFontHeight":{"type":"long","value":"100"}}' test.odt
Change-Id: Iceab943b7a995badfcdc6b12ecc9264e39e4a3a2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143135
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
This fixes the warnings during the build:
C:/cygwin/home/tdf/lode/jenkins/workspace/gerrit_windows/workdir/CustomTarget/filter/source/svg/tokens.gperf:9: warning: junk after %% is ignored
unsupported language option C++
, defaulting to ANSI-C
C:/cygwin/home/tdf/lode/jenkins/workspace/gerrit_windows/workdir/CustomTarget/filter/source/svg/tokens.gperf:2: junk after declaration
This is https://savannah.gnu.org/bugs/?53732, and is expected to be fixed in
http://git.savannah.gnu.org/gitweb/?p=gperf.git;a=commitdiff;h=13c9383b10872525688ef2b4daab090037ea3576
However, the last gperf release is still 3.1 from 2017, and has not that fix
included. Since we use Python 3.x, it is OK to just use 'newline' argument
in the open call.
Change-Id: I33585d1cc698eb55e353adbc684a83c1e0156507
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143095
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
A shape is exported using two svg:paths, first one is for the
fill, and the second one is for the line. Semi-transparency of
shapes enabled the disabled stroke of the first path, resulting
an ~1 pt width extra white line behind the normal line of the
shape. It was visible only, if the normal shape line was thinner
than 1 pt, or if the normal line was semi-transparent or disabled.
The extra line got the same transparency value, as the fill,
so its visibility depended on that, too.
Change-Id: Idc40971cc73ec9e4f241974ae29c876d06cc0658
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143003
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
PDF export has a watermark feature, but its color is hardcoded to light
green, which won't fit all documents.
On the other hand, the input from Heiko in
<https://bugs.documentfoundation.org/show_bug.cgi?id=54053#c12> is to
keep the dialog clean, so adding one more UI option is not great.
Fix the problem by only adding the option at an UNO API level for now,
this relaxes the hardcoded color without cluttering the UI.
Also available on the cmdline for e.g. 0xff0000 / red color:
soffice --convert-to pdf:writer_pdf_Export:'{"Watermark":{"type":"string","value":"draft"}, "WatermarkColor":{"type":"long","value":"16711680"}}' test.odt
Change-Id: I38a3650df86fd34dfc09e3a5643511baa371aa83
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142835
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
The bugdoc had a shape with two paragraphs. The export of the second paragraph
went wrong: the position & size of the text was larger than expected.
This problem was specific to semi-transparent text.
SVGTextWriter::setTextPosition() is recursive in this case. The non-transparent
case left nCurAction unchanged in the outer setTextPosition() and it returned 1
("text is found"). The semi-transparent case changed nCurAction by +2 and
returned 0 ("text is not found"). This led to all sorts of trouble, including
mismatching Push() and Pop() calls on the output device when replaying the
metafile.
Fix the problem by routing the empty state from the inner setTextPosition() to
the outer one: if we return 1 ("text is found"), then we know that the state is
non-empty. Once the empty state is correct in the outer setTextPosition(), then
even the transparent case also leaves nCurAction unchanged and the whole shape
text has the correct position and size.
I forgot to update this empty state in ther outer setTextPosition() in commit
666f252457 (SVG export: fix lost semi-transparent
text on shapes, 2020-07-17).
Change-Id: I7dc93fe13c4510220bf09a388e742799ed042510
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142590
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
before commit 4b95451f85
Date: Wed Sep 21 20:54:00 2022 +0200
split utl::TempFile into fast and named variants
which makes it easier to know what each variant requires
to stay on it's happy path
we closed the writable stream and got another readonly stream, after
that commit we have a read-write stream. With the "true" arg to
Storage it will Commit back to the underlying storage its contents
in its dtor. With a ReadOnly stream this failed and nothing happened,
with a read-write stream there is a write which didn't happen with a
read-only one.
Lets just use false here, we're not interested in keeping the contents.
"Direct" in this context is presumably analogous to the Compound
File Format "Direct mode":
"The mode in which files are accessed, either transacted or direct,
determines when changes are committed.
Transacted mode uses a two-phase commit operation to make changes to
objects in a compound file, thereby keeping both the old and the new
copies of the document available until the user chooses to either save
or undo the changes.
Direct mode incorporates changes to the document as they are made,
without the ability to later undo them.
For more information about access modes, see the OLE Programmer's Reference."
Change-Id: I1f710de227807073a6aff11a86d7cfaf6d380509
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142283
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Shaves another 20% off the export time, bringing us to roughly the same
time as before commit
commit 4fc3466d23
Date: Thu Apr 14 09:19:35 2022 +0200
do not cache layout glyphs if fallback is involved
Change-Id: Ic595d4be7b05d857f3328ec28d1ef1232203cb03
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141798
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This is a followup to commit a97bae545d.
Previously different areas within the "filter" module used their own "*ResId" code
to get the translated string. They did the same thing without any difference in
purpose and implementation.
Unify this to use FilterResId instead.
Change-Id: Idccf74601a89b5786e1f61a04631436147710bb9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141692
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Two step approach:
-putting this here where I need it - fairly targeted.
-put it in FindMethod before returning,
so that everything gets it in a valid state.
Of course the second will probably cause consternations,
but then when it gets reverted at least this will still work.
Change-Id: I8772f85c9b9ae6ed9a25ba7966b50519afe0d6ef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141243
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
Unlike Word, ThisWorksheet cannot hold auto-running
subroutines for Open/Close/New.
This fixes a LO 7.4 regression caused by
commit beb6c62e99.
Change-Id: Idb8f72775d9392b306cb924ee776821272b12f3b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141127
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
I noticed this on one function, but completely
missed it on the second one.
Change-Id: I6ca74485b0c40cec2b04003fe894159198186ebf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141220
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
Note: this should NOT apply to Document_Open which normally
is a private subroutine and runs fine as private.
I tested and it DOES apply to all three version of AutoOpen:
-ThisDocument.AutoOpen,
-<AnyModule>.AutoOpen,
-AutoOpen.Main
Note: this is different from Excel.
Private Auto_Open runs just fine there.
Change-Id: If10c8c90c35275c2b14dc2e15fb357674fc580b8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141114
Tested-by: Justin Luth <jluth@mail.com>
Reviewed-by: Justin Luth <jluth@mail.com>
Impress slides are exported to SVG via a metafile. In case shape text
has a string like "A\tB", that was exported as "AB", loosing the tab
character.
The relevant shape is exported as a metafile, with two text array
metafile actions (one for "A", one for "B") and the tab needs no
explicit action as both "A" and "B" has an explicit position. The SVG
contained no explicit position for "B", so the tab was lost visually.
Fix the problem by detecting when the doc model has a "\t" without a
matching metafile action and emitting the explicit position in that
case.
An alternative would be to use implWriteTextPortion() to write a <tspan>
for the tab, but that doesn't guarantee that the width of the tab in the
SVG is the same as in Impress.
Change-Id: Ie21bffce9d09194159e460fb28ab23fbefd52102
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141014
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Prior to this, none of the DOCM ActiveX macros were called.
Now, just like magic, it all works.
Already broken at commit c5fc57de56
Author: npower Developer on Tue Mar 2 15:04:15 2010 +0000
npower14miscfixes: #i109706# move back msvbahelper to the filter module
Change-Id: I25b25850b12609e5e00dd4bd5189a734abcbddd6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140750
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>