Commit Graph
2294 Commits
Author SHA1 Message Date
Miklos Vajna 2c4d84e939 tdf#116410 DOCX import: restrict increased object spacing to multiple shapes
This anchored object handling is just there to be bug-compatible with
Word, it's not needed for the case when there is a single shape in the
paragraph.

Change-Id: I5e3dc4ba9a4a6f459ec6217e8974ebc2d7303bcc
Reviewed-on: https://gerrit.libreoffice.org/51922
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
2018-03-27 09:17:38 +02:00
Justin Luth d47c84a5fd comment: Word does not use tabs in footnote implementation
Tabs are inserted when LO exports to MS formats in an attempt to
emulate its "magical" spacing which uses the paragraph margin.

By default, the Footnote paragraph style has a paragraph margin of
0.60cm. A hanging indent places the footnote character before the
margin, and thus a tab advances to the margin. So the emulation
works well.

The previous comment was misleading because it suggests that this
was a Microsoft convention, but actually this is an OOo innovation.

Change-Id: Ie8708998457bcb3363bbc760086cf2b41d3eb104
Reviewed-on: https://gerrit.libreoffice.org/51753
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Justin Luth <justin_luth@sil.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-03-23 08:53:38 +01:00
Mike Kaganski 9078fbd14b tdf#116472: import "auto" border color as black
Since commit fe6da2feb5, "auto" color is
supported in OOXML import.

Since ODF doesn't support "auto" color as border color, just convert
"auto" border color to black on import, like is done in GetLineIndex
in ww8par6.cxx.

Incidentally, this also fixes a problem in RTF import, where we used to
import black borders ("\red0\green0\blue0;" entries in color table) as
0x000001 ("\red0\green0\blue1;") - see fixed tests in rtfexport2.cxx.

Change-Id: I4f5e720d215b51c8a43dc7c58f338741bd608efc
Reviewed-on: https://gerrit.libreoffice.org/51519
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-03-19 16:42:10 +01:00
Serge Krot be02ce71f2 tdf#113182: DOCX filter: new values of wrap property in text box
Added support of "none" and "through" values of the w:wrap
poroperty in the text box.

Change-Id: I83f0c9e8162e93bf457f228d49d3b426050d4dc6
Reviewed-on: https://gerrit.libreoffice.org/51396
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2018-03-16 15:40:45 +01:00
Mike Kaganski 8805e10f58 tdf#112118: DOC: properly import/export border distance
DOCX part was done in fb959e581c.

This commit fixes DOC part. Line width wasn't taken into account on
import; and export was done only with "from text" distance, which
gave poor interoperability with Word, where the borders were close
to page edge.

The common code is moved to editeng/source/items/frmitems.cxx and
include/editeng/boxitem.hxx.

Change-Id: I3d1d1312cb9dc9a9e00d9847ec11234cd787df60
Reviewed-on: https://gerrit.libreoffice.org/51366
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-03-16 04:54:47 +01:00
Andrea Gelmini 4defe28e5f Fix typos
Change-Id: Icb2d5f8bb9eb781d6a59384e1aac75abf6145774
Reviewed-on: https://gerrit.libreoffice.org/51337
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins <ci@libreoffice.org>
2018-03-15 20:09:53 +01:00
Mike Kaganski fb959e581c tdf#112118: DOCX: properly import/export border distance
https://wiki.openoffice.org/wiki/Writer/MSInteroperability/PageBorder
discusses implementation differences between ODF model and MS formats
wrt dealing with page margins and distances to borders.

This patch corrects import from DOCX, so that the border distance and
width doesn't add to the margin size imported from file anymore. It
takes care to preserve size from page edge to text (the most important
size that affects document layout). When borders go outside of range
valid for ODF, the margin is set to keep text area intact, and the
border is placed as close to intended position as possible.

Export code now also properly handles border width. Also, an improved
heuristic implemented to better export cases unsupported by Word, so
that the result would look closer to ODF original. We still write
correct sizes to OOXML, so that when reopened by LO, the borders will
be in correct places; but as Word cannot handle sizes more than 31 pt,
it will show borders shifted.

This prevents from adding border widths and distances to page margins
at each opening of DOCX, saving back the changed value, increasing
the margins each time.

Change-Id: Ia978ab119dd661949d6c321aea91397f28d205b0
Reviewed-on: https://gerrit.libreoffice.org/51267
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-03-14 15:32:54 +01:00
Luke Deller fe6da2feb5 tdf#116179 Support reading "auto" colour from docx
In docx a colour value is represented as a 6-digit hex RGB value, or
alternatively the word "auto" to represent automatic colour.

 - Add support for reading the value "auto" as COL_AUTO.  Previously
   this would be read as if it were a hex value, stopping at the
   letter 'u' which is not a valid hex digit, resulting in the colour
   0x00000A - a very dark blue, which looks close enough to black that
   it went unnoticed for a long time :-)

 - Remove code which tried to handle this wrong 0x00000A value,
   including the constant OOXML_COLOR_AUTO, as it is no longer needed
   and will cause surprises for anyone who really wanted this exact
   shade of dark blue

 - Fix unit tests that were checking for 0x00000A

Change-Id: I6000070341931147ff9341ad6281cd3b53c02b46
Reviewed-on: https://gerrit.libreoffice.org/50995
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-03-13 14:06:13 +01:00
Mike Kaganski 6d20aeeda8 If handler sets contexts properties, it should do it properly
Change-Id: I0b58ab924214e1cbbc89af94c037e29d14d45856
Reviewed-on: https://gerrit.libreoffice.org/51195
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-03-13 10:33:06 +01:00
Caolán McNamara aeb925a031 forcepoint #21 pop on empty stack
Thanks to Antti Levomäki and Christian Jalio from Forcepoint.

Change-Id: I25b1c6361fb0a3ae6b01f2be870c9e1b49bf5b84
Reviewed-on: https://gerrit.libreoffice.org/51114
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-03-12 22:07:05 +01:00
Caolán McNamara 57a1d2ce7d forcepoint #24 back() on empty vector
Thanks to Antti Levomäki and Christian Jalio from Forcepoint.

Change-Id: Idb6723b53a1ae8aaca80847bfe643bc4abaedd21
Reviewed-on: https://gerrit.libreoffice.org/51121
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-03-12 22:06:11 +01:00
Caolán McNamara 4c04156195 forcepoint #23 Null dereference
Thanks to Antti Levomäki and Christian Jalio from Forcepoint.

Change-Id: I2e68a6c3fe1846fbfaaa0305c02da135a930d863
Reviewed-on: https://gerrit.libreoffice.org/51120
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-03-12 15:03:45 +01:00
Caolán McNamara 87ea09563d forcepoint #22 pop on empty stack
Thanks to Antti Levomäki and Christian Jalio from Forcepoint.

Change-Id: I964c79af0087075df0142cd251fd304a68bc497b
Reviewed-on: https://gerrit.libreoffice.org/51119
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-03-12 15:03:32 +01:00
Caolán McNamara a4617d76a5 forcepoint #21 pop on empty stack
Thanks to Antti Levomäki and Christian Jalio from Forcepoint.

Change-Id: I0aac834a60224b33e5d33d08abd7fb056ef9d52a
Reviewed-on: https://gerrit.libreoffice.org/50973
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-03-09 10:09:00 +01:00
Tomaž Vajngerl fb29e6eeea svx: removing GraphicURL and OWN_ATTR_GRAFURL, fix writerfilter
Change-Id: I5b84788a324cc68e3c4561e9a7376fcb1cfeeb67
Reviewed-on: https://gerrit.libreoffice.org/50933
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2018-03-09 04:19:38 +01:00
Tomaž Vajngerl d72145f930 Move BackGraphicURL property & friends to BackGraphic + fixes
This moves BackGraphicURL, HeaderGraphicURL, FooterGraphicURL and
ParaBackGraphicURL properties to BackGraphic, HeaderBackGraphic,
FooterBackGraphic and ParaBackGraphic. With this the property type
changes from String to XGraphic.

