diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-07-29 09:48:51 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-07-29 16:16:04 +0200 |
commit | 153d9483c1e9ec3722447a2b43c43ec1b32193d6 (patch) | |
tree | 39cf74e56f3a1a52b21bfc95e04758d26396abb9 | |
parent | b1dc1c740e37639bb309f4aa6a1c2567f99083fc (diff) |
replace and drop SvtPrintWarningOptions
Change-Id: I17fd4156eb940fbdc925d9761301096e5349135f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99674
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | compilerplugins/clang/unusedvariablemore.cxx | 2 | ||||
-rw-r--r-- | cui/source/options/optgdlg.cxx | 9 | ||||
-rw-r--r-- | include/unotools/itemholderbase.hxx | 1 | ||||
-rw-r--r-- | include/unotools/printwarningoptions.hxx | 85 | ||||
-rw-r--r-- | sfx2/source/dialog/printopt.cxx | 21 | ||||
-rw-r--r-- | sfx2/source/view/viewprn.cxx | 5 | ||||
-rw-r--r-- | solenv/clang-format/excludelist | 2 | ||||
-rw-r--r-- | sw/source/uibase/uno/unotxdoc.cxx | 5 | ||||
-rw-r--r-- | unotools/Library_utl.mk | 1 | ||||
-rw-r--r-- | unotools/source/config/itemholder1.cxx | 5 | ||||
-rw-r--r-- | unotools/source/config/printwarningoptions.cxx | 319 |
11 files changed, 17 insertions, 438 deletions
diff --git a/compilerplugins/clang/unusedvariablemore.cxx b/compilerplugins/clang/unusedvariablemore.cxx index cc166ab0eb2e..484cab088843 100644 --- a/compilerplugins/clang/unusedvariablemore.cxx +++ b/compilerplugins/clang/unusedvariablemore.cxx @@ -175,8 +175,6 @@ bool UnusedVariableMore::VisitVarDecl(VarDecl const* var) return true; if (dc.Class("SvtPathOptions").GlobalNamespace()) return true; - if (dc.Class("SvtPrintWarningOptions").GlobalNamespace()) - return true; if (dc.Class("SvtSysLocaleOptions").GlobalNamespace()) return true; diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx index f9bccb5222d4..743a64ad4b7f 100644 --- a/cui/source/options/optgdlg.cxx +++ b/cui/source/options/optgdlg.cxx @@ -34,7 +34,6 @@ #include <svtools/menuoptions.hxx> #include <svl/languageoptions.hxx> #include <svtools/miscopt.hxx> -#include <unotools/printwarningoptions.hxx> #include <unotools/syslocaleoptions.hxx> #include <sfx2/objsh.hxx> #include <comphelper/propertysequence.hxx> @@ -362,10 +361,9 @@ bool OfaMiscTabPage::FillItemSet( SfxItemSet* rSet ) bModified = true; } - if ( m_xDocStatusCB->get_state_changed_from_saved() ) + if (m_xDocStatusCB->get_state_changed_from_saved()) { - SvtPrintWarningOptions aPrintOptions; - aPrintOptions.SetModifyDocumentOnPrintingAllowed( m_xDocStatusCB->get_active() ); + officecfg::Office::Common::Print::PrintingModifiesDocument::set(m_xDocStatusCB->get_active(), batch); bModified = true; } @@ -417,8 +415,7 @@ void OfaMiscTabPage::Reset( const SfxItemSet* rSet ) m_xPrintDlgCB->set_active( !aMiscOpt.UseSystemPrintDialog() ); m_xPrintDlgCB->save_state(); - SvtPrintWarningOptions aPrintOptions; - m_xDocStatusCB->set_active(aPrintOptions.IsModifyDocumentOnPrintingAllowed()); + m_xDocStatusCB->set_active(officecfg::Office::Common::Print::PrintingModifiesDocument::get()); m_xDocStatusCB->save_state(); const SfxPoolItem* pItem = nullptr; diff --git a/include/unotools/itemholderbase.hxx b/include/unotools/itemholderbase.hxx index 776d3ca9aed7..5e5809aaf703 100644 --- a/include/unotools/itemholderbase.hxx +++ b/include/unotools/itemholderbase.hxx @@ -60,7 +60,6 @@ enum class EItem PathOptions , PrintOptions , // 2 PrintFileOptions , // 2 - PrintWarningOptions , SecurityOptions , SysLocaleOptions , // 2 diff --git a/include/unotools/printwarningoptions.hxx b/include/unotools/printwarningoptions.hxx deleted file mode 100644 index 176dc924302e..000000000000 --- a/include/unotools/printwarningoptions.hxx +++ /dev/null @@ -1,85 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_UNOTOOLS_PRINTWARNINGOPTIONS_HXX -#define INCLUDED_UNOTOOLS_PRINTWARNINGOPTIONS_HXX - -#include <unotools/unotoolsdllapi.h> -#include <sal/types.h> -#include <unotools/options.hxx> -#include <memory> - -namespace osl { class Mutex; } - -/*-************************************************************************************************************ - @short forward declaration to our private date container implementation - @descr We use these class as internal member to support small memory requirements. - You can create the container if it is necessary. The class which use these mechanism - is faster and smaller then a complete implementation! -*//*-*************************************************************************************************************/ - -class SvtPrintWarningOptions_Impl; - -/*-************************************************************************************************************ - @short collect information about startup features - @devstatus ready to use -*//*-*************************************************************************************************************/ - -class SAL_WARN_UNUSED UNOTOOLS_DLLPUBLIC SvtPrintWarningOptions final : public utl::detail::Options -{ - public: - SvtPrintWarningOptions(); - virtual ~SvtPrintWarningOptions() override; - - /*-**************************************************************************************************** - @short interface methods to get and set value of config key "org.openoffice.Office.Common/Print/Warning..." - @descr These options describe internal states to enable/disable features of installed office. - - @seealso configuration package "org.openoffice.Office.Common/_3D-Engine" - *//*-*****************************************************************************************************/ - - bool IsPaperSize() const; - bool IsPaperOrientation() const; - bool IsTransparency() const; - bool IsModifyDocumentOnPrintingAllowed() const; - - void SetPaperSize( bool bState ); - void SetPaperOrientation( bool bState ); - void SetTransparency( bool bState ); - void SetModifyDocumentOnPrintingAllowed( bool bState ); - - private: - - /*-**************************************************************************************************** - @short return a reference to a static mutex - @descr These class use his own static mutex to be threadsafe. - We create a static mutex only for one ime and use at different times. - @return A reference to a static mutex member. - *//*-*****************************************************************************************************/ - - UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); - - private: - std::shared_ptr<SvtPrintWarningOptions_Impl> m_pImpl; - -}; // class SvtPrintWarningOptions - -#endif // INCLUDED_UNOTOOLS_PRINTWARNINGOPTIONS_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/printopt.cxx b/sfx2/source/dialog/printopt.cxx index 43f88786a292..5f4025fb57c0 100644 --- a/sfx2/source/dialog/printopt.cxx +++ b/sfx2/source/dialog/printopt.cxx @@ -19,7 +19,7 @@ #include <sal/macros.h> -#include <unotools/printwarningoptions.hxx> +#include <officecfg/Office/Common.hxx> #include <svtools/printoptions.hxx> #include <svtools/restartdialog.hxx> @@ -91,17 +91,19 @@ std::unique_ptr<SfxTabPage> SfxCommonPrintOptionsTabPage::Create(weld::Container bool SfxCommonPrintOptionsTabPage::FillItemSet( SfxItemSet* /*rSet*/ ) { - SvtPrintWarningOptions aWarnOptions; SvtPrinterOptions aPrinterOptions; SvtPrintFileOptions aPrintFileOptions; + std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create()); if( m_xPaperSizeCB->get_state_changed_from_saved()) - aWarnOptions.SetPaperSize(m_xPaperSizeCB->get_active()); + officecfg::Office::Common::Print::Warning::PaperSize::set(m_xPaperSizeCB->get_active(), batch); if( m_xPaperOrientationCB->get_state_changed_from_saved() ) - aWarnOptions.SetPaperOrientation(m_xPaperOrientationCB->get_active()); + officecfg::Office::Common::Print::Warning::PaperOrientation::set(m_xPaperOrientationCB->get_active(), batch); if( m_xTransparencyCB->get_state_changed_from_saved() ) - aWarnOptions.SetTransparency( m_xTransparencyCB->get_active() ); + officecfg::Office::Common::Print::Warning::Transparency::set(m_xTransparencyCB->get_active(), batch); + + batch->commit(); ImplSaveControls( m_xPrinterOutputRB->get_active() ? &maPrinterOptions : &maPrintFileOptions ); @@ -113,12 +115,9 @@ bool SfxCommonPrintOptionsTabPage::FillItemSet( SfxItemSet* /*rSet*/ ) void SfxCommonPrintOptionsTabPage::Reset( const SfxItemSet* /*rSet*/ ) { - SvtPrintWarningOptions aWarnOptions; - - m_xPaperSizeCB->set_active( aWarnOptions.IsPaperSize() ); - m_xPaperOrientationCB->set_active( aWarnOptions.IsPaperOrientation() ); - - m_xTransparencyCB->set_active( aWarnOptions.IsTransparency() ); + m_xPaperSizeCB->set_active(officecfg::Office::Common::Print::Warning::PaperSize::get()); + m_xPaperOrientationCB->set_active(officecfg::Office::Common::Print::Warning::PaperOrientation::get()); + m_xTransparencyCB->set_active(officecfg::Office::Common::Print::Warning::Transparency::get()); m_xPaperSizeCB->save_state(); m_xPaperOrientationCB->save_state(); diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx index f0200f421b91..19b954d26fe6 100644 --- a/sfx2/source/view/viewprn.cxx +++ b/sfx2/source/view/viewprn.cxx @@ -22,7 +22,7 @@ #include <com/sun/star/document/XDocumentProperties.hpp> #include <com/sun/star/view/XRenderable.hpp> #include <com/sun/star/view/XSelectionSupplier.hpp> - +#include <officecfg/Office/Common.hxx> #include <sal/log.hxx> #include <svl/itempool.hxx> #include <vcl/svapp.hxx> @@ -33,7 +33,6 @@ #include <svl/eitem.hxx> #include <sfx2/app.hxx> #include <unotools/useroptions.hxx> -#include <unotools/printwarningoptions.hxx> #include <tools/datetime.hxx> #include <sfx2/bindings.hxx> #include <sfx2/objface.hxx> @@ -303,7 +302,7 @@ void SfxPrinterController::jobStarted() m_bOrigStatus = mpObjectShell->IsEnableSetModified(); // check configuration: shall update of printing information in DocInfo set the document to "modified"? - if ( m_bOrigStatus && !SvtPrintWarningOptions().IsModifyDocumentOnPrintingAllowed() ) + if (m_bOrigStatus && !officecfg::Office::Common::Print::PrintingModifiesDocument::get()) { mpObjectShell->EnableSetModified( false ); m_bNeedsChange = true; diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index 2431d37a0d48..20ac504ec710 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -7248,7 +7248,6 @@ include/unotools/nativenumberwrapper.hxx include/unotools/options.hxx include/unotools/optionsdlg.hxx include/unotools/pathoptions.hxx -include/unotools/printwarningoptions.hxx include/unotools/progresshandlerwrap.hxx include/unotools/readwritemutexguard.hxx include/unotools/resmgr.hxx @@ -16280,7 +16279,6 @@ unotools/source/config/moduleoptions.cxx unotools/source/config/options.cxx unotools/source/config/optionsdlg.cxx unotools/source/config/pathoptions.cxx -unotools/source/config/printwarningoptions.cxx unotools/source/config/saveopt.cxx unotools/source/config/searchopt.cxx unotools/source/config/securityoptions.cxx diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index ed42e0d978fb..637f13488921 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -20,7 +20,7 @@ #include <boost/property_tree/json_parser.hpp> #include <sal/config.h> - +#include <officecfg/Office/Common.hxx> #include <comphelper/string.hxx> #include <AnnotationWin.hxx> #include <o3tl/any.hxx> @@ -79,7 +79,6 @@ #include <unochart.hxx> #include <charatr.hxx> #include <svx/xmleohlp.hxx> -#include <unotools/printwarningoptions.hxx> #include <com/sun/star/lang/ServiceNotRegisteredException.hpp> #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> @@ -2588,7 +2587,7 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( // #122919# Force field update before PDF export, but after layout init (tdf#121962) bool bStateChanged = false; // check configuration: shall update of printing information in DocInfo set the document to "modified"? - if ( pRenderDocShell->IsEnableSetModified() && !SvtPrintWarningOptions().IsModifyDocumentOnPrintingAllowed() ) + if (pRenderDocShell->IsEnableSetModified() && !officecfg::Office::Common::Print::PrintingModifiesDocument::get()) { pRenderDocShell->EnableSetModified( false ); bStateChanged = true; diff --git a/unotools/Library_utl.mk b/unotools/Library_utl.mk index b1bb21e129ba..5db591fa2ff5 100644 --- a/unotools/Library_utl.mk +++ b/unotools/Library_utl.mk @@ -79,7 +79,6 @@ $(eval $(call gb_Library_add_exception_objects,utl,\ unotools/source/config/options \ unotools/source/config/optionsdlg \ unotools/source/config/pathoptions \ - unotools/source/config/printwarningoptions \ unotools/source/config/saveopt \ unotools/source/config/searchopt \ unotools/source/config/securityoptions \ diff --git a/unotools/source/config/itemholder1.cxx b/unotools/source/config/itemholder1.cxx index cdb7084981fb..4bb1f23ec623 100644 --- a/unotools/source/config/itemholder1.cxx +++ b/unotools/source/config/itemholder1.cxx @@ -34,7 +34,6 @@ #include <unotools/lingucfg.hxx> #include <unotools/moduleoptions.hxx> #include <unotools/pathoptions.hxx> -#include <unotools/printwarningoptions.hxx> #include <unotools/optionsdlg.hxx> #include <unotools/securityoptions.hxx> #include <unotools/viewoptions.hxx> @@ -164,10 +163,6 @@ void ItemHolder1::impl_newItem(TItemInfo& rItem) rItem.pItem.reset( new SvtPathOptions() ); break; - case EItem::PrintWarningOptions : - rItem.pItem.reset( new SvtPrintWarningOptions() ); - break; - case EItem::MiscConfig : rItem.pItem.reset( new ::utl::MiscCfg() ); break; diff --git a/unotools/source/config/printwarningoptions.cxx b/unotools/source/config/printwarningoptions.cxx deleted file mode 100644 index c2409dab3027..000000000000 --- a/unotools/source/config/printwarningoptions.cxx +++ /dev/null @@ -1,319 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <unotools/printwarningoptions.hxx> -#include <unotools/configitem.hxx> -#include <tools/debug.hxx> -#include <com/sun/star/uno/Any.hxx> -#include <com/sun/star/uno/Sequence.hxx> - -#include "itemholder1.hxx" - -// namespaces - -using namespace ::utl; -using namespace ::osl; -using namespace ::com::sun::star::uno; - -#define ROOTNODE_START "Office.Common/Print" - -#define PROPERTYNAME_PAPERSIZE OUString("Warning/PaperSize") -#define PROPERTYNAME_PAPERORIENTATION OUString("Warning/PaperOrientation") -#define PROPERTYNAME_NOTFOUND OUString("Warning/NotFound") -#define PROPERTYNAME_TRANSPARENCY OUString("Warning/Transparency") -#define PROPERTYNAME_PRINTINGMODIFIESDOCUMENT OUString("PrintingModifiesDocument") - -#define PROPERTYHANDLE_PAPERSIZE 0 -#define PROPERTYHANDLE_PAPERORIENTATION 1 -#define PROPERTYHANDLE_NOTFOUND 2 -#define PROPERTYHANDLE_TRANSPARENCY 3 -#define PROPERTYHDL_PRINTINGMODIFIESDOCUMENT 4 - -#define PROPERTYCOUNT 5 - -class SvtPrintWarningOptions_Impl : public ConfigItem -{ -public: - -// constructor / destructor - - SvtPrintWarningOptions_Impl(); - virtual ~SvtPrintWarningOptions_Impl() override; - -// override methods of baseclass - - virtual void Notify( const css::uno::Sequence< OUString >& aPropertyNames ) override; - -// public interface - - bool IsPaperSize() const { return m_bPaperSize; } - bool IsPaperOrientation() const { return m_bPaperOrientation; } - bool IsTransparency() const { return m_bTransparency; } - bool IsModifyDocumentOnPrintingAllowed() const { return m_bModifyDocumentOnPrintingAllowed; } - - void SetPaperSize( bool bState ) { m_bPaperSize = bState; SetModified(); } - void SetPaperOrientation( bool bState ) { m_bPaperOrientation = bState; SetModified(); } - void SetTransparency( bool bState ) { m_bTransparency = bState; SetModified(); } - void SetModifyDocumentOnPrintingAllowed( bool bState ) { m_bModifyDocumentOnPrintingAllowed = bState; SetModified(); } - -// private methods - -private: - - virtual void ImplCommit() override; - - static Sequence< OUString > impl_GetPropertyNames(); - -// private member - -private: - - bool m_bPaperSize; - bool m_bPaperOrientation; - bool m_bNotFound; - bool m_bTransparency; - bool m_bModifyDocumentOnPrintingAllowed; -}; - -// constructor - -SvtPrintWarningOptions_Impl::SvtPrintWarningOptions_Impl() : - ConfigItem( ROOTNODE_START ), - m_bPaperSize( false ), - m_bPaperOrientation( false ), - m_bNotFound( false ), - m_bTransparency( true ), - m_bModifyDocumentOnPrintingAllowed( true ) -{ - Sequence< OUString > seqNames( impl_GetPropertyNames() ); - Sequence< Any > seqValues( GetProperties( seqNames ) ); - - DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtPrintWarningOptions_Impl::SvtPrintWarningOptions_Impl()\nI miss some values of configuration keys!\n" ); - - // Copy values from list in right order to our internal member. - sal_Int32 nPropertyCount = seqValues.getLength(); - sal_Int32 nProperty = 0; - - for( nProperty=0; nProperty<nPropertyCount; ++nProperty ) - { - DBG_ASSERT( seqValues[nProperty].hasValue(), "SvtPrintWarningOptions_Impl::SvtPrintWarningOptions_Impl()\nInvalid property value for property detected!\n" ); - - switch( nProperty ) - { - case PROPERTYHANDLE_PAPERSIZE: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "Invalid type" ); - seqValues[nProperty] >>= m_bPaperSize; - } - break; - - case PROPERTYHANDLE_PAPERORIENTATION: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "Invalid type" ); - seqValues[nProperty] >>= m_bPaperOrientation; - } - break; - - case PROPERTYHANDLE_NOTFOUND: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "Invalid type" ); - seqValues[nProperty] >>= m_bNotFound; - } - break; - - case PROPERTYHANDLE_TRANSPARENCY: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "Invalid type" ); - seqValues[nProperty] >>= m_bTransparency; - } - break; - case PROPERTYHDL_PRINTINGMODIFIESDOCUMENT: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "Invalid type" ); - seqValues[nProperty] >>= m_bModifyDocumentOnPrintingAllowed; - } - break; - - } - } -} - -// destructor - -SvtPrintWarningOptions_Impl::~SvtPrintWarningOptions_Impl() -{ - assert(!IsModified()); // should have been committed -} - -// Commit - -void SvtPrintWarningOptions_Impl::ImplCommit() -{ - Sequence< OUString > aSeqNames( impl_GetPropertyNames() ); - Sequence< Any > aSeqValues( aSeqNames.getLength() ); - - for( sal_Int32 nProperty = 0, nCount = aSeqNames.getLength(); nProperty < nCount; ++nProperty ) - { - switch( nProperty ) - { - case PROPERTYHANDLE_PAPERSIZE: - aSeqValues[nProperty] <<= m_bPaperSize; - break; - - case PROPERTYHANDLE_PAPERORIENTATION: - aSeqValues[nProperty] <<= m_bPaperOrientation; - break; - - case PROPERTYHANDLE_NOTFOUND: - aSeqValues[nProperty] <<= m_bNotFound; - break; - - case PROPERTYHANDLE_TRANSPARENCY: - aSeqValues[nProperty] <<= m_bTransparency; - break; - case PROPERTYHDL_PRINTINGMODIFIESDOCUMENT: - aSeqValues[nProperty] <<= m_bModifyDocumentOnPrintingAllowed; - break; - } - } - - PutProperties( aSeqNames, aSeqValues ); -} - -void SvtPrintWarningOptions_Impl::Notify( const Sequence< OUString >& ) -{ -} - -// private method - -Sequence< OUString > SvtPrintWarningOptions_Impl::impl_GetPropertyNames() -{ - // Build list of configuration key names. - const OUString pProperties[] = - { - PROPERTYNAME_PAPERSIZE, - PROPERTYNAME_PAPERORIENTATION, - PROPERTYNAME_NOTFOUND, - PROPERTYNAME_TRANSPARENCY, - PROPERTYNAME_PRINTINGMODIFIESDOCUMENT - }; - - // Initialize return sequence with these list ... - const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); - - return seqPropertyNames; -} - -static std::weak_ptr<SvtPrintWarningOptions_Impl> g_pPrintWarningOptions; - -SvtPrintWarningOptions::SvtPrintWarningOptions() -{ - // Global access, must be guarded (multithreading!). - MutexGuard aGuard( GetOwnStaticMutex() ); - - m_pImpl = g_pPrintWarningOptions.lock(); - if( !m_pImpl ) - { - m_pImpl = std::make_shared<SvtPrintWarningOptions_Impl>(); - g_pPrintWarningOptions = m_pImpl; - ItemHolder1::holdConfigItem(EItem::PrintWarningOptions); - } -} - -SvtPrintWarningOptions::~SvtPrintWarningOptions() -{ - // Global access, must be guarded (multithreading!) - MutexGuard aGuard( GetOwnStaticMutex() ); - - m_pImpl.reset(); -} - -// public method - -bool SvtPrintWarningOptions::IsPaperSize() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pImpl->IsPaperSize(); -} - -// public method - -bool SvtPrintWarningOptions::IsPaperOrientation() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pImpl->IsPaperOrientation(); -} - -// public method - -bool SvtPrintWarningOptions::IsTransparency() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pImpl->IsTransparency(); -} - -// public method - -void SvtPrintWarningOptions::SetPaperSize( bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pImpl->SetPaperSize( bState ); -} - -// public method - -void SvtPrintWarningOptions::SetPaperOrientation( bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pImpl->SetPaperOrientation( bState ); -} - -// public method - -void SvtPrintWarningOptions::SetTransparency( bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pImpl->SetTransparency( bState ); -} - -bool SvtPrintWarningOptions::IsModifyDocumentOnPrintingAllowed() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pImpl->IsModifyDocumentOnPrintingAllowed(); -} - -void SvtPrintWarningOptions::SetModifyDocumentOnPrintingAllowed( bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pImpl->SetModifyDocumentOnPrintingAllowed( bState ); -} - -namespace -{ - class thePrintWarningOptionsMutex : public rtl::Static<osl::Mutex, thePrintWarningOptionsMutex>{}; -} - -// private method - -Mutex& SvtPrintWarningOptions::GetOwnStaticMutex() -{ - return thePrintWarningOptionsMutex::get(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |