Commit Graph
239 Commits
Author SHA1 Message Date
Jonathan Clark 13d4e74e4f tdf#172442 xmloff: Fix Base ParagraphAdjust to awt::TextAlign conversion
When Base loads forms, it flattens ParagraphAdjust values into
GUI-specific awt::TextAlign values. The code that performed this
remapping was missing some recently-added values, causing apparent loss
of column alignment after save.

This change adds the missing values. In addition, this change adds unit
tests for the conversion code, and fixes a long-standing typo bug that
made values fail to round-trip.

Regression due to the following commit:
 commit 5d1b2baaa9
 Author: Jonathan Clark <jonathan@libreoffice.org>
 Date:   Tue Oct 21 02:14:26 2025 -0600

     tdf#118350 [API CHANGE] Implement start and end paragraph alignment

Change-Id: Ica27870a952c6ec77360f416e112724b4943a016
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/206816
Reviewed-by: Jonathan Clark <jonathan@libreoffice.org>
Tested-by: Jenkins
2026-06-18 13:57:18 +02:00
Vissarion Fisikopoulos 367fdac5ab tdf#87012: Fix charts without content in report-builder
In report builder if the charts contain date or time
then the generated chart appear without content.
This is fixed by adding appropriate handling of date
and time value cases.

Change-Id: Idfa0e03645e1e8130707fc541b155fd53311572d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/206232
Tested-by: Jenkins
Reviewed-by: Vissarion Fisikopoulos <vfisikop@libreoffice.org>
2026-06-12 09:10:33 +02:00
shark 789fa61602 tdf#168337 Set draw:escape-direction to auto for
drawing::EscapeDirection_SMART

Change-Id: I37028da7acabbbb80a71c18efa08f5e37d1eb569
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197456
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-05-25 08:58:42 +02:00
Xisco Fauli 1ed8bf0011 UnoApiTest: factor out common code for setting LO_IMPORT_USE_PDFIUM
Change-Id: I1b3c66b9098163ce17b6a4c812cc448cc5cd594c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201366
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-03-11 10:47:57 +01:00
Noel Grandin 5505d3bc4d loplugin:constparams
Change-Id: I33c701be5a441c1121b797f1eb5a8bda6fc3f89b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200927
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2026-03-04 11:29:39 +01:00
Caolán McNamara ae6ce55091 tdf#156707 always write fo:border for form control shapes on export
On export, always write ControlBorder and ControlBorderColor to the
auto style for control shapes, even when the property state is
DEFAULT_VALUE.

On import, when fo:border is absent, apply the control model's default
border to the shape.

a) New document, user sets flat (2) border:
    The constructor default is 2 (flat) but getPropertyDefaultByHandle
    returns 1 (3D). Property state is DIRECT_VALUE and the filter exports
    fo:border as before. On reimport fo:border is present and applied.
    No change in behavior.

b) New document, user sets no (0) border:
    Same as flat, DIRECT_VALUE, exported by the filter. No change.

c) New document, user sets 3D (1) border:
    1 matches getPropertyDefaultByHandle so property state is
    DEFAULT_VALUE and the export filter would previously skip it.
    Now export always adds adds ControlBorder explicitly, so fo:border
    is written. On reimport fo:border is present so applied.