This change also fixes a bunch of test failures, changes the tests
to use the new properties and the correct type, changes the import
and export filters like xmloff and oox, to make the tests happy.

Change-Id: Ie66097514203c6dc36ab27420faf265322e9279e
Reviewed-on: https://gerrit.libreoffice.org/50760
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2018-03-07 02:37:36 +01:00
Miklos Vajna 49cf733eff tdf#115861 DOCX import: avoid last-paragraph removal when discarding footer
Discarding header/footer is necessary when the document or section
settings request to ignore first or even headers/footers. In the bugdoc
case settings.xml didn't opt-in for different even/odd footers, but
there was an even footer to be ignored.

Handle this state at two more places, so we don't end up in a situation
where we ignore the footer but not its "remove last (empty) paragraph at
the end of the footer" action.

Also make the debug dumper for text ranges more robust to have a working
token dump when we try to get the string for a table.

Change-Id: I6395f37aa40c42304e2c918d87dadecb21e9d378
Reviewed-on: https://gerrit.libreoffice.org/50786
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
2018-03-06 09:07:07 +01:00
Caolán McNamara 09c311b0fb ofz#6720 Divide-by-zero
Change-Id: I81d89a41437456535949e1cd214ec4e514c26494
Reviewed-on: https://gerrit.libreoffice.org/50733
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-03-04 20:42:15 +01:00
Caolán McNamara 3d5a763194 forcepoint #12 top empty stack
Change-Id: I51f02be13b3cf69e9aaef644a6c4837f1c47ff62
Reviewed-on: https://gerrit.libreoffice.org/50602
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-03-02 09:50:27 +01:00
Noel Grandin e2cb154195 convert COL_ constants to be of type Color
Change-Id: I0e25c8950ac26b851ff42f71e1471fcbe4770d48
Reviewed-on: https://gerrit.libreoffice.org/50373
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-02-28 07:34:27 +01:00
Caolán McNamara 0169227035 forcepoint #10 pop empty stack
Change-Id: I96452a86187a6b03251614625445d1b18a5ee218
Reviewed-on: https://gerrit.libreoffice.org/50357
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-02-26 18:33:28 +01:00
Miklos Vajna 5e1a50cc43 tdf#115883 DOCX import: catch RuntimeException from SwXFrame
getPropertyValue("Surround") for a non-inserted frame can throw, but
hasPropertyValue("Surround") still returns true. So fix the regression
by just catching the exception, assuming that in that case no increased
spacing is needed.

Change-Id: I49a78ce8d41b4e1cc7d23721d5dc70f7550c94af
Reviewed-on: https://gerrit.libreoffice.org/50175
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-02-23 09:06:16 +01:00
Miklos Vajna a16275a364 tdf#112694 DOCX import: handle <w:titlePg> when turning on follow style header
Commit 17e51f427b (DOCX import: first page
header should always set default headers as well, 2014-11-21) turned on
header/footer of follow page styles of first page styles when the first
page style had the header/footer turned on, but failed to consider if
<w:titlePg> is present or not. When it's not present, the first page
header/footer should be ignored.

An additional problem is that by the time
DomainMapper_Impl::PushPageHeaderFooter() is called, <w:titlePg> is not
parsed yet, so we can't act accordingly.

Fix the problem by moving the check to
SectionPropertyMap::PrepareHeaderFooterProperties(), which runs at the
end of the section properties, where all required info is available,
there we can just check for m_bTitlePage.

This allows reverting the two changes to existing testcases in
CppunitTest_sw_ooxmlexport6 from the original commit as a side-effect.

Change-Id: Ic628adab99a4b148fcfd66ca39d0cf81eb7dd9f1
Reviewed-on: https://gerrit.libreoffice.org/50014
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
2018-02-20 08:11:57 +01:00
Miklos Vajna 8b73bafbc1 tdf#115719 DOCX import: increase paragraph spacing for anchored objects
... like Word 2013 does, when the version string indicates that the new
layout is wanted.

An alternative to this change would be to add a new sw layout
compatibility flag and handle this at a layout level (somewhere in
SwAnchoredObject::GetObjRectWithSpaces()). The downside of that approach
is that once a layout flag is added, it's not preferred to tweak its
behavior, while doing the same at import time is not a problem.

Also it's better to have a flag for something which has clear behavior
in some spec / implementer notes, which is not the case for this
problem. (I've mailed dochelp@microsoft, no answer so far.)

Change-Id: Ibad28d27e4bcbe1991a3be1c686064e18e9ffa4d
Reviewed-on: https://gerrit.libreoffice.org/49733
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
2018-02-14 20:21:57 +01:00
Miklos Vajna f737c9386a tdf#113258 DOCX import: fix beforeAutospacing for shape first paragraph
Commit c761df1e42 (tdf#84678 DOCX import:
fix handling of textbox margins, 2016-10-25) uncovered a previously
harder to notice problem that single-paragraph shapes have an incorrect
upper paragraph margin for the first paragraph. Now that the shape
margins are correct this problematic paragraph margin causes crop of the
shape text.

Fix the problem by adapting the DOCX import to the WW8 import's
SwWW8ImplReader::AppendTextNode() (the "If this is the first paragraph
in the document" part), where it seems the first paragraph is not only
the literally first paragraph in the document, but also the first
paragraph of shapes as well.

Change-Id: I9d99b9cfabae2c9a7c33eefefb5a9f008669e93d
Reviewed-on: https://gerrit.libreoffice.org/49617
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
2018-02-13 09:58:09 +01:00
Jochen Nitschke 4f759834d3 cppcheck useInitializationList
unique_ptr don't need explicit nullptr initialization, same
goes for VclPtr in ImpEditEngine.

Change-Id: Id8f3163c2719bee6ee2724cae98449d564be5535
Reviewed-on: https://gerrit.libreoffice.org/49559
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-02-12 08:03:12 +01:00
Mark Hung 275a60e17d writerfilter / ww8filter: enhancement to support new ruby position.
1. Allow ooxml / rtf import the ruby aligned on the right side
( rightVertical or jc=5 ) as css::text::RubyPosition::INTER_CHARACTER.

2. Allow rtf / ww8 export of css::text::RubyPosition::INTER_CHARACTER
as  jc=5.

Though rtf filter can save and load the new ruby position,
character format seems lost. The reset of the MSO formats have
other issues that they can't make roundtrip yet.

Change-Id: Idb77423842f43abc375a1282a52b0bc6f20049e4
Reviewed-on: https://gerrit.libreoffice.org/49177
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mark Hung <marklh9@gmail.com>
2018-02-10 10:16:31 +01:00
Caolán McNamara 469430a7d3 rtf: null-deref
Change-Id: I9c4510cb91e2572a3ab2b62497dc4dd9fd1119c8
Reviewed-on: https://gerrit.libreoffice.org/49319
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-02-07 10:25:03 +01:00
Mike Kaganski 76d6fcd05c tdf#114217: Consider relative width when importing floating table
Unit test included

Change-Id: I8e3338d7df431bd016caa4e06e684fbd189127c4
Reviewed-on: https://gerrit.libreoffice.org/49324
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-02-07 07:23:57 +01:00
Miklos Vajna 03cee02464 tdf#115242 RTF import: order numPr before other paragraph properties
So that paragraph properties inherited from numbering properties can be
properly overwritten with direct formatting, even when we have to take
style deduplication into account.

The OOXML tokenizer already did this,
writerfilter::dmapper::DomainMapper::sprmWithProps()'s
NS_ooxml::LN_CT_NumPr_numId depends on this, so adapt the RTF tokenizer
accordingly.

Change-Id: Iec6026d146f08a9d06266763d01ed626a2d1f3d1
Reviewed-on: https://gerrit.libreoffice.org/49247
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
2018-02-06 10:53:37 +01:00
Miklos Vajna a6f2199e98 DOCX import: don't try to set grab-gag props as UNO props
This fixes loads of warnings like this one:

warn:legacy.osl:22335:22335:writerfilter/source/dmapper/StyleSheetTable.cxx:1611: Exception in StyleSheetTable::getOrCreateCharStyle - Style::setPropertyValue

during import. They are harmless as we catch the exception, but they are
just noise. It seems the code that transforms grab-bag pseudo-props into
real props was added in commit 4c3ba3a413
(fdo#75757: Remove inheritance from std::map., 2014-07-26), which is
supposed to be a pure refactoring, so just remove this problematic
transformation.

Change-Id: Ibf45bfedc661f9e065405c47623516c4026148a4
Reviewed-on: https://gerrit.libreoffice.org/49105
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
2018-02-02 09:04:02 +01:00
Serge Krot deaa16bd24 tdf#72942 Do not overwrite styles from the inserted doc
During inserting of the text from the external document
we should not change original default styles in
currently opened document.

Added unit test.

Change-Id: Ida754a0da5efaaa043464cd807c0b52cfb0d5670
Reviewed-on: https://gerrit.libreoffice.org/48826
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2018-01-31 01:30:39 +01:00
Miklos Vajna 7655001a65 tdf#115155 RTF import: fix left indent handling inside list definition
This used to work in the past only because the left indent was also
imported as a direct paragraph formatting, but that is not the case
since left margin of lists is deduplicated during import after commit
c9dee880d8 (tdf#104016 RTF import:
deduplicate before text indent from numbering, 2017-12-05).

Change-Id: I1c9be30700c51ef97fb274e8781d6008db3121d8
Reviewed-on: https://gerrit.libreoffice.org/48855
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-01-30 09:06:25 +01:00
Miklos Vajna 4bdbb5502f DOCX import: handle horizontal flip of bitmaps
Horizontal mirror on the UNO API level, mirror on the vertical axis
internally.

Change-Id: If142274a8f81a6875059a2651af6d8470870a36a
Reviewed-on: https://gerrit.libreoffice.org/48843
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
2018-01-29 21:51:51 +01:00
Andrea Gelmini c101df2171 Fix typos
Change-Id: Iedd82d035454c940d76a94c7e910c81827c1389c
Reviewed-on: https://gerrit.libreoffice.org/48828
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2018-01-29 13:26:15 +01:00
Justin Luth 99d08aa87b writerfilter: FindStyleSheetBy... remove StyleName option
It is confusing having three undocumented Find functions.
Reduce by one - either search on the imported WW8 (ISTD) name
or on the internal (converted) name.

The one remaining use of ByStyleName was testing against an
already set property, so by definition it was set using
convertedStyleName.  (Plus, that was my code anyway...)

Change-Id: If5a352bedb7d297698f449fbb629a1350e27c51c
Reviewed-on: https://gerrit.libreoffice.org/48037
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Justin Luth <justin_luth@sil.org>
2018-01-27 13:53:09 +01:00
Justin Luth cc1c9c7484 tdf#95377 ooxmlimport: treat default style like named styles
The default style was missing out on all of the fixes made
by LN_CT_PPrBase_pStyle. That included right margins, and
numbering styles.

Essentially, this change is just copy and paste from one function
to another. I tried to make all of the logic changes
separately in previous commits. So the adjustments here are simply
to accommodate different variable/function names. So if this
causes any regressions, it ought to just be related to either
applying later on (at finishparagraph instead of
LN_CT_PPrBase_pStyle or because it includes the default style.

One important note regards the preparatory
commit 254c80037a.
If this commit is reverted, make sure to check that commit
to add a conditional wrappers around GetCurrentNumberingRules().

Change-Id: I9827b2cd1a74a13cf18ada9baa221c5c567a7391
Reviewed-on: https://gerrit.libreoffice.org/48458
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Justin Luth <justin_luth@sil.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-01-26 12:41:18 +01:00
Justin Luth 8fd13c356d ooxmlimport: support inherited listid
This is prep work for tdf#95377. This unit test avoids the unique
chapter-numbering style (from the heading paragraph styles) and just
has a basic, user-created style inheriting from Default.

Also unique about this unit test is that the numbering is
specified by the "Default Style" which takes a rather unique
code path and exposes even more problems.

We already know the listId through a recursive function, and
GetCurrentNumberingRules only looks at the current style which
isn't good enough. Moved that modified function into
DomainMapper_Impl since I will need it there for bug 95377.

Additionally, ensure that directly applied paragraph properties
are not overwritten. That also meant changing the order, so that
paraStyle properties are directly applied to the paragraph before
applying RightMargin and friends.

Change-Id: I5c1fb71d64727be9d9105f287150daf4e0ff413d
Reviewed-on: https://gerrit.libreoffice.org/48457
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Justin Luth <justin_luth@sil.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-01-25 13:39:17 +01:00
Patrick Jaap 82dcf01515 Add SAL_WARN in writerfilter graphic import
Change-Id: Iac6265094572c57f421b0533db2c90a41b2ef427
Reviewed-on: https://gerrit.libreoffice.org/48492
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2018-01-25 09:05:29 +01:00
Justin Luth 9dfd46ef4b writerfilter: use WW8 name for StyleId
The sStyleIdentifierD for the default style is "Normal".
FindStyleSheetByISTD uses sStyleIndentifierD for its comparison.
SetCurrentParaStyleId() is used to save the WW8 provided name.
Thus, the default style should do the same.

The SetCurrentParaStyleId was added here by
commit 4abb20ee16
Author: Miklos Vajna
Date:   Tue Jun 19 17:36:28 2012 +0200

Also removing the static variable, since it serves no purpose.

Change-Id: I58659e9d809c32dd799fb46217971707991b2803
Reviewed-on: https://gerrit.libreoffice.org/48034
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-01-24 11:31:38 +01:00
Patrick Jaap ff8826d438 tdf#113946 add 'topMargin' to GraphicHelpers import
The case '...topMargin' was not caught for setting a relative
vertical position in GraphicHelpers. The test file demands a '7' here,
which stands for 'PAGE_FRAME'. The '7' was overwritten in GraphicImport in case
'LN_CT_Anchor_positionV' by a call of 'resolve'.

For a better overview a switch is inserted here.

Change-Id: Ie98209fe445ecbba15c3dafe5980ca52421126f8
Reviewed-on: https://gerrit.libreoffice.org/47905
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2018-01-21 22:57:54 +01:00
Justin Luth 254c80037a writerfilter: move TopContextType==Para requirement
This is prep work for tdf#95377. I need this function to
run when there is no TopContext. This function doesn't do anything
with the context, so in that regard I wonder if it is even
necessary? My guess would be that it is a leftover piece from
discovering the fix for n75883.

However, to avoid causing a regression, I'm just pulling this test
into the calling functions. (Of the three instances
calling this function, two need to be contextless..)

This is not truly NFC because if the followup patch is reverted,
then this one will cause a change. But that is actually OK, because
if my follow-up patch breaks because of these two functions changing
to become contextless, then I'll be better able to pin-point the
reason for the regression.

Original commit adding this function was
commit 2123ede032

Change-Id: I471aa852aa48527d69e0343a2ac28fa6e8acb209
Reviewed-on: https://gerrit.libreoffice.org/48062
Reviewed-by: Justin Luth <justin_luth@sil.org>
Tested-by: Justin Luth <justin_luth@sil.org>
2018-01-19 17:11:54 +01:00
Noel Grandin be94207ecb new loplugin:emptyif
Change-Id: I1092115a0ceb3a5e6680a4b724b129f98a892c42
Reviewed-on: https://gerrit.libreoffice.org/48128
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-19 13:25:54 +01:00
Justin Luth ee2750f3a5 writerfilter: remove unused sStyleName1
Both sStyleName and sStyleName1 were part of the original
fork from the OOo project. I'm
not sure if/how it was ever used, but sStyleName1 is unused now.

Change-Id: I71b54645aa0615101529aa4d5008973f740da1f0
Reviewed-on: https://gerrit.libreoffice.org/48036
Reviewed-by: Justin Luth <justin_luth@sil.org>
Tested-by: Justin Luth <justin_luth@sil.org>
2018-01-17 18:01:55 +01:00
Justin Luth ae094e7703 NFC writerfilter: remove redundant sStyleIdentifierI
Originally, StyleIdentiferI was the string name, and
StyleIdentifierD was an integer. That changed a long
time ago.

Both identifiers are only assigned a value once, and
both are given identical values at the same time.
Thus, one is completely redundant and is being removed.

Change-Id: Ia7e9bbeec53110fa8e56cdfb13b9871486f335fa
Reviewed-on: https://gerrit.libreoffice.org/48035
Reviewed-by: Justin Luth <justin_luth@sil.org>
Tested-by: Justin Luth <justin_luth@sil.org>
2018-01-17 17:58:31 +01:00
Andrea Gelmini c66fe94d3e Fix typos
Change-Id: I5fff9ccb1bc74b85ee378439ffa2272583ffcb0f
Reviewed-on: https://gerrit.libreoffice.org/48024
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
2018-01-17 12:06:11 +01:00
Andrea Gelmini eae9bf0d25 Fix typos
Change-Id: Id3d1a07922d4ca05e3bbf61d4b5797a30fc5b23a
Reviewed-on: https://gerrit.libreoffice.org/47872
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2018-01-16 14:28:07 +01:00
Justin Luth 7201d157a2 tdf#76817 ooxmlimport: connect Heading to existing numbers
This fixes the inability to insert a numbered Heading into
an existing sequence in an opened document. Before it would
start a new sequence, but now it connects to / adjusts
the other numbered Headings.

LibreOffice has built-in handling for "Chapter Numbering".
All of the formatting for this is tied to the paragraph stylename.

Since MSO has a different structure, in docx format these
are defined as "regular" styles with an OutlineLvl component.
During import, that style information was copied to LO's special
Outline chapter numbering style. *From this point on, the
"regular" list style should no longer be referred to.* Numbering is only
defined by the paragraph stylename (which by definition is "Heading X").

The unit test I am hijacking has an unchangeable Paragraph Numbering
style of "Outline Numbering" and not WWNumX. So, in reality the
document ought to require the style name to be the internal Outline
style like it originally was.
A followup patch allows this to round-trip.

Change-Id: If5d544529fa32d4abaa2b46403bc61c028e53f21
Reviewed-on: https://gerrit.libreoffice.org/47827
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Justin Luth <justin_luth@sil.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-01-15 13:57:29 +01:00
Stephan Bergmann 0ffaf416ba More loplugin:cstylecast: writerfilter
Change-Id: I06ab6063a4d349859851065b96442564598f9d14
2018-01-15 09:01:08 +01:00
Justin Luth 60c84cd52b remove unused include XChapterNumberingSupplier.hpp
The code moved to NumberingManager.cxx I believe.

Change-Id: I6f21e913e8fa52ffd47a3004137e7b5043421613
Reviewed-on: https://gerrit.libreoffice.org/47826
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Justin Luth <justin_luth@sil.org>
2018-01-13 05:03:35 +01:00