1217 Commits

Author SHA1 Message Date
Miklos Vajna
32d6d27eb6 CppunitTest_sw_ooxmlexport: port testPageRelSize to textboxes
Change-Id: I08e112b3816797a848ae9d16fa7002a67c12fc3d
2014-06-12 09:39:03 +02:00
Kohei Yoshida
61ad374e72 This assumption doesn't hold on all build environments.
Change-Id: Ie1f56aed91e7cbfc59e254a111991f958e9a1607
2014-06-11 15:37:48 -04:00
Miklos Vajna
a5658d3f89 CppunitTest_sw_ooxmlexport: port testTextBoxPictureFill to textboxes
Change-Id: I304c7d7157c4167e7fe33af259e732865900d4ca
2014-06-11 19:15:09 +02:00
Miklos Vajna
e9261e8b41 DOCX drawingML filter: handle TextAutoGrowHeight for shapes having textboxes
Change-Id: I0cdc7edf851915f7fbc772eb42edd6ec08b09025
2014-06-11 19:03:34 +02:00
Miklos Vajna
4d120b6ab1 DOCX import: fix additional empty paragraphs around footnote text
Regression from commit abe1e852a232e3bdab7b9177d099fe3929f5a4aa (handle
properly page breaks even if a page contains only a frame (fdo#55381),
2014-04-21), DomainMapper::lcl_endSectionGroup() inserted an empty
paragraph before and after the real footnote text. Disable addition of
the dummy paragraph for footnotes.

Change-Id: I6e1954c9bd5520ac284d66244ce1c9004e970305
2014-06-11 13:35:10 +02:00
Tushar Bende
e1d80c0d70 fdo#79668 :File getting corrupt after RT
Problem Description : For some documents containing redLine data there was already processing done for paragraph properties pPr
but when it comes to DocxAttributeOutput::EndParagraphProperties() instead of writing these pPr, LO was calling Redline( pRedlineData )
which has it's pPr inside w:pPrChange.
This was the reason when LO calls WriteCollectedParagraphProperties() after calling Redline() it was writing both paragraph properties
inside single w:shd element.Hence the RT document was getting Corrupt.

Added condition in DocxAttributeOutput::EndParagraphProperties() which is checking for RedlineData and if it's there call
WriteCollectedParagraphProperties() before calling Redline().

Added Export Test case.

Change-Id: I7000c27fe6ee372cac81d6f22e0d3ca9219a24d7
Reviewed-on: https://gerrit.libreoffice.org/9712
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2014-06-11 09:30:45 +00:00
Rohit Deshmukh
88f84eb1b0 fdo#79817:Fix for corruption having databinding have duplicates attributes
File contains SDT content, in which after export databinding have duplicate attribute.

Conflicts:
	sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Reviewed on:
	https://gerrit.libreoffice.org/9693

Change-Id: Ibe828964c054bdd5a63b5c0c903bc7441d953d72
2014-06-11 10:29:49 +02:00
Pallavi Jadhav
69ba8e94e3 fdo#79540 : DOCX: Lo exports Drawing inside Drawing
Issue :
	- In file there is a WordArt inside Table.
	- In RT, LO exports <w:drawing> inside <w:drawing>.
	- The xml sequence was :
  	  <mc:AltrnateContent>
            <mc:Choice>
              <w:drawing>                // first start of drawing
                <w:txbxContent>
                  <w:tbl>
                    <w:drawing>   // second start of drawing. MSO does not allow.

	Implementation :
	- In DocxAttributeOutput::OutputFlyFrame_Impl() under "case sw::Frame::eDrawing",
	  if drawing is already open then Postpone the Inner Drawing.
	- Added Export Unit Test case to check two separate drawings are
          now written in document.xml of RT.

Change-Id: I01d06621576d60d26cd51489ee9718dd79eb9c72
Reviewed-on: https://gerrit.libreoffice.org/9653
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2014-06-11 08:21:47 +00:00
Adam Co
2211a67cc5 Rewrite import and export of custom dashes in ooxml filter (fix)
The import mechanism of custom-dash (a:custDash) was wrong, and imported
wrong values, which causes that if you would import-export-import-export -
you would get inflated values, which might cause a corruption.

The attributes for custom-dash nodes (a:ds) are of type 'PositivePercentage'.
Office will read percentages formatted with a trailing percent sign or
formatted as 1000th of a percent without a trailing percent sign, but only
write percentages as 1000th's of a percent without a trailing percent sign.

During import - LO did not check if it was in '%' format or in
'1000th of a percent' format. So that was fixed. Also - when exporting -
it always exports now in '1000th of a percent' format.

Change-Id: I6bd74df26951974f85173227c832386c70034afb
Reviewed-on: https://gerrit.libreoffice.org/9681
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2014-06-10 17:22:40 +00:00
Miklos Vajna
75ebb553bf CppunitTest_sw_ooxmlexport: port testTextBoxGradientAngle to textboxes
Change-Id: Id17c7d4cf9c9bcb81d0da486c9bce44abb04b6cd
2014-06-10 19:07:24 +02:00
Miklos Vajna
ab4279d7f2 CppunitTest_sw_ooxmlexport: port testTableFloating to textboxes
Change-Id: Ie20e0ca939139c952f3524c7dae494e24bc7cab7
2014-06-10 18:34:54 +02:00
Miklos Vajna
13f7b89c2c CppunitTest_sw_ooxmlexport: port testFdo60990 to textboxes
Change-Id: I5871ca0c3eea931e2144d7a469844cf3a69d0038
2014-06-10 18:34:54 +02:00
Miklos Vajna
2b076a0d91 DOCX drawingML export of textboxes: write <wps:bodyPr> in oox
It's possible to write this tag in oox (so it represents the properties
of the shape) or in sw (so it represents the properties of the shape's
textbox). Do the previous, as the textbox is really just a container in
this use case, nothing more.

