Commit Graph
9517 Commits
Author SHA1 Message Date
Tomaž Vajngerl d8de2dc3c5 xmloff: import of theme structure + import/export/round-trip tests
Change-Id: I50e8c53c534895098613e81fd97b346fd3d7d05f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146287
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-02-01 08:41:30 +00:00
Tomaž Vajngerl 75c0d78276 sd: use XTheme to transport the theme to xmloff import/export
Refactor the existing places and tests in Impress code (sd) to
use it instead.

Also keep the old property of construction and view of the theme
with a sequence of property values, but  under the new property
named "ThemeUnoRepresentation". This is needed by the UI tests
currently.

Change-Id: I484567f4a603f1a5e2e03955fdd2b63132dcc66e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146225
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-01-31 08:59:09 +00:00
Laurent Balland 46b7fd59f9 tdf#118324 Treat blank ? in integer
Restore and update change 56352
Test of https://cgit.freedesktop.org/libreoffice/core/commit/?id=8ca6468f0f4900d4d3bb45e0e938fe35c308512c is now ok

Add disambiguation between '0' and '?' in integer part
XML_MAX_BLANK_INTEGER_DIGITS is added for the number of '?'
XML_MIN_INTEGER_DIGITS is the number of '?' and '0'
This preserve compatibility with previous versions:
in previous versions '?' will be transformed in '0'
It also applies to scientific and fraction numbers.
Integer part for number, scientific and fraction are
treated the same way

Include QA unit test

Change-Id: Iab3127bf07223caac60e409306a1bee2edc37428
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145932
Tested-by: Jenkins
Reviewed-by: Eike Rathke <erack@redhat.com>
2023-01-30 17:00:46 +00:00
Tomaž Vajngerl c9fb441c55 move Theme class to own file inside docmodel
Also move Theme from svx to model namespace so it is consistent
with other classes in docmodel.

Theme header also includes ThemeSupplementalFont, ThemeFont,
FontScheme classes that are used by the Theme and were also moved
to docmodel. These may be moved to its own file in the future when
they are used in more places.

Change-Id: Ic409bea8e5298adc2b039b529c4f7b01cf64f03e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146221
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-01-27 03:22:22 +00:00
Mike Kaganski d183daea1a tdf#153161: (Ab)use a call to XTextRange::getString to flush edits
Restore the call (without checking its returned value), removed in commit
d194474aabd699806cb3631bc8641dd0548b8026 ("tdf#151100: xText->getString()
may be empty for content needing export", 2022-09-22), side effects of
which obviously allow some object's changes to get flushed and saved.

Change-Id: I62f27cd056c32ad76f79a4862e2f4a0964eaadef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146106
Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-01-25 07:25:16 +00:00
Michael Stahl 90e1698dab tdf#153090 xmloff: ODF import/export of source style on ToX
For Table of Figures/Objects/Tables.

Make this similar to DOCX: only one source style is possible, so omit
the intermediate text:index-source-styles element.

Also a boolean attribute like text:use-index-source-styles appears as
unnecessary complexity, so try to do without.

Change-Id: I7cb599c7ec1261ddedc196a25c3eafe35f35fbe9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146013
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2023-01-24 13:39:23 +00:00
Tomaž Vajngerl 5d135edd88 xmloff: extract XMLThemeContext into own class
Change-Id: Iee30a84915148297ad5c105d29fdf48098261a9d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146051
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-01-24 10:50:20 +00:00
Miklos Vajna 713493c107 tdf#150806 ODT export: fix fallback svg:width/height for zero layout size
The reported problem was that once tracked changes is enabled and an
image is deleted, its aspect ratio changes on save.

What happens here is that the image's frame is marked as a redline
deletion, so when the ODT export writes the file, it'll have a zero
size. But this zero size is nothing we should take into account on save,
XMLTextParagraphExport::addTextFrameAttributes() expected to always have
a valid layout size if the LayoutSize property is available.

Fix the problem by adding one more condition where we ignore the layout
size, which was already there since commit
80550ade30 (tdf#150990 ODT export: fix
zero layout size of scale/scale images, 2022-09-20).

Note that this way the written side will be the original one, so only
the aspect ratio will be correct, but that was accepted as a compromise
earlier.

Change-Id: I108dc2428ce0cb07a044bfef216575fdba19267b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146043
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2023-01-24 07:12:08 +00:00
Michael Stahl 09e3aaa2d2 xmloff: ODF export: missing extension check in XMLStyleExport
(regression from commit 05f863844d)

Change-Id: Iae891ecec26599c9016be17e4db8eaf99783baa6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146012
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2023-01-23 18:49:06 +00:00
Caolán McNamara 90ffbbdcd3 cid#1519129 Improper use of negative value
Change-Id: Ib74c0734801e9f4b5cbeb9b1b19c12d5ad5eadbd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145708
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2023-01-18 12:24:54 +00:00
Mike Kaganski f2f008c52a Merge SvXMLAttributeList to comphelper::AttributeList
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>
2023-01-15 12:32:29 +00:00
Noel Grandin e5e40c0bf5 XUnoTunnel->dynamic_cast in StyleMap
Change-Id: Ib4070fbff0c919cdc2be12f5a2bed1b1ac9e03c3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145505
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-01-15 10:14:05 +00:00
Noel Grandin 68c6133e4d XUnoTunnel->dynamic_cast in XMLMutableAttributeList
Change-Id: Ia36576da1f287c9b687042eba5d429366b3db0a3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145504
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-01-15 10:13:54 +00:00
Noel Grandin 79752f9a37 XUnoTunnel->dynamic_cast in Transformer
Change-Id: Ief186ab88bfe6f952e2e09351fdaa8e0e8a2b6be
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145503
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-01-14 17:24:48 +00:00
Noel Grandin d66d1f6fd4 XUnoTunnel->dynamic_cast in SvXMLExport
Change-Id: I68e4691ac0a58e2320b534d15934ff177feb124d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145493
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-01-14 07:28:18 +00:00
Noel Grandin e07d4c03ac XUnoTunnel->dynamic_cast in SvXMLImport
Change-Id: I070bc1a8136e5b492c0ea56774a274b9a3d2ec2d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145494
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-01-14 07:21:10 +00:00
Noel Grandin f2918ed9ad XUnoTunnel->dynamic_cast in SvUnoAttributeContainer
Change-Id: Ief76f12dd98e3455667b70d09605c82c0cedc4b9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145485
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-01-13 18:32:34 +00:00
Noel Grandin 9ca22b6021 XUnoTunnel->dynamic_cast in SvXMLAttributeList
Change-Id: I68806bf4b59f76c49f733283d9db21c68342c071
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145484
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-01-13 18:32:21 +00:00
Tomaž Vajngerl 3eb53d327f xmloff: use XThemeColor in ODF, change the format for themes
Change the xmloff filter to use XThemeColor and the associated
proprties (CharColorThemeReference and FillColorThemeReference).

Change the ODF format for referencing a theme color - make it an
element instead a series of attributes on the *-properties style
element.

Change-Id: I0fa7d8ebffecc02897b7fe9824d6f1776ef36380
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144923
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-01-13 13:44:09 +00:00
Michael Stahl e5b5d9c8d3 tdf#152710 xmloff: ignore exception in XMLChangedRegionImportContext
The xOldCursor must be restored in all cases.

Also XMLParaContext triggers an exception which ends up aborting the
import.

Change-Id: I8f4785e0e9bde4c8c484954a4d66f3b82d6ca28c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145094
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2023-01-05 18:26:15 +00:00
Stephan Bergmann 19691c3b68 Revert all the recent loplugin:unocast changes
...as obsoleted by ef53355355 "Rudimentary support
for dynamic_cast on UNO proxy objects".

This reverts all of:
4cfcc9ac37 "loplugin:unocast (framework::Desktop)"
03efbf72f4 "loplugin:unocast
 (vclcanvas::TextLayout)"
80099fdd51 "loplugin:unocast (SalGtkXWindow)"
cc147f576d "loplugin:unocast
 (sdext::presenter::CachablePresenterView)"
40db42be1d "loplugin:unocast
 (vclcanvas::CanvasFont)"
2d1e7995ea "loplugin:unocast (CairoColorSpace)"
4c0bbe4bd9 "loplugin:unocast
 (canvas::ParametricPolyPolygon)"
8980366662 "loplugin:unocast
 (vclcanas::CanvasBitmap)"
d5e0c2c8db "loplugin:unocast
 (sfx2::DigitalSignatures)"
c0c4519e0d "loplugin:unocast
 (VCLXAccessibleComponent)"
feb8b833a6 "loplugin:unocast (VCLXDialog)"
1fa58cc6cc "loplugin:unocast (VCLXMultiPage)"
f481f036de "loplugin:unocast
 (DocumentSettingsSerializer)"
73df933f5f "loplugin:unocast
 (css::embed::EmbeddedUpdate)"
420165ab0e "loplugin:unocast
 (canvas::tools' StandardColorSpace, StandardNoAlphaColorSpace)"
9abe8ee067 "loplugin:unocast (MutableTreeNode)"
9f3022ceb0 "loplugin:unocast (VCLXTabPage)"
1be70dda02 "loplugin:unocast
 (vcl::unotools::VclCanvasBitmap)"
d6a70bb641 "loplugin:unocast
 (basegfx::unotools::UnoPolyPolygon)"
5a14f009e6 "loplugin:unocast
 (xmlsecurity::Certificate)"
99009c9535 "loplugin:unocast (sd::Annotation)"
0c7585c5fa "loplugin:unocast (sd::TextApiObject)"
24e14afd1b "loplugin:unocast
 (SignatureVerifierImpl)"
1a7ad0c10d "loplugin:unocast
 (pcr::PropertyEventTranslation)"
a97e2d2702 "loplugin:unocast (RangePageBreaks)"
19dfdf86ad "iloplugin:unocast
 (pcr::OFormattedNumericControl)"
f9785ea595 "loplugin:unocast
 (frm::OInterfaceContainer)"
5e5f40a4a9 "loplugin:unocast (ScVbaShapes)"
27b35b2c21 "loplugin:unocast (ScVbaShapeRange)"
cb3108f860 "cid#1517812 Dereference null return
 value"
feba0ddb15 "loplugin:unocast
 (weld::TransportAsXWindow)"
4d6c232165 "loplugin:unocast
 (oox::ForumlaImExportBase)"
4844c096a8 "loplugin:unocast
 (cairocanvas::SurfaceProvider)"
9a0b523e0a "loplugin:unocast
 (cairocanvas::CanvasBitmap)"
8a5648d8e5 "loplugin:unocast
 (cairocanvas::TextLayout)"
28c27a0623 "loplugin:unocast
 (cairocanvas::CanvasFont)"
53bc223cb3 "loplugin:unocast
 (cairocanvas::RepaintTarget)"
5f70b0b9f6 "loplugin:unocast (SvXMLImport)"
068187a898 "loplugin:unocast (VCLXWindow)"
88b4f96620 "loplugin:unocast
 (sfx2::sidebar::SidebarController)"
f1b7a69b28 "loplugin:unocast
 (SvxLineStyleToolBoxControl)"
ba76f0ba7e "loplugin:unocast
 (i18npool::Calendar_gregorian)"
840154daf9 "loplugin:unocast
 (framework::AddonsToolBarWrapper)"
b0e9c4c5f0 "loplugin:unocast
 (GrammarCheckingIterator)"
8ee6cfc965 "loplugin:unocast
 (ucb::ucp::ext::Content)"
5b8cd77c11 "loplugin:unocast
 (basic::SfxScriptLibraryContainer)"
9e73ff9fce "loplugin:unocast
 (sdext::presenter::PresenterNotesView)"
a98acca8fb "loplugin:unocast
 (SelectionChangeHandler)"
c0b59ad6e3 "Consistently use
 comphelper::getSomethingImpl<I>(aIdentifier, this)"
276e3ccbdd "loplugin:unocast
 (vclcanvas::RepaintTarget)"

Change-Id: I37c73e3422a5154bf6cb647640d2d3f23db8bc34
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145063
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-01-05 11:45:51 +00:00
Caolán McNamara 54cb5990e6 tdf#150707 xmloff/source/style/xmlexppr.cxx:907: no prop type specified
warning seen on saving very simple writer document.

maybe since:

commit 91f649a119
Date:   Thu Dec 9 08:43:27 2021 +0100

    ODP import/export: refer to theme from shape text color

    Refer to the 12 pre-defined colors by name + don't write the attribute
    for the case when there is no theme.

Change-Id: I4a7d21a7bab1ee77336ed6a5de8862fbab9be177
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144870
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2023-01-02 08:18:42 +00:00
Tomaž Vajngerl df9f3f3fd8 sw: support for reading back theme color from OOXML
OOXML supports theme colors and tint/shade value that additionally
changed the theme color. Read back which theme color + tint/shade
value was applied in the resulting color and add this attributes
as properties to be used by writer.
In sidebar theme panel the changing the theme colors now doesn't
takes this into account and changes the colors correctly.

Change-Id: I3a2d49d485fd37a1611483ee0bb5e6034ac5f88e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143697
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-12-25 02:06:58 +00:00
Stephan Bergmann f481f036de loplugin:unocast (DocumentSettingsSerializer)
(See the upcoming commit introducing that loplugin:unocast on why such
dynamic_casts from UNO types are dangerous.)

Change-Id: I803f62085264511976ed9bb0744ee301de2a7dab
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144754
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-12-22 14:19:22 +00:00
Miklos Vajna 1feb1aa084 sw: fix ODT import of paragraph marker formatting
The DOCX bugdoc had a numbering portion which was not bold, even if all
characters in the paragrpah was bold. This was rendered fine, but once
it was saved to ODT + reloaded, the numbering portion became bold as
well, which is buggy.

What happens here is that there is one span that covers the entire
paragraph (and is bold) and there is an empty span at paragraph end
(which is not bold), so the ODT export is fine. But once we import it
back, the first span gets "upgraded" to paragraph-level formatting
(because SetAttrMode::NOFORMATATTR is not used when inserting the hints)
and the second span is not mapped back to the original
RES_PARATR_LIST_AUTOFMT in the text node.

Fix the problem by 1) improving SwXTextCursor::setPropertyValue() to
work with SetAttrMode::NOFORMATATTR when multiple spans are inserted and
by 2) extending SwUnoCursorHelper::SetCursorPropertyValue() to create
RES_PARATR_LIST_AUTOFMT for empty spans at paragraph end. This way the
original doc model and the one created after ODT export + import is much
closer to each other.

This builds on top of 6249858a89 (sw: ODT
import/export of DOCX's paragraph marker formatting, 2022-12-19),
previously the ODT export and import of paragraph marker formatting was
completely missing.

Change-Id: I139e11217dcbc18744aeeb80638090781aa74933
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144587
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2022-12-20 12:56:48 +00:00
Stephan Bergmann a0c6bc7562 -Werror=maybe-uninitialized
Change-Id: Ib467fa5eec2560943e10adc2c440fdbf8f853a2f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144446
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-12-19 14:12:06 +00:00
Caolán McNamara 68809ffde7 crashtesting: assert seen with forum-mso-en4-747641.xlsx with LCID F6E0B
see on export to ods

input .xlsx contains a LCID of F6E0B

<numFmt numFmtId="169" formatCode="_-[$£-F6E0B]* #,##0.00_-;\-[$£-F6E0B]* #,##0.00_-;_-[$£-F6E0B]* &quot;-&quot;??_-;_-@_-"/>

Change-Id: I543164dba4cc8b1c86508a3e3e39b43900c06484
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144321
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-12-18 10:41:30 +00:00
Justin Luth 54599383a2 sw content controls: enhance preserve id
Follow-up to 100c914d44
which added the initial id preservation for DOCX.

adding DOCX block SDT grabbaging, ODF import/export
[content controls can't exist in DOC format]

The ID field is CRITICAL to preserve for VBA purposes.
This patch adjusts BlockSDT to also round-trip the id
instead of just creating a random one.

m_nRunSdtPrToken <never equals> FSNS(XML_w, XML_id) since 2021
with 5f3af56b2c,
so I removed that part of the clause.

I had thought about changing the ID to use a string instead of an int,
but then the integer version was adopted to fix a regression
in the commit mentioned earlier.

I think it is AWFUL to have a number as the identifier
when it will be used in StarBASIC. The VBA guys have to deal
with it, but it would be nice to do something reasonable
for LO native access to content controls.

However, the concern would be if we allow VBA macro content created in LO
to be exported to DOCX format - that would cause problems converting
from a string ID to a number ID. VBA editing already is happening to
some extent, and mmeeks seems interested in enabling it.
So over-all it seems best to just stick with an integer ID.

I used the commits for <w:alias> and <w:tag> to compose this patch.
XML_ID already existed in include/xmloff/xmltoken.hxx
and "id" already exists in xmloff/source/token/tokens.txt

The ID can be used in VBA to select a specific control.
The id (which is a positive or negative integer in DOCX)
specifies a unique control - either by passing the number as a string
(of the UNSIGNED value) or by passing as a float (specified with #).

For example:
msgbox ActiveDocument.ContentControls(2587720202#).ID
msgbox ActiveDocument.ContentControls("2587720202").ID
but not as an integer since that is used for index access.
dim index as integer
index = 1
msgbox ActiveDocument.ContentControls(index).ID

make CppunitTest_writerfilter_dmapper CPPUNIT_TEST_NAME=testSdtRunRichText
make CppunitTest_sw_ooxmlexport17 CPPUNIT_TEST_NAME=testDateContentControlExport
make CppunitTest_sw_ooxmlexport18 CPPUNIT_TEST_NAME=testTdf151912
make CppunitTest_sw_core_unocore CPPUNIT_TEST_NAME=testContentControlDate
make CppunitTest_xmloff_text CPPUNIT_TEST_NAME=testAliasContentControlExport
make CppunitTest_xmloff_text CPPUNIT_TEST_NAME=testAliasContentControlImport

Change-Id: I5c4022dc932d941fad9da6d75ce899ee1ff66ff5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142818
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-12-16 07:34:20 +00:00
Justin Luth 908d058c67 tdf#151548 sw content controls: preserve tabIndex
This has to be vital to keyboard navigation.
Certainly it is good to have it imported
before we start to consider tab-movements
for form controls.

All tabIndex 1's are processed (in placement order)
and then the 2's etc. 0's are to be done last.

XML_TAB_INDEX already existed in include/xmloff/xmltoken.hxx
and "tab-index" already exists in xmloff/source/token/tokens.txt

make CppunitTest_writerfilter_dmapper CPPUNIT_TEST_NAME=testSdtRunRichText
make CppunitTest_sw_ooxmlexport17 CPPUNIT_TEST_NAME=testDateContentControlExport
make CppunitTest_sw_core_unocore CPPUNIT_TEST_NAME=testContentControlDate
make CppunitTest_xmloff_text CPPUNIT_TEST_NAME=testAliasContentControlExport
make CppunitTest_xmloff_text CPPUNIT_TEST_NAME=testAliasContentControlImport

No existing unit test found containing blockSDT with tabIndex.

Change-Id: I8a958844e6192b079a2b22a62dedfd8739021f4a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143603
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-12-14 07:14:59 +00:00
Justin Luth 65fa248f9a tdf#151548 sw content controls: preserve lock
DOCX SdtControls can be locked in two ways:
-Content Control cannot be deleted (sdtLocked)
-Contents cannot be edited (contentLocked)
or both (sdtContentLocked)

make CppunitTest_writerfilter_dmapper CPPUNIT_TEST_NAME=testSdtRunRichText
make CppunitTest_sw_ooxmlexport4 CPPUNIT_TEST_NAME=testSimpleSdts
make CppunitTest_sw_ooxmlexport17 CPPUNIT_TEST_NAME=testDateContentControlExport
make CppunitTest_sw_core_unocore CPPUNIT_TEST_NAME=testContentControlDate
make CppunitTest_sw_macros_test CPPUNIT_TEST_NAME=testVba
make CppunitTest_xmloff_text CPPUNIT_TEST_NAME=testAliasContentControlExport
make CppunitTest_xmloff_text CPPUNIT_TEST_NAME=testAliasContentControlImport

Change-Id: I5a82d9f6b5103a4902f59af66cd8a99addd4e690
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143542
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-12-13 14:24:56 +00:00
Michael Stahl 31084ebb59 tdf#143311 offapi,oox,writerfilter,xmloff,sw: decorative flag on flys
* sw core RES_DECORATIVE as a FRMATR
* sw API SwXFrame property "Decorative"
* UI checkbox "Decorative"
* ODF import/export as loext:decorative on draw:frame
* DOCX export
* DOCX import - very non-obvious how to get it from model.xml to dmapper
* PDF/UA export: tag flys with this flag as Artifact
* test for DOCX filters, ODF filters, PDF export

Change-Id: I1ceb67fdd4e1cfa212aafdeb1c5f4ccd873d433e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143815
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2022-12-09 16:03:20 +00:00
Maxim Monastirsky 95a3d7733c Deduplicate table styles insertion
(Not adding a test here, as this should already be covered
by several tests in sw/qa/extras/odfexport/odfexport.cxx.)

Change-Id: Ic3cae9f38efc55d3d9055a45bc642d7b15fa382a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143840
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
2022-12-09 00:13:42 +00:00
Maxim Monastirsky 8bd31225d7 Fix sd encoded table style name handling
Found this while looking into improving insertion of pages
with tables, as SdDrawDocument::InsertBookmarkAsPage uses "_"
as the rename suffix for styles with identical names but a
different content.

This commit fixes two issues:

- For import, cell styles with encoded names couldn't be found
by table styles. The reason is that styles are referenced in
ODF by encoded names, but at runtime by display names. Yet we
were searching the cell style family by encoded names. This was
already handled for sw in insertTabletemplate(), and now do the
same for sd.

- For export, table template names were encoded, but then
referenced by tables using their non-encoded names. This is
unlike the sw code that doesn't encode them, and therefore
doesn't have this problem. Looking at the schema, both
table:name attribute of a table template, and table:template-name
attribute of a table are of type "string", which suggests that
there is indeed no need to encode those names. This aligns with
the fact that table templates don't have a display-name attribute.

Change-Id: Ie61b6a1c95b033404ee98f3fc40d8e82434a6a6c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143839
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
2022-12-09 00:13:30 +00:00
Caolán McNamara 8a33bde528 tdf#152266 only warn about script:event-listener with non-empty targets
Change-Id: I19518c4872b522686b3df1881ccee02d840c3db4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143829
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-12-08 19:45:00 +00:00
Noel Grandin da798460e3 crashtesting ooo84576-1.odt
prevent the OOM by detecting cycles in SwList::SwList and throwing an
exception.

(1) However, that means we need to catch the exception in
    XMLTextListBlockContext::XMLTextListBlockContext
and undo some registration, otherwise we will get a use-after-free.

The need to catch it is why I'm using an UNO exception here,
it seemed like a bad idea to throw and then catch and std::foo
exception.

(2) this is still not the end of the story, a further exception
is thrown during SwDoc destruction, for which I don't have a
solution.

Change-Id: I48be3d8acbdc0f9ca948a958f1124b158ba77ac0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143820
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-12-08 18:24:22 +00:00
Mike Kaganski b15eb164a8 tdf#152380: add checks for names and values sequences length equality
Change-Id: Ibeef551126874bcfffb4e7736588e2e1873f5768
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143681
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-12-06 05:32:37 +00:00
Noel Grandin 01a3cc1e55 tdf#133343 collect autostyle prop names
before scanning for autostyles. That way we can collect only the
property state we are interested in, instead of all properties.

Change-Id: I8da4d61401d904631cbf9dc1828266950fe98421
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143466
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-11-30 08:38:57 +01:00
Maxim Monastirsky daab698b34 sd: replace hardcoded table styles with xml file
Including a new set of default styles, provided by Rafael Lima.
Some ui tests had to be modified, because the new borders are
thicker.

If you intend to edit the xml file, please keep in mind the
following requirements:

1) There should be a table template called "default". It's
applied to newly inserted tables.

2) There should be a cell style called "default". It's used for
new table styles.

3) Please make all cell styles inherit from "default" (directly
or indirectly), unless you intend to specify font names in them.
"default" has its font names filled programmatically based on
officecfg/registry/data/org/openoffice/VCL.xcu.

4) Whenever possible please use <style:table-cell-properties>
for cell properties, instead of the incorrect
<style:paragraph-properties> and <loext:graphic-properties>
we currently use for export. See tdf#72238 and tdf#72239.

