dbaccess/source/core/dataaccess/ModelImpl.cxx | 8 ++++---- dbaccess/source/core/dataaccess/databasedocument.cxx | 2 +- dbaccess/source/core/dataaccess/documentdefinition.cxx | 4 ++-- dbaccess/source/core/inc/ModelImpl.hxx | 8 ++++---- include/vcl/outdev.hxx | 7 ++++--- vcl/source/outdev/outdev.cxx | 4 ++-- vcl/source/window/settings.cxx | 10 +++++----- vcl/source/window/window.cxx | 6 +++--- 8 files changed, 25 insertions(+), 24 deletions(-)
New commits: commit 62cea174f4c73ed39e5ac29e2a44fd27b92054bd Author: Noel Grandin <[email protected]> AuthorDate: Wed Sep 7 08:41:45 2022 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Sat Sep 10 08:39:22 2022 +0200 convert EmbeddedMacros to scoped enum Change-Id: I7e24b5ad53853ff7989f262a3b914b2082ac5ec4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139733 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx index 14d05bb53b35..3db610503313 100644 --- a/dbaccess/source/core/dataaccess/ModelImpl.cxx +++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx @@ -1323,17 +1323,17 @@ ODatabaseModelImpl::EmbeddedMacros ODatabaseModelImpl::determineEmbeddedMacros() { if ( ::sfx2::DocumentMacroMode::storageHasMacros( getOrCreateRootStorage() ) ) { - m_aEmbeddedMacros = eDocumentWideMacros; + m_aEmbeddedMacros = EmbeddedMacros::DocumentWide; } else if ( lcl_hasObjectsWithMacros_nothrow( *this, ObjectType::Form ) || lcl_hasObjectsWithMacros_nothrow( *this, ObjectType::Report ) ) { - m_aEmbeddedMacros = eSubDocumentMacros; + m_aEmbeddedMacros = EmbeddedMacros::SubDocument; } else { - m_aEmbeddedMacros = eNoMacros; + m_aEmbeddedMacros = EmbeddedMacros::NONE; } } return *m_aEmbeddedMacros; @@ -1342,7 +1342,7 @@ ODatabaseModelImpl::EmbeddedMacros ODatabaseModelImpl::determineEmbeddedMacros() bool ODatabaseModelImpl::documentStorageHasMacros() const { const_cast< ODatabaseModelImpl* >( this )->determineEmbeddedMacros(); - return ( *m_aEmbeddedMacros != eNoMacros ); + return ( *m_aEmbeddedMacros != EmbeddedMacros::NONE ); } bool ODatabaseModelImpl::macroCallsSeenWhileLoading() const diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index 681966020696..fb4ed754380b 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -775,7 +775,7 @@ bool ODatabaseDocument::impl_attachResource( const OUString& i_rLogicalDocumentU // determine whether the document as a whole, or sub documents, have macros. Especially the latter // controls the availability of our XEmbeddedScripts and XScriptInvocationContext interfaces, and we // should know this before anybody actually uses the object. - m_bAllowDocumentScripting = ( m_pImpl->determineEmbeddedMacros() != ODatabaseModelImpl::eSubDocumentMacros ); + m_bAllowDocumentScripting = ( m_pImpl->determineEmbeddedMacros() != ODatabaseModelImpl::EmbeddedMacros::SubDocument ); _rDocGuard.clear(); // <- SYNCHRONIZED diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index 2c7bc4b871a7..dbbb7eb94ecc 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -852,7 +852,7 @@ Any ODocumentDefinition::onCommandOpenSomething( const Any& _rOpenArgument, cons // So, in such a case, and with 2. above, we would silently execute those macros, // regardless of the global security settings - which would be a security issue, of // course. - if ( m_pImpl->m_pDataSource->determineEmbeddedMacros() == ODatabaseModelImpl::eNoMacros ) + if ( m_pImpl->m_pDataSource->determineEmbeddedMacros() == ODatabaseModelImpl::EmbeddedMacros::NONE ) { // this is case 2. from above // So, pass a USE_CONFIG to the to-be-loaded document. This means that @@ -1431,7 +1431,7 @@ namespace bool ODocumentDefinition::objectSupportsEmbeddedScripts() const { bool bAllowDocumentMacros = !m_pImpl->m_pDataSource - || ( m_pImpl->m_pDataSource->determineEmbeddedMacros() == ODatabaseModelImpl::eSubDocumentMacros ); + || ( m_pImpl->m_pDataSource->determineEmbeddedMacros() == ODatabaseModelImpl::EmbeddedMacros::SubDocument ); // if *any* of the objects of the database document already has macros, we // continue to allow it to have them, until the user does a migration. diff --git a/dbaccess/source/core/inc/ModelImpl.hxx b/dbaccess/source/core/inc/ModelImpl.hxx index 14c6d6a6ad91..fdaf89f1511d 100644 --- a/dbaccess/source/core/inc/ModelImpl.hxx +++ b/dbaccess/source/core/inc/ModelImpl.hxx @@ -109,14 +109,14 @@ public: LAST = Table }; - enum EmbeddedMacros + enum class EmbeddedMacros { // the database document (storage) itself contains macros - eDocumentWideMacros, + DocumentWide, // there are sub document( storage)s containing macros - eSubDocumentMacros, + SubDocument, // there are no known macro( storage)s - eNoMacros + NONE }; private: commit 9d30a59ee1f4b280d70d43e6ee3fc7472e8efa2a Author: Noel Grandin <[email protected]> AuthorDate: Fri Sep 9 20:51:02 2022 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Sat Sep 10 08:39:09 2022 +0200 unique_ptr->optional for AllSettings AllSettings is just a cow_wrapper, so no need to allocate this separately Change-Id: I8f7705d55ab70da209d1383f3812249e0750df5f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139740 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 66cd10f2a53f..d217b786bd15 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -50,6 +50,7 @@ #include <vcl/wall.hxx> #include <vcl/metaactiontypes.hxx> #include <vcl/salnativewidgets.hxx> +#include <vcl/settings.hxx> #include <vcl/vclreferencebase.hxx> #include <basegfx/numeric/ftools.hxx> @@ -64,6 +65,7 @@ #include <com/sun/star/awt/DeviceInfo.hpp> #include <memory> +#include <optional> #include <string_view> #include <vector> @@ -75,7 +77,6 @@ class ImplMultiTextLineInfo; class SalGraphics; class Gradient; class Hatch; -class AllSettings; class BitmapReadAccess; class BitmapEx; class Image; @@ -231,7 +232,7 @@ private: Color maOverlineColor; RasterOp meRasterOp; Wallpaper maBackground; - std::unique_ptr<AllSettings> mxSettings; + std::optional<AllSettings> moSettings; MapMode maMapMode; Point maRefPoint; AntialiasingFlags mnAntialiasing; @@ -285,7 +286,7 @@ public: GDIMetaFile* GetConnectMetaFile() const { return mpMetaFile; } virtual void SetSettings( const AllSettings& rSettings ); - const AllSettings& GetSettings() const { return *mxSettings; } + const AllSettings& GetSettings() const { return *moSettings; } SystemGraphicsData GetSystemGfxData() const; OUString GetRenderBackendName() const; diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx index 2bb047acc223..ab677b468f73 100644 --- a/vcl/source/outdev/outdev.cxx +++ b/vcl/source/outdev/outdev.cxx @@ -61,7 +61,7 @@ OutputDevice::OutputDevice(OutDevType eOutDevType) : maRegion(true), maFillColor( COL_WHITE ), maTextLineColor( COL_TRANSPARENT ), - mxSettings( new AllSettings(Application::GetSettings()) ) + moSettings( Application::GetSettings() ) { mpGraphics = nullptr; mpUnoGraphicsList = nullptr; @@ -215,7 +215,7 @@ void OutputDevice::SetConnectMetaFile( GDIMetaFile* pMtf ) void OutputDevice::SetSettings( const AllSettings& rSettings ) { - *mxSettings = rSettings; + *moSettings = rSettings; if( mpAlphaVDev ) mpAlphaVDev->SetSettings( rSettings ); diff --git a/vcl/source/window/settings.cxx b/vcl/source/window/settings.cxx index f9af6982a0d4..11d863c98196 100644 --- a/vcl/source/window/settings.cxx +++ b/vcl/source/window/settings.cxx @@ -53,7 +53,7 @@ void WindowOutputDevice::SetSettings( const AllSettings& rSettings, bool bChild static_cast<vcl::WindowOutputDevice*>(static_cast<ImplBorderWindow*>(pBorderWindow)->mpMenuBarWindow->GetOutDev())->SetSettings( rSettings, true ); } - AllSettings aOldSettings(*mxSettings); + AllSettings aOldSettings(*moSettings); OutputDevice::SetSettings( rSettings ); AllSettingsFlags nChangeFlags = aOldSettings.GetChangeFlags( rSettings ); @@ -88,8 +88,8 @@ void Window::UpdateSettings( const AllSettings& rSettings, bool bChild ) static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->mpMenuBarWindow->UpdateSettings( rSettings, true ); } - AllSettings aOldSettings(*mpWindowImpl->mxOutDev->mxSettings); - AllSettingsFlags nChangeFlags = mpWindowImpl->mxOutDev->mxSettings->Update( AllSettings::GetWindowUpdate(), rSettings ); + AllSettings aOldSettings(*mpWindowImpl->mxOutDev->moSettings); + AllSettingsFlags nChangeFlags = mpWindowImpl->mxOutDev->moSettings->Update( AllSettings::GetWindowUpdate(), rSettings ); // recalculate AppFont-resolution and DPI-resolution ImplInitResolutionSettings(); @@ -101,9 +101,9 @@ void Window::UpdateSettings( const AllSettings& rSettings, bool bChild ) * so we can spare all our users the hassle of reacting on * this in their respective DataChanged. */ - MouseSettings aSet( mpWindowImpl->mxOutDev->mxSettings->GetMouseSettings() ); + MouseSettings aSet( mpWindowImpl->mxOutDev->moSettings->GetMouseSettings() ); aSet.SetWheelBehavior( aOldSettings.GetMouseSettings().GetWheelBehavior() ); - mpWindowImpl->mxOutDev->mxSettings->SetMouseSettings( aSet ); + mpWindowImpl->mxOutDev->moSettings->SetMouseSettings( aSet ); if( (nChangeFlags & AllSettingsFlags::STYLE) && IsBackground() ) { diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index ef43f19e720d..a233327900f1 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -1152,7 +1152,7 @@ void Window::ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* p if (!utl::ConfigManager::IsFuzzing()) { - const StyleSettings& rStyleSettings = mpWindowImpl->mxOutDev->mxSettings->GetStyleSettings(); + const StyleSettings& rStyleSettings = mpWindowImpl->mxOutDev->moSettings->GetStyleSettings(); mpWindowImpl->mxOutDev->maFont = rStyleSettings.GetAppFont(); if ( nStyle & WB_3DLOOK ) @@ -1353,7 +1353,7 @@ void Window::ImplInitResolutionSettings() // setup the scale factor for HiDPI displays GetOutDev()->mnDPIScalePercentage = CountDPIScaleFactor(mpWindowImpl->mpFrameData->mnDPIY); - const StyleSettings& rStyleSettings = GetOutDev()->mxSettings->GetStyleSettings(); + const StyleSettings& rStyleSettings = GetOutDev()->moSettings->GetStyleSettings(); SetPointFont(*GetOutDev(), rStyleSettings.GetAppFont()); } else if ( mpWindowImpl->mpParent ) @@ -3689,7 +3689,7 @@ void Window::EnableNativeWidget( bool bEnable ) // send datachanged event to allow for internal changes required for NWF // like clipmode, transparency, etc. - DataChangedEvent aDCEvt( DataChangedEventType::SETTINGS, GetOutDev()->mxSettings.get(), AllSettingsFlags::STYLE ); + DataChangedEvent aDCEvt( DataChangedEventType::SETTINGS, &*GetOutDev()->moSettings, AllSettingsFlags::STYLE ); CompatDataChanged( aDCEvt ); // sometimes the borderwindow is queried, so keep it in sync
