/* -*- 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 .
*/
switch ( nClassId )
{ case FormComponentType::TEXTFIELD:
{
Reference< XInterface > xIFace;
aUnoObj >>= xIFace;
pClassNameResourceId = RID_STR_PROPTITLE_EDIT; if (xIFace.is())
{ // we have a chance to check if it's a formatted field model
Reference< XServiceInfo > xInfo(xIFace, UNO_QUERY); if (xInfo.is() && (xInfo->supportsService(FM_SUN_COMPONENT_FORMATTEDFIELD)))
pClassNameResourceId = RID_STR_PROPTITLE_FORMATTED; elseif (!xInfo.is())
{ // couldn't distinguish between formatted and edit with the service name, so try with the properties
Reference< XPropertySet > xProps(xIFace, UNO_QUERY); if (xProps.is())
{
Reference< XPropertySetInfo > xPropsInfo = xProps->getPropertySetInfo(); if (xPropsInfo.is() && xPropsInfo->hasPropertyByName(FM_PROP_FORMATSSUPPLIER))
pClassNameResourceId = RID_STR_PROPTITLE_FORMATTED;
}
}
}
} break;
case FormComponentType::COMMANDBUTTON:
pClassNameResourceId = RID_STR_PROPTITLE_PUSHBUTTON; break; case FormComponentType::RADIOBUTTON:
pClassNameResourceId = RID_STR_PROPTITLE_RADIOBUTTON; break; case FormComponentType::CHECKBOX:
pClassNameResourceId = RID_STR_PROPTITLE_CHECKBOX; break; case FormComponentType::LISTBOX:
pClassNameResourceId = RID_STR_PROPTITLE_LISTBOX; break; case FormComponentType::COMBOBOX:
pClassNameResourceId = RID_STR_PROPTITLE_COMBOBOX; break; case FormComponentType::GROUPBOX:
pClassNameResourceId = RID_STR_PROPTITLE_GROUPBOX; break; case FormComponentType::IMAGEBUTTON:
pClassNameResourceId = RID_STR_PROPTITLE_IMAGEBUTTON; break; case FormComponentType::FIXEDTEXT:
pClassNameResourceId = RID_STR_PROPTITLE_FIXEDTEXT; break; case FormComponentType::GRIDCONTROL:
pClassNameResourceId = RID_STR_PROPTITLE_DBGRID; break; case FormComponentType::FILECONTROL:
pClassNameResourceId = RID_STR_PROPTITLE_FILECONTROL; break; case FormComponentType::DATEFIELD:
pClassNameResourceId = RID_STR_PROPTITLE_DATEFIELD; break; case FormComponentType::TIMEFIELD:
pClassNameResourceId = RID_STR_PROPTITLE_TIMEFIELD; break; case FormComponentType::NUMERICFIELD:
pClassNameResourceId = RID_STR_PROPTITLE_NUMERICFIELD; break; case FormComponentType::CURRENCYFIELD:
pClassNameResourceId = RID_STR_PROPTITLE_CURRENCYFIELD; break; case FormComponentType::PATTERNFIELD:
pClassNameResourceId = RID_STR_PROPTITLE_PATTERNFIELD; break; case FormComponentType::IMAGECONTROL:
pClassNameResourceId = RID_STR_PROPTITLE_IMAGECONTROL; break; case FormComponentType::HIDDENCONTROL:
pClassNameResourceId = RID_STR_PROPTITLE_HIDDEN; break; case FormComponentType::SCROLLBAR:
pClassNameResourceId = RID_STR_PROPTITLE_SCROLLBAR; break; case FormComponentType::SPINBUTTON:
pClassNameResourceId = RID_STR_PROPTITLE_SPINBUTTON; break; case FormComponentType::NAVIGATIONBAR:
pClassNameResourceId = RID_STR_PROPTITLE_NAVBAR; break; case FormComponentType::CONTROL: default:
pClassNameResourceId = RID_STR_CONTROL; break;
}
try
{ // create a frame wrapper for myself
m_xMeAsFrame = Frame::create(m_xORB);
// transport the container area of this dialog to be the container window of the frame
css::uno::Reference<css::awt::XWindow> xFrameContainerWindow(new weld::TransportAsXWindow(m_xContainer.get()));
m_xMeAsFrame->initialize(xFrameContainerWindow);
m_xMeAsFrame->setName(u"form property browser"_ustr);
} catch (const Exception&)
{
OSL_FAIL("FmPropBrw::FmPropBrw: could not create/initialize my frame!");
m_xMeAsFrame.clear();
}
if ( _pInfo )
m_sLastActivePage = _pInfo->aExtraString;
}
FmPropBrw::~FmPropBrw()
{ if (m_nAsyncGetFocusId)
{
Application::RemoveUserEvent(m_nAsyncGetFocusId);
m_nAsyncGetFocusId = nullptr;
}
if (m_xBrowserController.is())
implDetachController(); try
{ // remove our own properties from the component context. We cannot ensure that the component context // is freed (there might be refcount problems :-\), so at least ensure the context itself // does hold the objects anymore
Reference<XNameContainer> xName(m_xInspectorContext,uno::UNO_QUERY); if ( xName.is() )
{ const OUString pProps[] = { u"ContextDocument"_ustr
, u"DialogParentWindow"_ustr
, u"ControlContext"_ustr
, u"ControlShapeAccess"_ustr }; for (constauto & i : pProps)
xName->removeByName( i );
}
} catch (const Exception& )
{
DBG_UNHANDLED_EXCEPTION("svx");
}
::SfxControllerItem::dispose();
}
if ( m_xMeAsFrame.is() )
{ try
{
m_xMeAsFrame->setComponent(nullptr, nullptr);
} catch( const Exception& )
{
TOOLS_WARN_EXCEPTION("svx.form", "caught an exception while resetting the component!");
}
}
// we attached a frame to the controller manually, so we need to manually tell it that it's detached, too if ( m_xBrowserController.is() )
{
m_xBrowserController->attachFrame( nullptr );
}
void FmPropBrw::Close()
{ // suspend the controller (it is allowed to veto) if ( m_xMeAsFrame.is() )
{ try
{
Reference< XController > xController( m_xMeAsFrame->getController() ); if ( xController.is() && !xController->suspend( true ) ) return;
} catch( const Exception& )
{
TOOLS_WARN_EXCEPTION("svx.form", "caught an exception while asking the controller!");
}
}
implDetachController();
// remember our bindings: while we're closed, we're deleted, too, so accessing the bindings after this // would be deadly // 10/19/00 - 79321 - FS
SfxBindings& rBindings = SfxControllerItem::GetBindings();
void FmPropBrw::impl_createPropertyBrowser_throw( FmFormShell* _pFormShell )
{ // the document in which we live
Reference< XInterface > xDocument; if ( _pFormShell && _pFormShell->GetObjectShell() )
xDocument = _pFormShell->GetObjectShell()->GetModel();
// the context of the controls in our document
Reference< awt::XControlContainer > xControlContext; if ( _pFormShell && _pFormShell->GetFormView() )
{
SdrPageView* pPageView = _pFormShell->GetFormView()->GetSdrPageView();
// the default parent window for message boxes
Reference< XWindow > xParentWindow(m_xDialog->GetXWindow());
// the mapping from control models to control shapes
Reference< XMap > xControlMap;
FmFormPage* pFormPage = _pFormShell ? _pFormShell->GetCurPage() : nullptr; if ( pFormPage )
xControlMap = pFormPage->GetImpl().getControlToShapeMap();
// set the new object to inspect
implSetNewSelection( aSelection );
// if this is the first time we're here, some additional things need to be done ... if ( m_bInitialStateChange )
{ // if we're just newly created, we want to have the focus
m_nAsyncGetFocusId = Application::PostUserEvent(LINK(this, FmPropBrw, OnAsyncGetFocus));
// and additionally, we want to show the page which was active during // our previous incarnation if ( !m_sLastActivePage.isEmpty() )
{ try
{ if ( m_xBrowserController.is() )
m_xBrowserController->restoreViewData( Any( m_sLastActivePage ) );
} catch( const Exception& )
{
TOOLS_WARN_EXCEPTION("svx.form", "caught an exception while setting the initial page!");
}
}
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.