include/svx/svdobj.hxx | 2 package/source/xstor/xstorage.cxx | 93 +++++++++++++++++++------------------- package/source/xstor/xstorage.hxx | 3 + svx/source/svdraw/svdobj.cxx | 29 ++++------- vcl/source/outdev/map.cxx | 2 5 files changed, 62 insertions(+), 67 deletions(-)
New commits: commit a89cd9173b9c5145416c1fba3877ae9edd44337d Author: Noel Grandin <[email protected]> AuthorDate: Wed Jan 7 17:25:35 2026 +0100 Commit: Andras Timar <[email protected]> CommitDate: Wed Jan 14 11:55:27 2026 +0100 tdf#170257 Dragging a shape over another shape changes positions Revert the following commit which seems to have caused this problem commit 11fd1adad3b23b57cfc6ffde88672154b02b15b6. tdf#154913 empty is a valid value for m_aOutRect Change-Id: I3e4ef9b27021f76e3e474d00ec59cc8e1784dfff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196781 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> (cherry picked from commit 64dfe34cdc0f7db90804bceb25f1e19e534d4d1b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196965 Reviewed-by: Adolfo Jayme Barrientos <[email protected]> diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx index 6fddea9c5fb3..13a1dba2e602 100644 --- a/include/svx/svdobj.hxx +++ b/include/svx/svdobj.hxx @@ -875,14 +875,12 @@ public: protected: const tools::Rectangle& getOutRectangle() const; - bool isOutRectangleSet() const { return m_bOutRectangleSet; } void setOutRectangleConst(tools::Rectangle const& rRectangle) const; // need to do something about this void setOutRectangle(tools::Rectangle const& rRectangle); void resetOutRectangle(); void moveOutRectangle(sal_Int32 nXDelta, sal_Int32 nYDelta); mutable tools::Rectangle m_aOutRect; // surrounding rectangle for Paint (incl. LineWidth, ...) - mutable bool m_bOutRectangleSet; // empty is a valid rectangle, so we need a separate flag to know when the cached value is not yet set Point m_aAnchor; // anchor position (Writer) SdrObjUserCall* m_pUserCall; std::unique_ptr<SdrObjPlusData> diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 9b27feffcd83..c6ded1570cd4 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -339,7 +339,6 @@ void impRemoveIncarnatedSdrObjectToSdrModel(SdrObject& rSdrObject, SdrModel& rSd SdrObject::SdrObject(SdrModel& rSdrModel) : mpFillGeometryDefiningShape(nullptr) , mrSdrModelFromSdrObject(rSdrModel) - , m_bOutRectangleSet(false) , m_pUserCall(nullptr) , mpImpl(new Impl) , mpParentOfSdrObject(nullptr) @@ -376,7 +375,6 @@ SdrObject::SdrObject(SdrModel& rSdrModel) SdrObject::SdrObject(SdrModel& rSdrModel, SdrObject const & rSource) : mpFillGeometryDefiningShape(nullptr) , mrSdrModelFromSdrObject(rSdrModel) - , m_bOutRectangleSet(false) , m_pUserCall(nullptr) , mpImpl(new Impl) , mpParentOfSdrObject(nullptr) @@ -958,12 +956,13 @@ void SdrObject::SetNavigationPosition (const sal_uInt32 nNewPosition) // GetCurrentBoundRect(). const tools::Rectangle& SdrObject::GetCurrentBoundRect() const { - if (!isOutRectangleSet()) + auto const& rRectangle = getOutRectangle(); + if (rRectangle.IsEmpty()) { const_cast< SdrObject* >(this)->RecalcBoundRect(); } - return getOutRectangle(); + return rRectangle; } // To have a possibility to get the last calculated BoundRect e.g for producing @@ -993,27 +992,22 @@ void SdrObject::RecalcBoundRect() GetViewContact().getViewIndependentPrimitive2DContainer(xPrimitives); if (xPrimitives.empty()) - { - setOutRectangle(tools::Rectangle()); return; - } // use neutral ViewInformation and get the range of the primitives const drawinglayer::geometry::ViewInformation2D aViewInformation2D; const basegfx::B2DRange aRange(xPrimitives.getB2DRange(aViewInformation2D)); - if (aRange.isEmpty()) + if (!aRange.isEmpty()) { - setOutRectangle(tools::Rectangle()); + tools::Rectangle aNewRectangle( + tools::Long(floor(aRange.getMinX())), + tools::Long(floor(aRange.getMinY())), + tools::Long(ceil(aRange.getMaxX())), + tools::Long(ceil(aRange.getMaxY()))); + setOutRectangle(aNewRectangle); return; } - - tools::Rectangle aNewRectangle( - tools::Long(floor(aRange.getMinX())), - tools::Long(floor(aRange.getMinY())), - tools::Long(ceil(aRange.getMaxX())), - tools::Long(ceil(aRange.getMaxY()))); - setOutRectangle(aNewRectangle); } void SdrObject::BroadcastObjectChange() const @@ -3263,19 +3257,16 @@ const tools::Rectangle& SdrObject::getOutRectangle() const void SdrObject::setOutRectangleConst(tools::Rectangle const& rRectangle) const { m_aOutRect = rRectangle; - m_bOutRectangleSet = true; } void SdrObject::setOutRectangle(tools::Rectangle const& rRectangle) { m_aOutRect = rRectangle; - m_bOutRectangleSet = true; } void SdrObject::resetOutRectangle() { m_aOutRect = tools::Rectangle(); - m_bOutRectangleSet = false; } void SdrObject::moveOutRectangle(sal_Int32 nXDelta, sal_Int32 nYDelta) commit 124188d4ce292d45eadef06b16b4d5c578e1706d Author: Christopher Sherlock <[email protected]> AuthorDate: Mon Jan 5 00:45:53 2026 +1100 Commit: Andras Timar <[email protected]> CommitDate: Wed Jan 14 11:55:27 2026 +0100 vcl: fix error in ImplLogicToDevicePixel() In the logic for transforming Bezier curves, the calculation for the second control point (aC2) was accidentally assigning to the first control point variable (aC1). This left aC2 uninitialized (defaulting to 0,0) and corrupted aC1, causing Bezier curves to visually collapse towards the origin. Change-Id: I48572679e78146226dd09a011c57609fc1de3794 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196520 Reviewed-by: Dan Williams <[email protected]> Tested-by: Jenkins (cherry picked from commit 43759b2b1c7a64dfb84b7989490514caffd9ac6a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197164 Reviewed-by: Xisco Fauli <[email protected]> diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx index da9b3c4e6878..1bb4548d9d6f 100644 --- a/vcl/source/outdev/map.cxx +++ b/vcl/source/outdev/map.cxx @@ -516,7 +516,7 @@ basegfx::B2DPolygon OutputDevice::ImplLogicToDevicePixel(const basegfx::B2DPolyg { const basegfx::B2DPoint aB2DC2(aPoly.getNextControlPoint(i)); - aC1 = basegfx::B2DPoint(aB2DC2.getX() + mnOutOffX, aB2DC2.getY() + mnOutOffY); + aC2 = basegfx::B2DPoint(aB2DC2.getX() + mnOutOffX, aB2DC2.getY() + mnOutOffY); } aPoly.setB2DPoint(i, aPt); commit 9a10ce47c7cff0ec6dfe0b0efa37e3cc2a670c3a Author: Noel Grandin <[email protected]> AuthorDate: Mon Jan 12 15:01:40 2026 +0100 Commit: Andras Timar <[email protected]> CommitDate: Wed Jan 14 11:55:27 2026 +0100 tdf#170283 crashed when opening a .ppt file Revert "no need to have duplicate m_nStorageType fields" This reverts commit 9a9bb1f212bb7eb40dcf34c15a3422e633fc195d. Change-Id: Ia471d291ebb99aea47c798cf923d7571711de356 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197118 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> (cherry picked from commit 9b90b680e5703f58146c883fb33972a95951b446) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197162 Reviewed-by: Xisco Fauli <[email protected]> diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index eee9ee466f13..a8c56e9b5eef 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -1741,6 +1741,7 @@ OStorage::OStorage( uno::Reference< io::XInputStream > const & xInputStream, : m_pImpl( new OStorage_Impl( xInputStream, nMode, xProperties, xContext, nStorageType ) ) , m_xSharedMutex( m_pImpl->m_xMutex ) , m_aListenersContainer( m_pImpl->m_xMutex->GetMutex() ) +, m_nStorageType( m_pImpl->m_nStorageType ) , m_bReadOnlyWrap( false ) { m_pImpl->m_pAntiImpl = this; @@ -1754,6 +1755,7 @@ OStorage::OStorage( uno::Reference< io::XStream > const & xStream, : m_pImpl( new OStorage_Impl( xStream, nMode, xProperties, xContext, nStorageType ) ) , m_xSharedMutex( m_pImpl->m_xMutex ) , m_aListenersContainer( m_pImpl->m_xMutex->GetMutex() ) +, m_nStorageType( m_pImpl->m_nStorageType ) , m_bReadOnlyWrap( false ) { m_pImpl->m_pAntiImpl = this; @@ -1763,6 +1765,7 @@ OStorage::OStorage( OStorage_Impl* pImpl, bool bReadOnlyWrap ) : m_pImpl( pImpl ) , m_xSharedMutex( m_pImpl->m_xMutex ) , m_aListenersContainer( m_pImpl->m_xMutex->GetMutex() ) +, m_nStorageType( m_pImpl->m_nStorageType ) , m_bReadOnlyWrap( bReadOnlyWrap ) { // this call can be done only from OStorage_Impl implementation to create child storage @@ -2039,7 +2042,7 @@ uno::Any SAL_CALL OStorage::queryInterface( const uno::Type& rType ) if ( aReturn.hasValue() ) return aReturn ; - if ( m_pImpl->m_nStorageType == embed::StorageFormats::PACKAGE ) + if ( m_nStorageType == embed::StorageFormats::PACKAGE ) { if ( m_pImpl->m_bIsRoot ) { @@ -2057,7 +2060,7 @@ uno::Any SAL_CALL OStorage::queryInterface( const uno::Type& rType ) , static_cast<embed::XStorageRawAccess*> ( this ) ); } } - else if ( m_pImpl->m_nStorageType == embed::StorageFormats::OFOPXML ) + else if ( m_nStorageType == embed::StorageFormats::OFOPXML ) { aReturn = ::cppu::queryInterface ( rType @@ -2089,7 +2092,7 @@ uno::Sequence< uno::Type > SAL_CALL OStorage::getTypes() if (! m_oTypeCollection) { - if ( m_pImpl->m_nStorageType == embed::StorageFormats::PACKAGE ) + if ( m_nStorageType == embed::StorageFormats::PACKAGE ) { if ( m_pImpl->m_bIsRoot ) { @@ -2119,7 +2122,7 @@ uno::Sequence< uno::Type > SAL_CALL OStorage::getTypes() , cppu::UnoType<beans::XPropertySet>::get()); } } - else if ( m_pImpl->m_nStorageType == embed::StorageFormats::OFOPXML ) + else if ( m_nStorageType == embed::StorageFormats::OFOPXML ) { m_oTypeCollection.emplace( cppu::UnoType<lang::XTypeProvider>::get() @@ -2219,7 +2222,7 @@ uno::Reference< io::XStream > SAL_CALL OStorage::openStreamElement( if ( aStreamName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamName, false ) ) throw lang::IllegalArgumentException( THROW_WHERE "Unexpected entry name syntax.", uno::Reference< uno::XInterface >(), 1 ); - if ( m_pImpl->m_nStorageType == embed::StorageFormats::OFOPXML && aStreamName == "_rels" ) + if ( m_nStorageType == embed::StorageFormats::OFOPXML && aStreamName == "_rels" ) throw lang::IllegalArgumentException( THROW_WHERE, uno::Reference< uno::XInterface >(), 1 ); // unacceptable element name if ( ( nOpenMode & embed::ElementModes::WRITE ) && m_bReadOnlyWrap ) @@ -2314,7 +2317,7 @@ rtl::Reference< OStorage > OStorage::openStorageElement2( if ( aStorName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStorName, false ) ) throw lang::IllegalArgumentException( THROW_WHERE "Unexpected entry name syntax.", uno::Reference< uno::XInterface >(), 1 ); - if ( m_pImpl->m_nStorageType == embed::StorageFormats::OFOPXML && aStorName == "_rels" ) + if ( m_nStorageType == embed::StorageFormats::OFOPXML && aStorName == "_rels" ) throw lang::IllegalArgumentException( THROW_WHERE, uno::Reference< uno::XInterface >(), 1 ); // unacceptable storage name if ( ( nStorageMode & embed::ElementModes::WRITE ) && m_bReadOnlyWrap ) @@ -2444,7 +2447,7 @@ uno::Reference< io::XStream > SAL_CALL OStorage::cloneStreamElement( const OUStr if ( aStreamName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamName, false ) ) throw lang::IllegalArgumentException( THROW_WHERE "Unexpected entry name syntax.", uno::Reference< uno::XInterface >(), 1 ); - if ( m_pImpl->m_nStorageType == embed::StorageFormats::OFOPXML && aStreamName == "_rels" ) + if ( m_nStorageType == embed::StorageFormats::OFOPXML && aStreamName == "_rels" ) throw lang::IllegalArgumentException( THROW_WHERE, uno::Reference< uno::XInterface >(), 1 ); // unacceptable storage name try @@ -2570,7 +2573,7 @@ void SAL_CALL OStorage::copyStorageElementLastCommitTo( if ( aStorName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStorName, false ) ) throw lang::IllegalArgumentException( THROW_WHERE "Unexpected entry name syntax.", uno::Reference< uno::XInterface >(), 1 ); - if ( m_pImpl->m_nStorageType == embed::StorageFormats::OFOPXML && aStorName == "_rels" ) + if ( m_nStorageType == embed::StorageFormats::OFOPXML && aStorName == "_rels" ) throw lang::IllegalArgumentException( THROW_WHERE, uno::Reference< uno::XInterface >(), 1 ); // unacceptable storage name try @@ -2646,7 +2649,7 @@ sal_Bool SAL_CALL OStorage::isStreamElement( const OUString& aElementName ) if ( aElementName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aElementName, false ) ) throw lang::IllegalArgumentException( THROW_WHERE "Unexpected entry name syntax.", uno::Reference< uno::XInterface >(), 1 ); - if ( m_pImpl->m_nStorageType == embed::StorageFormats::OFOPXML && aElementName == "_rels" ) + if ( m_nStorageType == embed::StorageFormats::OFOPXML && aElementName == "_rels" ) throw lang::IllegalArgumentException( THROW_WHERE, uno::Reference< uno::XInterface >(), 1 ); // unacceptable name SotElement_Impl* pElement = nullptr; @@ -2704,7 +2707,7 @@ sal_Bool SAL_CALL OStorage::isStorageElement( const OUString& aElementName ) if ( aElementName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aElementName, false ) ) throw lang::IllegalArgumentException( THROW_WHERE "Unexpected entry name syntax.", uno::Reference< uno::XInterface >(), 1 ); - if ( m_pImpl->m_nStorageType == embed::StorageFormats::OFOPXML && aElementName == "_rels" ) + if ( m_nStorageType == embed::StorageFormats::OFOPXML && aElementName == "_rels" ) throw lang::IllegalArgumentException( THROW_WHERE, uno::Reference< uno::XInterface >(), 1 ); SotElement_Impl* pElement = nullptr; @@ -2765,7 +2768,7 @@ void SAL_CALL OStorage::removeElement( const OUString& aElementName ) throw lang::IllegalArgumentException(THROW_WHERE "Unexpected entry name syntax.", uno::Reference<uno::XInterface>(), 1); - if (m_pImpl->m_nStorageType == embed::StorageFormats::OFOPXML && aElementName == "_rels") + if (m_nStorageType == embed::StorageFormats::OFOPXML && aElementName == "_rels") throw lang::IllegalArgumentException(THROW_WHERE, uno::Reference<uno::XInterface>(), 1); // TODO: unacceptable name @@ -2844,7 +2847,7 @@ void SAL_CALL OStorage::renameElement( const OUString& aElementName, const OUStr throw lang::IllegalArgumentException(THROW_WHERE "Unexpected entry name syntax.", uno::Reference<uno::XInterface>(), 1); - if (m_pImpl->m_nStorageType == embed::StorageFormats::OFOPXML + if (m_nStorageType == embed::StorageFormats::OFOPXML && (aElementName == "_rels" || aNewName == "_rels")) throw lang::IllegalArgumentException(THROW_WHERE, uno::Reference<uno::XInterface>(), 0); // TODO: unacceptable element name @@ -2944,7 +2947,7 @@ void SAL_CALL OStorage::copyElementTo( const OUString& aElementName, // || xDest == getXWeak() ) throw lang::IllegalArgumentException( THROW_WHERE, uno::Reference< uno::XInterface >(), 2 ); - if ( m_pImpl->m_nStorageType == embed::StorageFormats::OFOPXML && ( aElementName == "_rels" || aNewName == "_rels" ) ) + if ( m_nStorageType == embed::StorageFormats::OFOPXML && ( aElementName == "_rels" || aNewName == "_rels" ) ) throw lang::IllegalArgumentException( THROW_WHERE, uno::Reference< uno::XInterface >(), 0 ); // unacceptable element name try @@ -3028,7 +3031,7 @@ void SAL_CALL OStorage::moveElementTo( const OUString& aElementName, if (!xDest.is() || xDest == getXWeak()) throw lang::IllegalArgumentException(THROW_WHERE, uno::Reference<uno::XInterface>(), 2); - if (m_pImpl->m_nStorageType == embed::StorageFormats::OFOPXML + if (m_nStorageType == embed::StorageFormats::OFOPXML && (aElementName == "_rels" || aNewName == "_rels")) throw lang::IllegalArgumentException(THROW_WHERE, uno::Reference<uno::XInterface>(), 0); // unacceptable element name @@ -3268,7 +3271,7 @@ uno::Reference< io::XInputStream > SAL_CALL OStorage::getPlainRawStreamElement( throw lang::DisposedException( THROW_WHERE ); } - if ( m_pImpl->m_nStorageType == embed::StorageFormats::OFOPXML ) + if ( m_nStorageType == embed::StorageFormats::OFOPXML ) throw uno::RuntimeException( THROW_WHERE ); // the interface is not supported and must not be accessible if ( sStreamName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( sStreamName, false ) ) @@ -3358,7 +3361,7 @@ uno::Reference< io::XInputStream > SAL_CALL OStorage::getRawEncrStreamElement( throw lang::DisposedException( THROW_WHERE ); } - if ( m_pImpl->m_nStorageType != embed::StorageFormats::PACKAGE ) + if ( m_nStorageType != embed::StorageFormats::PACKAGE ) throw packages::NoEncryptionException( THROW_WHERE ); if ( sStreamName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( sStreamName, false ) ) @@ -3455,7 +3458,7 @@ void SAL_CALL OStorage::insertRawEncrStreamElement( const OUString& aStreamName, throw lang::DisposedException( THROW_WHERE ); } - if ( m_pImpl->m_nStorageType != embed::StorageFormats::PACKAGE ) + if ( m_nStorageType != embed::StorageFormats::PACKAGE ) throw embed::InvalidStorageException( THROW_WHERE ); if ( aStreamName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamName, false ) ) @@ -3764,7 +3767,7 @@ uno::Any SAL_CALL OStorage::getByName( const OUString& aName ) if ( aName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aName, false ) ) throw lang::IllegalArgumentException( THROW_WHERE "Unexpected entry name syntax.", uno::Reference< uno::XInterface >(), 1 ); - if ( m_pImpl->m_nStorageType == embed::StorageFormats::OFOPXML && aName == "_rels" ) + if ( m_nStorageType == embed::StorageFormats::OFOPXML && aName == "_rels" ) throw lang::IllegalArgumentException( THROW_WHERE, uno::Reference< uno::XInterface >(), 1 ); // unacceptable element name uno::Any aResult; @@ -3850,7 +3853,7 @@ sal_Bool SAL_CALL OStorage::hasByName( const OUString& aName ) if ( aName.isEmpty() ) return false; - if ( m_pImpl->m_nStorageType == embed::StorageFormats::OFOPXML && aName == "_rels" ) + if ( m_nStorageType == embed::StorageFormats::OFOPXML && aName == "_rels" ) return false; SotElement_Impl* pElement = nullptr; @@ -3998,7 +4001,7 @@ void SAL_CALL OStorage::removeEncryption() throw lang::DisposedException( THROW_WHERE ); } - if ( m_pImpl->m_nStorageType != embed::StorageFormats::PACKAGE ) + if ( m_nStorageType != embed::StorageFormats::PACKAGE ) throw uno::RuntimeException( THROW_WHERE ); // the interface must be visible only for package storage SAL_WARN_IF( !m_pImpl->m_bIsRoot, "package.xstor", "removeEncryption() method is not available for nonroot storages!" ); @@ -4059,7 +4062,7 @@ void SAL_CALL OStorage::setEncryptionData( const uno::Sequence< beans::NamedValu throw lang::DisposedException( THROW_WHERE ); } - if ( m_pImpl->m_nStorageType != embed::StorageFormats::PACKAGE ) + if ( m_nStorageType != embed::StorageFormats::PACKAGE ) throw uno::RuntimeException( THROW_WHERE ); // the interface must be visible only for package storage if ( !aEncryptionData.hasElements() ) @@ -4124,7 +4127,7 @@ void SAL_CALL OStorage::setEncryptionAlgorithms( const uno::Sequence< beans::Nam throw lang::DisposedException( THROW_WHERE ); } - if ( m_pImpl->m_nStorageType != embed::StorageFormats::PACKAGE ) + if ( m_nStorageType != embed::StorageFormats::PACKAGE ) throw uno::RuntimeException( THROW_WHERE ); // the interface must be visible only for package storage if ( !aAlgorithms.hasElements() ) @@ -4184,7 +4187,7 @@ void SAL_CALL OStorage::setGpgProperties( const uno::Sequence< uno::Sequence< be throw lang::DisposedException( THROW_WHERE ); } - if ( m_pImpl->m_nStorageType != embed::StorageFormats::PACKAGE ) + if ( m_nStorageType != embed::StorageFormats::PACKAGE ) throw uno::RuntimeException( THROW_WHERE ); // the interface must be visible only for package storage if ( !aProps.hasElements() ) @@ -4244,7 +4247,7 @@ uno::Sequence< beans::NamedValue > SAL_CALL OStorage::getEncryptionAlgorithms() throw lang::DisposedException( THROW_WHERE ); } - if ( m_pImpl->m_nStorageType != embed::StorageFormats::PACKAGE ) + if ( m_nStorageType != embed::StorageFormats::PACKAGE ) throw uno::RuntimeException( THROW_WHERE ); // the interface must be visible only for package storage uno::Sequence< beans::NamedValue > aResult; @@ -4327,9 +4330,9 @@ void SAL_CALL OStorage::setPropertyValue( const OUString& aPropertyName, const u if ( m_bReadOnlyWrap && aPropertyName != "Version" ) throw uno::RuntimeException( THROW_WHERE ); // TODO: Access denied - if ( m_pImpl->m_nStorageType == embed::StorageFormats::ZIP ) + if ( m_nStorageType == embed::StorageFormats::ZIP ) throw beans::UnknownPropertyException( aPropertyName ); - else if ( m_pImpl->m_nStorageType == embed::StorageFormats::PACKAGE ) + else if ( m_nStorageType == embed::StorageFormats::PACKAGE ) { if ( aPropertyName == "MediaType" ) { @@ -4363,7 +4366,7 @@ void SAL_CALL OStorage::setPropertyValue( const OUString& aPropertyName, const u else throw beans::UnknownPropertyException( aPropertyName ); } - else if ( m_pImpl->m_nStorageType == embed::StorageFormats::OFOPXML ) + else if ( m_nStorageType == embed::StorageFormats::OFOPXML ) { if ( aPropertyName == "RelationsInfoStream" ) { @@ -4418,7 +4421,7 @@ uno::Any SAL_CALL OStorage::getPropertyValue( const OUString& aPropertyName ) throw lang::DisposedException( THROW_WHERE ); } - if ( m_pImpl->m_nStorageType == embed::StorageFormats::PACKAGE + if ( m_nStorageType == embed::StorageFormats::PACKAGE && ( aPropertyName == "MediaType" || aPropertyName == MEDIATYPE_FALLBACK_USED_PROPERTY || aPropertyName == "Version" ) ) { try @@ -4471,7 +4474,7 @@ uno::Any SAL_CALL OStorage::getPropertyValue( const OUString& aPropertyName ) return uno::Any( false ); // RepairPackage } - else if ( m_pImpl->m_nStorageType == embed::StorageFormats::PACKAGE + else if ( m_nStorageType == embed::StorageFormats::PACKAGE && ( aPropertyName == HAS_ENCRYPTED_ENTRIES_PROPERTY || aPropertyName == HAS_NONENCRYPTED_ENTRIES_PROPERTY || aPropertyName == ENCRYPTION_GPG_PROPERTIES @@ -4576,7 +4579,7 @@ sal_Bool SAL_CALL OStorage::hasByID( const OUString& sID ) throw lang::DisposedException( THROW_WHERE ); } - if ( m_pImpl->m_nStorageType != embed::StorageFormats::OFOPXML ) + if ( m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException( THROW_WHERE ); try @@ -4612,7 +4615,7 @@ OUString SAL_CALL OStorage::getTargetByID( const OUString& sID ) throw lang::DisposedException( THROW_WHERE ); } - if ( m_pImpl->m_nStorageType != embed::StorageFormats::OFOPXML ) + if ( m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException( THROW_WHERE ); const uno::Sequence< beans::StringPair > aSeq = getRelationshipByID( sID ); @@ -4633,7 +4636,7 @@ OUString SAL_CALL OStorage::getTypeByID( const OUString& sID ) throw lang::DisposedException( THROW_WHERE ); } - if ( m_pImpl->m_nStorageType != embed::StorageFormats::OFOPXML ) + if ( m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException( THROW_WHERE ); const uno::Sequence< beans::StringPair > aSeq = getRelationshipByID( sID ); @@ -4654,7 +4657,7 @@ uno::Sequence< beans::StringPair > SAL_CALL OStorage::getRelationshipByID( cons throw lang::DisposedException( THROW_WHERE ); } - if ( m_pImpl->m_nStorageType != embed::StorageFormats::OFOPXML ) + if ( m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException( THROW_WHERE ); // TODO/LATER: in future the unification of the ID could be checked @@ -4680,7 +4683,7 @@ uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OStorage::getRelati throw lang::DisposedException( THROW_WHERE ); } - if ( m_pImpl->m_nStorageType != embed::StorageFormats::OFOPXML ) + if ( m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException( THROW_WHERE ); // TODO/LATER: in future the unification of the ID could be checked @@ -4709,7 +4712,7 @@ uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OStorage::getAllRel throw lang::DisposedException( THROW_WHERE ); } - if ( m_pImpl->m_nStorageType != embed::StorageFormats::OFOPXML ) + if ( m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException( THROW_WHERE ); uno::Sequence< uno::Sequence< beans::StringPair > > aRet; @@ -4746,7 +4749,7 @@ void SAL_CALL OStorage::insertRelationshipByID( const OUString& sID, const uno: throw lang::DisposedException( THROW_WHERE ); } - if ( m_pImpl->m_nStorageType != embed::StorageFormats::OFOPXML ) + if ( m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException( THROW_WHERE ); const beans::StringPair aIDRel(u"Id"_ustr, sID); @@ -4796,7 +4799,7 @@ void SAL_CALL OStorage::removeRelationshipByID( const OUString& sID ) throw lang::DisposedException( THROW_WHERE ); } - if ( m_pImpl->m_nStorageType != embed::StorageFormats::OFOPXML ) + if ( m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException( THROW_WHERE ); uno::Sequence< uno::Sequence< beans::StringPair > > aSeq = getAllRelationships(); @@ -4830,7 +4833,7 @@ void SAL_CALL OStorage::insertRelationships( const uno::Sequence< uno::Sequence throw lang::DisposedException( THROW_WHERE ); } - if ( m_pImpl->m_nStorageType != embed::StorageFormats::OFOPXML ) + if ( m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException( THROW_WHERE ); OUString aIDTag( u"Id"_ustr ); @@ -4883,7 +4886,7 @@ void SAL_CALL OStorage::clearRelationships() throw lang::DisposedException( THROW_WHERE ); } - if ( m_pImpl->m_nStorageType != embed::StorageFormats::OFOPXML ) + if ( m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException( THROW_WHERE ); m_pImpl->m_aRelInfo.realloc( 0 ); @@ -4917,7 +4920,7 @@ void SAL_CALL OStorage::insertStreamElementDirect( if ( aStreamName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamName, false ) ) throw lang::IllegalArgumentException( THROW_WHERE "Unexpected entry name syntax.", uno::Reference< uno::XInterface >(), 1 ); - if ( m_pImpl->m_nStorageType == embed::StorageFormats::OFOPXML && aStreamName == "_rels" ) + if ( m_nStorageType == embed::StorageFormats::OFOPXML && aStreamName == "_rels" ) throw lang::IllegalArgumentException( THROW_WHERE, uno::Reference< uno::XInterface >(), 1 ); // unacceptable storage name if ( m_bReadOnlyWrap ) @@ -4996,7 +4999,7 @@ void SAL_CALL OStorage::copyElementDirectlyTo( if ( !xDest.is() || xDest == getXWeak() ) throw lang::IllegalArgumentException( THROW_WHERE, uno::Reference< uno::XInterface >(), 2 ); - if ( m_pImpl->m_nStorageType == embed::StorageFormats::OFOPXML && ( aElementName == "_rels" || aNewName == "_rels" ) ) + if ( m_nStorageType == embed::StorageFormats::OFOPXML && ( aElementName == "_rels" || aNewName == "_rels" ) ) throw lang::IllegalArgumentException( THROW_WHERE, uno::Reference< uno::XInterface >(), 0 ); // unacceptable name try @@ -5198,7 +5201,7 @@ uno::Any SAL_CALL OStorage::getElementPropertyValue( const OUString& aElementNam if ( aElementName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aElementName, false ) ) throw lang::IllegalArgumentException( THROW_WHERE "Unexpected entry name syntax.", uno::Reference< uno::XInterface >(), 1 ); - if ( m_pImpl->m_nStorageType == embed::StorageFormats::OFOPXML && aElementName == "_rels" ) + if ( m_nStorageType == embed::StorageFormats::OFOPXML && aElementName == "_rels" ) throw lang::IllegalArgumentException( THROW_WHERE, uno::Reference< uno::XInterface >(), 1 ); // TODO: unacceptable name try @@ -5208,7 +5211,7 @@ uno::Any SAL_CALL OStorage::getElementPropertyValue( const OUString& aElementNam throw container::NoSuchElementException( THROW_WHERE ); // TODO/LATER: Currently it is only implemented for MediaType property of substorages, might be changed in future - if ( !pElement->m_bIsStorage || m_pImpl->m_nStorageType != embed::StorageFormats::PACKAGE || aPropertyName != "MediaType" ) + if ( !pElement->m_bIsStorage || m_nStorageType != embed::StorageFormats::PACKAGE || aPropertyName != "MediaType" ) throw beans::PropertyVetoException( THROW_WHERE ); if (!pElement->m_xStorage) @@ -5284,7 +5287,7 @@ void SAL_CALL OStorage::copyStreamElementData( const OUString& aStreamName, cons if ( aStreamName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamName, false ) ) throw lang::IllegalArgumentException( THROW_WHERE "Unexpected entry name syntax.", uno::Reference< uno::XInterface >(), 1 ); - if ( m_pImpl->m_nStorageType == embed::StorageFormats::OFOPXML && aStreamName == "_rels" ) + if ( m_nStorageType == embed::StorageFormats::OFOPXML && aStreamName == "_rels" ) throw lang::IllegalArgumentException( THROW_WHERE, uno::Reference< uno::XInterface >(), 1 ); // unacceptable name if ( !xTargetStream.is() ) @@ -5440,7 +5443,7 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL OStorage::openEncrypted throw lang::DisposedException( THROW_WHERE ); } - if ( m_pImpl->m_nStorageType != embed::StorageFormats::PACKAGE ) + if ( m_nStorageType != embed::StorageFormats::PACKAGE ) throw packages::NoEncryptionException( THROW_WHERE ); if ( aStreamPath.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamPath, true ) ) diff --git a/package/source/xstor/xstorage.hxx b/package/source/xstor/xstorage.hxx index f6e9890c43a3..067893a274fb 100644 --- a/package/source/xstor/xstorage.hxx +++ b/package/source/xstor/xstorage.hxx @@ -283,6 +283,9 @@ class OStorage final : public css::lang::XTypeProvider rtl::Reference<comphelper::RefCountedMutex> m_xSharedMutex; comphelper::OMultiTypeInterfaceContainerHelper2 m_aListenersContainer; // list of listeners ::std::optional< ::cppu::OTypeCollection> m_oTypeCollection; + // m_nStorageType is both here, and in m_pImpl->m_nStorageType because + // sometimes we need the value when m_pImpl is nullptr. + sal_Int32 m_nStorageType; // the mode in which the storage is used bool m_bReadOnlyWrap; ::rtl::Reference<OChildDispListener_Impl> m_pSubElDispListener; ::std::vector< css::uno::WeakReference< css::lang::XComponent > > m_aOpenSubComponentsVector;