Change-Id: I73dd4492fefb65b1870238aec7dc64f8076f6e95
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141825
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
2022-11-29 09:39:22 +01:00
Maxim Monastirsky 5d683e8f6c Export modified table styles
In addition to actually used styles, we want to
export user defined styles, as well as built in
styles that were modified.

Detecting the real modification state might be
challenging in some cases, e.g. when importing
the style from an existing document. So for
simplicity, we consider a style as "modified"
if at least one of its child cell styles is user
defined. The UI for modifying cell styles will be
implemented in such a way that built in styles
will never be modified themselves. Instead, a
user defined style will be created on the fly,
with the corresponding built in style set as its
parent, and only that new style will be modified.

It is still possible to modify built in cell
styles via the UNO API, but such styles won't be
exported unless actually used in the document.

Change-Id: Ic73eb460fd024f23016553e134397e07259f5c90
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143011
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
2022-11-21 14:38:59 +01:00
Miklos Vajna 56db6406b0 sw content controls: allow no list items in a dropdown
- Replace SwContentControl::HasListItems(), which assumed that the type
  is dropdown if we have list items. This is not valid, it's OK to have
  a dropdown with no list items. Add a GetDropDown() instead to check
  for the type, explicitly.

- UNO API sets the dropdown bit when list items are set and the type is
  not expilcitly combo box or drop down, to keep backwards
  compatibility with existing documents.

