summaryrefslogtreecommitdiff
path: root/sw/qa/extras/unowriter
AgeCommit message (Collapse)Author
2021-10-31Prepare for removal of non-const operator[] from Sequence in swMike Kaganski
Change-Id: Ie9530262e4addec01091cc1147e68be5b5a782f0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124398 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-07-19Move svl::Items to include/svl/whichranges.hxx, and unify its usageMike Kaganski
... in WhichRangesContainer and SfxItemSet ctors. Now it's not needed to explicitly use 'value' in WhichRangesContainer's ctor, or create an instance for use in SfxItemSet ctor (svl::Items is already defined as a template value of corresponding type). Instead of WhichRangesContainer Foo(svl::Items<1, 2>::value); SfxItemSet Bar(rItemPool, svl::Items<1, 2>{}); now use: WhichRangesContainer Foo(svl::Items<1, 2>); SfxItemSet Bar(rItemPool, svl::Items<1, 2>); Change-Id: I4681d952b6442732025e5a26768098878907a238 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119157 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-07-02sw: handle RANGE_IS_SECTION in SwXTextRange::getText()Michael Stahl
It always returned null. This was missing in 6471d88cb8b61741c51499ac579dd16cb5b67ebf Change-Id: Ibf34c24fdbbbc2f65c6948f58d12f257ccf120ae Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118286 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2021-05-12tdf#137810 sw: fix SwXNumberingRules setting CharStyleNameMichael Stahl
During ODF import, due to removal of the pDocShell parameter, this hits else rCharStyleName = sCharFormatName; while setting the "CharStyleName" property and later GetNumberingRuleByIndex() prefers m_sNewCharStyleNames over the format set in the SwCharFormat?? Also, "BulletFontName" has a similar problem; otoh "HeadingStyleName" only makes sense on chapter numbering. The m_pDoc and m_pDocShell members are such a WTF. (regression from ae0e4a6ba9be2fa99ac2be8e20157806e36209b2) Change-Id: I9d4d4cd7aeb7e6e29221d53facaff213fd4e35a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115495 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2021-03-25const OUString -> const OUStringLiteralMike Kaganski
Mostly automated rewrite Change-Id: Ie020a083f898bc126b8fb039d4ecb2e687172da1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112965 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-02-15loplugin:referencecasting in swNoel
Change-Id: Ie923fc8baaa26938378407f6e5f3c50b2cea7cca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110815 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-02-04sw: fix copying and deleting of table in section via APIMichael Stahl
This is a follow-up to 7ab349296dac79dad3fec09f60348efcbb9ea17e. The first problem was that tables that contain protected cells refused to be deleted, which caused an infinite loop in SwXTextRange::DeleteAndInsert(). This also affected SwXTextTable::dispose(), and DDE tables. Fix this by forcibly deleting even protected cells from UNO APIs; protection is an UI feature. The second problem was that pasting the table SwFEShell::Paste() would set up aCpyPam so that it selects from the start node of the table to the last text node in the table, excluding the table cell and table end nodes, which caused: DocumentContentOperationsManager.cxx:3548: An insufficient number of nodes were copied! Fix this by setting up aCpyPam over the entire body section of the clipboard document. Change-Id: I8c6caee5e75260dff79f106efc11f9669feddc0c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110411 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2021-01-10fix coverity parse errorsCaolán McNamara
Change-Id: I4884bfb67a061b865e8cf38b2fea6de0cb1bc3d6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109057 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-12-26New loplugin:stringliteralvarStephan Bergmann
See the comment at the top of compilerplugins/clang/stringliteralvar.cxx for details. (Turned some affected variables in included files into inline variables, to avoid GCC warnings about unused variables.) Change-Id: Ie77219e6adfdaaceaa8b4e590b08971f2f04c83a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108239 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-11-24sw: fix SwXTextRange::createEnumeration() inside table cellMichael Stahl
This would set CursorType::SelectionInTable but leave m_pOwnTable and m_pOwnStartNode uninitialised, causing sw/source/core/unocore/unoobj2.cxx:399: SwXParagraphEnumeration: table type but no start node or table and then the enumeration would return the table it's in as the first element, which is quite annoying. Refactor the creation of SwXParagraphEnumeration to prevent this. Change-Id: I4e9e3456bdf66b9822d19ad985a20b094e6bbba4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106532 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-11-24sw: fix copying and deleting of section content via APIMichael Stahl
The problem happens if a section starts or ends with a table: SwXTextSection::getAnchor() may return a SwXTextRange with one position in a table cell and another position in a different table cell, or outside the table, neither of which is valid to set the cursor via SwXTextViewCurosor::gotoRange(). Introduce a new special mode for SwXTextRange, RANGE_IS_SECTION, analogous to RANGE_IS_TABLE but actually working. Only SwXTextView can be used to create XTransferables, and it requires selecting first via either the SwXTextViewCursor or select(). It's currently not possible to select the content of a section in the ViewShell in these problematic cases, and would be some effort to add. So add a new interface XTransferableTextSupplier that can be used to create XTransferable from the SwXTextRange with RANGE_IS_SECTION. The core CopyRange() and DeleteRange() functions can deal with SwPaMs that start or end in non-text-nodes, so pass the whole section content to these in SwXTextRange::setString() and in SwXTextView::getTransferableFromTextRange(). Change-Id: If7e3210e8a26f5618317c294f2b2f3ed5c217f1c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106293 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-11-24loplugin:stringviewparam extend to comparison operatorsNoel
which means that some call sites have to change to use unicode string literals i.e. u"foo" instead of "foo" Change-Id: Ie51c3adf56d343dd1d1710777f9d2a43ee66221c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106125 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-10-20use tools::Long in swNoel
Change-Id: I44be72b3a9b14823ec37a3c799cffb4fb4d6e1de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104527 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-09-28sw: prefix members of SwFrameChangesLeave, SwSidebarItem, ...Miklos Vajna
... SwSizeEnterLeave and SwTextAPIObject See tdf#94879 for motivation. Change-Id: Iea12ac975b68700488f7b39bbb3596a011159c61 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103528 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2020-08-23Fix typosAndrea Gelmini
Change-Id: I305ec375c0aed8832290fe872edd050e53262a90 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101217 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2020-08-15Fix typo in codeAndrea Gelmini
Change-Id: If2a5e5533a8587c83279d61d764c201e8572f075 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100730 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2020-08-03tdf#42949 Fix IWYU warnings in include/[t-x]*/*hxxGabor Kelemen
Recheck after 7-0 branchoff Also drop the now unused file include/vcl/field.hxx Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: I9e54c82f50d1e02a0f99858939cac999fc66f7de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99261 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-07-31sw: introduce a Library_swqahelperMiklos Vajna
So it is no longer necessary to define all SwModelTestBase functions inline. Change-Id: Ia1055ff967b3614102275ec92607c85ec063fce7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99820 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-06-05Upcoming loplugin:elidestringvar: swStephan Bergmann
Change-Id: I3805d7a0f8f0e93463a2285a1ce52f6a5daba27d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95578 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-05-15CppUnittest: sw: simplify code. use getShapes and getShapeXisco Fauli
Change-Id: I494349b99a122f67ed1f2881faf1a37e4358c55b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94214 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-04-14sw: fix fly at-char deletion API behaviour changeMichael Stahl
28b77c89dfcafae82cf2a6d85731b643ff9290e5 changed at-char anchored fly selection. WollMux calls setString("") to remove one character in the first paragraph and a fly anchored at the start of the body text is deleted due to the new IsAtStartOfSection() check. It would be possible to treat deletion via API differently than via UI, as there is already a flag ExcludeFlyAtStartEnd but it would require passing the flag through 10 functions and also to store it in SwUndoDelete... The main intent of the IsAtStartOfSection() check was that Ctrl+A should delete every fly; this can be achieved by checking that everything was selected, so that selections only inside the first/last paragraph don't delete the flys at the edges. Change-Id: Id62e7d99a10b42eaecea5564372d29b6c43e3f7e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91993 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-02-22Fix typoAndrea Gelmini
Change-Id: Ic6198edef14817f91d889359878636320a64c09c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89253 Tested-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2020-01-07tdf#129841: fix GetTextTableCursorPropertyMap cell background valuesMike Kaganski
... which were accidentally broken in 2003 in commit eba784710e92597282a2284b56dce3a45ac38776. Change-Id: I3dc96dff0a8935f927933bb3946528fb8ac9aed0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86315 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-01-06tdf#129839: pass initialized shared_ptr to SwDoc::GetBoxAttrMike Kaganski
Regression after commit 1e2682235cded9a7cd90e55f0bfc60a1285e9a46 Change-Id: I40acc9e0ffdd292283381366a31eb6647b80324f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86291 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-01-03tdf#129743 follow-up: implement the other variant of the fixMike Kaganski
Reimplement commit d8a188d8d59ae51621a0540fe931e1c70db285fe Seems that I was overly optimistic. The behaviour of CreateCursor affects many places; first of them is CreateNewShellCursor, which would start returning cursors with selection after the fix from commit d8a188d8d59ae51621a0540fe931e1c70db285fe. Or if we change which cursor is returned from that method, then the order of the chain would reverse. And there are many such places. So just make it like before, and do the conservative fix. Change-Id: Ib6bf414f0e91d6fb59f73fbfc0fbd799457d49c9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86151 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-01-03sw: add UNO API for semi-transparent textMiklos Vajna
This makes the ODF filter work out of the box, since the same property was provided by Draw/Impress in the past already. Change-Id: Ie6a053864c9fa41fad6ca4571d7d04a3756b7591 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86147 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-01-02tdf#129743: don't delete mark of current cursor when creating new cursorMike Kaganski
The deletion was there since initial import in commit 84a3db80b4fd66c6854b3135b5f69b61fd828e62. It's unclear why would it be necessary and what depend on it. All tests pass => let's drop it. Another (less intrusive, and IMO more of a workaround) way would be to move setting mark of pCursor after the loop over GetNext() in SwCursorShell::SetSelection. Change-Id: I5402db58d8f829799bc16b8f4f6014bcea133995 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86142 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2019-11-20sw: revert change in expanding hints in SwXText::insertTextContent()Michael Stahl
The SwXText implementation for inserting text works like this: * XTextPortionAppend methods appendTextPortion()/insertTextPortion() get the text properties passed as a parameter, and they should apply only those properties to the inserted text, not expand any existing formatting hints at the insert position. * XSimpleText method insertString() does expand existing formatting at the insert position, just like editing in the UI does For inserting XTextContent: * XTextContentAppend methods appendTextContent()/insertTextContentWithProperties() with properties parameter, similar to XTextPortionAppend * XTextContent::insertTextContent(), without properties So arguably, by analogy to inserting text, the methods that take properties should not expand hints, and the insertTextContent() should follow the insertString and expand hints. Commit 18cbb8fe699131a234355e1d00fa917fede6ac46 is an important bugfix for writerfilter import, but the problem is, it added the DontExpandFormat() call to insertTextContent(), whereas the regression it was fixing (from commit 232ad2f2588beff50cb5c1f3b689c581ba317583) was that the call was removed from insertTextContentWithProperties(). So restore the state before 232ad2f2588beff50cb5c1f3b689c581ba317583. Turns out that SwUiWriterTest2::testTdf126206 was checking how a bookmark-start is formatted instead of how the text is formatted. Change-Id: If524409f88a1a36aa062b6e132996d3f9c1bb571 Reviewed-on: https://gerrit.libreoffice.org/83223 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2019-11-18sw: insert image: set anchor to at-char by defaultMiklos Vajna
This changes the default set in commit 4f40bf6a79de6d60da0a5090cdfeda6242e889f0 (sw: insert image: set anchor to as-char by default, 2019-07-04), to have a better compromise, taking both Word defaults compatibility and usability into account. The problem is that users are used to just inserting an image and being able to drag it to its final location, which is broken with as-char anchoring. So default to at-char anchoring, this is still something that is fully interoperable to Word (unlike the old to-para anchoring), but allows the easier image move again. Change-Id: Ibc61ae167fc9e5cc31b04c83e854556309e27fd4 Reviewed-on: https://gerrit.libreoffice.org/83089 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2019-10-03DOCX import: fix interaction of table and paragraph style in table cellsMiklos Vajna
Both table and paragraph styles can define paragraph properties for the content of table cells, e.g. line spacing. The intended behavior is that direct formatting has priority, then paragraph style, then the table styles. But in practice table style had priority: table style is turned into a set of property name-value pairs by writerfilter/ code, then this is applied to the content of a cell using SwXCell::setPropertyValue(). To make sure that direct-format-from-table-style doesn't override direct-format, there was already a check to not replace properties which are set directly. The problem is that in case the property value comes from a paragraph style, that's not direct and still should have priority over direct-format-from-table-style. Fix this by checking for custom values not only in the paragraph's item set, but also in its parents. Unless the parent would be the default style, which doesn't count. Or in case the paragraph is numbered, which complicates the situation, so leave that case unchanged. Change-Id: Ib554247cdc51fee0d9a6c7a26aecd38442dfa692 Reviewed-on: https://gerrit.libreoffice.org/80146 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2019-09-19Related: tdf#124600 sw anchored object allow overlap: add UNO APIMiklos Vajna
And fix the pool item's operator==() that forgot to take allow-overlap into account. Change-Id: I34ec29eed95d821cfccebbb15675e0f576b6454d Reviewed-on: https://gerrit.libreoffice.org/79115 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2019-08-16This was meant to be 'continue', not 'break'Mike Kaganski
... when commit ee0bf5d58bc59052923c4ced928a989956e71456 had introduced SwUnoCursorHelper::SetPropertyValues, and the intent obviously was to skip bad values, populating relevant error messages, and set all correct values. Change-Id: Id699f74a9df179c810608400983f88db1a7164b8 Reviewed-on: https://gerrit.libreoffice.org/77584 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2019-08-15loplugin:sequenceloop in swNoel Grandin
Change-Id: Icda7c89b396e5607ca847c0a8393cb27a2d50c6c Reviewed-on: https://gerrit.libreoffice.org/77530 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-08-12Fix typosAndrea Gelmini
Change-Id: I4a334f1f40c829ddffb93cd8a41f0a9c8e65d5d8 Reviewed-on: https://gerrit.libreoffice.org/77279 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
2019-08-07sw: fix ViewCursor.PageStyleName for multi-page paragraphsMiklos Vajna
In case the text frames of a text node span over multiple pages and the first page has a page style which has a follow page style, the page style under the cursor depends on not only the text node index, but also on the context index. Without this, the page style under the cursor will expose the first page's style name via the API, even if it's already on a follow page. Change-Id: I922e153750755317bda87441a88e9f53a6f348b7 Reviewed-on: https://gerrit.libreoffice.org/77128 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2019-07-23resurrect and improve loplugin:referencecastingNoel Grandin
Improve the plugin to avoid generating false+ with the special case of querying XInterface (what the code calls normalisation). Also ignore places where the querying is dealing with ambiguous base classes. Change-Id: I23b2b2fa6618328fafc4707b94c26582a462ea87 Reviewed-on: https://gerrit.libreoffice.org/74993 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-07-04sw: insert image: set anchor to as-char by defaultMiklos Vajna
See the mailing list thread at https://www.mail-archive.com/search?l=mid&q=999e55c8-5d15-1014-e6f9-9f3d19d003af@collabora.com (minutes of ESC call ..., 2019-05-09) for motivation, this is meant to improve Word compatibility, by not defaulting to the at-paragraph anchor type, which is unavailable in Word. See tdf#45778 and tdf#87720 for related bugs. Change-Id: I2699ce04dce02e8436dc3af3b2cc8778f8dc476c Reviewed-on: https://gerrit.libreoffice.org/75091 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2019-06-24Adapt new test to actual values observed on macOSStephan Bergmann
The test against 5892 was introduced with ac246d6ea1bc43bfc82c9b4c69c9c0f1fd678129 "sw comments on frames: fix layout to place anchor next to the image", causing various macOS builds (<https://ci.libreoffice.org//job/lo_tb_master_mac/30338/> and <https://ci.libreoffice.org//job/lo_tb_master_mac_dbg/26914/> as well as my own local build) to consistently fail with 6283 instead, for whatever reason. So, at least for now, adapt the test to check for >= 5892. Change-Id: Id5cb5dbb343873e02405957edec6be4f9e477f8f Reviewed-on: https://gerrit.libreoffice.org/74627 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-06-21sw comments on frames: fix layout to place anchor next to the imageMiklos Vajna
With this, if you load sw/qa/extras/unowriter/data/image-comment-at-char.odt, the comment anchor leads to the commented image, not to the anchor of the image (between "aaa" and "bbb"). Change-Id: I99389c9fc849269eb20d0266f8f604db89faec12 Reviewed-on: https://gerrit.libreoffice.org/74519 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2019-06-21sw comments on frames: fix annotation start order in UNO portion enumMiklos Vajna
The problem was similar to commit 76a4305d1e90b6617054dd33036e64f005dbcf04 (sw: fix inconsistent bookmark behavior around at-char/as-char anchored frames, 2017-12-21), except here we have an (annotation) mark which does have a range, but still around at-char anchored frames, similar to the bookmark situation in that commit. Fix the problem similarly, by first adding comment-start portions to the enumeration, then frames, and finally the rest of the comment portions (as before). With this, an ODF <office:annotation/><draw:frame text:anchor-type="char"/><office:annotation-end/> sequence (commented at-char image) is roundtripped correctly. Change-Id: I8790d9efae625de48c689ca4180fe75f15b4833c Reviewed-on: https://gerrit.libreoffice.org/74503 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2019-06-20sw comments: allow ranges to be created which cover only the placeholder charMiklos Vajna
First, the old condition was a bit tricky: it wanted to avoid the case when only the placeholder character is covered, but given that start and end can be the same for collapsed ranges, this was true for comments without a range, too. In practice what remains blacklisted is just the case when the PaM has a mark, but it's the same as the point. The change has two motivations: 1) ODF can have '<office:annotation/>...<office:annotation-end/>', where '...' may be content which has no document position itself in the Writer implementation, like at-char anchored images. This change avoids loosing the range of such annotations during ODF roundtrip. 2) This starts adding support for comments on objects which don't have an own document position, though UI for that is still missing. Change-Id: If151b8e00e37e07830c0582b8f0920a91a787363 Reviewed-on: https://gerrit.libreoffice.org/74459 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2019-05-10an is used before a vowel soundCaolán McNamara
not before vowels with a consonant sound so its a url not an url Change-Id: Ic27ff3bee67469284d460c31ced6f63cb3633db2 Reviewed-on: https://gerrit.libreoffice.org/72062 Reviewed-by: Jens Carl <j.carl43@gmx.de> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-04-11CppunitTest_sw_unowriter: use CPPUNIT_TEST_FIXTURE()Miklos Vajna
Instead of the custom DECLARE_UNOAPI_TEST_FILE() and DECLARE_UNOAPI_TEST(). Change-Id: I5565ad1661ada870f3f53da808bd5a30f2172013 Reviewed-on: https://gerrit.libreoffice.org/70538 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-03-29tdf#42949 Fix IWYU warnings in include/sfx2/[n-r]*Gabor Kelemen
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: Ia2bea9bd4775f4ed5ef0133971106a6c0bfdd1c0 Reviewed-on: https://gerrit.libreoffice.org/69896 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-03-27CppunitTest_sw_unowriter: be consistent about using namespace declarationsMiklos Vajna
This file already used uno::Reference at a number of places, then an additional 'using namespace ::com::sun::star::uno;' makes little sense. Especially that naked Reference may refer to rtl::Reference as well, i.e. harder to read. Change-Id: I8f0eda0e81a8da1af02a99ac37cb08496f753cf5 Reviewed-on: https://gerrit.libreoffice.org/69771 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-01-24sw paste listener: expose pasted images as wellMiklos Vajna
Do it similar to SwXTextView::getSelection(), so that SwView::GetShellMode() determines when an image is selected (and otherwise assume text selection). Change-Id: I717e1358428daba842309260b54f82b62a0aaec1 Reviewed-on: https://gerrit.libreoffice.org/66879 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2019-01-24sw: make it possible to listen to paste eventsMiklos Vajna
The use-case is that the user pastes content and custom postprocessing is necessary for the pasted content. This is not easy by default, since the cursor is at the end of the pasted content, so the start is not known -- even if you intercept the paste UNO command. Precisely tracking the start is possible when using the internal API, SwReader::Read() does something similar already to track the undo range. Only expose the text selection after paste (as a start), but design the API in a way so that other pasted content type (e.g. image) can be added in a backwards-compatible way later. Change-Id: If35bda4244cc417e4858124fb75f7608b95fc556 Reviewed-on: https://gerrit.libreoffice.org/66807 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2019-01-04svtools: expose document position in DocumentToGraphicRendererMiklos Vajna
Writer pages always have an offset inside the root frame, and this is visible in the generated metafile as well. The offset is minimal for a small window and a single page, but the vertical offset increases with every page. Make this information visible, so sfx2 can compensate this. This is somewhat similar to what SfxObjectShell::DoDraw_Impl() does, but that works for the first page only (use case is thumbnail generation), while this is 0 offset for Calc/Impress and a proper offset for all Writer pages. Change-Id: I1075c98faf74f9e77c916572b4d63d40fbd80ab1 Reviewed-on: https://gerrit.libreoffice.org/65850 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2018-12-11sw: fix paragraph enumeration going past a selected tableMiklos Vajna
Writer has the internal invariant that if a text (non-table) selection starts outside a table, it should end outside a table as well. This means if you start your selection before a table and you try to select till the end of the table, your selection will end at the start of the next non-table node in fact. This is especially confusing if you turn the selection into a paragraph enumeration, where the last paragraph's 0 -> 0 character range is "selected" (i.e. none of the paragraph content is selected) and still the paragraph is included in the paragraph enumeration. Special-case the "selection ending at para start after a table" situation when it comes to turning this selection into a paragraph enumeration to avoid the unexpected empty paragraph at the end. Change-Id: I51432dee9e5d76971533c8059edab1cd9683434b Reviewed-on: https://gerrit.libreoffice.org/64972 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2018-12-04sw: fix paragraph enumeration going past selection endMiklos Vajna
SwCursor::MovePara() may move the uno cursor past the end of the selection range, check for this explicitly. In practice this makes sure that in case a 1-paragraph cell text is selected, we never jump to the next cell for a selection created from the previous cell. Change-Id: Ibe2d00cfa75ed0c32b9c89d86cfae3b51d70ddc6 Reviewed-on: https://gerrit.libreoffice.org/64509 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins