summaryrefslogtreecommitdiff
path: root/editeng
AgeCommit message (Collapse)Author
2021-08-26tdf#114441 Convert use of sal_uLong to better int typesRadhey Parekh
Beacuse EditEngine::GetTextHeight() returns sal_uInt32, this type of int is chosen for the local variables nWidth, nHeight and nTextWidth Change-Id: I9288946b0cb7b9227fe63371840d6bfb84ab829e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120894 Reviewed-by: Hossein <hossein@libreoffice.org> Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Tested-by: Michael Stahl <michael.stahl@allotropia.de>
2021-08-25i#114206 sd: unshare shape properties for the same type before insertionMiklos Vajna
Regression from commit 9bd99c08e8662becdd5ac8b47ef6f953c14e65fc (CWS-TOOLING: integrate CWS os128, 2009-06-03), the problem was that the SvxItemPropertySet was both used to store a property map (information about UNO properties) and also as a descriptor for a not yet inserted shape. The above commit improved performance by sharing a single instance of an SvxItemPropertySet for the same shape types: this works for the property map, but doing the same for property values is problematic. In practice, this eliminates the need for a workaround in oox/, the user-visible problem was that loading a document with smartart, then loading a document with group shapes (but without smartart) and saving it would copy information from the first, closed document (!) to the second document. Just removing the oox/ workaround would make make -C oox -sr CppunitTest_oox_drawingml CPPUNIT_TEST_NAME="testGroupShapeSmartArt testTdf131082" fail, unsharing the descriptor piece makes it pass again. Change-Id: Icdff2108ad0da18ce0ade081b1938dd74bc0ae90 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120996 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2021-08-25lcl_translateTwips only needs OutputDevicesCaolán McNamara
Change-Id: I2c1536f062557f598aee0b0552044a7f41302b07 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120948 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-08-25assert on calc rtf import at svl::detail::validRange(nFrom, nTo)Caolán McNamara
Change-Id: I4513be06ff70605db8b386dc261c5b82509759e8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120953 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-08-22no need to use unique_ptr for PolyPolygonNoel Grandin
it is already a COW type Change-Id: If28f67bff3f8df7763bf4b574b1125d568f0ee27 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120821 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-08-22don't store vcl::Font with unique_ptrNoel Grandin
it is already a COW object, so just use std::optional Change-Id: I5ced54dbf3dc222316d9bcf3581b36e0f6e6e270 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120818 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-08-20New loplugin:unusedcapturedefaultStephan Bergmann
In sc/qa/unit/ucalc_formula.cxx, dropping the capture-default from the lExpectedinF lambda revealed that MSVC in C++17 mode (i.e., when building without --with-latest-c++) requires ROW_RANGE (a local const int variable from the enclosing TestFormula::testTdf97369) to be captured, even though all uses of that variable within the lambda body are constant expressions. That is still true at least for the latest Visual Studio 2019 version 16.11.1. (This is not an issue for the lExpectedinH and lExpectedinI lambdas a few lines further down, as they, in addition to using that ROW_RANGE, also use the local const double variables SHIFT1 and SHIFT2, whose uses are not constant expressions, so they are implicitly captured and loplugin:unusedcapturedefault does not suggest dropping those lambdas' capture-defaults in the first place.) Change-Id: Iee7efb485187cbe8eba6a2d470afca4993eb1816 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120693 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-08-20tdf#91519: prevent jump to top of the comment viewBayram Çiçek
In Writer, there are 3 issues about comment section: - comment section scrolls to top of its view when clicking inside a comment view. - clicking inside a comment view, scrolls the view to old cursor location automatically (if old cursor out of the visible area) - comment section scrolls automatically to the old *selected* text (if it's out of visible area) when clicking inside the Writer canvas view this commit is intended to solve these issues Change-Id: If7d62373f5215adea85512b66b78736e04e02c3c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118638 Tested-by: Jenkins Reviewed-by: Muhammet Kara <muhammet.kara@collabora.com>
2021-08-18undo changes to TextAlignCaolán McNamara
revert commit 8689bd5490b473a7ffb149bbe5f7f0683f679c72 Author: Caolán McNamara <caolanm@redhat.com> Date: Thu Jul 29 20:49:29 2021 +0100 convert TextAlign to scoped enum lets leave this as it always was Change-Id: Id4d2a5644974cdd2b0ed6d361d5c52629674d057 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120626 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-08-17tdf#143858: sw: default value for nInclUpperLevels is 1Vasily Melenchuk
SvxNumberFormat::nInclUpperLevels (matches text:display-levels in ODF) bit incorrect in its name: is counts total amount of levels to display, including current level. So value "0" seems have no sense: display 0 levels in total? In UI you can't select less than 1 level and ODF standard (19.797) using 1 as a default. This looks plausable. Change-Id: I596386c7b3cc4370910cd0ff6e927e501179fbdf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120458 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2021-08-17Make IdleFormatAndUpdate privateMike Kaganski
Change-Id: Ifecc0653de27bbc0cf483147c87a11d5cd307090 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120574 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-08-16pass OutlinerParaObject around by valueNoel Grandin
since it uses o3tl::cow_wrapper, so it is really just a wrapper around a pointer, no point in allocating it on the heap Remove assert in SdrText::SetOutlinerParaObject, which was bogus anyhow, because it was comparing pointers, not deep equality. And since we are now being more efficient and avoiding copying of the internal data in OutlinerParaObject, we hit this assert. Change-Id: I6dbfaab5ee2ca05b2001baf63110041e469df9c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120510 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-08-14flatten OFlowChainedTextNoel Grandin
Change-Id: I0836d1f850c71700f8691cf8847e4f4d30d4dbb5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120475 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-08-13rtl::Static -> thread-safe static localNoel Grandin
Change-Id: If5b7181fb1bb3f3f21ec3742680e5a3e12b21b73 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120431 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-08-13split SvNumberFormatter into it's own headerNoel Grandin
so I can make changes without running into cyclic dependencies between header files Change-Id: I98a91c7cc66002ba745cdb8239e5cc267922a45c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120412 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-08-12tdf#95549 speed up load of xlsNoel Grandin
we don't need to perform layout during load, so disable a few places that do that reduces load time by 50% Change-Id: Ie746ca0b46de3b76ca1b7291e0528b525333278f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120384 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-08-11Drop convertMm100ToTwip in favor of the new o3tl::toTwipsMike Kaganski
Step by step, duplicates from <tools/UnitConversion.hxx> may go Change-Id: Id4c03ff8adc120ae06dbfdbdfb4f5ff0bb51f489 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120315 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-08-11convert some LogicToLogic calls to use o3tl::convert insteadTomaž Vajngerl
If a LogicToLogic uses fixed units, we can use o3tl::convert instead. We can also do the same for all other cases where LogicToLogic is used, but that needs additional investigation to determine if it is safe to do so. Note: MapUnit::Pixel is converted to o3tl::Length::pt because it assumed 72 PPI for a logical pixel, which corresponds with the conversion rate of a point (72 PPI). Today, 96 PPI is standard, which is also used for o3tl::Length:px. Change-Id: I29126df38bfcfda74b5d83d4cb880a378aecd18b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120230 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2021-08-10no need to use unique_ptr for SvxRTFStyleType hereNoel Grandin
Change-Id: I2af75b594096c54403af34d20303fbf3ff79a5f6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120214 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-08-10tdf#142845 editeng: don't update selection when formatting before sd pasteMiklos Vajna
Regression from commit f0c25c751cf8e166a84b289746bce6202a40391d (tdf#115783 sd: fix lost char attributes during in-table copy&paste, 2018-02-16), the problem was that the formatting before paste also created an undo action, and executing it alters the selection, which was not intended. So in case the textbox contains "world" and we paste "hello", then the undo will set the cursor at the end of "world", while the expected result is to just undo the paste and the formatting of "world". Fix the problem by not altering the selection in the undo of Outliner::SetCharAttribs(), which is only called by sd/ in the before-paste case, not anywhere else. Change-Id: Ie4a08f57d22cd1862c02987a5f86089fda8a5d9d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120220 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2021-08-05Pass context and resource string down to boost::locale separatelyNoel Grandin
because this is often on a hot path, and we can avoid the splitting and joining of strings like this. Change-Id: Ia36047209368ca53431178c2e8723a18cfe8260a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119220 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-07-31getArray->getConstArrayNoel Grandin
Change-Id: I951dd4a02c9ead98e7eb13ae2995ba2e1e57b38a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119740 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-07-31editengine-columns: number of columns is sal_Int16Mike Kaganski
Change-Id: If0e46614a398a1b2fe93eb1bfa25b5670be3511b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119725 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-07-30cid#1399290 silence Uncaught exceptionCaolán McNamara
Change-Id: I1fecdb09374c3631e005039d38dfd852a7b4b671 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119704 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-07-30convert TextAlign to scoped enumCaolán McNamara
Change-Id: Id2c466eacb44f0ea6adba75a0ac0be8be8e7ed4c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119682 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-07-29drop some unneeded includesCaolán McNamara
Change-Id: I200d2936e97475dedc67801631222da12c777729 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119649 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-07-29use the parent as available from HangulHanjaConversionCaolán McNamara
Change-Id: I9b8e34f4358620f2bc3c510ea3d581be8f87bb97 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119648 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-07-28Three identical functions for a class is a bit too muchMike Kaganski
Change-Id: Ia949f3fe2cbbc8aa524347854faa23807d58e252 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119606 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-07-26sw: use followby parameter of outline in Chapter fieldVasily Melenchuk
When Chapter field with format "Chapter number and name" is used it does not insert any delimiter between number and name. Best is to use outline/list property LabelFollowBy. But since it is done inside field we are limited with supported characters, so practically only space and nothing are correctly supported. Tab and newline are replaced by space. Change-Id: I4583b7051ae5ad963132980443fa70b5a19354e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119428 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2021-07-26tdf#143424: support for "Chapter number without separator"Vasily Melenchuk
If LO is using list format strings (this is default behavior since aa5c6d12) it was not able to show just numbering without all formatting, as it used in some fields. Change-Id: Ib4695b8e1c2d7a451522c7e04af2216d16aceefe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119309 Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de> Tested-by: Jenkins
2021-07-26use officecfg for security optionsNoel Grandin
Change-Id: I9d91fd5b260b82e05aac6567143386742953ecf6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119486 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-07-22Make static_casting to the only derived class less verboseMike Kaganski
... and assert on correct derived type in debug builds. Change-Id: Iedd37b3ad4139ab1eb1a0a321e3ebd0018ecde99 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119360 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-07-22Simplify EditTextObject's pool initializationMike Kaganski
Old scheme (ever since commit fd069bee7e57ad529c3c0974559fd2d84ec3151a "initial import") was that when source EditTextObject was owner of the pool, the copy created a new pool; and when source was not owner, the copy just re-used existing pool. It made no sense since commit 1545949690c750d7b512000723b564e69cf3c3a6 where pools were made ref-counted using rtl::Reference. This also simplifies the only place which used the EditTextObject ctor taking pool by making the related ctor to take all necessary arguments instead of calling setters after constructing the object, which allows to drop a couple of setters. Change-Id: I843e154dd57f33f7c037063b4a0fcc0ac5a33cd2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119358 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-07-22BinTextObject was renamed to EditTextObject long agoMike Kaganski
... so update comments accordingly Change-Id: I5fe423c510912dc3bc3e113afcd5c5daaba3d717 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119357 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-07-21Use Append here instead of InsertMike Kaganski
The containers are filled after resetting them. Change-Id: I6cd17fd47a84e755788a3b58fe72b451d6267e99 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119323 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-07-21IsVertical->IsEffectivelyVertical, GetDirectVertical->GetVerticalMike Kaganski
Before commit 653b53287ca09a9ffe3f5ce0242919e719c1086c, editengine objects had a pair IsVertical/SetVertical, which queried and set a boolean flag (and SetVertical also had a second argument to set another flag). The mentioned commit had introduced an inconsistency, changing SetVertical to only set a single flag, but at the same time making IsVertical to return a synthesized result from two values: vertical and rotation. Additionally, GetDirectVertical was introduced to complement SetVertical. In many places, the use of synthetic IsVertical looks suspicious, especially where it is used in combinations with SetVertical. But here I don't change existing logic, and only rename the methods, so that in case someone sees an actual problem, it would be easier to spot the method mismatch. The end result is that now we have a proper getter/setter pair GetVertical/SetVertical, and also IsEffectivelyVertical, named to reflect that it calculates its return value. Change-Id: I38e2b7c5bd7af0787dd7a1c48e1385138dac80b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119315 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-07-21Use MapUnit directly hereMike Kaganski
Change-Id: I745503ca1cae88519ac32e946849302b46e0ccb4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119297 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-07-21Prefix members of EditTextObjectImplMike Kaganski
... and re-arrange them a bit to optimize memory layout Change-Id: Ia543a68b446b9d9e49828112f3aa0054607cb2a9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119296 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-07-20Use standard algorithm hereMike Kaganski
It also compares sizes, so no need for duplicating check. Change-Id: Ica08af55da2ec8acfbeca333d32fe03929ee2cac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119189 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-07-20EditTextObject: use virtual interface instead of pimplMike Kaganski
Makes it simpler, and avoids extra allocations Change-Id: I301f628a2898f6421242808cbf8ce36c5acf9b0b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119241 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-07-20no need to allocate child array separately in SvxRTFItemStackTypeNoel Grandin
Change-Id: Ie40cc3b2d05bbb16a2b33a6beb4fdb804454333e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119250 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-07-20no need to store data separately in SvXMLAttrContainerItemNoel Grandin
Change-Id: Idea4289c600a81f5c8dbb389343ef57a9623d11d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119251 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-07-19Fix updating WhichRangesContainer using MergeRangeMike Kaganski
I forgot that MergeRange is not modifying its object, but returns a modified copy. Added SAL_WARN_UNUSED_RESULT to it (but it seems to not have effect on Windows). Change-Id: I919146fc25a0992d543890464ccac75737647ee5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119230 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-17blind fix for ubsan div/0Noel Grandin
Change-Id: I0ee929c79d5ac94299adc84ba91d6b0683a8193d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119095 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-07-16Use WhichRangesContainer in editengMike Kaganski
Change-Id: Ia6516df33341181990c2b8b8affa859395831007 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119013 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-07-15drop the Pair constructor from SfxItemSetNoel Grandin
just so we have one fewer odd constructors here Change-Id: I81278e9436747a4eb46a33da9bfec7a8b30079b9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118982 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-07-11editengine-columns: tdf#143258 Fix handling rotated textMike Kaganski
This reverts modifications to existing unit tests made in commit d0a1616ccad0dd5f5a02c1b0204f537b57d0b4b5. My idea that those changes were required because of more correct calculations was wrong, and in fact they were caused by off-by-1 error in height calculations. Change-Id: Ib94878a911238c977c35a8f8e3e5694cedc79a89 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118705 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-07-07tdf#132740 avoid some WeakReference cost in accessibilityNoel Grandin
reduces time by 20% for me Change-Id: Ife78248fd36099298eb2401b362f16a1ae3c0434 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118534 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-07-07tdf#132740 bypass work if selection has not changedNoel Grandin
takes 10% of the time off Change-Id: Ia0a2f4469088e103f162b7d85abb7fadc5f365cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118532 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>