- No change to the edit shell, SwDropDownContentControlButton already
  checked if items are empty and used STR_DROP_DOWN_EMPTY_LIST in that
  case, but that was dead code previously.

- ODT & DOCX filters are now updated, ODF has a new
  <loext:content-control loext:dropdown="..."> attribute to specify that
  the type is a dropdown, explicitly.

Change-Id: Id577ba9639151549a8f953aab31685a73a898504
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142491
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2022-11-09 17:00:00 +01:00
László Németh 0a93f33a2e xmloff: write transliteration-spellout only in extended ODF
Follow-up to commit 7c20c3c2a9
"xmloff: ODF export: adapt all checks of ODFSVER_012 etc.".

Reported by Eike Rathke.

See also b7d53247eb
"tdf#115007 i18npool: add NatNum12 formats to locales" and
2a1d2d42af
"tdf#115007 add NatNum12 number format list items, fix title case".

Change-Id: Idb25a37ffcad0a0fb05276b972561abf929cd81b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142373
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
2022-11-07 13:53:48 +01:00
Noel Grandin e14a3ebf80 tdf#54857 use OUStringConstExpr in XMLPropertyMapEntry
which means we don't need to allocate a bunch of strings
when building the property maps in xmloff

Change-Id: I83cb013f816d9b7bcb0dd55c59e5151b33b91c9c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142192
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-11-04 06:50:43 +01:00
Maxim Monastirsky 6f32f1a12b tdf#72238 xmloff,sd: Import of <style:table-cell-properties>
Handles fo:border*, fo:padding*, fo:background-color and
style:vertical-align attributes.

