31#include <svx/strings.hrc>
37#include <com/sun/star/container/XContainer.hpp>
74 Reference< XFormComponent > xFormComponent(evt.Source, UNO_QUERY);
75 Reference< XForm > xForm(evt.Source, UNO_QUERY);
80 else if( xFormComponent.is() )
85 OUString aNewName = ::comphelper::getString(evt.NewValue);
86 pEntryData->
SetText( aNewName );
102 Reference< XInterface > xTemp;
103 evt.Element >>= xTemp;
104 Insert(xTemp, ::comphelper::getINT32(evt.Accessor));
112 Reference< XForm > xForm(xIface, UNO_QUERY);
116 Reference< XIndexContainer > xContainer(xForm, UNO_QUERY);
117 Reference< XInterface > xTemp;
118 for (sal_Int32
i = 0;
i < xContainer->getCount();
i++)
120 xContainer->getByIndex(
i) >>= xTemp;
126 Reference< XFormComponent > xFormComp(xIface, UNO_QUERY);
141 Reference< XFormComponent > xReplaced;
142 evt.ReplacedElement >>= xReplaced;
146 if (
dynamic_cast<const FmControlData*
>( pEntryData) !=
nullptr)
148 Reference< XFormComponent > xComp;
149 evt.Element >>= xComp;
150 DBG_ASSERT(xComp.is(),
"OFormComponentObserver::elementReplaced : invalid argument !");
154 else if (
dynamic_cast<const FmFormData*
>( pEntryData) !=
nullptr)
156 OSL_FAIL(
"replacing forms not implemented yet !");
183 Reference< XInterface > xElement;
184 evt.Element >>= xElement;
189 :m_pFormShell(nullptr)
190 ,m_pFormPage(nullptr)
191 ,m_pFormModel(nullptr)
221 if( !pObjShell )
return;
228 Reference< css::form::XForms > xForms(
GetForms());
263 if (
dynamic_cast<const FmFormData*
>( pEntry) !=
nullptr)
268 Reference< XIndexContainer > xContainer;
278 OUString aUndoStr(
SvxResId(RID_STR_UNDO_CONTAINER_INSERT));
279 aUndoStr = aUndoStr.replaceFirst(
"#",
aStr);
284 nRelPos =
static_cast<sal_uInt32
>(xContainer->getCount());
297 if (xContainer->getElementType() ==
301 Reference< XForm > xElementAsForm(xElement, UNO_QUERY);
302 xContainer->insertByIndex(nRelPos,
Any(xElementAsForm));
304 else if (xContainer->getElementType() ==
308 Reference< XFormComponent > xElementAsComponent(xElement, UNO_QUERY);
309 xContainer->insertByIndex(nRelPos,
Any(xElementAsComponent));
313 OSL_FAIL(
"NavigatorTreeModel::Insert : the parent container needs an elementtype I don't know !");
321 Reference< XPropertySet > xSet(xElement, UNO_QUERY);
327 if (
dynamic_cast<const FmFormData*
>( pEntry) !=
nullptr)
329 Reference< XContainer > xContainer(xElement, UNO_QUERY);
368 if (
dynamic_cast<const FmFormData*
>( pEntry) !=
nullptr)
375 OUString aUndoStr(
SvxResId(RID_STR_UNDO_CONTAINER_REMOVE));
376 aUndoStr = aUndoStr.replaceFirst(
"#",
aStr);
382 if (
auto pFormData =
dynamic_cast<FmFormData*
>( pEntry))
390 Reference< XIndexContainer > xContainer(xElement->getParent(), UNO_QUERY);
392 sal_Int32 nContainerIndex =
getElementPos(xContainer, xElement);
394 if (nContainerIndex >= 0)
401 xElement, nContainerIndex ));
408 xContainer->removeByIndex(nContainerIndex );
448 for (
size_t i = pChildList->
size();
i > 0; )
454 if(
auto pChildFormData =
dynamic_cast<FmFormData*
>( pEntryData) )
456 else if(
auto pChildControlData =
dynamic_cast<FmControlData*
>( pEntryData) )
487 if( pFormData ==
nullptr )
489 Reference< XIndexContainer > xForms =
GetForms();
493 Reference< XForm > xSubForm;
494 for (sal_Int32
i=0;
i<xForms->getCount(); ++
i)
497 "NavigatorTreeModel::FillBranch : the root container should supply only elements of type XForm");
499 xForms->getByIndex(
i) >>= xSubForm;
513 if( !xComponents.is() )
return;
518 Reference< XFormComponent > xCurrentComponent;
519 for (sal_Int32 j=0; j<xComponents->getCount(); ++j)
521 xComponents->getByIndex(j) >>= xCurrentComponent;
522 Reference< XForm > xSubForm(xCurrentComponent, UNO_QUERY);
526 pSubFormData =
new FmFormData(xSubForm, pFormData);
535 pNewControlData =
new FmControlData(xCurrentComponent, pFormData);
551 Reference< XInterface > xIFace( xForm->getParent());
552 Reference< XForm > xParentForm(xIFace, UNO_QUERY);
554 if (xParentForm.is())
557 pFormData =
new FmFormData(xForm, pParentData);
558 Insert( pFormData, nRelPos );
566 Reference< XInterface > xIFace( xComp->getParent());
567 Reference< XForm > xForm(xIFace, UNO_QUERY);
586 Insert( pNewEntryData, nRelPos );
591 const Reference< XFormComponent > & xOld,
592 const Reference< XFormComponent > & xNew
609 Reference< XInterface > xIFace( xElement, UNO_QUERY );
611 for (
size_t i = 0;
i < pDataList->
size();
i++ )
614 if ( pEntryData->
GetElement().get() == xIFace.get() )
639 for(
size_t i = 0;
i < pDataList->
size();
i++ )
641 pEntryData = pDataList->
at(
i );
642 aEntryText = pEntryData->
GetText();
644 if (rText == aEntryText)
649 pChildData =
FindData(rText, pFormData,
true);
660 if (rHint.
GetId() == SfxHintId::ThisIsAnSdrHint)
676 else if (rHint.
GetId() == SfxHintId::Dying)
689 const FmFormObj* pFormObject = FmFormObj::GetFormObject( pObj );
694 Reference< XFormComponent > xFormComponent( pFormObject->GetUnoControlModel(), UNO_QUERY_THROW );
695 Reference< XIndexAccess > xContainer( xFormComponent->getParent(), UNO_QUERY_THROW );
716 const FmFormObj* pFormObject = FmFormObj::GetFormObject( pObj );
721 Reference< XFormComponent > xFormComponent( pFormObject->GetUnoControlModel(), UNO_QUERY_THROW );
743 const SdrObjList *pChildren = pObjGroup->GetSubList();
753 FmFormObj* pFormObject = FmFormObj::GetFormObject(
pObject );
759 Reference< XFormComponent > xFormViewControl( pFormObject->GetUnoControlModel(), UNO_QUERY_THROW );
781 bool bIsMixedSelection =
false;
783 for (
size_t i=0; (
i<mlMarked.
GetMarkCount()) && !bIsMixedSelection; ++
i)
791 if (bIsMixedSelection)
816 DBG_ASSERT(pFormView !=
nullptr,
"NavigatorTreeModel::UpdateContent : no FormView");
867 return Reference< XIndexContainer > (pFormData->
GetFormIface(), UNO_QUERY);
869 return Reference< XIndexContainer > ();
877 pEntryData->
SetText( rNewText );
881 Reference< XFormComponent > xFormComponent;
883 if(
auto pFormData =
dynamic_cast<FmFormData*
>( pEntryData))
885 xFormComponent = pFormData->GetFormIface();
888 if(
auto pControlData =
dynamic_cast<FmControlData*
>( pEntryData) )
890 xFormComponent = pControlData->GetFormComponent();
893 if( !xFormComponent.is() )
return false;
894 Reference< XPropertySet > xSet(xFormComponent, UNO_QUERY);
895 if( !xSet.is() )
return false;
void ModelReplaced(const css::uno::Reference< css::form::XFormComponent > &_rxNew)
void removeNoDelete(FmEntryData *pItem)
FmEntryData * at(size_t Index)
void insert(std::unique_ptr< FmEntryData > pItem, size_t Index)
const css::uno::Reference< css::container::XChild > & GetChildIFace() const
const OUString & GetText() const
const css::uno::Reference< css::uno::XInterface > & GetElement() const
const css::uno::Reference< css::beans::XPropertySet > & GetPropertySet() const
FmEntryDataList * GetChildList() const
FmEntryData * GetParent() const
void SetText(const OUString &rText)
const css::uno::Reference< css::form::XForms > & GetForms(bool _bForceCreate=true) const
void SetMixedSelection(bool bMixedSelection)
void AddItem(FmEntryData *pEntry)
static void DisposeElement(const css::uno::Reference< css::uno::XInterface > &xElem)
SdrHintKind GetKind() const
const SdrObject * GetObject() const
size_t GetMarkCount() const
SdrMark * GetMark(size_t nNum) const
const SdrMarkList & GetMarkedObjectList() const
SdrObject * GetMarkedSdrObj() const
void AddUndo(std::unique_ptr< SdrUndoAction > pUndo)
bool IsUndoEnabled() const
returns true if undo is currently enabled This returns false if undo was disabled using EnableUndo( f...
SdrObject * GetObj(size_t nNum) const
size_t GetObjCount() const
virtual SdrObjList * GetSubList() const
bool IsGroupObject() const
void Broadcast(const SfxHint &rHint)
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
bool IsListening(SfxBroadcaster &rBroadcaster) const
void EndListening(SfxBroadcaster &rBroadcaster, bool bRemoveAllDuplicates=false)
virtual void SetModified(bool bModified=true)
css::uno::Type const & get()
#define DBG_ASSERT(sCon, aError)
#define DBG_UNHANDLED_EXCEPTION(...)
OUString SvxResId(TranslateId aId)
EmbeddedObjectRef * pObject
constexpr OUStringLiteral FM_PROP_NAME
std::unique_ptr< sal_Int32[]> pData
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)