Commit Graph
2620 Commits
Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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
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
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
Miklos Vajna 80550ade30 tdf#150990 ODT export: fix zero layout size of scale/scale images
The bugdoc has a broken image where both axis are set to a relative size
of 255%, which means "keep aspect", and the expectation is that only one
axis uses this to match the size of the other axis.

The problem was that commit b578fa08a2
(ODT export: fix fallback svg:width/height for text frames with relative
sizes, 2022-03-16) assumed that only one axis uses "scale", so we always
get a non-zero layout size.

Fix the problem by only using the layout size when exactly one axis uses
the "scale" percentage, which is the expected the case.

This way we just keep the aspect ratio of broken documents, then the UI
will in practice ignore the scale request of the width.

Change-Id: I2dbd6bb92f912f6185422fd301b99b284a66ef74
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140218
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2022-09-20 11:54:33 +02:00
Mike Kaganski 58cb4fc7d1 tdf#150927: properly handle nesting in tables
This re-implements the relevant part of commit
35021cd56b, to follow the same
recursion logic that is used in SwXMLExport::ExportTable.

Additionally, it found a place where XML was still emitted
when collecting autostyles (breaks were exported); fixed.

Change-Id: I3b7eed06e0eca9ad20304b45db4c3e9d72478c9b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139901
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-09-14 10:38:31 +02:00
Noel Grandin b32c44f83d WARN->INFO in XMLTextFrameContext_Impl
Unknown attributes are not really a problem.

Change-Id: Ie21d42c6489eae11c730eec272fc430c2d17f727
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139750
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-09-10 20:58:13 +02:00
Noel Grandin 4aa464f463 no need to use unique_ptr for this map in XMLRedlineExport
map is already a node based data structure, so the values will stay
in the same place in memory

Change-Id: Id555367e9a3e44f60295b8296aadabb9c1681e6a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139271
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-09-03 11:37:34 +02:00
Justin Luth 46dc9f3bba tdf#57317 odf export: avoid autolist conflict with NumberingStyles
Somehow you can have autoStyles writing into the styles.xml.
Well, the code to prevent duplicates for that needs to exist
for autoStyles written into document.xml as well.

Change-Id: I9602b7023a1ef009ad644374dc5081afb8a76916
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138703
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
2022-08-23 04:09:04 +02:00
Stephan Bergmann 91ba9654ba Move tools/diagnose_ex.h to comphelper/diagnose_ex.hxx
...so that its TOOLS_WARN_EXCEPTION can be used in
comphelper/source/misc/logging.cxx in a follow-up commit.  (And while at it,
rename from diangose_ex.h to the more appropriate diagnose_ex.hxx.  The
comphelper module is sufficiently low-level for this immediate use case, so use
that at least for now; o3tl might be even more suitable but doesn't have a
Library until now.  Also, for the immediate use case it would have sufficed to
only break DbgGetCaughtException, exceptionToString, TOOLS_WARN_EXCEPTION,
TOOLS_WARN_EXCEPTION_IF, and TOOLS_INFO_EXCEPTION out of
include/tools/diagnose_ex.h into an additional new
include/comphelper/diagnose_ex.hxx, but its probably easier overall to just move
the complete include file as is.)

Change-Id: I9f3222d4ccf1a9ac29d7eb9ba1530d53e2affaee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138451
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-08-18 17:10:19 +02:00
Mike Kaganski f1f6c82e61 tdf#150235: use correct types in XMLTextColumnsExport
The types for the properties are defined in css::text::TextColumns
servise. But before commit 95ebd24a62
  Author Mike Kaganski <mike.kaganski@collabora.com>
  Date   Thu May 27 13:00:10 2021 +0300
    editengine-columns: ODF support [API CHANGE]

the implementation of the service (SwXTextColumns) used smaller types
for some properties. The export code (XMLTextColumnsExport::exportXML)
mathced those implementation types.

The mentioned commit changed the implementation to use proper types;
but the export code wasn't corrected.

This fixes the export code.