Export is unchanged for now, as older versions still
can't read this, and on the other hand we probably want
to keep the import of the wrong attributes for the long
term, to not break existing documents. Also, we can't
fully export fill properties anyway because of tdf#103602.

Change-Id: I8687507b98602ffcd05adb2087c894bb45aa3c6c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142058
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
2022-10-31 11:49:11 +01:00
Armin Le Grand (allotropia) 470201f392 tdf#145240 add flexibility to receiving PolyPolygons over UNO API
Make XMLShapeExport aware and use that PolyPolygons can be not
only in Bezier format, but also a sequence of Points

Change-Id: Ie00e87d35d4f8aa9d481b2800585c5a770bbbc0a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141935
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2022-10-28 10:47:36 +02:00
Miklos Vajna 888a8c3ca7 sw content controls, alias and tag: add ODT filter
Map the Alias/Tag UNO properties to:

        <loext:content-control loext:alias="..." loext:tag="...">

on export, and do the opposite on import.

Change-Id: Icecbe9037ede0bf8d72d52f2db44328a8db1d83a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141492
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2022-10-18 12:40:31 +02:00
Caolán McNamara 1f09bf7bee crashtesting: assert on converting ooo64499-3.sxc to ods
a problem since:

commit 776ea34dee
Date:   Wed Sep 21 11:09:46 2022 +0200

    use more string_view in xmloff

