Added a new export only macro - this can be used to create tests
which import a document (in any format), and export it in a format
that is being tested. The exported document isn't loaded again, but
it must be asserted using xpath. The primary usage of this is to
test the HTML export.
Change-Id: I1ad300f6274a2181f7f29fed3903b99b68f37fd9
- ModelToViewHelper: add new flag REPLACEMODE, which causes fields and
footnotes to be replaced with ZWSP instead of expanding them
- SwXFlatParagraph: add FootnotePositions and FieldPositions properties
- GrammarCheckingIterator: invoke XProofreader::doProofreading with
properties FootnotePositions and FieldPositions
Change-Id: I9b66a37aac94f940546e812d8b85a35aebd8181a
Z-Index was not handledin LO for vml.
I have made the changes to handle that using aGrabBag.
Change-Id: I2af3b2974c8eb699bc6a7b743dc438584d6517ac
Reviewed-on: https://gerrit.libreoffice.org/8833
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
This scenario is not a valid one, Word doesn't handle it, either -- but
the old LO 3.4 parser did. So add minimal support for it to avoid
the regression.
Change-Id: Icc2e8d3bf314e9cadda57956668033aa6d092457
Issue:Only one AlternateContent is getting written in the RT file irrespective of
the number of TextBoxes in the original file which is causing the issue.
RootCause is found in DocxAttributeOutput::OutputFlyFrame_Impl where under case
sw::Frame::eTxtBox,m_aFramesOfParagraph.push_back(sw::Frame(rFrame)); is getting executed only once.
push_back should happen as many number of times as there are TextBoxes in the original file.
if(rFrame.GetFrmFmt().GetName() == m_aFramesOfParagraph[nIndex].GetFrmFmt().GetName())
bDuplicate = true;
In the above check both the GetName() are returning values as empty which leads to
bDuplicate equals TRUE and hence push_back does not happen.
I have introduced one more check to handle this.
Also changes are made in for loop to make it more efficient.
Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Reviewed on:
https://gerrit.libreoffice.org/8782
Change-Id: I397aa3c4548cb57e8dacbf3fbf9ebaf87c0daa80
Commit bbe3627eece0c3486e7ea11f2f13377aaa3a8fed (rtftok: stop sending
sprm:CRgFtc{0,1,2} tokens, 2014-03-05) dropped support for case when a
font name is used in multiple entries in the font table, but with
different encodings.
Turns out that this is a valid use-case, so revert back to the old
behavior where the key of the encoding table is the font index, not the
font name.
Change-Id: I048dff58af801d704fd4bc75a6a4dcb0f03bf185
Some table properties can be defined by the table style but cells can
overwrite them in their cell properties section. Our exporter was
writing all the cell properties in all cases, regardless of them
being defined by the theme or not, and we shouldn't do that if we
want the document to work properly in Word.
To fix the issue I store the style-defined cell properties (the
format of all four borders) in the table grab bag. The exporter
recovers them and compares with the cell properties before writing
them; if the cell property matches the stlye-defined one, we don't
write it to the document.
An existing unit test was slightly modified to check that the actual
cell properties are not being skipped.
Change-Id: I3aa12d76fb8f73d3fd300f254d19e1683fb6146c
Word supports formatting the paragraph parker itself, and we import that
as a formatting at a position after the last character (e.g. "foo" will
have that formatting at char pos 3, which is ignored by the layout).
In addition to this hack, commit
1c22545edf9085b9f2656ca92781158b6b123db3 (Fix issue #i119405: Numbering
text style changed after importing the *.doc, 2012-08-24) added a
SwTxtNode::TryCharSetExpandToNum() hack to Writer core, where in case
such a paragraph marker attribute is set, and the SwTxtNode has a
numbering, then also modify the associated character style as well.
As that commit already noticed, there are attributes which should not be
propagated to that character style. Extend this blacklist to ignore
RES_CHRATR_BACKGROUND as well, as Word does.
Change-Id: Idcb40d37d8688c76fbd61f28428f6e3bc995f799
The brush color contains both the color itself and transparency as well.
In case of DocxAttributeOutput::FormatBackground(), the sColor should
contain the color part, and oAlpha the transparency part.
In case of drawingML export of Writer TextFrames, an automatic color
(0xFFFFFFF) shouldn't be recognized as "auto", as that's invalid:
instead an explicit 0xFFFFFF with zero transparency should be written.
Fix the problem by calling msfilter::util::ConvertColor() for the RGB
color only.
Change-Id: I2132375a4dbcac1667aed49c74e581183178b0cc
Issue :
Numbered list without suffix does not get preserved after
Roudtrip.
Description :
- For level zero LO was writing w:lvlText with epmty value.
- This was because in DocxAttributeOutput::NumberingLevel()
check was based on empty NumberingString.
- But for "deciaml" also rNumberingString appears to be empty
for level-0
Implementation :
- Added check to write empty value for w:lvlText only if
NumberingType is "bullet" with level-0.
- This will not write empty w:lvlText with level-0 and
NumberingType as "decimal".
Reviewed on:
https://gerrit.libreoffice.org/8768
Change-Id: Ic6ece45e0122da05013beac93a6e11fac926514d
Table style is a property that defines a set of background and line
attributes for cells. These attributes depend on theme settings (e.g.
theme colors).
We added a grabbag to the table object to save the table style name.
We detect that name on export and write it back to the document.
Finally, modified an existing unit test to check this attribute too.
TODO: To get the table style working properly after a roundtrip, we
must preserve it and also check that its values are not being
overwritten by different cell or table properties.
Change-Id: Id0e022a389561960c21ab874db33649499735024
When some background color is set to a table cell, it is stored in the
cell properties tag <tcPr> like this:
<w:shd w:fill="ECD2B6" w:color="auto"
w:themeFill="accent6" w:themeFillTint="66" w:val="clear"/>
The theme-related attributes in w:shd were not being preserved. To
fix this I added an InteropGrabBag to the cell properties object,
which is filled with the attributes of w:shd to be checked on export.
The exporter checks if the cell color is still the original color that
was imported from the file, if it is not it means the user has
manually changed it during the edition and the new color is written
instead.
Finally, added a unit test for theme attributes on tables.
Change-Id: Ica8091b5eb4075e51912a255650a1d9d64f5767a
In the test file Table Grid had only one value for entire table width
while there are two cells in a table row. So the table was not
imported with the correct Column Separators.
Added fix to calculate column seperators from cell widths if
unable to calculate from Table Grid, and all the cells have individual cell widths and
there are no after and before cells.
Change-Id: I466737437a18d3373e75fea5ad56c9e31eb149ec
Reviewed-on: https://gerrit.libreoffice.org/8767
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
It appears that the C++ standard allows overriding destructors to be marked
"override," but at least some MSVC versions complain about it, so at least make
sure such destructors are explicitly marked "virtual."
Change-Id: I0e1cafa7584fd16ebdce61f569eae2373a71b0a1
The problem was that for the CharDiffHeight UNO property,
SvxFontHeightItem::QueryValue() put a float to the returned uno::Any.
When we noticed that it's not sal_Int16, we tried to read that into a
sal_Int32 (which failed), and then wrote back the result to the
uno::Any, that's how the result value was 0.
Fix this by checking if reading the uno::Any into a sal_Int32 succeeds.
Change-Id: Ie2269a24fe82ae241940811e7a2f5deaf9f1aeb0
In the past in case FillStyle was set, BackColor wasn't ignored, now it
is, since 6e61ecd09679a66060f932835622821d39e92f01 (Merge back branch
alg_writerframes to trunk, 2014-03-19).
The intention there was that in case FillStyle is set, FillColor will be
used: so to keep both new users and old filters happy, just restore
handling of BackColor in case FillStyle is set, but not FillColor.
Change-Id: Ie034a959e72e48b617cf598af8f7afd030bb50c4
Now that fill attributes are available in the item set of the shared
exporter, just had to adjust the WhichId of fill style / gradient fill,
and it's working again.
Change-Id: Iec7048ef77aea534a567799bfd385fcc029586b3
Fill attributes with their original WhichId are only used for frames at
the moment, replacing RES_BACKGROUND. To keep export filters working,
handle those fill attributes as frame ones as well.
Change-Id: I1e59b483b706d9fd3f9b947e83244740e3293f9e
Commit 6e61ecd09679a66060f932835622821d39e92f01 (Merge back branch
alg_writerframes to trunk, 2014-03-19) changed the sw UNO API, so that
in case SvxBrushItem / RES_BACKGROUND was to be get/set, it mapped that
to svx's fill style.
This has two problems: 1) it does not work (see the failing unit test)
and also page style editing UI sets SvxBrushItem, so even if the UI is
used to (actually successfully) set the page background, it won't be
saved to ODF.
So, do this background <-> fill style mapping only for frames for now.
Change-Id: I734880a40c891ae9e341cbddf8f88b0462361aac
but continue to expand fields. No change to anything yet, but
should allow this to be reused in SwTxtNode::GetExpandText
Change-Id: I4dbfc454d498fc85a918b0e43e68c219cbc37a21
...mostly done with a rewriting Clang plugin, with just some manual tweaking
necessary to fix poor macro usage.
Change-Id: Ie656f9d653fc716f72ac175925272696d509038f
This test exercises the import component of commit
ad51d4952dc30e0d1cdcc6037556cd7c66a61542 which adds support for full
colour borders in .doc import/export.
Also this test showed that page border import was not actually covered
by ad51d4952dc30e0d1cdcc6037556cd7c66a61542, so that omission is fixed
here.
Change-Id: I6272e9b22415b5af012145e99360c5765d5aec60
Reviewed-on: https://gerrit.libreoffice.org/8759
Tested-by: Michael Stahl <mstahl@redhat.com>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
It appears that this was just a workaround that incidentally worked.
Making the negative value even larger (in abs value) doesn't seem to make
a difference for MSO, but LO fails again. A proper fix (better workaround?)
will follow.
This reverts commit 76aa23c59b4c81ea7b9d974a1a0a9e39c6bf8741.
Reading the spec, it seems that we have two cases here:
- if lKeyProtDoc is set and fProtEnabled is 1, then editing forms is
allowed
- if lKeyProtDoc is set, but fProtEnabled is 0, then the document is
totally read-only
So in the first case avoid the SetModifyPasswordHash() call to allow
form field editing.
Change-Id: Id0c48e8eb4bde75c5520a7b108fcfada51148faf
The BRC (BoRder Control) structure used in .doc files to specify border
properties has undergone several revisions over time. LibreOffice
supports the WW6 and WW8 (Word '97) BRC versions, which allow the border
colour to be selected from a palette of only 16 colours.
This changeset adds support for the WW9 (Word 2000) BRC version, along
with some new SPRMs (Single PRoperty Modifiers) which use it, so that
border colours are preserved accurately in .doc import/export.
This change covers:
- page borders
- paragraph borders
- borders around a sequence of characters
- table / table cell borders (import only)
Further work is required to extend coverage to borders of pictures and
export of borders in tables.
The LO code was using the same class WW8_BRC to store the bits for either
the WW6 or WW8 BRC. This becomes a bit unmanagable when adding a third
BRC version, so I have split this into a separate class for each version.
Fixes fdo#68475, fdo#50185
Change-Id: I7ebc15236497cbab9312d8659fe7ed0bee2c59ed
Reviewed-on: https://gerrit.libreoffice.org/8646
Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
These controls don't have a special property, like for example
unformatted text controls have. So we use the id property as a
marker; we will grab-bag it together with other sdt properties and
use the existing mechanism to write the sdt block on export.
A grab bag that only contains an id property is for sure a rich text
control so we add it to the character props and not to the paragraph
props, like in the case of the unformatted text control.
Word doesn't allow us to write an empty <w:id/> tag, so we fill
it with a random number.
Finally, modified an existing unit test to add a rich text control and
check it is exported correctly.
Change-Id: If403a4a2393d4ee069a628645e364d21f104a859
Used the same algorithm that we had for VML to update the position of
the DML anchor taking into account the rotation of the shape.
Complemented the unit test to check the values in the generated DML.
Change-Id: Ie0293c3cf4d1309fad58c0387f1589e69071fd9a
Field inside a hyperlink closed after the ending tag of hyperlink, which corrupted the RT file.
Reviewed on:
https://gerrit.libreoffice.org/8688
Change-Id: Ie6fb5eff19c941819ca8c6193b3a6471de12c3e6
The document contains an empty table with borders.
LO was treating this table as a nested table, which lead to
a TC tag mismatch.
In docxattributeoutput.cxx, inside 'switchHeaderFooter'
added a check against 'm_oldTableReference->m_pOldTablepInner'
For some documents, even if the above value was null, still
it was getting assigned to 'm_tableReference' . Thus in such situations
it leads to a crash.
Change-Id: I883267585cb804f961989797de57c4b843b96821
Reviewed-on: https://gerrit.libreoffice.org/8677
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Re-enable the unit test with the fixed xPath expression.
This reverts commit 0e5f9958a57a68a3707db5b1eb9f82e0326327c1.
Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Change-Id: Ibc848b2ae89b3fb7f009cd984d0ecc5fc165673a
Reviewed-on: https://gerrit.libreoffice.org/8679
Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>