d) Old document (pre tdf#152974) with no fo:border:
    These documents never wrote fo:border for 3D because that was the
    real default. Now on import the importer detects the missing
    fo:border and queries getPropertyDefault("Border") for the control
    which returns 1 (3D) for text controls, restoring the original
    border. On reexport the exporter writes an explicit fo:border.

e) Label controls (tdf#167358):
    Labels default to no (0) border. Their getPropertyDefault
    returns 0, so the importer applies no border when fo:border is
    absent, so this fix effort shouldn't cause that problem again.

Change-Id: I365adf84e9d26ae3231331230178381d31bfa829
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200685
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2026-03-01 20:15:09 +01:00
Xisco Fauli ba3fb9026c merge UnoApiText and UnoApiXmlTest
in preparation for a follow-up commit

Change-Id: I3449c031696fe3ab13d4832e2671da08eb483cdb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199552
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-02-18 21:17:13 +01:00
Xisco Fauli cec5d6f1c8 xmloff: fix two tests saving to the wrong format
Change-Id: I699bdb262cf608dfdb1ebfdb1706b06e3cf6c3d2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199371
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-02-14 17:10:45 +01:00
Xisco Fauli a9491be1f1 filter, xmloff, svx, oox: only load one document per test
Change-Id: Ibb07c8069e6ce8965739c7ccef52c41bb1f04422
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198968
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-02-09 17:02:24 +01:00
Jonathan Clark 7fa77b9072 tdf#72640 sw: Make list label alignment account for para writing mode
This change updates Writer to better conform with the ODF standard
wording for the fo:text-align attribute when used in
style:list-level-properties.

Previously, Writer interpreted list label alignments while ignoring
paragraph direction, always behaving as if the list label is always
left-to-right. This change updates Writer to instead apply label
direction correctly, treating start and end label alignment in a manner
similar to how we treat start and end paragraph alignment.

The list style dialog has been updated to reflect the new behavior as
start/end alignment, rather than left/right alignment.

This change also adds the LIST_LABEL_ALIGNMENT_IGNORES_DIRECTION
compatibility flag. In order to preserve the layout of existing
documents, this flag is enabled automatically when loading an ODF
created with earlier versions of LibreOffice.

Change-Id: I56cd37fa83487b010369b99570f7bb4750c07595
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198857
Tested-by: Jenkins
Reviewed-by: Jonathan Clark <jonathan@libreoffice.org>
2026-02-06 20:01:06 +01:00
Mike Kaganski d0e23db89a Drop MacrosTest::Resetter, and use comphelper::ScopeGuard
Change-Id: I2214724567a58174b175a17fbabec7a5249e4df8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198482
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2026-02-01 19:38:44 +01:00
Michael Stahl 9e0d4c693c sw: fix setting mbIsTextBox on shapes' text boxes
SetTextBoxes(true) is never called because it checks the shape's
SdrObject, while previously this code was in
SwFrameFormat::SetOtherTextBoxFormat() where it would be called a second
time for the text box SwFrameFormat which has the SwFlyDrawObj.

SwTextBoxHelper::getCount() can't ignore the text boxes if the flag is
never set; this ends up confusing
ShapeGroupContext::popGroupAndPostProcess() (and causes tests like
testTdf84695 to fail with the fixes in the next commit).

Because shapes with text boxes are sorted again with this, testTdf146272
and testTextBoxLoss need adapting.

(regression from commit 504d78acb8)

Change-Id: I80c375d900a10f1956cd112d60c3f25332c485ac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197594
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
(cherry picked from commit 327e92c78603e011e7ddf8b57749dfd9e690addf)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197729
Tested-by: Jenkins
2026-01-21 19:52:23 +01:00
Noel Grandin 23800ba95e tdf#153183 testAxialGradientCompatible does not need skipValidation
anymore, I suspect fixed by:
  commit 8a14061645
  Author: Noel Grandin <noelgrandin@gmail.com>
  Date:   Thu Nov 13 20:16:44 2025 +0200
  officeotron: ID is not valid attribute in vml shape

Change-Id: I3c30caee6130b4e8a002f3c52b4d0e058dd913ac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194447
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Code-Style: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2025-11-25 09:59:44 +01:00
Kurt Nordback 6195f52e3f tdf#167941 Extend Transformation value from sal_Int16 to sal_Int32
Needed to make it compatible with oox::drawingml::Color.

Change-Id: I129c03c0510822682afc1eca35c5b912c5d94b3a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194203
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Jenkins
2025-11-20 05:48:03 +01:00
Xisco Fauli 6675e7893e UnoApiTest: use TestFilter enum in setImportFilterName too
Change-Id: I16dae720be9dd9dd4bbc2a691d83fa6339f33c2c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194166
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2025-11-18 21:11:09 +01:00
Xisco Fauli 801dc48c6f UnoApiTest: Add enum for filter names
and use it in save/saveAndReload

Change-Id: I3d82ab54119ab6c35587ea706c82254a5c39dbd3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194158
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2025-11-18 21:11:02 +01:00
Caolán McNamara cf6edbd0b3 [API CHANGE] sd pdfium: apply page number when loading pdf pages from fodg
this is the same concept/ideas as

a12bd4fedfc3f269f1dbb5fea36b607facd1261d
    [API CHANGE] sd pdfium: add page number when saving/loading pdf pages as images

but extended to support fodg where the problem of showing the first page
of the pdf for all images remained.

Change-Id: I5a180037634f71104800e09bec400316b56ab1f2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193156
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2025-10-31 10:04:34 +01:00
Jonathan Clark 5d1b2baaa9 tdf#118350 [API CHANGE] Implement start and end paragraph alignment
Implements support for ODF fo:text-align start and end in paragraph
styles. The new alignment options can be selected in the paragraph
dialog. Further user interface changes are tracked as separate bugs.

This change also adds START and END to css.style.ParagraphAdjust, which
is flagged as an incompatible UNO API change.

Change-Id: I2ee57f0029de7b794bc1ecd3eddbbd90af5dfdb9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192932
Tested-by: Jenkins
Reviewed-by: Jonathan Clark <jonathan@libreoffice.org>
2025-10-24 13:07:10 +02:00
Miklos Vajna 5248afb9b6 tdf#168321 sw format redline, direct: fix ODF strict export
Save the bugdoc in strict ODF, the exporter crashes due to an assertion
failure.

What happens is that strict ODF doesn't add the loext namespace alias to
the alias list, so we crash when we would write an loext attribute.

Fix the problem by simply throwing away the direct format of a format
redline when saving to strict ODF, just to please the validator.

If we're at it, also don't register the direct format of the format
redline in the autostyle pool in that case, since it would be
unreferenced anyway.

Change-Id: I0de9ee114be9ef67f97716cf5fd9aaa9f8757683
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190851
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2025-09-12 10:32:46 +02:00
Miklos Vajna c625247680 tdf#167761 sw format redline, char style+direct: add ODT export
The bugdoc contains a format redline that changes the character style
from Strong to Quote and the font size from 24 to 36. Exporting to ODT,
loading the ODT and rejecting the redline, the font size is set to 24,
but the character style is set to default instead of Strong.

What happens is that the item set of the format redline contains the
necessary SvxFontHeightItem, but contains no SwFormatCharFormat. This is
because the ODT export writes no parents for char automatic styles,
because char formatting outside the redline table has 2 pool items for
such char formatting: a dedicated SwFormatCharFormat for the char style
and a separate SwFormatAutoFormat for other char props, so the ODT
export "knows" to ignore the autoformat parent and creates this markup:
<text:span text:style-name="...named style..."><text:span text:style-name="...automatic style...">t</text:span></text:span>

Fix the problem by explicitly exporting the parent style name when we
write an automatic style that is referred from the redline table (and
not from the body text). This is similar to what e.g. "frame" autostyles
already do, which also have parents. The result is this markup:
    <style:style style:name="..." style:family="text" style:parent-style-name="Strong_20_Emphasis">
      <style:text-properties fo:font-size="24pt"/>
...
          <text:format-change loext:style-name="...">
which contains both the named character style name and the automatic
style, describing the direct formatting.

The ODT import side still needs fixing.

Change-Id: I19a67cf5e2c538cfcfa1b13097241954667d2c89
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190181
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2025-08-26 12:32:30 +02:00
Miklos Vajna 43104ad996 tdf#167761 sw format redline, char style: fix missing encode in ODF filter
Open the input DOCX, save to ODT, the named char style of the format
redline is:
          <text:format-change loext:style-name="Strong Emphasis">
while it should be:
          <text:format-change loext:style-name="Strong_20_Emphasis">

This was not obviously a problem before, because both the import and the
export failed to encode/decode, but it'll be a more noticable problem
once we try to handle both direct format + char style, where autostyle
parent names are encoded and this was not, leading to inconistency.

Fix the problem similar to how it's handled for <text:span> elements for
export in XMLTextParagraphExport::exportTextRangeSpan() and for import
in XMLTextImportHelper::SetStyleAndAttrs(), by encoding/decoding on
export/import.

Also update sw/qa/filter/xml/data/format-char-style-change.odt, which
had a bad style name, missing an encode before export.

Change-Id: I2a9fae2c99c286d8c1c3a5e6af18f6f501e18089
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190151
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2025-08-25 15:05:23 +02:00
Miklos Vajna 0e21f3b36c tdf#167761 sw format redline, char props: implement ODF import
Load the bugdoc, save as ODF, open the ODF, revert the format redline,
the font size should go from 36pt (new direct format) to 24pt (old
direct format), but it goes to 12pt (doc default).

What happens is that the format redline specifies the old direct format
via <text:format-change loext:style-name="..."> (referring to an
automatic character style), but this was not handled on import.

Fix the problem by:
1) Handling the new attribute in
   XMLChangedRegionImportContext::createFastChildContext()