Change-Id: Ifec0f4c84373aa4501acfde2fd357fd749f836c1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140654
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-09-27 17:47:41 +02:00
Michael Stahl a0a529a131 xmloff: ODF import: fix crash on fdo34997-1.odt
Clean up the redundant checks too, these are all called after first
checking hasCurrentFieldCtx().

(regression from 463178fef5)

Change-Id: Ieec848944ef576caf319d5da7dc11139a4d26c58
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140514
Tested-by: Jenkins
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-09-23 21:34:59 +02:00
Miklos Vajna 21d93d8d2f sw content controls, combo box: add ODT filter
Map the ComboBox UNO property to:

        <loext:content-control loext:combbobox="...">

on export, and do the opposite on import.

Change-Id: I33c162ace15025c8031eb678ba5a43ac085c4b6c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140364
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2022-09-22 09:34:38 +02:00
Noel Grandin 776ea34dee use more string_view in xmloff
Change-Id: Ieef49d049760e557d341f1991f28333b09220c1d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140336
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-09-21 15:46:10 +02:00
Mike Kaganski bdf346830b tdf#151100: xText->getString() may be empty for content needing export
The check that is removed prevents collecting the table data.
Assume that it's the performance optimization, and that processing
empty text objects would be fast anyway.

This basically reverts commit 73fcb052ed
  Author Christian Lippka <cl@openoffice.org>
  Date   Thu Nov 22 12:26:35 2001 +0000
    #90330# only export text autostyles for shapes with text

and commit 7661bbbaef
  Author Michael Stahl <mstahl@redhat.com>
  Date   Fri Nov 25 22:46:34 2016 +0100
    tdf#102479 ODF export: ignore exceptions when checking shape text

that becomes unnecessary after the former change is reverted.

Change-Id: I709a7b4c5ac1cc0621d3a1b18f2eb74feb987efb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140313
Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-09-21 13:48:44 +02:00