Change-Id: I95838dec382edc61bb2e5b39177bf57a7d79e0bf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137900
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-08-06 18:32:03 +02:00
Miklos Vajna 6cf1f3c09c crashtest: fix crash on ODT export of forum-mso-de-84211.docx
XMLTextParagraphExport::ExportContentControl() disables the export of
the <loext:list-item> XML element in autostyle mode, then it should also
disable the export of the matching attributes.

Change-Id: Ia65fc8bd3398df0ab1b71973695c9bc8d10deaa4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137452
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2022-07-26 13:00:01 +02:00
Miklos Vajna 33cf26c8b6 sw content controls, date: add ODT filter
Map the PlainText UNO property to:

	<loext:content-control loext:plain-text="...">

on export, and do the opposite on import.

Change-Id: Icec0c35b2b9fca53104e6526c98083db52df5d42
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137340
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2022-07-22 09:39:00 +02:00
Mike Kaganski 9f4af852c4 tdf#148198: merge identical hyperlinks of adjacent text ranges on ODF export
The true hyperlink boundaries are available as SwpHints starts/ends, which are used
in DOC(X) export (see SwWW8AttrIter::OutAttrWithRange).

However, I don't see a reasonable way to expose this information to xmloff, so I
decided instead to just merge the identical hyperlink properties of adjacent ranges
into a single hyperlink. This will allow to fix already split hyperlinks saved in
previous versions. The downside is that this disallows to have separate adjacent
identical hyperlinks - I hope that this would not be a real issue.

Change-Id: I901e6035a5e89bc515b5742c6a5f564c77faf05b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137013
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-07-14 07:43:14 +02:00
Mike Kaganski 454e182898 Simplify XMLTextParagraphExport::addHyperlinkAttributes
Change-Id: I283fc348d1ecaee92095f50c6f7d92fff8b09dce
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136994
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-07-13 09:54:03 +02:00
Noel Grandin ca2a4a4b1c clang-tidy modernize-pass-by-value in xmloff
Change-Id: Ica07e393763343d0f5caaad6a89fa3378f6ad344
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136995
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-07-12 15:59:38 +02:00
Michael Stahl 463178fef5 xmloff, sw: ODF import/export of fieldmark separator
Previously there were only the fieldmark-start and fieldmark-end
elements; now add a fieldmark-separator, so that the field command can
be stored as character data (and elements if there is any formatting)
instead of attribute value.

The import is a bit more complicated because there are already existing
documents that are missing the separator; it's not possible to predict
if there will be a separator at the time when the start element is seen,
so add some hack to toggle inserting the SwXFieldmark with separator
at the end (when the document contains a separator, i.e. after the
command) or separator at the start (when the document is missing a
separator, i.e.  after the result).

Change-Id: I14d2f50f57d690e75643df5d14fd881ebc759a41
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136513
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2022-07-08 14:32:03 +02:00
Noel Grandin adf4197927 elide some string copies
Change-Id: I3e0d9f7e5a446689e007b9d01fb1c6bf9bc068e9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136880
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-07-07 15:21:33 +02:00
Miklos Vajna b6758293e6 Remove some unused includes
See tdf#42949 for motivation.

Change-Id: I157b331195cc8262e6bd1dcc536cb653587fc45f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135775
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-06-14 08:11:28 +02:00
Stephan Bergmann 875abc7774 Use o3tl::make_unsigned, length is known to be non-negative
Change-Id: I2fac355230fd0c80016ca2259b8c6150e7160567
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135323
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-06-02 20:32:20 +02:00
Noel Grandin 733a6b4f8e elide some makeStringAndClear() class
when we are passing the result to a string_view, it is pointless.

Change-Id: I1e11d2610d70ed49c0b00d0c908829e8f1252bab
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135298
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-06-02 13:06:27 +02:00
László Németh 7a1d4b7d1d tdf#149420 sw offapi xmloff: add hyphenation zone
Add hyphenation zone support, i.e. allow the specified
amount of extra space in lines instead of forcing hyphenation.
It's for limiting hyphenation, used especially with
not justified paragraph alignment.

Note: this is an OOXML interoperability feature,
used also in DTP software and CSS.

* Add checkbox to Text Flow in paragraph dialog
* Store property in paragraph model (com::sun::star::style::ParagraphProperties::ParaHyphenationZone)
* Add ODF import/export
* Add ODF unit test
* Add layout test

Note: extend SvxHyphenZoneItem::GetPresentation() with
missing No CAPS and No last word hyphenation options.

Note: fix OSL_ENSURE condition in SwTextFormatInfo::GetHyphValues().

Follow-up to commit 29359fc15c
"tdf#149324 sw offapi xmloff: add option to not hyphenate short words".

Change-Id: Ib8eff6ea98a9aa5ca6cb9d17faa0bbb789687ce9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135247
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2022-06-02 09:57:39 +02:00
Noel Grandin 2e32150731 these can be stack allocated
Change-Id: Ief9a0732d50af95d679d1d6b66dec9d2e2d141df
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135132
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-30 19:17:03 +02:00
Michael Stahl 9896f330cd tdf#145178 xmloff: ODF import: fix another bad attribute
...in XMLSectionFootnoteConfigImport.

(regression from commit 9814c1f2ed)

Change-Id: I79ab3b74853bd3ec9058fea72c341768e916bbd3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135048
Tested-by: Michael Stahl <michael.stahl@allotropia.de>
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2022-05-28 16:47:09 +02:00
Louis Possoz bbec710bd2 tdf#145178 Formats in section Foot/Endnotes not read from saved files
Imported, 'num-suffix' & 'num-format' properties generate debug warnings:

warn:xmloff:10220:10220:xmloff/source/text/
   XMLSectionFootnoteConfigImport.cxx:123: unknown attribute urn:oasis
   :names:tc:opendocument:xmlns:style:1.0 style:num-suffix value=]]
warn:xmloff:10220:10220:xmloff/source/text/
   XMLSectionFootnoteConfigImport.cxx:123: unknown attribute urn:oasis
   :names:tc:opendocument:xmlns:style:1.0 style:num-format value=One

The faulty code is within XMLSectionFootnoteConfigImport::startFastElement()

The namespace for these two properties must be set to 'STYLE'
   (it is wrongly set to 'TEXT')

Change-Id: I923f12e19ed15779c67b2159d88d80a2ccb04e17
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133605
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Tested-by: Michael Stahl <michael.stahl@allotropia.de>
2022-05-27 21:11:27 +02:00
Miklos Vajna 79baafccf3 sw content controls, date: add current date handling
While working on the DOCX import for dates, it turns out there is a need
to store the selected date in machine-readable format as well. This is
useful, because once the timestamp is formatted, the user is allowed to
hand-edit the result, so otherwise the selected date would be lost.

This commit adds:

- doc model & UNO API

- click handler (store the selected date, default to the current date in
  the date picker if possible)

- ODT filter

- DOCX export

And tests for all these.

Change-Id: I00f4e87ebfe0e8a19486367c32d472ccd2ff16a8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135035
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2022-05-27 12:11:46 +02:00
László Németh 29359fc15c tdf#149324 sw offapi xmloff: add option to not hyphenate short words
Add paragraph property to disable automatic hyphenation of short
words based on a minimum character count.

Note: there is a (broken) global option for Minimum Word Length
at hyphenation, see "Minimal number of characters for hyphenation"
in Tools->Options->Language Settings->Writing Aids), but
for better/comfortable paragraph-level adjustment of typesetting,
add a paragraph property for it. The same option is available e.g.
in Adobe InDesign and in CSS Text Module Level 4 (hyphenate-limit-chars).

* Add checkbox to Text Flow in paragraph dialog
* Store property in paragraph model (com::sun::star::style::ParagraphProperties::ParaHyphenationMinWordLength)
* Add ODF import/export
* Add ODF unit test
* Add layout test