2) Looking up the already imported autostyle for the style name in
   XMLChangedRegionImportContext::SetChangeInfo()
3) Creating a matching SwRedlineExtraData_FormatColl in
   XMLRedlineImportHelper::InsertIntoDocument() when the format redline
   is created in sw/ core.

Note that this means we have two autostyle names at play, the first is
T<number> and the second is effectively a pointer address as a string,
like 3cb7b270; FindAutoCharStyle() mapping from the first to the second.
Unfortunately both are just string references to the already imported
autostyle.

Change-Id: Ib0f18bad223f4320afe5aaa11ea713e610f6c029
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189845
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2025-08-18 13:27:04 +02:00
Miklos Vajna b78bdc9eb1 tdf#167761 sw format redline: implement ODF export
Load the bugdoc, revert the format redline, the font size should go from
36pt (new direct format) to 24pt (old direct format), but it goes to
12pt (doc default).

What happens is that we have working DOCX import to store this in
SwRedlineExtraData_FormatColl's item set, but the ODF import/export is
missing.

Add the ODT export by:
1) Adding a new SwXRedlineAutoStyle that exposes the item set, assuming
   it contains character properties, and create this in
   SwXRedlinePortion::GetPropertyValue() if the RedlineAutoFormat property
   is requested.
2) In XMLRedlineExport::ExportChangeAutoStyle(), write this item set as
   an autostyle.
3) In XMLRedlineExport::ExportChangedRegion(), refer to this autostyle.

Note that similar to delete redlines, the format redline contains the
old formatting, the new formatting is directly in the document.

Change-Id: Iedd7416e5eefc4814199d60c4a6b68dbb76136e2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189672
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2025-08-15 15:29:00 +02:00
Justin Luth 0ad0fc985c tdf#167358 Revert "tdf#156707 xmloff import: always provide ControlBorder
... property #2"

This reverts my 25.2 commits d4dad2e181
and 5a617f77ee.

Obviously this entire thing is just too broken
for a simple guy like me to fix.

It seems like each kind of control has its own definition
of what should happen if the border is not specified.
So much for ODF standardization of default style values...

This makes it virtually impossible to force a setting at import time,
and since styles (without specified fo:borders)
could theoretically be shared between the different control types,
it might also make it impossible to force an export as well?

make CppunitTest_xmloff_style

Change-Id: I0182878a16213ad2c7f06524fe85388aae86551f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187654
Reviewed-by: Justin Luth <jluth@mail.com>
Tested-by: Jenkins
2025-07-11 13:45:35 +02:00
Michael Stahl f5d48df735 tdf#159549 tdf#166850 sw,xmloff: fix localised STYLEREF differently
SwXTextField must for the "SourceName" property convert from ProgName to
UIName on setting and reverse on getting, for consistency with the rest
of the sw UNO services.

This is annoyingly complicated because the "sPar1" of SwGetRefField is
used for numerous other purposes, including a bookmark name.

Revert writerfilter changes of commit 80877c7dc4
but keep the test.

With de_DE locale we now get "Überschrift 1 (user)" cloned style (same
as the reverted fix), and exported to ODF as "Überschrift 1"; the ODT
works when loaded both with the same and a different locale.

Unfortuantely an ODT created by versions on the 24.2 branch >= 24.2.4,
which used to work being loaded in the same locale but not in a
different one, stops working when loaded in the same locale with this,
so add an incredibly ugly flag to SwDoc because no SvXMLImport etc can
be accessed from SwGetRefField.

Move testTdf160402 to the new ooxmlexport26 because it also failed with
de_DE locale.
(regression from commit e45f187870362ed4448f4a9fb96883b8431887fb)

Change-Id: I6b7862f142d602544165d8b5a254bf8af28e527b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186228
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2025-06-17 18:42:46 +02:00
Justin Luth d4dad2e181 tdf#156707 xmloff import: always provide ControlBorder property #2
In LO 7.5, ORichTextModel changed the app default to use a flat border
(in order to better match how PDF/print looks)
while the file-spec's default for undefined borders is 3d,
so during import time we ALWAYS need to specify 3d as the border.

The patch replaces 25.2 commit 5a617f77ee
    tdf#156707 xmloff import: always provide ControlBorder property
which wasn't wrong, but just was incomplete.
It only handled the situation where there was a fo:border element
which didn't specify 3d/flat/none,
but didn't handle the situation where there was no fo:border at all
in style:graphic-properties.

[On export, since the 3d property is the default value,
fo:border is not even provided as something to be exported,
and therefore only "solid" and "none"
are ever exported as fo:border qualifiers.]

I modified the unit test to remove the fo:border
by clearing the unused-by-3d green border colour
(although the green was seen if the wrong flat border was assigned).

make CppunitTest_xmloff_style CPPUNIT_TEST_NAME=testTdf156707

Change-Id: I70718fe964a7c3578f8edbf8591fe2e3417ec60b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185619
Reviewed-by: Justin Luth <jluth@mail.com>
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2025-05-22 08:39:20 +02:00
Miklos Vajna 1a34019623 tdf#166319 sw interdependent redlines: handle ODF export of delete under format
The bugdoc has <del>AA<format>BB</format>CC</del> in it, DOCX import
works, but exporting to ODT turns the format-on-delete redline into a
plain "format" redline.

What happens is that various code only checks the m_eType of the first
SwRedlineData of an SwRangeRedline, so format-on-delete is handled as
format. But this is not correct: if the format-on-delete is to be
accepted, then it's just a small detail that there was a format on top
of it: the result should be text deleted from the document on accept,
not accepting the the format changes and leaving the text in the
document.

Fix the problem by:
1) Extending SwRangeRedline::Hide() and SwRangeRedline::Show(), so when
   the ODF export moves delete redlines to their own toplevel SwNode
   section, so it can refer to these ranges using a single SwStartNode
   index, this move happens for format-on-delete as well, not just deletes.
2) Then can extend SwXRedlinePortion::GetPropertyValue()'s
   lcl_GetSuccessorProperties() to produce an XText for the deleted
   range of a format-on-delete redline.
3) Finally consume this new XText in
   XMLRedlineExport::ExportChangeInfo().