If we are at it, also fix the default value of <wps:bodyPr>'s l/r/t/bIns
attributes.

Change-Id: I0571b9d8ea7dc0acd5c61f3e28e18400d305eab3
2014-06-10 17:46:55 +02:00
Miklos Vajna
147d3f61c4 CppunitTest_sw_ooxmlexport: port testTextFrameBorders to textboxes
Change-Id: Idf837c1eecc3a5e0d6c82126685e4720e78b4481
2014-06-10 17:09:09 +02:00
PriyankaGaikwad
1785509235 fdo#79822 : Crash:LO Crashes while Saving the DOCX containing smartart
Decription :
- Docx file contain smartart and it was created in MS word 2007.
- MS word 2007 does not create any drawing.xml for smartart
- So in DocxSdrExport::writeDiagram() diagramDrawing was not set in this case.
- File crashing at diagramDrawing[0] >>= drawingDom as diagramDrawing is empty.

Change-Id: I6bc38e702f731ad8074b562572fd50f2e29a41b7
Reviewed-on: https://gerrit.libreoffice.org/9706
Tested-by: Michael Stahl <mstahl@redhat.com>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
2014-06-10 12:51:33 +00:00
Vinaya Mandke
e49d2b31fb fdo#78939 [DOCX] Hang while opening due to incorrect modification of Style
http://opengrok.libreoffice.org/xref/core/sw/source/core/unocore/unosett.cxx#1884
Modifies the refernced style of the numbering rule to use the current numbering rule.
Actually the refernced style is not supposed to be modified.
As the numbering level formatonly uses that properties particular style,
which may or may not be a numbering style

For this Particular document the numbering format refers the "Default Style" (Normal).
Almost all of the styles in style.xml are based on it. Normal was modified,
and as a result the whole document was bulletized; Which caused the hang while opening

Removed the addition of style as a PARA_STYLE, as the properties of the
refernced style are already added in ListLevel::AddParaProperties

Conflicts:
	sw/qa/extras/ooxmlimport/ooxmlimport.cxx

Reviewed on:
	https://gerrit.libreoffice.org/9668

Change-Id: I8cc143805a38613908d2e2cb4827882d4cf40a78
2014-06-10 09:57:45 +02:00
Miklos Vajna
81b2b92907 testcase for e6300f83d08fd959596551dcd660eb0fbfb248a6
Change-Id: Ia43c14665e6d1684d840da3516f69e951026c293
2014-06-08 12:44:56 +02:00
Caolán McNamara
cae83eb8b6 commit id with ccc in it breaks regression test
Change-Id: I1a222fdd5e837a4d0071f8b4d03b80c1d104f235
2014-06-06 21:28:29 +01:00
Miklos Vajna
8ab695374e CppunitTest_sw_ooxmlexport: port testFdo58577 to textboxes
Change-Id: Ic309c7f2a3df46a4813646902a595408f4751fcd
2014-06-06 17:58:56 +02:00
Miklos Vajna
016e1f8889 CppunitTest_sw_ooxmlexport: port testFdo66688 to textboxes
Change-Id: Iada46e037844b010959b153b5e895fd2be021d68
2014-06-06 17:31:25 +02:00
Miklos Vajna
28e9b5bc01 oox: support non-TextFrame shapes in WpsContext::onCreateContext
Change-Id: I692fa22132cd3a722b58de22e3dbb759ff888e5d
2014-06-06 17:15:17 +02:00
Miklos Vajna
735cd34078 CppunitTest_sw_ooxmlexport: port testTextFrameBorders to textboxes
Change-Id: I4d7a6a13a721282450a1c217defb84f386535a74
2014-06-06 15:40:21 +02:00
Miklos Vajna
020035a0e0 CppunitTest_sw_ooxmlexport: port testTextFrames to textboxes
Change-Id: Id52ab22e2981ebda3960acabe473fadfafc67e72
2014-06-06 15:40:20 +02:00
Jacobo Aragunde Pérez
1534c33633 fdo#79558: Do not overwrite w:shd value
When a w:shd has some pattern with two colors, LO blends both to
render the paragraph background. We must compare that blended color
with the paragraph color on export to know if the user has edited it
or not. We were using the w:fill attribute to compare, but that was
incorrect.

Modified an existing unit test to check this behaviour. The unit test
had to be retouched because Word remove some redundant information
from the original .docx file when I saved it again with some
background changes.

Change-Id: Ia2f1ddc4afd2637e1d87b6eccd441c26853045c4
2014-06-06 13:56:55 +02:00
Caolán McNamara
ff38a90357 coverity#735889 Unchecked dynamic_cast
Change-Id: Ia55f575f6bfd1d90c2a517db8a76d7d22cdfd6e4
2014-06-06 11:32:55 +01:00
Dinesh Patil
80ef7a645a fdo#79256 Line Style with Long Dashes and dots is getting corrupt after RT
Description:
In RT file the dash length (d) is going out of range,
as after RT the dashing scheme changes to custom dash
which was causing the corruption. Changed code at export,
which will divide the DashLen, DotLen and Distance by
base line width.

Reviewed on:
	https://gerrit.libreoffice.org/9559

Change-Id: I0e644b5a2b692a9e717026a14d1f0058199f53b1
2014-06-06 10:23:54 +02:00
Miklos Vajna
60272bb37d CppunitTest_sw_ooxmlimport: remaining textbox porting
These are the remaining changes: with these, if we import "drawingML
shape with text in DOCX" as "shape with textbox", no testcase in this
suite fails.

Change-Id: Ic39cc204e3cfb662f14db1810f7138df0829eb27
2014-06-05 18:23:14 +02:00
Miklos Vajna
c7aed931dd CppunitTest_sw_ooxmlimport's testFdo69636: use getShape()
getShape() doesn't case if the object is on a drawinglayer one or a
Writer TextFrame, and that's exactly what we want. (Currently is a
TextFrame, but will be a drawinglayer object when shape with text will
be imported as shape with textbox.)

Change-Id: I6ae981700d214447f326e6a0fb550b98380bc10c
2014-06-05 17:30:00 +02:00
Tushar Bende
8fcd4bf323 fdo#79535 :LO writer crash while Opening some document.
Problem Description : While setting ExtraData for Redline LO calls SwRangeRedline::SetExtraData() with
argument of type SwRedlineExtraData_FormattingChanges* which contains SfxItemSet*
In function SwRedlineExtraData_FormattingChanges() without Null checking SfxItemSet*,
LO was trying to get rCpy.pSet->Count() which was the reason for segmentation fault
while opening some documents in LO.

Added Null check before accessing a pointer.

Change-Id: I33299d2be2777ab6a8af0621595c9453145f1069
Reviewed-on: https://gerrit.libreoffice.org/9647
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2014-06-05 08:29:16 +00:00
Miklos Vajna
0dca68a55a CppunitTest_sw_ooxmlimport's testMceNested: port to textboxes
Change-Id: Ie1cc83963ccd2d9d6f7833302af6cdb3078d60de
2014-06-04 15:08:36 +02:00
Miklos Vajna
c12a78e42e writerfilter: reset properties of reused styles
When we have a style to import and the name is already taken, we reuse
the style (we can't use replaceByName(), it only works with user-defined
styles). If that happens, reset non-default properties of it, so the
result will be what was in the file, not a merge of Writer defaults and
what was in the file.

Change-Id: Ifb1098f78254a061b11fd6c6d2a2fa8d85a00d60
2014-06-04 12:34:18 +02:00
Stephan Bergmann
c772e6252a testFdo52989 kept failing for my Mac build at least
<vmiklos> sberg: the comment says that it was 2, so unless you're interested in
debugging it, i would just lower the barrier (423 -> 369)

