25#include <svx/strings.hrc>
36#include <svx/svxids.hrc>
38#include <com/sun/star/awt/XControlContainer.hpp>
39#include <com/sun/star/beans/XPropertySet.hpp>
40#include <com/sun/star/form/XForm.hpp>
41#include <com/sun/star/form/FormComponentType.hpp>
42#include <com/sun/star/form/inspection/DefaultFormComponentInspectorModel.hpp>
43#include <com/sun/star/frame/Frame.hpp>
44#include <com/sun/star/inspection/ObjectInspector.hpp>
45#include <com/sun/star/inspection/XObjectInspectorUI.hpp>
46#include <com/sun/star/inspection/DefaultHelpProvider.hpp>
47#include <com/sun/star/lang/XServiceInfo.hpp>
48#include <com/sun/star/util/VetoException.hpp>
71using namespace ::com::sun::star::form::inspection;
78using ::com::sun::star::awt::XWindow;
87 std::shared_ptr<FmPropBrw> xControl(
new FmPropBrw(::comphelper::getProcessComponentContext(), _pBindings,
89 SetController(std::move(xControl));
99 case FormComponentType::TEXTFIELD:
101 Reference< XInterface > xIFace;
103 pClassNameResourceId = RID_STR_PROPTITLE_EDIT;
106 Reference< XServiceInfo > xInfo(xIFace, UNO_QUERY);
108 pClassNameResourceId = RID_STR_PROPTITLE_FORMATTED;
109 else if (!xInfo.is())
112 Reference< XPropertySet > xProps(xIFace, UNO_QUERY);
115 Reference< XPropertySetInfo > xPropsInfo = xProps->getPropertySetInfo();
117 pClassNameResourceId = RID_STR_PROPTITLE_FORMATTED;
124 case FormComponentType::COMMANDBUTTON:
125 pClassNameResourceId = RID_STR_PROPTITLE_PUSHBUTTON;
break;
126 case FormComponentType::RADIOBUTTON:
127 pClassNameResourceId = RID_STR_PROPTITLE_RADIOBUTTON;
break;
128 case FormComponentType::CHECKBOX:
129 pClassNameResourceId = RID_STR_PROPTITLE_CHECKBOX;
break;
130 case FormComponentType::LISTBOX:
131 pClassNameResourceId = RID_STR_PROPTITLE_LISTBOX;
break;
132 case FormComponentType::COMBOBOX:
133 pClassNameResourceId = RID_STR_PROPTITLE_COMBOBOX;
break;
134 case FormComponentType::GROUPBOX:
135 pClassNameResourceId = RID_STR_PROPTITLE_GROUPBOX;
break;
136 case FormComponentType::IMAGEBUTTON:
137 pClassNameResourceId = RID_STR_PROPTITLE_IMAGEBUTTON;
break;
138 case FormComponentType::FIXEDTEXT:
139 pClassNameResourceId = RID_STR_PROPTITLE_FIXEDTEXT;
break;
140 case FormComponentType::GRIDCONTROL:
141 pClassNameResourceId = RID_STR_PROPTITLE_DBGRID;
break;
142 case FormComponentType::FILECONTROL:
143 pClassNameResourceId = RID_STR_PROPTITLE_FILECONTROL;
break;
144 case FormComponentType::DATEFIELD:
145 pClassNameResourceId = RID_STR_PROPTITLE_DATEFIELD;
break;
146 case FormComponentType::TIMEFIELD:
147 pClassNameResourceId = RID_STR_PROPTITLE_TIMEFIELD;
break;
148 case FormComponentType::NUMERICFIELD:
149 pClassNameResourceId = RID_STR_PROPTITLE_NUMERICFIELD;
break;
150 case FormComponentType::CURRENCYFIELD:
151 pClassNameResourceId = RID_STR_PROPTITLE_CURRENCYFIELD;
break;
152 case FormComponentType::PATTERNFIELD:
153 pClassNameResourceId = RID_STR_PROPTITLE_PATTERNFIELD;
break;
154 case FormComponentType::IMAGECONTROL:
155 pClassNameResourceId = RID_STR_PROPTITLE_IMAGECONTROL;
break;
156 case FormComponentType::HIDDENCONTROL:
157 pClassNameResourceId = RID_STR_PROPTITLE_HIDDEN;
break;
158 case FormComponentType::SCROLLBAR:
159 pClassNameResourceId = RID_STR_PROPTITLE_SCROLLBAR;
break;
160 case FormComponentType::SPINBUTTON:
161 pClassNameResourceId = RID_STR_PROPTITLE_SPINBUTTON;
break;
162 case FormComponentType::NAVIGATIONBAR:
163 pClassNameResourceId = RID_STR_PROPTITLE_NAVBAR;
break;
164 case FormComponentType::CONTROL:
166 pClassNameResourceId = RID_STR_CONTROL;
break;
169 return SvxResId(pClassNameResourceId);
176 , m_bInitialStateChange(true)
177 , m_pParent(_pParent)
178 , m_nAsyncGetFocusId(nullptr)
179 , m_xDialogBox(m_xBuilder->weld_box(
"dialog-vbox1"))
197 OSL_FAIL(
"FmPropBrw::FmPropBrw: could not create/initialize my frame!");
223 const OUString pProps[] = { OUString(
"ContextDocument" )
224 , OUString(
"DialogParentWindow" )
225 , OUString(
"ControlContext" )
226 , OUString(
"ControlShapeAccess" ) };
227 for (
const auto &
i : pProps)
228 xName->removeByName(
i );
240 OUString sCurrentPage;
248 if ( sCurrentPage.isEmpty() )
345 catch(
const VetoException& )
358 if ( _rSelection.
empty() )
360 sTitle =
SvxResId(RID_STR_NO_PROPERTIES);
362 else if ( _rSelection.
size() > 1 )
365 sTitle =
SvxResId(RID_STR_PROPERTIES_CONTROL) +
366 SvxResId(RID_STR_PROPTITLE_MULTISELECT);
370 Reference< XPropertySet > xSingleSelection( *_rSelection.
begin(), UNO_QUERY);
373 sal_Int16 nClassID = FormComponentType::CONTROL;
376 sTitle =
SvxResId(RID_STR_PROPERTIES_CONTROL) +
379 else if ( Reference< XForm >( xSingleSelection, UNO_QUERY ).is() )
380 sTitle =
SvxResId(RID_STR_PROPERTIES_FORM);
384 sTitle +=
SvxResId(RID_STR_READONLY_VIEW);
397 m_xDialogBox->child_grab_focus();
398 m_nAsyncGetFocusId =
nullptr;
403 bool lcl_shouldEnableHelpSection(
const Reference< XComponentContext >& _rxContext )
408 "/org.openoffice.Office.Common/Forms/PropertyBrowser/" ) );
410 bool bEnabled =
false;
411 OSL_VERIFY( aConfiguration.getNodeValue(
"DirectHelp" ) >>= bEnabled );
419 Reference< XInterface > xDocument;
424 Reference< awt::XControlContainer > xControlContext;
441 Reference< XWindow > xParentWindow(
m_xDialog->GetXWindow());
444 Reference< XMap > xControlMap;
447 xControlMap = pFormPage->
GetImpl().getControlToShapeMap();
460 ::cppu::createComponentContext( aHandlerContextInfo,
SAL_N_ELEMENTS( aHandlerContextInfo ),
463 bool bEnableHelpSection = lcl_shouldEnableHelpSection(
m_xORB );
473 ObjectInspector::createWithModel(
486 if ( bEnableHelpSection )
489 Reference< XObjectInspectorUI > xInspectorUI( xInspector->getInspectorUI() );
498 Reference< XInterface > xDocument;
501 xDocument = pObjectShell->
GetModel();
529 if (!pState || SID_FM_PROPERTY_CONTROL != nSID)
534 if (eState >= SfxItemState::DEFAULT)
539 pShell->
GetImpl()->getCurrentSelection_Lock(aSelection);
564 "caught an exception while setting the initial page!");
Reference< XExecutableDialog > m_xDialog
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
static void RemoveUserEvent(ImplSVEvent *nUserEvent)
FmFormPageImpl & GetImpl() const
void implDetachController()
OUString getCurrentPage() const
css::uno::Reference< css::inspection::XObjectInspectorModel > m_xInspectorModel
virtual ~FmPropBrw() override
void impl_ensurePropertyBrowser_nothrow(FmFormShell *_pFormShell)
creates the PropertyBrowser (aka ObjectInspector) and plugs it into our frame
void impl_createPropertyBrowser_throw(FmFormShell *_pFormShell)
creates a property browser
css::uno::Reference< css::uno::XInterface > m_xLastKnownDocument
bool implIsReadOnlyModel() const
virtual void FillInfo(SfxChildWinInfo &rInfo) const override
css::uno::Reference< css::frame::XFrame2 > m_xMeAsFrame
virtual void StateChangedAtToolBoxControl(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem *pState) override
virtual void Close() override
OUString m_sLastActivePage
std::unique_ptr< weld::Container > m_xContainer
bool m_bInitialStateChange
css::uno::Reference< css::uno::XComponentContext > m_xInspectorContext
ImplSVEvent * m_nAsyncGetFocusId
void implSetNewSelection(const InterfaceBag &_rSelection)
css::uno::Reference< css::uno::XComponentContext > m_xORB
css::uno::Reference< css::frame::XController > m_xBrowserController
FmPropBrw(const css::uno::Reference< css::uno::XComponentContext > &_xORB, SfxBindings *pBindings, SfxChildWindow *pMgr, weld::Window *pParent, const SfxChildWinInfo *_pInfo)
SdrPageWindow * GetPageWindow(sal_uInt32 nIndex) const
css::uno::Reference< css::awt::XControlContainer > const & GetControlContainer(bool _bCreateIfNecessary=true) const
SdrPageView * GetSdrPageView() const
void Invalidate(sal_uInt16 nId)
SfxBindings & GetBindings()
virtual void Close() override
css::uno::Reference< css::frame::XModel3 > GetModel() const
virtual SfxObjectShell * GetObjectShell()
const_iterator begin() const
static OConfigurationTreeRoot createWithComponentContext(const css::uno::Reference< css::uno::XComponentContext > &_rxContext, const OUString &_rPath, sal_Int32 _nDepth=-1, CREATION_MODE _eMode=CM_UPDATABLE)
#define TOOLS_WARN_EXCEPTION(area, stream)
#define DBG_UNHANDLED_EXCEPTION(...)
OUString SvxResId(TranslateId aId)
virtual std::shared_ptr< SfxDialogController > GetController() override
IMPL_LINK_NOARG(FmPropBrw, OnAsyncGetFocus, void *, void)
static OUString GetUIHeadlineName(sal_Int16 nClassId, const Any &aUnoObj)
constexpr OUStringLiteral FM_PROP_FORMATSSUPPLIER
constexpr OUStringLiteral FM_PROP_CLASSID
constexpr OUStringLiteral FM_SUN_COMPONENT_FORMATTEDFIELD
#define LINK(Instance, Class, Member)
#define SAL_N_ELEMENTS(arr)
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
Reference< XNameAccess > m_xContainer
SFX_IMPL_MODELESSDIALOGCONTOLLER(SfxRecordingFloatWrapper_Impl, SID_RECORDING_FLOATWINDOW)
void VCL_DLLPUBLIC ShowServiceNotAvailableError(weld::Widget *pParent, std::u16string_view rServiceName, bool bError)
Reference< XController > xController