summaryrefslogtreecommitdiff
path: root/sfx2/source/doc
AgeCommit message (Collapse)AuthorFilesLines
3 dayssw lok: .uno:SetDocumentProperties: add file size parameterPranam Lashkari1-3/+5
problem: in LOK/online to support async save, files in jails may have different extensions (ie: .upload, .uploading) this caused problem to detect files as original file name may not exist. As result property like file size were always set to 0 Change-Id: I552aef203297470d01032659a266210970129e66 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165769 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> (cherry picked from commit aa4e10efc6e9ac92b0c652f238526aacbe2096c6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166171 Tested-by: Jenkins
3 daysDrop FRound, and use generalized basegfx::froundMike Kaganski1-2/+2
Change-Id: I7447e649dc3ef4e51242f69c7486a3e84e103d2e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166159 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
13 daystdf#152336 Detect charset and separators for csv filesGabriel Masei1-0/+327
Change-Id: Ie8451b3d30e390d363d8f9e5ec8bdf47350ca3a2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164936 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
2024-04-02tdf#146619 Drop unused 'using namespace' in: sfx2/Gabor Kelemen4-4/+0
Change-Id: I3748612644c9c4eb88d7fb6e2d512954de9c1002 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165538 Tested-by: Jenkins Reviewed-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
2024-03-31Convert SfxDocumentMetaData to comphelper::WeakComponentImplHelperNoel Grandin1-194/+197
Change-Id: Ib633595008224ff11486e9ff72b6801d2dbfb887 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165580 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-03-21ITEM: Remove InvalidateAllItems()Armin Le Grand (allotropia)1-1/+1
I checked if this is used, but it can be replaced using Clear() -> all. This prevents that the whole array of Items in an ItemSet gets set to INVALID_POOL_ITEM. I also checked if INVALID_POOL_ITEM/IsInvalidItem is needed at all representing SfxItemState::DONTCARE but it is and still will need to be set for individual Items. At last checked if SfxItemState::UNKNOWN and ::DISABLED really need to be separate states, but indeed there are some rare cases that need that. To make things more consistent I also renamed SfxItemState::DONTCARE to SfxItemState::INVALID to better match Set/IsInvalid calls at ItemSet. The build showed a missing UT and led to a problem due to the hand-made ItemSet-like SearchAttrItemList. The state 'invalid' seems to be used as 'unused' marker. It should be changed to use SfxPoolItemHolder and not need that. For now, set by using an own loop to set to that state. Change-Id: Ifc51aad60570569a1e37d3084a5e307eed47d06c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165035 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2024-03-21Moving parts of readonly checks from model to view.Gökay Şatır1-1/+2
Summary for what's done with this commit: init.cxx * Add guards for modify commands. viewsh: * Add "IsCurrentLokViewReadOnly" for ease of use. unocitm: * Add guard for modify comamnds dispatch.cxx * Implement readonlyview. objmisc: * Modify IsReadOnlyUI check for LokReadOnly view. svx.sdi: * Disable TableChangeCurrentBorderPosition command for readOnly views. sw-editwin: * Treat mouse moves as readonly when the view is LokReadOnly. gridwin: * For autofilter. impedit2, inputhdl: * For text input. svdedtc: * For sdr object dragging. Change-Id: I71fc353976256bce22042bbb6042ee464b65cc13 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165093 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2024-03-18tdf#40244 tdf#160192: create tempFile elsewhere if LogicBase is ROJustin Luth1-0/+4
This avoids a crash/infinite loop in specific read-only folder situation (where the lock file already exists). It also fixes ODF files giving three misleading/unclear notices when attempting to save into a read-only folder. When LO saves a file, it saves to a temporary file and then moves that file overtop of the previous one, IIUC. Prior to 6.1 5259ab8104cfba60c40748ed0cd59d93df038c5b that temporary file was stored in the /tmp directory (IIUC), but was changed to be in the same folder for easier renaming, same filesystem etc. Note that typically this situation would fail since a locking file also could not be created. However in the case where the lock file already exists, then all the pieces are in place to actually modify the document. By falling back to the /tmp folder if the document's folder is read-only, we can still modify a writeable document. Change-Id: Ie027fc05934f2c071f7a91007255801c179bff49 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164841 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2024-03-15tdf#160192: avoid hang when trying to overwrite doc/lockfile in RO dirJustin Luth1-1/+1
Bug exposed with 6.1 5259ab8104cfba60c40748ed0cd59d93df038c5b sfx2 store: create temp files next to local files tested on .doc format, code-read suggests it affects xls/ppt too, but they throw exceptions, apparently before hitting this section. I was seeing an infinite loop on SfxOleSection::SaveProperty's while((rStrm.Tell() & 3)) rStrm.WriteUChar( 0 ); because nothing checks to confirm that the tempfile is actually created/useable. Now, instead of an infinite loop, we get a crash... Change-Id: I9e093432361a8ad6f928ec9b47290274b3d4ef06 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164840 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com>
2024-03-11Disallow closing document during generation of previewMike Kaganski2-3/+36
Using an external (Java) script that opens a document, and then quickly closes it, it may happen that the idle that generates a preview is still active, when the control thread calls XCloseable::close, which destroys still used document. This leads to use-after-free. This uses the close listener in SfxObjectShell, to veto closing document that is still in use by the preview generation code. After completion, when the caller of close() transferred ownership, then the call to close is repeated. Change-Id: I39691f61ad5141d7e8ee54723d5aef87f0bc01dc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164632 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-03-11Use weak reference to SfxObjectShell in SfxEventHint to avoid use-after-freeMike Kaganski1-2/+2
The events may be processed after the shell has been destroyed. This is happening reliably after commit e2bfc34d146806a8f96be0cd2323d716f12cba4e (Reimplement OleComponentNative_Impl to use IGlobalInterfaceTable, 2024-03-11) when controlling LibreOffice from external Java scripts; but obviously, it could happen before as well. Now SotObject inherits from cppu::OWeakObject, instead of SvRefBase. Change-Id: I73a3531499a3068c801c98f40de39bdf8ad90b2b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164458 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-26Use SHGetKnownFolderPath, to avoid MAX_PATH limitationMike Kaganski1-2/+3
Change-Id: If7e70453bd67ec874fc06af7cd53a8c410a24e52 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163912 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-23Fix warning C4312 when building with MSVC without -Wv:18Mike Kaganski1-1/+2
Discovered by https://gerrit.libreoffice.org/c/core/+/163717 Like these: C:/lo/core/sw/source/ui/dbui/addresslistdialog.cxx(426): warning C4312: 'reinterpret_cast': conversion from 'int' to 'void *' of greater size Change-Id: Idbfbe8add89c8e219bdabcf28b741e2e31a5e345 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163781 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-15i#112829: offer svg as clipboard format as wellDamjan Jovanovic1-8/+39
When copying charts, shapes, etc. out of LibreOffice, export them to the clipboard in the (lossless) SVG graphics format as well. This can be pasted into GIMP, Inkscape, and other apps, unlike our current WMF/EMF clipboard formats which use private MIME types that nothing supports. (cherry picked from commit 61aee323790d0a1ed0745ee5a84b8885bcd0a559) Change-Id: Ia32be448a096154bb092d49f372148c6b2263f35 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163412 Tested-by: Thorsten Behrens <thorsten.behrens@allotropia.de> Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2024-02-14tdf#159707: fix crash when changing to edit mode (calc)Julien Nabet1-1/+1
bt: 0x00007f9eb4b902f2 in com::sun::star::uno::Reference<com::sun::star::frame::XModel>::operator->() const (this=0x55b8c2b54888) at include/com/sun/star/uno/Reference.h:387 0x00007f9eb4c03584 in ScVbaEventsHelper::notifyEvent(com::sun::star::document::EventObject const&) (this=0x55b8c2b54840, rEvent=...) at /home/julien/lo/libreoffice/sc/source/ui/vba/vbaeventshelper.cxx:605 0x00007f9ef464bd3c in (anonymous namespace)::NotifySingleListenerIgnoreRE<com::sun::star::document::XEventListener, com::sun::star::document::EventObject>::operator()(com::sun::star::uno::Reference<com::sun::star::document::XEventListener> const&) const (this=0x7ffc5044dfc0, listener=uno::Reference to (ScVbaEventsHelper *) 0x55b8c2b54870) at /home/julien/lo/libreoffice/sfx2/source/doc/sfxbasemodel.cxx:3293 0x00007f9ef463b8aa in comphelper::OInterfaceContainerHelper3<com::sun::star::document::XEventListener>::forEach<(anonymous namespace)::NotifySingleListenerIgnoreRE<com::sun::star::document::XEventListener, com::sun::star::document::EventObject> >((anonymous namespace)::NotifySingleListenerIgnoreRE<com::sun::star::document::XEventListener, com::sun::star::document::EventObject> const&) (this=0x55b8c2735c18, func=...) at include/comphelper/interfacecontainer3.hxx:279 0x00007f9ef463b010 in SfxBaseModel::postEvent_Impl(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::frame::XController2> const&, com::sun::star::uno::Any const&) (this=0x55b8c2308ae0, aName="OnUnload", xController=empty uno::Reference, supplement=uno::Any(void)) at /home/julien/lo/libreoffice/sfx2/source/doc/sfxbasemodel.cxx:3338 0x00007f9ef463a089 in SfxBaseModel::Notify(SfxBroadcaster&, SfxHint const&) (this=0x55b8c2308ae0, rBC=..., rHint=...) at /home/julien/lo/libreoffice/sfx2/source/doc/sfxbasemodel.cxx:2960 See full bt here: https://bugs.documentfoundation.org/attachment.cgi?id=192546 Regression from: https://git.libreoffice.org/core/+/d2fccf0117a37f8aab8bb50ece419987f06af6b9%5E%21 "cool#6893 improve listeners in SfxBaseModel" Change-Id: I372808dade20c47275ab599054d8e9572dc3da4d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163356 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins
2024-02-08tdf#158975 Add option to not write temp file next to local fileSamuel Mehrbrodt1-0/+2
This causes permission issues in some setups. See bug report for details. Change-Id: If97030f95185ab96e21cec968b734fba8a811f9d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163003 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2024-02-02Add SfxMedium::IsRepairPackageMike Kaganski4-18/+14
Change-Id: Id100e5a85a0504ab4fb80f75a168a4fd31a54119 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162924 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-01tdf#154587: allow directory entries in ZIP packagesMike Kaganski1-3/+12
The problem in the bugdoc was the directory entries. These entries are valid in ZIP packages (even if not common); they may be useful to e.g. define per-directory permissions (ACLs). In normal mode, ZipFile reads central directory; there we can read if the entry has FAT file attributes; and then, if the entry is a directory. Then it is OK to skip it. In repair mode, central directory is not used, local file headers don't contain a "directory" flag. A workaround is used, checking if there are entries that represent directories of other entries. Also this change fixes some places that didn't pass the recovery flag correctly. Change-Id: I324671841a2c4d0f279b03801d95c8f2eeb99b46 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162888 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-01tdf#159496: clear mxObjectContainer in PrepareSecondTryLoad_ImplMike Kaganski1-0/+1
The problem here is that the object container has own reference to the storage object. In SfxBaseModel::load, when preparing for a second try, the storage gets disposed, and a cleanup is performed; but previously, the reference to the disposed storage was used in the object container, and thus generated a failure when it was used to import the OLE. Clearing it allows to re-create it properly, with the updated storage. Change-Id: I08b7503d79240ccc51b253fe1f4e99a0232995b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162866 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-01sc: put used currencies on top of the currency pop-up listTomaž Vajngerl1-0/+6
The list of currencies is fairly long and there is no easy way to search the list, so to make it easier to concurrently fint the desired currency, put the currencies that are used in the document on top of the list. This adds a DocumentModelAccessor class, which is used to access parts of the document model from other modules throught the SfxObjectShell. Change-Id: I81a180b674ae69b373b0422f363678e8bab37194 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162638 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com> (cherry picked from commit 79da840fac78f11c156801c43d8b79d6d4f32869) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162755 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2024-01-30just get SfxViewShell::Current onceCaolán McNamara1-2/+2
Change-Id: Ie4d86076af63b68c7ae61570ce8e2b9ce8509e50 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162690 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-01-27Drop std::as_const from css::uno::Sequence iterationsMike Kaganski8-8/+8
Obsoleted by commit 2484de6728bd11bb7949003d112f1ece2223c7a1 (Remove non-const Sequence::begin()/end() in internal code, 2021-10-15) and commit fb3c04bd1930eedacd406874e1a285d62bbf27d9 (Drop non-const Sequence::operator[] in internal code, 2021-11-05). Change-Id: Idbafef5d34c0d4771cbbf75b9db9712e504164cd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162640 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-01-24sfx2: check SfxViewShell::Current()Xisco Fauli1-1/+1
Seen in https://crashreport.libreoffice.org/stats/crash_details/52df6de5-7ea8-48e4-8c45-f18b02d9a767 Change-Id: I56c17234a0f82797d37e26b0c39eeba7f78fcee5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162492 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-01-23Make wholesome ODF package encryption the defaultThorsten Behrens1-2/+1
Change-Id: I825ae7a5e4b80d390804a7bb2cfdfc3b1843bd07 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162066 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2024-01-23ITEM: Solve SfxVoidItem(0) situationArmin Le Grand (allotropia)1-1/+1
An instance of SfxVoidItem(0) was used to signal the SfxItemState::DISABLED. This was done not only using WhichID == 0, but using isVoidItem() at the SfxPoolItem. Unfortunately this mixes up with usages of SfxVoidItems, mostly for UI stuff/Slots. This also means that all the time an SfxVoidItem had to be cloned/delete when when added/removed from ItemSet or ItemHolder. Much more action than e.g. for INVALID_POOL_ITEM which we already use by havong just a simple ptr to a single static instance of an Item. Disabled should do the same thing. Unfortunately also the functionality was mixed with non-SfxItemState::DISABLED purposes and these were very hard to be separated. But the current solution works now after some quirks doing that. It even oes no more need the isVoidItem() flag at the SfxPoolItem. Change-Id: I99f03db144f541ae4ea35f3775b3b3d58a375a81 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162414 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2024-01-17Eliminate hang in iOS app (and maybe the Android app) during exportPatrick Luby1-10/+58
When exporting a document via this path, such as exporting to PDF via the .uno:ExportToPDF command, any exceptions thrown while saving the current document will leave the app in a blocked state if a "PENDING" message has been sent. The iOS app (and maybe the Android app) fails to set the URL to save to so we need to set it to a temporary file. Note: the iOS app is responsible for deleting the temporary file. Also, enable building iOS with TLS=OPENSSL by default. Signed-off-by: Patrick Luby <plubius@libreoffice.org> Change-Id: Ibc070bed4e792bb0a481d2b900d12d214e3c519f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161692 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Andras Timar <andras.timar@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162125 Tested-by: Jenkins
2024-01-17ITEM: Remove suspicious extra-Which in ::PutArmin Le Grand (allotropia)1-1/+1
The ::Put methods at SfxItemSet had an extra WhichID parameter that was not really documented, but I would guess often asked why it exists: An extra WhichID, just called 'nWhich' (which makes things NOT clearer). That is 'strange' since the Item given to be put already internally has a WhichID, so why a 2nd one? If you were really interested and read all that code (no, no comments on that anywhere) you might know that this a kind of 'Target-WhichID' under which the Item shall be put to the ItemSet. Since this is unclear for most people it is even dangerous and explains why so many code places just hand over the WhichID requsted from the Item that already gets handed over. To make it short: I removed that. For the 19 places where this was really needed I added a new method besides ::Put called ::PutAsTargetWhich that takes that extra WhichID (now called TargetWhich) and takes the needed actions. These are quite some because that may be combined with the bPassingOwnership flag, see new SfxItemSet::PutImplAsTargetWhich method. This makes usage of ItemSets/Items less dangerous. It also simplifies and thus makes safer the central helpers implCreateItemEntry/implCleanupItemEntry which have some less cases to handle. Debugged the failing UnitTests showed that there is an incarnate Item != SfxVoidItem that causes problems. I checked for errors in the change, but no luck. Afterr some time I found out that a ::Clone implementation caused the problem: These need to also copy the WichID of the original, but the SfxFrameItem failed to do so. This did not cause problems in the former version because implCreateItemEntry was designed to set a missing/ different WhichID. I corrected that in SfxFrameItem, also removed not needed costructor that caused that. Also added a SAL_WARN and a correction in implCreateItemEntry. I could have added an assert (did so for running local UnitTests), but should be enough. NOTE: When hunting for Items except SfxVoidItem that get crerated using a WhichID '0' i learned that this indeed happens: There are some (5) calls to SfxRequest::SetReturnValue that incarnate an SfxBoolItem with WhichID '0' (ZERO). This is not good and I think about how to change that... Change-Id: I9854a14cdc42d1cc19c7b9df65ce74147d680825 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162124 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2024-01-16tdf#53614 - Don't try to lock file after cancelling the import processAndreas Heinisch1-1/+3
After cancelling the import process don't try to lock the file. Otherwise, the document in use dialog will be shown which has literally no effect. Change-Id: I0a9c786899a7fc648678c785e316d28fc43c7fe7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162150 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2024-01-11tdf#158937 Allow cancel of password dialog during recoveryMatt K1-1/+1
The problem is that when a user cancels the password dialog during recovery, the code tries to do something with the doc, but there is no doc yet because the file is password protected and not opened, so it crashes. The fix is just to check for the absence of errors before using the doc (canceling the password dialog is considered an abort/ general IO error). Change-Id: Ia76d8e4ff8212427d6b7b0a67ce1971b9ea8a48d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161844 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-01-09sfx2: reorder the checks in SfxBaseModel::postEvent_Impl()Michael Stahl1-8/+8
It doesn't make sense to copy m_pData after impl_isDisposed() checks if it's null (not sure if this makes a difference in practice). Change-Id: I5c6db0bd3e09f92acef346115a4fee44ae4c0a89 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161835 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2024-01-08cid#1545370 COPY_INSTEAD_OF_MOVECaolán McNamara1-1/+2
and cid#1545364 COPY_INSTEAD_OF_MOVE cid#1545363 COPY_INSTEAD_OF_MOVE cid#1545344 COPY_INSTEAD_OF_MOVE cid#1545299 COPY_INSTEAD_OF_MOVE cid#1545287 COPY_INSTEAD_OF_MOVE cid#1545267 COPY_INSTEAD_OF_MOVE cid#1545256 COPY_INSTEAD_OF_MOVE cid#1545226 COPY_INSTEAD_OF_MOVE cid#1545500 COPY_INSTEAD_OF_MOVE cid#1545538 COPY_INSTEAD_OF_MOVE cid#1545618 COPY_INSTEAD_OF_MOVE cid#1545681 COPY_INSTEAD_OF_MOVE cid#1545750 COPY_INSTEAD_OF_MOVE cid#1545778 COPY_INSTEAD_OF_MOVE cid#1545785 COPY_INSTEAD_OF_MOVE cid#1545799 COPY_INSTEAD_OF_MOVE cid#1545847 COPY_INSTEAD_OF_MOVE cid#1545958 COPY_INSTEAD_OF_MOVE cid#1545963 COPY_INSTEAD_OF_MOVE cid#1545990 COPY_INSTEAD_OF_MOVE cid#1546013 COPY_INSTEAD_OF_MOVE cid#1546029 COPY_INSTEAD_OF_MOVE cid#1546079 COPY_INSTEAD_OF_MOVE cid#1546104 COPY_INSTEAD_OF_MOVE cid#1546127 COPY_INSTEAD_OF_MOVE cid#1546133 COPY_INSTEAD_OF_MOVE cid#1546155 COPY_INSTEAD_OF_MOVE cid#1546190 COPY_INSTEAD_OF_MOVE cid#1546216 COPY_INSTEAD_OF_MOVE cid#1546273 COPY_INSTEAD_OF_MOVE cid#1546315 COPY_INSTEAD_OF_MOVE cid#1546326 COPY_INSTEAD_OF_MOVE cid#1546387 COPY_INSTEAD_OF_MOVE accept some reasonable suggestions Change-Id: I7b004086d490c7618d8fe7a21a53cfa8ac1f8408 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161748 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-01-05Use officecfg instead of SvtFilterOptions wrapper in sfx2, sd, ooxGabor Kelemen1-3/+1
Change-Id: I1a404fe156c9c7859c1eb19d4dff9892f4598bc9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161591 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2023-12-31cid#1546464 COPY_INSTEAD_OF_MOVECaolán McNamara1-2/+1
and cid#1546346 COPY_INSTEAD_OF_MOVE cid#1546342 COPY_INSTEAD_OF_MOVE cid#1546320 COPY_INSTEAD_OF_MOVE cid#1546305 COPY_INSTEAD_OF_MOVE cid#1546241 COPY_INSTEAD_OF_MOVE cid#1546162 COPY_INSTEAD_OF_MOVE cid#1546118 COPY_INSTEAD_OF_MOVE cid#1546048 COPY_INSTEAD_OF_MOVE cid#1545989 COPY_INSTEAD_OF_MOVE cid#1545936 COPY_INSTEAD_OF_MOVE Change-Id: I63bc43378b36f7c49e66231152138ad7038971e1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161507 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-12-31Replace "size() == 0 with empty()" (sfx2)Julien Nabet1-1/+1
Change-Id: I6bdb18319e45fbe8641a2ded31e60c2628bb1b67 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161468 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-12-30move IsFuzzing to comphelperCaolán McNamara3-9/+10
and try something a bit more generic Change-Id: I1d8256576cd02f0a589df350ba7b53059dd586a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161250 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-12-28Added boolean op's to SfxPoolItemHolderArmin Le Grand (allotropia)2-2/+2
...and adapted code to make use of it. This makes checking if the SfxPoolItemHolder instance contains an Item or not simpler and thus more readable, no need to access the Item* every time using getItem() - is okay, but not intuitive. Change-Id: I8042267cce670aca2641a91cd36285058f17ffbb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161380 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-12-22cid#1546500 COPY_INSTEAD_OF_MOVECaolán McNamara1-3/+3
and cid#1546492 COPY_INSTEAD_OF_MOVE cid#1546468 COPY_INSTEAD_OF_MOVE cid#1546431 COPY_INSTEAD_OF_MOVE cid#1546382 COPY_INSTEAD_OF_MOVE cid#1546350 COPY_INSTEAD_OF_MOVE cid#1546336 COPY_INSTEAD_OF_MOVE cid#1546314 COPY_INSTEAD_OF_MOVE cid#1546152 COPY_INSTEAD_OF_MOVE cid#1546094 COPY_INSTEAD_OF_MOVE cid#1546077 COPY_INSTEAD_OF_MOVE cid#1546047 COPY_INSTEAD_OF_MOVE cid#1545213 COPY_INSTEAD_OF_MOVE Change-Id: Ia51df9f9cbde755db4d2685e34f22676ed5eceff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161141 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-12-21Remove DeleteItemOnIdlexArmin Le Grand (allotropia)3-12/+15
There are some CrashReports in 7.6 which have DeleteItemOnIdle on the stack, but there is nothing reproducable. So I took a look... I first thought it's a MCGR regression, due to classes on the stack. But the Item involved is just random, can happen with any Item. Then I thought it may have to do with ITEM refactorings, but it happens with DeleteItemOnIdle involved, so also not the case. I already saw DeleteItemOnIdle when doing these and qualified as 'hack' in the way. already It is only on Windows and DeleteItemOnIdle is involved. This again (took a deeper look now) is an old hack to keep an SfxPoolItem 'alive' for some 'time'. For that, it triggers an async reschedule which then deletes the Item when being called. If the Item will be used after that is pure coincidence - seems to work in most cases. It seems as if for Windows the timing slightly changed for some scenarios, so a reschedule is too early. This can happen with this hack anytime. DeleteItemOnIdle is used in scenarios where SfxPoolItem* is e.g. returned, but is *not* anchored, so e.g. not member of an SfxItemSet. Or in short: Lifetime is not safe. DeleteItemOnIdle exists since 1st import, but was changed to AsyncEvent ca. 4 months ago (see 57145acf9ec47c23e307b7a5c0029d21d937cc35), so that may have caused it. It is possible that these errors happen on Windows since then. Before something more complicated was used to delete it late, but surely also not really safe. Due to ITEM refactor I have the knowledge/tooling to solve this. It will not be a 1-5 lines fix, but it is a hack and in the way for further ITEM refactor anyways. What we have nowadays is a SfxPoolItemHolder -> it's like an SfxItemSet for a single Item. It safely holds/ controls the lifetime of an SfxPoolItem. It is already used in quite some places. It helps to solve many hacks, also the ones putting Items directly to the Pool - due to there never was an alternative for that. In principle the ItemPool/ItemSet/Item paradigm was never complete without SfxPoolItemHolder. Thus I started to fix that (and remove that hack for good, sooo many changes over the years, sigh), but as said is not straightforward. Will have to change retvals of involved stuff to SfxPoolItemHolder - it's just two pointers and designed to be copied (one is a Pool, needed to cleanup when destructing). CopyConstruct/destroy just counts the RefCnt up/down, so cheap. 1st version compiling, let's check on gerrit... Corrected one error in QueryState for securitypage, also added some security features/asserts. Change-Id: Ida49fd35ca88ead84b11d93e18b978cb9e395090 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161083 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-12-20tdf#105844 offapi,package,sfx2: use Argon2 for wholesome ODF encryptionMichael Stahl1-1/+7
https://www.rfc-editor.org/rfc/rfc9106.html * add css::xml::crypto::KDFID constant group * add "KeyDerivationFunction" to setEncryptionAlgorithms sequence * Argon2 is used by default for wholesome ODF encryption, but $LO_ARGON2_DISABLE can be set to use PBKDF2 * extend various structs in package * use 3 new ODF attributes "loext:argon2-iterations" "loext:argon2-memory" "loext:argon2-lanes" to store the arguments * use this URL for now: "urn:org:documentfoundation:names:experimental:office:manifest:argon2id" * use default arguments according to second recommendation from "7.4. Recommendations" of RFC9106; 64 MiB RAM should hopefully not be too much even for 32 bit builds Change-Id: I683118cc5e0706bd6544db6fb909096768ac9920 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161009 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2023-12-20cid#1545835 COPY_INSTEAD_OF_MOVECaolán McNamara1-2/+1
and cid#1545830 COPY_INSTEAD_OF_MOVE cid#1545798 COPY_INSTEAD_OF_MOVE cid#1545784 COPY_INSTEAD_OF_MOVE cid#1545753 COPY_INSTEAD_OF_MOVE cid#1545752 COPY_INSTEAD_OF_MOVE cid#1545672 COPY_INSTEAD_OF_MOVE Change-Id: Iaf2f77cb27ae0ea1585416a0c500f7c50d04e3fb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161007 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-12-14tdf#105844 sfx2: add another consistency checkMichael Stahl1-2/+15
SfxMedium::TryEncryptedInnerPackage() checks same mimetype of inner and outer package for ODF wholesome encryption. Change-Id: I8a5ef463c5f604a59573fb0f9e15453f22d867d6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160767 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2023-12-13tdf#105844 package,sfx2: remove checksum infoleak when using AEADMichael Stahl1-1/+1
AEAD provides the verification of the password automatically, by reading the entire stream the tag at the end will be verified. The existing attributes manifest:checksum-type/manifest:checksum leak information about the plain text. This was mitigated with the addChaffWhenEncryptedStorage() functions (see commit f57baefbd3c4c5d8e5ec28e8702c91d60ffc5de2) but a better solution that also works for non-XML streams is to simply omit the attributes; authenticated encryption provides better verification without any leak. * "ChecksumAlgorithm" property can be set to void now to remove the checksum * change a bunch of members in EncryptionData, ZipPackage, ZipPackageStream to optional * change ZipFile::checkValidPassword() to open the stream and return it Change-Id: Id95288d0c238c4f9940fc5a185df814e8edcbad3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160711 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2023-12-13sfx2: remove wrong assertsMichael Stahl1-3/+0
Mike Kaganski points out that "soffice -n anything.docx" triggers the one in GetOutStream(), called from SfxMedium::CreateTempFile() !bTransferSuccess path, so the assumption of which parts of SfxMedium can be in use concurrently was wrong. Change-Id: I40f321d71297cadcdf4bf9ba6f07c4db3d2ac523 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160712 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2023-12-11tdf#105844 offapi,package,sfx2,xmlsecurity: add AEAD w/ AES GCMMichael Stahl1-4/+16
... and use it in the new experimental ODF encryption mode. https://www.w3.org/TR/xmlenc-core1/#sec-AES-GCM Unfortunately it turned out that NSS PK11_CipherOp() does not work with CKM_AES_GCM because it is initialized with "context->multi = PR_FALSE" in sftk_CryptInit(), so the one-step functions PK11_Encrypt() and PK11_Decrypt() have to be used. NSS 3.52 also changed a parameter struct definition - see https://fedoraproject.org/wiki/Changes/NssGCMParams - which is not a problem for RHEL or SUSE system NSS since those are rebased, but it is likely a problem for less well maintained Ubuntu LTS, so use the old struct definition which evidently still works with NSS 3.94. NSS 3.52 also added a new PK11_AEADOp() API but it looks like this doesn't support incremental encryption either. Change-Id: Ibd4a672db74b65b1218926ba35ff8d2f70444c7e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160505 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2023-12-10cid#1545177 COPY_INSTEAD_OF_MOVECaolán McNamara1-2/+1
and cid#1545179 COPY_INSTEAD_OF_MOVE cid#1545187 COPY_INSTEAD_OF_MOVE cid#1545188 COPY_INSTEAD_OF_MOVE cid#1545189 COPY_INSTEAD_OF_MOVE cid#1545196 COPY_INSTEAD_OF_MOVE cid#1545197 COPY_INSTEAD_OF_MOVE cid#1545204 COPY_INSTEAD_OF_MOVE cid#1545223 COPY_INSTEAD_OF_MOVE cid#1545236 COPY_INSTEAD_OF_MOVE cid#1545239 COPY_INSTEAD_OF_MOVE cid#1545253 COPY_INSTEAD_OF_MOVE cid#1545274 COPY_INSTEAD_OF_MOVE cid#1545286 COPY_INSTEAD_OF_MOVE cid#1545309 COPY_INSTEAD_OF_MOVE cid#1545311 COPY_INSTEAD_OF_MOVE cid#1545345 COPY_INSTEAD_OF_MOVE cid#1545358 COPY_INSTEAD_OF_MOVE cid#1545361 COPY_INSTEAD_OF_MOVE cid#1545365 COPY_INSTEAD_OF_MOVE cid#1545367 COPY_INSTEAD_OF_MOVE cid#1545372 COPY_INSTEAD_OF_MOVE cid#1545373 COPY_INSTEAD_OF_MOVE cid#1545377 COPY_INSTEAD_OF_MOVE cid#1545392 COPY_INSTEAD_OF_MOVE cid#1545399 COPY_INSTEAD_OF_MOVE cid#1545404 COPY_INSTEAD_OF_MOVE cid#1545408 COPY_INSTEAD_OF_MOVE cid#1545430 COPY_INSTEAD_OF_MOVE cid#1545439 COPY_INSTEAD_OF_MOVE cid#1545449 COPY_INSTEAD_OF_MOVE Change-Id: I3afe836a0bbc8bd70937035e60eb020435e413d2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160539 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-12-10Keep original errorMike Kaganski2-2/+3
Fix several SetError implementations, to make sure that original errors are not rewritten, but OTOH warnings could be replaced by errors. Change-Id: Ic5e71b791ff3426ff1144778a610ab77fcbf24d1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160530 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-12-10cid#1546281 COPY_INSTEAD_OF_MOVECaolán McNamara1-2/+1
and cid#1546278 COPY_INSTEAD_OF_MOVE cid#1546276 COPY_INSTEAD_OF_MOVE cid#1546247 COPY_INSTEAD_OF_MOVE cid#1546244 COPY_INSTEAD_OF_MOVE cid#1546243 COPY_INSTEAD_OF_MOVE cid#1546220 COPY_INSTEAD_OF_MOVE cid#1546209 COPY_INSTEAD_OF_MOVE cid#1546207 COPY_INSTEAD_OF_MOVE cid#1546206 COPY_INSTEAD_OF_MOVE cid#1546205 COPY_INSTEAD_OF_MOVE cid#1546197 COPY_INSTEAD_OF_MOVE cid#1546180 COPY_INSTEAD_OF_MOVE cid#1546172 COPY_INSTEAD_OF_MOVE cid#1546165 COPY_INSTEAD_OF_MOVE cid#1546164 COPY_INSTEAD_OF_MOVE cid#1546158 COPY_INSTEAD_OF_MOVE cid#1546151 COPY_INSTEAD_OF_MOVE cid#1546135 COPY_INSTEAD_OF_MOVE cid#1546132 COPY_INSTEAD_OF_MOVE cid#1546129 COPY_INSTEAD_OF_MOVE cid#1546128 COPY_INSTEAD_OF_MOVE cid#1546122 COPY_INSTEAD_OF_MOVE cid#1546117 COPY_INSTEAD_OF_MOVE cid#1546113 COPY_INSTEAD_OF_MOVE cid#1546106 COPY_INSTEAD_OF_MOVE cid#1546099 COPY_INSTEAD_OF_MOVE cid#1546091 COPY_INSTEAD_OF_MOVE cid#1546085 COPY_INSTEAD_OF_MOVE cid#1546069 COPY_INSTEAD_OF_MOVE cid#1546063 COPY_INSTEAD_OF_MOVE cid#1546062 COPY_INSTEAD_OF_MOVE cid#1546058 COPY_INSTEAD_OF_MOVE cid#1546056 COPY_INSTEAD_OF_MOVE cid#1546051 COPY_INSTEAD_OF_MOVE cid#1546040 COPY_INSTEAD_OF_MOVE cid#1546030 COPY_INSTEAD_OF_MOVE cid#1546028 COPY_INSTEAD_OF_MOVE cid#1546015 COPY_INSTEAD_OF_MOVE cid#1546001 COPY_INSTEAD_OF_MOVE Change-Id: Ib954c92a300fc323b29f27880fdf8bc46ed98862 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160520 Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-12-07sfx2: simplify SetCommonStorageEncryptionData() callsMichael Stahl2-54/+17
Some of these look redundant, as SfxMedium::GetStorage() already does this earlier. Change-Id: Iba178196898adfd4ee260da908c7298f3f2c1734 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160408 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2023-12-07tdf#105844 package,sfx2: wholesome ODF package wrapping encryptionMichael Stahl4-29/+323
Redo the ODF encryption by storing an ODF package and wrapping it as a stream "encrypted-package" in another ODF package, such that there is only one encrypted stream - this requires only one KDF computation. * This is only enabled in Experimental mode for now. * Avoid storing unencrypted data in the pTempFile of SfxMedium, as it is usually created in the same directory as the target file, which may be on a network share or similar less trusted location. * SfxMedium::SetEncryptionDataToStorage_Impl() should just set an error status if it fails (how can it fail anyway) * when loading a document, SfxDocPasswordVerifier extracts an encrypted inner package (by calling SfxMedium::TryEncryptedInnerPackage()) * SfxMedium::GetStorage() automatically decrypts an encrypted inner storage and sets it as the SfxMedium's xStorage * when storing a document, SfxObjectShell::SaveTo_Impl() creates the wrapped storages * One challenge is to keep the macro/scripting signature working; this can only be put in the inner storage, whereas the document signature should continue to be on the outer storage; also it must use a Zip storage, to see the "META-INF" directory. This needs a new SfxMedium::GetScriptingStorageToSign_Impl() and changes in SfxMedium::SignContents_Impl(). Change-Id: Ibfee36ce3a9cd030f2aa2ce1484b6d001cba2389 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160401 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2023-12-07some cosmetic improvements, better warningsMichael Stahl1-8/+7
Change-Id: I05a7eeb74088c278aab94519c7f53b0482e38058 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160400 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>