diff options
Diffstat (limited to 'framework')
-rw-r--r-- | framework/inc/classes/taskcreator.hxx | 3 | ||||
-rw-r--r-- | framework/source/classes/taskcreator.cxx | 10 | ||||
-rw-r--r-- | framework/source/loadenv/loadenv.cxx | 4 | ||||
-rw-r--r-- | framework/source/services/desktop.cxx | 4 | ||||
-rw-r--r-- | framework/source/services/frame.cxx | 23 | ||||
-rw-r--r-- | framework/source/services/taskcreatorsrv.cxx | 9 |
6 files changed, 40 insertions, 13 deletions
diff --git a/framework/inc/classes/taskcreator.hxx b/framework/inc/classes/taskcreator.hxx index 3c34bb00e1ad..ee8056f13812 100644 --- a/framework/inc/classes/taskcreator.hxx +++ b/framework/inc/classes/taskcreator.hxx @@ -27,6 +27,7 @@ #include <com/sun/star/uno/Reference.hxx> #include <rtl/ustring.hxx> +#include <unotools/mediadescriptor.hxx> namespace framework{ @@ -53,7 +54,7 @@ class TaskCreator final TaskCreator( const css::uno::Reference< css::uno::XComponentContext >& xContext ); ~TaskCreator( ); - css::uno::Reference< css::frame::XFrame > createTask( const OUString& sName ); + css::uno::Reference< css::frame::XFrame > createTask( const OUString& sName, const utl::MediaDescriptor& rDesciprtor ); }; // class TaskCreator diff --git a/framework/source/classes/taskcreator.cxx b/framework/source/classes/taskcreator.cxx index 612ab433e7e3..0bf720b510ac 100644 --- a/framework/source/classes/taskcreator.cxx +++ b/framework/source/classes/taskcreator.cxx @@ -57,7 +57,7 @@ TaskCreator::~TaskCreator() /*-**************************************************************************************************** TODO document me *//*-*****************************************************************************************************/ -css::uno::Reference< css::frame::XFrame > TaskCreator::createTask( const OUString& sName ) +css::uno::Reference< css::frame::XFrame > TaskCreator::createTask( const OUString& sName, const utl::MediaDescriptor& rDescriptor ) { css::uno::Reference< css::lang::XSingleServiceFactory > xCreator; OUString sCreator = IMPLEMENTATIONNAME_FWK_TASKCREATOR; @@ -86,7 +86,7 @@ css::uno::Reference< css::frame::XFrame > TaskCreator::createTask( const OUStrin if ( ! xCreator.is()) xCreator = css::frame::TaskCreator::create(m_xContext); - css::uno::Sequence< css::uno::Any > lArgs(5); + css::uno::Sequence< css::uno::Any > lArgs(6); css::beans::NamedValue aArg; aArg.Name = ARGUMENT_PARENTFRAME; @@ -109,6 +109,12 @@ css::uno::Reference< css::frame::XFrame > TaskCreator::createTask( const OUStrin aArg.Value <<= sName; lArgs[4] <<= aArg; + bool bHidden + = rDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_HIDDEN(), false); + aArg.Name = "Hidden"; + aArg.Value <<= bHidden; + lArgs[5] <<= aArg; + css::uno::Reference< css::frame::XFrame > xTask(xCreator->createInstanceWithArguments(lArgs), css::uno::UNO_QUERY_THROW); return xTask; } diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index 6fd8f5b54061..d5819ebb6675 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -87,6 +87,7 @@ #include <vcl/svapp.hxx> #include <cppuhelper/implbase.hxx> #include <comphelper/profilezone.hxx> +#include <classes/taskcreator.hxx> const char PROP_TYPES[] = "Types"; const char PROP_NAME[] = "Name"; @@ -989,7 +990,8 @@ bool LoadEnv::impl_loadContent() { if (! impl_furtherDocsAllowed()) return false; - m_xTargetFrame = m_xBaseFrame->findFrame(SPECIALTARGET_BLANK, 0); + TaskCreator aCreator(m_xContext); + m_xTargetFrame = aCreator.createTask(SPECIALTARGET_BLANK, m_lMediaDescriptor); m_bCloseFrameOnError = m_xTargetFrame.is(); } else diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx index b7fc1a152ed3..fbfe5cd9f7c6 100644 --- a/framework/source/services/desktop.cxx +++ b/framework/source/services/desktop.cxx @@ -967,7 +967,7 @@ css::uno::Reference< css::frame::XFrame > SAL_CALL Desktop::findFrame( const OUS if ( sTargetFrameName==SPECIALTARGET_BLANK ) { TaskCreator aCreator( m_xContext ); - xTarget = aCreator.createTask(sTargetFrameName); + xTarget = aCreator.createTask(sTargetFrameName, utl::MediaDescriptor()); } // I.II) "_top" @@ -1051,7 +1051,7 @@ css::uno::Reference< css::frame::XFrame > SAL_CALL Desktop::findFrame( const OUS ) { TaskCreator aCreator( m_xContext ); - xTarget = aCreator.createTask(sTargetFrameName); + xTarget = aCreator.createTask(sTargetFrameName, utl::MediaDescriptor()); } } diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx index adc174a8ad3a..0357a4955b82 100644 --- a/framework/source/services/frame.cxx +++ b/framework/source/services/frame.cxx @@ -412,6 +412,8 @@ private: bool m_bSelfClose; /// indicates, if this frame is used in hidden mode or not bool m_bIsHidden; + /// The container window has WindowExtendedStyle::DocHidden set. + bool m_bDocHidden = false; /// is used to layout the child windows of the frame. css::uno::Reference< css::frame::XLayoutManager2 > m_xLayoutManager; css::uno::Reference< css::frame::XDispatchInformationProvider > m_xDispatchInfoHelper; @@ -772,8 +774,13 @@ void SAL_CALL Frame::initialize( const css::uno::Reference< css::awt::XWindow >& // if window is initially visible, we will never get a windowShowing event VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xWindow); - if (pWindow && pWindow->IsVisible()) - m_bIsHidden = false; + if (pWindow) + { + if (pWindow->IsVisible()) + m_bIsHidden = false; + m_bDocHidden + = static_cast<bool>(pWindow->GetExtendedStyle() & WindowExtendedStyle::DocHidden); + } css::uno::Reference< css::frame::XLayoutManager2 > xLayoutManager = m_xLayoutManager; @@ -782,7 +789,9 @@ void SAL_CALL Frame::initialize( const css::uno::Reference< css::awt::XWindow >& aWriteLock.clear(); /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ - if (xLayoutManager.is()) + // Avoid enabling the layout manager for hidden frames: it's expensive and + // provides little value. + if (xLayoutManager.is() && !m_bDocHidden) lcl_enableLayoutManager(xLayoutManager, this); // create progress helper @@ -971,7 +980,7 @@ css::uno::Reference< css::frame::XFrame > SAL_CALL Frame::findFrame( const OUStr if ( sTargetFrameName==SPECIALTARGET_BLANK ) { TaskCreator aCreator(m_xContext); - xTarget = aCreator.createTask(sTargetFrameName); + xTarget = aCreator.createTask(sTargetFrameName, utl::MediaDescriptor()); } // I.II) "_parent" @@ -1171,7 +1180,7 @@ css::uno::Reference< css::frame::XFrame > SAL_CALL Frame::findFrame( const OUStr ) { TaskCreator aCreator(m_xContext); - xTarget = aCreator.createTask(sTargetFrameName); + xTarget = aCreator.createTask(sTargetFrameName, utl::MediaDescriptor()); } } @@ -1825,7 +1834,7 @@ void SAL_CALL Frame::setLayoutManager(const css::uno::Reference<css::uno::XInter m_xLayoutManager = xNewLayoutManager; if (xOldLayoutManager.is()) disableLayoutManager(xOldLayoutManager); - if (xNewLayoutManager.is()) + if (xNewLayoutManager.is() && !m_bDocHidden) lcl_enableLayoutManager(xNewLayoutManager, this); } } @@ -2738,7 +2747,7 @@ void Frame::impl_setPropertyValue(sal_Int32 nHandle, m_xLayoutManager = xNewLayoutManager; if (xOldLayoutManager.is()) disableLayoutManager(xOldLayoutManager); - if (xNewLayoutManager.is()) + if (xNewLayoutManager.is() && !m_bDocHidden) lcl_enableLayoutManager(xNewLayoutManager, this); } } diff --git a/framework/source/services/taskcreatorsrv.cxx b/framework/source/services/taskcreatorsrv.cxx index 26708477a502..c0f98832cd69 100644 --- a/framework/source/services/taskcreatorsrv.cxx +++ b/framework/source/services/taskcreatorsrv.cxx @@ -129,6 +129,8 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL TaskCreatorService::createI css::uno::Reference< css::awt::XWindow > xContainerWindow = lArgs.getUnpackedValueOrDefault(ARGUMENT_CONTAINERWINDOW , css::uno::Reference< css::awt::XWindow >() ); bool bSupportPersistentWindowState = lArgs.getUnpackedValueOrDefault(ARGUMENT_SUPPORTPERSISTENTWINDOWSTATE , false ); bool bEnableTitleBarUpdate = lArgs.getUnpackedValueOrDefault(ARGUMENT_ENABLE_TITLEBARUPDATE , true ); + // If the frame is explicitly requested to be hidden. + bool bHidden = lArgs.getUnpackedValueOrDefault("Hidden", false); // We use FrameName property to set it as API name of the new created frame later. // But those frame names must be different from the set of special target names as e.g. _blank, _self etcpp ! @@ -167,6 +169,13 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL TaskCreatorService::createI //-------------------> // create the new frame + VclPtr<vcl::Window> pContainerWindow = VCLUnoHelper::GetWindow(xContainerWindow); + if (pContainerWindow && bHidden) + { + WindowExtendedStyle eStyle = pContainerWindow->GetExtendedStyle(); + eStyle |= WindowExtendedStyle::DocHidden; + pContainerWindow->SetExtendedStyle(eStyle); + } css::uno::Reference< css::frame::XFrame2 > xFrame = implts_createFrame(xParentFrame, xContainerWindow, sRightName); // special freature: |