25#include <com/sun/star/beans/XPropertySet.hpp>
26#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
27#include <com/sun/star/frame/ModuleManager.hpp>
28#include <com/sun/star/frame/UnknownModuleException.hpp>
29#include <com/sun/star/frame/XFrame.hpp>
37FrameListAnalyzer::FrameListAnalyzer(
const css::uno::Reference< css::frame::XFramesSupplier >& xSupplier ,
38 const css::uno::Reference< css::frame::XFrame >& xReferenceFrame ,
40 : m_xSupplier (xSupplier )
41 , m_xReferenceFrame(xReferenceFrame)
42 , m_eDetectMode (eDetectMode )
47FrameListAnalyzer::~FrameListAnalyzer()
65void FrameListAnalyzer::impl_analyze()
68 m_bReferenceIsHidden =
false;
69 m_bReferenceIsHelp =
false;
70 m_bReferenceIsBacking =
false;
72 m_xBackingComponent.clear();
75 css::uno::Reference< css::container::XIndexAccess > xFrameContainer = m_xSupplier->getFrames();
79 sal_Int32 nVisibleStep = 0;
80 sal_Int32 nHiddenStep = 0;
81 sal_Int32 nModelStep = 0;
82 sal_Int32
nCount = xFrameContainer->getCount();
84 m_lOtherVisibleFrames.resize(nCount);
85 m_lOtherHiddenFrames.resize(nCount);
86 m_lModelFrames.resize(nCount);
92 css::uno::Reference< css::frame::XModel > xReferenceModel;
95 css::uno::Reference< css::frame::XController > xReferenceController;
96 if (m_xReferenceFrame.is())
97 xReferenceController = m_xReferenceFrame->getController();
98 if (xReferenceController.is())
99 xReferenceModel = xReferenceController->getModel();
104 css::uno::Reference< css::beans::XPropertySet > xSet(m_xReferenceFrame, css::uno::UNO_QUERY);
116 css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
117 css::uno::Reference< css::frame::XModuleManager2 > xModuleMgr = css::frame::ModuleManager::create(xContext);
118 OUString sModule = xModuleMgr->identify(m_xReferenceFrame);
119 m_bReferenceIsBacking = sModule ==
"com.sun.star.frame.StartModule";
121 catch(
const css::frame::UnknownModuleException&)
124 catch(
const css::uno::Exception&)
134 (m_xReferenceFrame.is() ) &&
138 m_bReferenceIsHelp =
true;
149 css::uno::Reference< css::frame::XFrame >
xFrame;
151 !(xFrameContainer->getByIndex(i) >>= xFrame) ||
153 (xFrame==m_xReferenceFrame )
160 (!
xFrame->getContainerWindow().is()) ||
161 (!
xFrame->getComponentWindow().is())
165 SAL_INFO(
"fwk",
"FrameListAnalyzer::impl_analyze(): ZOMBIE!");
187 css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
188 css::uno::Reference< css::frame::XModuleManager2 > xModuleMgr = css::frame::ModuleManager::create(xContext);
189 OUString sModule = xModuleMgr->identify(xFrame);
190 if (sModule ==
"com.sun.star.frame.StartModule")
192 m_xBackingComponent =
xFrame;
196 catch (
const css::uno::Exception&)
205 css::uno::Reference< css::frame::XController >
xController =
xFrame->getController();
206 css::uno::Reference< css::frame::XModel >
xModel;
209 if (xModel==xReferenceModel)
211 m_lModelFrames[nModelStep] =
xFrame;
221 bool bHidden =
false;
224 xSet.set(xFrame, css::uno::UNO_QUERY);
233 m_lOtherHiddenFrames[nHiddenStep] =
xFrame;
238 m_lOtherVisibleFrames[nVisibleStep] =
xFrame;
243 catch (
const css::lang::IndexOutOfBoundsException&)
253 m_lOtherVisibleFrames.resize(nVisibleStep);
254 m_lOtherHiddenFrames.resize(nHiddenStep);
255 m_lModelFrames.resize(nModelStep);
#define DBG_UNHANDLED_EXCEPTION(...)
FrameAnalyzerFlags
These enums can be combined as flags to enable/disable special search algorithm during analyze phase.
#define SAL_INFO(area, stream)
constexpr OUStringLiteral FRAME_PROPNAME_ASCII_ISHIDDEN
constexpr OUStringLiteral SPECIALTARGET_HELPTASK
Reference< XController > xController
Reference< XFrame > xFrame
Reference< XModel > xModel