Note that this way a format redline can now have its own XText (in case
it's on top of a delete), but we want to export the text only once, so
restrict the content export for a redline to the 'delete' type.

Change-Id: I91902a2ae4b464ace41717a196d19530be9d84d1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185551
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2025-05-20 13:15:07 +02:00
Jaume Pujantell 87f132a5e8 [API CHANGE] sd pdfium: add page number when saving/loading pdf pages as images
When a pdf file is opened with pdfium and then saved as odg, each page
is saved as a draw:image of the pdf. But since no page number info was
given, when opening the odg file, all the pages are shown as the first
one.

This adds a loext:page-number to the saved odg and the logic to load a
specific page from an embedded pdf.

Added loadGraphicAtPage to XGraphicStorageHandler.

Change-Id: I398b7ad7f03cc7fb930a4e7b7620c6f238b41c0d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181066
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2025-02-04 12:55:29 +01:00
Noel Grandin 910d3a4f04 loplugin:reftotemp in xmloff
Change-Id: I121307865a576b8d0bced6098fae37051bd531b7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176503
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-11-13 06:34:57 +01:00
Xisco Fauli 3dcd0f4a4c tdf#162691: ODF 1.4 Add support for xy and polar handle new attributes
Co-author: Regina Henschel
This implements the new draw:handle attributes of ODF 1.4. For reasons
for new attributes see https://issues.oasis-open.org/browse/OFFICE-4110
The old attributes are deprecated but may still be written. So we keep
them to be backward compatible.

Change-Id: I0b3443d000b2b163363f9070e5e276af2b018cbb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174966
Tested-by: Jenkins
Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
2024-11-12 14:05:10 +01:00
Regina Henschel 1b7bdc2955 tdf#162686 tdf#162687 ODF 1.4 extrusion-metal-type
and extrusion-specularity.

In ODF strict always value 'draw:MetalODF' was written. Changed the
logic to write 'loext:MetalMSCompatible' too, depending on eMetalType.
Using a QName as value requires a namespace declaration for the prefix
'loext'. That is now written directly at the element, not as global
declaration, to restrict its scope to the element. A global declaration
would hide when attributes or elements are accidentially written in
'loext' namespace.

The pattern for nonNegativePercent had missed the percent sign.
The export is adapted to write the percent sign.

Validation is skipped for save to ODF 1.3, because currently the
implicit validation uses always latest ODF version, see tdf#163806.

Tests are extended to cover ODF 1.4 and value draw:MetalODF.

Change-Id: I836d11b9cd327b9772e800d9797e04e1613ab2f9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176246
Tested-by: Jenkins
Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
2024-11-10 18:50:37 +01:00
Mike Kaganski 1180b3473a com::sun::star -> css
Change-Id: I890ec73e30d3cc6b210903ecee29431f3cb5f635
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175979
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-11-10 10:50:15 +01:00
Noel Grandin 5de73f04f3 new loplugin:staticconstexpr
Change-Id: Ida1996dfffa106bf95fd064e8191b8033b4002f3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175336
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-11-04 08:51:00 +01:00
Xisco Fauli a38a22c7e5 UnoApiTest: rename load to loadFromURL and use it everywhere
Change-Id: Ie67eebec74f783fa0c29acfb23bb83bc582812b2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175724
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2024-10-29 09:11:37 +01:00
Justin Luth 5a617f77ee tdf#156707 xmloff import: always provide ControlBorder property
The problem was that 3d textbox form controls
were imported as flat.

The default value for ControlBorder is 3d.

Since caolan's 7.5.4 63b8e8bda2,
all textboxes are initially created with a flat border instead of 3d.
Since 3d is the fo:border default (and never specified),
the newly created control had no override to force it to 3d.

So this patch forces passing a ControlBorder property.

On export, since the 3d property is the default value,
ControlBorder is no even provided as something to be exported,
and therefore only "solid" and "none"
are ever exported as fo:border qualifiers.

make CppunitTest_xmloff_style CPPUNIT_TEST_NAME=testTdf156707

Change-Id: Ib4541d5e3599dc42af6055062fd709e105bf5d14
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174754
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
2024-10-10 18:52:22 +02:00
Mike Kaganski a6a6921123 Use good old string literals in assertXPath and friends
These are only sent to an external API expecting char*-like strings,
or for comparison. Having every assertXPath having three of _[ou]str
is too much syntactic noise, making the unit tests almost unreadable.

Change-Id: Ic004a36ea75e7bfe0b96f405c40f926a957b51cc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174416
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
2024-10-05 10:06:44 +02:00
Xisco Fauli 4dc04a1069 qa: use SetODFDefaultVersion everywhere
Change-Id: I4a08abea9a6c61a0365d238abf1021806ae6df29
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174375
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-10-02 11:15:09 +02:00
Xisco Fauli c6f9d381d3 Add ODF 1.3 Extended / ODF 1.4 versions to configuration and UI
The new default is ODF 1.4 Extended

Change-Id: I50f60cccde81b5ea320478314482cc67a7bcc2e4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174343
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2024-10-02 08:57:38 +02:00
Xisco Fauli b532d79f39 tdf#162687: ODF 1.4: fix import
Change-Id: Ic728c1c92ff5815c0780ba18e1a473d26e13e63f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173993
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2024-09-26 19:15:05 +02:00
Xisco Fauli fc9155f8cd CppunitTest_xmloff_draw: simplify a bit
Change-Id: Ic36e2c50953e99d7509c1d16ffef2f9f5f3a7bf4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173992
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2024-09-26 19:14:43 +02:00
Xisco Fauli dc8718385b CppunitTest_xmloff_draw: remove leftover
after 146dac7d30
"tdf#162690, tdf#162687: Adapt to ODF 1.4"

Change-Id: I1236b89186e51e594610272a2ea490274ddc41e0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173979
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-09-26 19:13:48 +02:00
Xisco Fauli 146dac7d30 tdf#162690, tdf#162687: Adapt to ODF 1.4
After this, the workaround introduced to
OpenDocument-v1.4+libreoffice-schema.rng in
afa4965e4d "schema: update to ODF 1.4 OS"
can be removed

Change-Id: Iecf31cec0bf187155a97e5b6ccf8173b6aba82fc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173940
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-09-25 19:31:28 +02:00
Xisco Fauli 34c4a18d78 tdf#162686: Adapt to ODF 1.4
Change-Id: I47f29a88eb0e98dc0fd312a3895d3a578fa04d46
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172768
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-09-24 14:50:36 +02:00
Mike Kaganski 3a37d8320c Optimize TokenMap and AttributeList in oox and xo
Shaves lots of string allocations, and uses optimized code paths

Change-Id: I8e33e2aecdc7e0d2f2c31b774daa36304b3973ac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173179
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-09-12 23:09:23 +02:00
Regina Henschel 9f62c7a0f2 tdf#161483 enable LO to read ODF angle units
ODF uses in several places data type 'angle' (18.3.1, ODF 1.3). That is
a double followed by unit identifier 'deg', 'grad' or 'rad' or a unit
less value in degrees. LO uses in the API angles in degrees, 1/10 of
degrees and 1/100 of degrees in data types 'double', 'short' and 'long'.

Without the fix LO does not interpret the units, but takes only the
number part.

Change-Id: Ib3f2a518a25199e3cf7a7a8572e169785f75c427
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169360
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Tested-by: Jenkins
Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
2024-06-25 16:21:42 +02:00
Regina Henschel 567dbcf687 tdf#161327 Interpret angle units in dr3d:end-angle ..
.. and draw:rotation in <draw:hatch> element.

ODF 1.1 has not specified the syntax of datatype 'angle'. Since ODF 1.2
it is specified as double with unit "deg", "grad" or "rad", or without
unit. The unit-less value is specified to be in degrees. But OOo, AOO
and all LO versions had written the value unit-less in 1/10th of a
degree in some cases.

To fix it, LibreOffic will be enabled to read units. When then the
active versions are able to read units, starting with the then actual
version, LibreOffice will write angles with unit 'deg'.

This has already be done for gradients, see tdf#89475. This patch
starts the first step to make LibreOffice able to read units for
dr3d:end-angle (UNO D3DEndAngle) and for draw:rotation (UNO
FillHatch.Angle). I have not found further cases of writing 1/10deg.

The patch still writes unit-less 1/10th of a degree for export to
ODF 1.3 and earlier. When it is time to write unit degree or when
LibreOffice supports the next ODF versions, some places need to be
adapted. They are marked.

The converter convertAngle is renamed to convert10thDegAngle() to
indicate, that it is special. The parts, which were specific to
gradients are moved to the gradients, so that it is now usable for
dr3d:angle and draw:rotation too.

I intend to write next a patch that enables LibreOffice to read angle
units for cases where LibreOffice already writes unit-less values in
degree. That is not so urgent, but to bring LibreOffice nearer to ODF,
reading angle units should be implemented nevertheless.

The file xmlbahdl.hxx is moved from xmloff/source/style to xmloff/inc
to have access to it from xmloff/source/draw.

Change-Id: I8ffc2735f8bcfefb86efa80eb05f900c32403f31
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168336
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
2024-06-11 10:29:17 +02:00
Miklos Vajna 080afd6a34 Related: tdf#145972 sw images: fix rounding error in relative size calculation
Open the bugdoc, see that the image is roughly half of the page width,
right click, properties, UI shows that the width of the image is 5% of
the width of the entire page. This only happens if tools -> options ->
writer -> general sets the UI units to points, the default cm case is
fine.

This went wrong with commit 9e8712ed6f (sw
image dialog: fix fallback width/height for images with relative sizes,
2022-03-17), because the layout size started to matter more after that
commit. This lead to the nWidth !=
m_xWidthED->get_value(FieldUnit::TWIP) check in SwFramePage::Init() to
be true, because 11906 * 0.48 is 5714.88, so you got 5714 in the layout,
but got 5715 with rounding in SwFramePage::Reset() (which tries to calc
the page width based on the 48% and the fly width). And once we had that
mismatch, we went down the wrong path.

Fix the problem by using rtl::math::round() in SwFlyFrame::CalcRel(), so
the relative width twips value is 5715 everywhere: once we have
consisteny, the UI value is correct, too.

Note that the original bugdoc needs more fixing, this just fixes the
bugdoc where KeepRatio is false.

Change-Id: I1e8782c95a0cf9d97375c36d41134735c01f3e46
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167916
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2024-05-22 10:27:36 +02:00
Noel Grandin 12008e1054 loplugin:ostr in xmloff
Change-Id: I24f5626e57e03217e4bcf77289c785e255b9f904
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167667
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2024-05-15 20:37:38 +02:00
Regina Henschel 21d39b5a8c Clamp extrusion light level to allowed range for ODF
With import of shapes in 3D-mode from pptx files, the internal values
for light level might be outside the range 0..100 and thus not allowed in
ODF. These high levels are needed to get a similar rendering to
MS Office.

The export to ODF clamps them now to the allowed range.

I do not intend to change the export to loext namespace, because the
extrusion mode of custom shapes needs a totally new handling. But that
will not be possible timely for version 24.8.

Change-Id: I839903cbaf1b304c1e0c4374080963bc70352e61
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164948
Tested-by: Jenkins
Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
2024-03-18 15:58:53 +01:00
Rafał Dobrakowski c8b8a2c2cb tdf#141908 - CppUnittests: replace usage of sal_Int32 with colors
Conversion of hex/dec colour notation
(example entry Color( 255, 255, 255), Color(0xFFFFFF) - COL_WHITE)
For the other available colour definitions.

Change-Id: I9eed0cd64adcbc8d25e1c22143a000906a457586
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163729
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2024-03-14 02:33:03 +01:00