1656 Commits

Author SHA1 Message Date
Stephan Bergmann
887b3a3562 loplugin:staticcall
Change-Id: I26e1e0f66dad5ed4e8351fc7509449b312559166
2014-06-13 17:54:35 +02:00
Michael Stahl
ba9b63d810 fdo#76633: writerfilter: RTF import: do not leak the XShape of image
RTFSdrImport::resolve() is called for \picprop and creates an XShape
that is stored in RTFSdrImport::m_xShape and also
DomainMapper_Impl::m_aPendingShapes;
later RTFDocumentImpl::resolvePict() completely ignores that XShape
and creates a new one, which is also inserted in the document;
the first XShape is effectively leaked.

Try to avoid that by re-using the exising m_xShape in resolvePict().
Not sure if there are any problems with doing this, it's all a bit
confusing.

Change-Id: I98456242acb0766f547eb8f7d877f51d53323f3a
2014-06-13 15:27:02 +02:00
Michael Stahl
b7857e5cfe fdo#76633: writerfilter RTF import: disappear the rectangle shapes on images
If the shape properties are inside \picprop destination, don't set
shapeType.

(regression from 9f1f7199736e2ae07b34849ba66f61a1ef5782e8)

Actually this does not fix the root cause, this is just a work-around,
the extra shape is still inserted but it's invisible now.

Change-Id: I6cf093de2a5657533f393863ed8010ae083bec16
2014-06-13 15:27:01 +02:00
Stephan Bergmann
809c8d4c99 Spell out UTF-8
Change-Id: Iea5f79fb12ac86d4348f46f8ad93a13aaf0f7eb6
2014-06-12 15:34:49 +02:00
Michael Stahl
90b2b378ae fdo#77979: argh forgot to add the test document
Change-Id: I64cf70cf7f1f77c38a8a4804b705ce8a0441e487
2014-06-12 12:52:03 +02:00
Michael Stahl
e47a02b152 fdo#77979: sw: RTF export: write non-ASCII font names encoded
Currently font names like "微软雅黑" (Microsoft YaHei) are
written as "????" in the RTF export; to avoid that, set the \fcharset
of the font entry to something that at least is able to encode
the font name and alternate name.

This requires a new function since the existing
rtl_TextEncodingToWinCharset was changed in
b88fe998ce8c80d7629fe70118311096615d959d to return "default" 0x01
(for OOXML) which is quite unhelpful for RTF.

This is not entirely satisfactory, as of course that is no guarantee
that the encoding can represent all of the actual text that has the
font applied; hence there are some \'3f in the fall-back encoded text
of the heading of the bugdoc, which indicates that the detected
Shift-JIS is insufficient and GB-2132 would be required; but it's not
obvious how to do better here without iterating over all the text
twice, and that still leaves the possibility that all text that has a
particular font applied cannot be represented by a single non-Unicode
encoding.

But since we always write text as the \u Unicode + legacy fall-back,
this should not be a big problem since modern RTF readers will simply
read the Unicode.

Change-Id: Ie6a42294c501d014dd9f0df82638519412ca19bb
2014-06-12 12:39:00 +02:00
Miklos Vajna
25526046e7 CppunitTest_sw_ooxmlexport: port testFloatingTablePosition to textboxes
Change-Id: I200520a28335fb62cecb91175fc6cefc2cfb51ec
2014-06-12 10:07:07 +02:00
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
sushil_shinde
63d1aa4dc8 fdo#78885 : File crashed while opening in LO
- File attached to issue contains footnote between a table and reference
    of footnote is in field.
  - In PopFieldContext code was throwing exception due to null value of
    footnotestartnode.

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

Change-Id: I467e234a7daa6a5f724087c2cc959e4c9d76f4d2
2014-06-11 11:21:35 +02: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
David Tardon
dedfd75d9c blind attempt to fix windows build
Change-Id: Id6f9eb9cb9e5a05732561ae575156cac3c083854
2014-06-08 08:04:32 +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
Stephan Bergmann
b6bfcaa054 loplugin:saloverride
Change-Id: I5ee17a1e5ea28e6ecf371bea30b36923586f41cc
2014-06-06 16:58:22 +02:00
Tobias Lippert
3aca57fb9c TOX: Extract generation of tab stop attributes to its own class.
This allows us to pass through less parameters which are only used for
this functionality.

Conflicts:
	sw/inc/ToxTextGenerator.hxx
	sw/source/core/tox/ToxTextGenerator.cxx

Change-Id: I5a03cf8ec6d86d05f2a7f7771668585669c1e595
Reviewed-on: https://gerrit.libreoffice.org/9613
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2014-06-06 14:02:16 +00: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
Stephan Bergmann
d4259530a6 loplugin:saloverride
Change-Id: I67ce0ceea8ee022493311d58acd0211897208631
2014-06-06 14:40:23 +02:00
Tobias Lippert
0a1b1511fa Unittest generation of text for chapter entries in the TOC
Conflicts:
	sw/inc/ToxTextGenerator.hxx
	sw/qa/cppunit/tox/test_ToxTextGenerator.cxx
	sw/source/core/tox/ToxTextGenerator.cxx

Change-Id: I343958f85fb6718215a0caa456a825d72f168a57
Reviewed-on: https://gerrit.libreoffice.org/9612
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2014-06-06 12:19:12 +00: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
Caolán McNamara
4ee265eeae loplugin:saloverride + loplugin:unreffun
Change-Id: If7d24294e0b62b47c5cbe9271dff948a70cb477a
2014-06-06 10:33:03 +01:00
Caolán McNamara
68e18231b9 tweak to get building universally
Change-Id: I5760dc1fccb7ad726663727b9404e014da519755
2014-06-06 09:31:11 +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
Tobias Lippert
26259e0cca Unittest generation of page number placeholders in table of contents
Conflicts:
	sw/inc/ToxTextGenerator.hxx
	sw/source/core/tox/ToxTextGenerator.cxx

Change-Id: I15c963b6e1a8823a1fdafd2c123d18ba3dc9f134
Reviewed-on: https://gerrit.libreoffice.org/9611
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2014-06-06 08:08:08 +00:00
Miklos Vajna
371b80e1a5 loplugin:saloverride
Change-Id: Iff296171e373bae256c7bf182de44e8fc8d7e60d
2014-06-05 22:04:59 +02:00
Caolán McNamara
13268c75b5 C2782: we hate you sal_Int32 as long on 32bit
Change-Id: I2c8d57f36be15fb4410b11f657e7621022eafa67
2014-06-05 20:35:37 +01:00
Tobias Lippert
94b296d541 Unittest link generation for table of contents.
The logic was moved to a separate class and unittested.

Conflicts:
	sw/inc/ToxTextGenerator.hxx

Change-Id: I0e4475f5e2950cdfdfb07b89128c4ce1d6af3f22
Reviewed-on: https://gerrit.libreoffice.org/9609
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2014-06-05 16:26:39 +00:00
Tobias Lippert
e5345f62bf Unittest the whitespace stripping logic for tox text generation
The separate class allows to unittest this functionality in isoloation.

Change-Id: I1e5eddfb455ca85a662ea38c03302883decc5d58
Reviewed-on: https://gerrit.libreoffice.org/9608
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2014-06-05 16:26:06 +00: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
Umesh Kadam
14ce4b3372 fdo#78906 : File crashes while opening.
Handled a memory corruption.

Change-Id: I195d17bcd0a9a86bcc96cc7ad14f1d5f2908cf8c
Reviewed-on: https://gerrit.libreoffice.org/9545
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2014-06-05 09:21:15 +00: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