Change-Id: I0269eab4eee594c4d7aad1c710ed389443208bc4
2014-06-04 10:58:13 +02:00
Miklos Vajna
5a7e4766ca RTFDocumentImpl::dispatchValue: fix indentation
Change-Id: I521462315ebe8b69b65e05df98042e7a33d60dbb
2014-06-04 10:14:31 +02:00
PriyankaGaikwad
2df0d9d32d fdo#78907 : File crashed while saving.
- There is pagebreak in file and footer has nested table.
   - While exporting LO write section break instead of PAGE_BREAK.
   - Due to this it was writing two sections in file and same footer
     for both sections.
   - This was causing wrong table depth values due to this it was crashing
     while writing table.
   - So in MSWordExportBase::OutputSectionBreaks if next node has
     RES_BREAK(page break) then bNewPageDesc value should be false.

Change-Id: I2ccc4e48a26253716253a7280a244f06e172770a
Reviewed-on: https://gerrit.libreoffice.org/9568
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2014-06-04 08:05:00 +00:00
Michael Stahl
061190a62f fdo#79384: RTF import: fix literal Shift-JIS text
This is a variable-length encoding, and the second byte may be a RTF
syntax character like \, {, }.

Change-Id: I813ccafda18388af3bf05eb7ce9a0253c627b1c4
2014-06-03 20:48:43 +02:00
Miklos Vajna
2cbd2abf1c ODF loext:text-box import/export testcase
There is a lot more to test here, but for now just test that we can have
tables and rounded corners at the same time.

Change-Id: Ia9a4877202d1d040209f49a428b83633c58fc7c7
2014-06-03 16:15:10 +02:00
Miklos Vajna
e2b260fc98 sw: let layout not mark embedded object as modified
The problem was that right after the import, the document wasn't marked
as modified, but as layout settled, it got marked as modified.

Given that we already have code to avoid modification when updating the
replacement image, do something similar here: when setting the view
area, make sure the embedded object's component is not marked as
modified.

Change-Id: I88a42829ec48db54178553661863a571cd2a268b
2014-06-03 13:10:36 +02:00
Stephan Bergmann
f87859b88f Fix memory leaks in test code
Change-Id: Ifa756a5da636e0b37654ad83900115872bc40f0e
2014-06-02 15:45:28 +02:00
Pallavi Jadhav
ef8293485a fdo#76934 : DOCX: Preservation: AutoSpacing property not getting preserved.
Issue :
	- In styles.xml, beforeAutospacing property was set to true.
	- In code LO grab bags AustoSpacing property using "ParaInteropGrabBag".
	- But ParaInteropGrabBag had only an entry for direct paragraph properties,
	  not paragraph styles.
	- Hence while importing AustoSpacing property from styles.xml, LO was throwing exception
          as "Some style properties could not be set: Unknown property: ParaInteropGrabBag".

	Implementation :
	- Added "ParaInteropGarbBag" entry for Paragraph styles in
          sw/source/core/unocore/unomap.cxx
	- Removed code from StyleSheetTable::ApplyStyleSheets() as it was previously added to
          "Ignore" the AutoSpacing property.
	  The code was previously added beacuse due to AutpSpacing in styles.xml,
          LO was throwing an exception and this was causing unhandling of properties after AutoSpacing.
	  So to prevent unhandling of other properties due to AutoSpacing property, a check was added to
          "Ignore" AutoSpacing, thus enabling handling of properties after AutoSpacing.
	  Please refer to : https://gerrit.libreoffice.org/#/c/8902/
	  But as now we have to "Preserve AutoSpacing" this check needs to be removed in order to set
          it in StyelSheetTable.cxx.
	- Added Export Unit test case

Change-Id: I6748f97befcdf40643e75388766e05740290306b
Reviewed-on: https://gerrit.libreoffice.org/9561
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2014-06-02 07:53:11 +00:00
Jens Carl
dcb32a33a3 fdo#68849: Add header guards to all include files
Added header guards to files in directory sw/

Change-Id: I5859f986c6f954d41a7940dc9ae8febaa714d34f
Reviewed-on: https://gerrit.libreoffice.org/9587
Reviewed-by: Thomas Arnhold <thomas@arnhold.org>
Tested-by: Thomas Arnhold <thomas@arnhold.org>
2014-06-01 16:16:29 +00:00
Tushar Bende
4896117323 fdo#78883: Writer getting Hang while opening document
Description:
Writer getting Hang while opening document because of loop in layout.

