class TaskCreatorService : public TaskCreatorService_BASE
{ private:
/** @short the global uno service manager. @descrMustbeusedtocreateownneededservices.
*/
css::uno::Reference< css::uno::XComponentContext > m_xContext;
// 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 !
OUString sRightName = impl_filterNames(sFrameName);
// if no external frame window was given ... create a new one. if ( ! xContainerWindow.is())
{
css::uno::Reference< css::awt::XWindow > xParentWindow; if (xParentFrame.is())
xParentWindow = xParentFrame->getContainerWindow();
// Parent has no own window ... // So we have to create a top level window always ! if ( ! xParentWindow.is())
bCreateTopWindow = true;
// #i53630# // Mark all document windows as "special ones", so VCL can bind // special features to it. Because VCL doesn't know anything about documents ... // Note: Doing so it's no longer supported, that e.g. our wizards can use findFrame(_blank) // to create it's previous frames. They must do it manually by using WindowDescriptor+Toolkit!
css::uno::Reference< css::frame::XDesktop > xDesktop(xParentFrame, css::uno::UNO_QUERY); bool bTopLevelDocumentWindow = (
sRightName.isEmpty() &&
(
(! xParentFrame.is() ) ||
( xDesktop.is() )
)
); if (bTopLevelDocumentWindow)
implts_applyDocStyleToWindow(xContainerWindow); //------------------->
// special feature: // A special listener will restore pos/size states in case // a component was loaded into the frame first time. if (bSupportPersistentWindowState)
implts_establishWindowStateListener(xFrame);
// special feature: On Mac we need tagging the window in case // the underlying model was modified. // VCL will ignore our calls in case different platform then Mac // is used ... if (bTopLevelDocumentWindow)
implts_establishDocModifyListener (xFrame);
// special feature: // A special listener will update title bar (text and icon) // if component of frame will be changed. if (bEnableTitleBarUpdate)
implts_establishTitleBarUpdate(xFrame);
// Make it visible directly here... // if it's required from outside. if (bVisible)
xContainerWindow->setVisible(bVisible);
// Check if child frames can be created really. We need at least a valid window at the parent frame ...
css::uno::Reference< css::awt::XWindowPeer > xParentWindowPeer; if ( ! bTopWindow)
{ if ( ! xParentWindow.is())
bTopWindow = false; else
xParentWindowPeer.set(xParentWindow, css::uno::UNO_QUERY_THROW);
}
// create a new blank container window and get access to parent container to append new created task.
css::uno::Reference< css::awt::XWindowPeer > xPeer = xToolkit->createWindow( aDescriptor );
css::uno::Reference< css::awt::XWindow > xWindow ( xPeer, css::uno::UNO_QUERY_THROW );
// Set window on frame. // Do it before calling any other interface methods ... // The new created frame must be initialized before you can do anything else there.
xNewFrame->initialize( xContainerWindow );
// Put frame to the frame tree. // Note: The property creator/parent will be set on the new putted frame automatically ... by the parent container. if (xParentFrame.is())
{
css::uno::Reference< css::frame::XFramesSupplier > xSupplier (xParentFrame, css::uno::UNO_QUERY_THROW);
css::uno::Reference< css::frame::XFrames > xContainer = xSupplier->getFrames();
xContainer->append( css::uno::Reference<css::frame::XFrame>(xNewFrame, css::uno::UNO_QUERY_THROW) );
}
// Set it's API name (if there is one from outside) if (!sName.isEmpty())
xNewFrame->setName( sName );
return xNewFrame;
}
void TaskCreatorService::implts_establishWindowStateListener( const css::uno::Reference< css::frame::XFrame2 >& xFrame )
{ // Special feature: It's allowed for frames using a top level window only! // We must create a special listener service and couple it with the new created task frame. // He will restore or save the window state of it ... // See used classes for further information too.
rtl::Reference<PersistentWindowState> pPersistentStateHandler = new PersistentWindowState( m_xContext );
// static void TaskCreatorService::implts_establishDocModifyListener( const css::uno::Reference< css::frame::XFrame2 >& xFrame )
{ // Special feature: It's allowed for frames using a top level window only! // We must create a special listener service and couple it with the new created task frame. // It will tag the window as modified if the underlying model was modified ...
rtl::Reference<TagWindowAsModified> pTag = new TagWindowAsModified();
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.