1656 Commits

Author SHA1 Message Date
Stephan Bergmann
9263b101c3 Activate the "suspicious cast to sal_Bool" parts of loplugin:salbool
Change-Id: I78a368ef2899b2462251b45a327fc7b1f31fe764
2014-07-01 17:49:10 +02:00
Vinaya Mandke
b00a59287e fdo#80514 LO crashes on opening; tries to remove a para with NumPicBullet
LO crashes while opening the issue file as, an extra Num Pic Bullets is
attached to the dummy para. All NumPicBullets were disposed in
dtor of ListsManager.
LO tries to remove dummy para after the section, while the pic bullet is still attached to it.
This causes Lo to crash while removing the paragraph.

Added a 'ListsManager::DisposeNumPicBullets( )' to remove the extra bullets from the document
Added the issue file in sw/qa/core/data/ooxml/pass/

Change-Id: I578f48364dcb4ff939fa3800e90db88a99d5ca1a
Reviewed-on: https://gerrit.libreoffice.org/9897
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2014-06-30 14:56:08 +00:00
Miklos Vajna
8100100298 fdo#80167 RTF export: don't loose page breaks
DOCX export tries to write accurately both <w:br> and
<w:pageBreakBefore>, while DOC/RTF prefers just the page break before
paragraph attribute. Given that these later two exporters are not
adapted to write their equivalent of <w:br> at all, add a virtual method
to determine if writing page breaks as "page break before" is preferred
or not, that'll give the expected RTF export result.

This conditionally reverts commit
a31fbb53dba76736b37213b98b64937f05929a67 (fdo#74566:DOCX: Preservation
<w:br> tag for Break to Next Page, 2014-02-06).

Change-Id: I4a5dd295b07739a570cd8cc6709561e64d031273
2014-06-27 22:34:17 +02:00
Miklos Vajna
085424074d identation fixes
Change-Id: Ie9a95b99e1f6de65985b295076f5f89e5d99ec93
2014-06-27 22:34:16 +02:00
Miklos Vajna
10d91ef984 SwTextBoxHelper::create: handle TextAutoGrowHeight
Without this, in case TextAutoGrowHeight is set before TextBox, the
textbox of the shape won't have automatic height.

Change-Id: I2ebf77eacbe1f1d10ccf64ef833c39ee965245d3
2014-06-27 18:02:23 +02:00
Norbert Thiebaud
d92aa2f445 remove SFX_APP() macro that was a mer wrapper for SfxGetApp()
Change-Id: I480a789c767dd671775c9d70d96bf71908f21f5b
2014-06-27 17:08:04 +02:00
Michael Stahl
b8907bf3d3 fdo#78758: sw: RTF export: don't export multiple \fldrst for one hyperlink
Ensure that we export only one \fldresult per hyperlink by doing that in
StartURL() and EndURL(); the TextINetFormat() is called once per text
portion.  This shouldn't cause problems as there can't be anything
between the end of the \field group and the start of \fldresult anyway.

Replace the annoying call to EndURL() from EndRun() with a special case
in EndURL() to store things in the right buffer (hopefully).

(somehow this is regression from c4498251cb7181a9f272b0720f398597c0daef09)

Change-Id: I209ea7a384fb1cb5d1505a70ecc4a4536bbf26a2
2014-06-27 16:15:19 +02:00
Miklos Vajna
f2ad42f97b CppunitTest_sw_ooxmlimport: use exact value from bugdoc in testMceNested()
Bugdoc has 2514600 EMU's as the vertical position, use that, and allow
larger values, as originally this was 0, and we have additional 2 mm100,
probably due to rounding errors.

Change-Id: I7495a0f9e913332a24d0a830b0252ecb6a39d806
2014-06-27 15:56:04 +02:00
Ravindra Vidhate
6bd609d845 fdo#80097 : tblBorders and tcBorders are not preserved for the table.
When we have multiple tables inside a table, the tblBorders and
tcBorders of the inside tables are not getting preserved.

The issue is m_aTableStyleConf is not clear when the LO starts
writing the properties of the inside table.

Change-Id: I30081b8a5a59614430a2279550ae7eb589cb71ec
Reviewed-on: https://gerrit.libreoffice.org/9893
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2014-06-27 07:07:25 +00:00
Vinaya Mandke
9fbdb02c9a fdo#79940 LO crashes on opening; tries to remove a para with bookmarks
LO crashes while opening the issue file as, DomainMapper_Impl::RemoveLastParagraph
tries to dispose a paragraph which has bookmarks attached.

If A para finishes and a new para has not been started as yet,
which means the current cursor position is outside a paragraph.  In such a case move the
Bookmark-End to the earlier paragraph.
Added the issue file in sw/qa/core/data/ooxml/pass/

Change-Id: I62cf94718add943d042d770ab5337a0dae70d9e8
Reviewed-on: https://gerrit.libreoffice.org/9764
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2014-06-26 07:41:44 +00:00
Miklos Vajna
fdb50cd32e SwTextBoxHelper::syncProperty: handle RES_TEXT_VERT_ADJUST
So that vertical text adjustment of the shape is reflected in the
textbox layout.

Change-Id: I887d51928fe4d37db08864374e0cea54f80953b5
2014-06-25 12:30:52 +02:00
Matúš Kukan
4a3b0e544d error: no matching function for call to 'assertEquals'
Change-Id: I0b87c2abeec30e9e4eab3ce488a5828b8a5b475d
2014-06-25 09:45:42 +02:00
Miklos Vajna
7596e26fd2 Add SwTextBoxHelper::findShapes
It builds a textbox -> shape map, so methods interested to pick the
shape instead of a shape's textbox can call it and act accordingly if
their textbox is in the map.

Change-Id: I0f30d64a284eb461f462ed6c0a36c88271153f04
2014-06-24 17:47:40 +02:00
Luboš Luňák
a531676d6d fix broken redlines after undoing column count change (cp#1000071)
Changing a document with redlines to two columns and then using undo
set some redlines to point to the end of the document (done by
the call to RemoveIdxFromSection() in SwUndoInsSection::UndoImpl()).

Change-Id: I88b563b88beebcd1c3cb21fe61bb56cdb12cdc41
2014-06-24 17:00:23 +02:00
Luboš Luňák
7637f765cf fix reading of section margins (bnc#875715)
The reason the section ended up with incorrect margins was because
that is computed as 'page margin' - 'section offset', and the order
of setting these up was backwards: First InsertSection() created
the section using the page margin of the old page, and only afterwards
SetSwFmtPageDesc() set the page margin that should be used.

Change-Id: I18ddcb0b5928879a2297b6caca766eab979abd45
2014-06-24 14:18:38 +02:00
Noel Grandin
e2080e70fe new compilerplugin returnbyref
Find places where we are returning a pointer to something, where we can
be returning a reference.
e.g.
   class A {
     struct X x;
     public X* getX() { return &x; }
   }
which can be:
     public X& getX() { return x; }

Change-Id: I796fd23fd36a18aedf6e36bc28f8fab4f518c6c7
2014-06-24 11:34:21 +02:00
Miklos Vajna
33141f999b SwDrawView::DeleteMarked: delete textbox of shape as well
If we delete a shape that had a textbox, then delete that textbox as
well. Without that, the doc model would be still consistent, but most
probably would not be what the user expects.

Change-Id: Id5075233ce66d7a398c88ff3e63b05a6b2133571
2014-06-23 17:07:43 +02:00
Miklos Vajna
6a93c7e207 CppunitTest_sw_ooxmlexport: enable a subset of these tests on Windows
Change-Id: Ia9bb5f9ea7854e7f85abd8bad347db82b342177f
2014-06-22 17:26:48 +02:00
Miklos Vajna
465503f52d sw: clean up leftover TextBox TODOs
Change-Id: I12782690368789849ea2ce2ed08ad4838a0a55db
2014-06-20 17:28:19 +02:00
PriyankaGaikwad
077121eb0d fdo#79973 : LO crashes while opening the document.
Description:
- If the equation ends with two dots(.) then file get crash.
- In SmParser::NextToken()
  the file get crash because string index is out of bound.

Change-Id: I5f25814220d556d53c10d4ca33a38b4d0d451438
Reviewed-on: https://gerrit.libreoffice.org/9840
Reviewed-by: Muthu Subramanian K <muthusuba@gmail.com>
Tested-by: Muthu Subramanian K <muthusuba@gmail.com>
2014-06-20 14:38:14 +00:00
Miklos Vajna
f75b2bf96e CppunitTest_sw_ooxmlsdrexport: this define should no longer be necessary
Change-Id: I5e4540b5bf47dde53021a300118052da47b90eff
2014-06-20 14:52:43 +02:00
Miklos Vajna
3ea80a4686 RTF import: handle column break at the very start of the document
Change-Id: Ib7d166bf1b1e5d5216d822b2b0396aa4dc535c6f
2014-06-20 12:59:11 +02:00
Miklos Vajna
36b1c27b26 CppunitTest_sw_ooxmlsdrexport: clean up testFDO77122
The document contained a few unrelated shapes and it was reported that
those cause testcase failures, depending on the version of some system
libraries (at least Ubuntu 14.04 is reported to be affected).

Change-Id: I1aaf02441e2bc30d1a5465b038211deb240a5b69
2014-06-20 11:57:29 +02:00
Umesh Kadam
75fc9e669f fdo#78904 : LO hangs while saving the document.
- In case of framePr attributes being omitted in original xml, LO defaults
  such attributes to incorrect values.
- Correcting these values in this fix.
- This fix stops LO from getting hang while saving the document, the actual
  fix needs to be somewhere in the table layout. We need to restrict the
  frame from being considered as part of the table as MSO does not allow
  frame to be part of a table.

Change-Id: I4c35f7eff6ca1122901f5667fc26b849df527f60
Reviewed-on: https://gerrit.libreoffice.org/9774
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2014-06-20 08:48:36 +00:00
Yogesh Bharate
9f87850745 fdo#79968: & fdo#79969: Fix for embedded powerpoint & excel sheet in docx.
Problem Description:
fdo#79968:
1. Document contains embedded powerpoint in docx.
2. After RT, embedded powerpoint object is not preserved.
3. In this case, .sldx is get converted to .bin due to this powerpoint slides
is getting converted to picture.

fdo#79969:
1. Document contains embedded excel work sheet.
2. After RT, embedded excel sheet is not preserved.
3. In this case, .xlsm is get converted to .xls.
4. Similar case happened with binary excel work sheet.

Implementation:
Added sMediaType, sRelationType & sFileExtension for embedded excel sheet,
binary excel sheet & powerpoint slide.

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

Change-Id: I8f94e3f9293f2ac98b61f919d60ca556695b26c2
2014-06-20 10:03:42 +02:00
Dinesh Patil
7ea1bbe712 fdo#79591 Values for docPr name and shape ID attributes were set invalid
Values set for docPr name and shape ID attributes in RT file were not valid
as per UTF-8 encoding format and hence was showing RT document as corrupt with
error message "invalid character".

Calling add() function with current parameters is causing issue and
setting invalid values so modified the second parameter which will
set valid values to the specified parameters.

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

Change-Id: I3b48e53adbe5ed844235e596bb98eb396133845a
2014-06-20 09:44:33 +02:00
nrbrtx@gmail.com
7eafd8ccac fdo#79599: use \highlightN instead of \chcbpatN in RTF import and export
Reviewed on:
	https://gerrit.libreoffice.org/9776

Change-Id: I98ef606fb73368a3c275819cb83b936e2162769d
2014-06-19 21:51:06 +02:00
Miklos Vajna
3cab1adf19 abi#2720 RTF import: handle non-graphic object after a graphic one
Change-Id: I9416b6e7cf3677006215fcbde458ed341c4e3e9e
2014-06-19 18:01:16 +02:00
Stephan Bergmann
f741a60511 ToxLinkProcessorTest needs SwGlobals::ensure to set pSwResMgr
...derefernced in

(anonymous namespace)::lcl_NewUINameArray
SwStyleNameMapper::GetChrFmtUINameArray
SwStyleNameMapper::getNameFromId
SwStyleNameMapper::fillNameFromId
SwStyleNameMapper::FillUIName
SwFmtINetFmt::SwFmtINetFmt
sw::ToxLinkProcessor::ClosedLink::ClosedLink
sw::ToxLinkProcessor::CloseLink
ToxLinkProcessorTest::ExceptionIsThrownIfTooManyLinksAreClosed
...

Also, fix the name from sw_tox_test to sw_tox.

Change-Id: I48ea9fb6322df3725b089538fd67b2e24578b668
2014-06-19 14:24:49 +02:00
Rohit Deshmukh
1c876f5616 fdo#78590: Fix for Corruption of para with framePr & drawing object into para
Issue:
 - File contains paragraph with framePr have graphic object in it.
 - So Libreoffice converts framePr into textbox.
 - So after saving file textbox gets exported with drawing object.
 - MS office does not allowed drawing object inside tetxbox.

Change-Id: I673e0e9f6681a189bde1c63a8cb7aea2cac0ab41
Fix: - Export framePr into paragraph and igonre exporting of
       dummy textbox added by LO for framePr.
Reviewed-on: https://gerrit.libreoffice.org/9389
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2014-06-19 11:01:17 +00:00
Miklos Vajna
19863db337 indentation fixes
Change-Id: Ia391ccc9889a135730f0fead11eb0b6c2f748ec4
2014-06-19 09:57:33 +02:00
Miklos Vajna
d379d18666 oox: import WPS shape with text as shape with textbox
This allows having real shapes (like having rounded corners) and complex
content (like containing a table) at the same time.

WPS shapes are wrappers around drawingML markup in DOCX files, so this
only affects the DOCX import.

Change-Id: Iad1c1c61233be1c17efa1821e680927aa9587215
2014-06-18 12:09:15 +02:00
Miklos Vajna
860f543cdb chart2, sw: remaining textbox DOCX import test preparations
Ideally now all testcases handle both cases during DOCX import:

- current situation, when shape with text is imported as a Writer
  TextFrame
- future situation, when shape with text will be imported as shape with
  an assicated TextBox

Change-Id: I5b95ff4672cecf39eb744f8557f967ade73404c0
2014-06-18 10:24:54 +02:00
Miklos Vajna
e1386e32a8 DocxSdrExport::writeDMLAndVMLDrawing: fix handling of inline VML shapes
In general Writer supports having objects inside a TextFrame, Word does
not. It turns out that Word allows having certain shapes inside other
shapes, as long as they are VML-only. So do that for now: if we receive
a shape when we're already inside a shape, then just export it as VML,
not the usual drawingml+VML pair.

Also, blacklist one more VML shape type, where the shape text is already
exported inside <v:textpath>, so no dedicated <v:textbox> is needed.

Change-Id: I5786bd6827eae9756e7c179bb2ef5a5741a91878
2014-06-18 02:02:51 +02:00
Miklos Vajna
b779dc1364 CppunitTest_sw_ooxmlsdrexport: port fdo78474 to textboxes
Change-Id: Icadf4b44377684e40334c52887883320805a8e89
2014-06-18 02:02:50 +02:00
Miklos Vajna
059ad394a8 CppunitTest_sw_ooxmlsdrexport: port fdo77719 to textboxes
Change-Id: I987f727ec1cd3927239a9339144274f2eea63e36
2014-06-18 02:02:50 +02:00
Miklos Vajna
55561240db VML export of shapes with textboxes: missing <w:txbxContent> tag
Change-Id: Iaf4e34007d7822705a278a94138572b0379b2779
2014-06-17 21:01:16 +02:00
Michael Stahl
1be0a3fa9e n#825305: writerfilter RTF import: override style properties like Word
It would certainly be immediately obvious to any reader of the RTF spec
that \sN will apply the style with index N to the current paragraph.

But actually, that is not what Word does when it reads \sN...
what it really does is to apply the style with index N, and then for
every attribute in that style, apply the same attribute with a default
value to the paragraph, effectively overriding what's in the style.

If that doesn't make any sense to you, well, have you heard the joke
about how many Microsoft engineers it takes to change a light bulb?

Also, \pard apparently implies \s0.

To implement that, change RTFSprms::deduplicate() to recursively
look for style SPRMs that are missing in the properties, and put
in default ones, currently just for 2 keywords \sa and \sb.

This requires changing deduplicate() to be const and return a new value,
since it is no longer idempotent, as the erased SPRMs would get
defaulted on the next run.

While at it, fix RTFValue::equals() which did not compare m_sValue.

This fixes the testParaBottomMargin test that was broken by the fix
for fdo#70578.

Change-Id: I4ced38628d76f6c41b488d608a804883493ff00b
2014-06-17 18:42:07 +02:00
Michael Stahl
6c0e127088 fdo#70578: writerfilter RTF import: by default style is para style 0
quoth the spec:

"For <style>, both <styledef> and <stylename> are optional; the default
is paragraph style 0."

Of course in order to do that we need to add support for at least
recognizing the \dsN and \tsN keywords to override the default, so that
table styles don't become paragraph styles.

Change-Id: Ic100768581f9e8c327063ff776fbd61ac4242483
2014-06-17 18:42:06 +02:00
Miklos Vajna
7b811b689c CppunitTest_sw_ooxmlsdrexport: port testMSwordHang to textboxes
Change-Id: Ia13c3d5657c32b89e200ede572d4615b833374de
2014-06-17 13:49:04 +02:00
Miklos Vajna
dfacd379b0 CppunitTest_sw_ooxmlsdrexport: port testLineStyle_DashType_VML to textboxes
Change-Id: Idb4807a58b6008afeb3e26d03b699671c0b88f7c
2014-06-17 13:49:04 +02:00
Miklos Vajna
d7551e3260 drawingML export: recognize <a:prstDash val="dash"/>
We used to write out a custom dash definition all the time, even in case
it was imported from a dash preset. Recognize at least "dash", and write
that on export if the parameters match.

Change-Id: Ifaaec51be9ecf1e7667a8c8f85fbd4fb9636a325
2014-06-17 12:49:55 +02:00
Miklos Vajna
d801926e0a CppunitTest_sw_ooxmlsdrexport: port testFdo70942 to textboxes
Change-Id: I417405192a74f340aaf80b911d9a8b16b3a83d6f
2014-06-17 11:56:23 +02:00
Miklos Vajna
edde2b02e1 CppunitTest_sw_ooxmlsdrexport: port testFdo73247 to textboxes
Change-Id: Ie9653c3a4c4e09d052027580036d73c20cc576ab
2014-06-17 11:56:23 +02:00
Ravindra Vidhate
fe5b3c3357 fdo#79915:Text Data Lost after exporting through LO
In the OutputTextNode, the text data is postponed when the in case of
NOT_PROCESSED state of fly frame. This text data is never been processed
later.

When the text data is postponed we should write this before processing
the next text node.

Change-Id: Ib8d5fdcf8dcfb9ff394d32103502150e08bbd521
Reviewed-on: https://gerrit.libreoffice.org/9737
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2014-06-16 13:08:53 +00:00
Miklos Vajna
711023ae99 CppunitTest_sw_ooxmlsdrexport: port testTableFloatingMargins to textboxes
Change-Id: I62f0159bec97c6c7a2285509b0662125f46ed480
2014-06-16 14:08:01 +02:00
Miklos Vajna
7389393284 SwModelTestBase: add a getShapeByName() method
Change-Id: Ie3b7099aea1d473cca88c4904683234408920100
2014-06-16 12:48:05 +02:00
Miklos Vajna
76f0a1307f CppunitTest_sw_ooxmlsdrexport: disable testFDO77122 on Mac for now
Change-Id: I1c87406d9b23e36d35e2ef2e62f9f7b4d209e381
2014-06-15 13:44:30 +02:00
Miklos Vajna
b577c99adc sw, writerfilter: identation fixes
Change-Id: I1f1db08447006515e7e6842792241aca992984c0
2014-06-14 11:38:32 +02:00
Miklos Vajna
54148d634d CppunitTest_sw_ooxmlsdrexport: clean up XPath expressions in testFDO77122
Change-Id: I1f8737bbe128c747c84c67e8ba8000ecef1ed4f7
2014-06-13 22:09:32 +02:00