Root cause: For Documents containing table with direct formatting for
Para line spacing along with style w:type="table" in style.xml LO was
erasing PROP_PARA_LINE_SPACING Prop from pAllCellProps in
DomainMapperTableHandler::endTableGetCellProperties().  But for
Documents without direct formatting for Para line spacing this deletion
was causing problem, as after deletion there is no formatting available
to apply.

To fix this checking whether there is a Direct formatting available for
table, if Yes then proceed with this deletion logic.

Change-Id: Ibaf51ebd1aca93eff44a9edfbe8fa13832ab2b70
Signed-off-by: Michael Stahl <mstahl@redhat.com>
2014-05-30 21:07:56 +02:00
Miklos Vajna
f64d2df599 CppunitTest_sw_rtfimport: enable on Mac
Change-Id: I5ab812c51e24877a2ad9be29a9d411c08b3234c3
Reviewed-on: https://gerrit.libreoffice.org/9514
Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2014-05-28 01:47:38 -05:00
Miklos Vajna
3755c87d04 bnc#863018 WW8 import: fix upper margin of multi-page floating table
A vert orient position was already handled in case a floating table was
imported as a TextFrame, but in case we didn't do that, the vert orient
position was simply lost.

Fix this by importing it as the upper margin of the table (assuming that
the position is relative from the anchor position).

Change-Id: I3e96f3068605fd6313dfb3e55483e1bce6c063a5
2014-05-26 12:20:47 +02:00
Miklos Vajna
a38de87515 CppunitTest_sw_ooxmlexport -> CppunitTest_sw_ooxmlsdrexport moves
Any DOCX export test that is related to shapes should go to the sdr
suite to be able to execute in parallel.

Change-Id: I719cd6eda973c5daa1f11bb0e1f57bbacab9f812
2014-05-26 09:36:30 +02:00
Ravindra Vidhate
4002fae087 fdo#79062 File having Footnote with Text Effect got corrupted after RT
When we do the export of the file, In the footnotes.xml,
 the w14 namespaces were not being added.

This issue exists for EndNotes as well.

Change-Id: I6494bbf1beaa0666743d9c1bb85a64f8bda20398
Reviewed-on: https://gerrit.libreoffice.org/9439
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2014-05-26 02:10:21 -05:00
Thomas Arnhold
762b160dce WaE: warning C4146: unary minus operator applied to unsigned type,...
...result still unsigned at sw/source/filter/ww8/docxsdrexport.cxx(441)

Just use SAL_{MAX,MIN}_INT32 (change -2147483648 to (-2147483647-1)) which fixes this warning for MSVC.

Change-Id: Ia039906602d3b00193a364bddb81626afa928f2d
2014-05-25 21:55:35 +02:00
Miklos Vajna
1c14618eaf CppunitTest_sw_rtfimport: the point here was only that this was nearly zero
If the old width was that small, then something larger should be also
fine. (Seen 564 instead of 423.)

Change-Id: Ife0fd4a55738268cdc1691b90e28b51adba829ef
2014-05-24 22:11:04 +02:00
Michael Stahl
6d431ffb68 fdo#77454: fix WW8 import/export of negative image crop
The negative crop values were imported as large positive values, which
caused the image to be rendered with 1 pixel width after commit
2e5167528f7566dd9b000e50fc1610b7bf99132a.

Change-Id: I0e01b9d9a05d90e868699832085a06ba5aab7e54
2014-05-24 18:34:06 +02:00
Luboš Luňák
5510f56350 discard more header/footer stuff when discarding headers/footers (bnc#875718)
782adba4d436c65cdf85d48f28486321873b15ed discards unneeded headers/footers,
but only the text, not e.g. frames or fields. The test document therefore
ends up with a frame with a page number inside the body text, because the text
in the footer it should be anchored to was discarded. This commit fixes
this by discarding more (although probably the whole header/footer
shouldn't even be parsed to begin with).

The test from b349d2483e1fe64316d87b55d0b3b4c8f2293e2e actually checked
for this incorrect frame, so change that (the whole test is suspicious, as
the end result is quite far away from what the original doc looks like).

Change-Id: I2e7192e00237db1f030d0524c5667fe92c9e496b
2014-05-24 00:41:49 +02:00
Jacobo Aragunde Pérez
b5f6a5cfc5 ooxml: Do not repeat wdp files in artistic effects
When two pictures apply different effects to the same picture, it is
only saved once in the original document. Added a cache to DrawingML
to know if the picture has already been exported, and added a test
for it.

Change-Id: Ia25f3d8f2f46d61f18aefc22fdfdbcdc72f2d916
2014-05-23 10:04:00 +02:00