Follow-up to commit 8c018910ae
"tdf#149248 sw offapi xmloff: add option to not hyphenate last word".

Change-Id: I68715f47d17b5c022430bd0e74c88a97bc7f81f9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135028
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2022-05-26 20:25:35 +02:00
László Németh 8c018910ae tdf#149248 sw offapi xmloff: add option to not hyphenate last word
Add option to disable automatic hyphenation of the last word of
paragraphs for better typography.

Note: the same option used e.g. in Adobe InDesign, and a
similar one in CSS Text Module Level 4 (hyphenate-limit-last).

* Add checkbox to Text Flow in paragraph dialog
* Store property in paragraph model (com::sun::star::style::ParagraphProperties::ParaHyphenationNoLastWord)
* Add ODF import/export
* Add ODF unit test
* Add layout test

Follow-up to commit 72bd0df107
"tdf#121658 Add option to not hyphenate words in CAPS".

Change-Id: Ida29c65b5a7cbfd7c399c342781531a6fb86f639
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134985
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2022-05-26 16:37:02 +02:00
Miklos Vajna b3c6511659 sw content controls, date: add ODT filter
Map the Date, DateFormat and DateLanguage UNO properties to:

	<loext:content-control loext:date="..." loext:date-format="..." loext:date-rfc-language-tag="...">

And do the opposite on import.

Change-Id: I16d3f755d77ed20380d877ba65dfe6d063f2bec2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134977
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2022-05-26 14:06:20 +02:00
László Németh 2682828f73 tdf#56266 sw xmloff: fix tracked deletions in insertions
RedlineSuccessorData export, i.e. tracked deletions
within tracked insertions were loaded as plain
tracked deletions during an ODF roundtrip. After that,
e.g. rejecting all changes couldn't reject the lost
tracked insertion, keeping the text of the tracked
deletion as part of the original text by mistake.

Regression from commit a9019e7681
"INTEGRATION: CWS oasis (1.3.276); FILE MERGED
2004/05/12 11:00:37 mib 1.3.276.1: - #i20153#: changed <office:annotation> and <office:change-info>"

Note: RedlineSuccessorData is still stored in an extra
text:insertion within text:changed-region, only the
not ODF-compatible office:chg-author and office:chg-date-time
attributes were changed to dc:creator and dc:date elements
in RedlineSuccessorData export:

<text:changed-region>
  <text:deletion/>
  <text:insertion/>
</text:changed-region>

Because this structure still causes a bootstrap ODF validation
error in the odfexport and layout tests, check the export with
uitest. See also SetChangeInfo()/RedlineAdd().

Change-Id: Ic15c468172bd4d7ea1fd49d9b6610204f23d0036
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134860
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
2022-05-25 09:56:53 +02:00
Miklos Vajna 81ce15c466 sw content controls, picture: add ODT filter
Map Picture UNO property on content controls to:

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

And do the opposite on import.

Change-Id: I47c3d04c505ba94da958d5d6b6b2c883236afc3d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134595
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-05-19 17:07:42 +02:00
Miklos Vajna 9f37840b0d sw content controls, dropdown: add insert UI
- introduce a SwContentControlListItem::ToString() that tries to use the
  display text of the list item, otherwise falls back to its value and use it
  while building the dropdown widget and when inserting selected list item

- handle the dropdown case in SwWrtShell::InsertContentControl()

- expose this as a new .uno:InsertDropdownContentControl command

- mention the new and all previous content control commands in the
  MS-compatible forms menu as well

Change-Id: I075f77933c1466b5258357d5a661e173c34de34f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134215
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2022-05-12 17:48:51 +02:00
Miklos Vajna c3f4c43694 sw content controls, drop-down: add ODT filter
Map each list item to a dedicated XML element:

<loext:list-item loext:display-text="..." loext:value="...">

And do the opposite on import.

Change-Id: I59a536a8317a3bb24919107b4449f858d5f6de96
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134034
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2022-05-09 11:16:54 +02:00