LibreOffice Module svx (master) 1
datanavi.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <sal/config.h>
21
22#include <memory>
23
24#include <sal/log.hxx>
25#include <datanavi.hxx>
26#include <fmservs.hxx>
27
28#include <bitmaps.hlst>
29#include <fpicker/strings.hrc>
30#include <o3tl/safeint.hxx>
31#include <o3tl/string_view.hxx>
32#include <svx/svxids.hrc>
34#include <unotools/resmgr.hxx>
35#include <svx/xmlexchg.hxx>
38#include <sfx2/viewfrm.hxx>
39#include <sfx2/objsh.hxx>
40#include <sfx2/bindings.hxx>
41#include <sfx2/dispatch.hxx>
42#include <utility>
43#include <vcl/commandevent.hxx>
44#include <vcl/event.hxx>
45#include <vcl/weld.hxx>
46#include <com/sun/star/beans/PropertyAttribute.hpp>
47#include <com/sun/star/container/XSet.hpp>
48#include <com/sun/star/frame/XController.hpp>
49#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
50#include <com/sun/star/xforms/XFormsSupplier.hpp>
51#include <com/sun/star/xml/dom/XDocument.hpp>
52#include <comphelper/string.hxx>
53
54using namespace ::com::sun::star::beans;
55using namespace ::com::sun::star::container;
56using namespace ::com::sun::star::datatransfer;
57using namespace ::com::sun::star::frame;
58using namespace ::com::sun::star::uno;
59using namespace ::com::sun::star::xml::dom::events;
60using namespace ::svx;
61
62constexpr OUStringLiteral CFGNAME_DATANAVIGATOR = u"DataNavigator";
63constexpr OUStringLiteral CFGNAME_SHOWDETAILS = u"ShowDetails";
64constexpr OUStringLiteral MSG_VARIABLE = u"%1";
65constexpr OUStringLiteral MODELNAME = u"$MODELNAME";
66constexpr OUStringLiteral INSTANCENAME = u"$INSTANCENAME";
67constexpr OUStringLiteral ELEMENTNAME = u"$ELEMENTNAME";
68constexpr OUStringLiteral ATTRIBUTENAME = u"$ATTRIBUTENAME";
69constexpr OUStringLiteral SUBMISSIONNAME = u"$SUBMISSIONNAME";
70constexpr OUStringLiteral BINDINGNAME = u"$BINDINGNAME";
71
72
73namespace svxform
74{
75
76 // properties of instance
77 constexpr OUStringLiteral PN_INSTANCE_MODEL = u"Instance";
78 constexpr OUStringLiteral PN_INSTANCE_ID = u"ID";
79 constexpr OUStringLiteral PN_INSTANCE_URL = u"URL";
80
81 // properties of binding
82 constexpr OUStringLiteral PN_BINDING_ID = u"BindingID";
83 constexpr OUStringLiteral PN_BINDING_EXPR = u"BindingExpression";
84 constexpr OUStringLiteral PN_BINDING_MODEL = u"Model";
85 constexpr OUStringLiteral PN_BINDING_NAMESPACES = u"ModelNamespaces";
86 constexpr OUStringLiteral PN_READONLY_EXPR = u"ReadonlyExpression";
87 constexpr OUStringLiteral PN_RELEVANT_EXPR = u"RelevantExpression";
88 constexpr OUStringLiteral PN_REQUIRED_EXPR = u"RequiredExpression";
89 constexpr OUStringLiteral PN_CONSTRAINT_EXPR = u"ConstraintExpression";
90 constexpr OUStringLiteral PN_CALCULATE_EXPR = u"CalculateExpression";
91 constexpr OUStringLiteral PN_BINDING_TYPE = u"Type";
92
93 // properties of submission
94 constexpr OUStringLiteral PN_SUBMISSION_ID = u"ID";
95 constexpr OUStringLiteral PN_SUBMISSION_BIND = u"Bind";
96 constexpr OUStringLiteral PN_SUBMISSION_REF = u"Ref";
97 constexpr OUStringLiteral PN_SUBMISSION_ACTION = u"Action";
98 constexpr OUStringLiteral PN_SUBMISSION_METHOD = u"Method";
99 constexpr OUStringLiteral PN_SUBMISSION_REPLACE = u"Replace";
100
101 // other const strings
102 constexpr OUStringLiteral TRUE_VALUE = u"true()";
103 constexpr OUStringLiteral NEW_ELEMENT = u"newElement";
104 constexpr OUStringLiteral NEW_ATTRIBUTE = u"newAttribute";
105 constexpr OUStringLiteral EVENTTYPE_CHARDATA = u"DOMCharacterDataModified";
106 constexpr OUStringLiteral EVENTTYPE_ATTR = u"DOMAttrModified";
107
108 #define MIN_PAGE_COUNT 3 // at least one instance, one submission and one binding page
109
110 struct ItemNode
111 {
112 Reference< css::xml::dom::XNode > m_xNode;
113 Reference< XPropertySet > m_xPropSet;
114
115 explicit ItemNode( const Reference< css::xml::dom::XNode >& _rxNode ) :
116 m_xNode( _rxNode ) {}
117 explicit ItemNode( const Reference< XPropertySet >& _rxSet ) :
118 m_xPropSet( _rxSet ) {}
119 };
120
122 : DropTargetHelper(rWidget.get_drop_target())
123 {
124 }
125
127 {
128 return DND_ACTION_NONE;
129 }
130
132 {
133 return DND_ACTION_NONE;
134 }
135
136 IMPL_LINK(XFormsPage, PopupMenuHdl, const CommandEvent&, rCEvt, bool)
137 {
138 if (rCEvt.GetCommand() != CommandEventId::ContextMenu)
139 return false;
140
141 Point aPos(rCEvt.GetMousePosPixel());
142
143 if (m_xItemList->get_dest_row_at_pos(aPos, m_xScratchIter.get(), false) && !m_xItemList->is_selected(*m_xScratchIter))
144 {
145 m_xItemList->select(*m_xScratchIter);
146 ItemSelectHdl(*m_xItemList);
147 }
148
149 std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(m_xItemList.get(), "svx/ui/formdatamenu.ui"));
150 m_xMenu = xBuilder->weld_menu("menu");
151 m_aRemovedMenuEntries.clear();
152
153 if (DGTInstance == m_eGroup)
154 m_aRemovedMenuEntries.insert("additem");
155 else
156 {
157 m_aRemovedMenuEntries.insert("addelement");
158 m_aRemovedMenuEntries.insert("addattribute");
159
160 if (DGTSubmission == m_eGroup)
161 {
162 m_xMenu->set_label("additem", SvxResId(RID_STR_DATANAV_ADD_SUBMISSION));
163 m_xMenu->set_label("edit", SvxResId(RID_STR_DATANAV_EDIT_SUBMISSION));
164 m_xMenu->set_label("delete", SvxResId(RID_STR_DATANAV_REMOVE_SUBMISSION));
165 }
166 else
167 {
168 m_xMenu->set_label("additem", SvxResId(RID_STR_DATANAV_ADD_BINDING));
169 m_xMenu->set_label("edit", SvxResId(RID_STR_DATANAV_EDIT_BINDING));
170 m_xMenu->set_label("delete", SvxResId(RID_STR_DATANAV_REMOVE_BINDING));
171 }
172 }
173 for (const auto& rRemove : m_aRemovedMenuEntries)
174 m_xMenu->remove(rRemove);
175 EnableMenuItems();
176 OUString sCommand = m_xMenu->popup_at_rect(m_xItemList.get(), tools::Rectangle(aPos, Size(1,1)));
177 if (!sCommand.isEmpty())
178 DoMenuAction(sCommand);
179 m_xMenu.reset();
180 return true;
181 }
182
184 {
185 m_xItemList->all_foreach([this](weld::TreeIter& rEntry) {
186 delete weld::fromId<ItemNode*>(m_xItemList->get_id(rEntry));
187 return false;
188 });
189 m_xItemList->clear();
190 }
191
193 {
194 if (m_xItemList->get_iter_first(*m_xScratchIter))
195 {
196 m_xItemList->select(*m_xScratchIter);
197 ItemSelectHdl(*m_xItemList);
198 }
199 }
200
202 : BuilderPage(pPage, nullptr, "svx/ui/xformspage.ui", "XFormsPage")
203 , m_pParent(pPage)
204 , m_xToolBox(m_xBuilder->weld_toolbar("toolbar"))
205 , m_xItemList(m_xBuilder->weld_tree_view("items"))
206 , m_xScratchIter(m_xItemList->make_iterator())
207 , m_aDropHelper(*m_xItemList)
208 , m_pNaviWin(_pNaviWin)
209 , m_bHasModel(false)
210 , m_eGroup(_eGroup)
211 , m_bLinkOnce(false)
212 {
213 m_xItemList->set_show_expanders(DGTInstance == m_eGroup || DGTSubmission == m_eGroup);
214
215 if ( DGTInstance == m_eGroup )
216 m_xToolBox->set_item_visible("additem", false);
217 else
218 {
219 m_xToolBox->set_item_visible("addelement", false);
220 m_xToolBox->set_item_visible("addattribute", false);
221
222 if ( DGTSubmission == m_eGroup )
223 {
224 m_xToolBox->set_item_label("additem", SvxResId(RID_STR_DATANAV_ADD_SUBMISSION));
225 m_xToolBox->set_item_label("edit", SvxResId(RID_STR_DATANAV_EDIT_SUBMISSION));
226 m_xToolBox->set_item_label("delete", SvxResId(RID_STR_DATANAV_REMOVE_SUBMISSION));
227 }
228 else
229 {
230 m_xToolBox->set_item_label("additem", SvxResId(RID_STR_DATANAV_ADD_BINDING));
231 m_xToolBox->set_item_label("edit", SvxResId(RID_STR_DATANAV_EDIT_BINDING));
232 m_xToolBox->set_item_label("delete", SvxResId(RID_STR_DATANAV_REMOVE_BINDING));
233 }
234 }
235
236 m_xToolBox->connect_clicked(LINK(this, XFormsPage, TbxSelectHdl));
237
238 m_xItemList->connect_changed(LINK(this, XFormsPage, ItemSelectHdl));
239 m_xItemList->connect_key_press(LINK(this, XFormsPage, KeyInputHdl));
240 m_xItemList->connect_popup_menu(LINK(this, XFormsPage, PopupMenuHdl));
241 ItemSelectHdl(*m_xItemList);
242 }
243
245 {
247 m_pNaviWin = nullptr;
248 m_pParent->move(m_xContainer.get(), nullptr);
249 }
250
251 IMPL_LINK(XFormsPage, TbxSelectHdl, const OUString&, rIdent, void)
252 {
253 DoToolBoxAction(rIdent);
254 }
255
257 {
258 EnableMenuItems();
259 PrepDnD();
260 }
261
263 {
265 m_xItemList->enable_drag_source(xTransferable, DND_ACTION_NONE);
266
267 if (!m_xItemList->get_selected(m_xScratchIter.get()))
268 {
269 // no drag without an entry
270 return;
271 }
272
273 if ( m_eGroup == DGTBinding )
274 {
275 // for the moment, bindings cannot be dragged.
276 // #i59395# / 2005-12-15 / frank.schoenheit@sun.com
277 return;
278 }
279
280 // GetServiceNameForNode() requires a datatype repository which
281 // will be automatically build if requested???
282 Reference< css::xforms::XModel > xModel( GetXFormsHelper(), UNO_QUERY );
283 Reference< css::xforms::XDataTypeRepository > xDataTypes =
284 xModel->getDataTypeRepository();
285 if(!xDataTypes.is())
286 return;
287
288 ItemNode *pItemNode = weld::fromId<ItemNode*>(m_xItemList->get_id(*m_xScratchIter));
289 if (!pItemNode)
290 {
291 // the only known (and allowed?) case where this happens are sub-entries of a submission
292 // entry
293 DBG_ASSERT( DGTSubmission == m_eGroup, "DataTreeListBox::StartDrag: how this?" );
294 bool bSelected = m_xItemList->iter_parent(*m_xScratchIter);
295 DBG_ASSERT(bSelected && !m_xItemList->get_iter_depth(*m_xScratchIter), "DataTreeListBox::StartDrag: what kind of entry *is* this?");
296 // on the submission page, we have only top-level entries (the submission themself)
297 // plus direct children of those (facets of a submission)
298 pItemNode = bSelected ? weld::fromId<ItemNode*>(m_xItemList->get_id(*m_xScratchIter)) : nullptr;
299 if (!pItemNode)
300 return;
301 }
302
303 OUString szName = m_xItemList->get_text(*m_xScratchIter);
304 Reference<css::xml::dom::XNode> xNode(pItemNode->m_xNode);
305 Reference<XPropertySet> xPropSet(pItemNode->m_xPropSet);
306
307 // tdf#154535 create the OXFormsDescriptor on-demand so we don't cause an unwanted
308 // Binding to be created unless we are forced to.
309 auto fnCreateFormsDescriptor = [this, szName, xNode, xPropSet](){
310 OXFormsDescriptor desc;
311 desc.szName = szName;
312 if (xNode) {
313 // a valid node interface tells us that we need to create a control from a binding
314 desc.szServiceName = GetServiceNameForNode(xNode);
315 desc.xPropSet = GetBindingForNode(xNode);
316 DBG_ASSERT( desc.xPropSet.is(), "DataTreeListBox::StartDrag(): invalid node binding" );
317 }
318 else {
319 desc.szServiceName = FM_COMPONENT_COMMANDBUTTON;
320 desc.xPropSet = xPropSet;
321 }
322 return desc;
323 };
324
325 xTransferable = rtl::Reference<TransferDataContainer>(new OXFormsTransferable(fnCreateFormsDescriptor));
326 m_xItemList->enable_drag_source(xTransferable, DND_ACTION_COPY);
327 }
328
330 const Reference< css::xml::dom::XNode >& _xNode)
331 {
332 DBG_ASSERT( m_xUIHelper.is(), "XFormsPage::AddChildren(): invalid UIHelper" );
333
334 try
335 {
336 Reference< css::xml::dom::XNodeList > xNodeList = _xNode->getChildNodes();
337 if ( xNodeList.is() )
338 {
339 bool bShowDetails = m_pNaviWin->IsShowDetails();
340 sal_Int32 i, nNodeCount = xNodeList->getLength();
341 for ( i = 0; i < nNodeCount; ++i )
342 {
343 Reference< css::xml::dom::XNode > xChild = xNodeList->item(i);
344 css::xml::dom::NodeType eChildType = xChild->getNodeType();
345 OUString aExpImg;
346 switch ( eChildType )
347 {
348 case css::xml::dom::NodeType_ATTRIBUTE_NODE:
349 aExpImg = RID_SVXBMP_ATTRIBUTE;
350 break;
351 case css::xml::dom::NodeType_ELEMENT_NODE:
352 aExpImg = RID_SVXBMP_ELEMENT;
353 break;
354 case css::xml::dom::NodeType_TEXT_NODE:
355 aExpImg = RID_SVXBMP_TEXT;
356 break;
357 default:
358 aExpImg = RID_SVXBMP_OTHER;
359 }
360
361 OUString sName = m_xUIHelper->getNodeDisplayName( xChild, bShowDetails );
362 if ( !sName.isEmpty() )
363 {
364 ItemNode* pNode = new ItemNode( xChild );
365 OUString sId(weld::toId(pNode));
366 std::unique_ptr<weld::TreeIter> xEntry = m_xItemList->make_iterator();
367 m_xItemList->insert(_pParent, -1, &sName, &sId, nullptr, nullptr, false, xEntry.get());
368 m_xItemList->set_image(*xEntry, aExpImg);
369
370 if ( xChild->hasAttributes() )
371 {
372 Reference< css::xml::dom::XNamedNodeMap > xMap = xChild->getAttributes();
373 if ( xMap.is() )
374 {
375 aExpImg = RID_SVXBMP_ATTRIBUTE;
376 sal_Int32 j, nMapLen = xMap->getLength();
377 for ( j = 0; j < nMapLen; ++j )
378 {
379 Reference< css::xml::dom::XNode > xAttr = xMap->item(j);
380 pNode = new ItemNode( xAttr );
381 OUString sSubId(weld::toId(pNode));
382 OUString sAttrName = m_xUIHelper->getNodeDisplayName( xAttr, bShowDetails );
383 m_xItemList->insert(xEntry.get(), -1, &sAttrName, &sSubId, nullptr, nullptr, false, m_xScratchIter.get());
384 m_xItemList->set_image(*m_xScratchIter, aExpImg);
385 }
386 }
387 }
388 if ( xChild->hasChildNodes() )
389 AddChildren(xEntry.get(), xChild);
390 }
391 }
392 }
393 }
394 catch( Exception& )
395 {
397 }
398 }
399
400 bool XFormsPage::DoToolBoxAction(std::u16string_view rToolBoxID)
401 {
402 bool bHandled = false;
403 bool bIsDocModified = false;
404 m_pNaviWin->DisableNotify( true );
405
406 if (rToolBoxID == u"additem" || rToolBoxID == u"addelement" || rToolBoxID == u"addattribute")
407 {
408 bHandled = true;
409 Reference< css::xforms::XModel > xModel( m_xUIHelper, UNO_QUERY );
410 DBG_ASSERT( xModel.is(), "XFormsPage::DoToolBoxAction(): Action without model" );
411 if ( DGTSubmission == m_eGroup )
412 {
414 if ( aDlg.run() == RET_OK && aDlg.GetNewSubmission().is() )
415 {
416 try
417 {
418 Reference< css::xforms::XSubmission > xNewSubmission = aDlg.GetNewSubmission();
419 Reference< XSet > xSubmissions = xModel->getSubmissions();
420 xSubmissions->insert( Any( xNewSubmission ) );
421 AddEntry(xNewSubmission, m_xScratchIter.get());
422 m_xItemList->select(*m_xScratchIter);
423 bIsDocModified = true;
424 }
425 catch ( Exception const & )
426 {
427 TOOLS_WARN_EXCEPTION( "svx.form", "XFormsPage::DoToolBoxAction()" );
428 }
429 }
430 }
431 else
432 {
434
435 std::unique_ptr<weld::TreeIter> xEntry(m_xItemList->make_iterator());
436 bool bEntry = m_xItemList->get_selected(xEntry.get());
437
438 std::unique_ptr<ItemNode> pNode;
439 Reference< css::xml::dom::XNode > xParentNode;
440 Reference< XPropertySet > xNewBinding;
441 TranslateId pResId;
442 bool bIsElement = true;
443 if ( DGTInstance == m_eGroup )
444 {
445 if ( !m_sInstanceURL.isEmpty() )
446 {
448 if (aMsgBox.run() != RET_OK)
449 return bHandled;
450 }
451
452 DBG_ASSERT( bEntry, "XFormsPage::DoToolBoxAction(): no entry" );
453 ItemNode* pParentNode = weld::fromId<ItemNode*>(m_xItemList->get_id(*xEntry));
454 DBG_ASSERT( pParentNode, "XFormsPage::DoToolBoxAction(): no parent node" );
455 xParentNode = pParentNode->m_xNode;
456 Reference< css::xml::dom::XNode > xNewNode;
457 if (rToolBoxID == u"addelement")
458 {
459 try
460 {
461 pResId = RID_STR_DATANAV_ADD_ELEMENT;
462 xNewNode = m_xUIHelper->createElement( xParentNode, NEW_ELEMENT );
463 }
464 catch ( Exception const & )
465 {
466 TOOLS_WARN_EXCEPTION( "svx.form", "XFormsPage::DoToolBoxAction(): exception while create element" );
467 }
468 }
469 else
470 {
471 pResId = RID_STR_DATANAV_ADD_ATTRIBUTE;
472 bIsElement = false;
474 try
475 {
476 xNewNode = m_xUIHelper->createAttribute( xParentNode, NEW_ATTRIBUTE );
477 }
478 catch ( Exception const & )
479 {
480 TOOLS_WARN_EXCEPTION( "svx.form", "XFormsPage::DoToolBoxAction(): exception while create attribute" );
481 }
482 }
483
484 try
485 {
486 xNewNode = xParentNode->appendChild( xNewNode );
487 }
488 catch ( Exception const & )
489 {
490 TOOLS_WARN_EXCEPTION( "svx.form", "XFormsPage::DoToolBoxAction(): exception while append child" );
491 }
492
493 try
494 {
495 Reference< css::xml::dom::XNode > xPNode;
496 if ( xNewNode.is() )
497 xPNode = xNewNode->getParentNode();
498 // attributes don't have parents in the DOM model
499 DBG_ASSERT( rToolBoxID == u"addattribute"
500 || xPNode.is(), "XFormsPage::DoToolboxAction(): node not added" );
501 }
502 catch ( Exception const & )
503 {
504 TOOLS_WARN_EXCEPTION( "svx.form", "XFormsPage::DoToolboxAction()" );
505 }
506
507 try
508 {
509 m_xUIHelper->getBindingForNode( xNewNode, true );
510 }
511 catch ( Exception const & )
512 {
513 TOOLS_WARN_EXCEPTION( "svx.form", "XFormsPage::DoToolBoxAction(): exception while get binding for node" );
514 }
515 pNode.reset(new ItemNode( xNewNode ));
516 }
517 else
518 {
519 try
520 {
521 pResId = RID_STR_DATANAV_ADD_BINDING;
522 xNewBinding = xModel->createBinding();
523 Reference< XSet > xBindings = xModel->getBindings();
524 xBindings->insert( Any( xNewBinding ) );
525 pNode.reset(new ItemNode( xNewBinding ));
527 }
528 catch ( Exception const & )
529 {
530 TOOLS_WARN_EXCEPTION( "svx.form", "XFormsPage::DoToolBoxAction(): exception while adding binding" );
531 }
532 }
533
535 aDlg.set_title(SvxResId(pResId));
536 aDlg.InitText( eType );
537 short nReturn = aDlg.run();
538 if ( DGTInstance == m_eGroup )
539 {
540 if ( RET_OK == nReturn )
541 {
542 AddEntry( std::move(pNode), bIsElement, m_xScratchIter.get());
543 m_xItemList->scroll_to_row(*m_xScratchIter);
544 m_xItemList->select(*m_xScratchIter);
545 bIsDocModified = true;
546 }
547 else
548 {
549 try
550 {
551 Reference< css::xml::dom::XNode > xPNode;
552 Reference< css::xml::dom::XNode > xNode =
553 xParentNode->removeChild( pNode->m_xNode );
554 if ( xNode.is() )
555 xPNode = xNode->getParentNode();
556 DBG_ASSERT( !xPNode.is(), "XFormsPage::RemoveEntry(): node not removed" );
557 }
558 catch ( Exception const & )
559 {
560 TOOLS_WARN_EXCEPTION( "svx.form", "XFormsPage::DoToolboxAction()" );
561 }
562 }
563 }
564 else
565 {
566 if ( RET_OK == nReturn )
567 {
568 AddEntry(xNewBinding, m_xScratchIter.get());
569 m_xItemList->select(*m_xScratchIter);
570 bIsDocModified = true;
571 }
572 else
573 {
574 try
575 {
576 Reference< XSet > xBindings = xModel->getBindings();
577 xBindings->remove( Any( xNewBinding ) );
578 }
579 catch ( Exception const & )
580 {
581 TOOLS_WARN_EXCEPTION( "svx.form", "XFormsPage::DoToolboxAction()" );
582 }
583 }
584 }
585 }
586 }
587 else if (rToolBoxID == u"edit")
588 {
589 bHandled = true;
590
591 std::unique_ptr<weld::TreeIter> xEntry(m_xItemList->make_iterator());
592 bool bEntry = m_xItemList->get_selected(xEntry.get());
593 if ( bEntry )
594 {
595 if ( DGTSubmission == m_eGroup && m_xItemList->get_iter_depth(*xEntry) )
596 {
597 m_xItemList->iter_parent(*xEntry);
598 }
599 ItemNode* pNode = weld::fromId<ItemNode*>(m_xItemList->get_id(*xEntry));
601 {
602 if ( DGTInstance == m_eGroup && !m_sInstanceURL.isEmpty() )
603 {
605 if (aMsgBox.run() != RET_OK)
606 return bHandled;
607 }
608
611 TranslateId pResId = RID_STR_DATANAV_EDIT_ELEMENT;
612 if ( pNode && pNode->m_xNode.is() )
613 {
614 try
615 {
616 css::xml::dom::NodeType eChildType = pNode->m_xNode->getNodeType();
617 if ( eChildType == css::xml::dom::NodeType_ATTRIBUTE_NODE )
618 {
619 pResId = RID_STR_DATANAV_EDIT_ATTRIBUTE;
621 }
622 }
623 catch ( Exception const & )
624 {
625 TOOLS_WARN_EXCEPTION( "svx.form", "XFormsPage::DoToolboxAction()" );
626 }
627 }
628 else if ( DGTBinding == m_eGroup )
629 {
630 pResId = RID_STR_DATANAV_EDIT_BINDING;
632 }
633 aDlg.set_title(SvxResId(pResId));
634 aDlg.InitText( eType );
635 if (aDlg.run() == RET_OK)
636 {
637 // Set the new name
638 OUString sNewName;
639 if ( DGTInstance == m_eGroup )
640 {
641 try
642 {
643 sNewName = m_xUIHelper->getNodeDisplayName(
644 pNode->m_xNode, m_pNaviWin->IsShowDetails() );
645 }
646 catch ( Exception const & )
647 {
648 TOOLS_WARN_EXCEPTION( "svx.form", "XFormsPage::DoToolboxAction()" );
649 }
650 }
651 else if (pNode)
652 {
653 try
654 {
655 OUString sTemp;
656 pNode->m_xPropSet->getPropertyValue( PN_BINDING_ID ) >>= sTemp;
657 sNewName += sTemp + ": ";
658 pNode->m_xPropSet->getPropertyValue( PN_BINDING_EXPR ) >>= sTemp;
659 sNewName += sTemp;
660 }
661 catch ( Exception const & )
662 {
663 TOOLS_WARN_EXCEPTION( "svx.form", "XFormsPage::DoToolboxAction()" );
664 }
665 }
666
667 m_xItemList->set_text(*xEntry, sNewName);
668 bIsDocModified = true;
669 }
670 }
671 else
672 {
674 aDlg.set_title(SvxResId(RID_STR_DATANAV_EDIT_SUBMISSION));
675 if (aDlg.run() == RET_OK)
676 {
677 EditEntry( pNode->m_xPropSet );
678 bIsDocModified = true;
679 }
680 }
681 }
682 }
683 else if (rToolBoxID == u"delete")
684 {
685 bHandled = true;
686 if ( DGTInstance == m_eGroup && !m_sInstanceURL.isEmpty() )
687 {
689 if (aMsgBox.run() != RET_OK)
690 return bHandled;
691 }
692 bIsDocModified = RemoveEntry();
693 }
694 else
695 {
696 OSL_FAIL( "XFormsPage::DoToolboxAction: unknown ID!" );
697 }
698
699 m_pNaviWin->DisableNotify( false );
701 if ( bIsDocModified )
703 return bHandled;
704 }
705
706 void XFormsPage::AddEntry(std::unique_ptr<ItemNode> _pNewNode, bool _bIsElement, weld::TreeIter* pRet)
707 {
708 if (!pRet)
709 pRet = m_xScratchIter.get();
710
711 std::unique_ptr<weld::TreeIter> xParent(m_xItemList->make_iterator());
712 if (!m_xItemList->get_selected(xParent.get()))
713 xParent.reset();
714 OUString aImage(_bIsElement ? OUString(RID_SVXBMP_ELEMENT) : OUString(RID_SVXBMP_ATTRIBUTE));
715 OUString sName;
716 try
717 {
718 sName = m_xUIHelper->getNodeDisplayName(
719 _pNewNode->m_xNode, m_pNaviWin->IsShowDetails() );
720 }
721 catch ( Exception& )
722 {
724 }
725 OUString sId(weld::toId(_pNewNode.release()));
726 m_xItemList->insert(xParent.get(), -1, &sName, &sId, nullptr, nullptr, false, pRet);
727 m_xItemList->set_image(*pRet, aImage);
728 if (xParent && !m_xItemList->get_row_expanded(*xParent) && m_xItemList->iter_has_child(*xParent))
729 m_xItemList->expand_row(*xParent);
730 }
731
732 void XFormsPage::AddEntry(const Reference< XPropertySet >& _rEntry, weld::TreeIter* pRet)
733 {
734 if (!pRet)
735 pRet = m_xScratchIter.get();
736
737 OUString aImage(RID_SVXBMP_ELEMENT);
738
739 ItemNode* pNode = new ItemNode( _rEntry );
740 OUString sTemp;
741
742 if ( DGTSubmission == m_eGroup )
743 {
744 try
745 {
746 // ID
747 _rEntry->getPropertyValue( PN_SUBMISSION_ID ) >>= sTemp;
748 OUString sId(weld::toId(pNode));
749 m_xItemList->insert(nullptr, -1, &sTemp, &sId, nullptr, nullptr, false, pRet);
750 m_xItemList->set_image(*pRet, aImage);
751 std::unique_ptr<weld::TreeIter> xRes(m_xItemList->make_iterator());
752 // Action
753 _rEntry->getPropertyValue( PN_SUBMISSION_ACTION ) >>= sTemp;
754 OUString sEntry = SvxResId( RID_STR_DATANAV_SUBM_ACTION ) + sTemp;
755 m_xItemList->insert(pRet, -1, &sEntry, nullptr, nullptr, nullptr, false, xRes.get());
756 m_xItemList->set_image(*xRes, aImage);
757 // Method
758 _rEntry->getPropertyValue( PN_SUBMISSION_METHOD ) >>= sTemp;
759 sEntry = SvxResId( RID_STR_DATANAV_SUBM_METHOD ) +
760 m_aMethodString.toUI( sTemp );
761 m_xItemList->insert(pRet, -1, &sEntry, nullptr, nullptr, nullptr, false, xRes.get());
762 m_xItemList->set_image(*xRes, aImage);
763 // Ref
764 _rEntry->getPropertyValue( PN_SUBMISSION_REF ) >>= sTemp;
765 sEntry = SvxResId( RID_STR_DATANAV_SUBM_REF ) + sTemp;
766 m_xItemList->insert(pRet, -1, &sEntry, nullptr, nullptr, nullptr, false, xRes.get());
767 m_xItemList->set_image(*xRes, aImage);
768 // Bind
769 _rEntry->getPropertyValue( PN_SUBMISSION_BIND ) >>= sTemp;
770 sEntry = SvxResId( RID_STR_DATANAV_SUBM_BIND ) + sTemp;
771 m_xItemList->insert(pRet, -1, &sEntry, nullptr, nullptr, nullptr, false, xRes.get());
772 m_xItemList->set_image(*xRes, aImage);
773 // Replace
774 _rEntry->getPropertyValue( PN_SUBMISSION_REPLACE ) >>= sTemp;
775 sEntry = SvxResId( RID_STR_DATANAV_SUBM_REPLACE ) +
776 m_aReplaceString.toUI( sTemp );
777 m_xItemList->insert(pRet, -1, &sEntry, nullptr, nullptr, nullptr, false, xRes.get());
778 m_xItemList->set_image(*xRes, aImage);
779 }
780 catch ( Exception const & )
781 {
782 TOOLS_WARN_EXCEPTION( "svx.form", "XFormsPage::AddEntry(Ref)" );
783 }
784 }
785 else // then Binding Page
786 {
787 try
788 {
789 OUString sName;
790 _rEntry->getPropertyValue( PN_BINDING_ID ) >>= sTemp;
791 sName += sTemp + ": ";
792 _rEntry->getPropertyValue( PN_BINDING_EXPR ) >>= sTemp;
793 sName += sTemp;
794
795 OUString sId(weld::toId(pNode));
796 m_xItemList->insert(nullptr, -1, &sName, &sId, nullptr, nullptr, false, pRet);
797 m_xItemList->set_image(*pRet, aImage);
798 }
799 catch ( Exception const & )
800 {
801 TOOLS_WARN_EXCEPTION( "svx.form", "XFormsPage::AddEntry(Ref)" );
802 }
803 }
804 }
805
806 void XFormsPage::EditEntry( const Reference< XPropertySet >& _rEntry )
807 {
808 if ( DGTSubmission != m_eGroup )
809 return;
810
811 try
812 {
813 std::unique_ptr<weld::TreeIter> xEntry(m_xItemList->make_iterator());
814 if (!m_xItemList->get_selected(xEntry.get()))
815 {
816 SAL_WARN( "svx.form", "corrupt tree" );
817 return;
818 }
819
820 // #i36262# may be called for submission entry *or* for
821 // submission children. If we don't have any children, we
822 // assume the latter case and use the parent
823 if (!m_xItemList->iter_has_child(*xEntry))
824 m_xItemList->iter_parent(*xEntry);
825
826 OUString sTemp;
827 _rEntry->getPropertyValue( PN_SUBMISSION_ID ) >>= sTemp;
828 m_xItemList->set_text(*xEntry, sTemp);
829
830 _rEntry->getPropertyValue( PN_SUBMISSION_BIND ) >>= sTemp;
831 OUString sEntry = SvxResId( RID_STR_DATANAV_SUBM_BIND ) + sTemp;
832 if (!m_xItemList->iter_children(*xEntry))
833 {
834 SAL_WARN( "svx.form", "corrupt tree" );
835 return;
836 }
837 m_xItemList->set_text(*xEntry, sEntry);
838 _rEntry->getPropertyValue( PN_SUBMISSION_REF ) >>= sTemp;
839 sEntry = SvxResId( RID_STR_DATANAV_SUBM_REF ) + sTemp;
840 if (!m_xItemList->iter_next_sibling(*xEntry))
841 {
842 SAL_WARN( "svx.form", "corrupt tree" );
843 return;
844 }
845 m_xItemList->set_text(*xEntry, sEntry);
846 _rEntry->getPropertyValue( PN_SUBMISSION_ACTION ) >>= sTemp;
847 sEntry = SvxResId( RID_STR_DATANAV_SUBM_ACTION ) + sTemp;
848 if (!m_xItemList->iter_next_sibling(*xEntry))
849 {
850 SAL_WARN( "svx.form", "corrupt tree" );
851 return;
852 }
853 _rEntry->getPropertyValue( PN_SUBMISSION_METHOD ) >>= sTemp;
854 sEntry = SvxResId( RID_STR_DATANAV_SUBM_METHOD ) +
855 m_aMethodString.toUI( sTemp );
856 if (!m_xItemList->iter_next_sibling(*xEntry))
857 {
858 SAL_WARN( "svx.form", "corrupt tree" );
859 return;
860 }
861 m_xItemList->set_text(*xEntry, sEntry);
862 _rEntry->getPropertyValue( PN_SUBMISSION_REPLACE ) >>= sTemp;
863 sEntry = SvxResId( RID_STR_DATANAV_SUBM_REPLACE ) +
864 m_aReplaceString.toUI( sTemp );
865 if (!m_xItemList->iter_next_sibling(*xEntry))
866 {
867 SAL_WARN( "svx.form", "corrupt tree" );
868 return;
869 }
870 m_xItemList->set_text(*xEntry, sEntry);
871 }
872 catch ( Exception const & )
873 {
874 TOOLS_WARN_EXCEPTION( "svx.form", "XFormsPage::EditEntry()" );
875 }
876 }
877
879 {
880 bool bRet = false;
881
882 std::unique_ptr<weld::TreeIter> xEntry(m_xItemList->make_iterator());
883 bool bEntry = m_xItemList->get_selected(xEntry.get());
884 if ( bEntry &&
885 ( DGTInstance != m_eGroup || m_xItemList->get_iter_depth(*xEntry) ) )
886 {
887 Reference< css::xforms::XModel > xModel( m_xUIHelper, UNO_QUERY );
888 DBG_ASSERT( xModel.is(), "XFormsPage::RemoveEntry(): no model" );
889 ItemNode* pNode = weld::fromId<ItemNode*>(m_xItemList->get_id(*xEntry));
890 DBG_ASSERT( pNode, "XFormsPage::RemoveEntry(): no node" );
891
892 if ( DGTInstance == m_eGroup )
893 {
894 try
895 {
896 DBG_ASSERT( pNode->m_xNode.is(), "XFormsPage::RemoveEntry(): no XNode" );
897 css::xml::dom::NodeType eChildType = pNode->m_xNode->getNodeType();
898 bool bIsElement = ( eChildType == css::xml::dom::NodeType_ELEMENT_NODE );
899 TranslateId pResId = bIsElement ? RID_STR_QRY_REMOVE_ELEMENT : RID_STR_QRY_REMOVE_ATTRIBUTE;
900 OUString sVar = bIsElement ? OUString(ELEMENTNAME) : OUString(ATTRIBUTENAME);
901 std::unique_ptr<weld::MessageDialog> xQBox(Application::CreateMessageDialog(m_pNaviWin->GetFrameWeld(),
902 VclMessageType::Question, VclButtonsType::YesNo,
903 SvxResId(pResId)));
904 OUString sMessText = xQBox->get_primary_text();
905 sMessText = sMessText.replaceFirst(
906 sVar, m_xUIHelper->getNodeDisplayName( pNode->m_xNode, false ) );
907 xQBox->set_primary_text(sMessText);
908 if (xQBox->run() == RET_YES)
909 {
910 std::unique_ptr<weld::TreeIter> xParent(m_xItemList->make_iterator(xEntry.get()));
911 bool bParent = m_xItemList->iter_parent(*xParent); (void)bParent;
912 assert(bParent && "XFormsPage::RemoveEntry(): no parent entry");
913 ItemNode* pParentNode = weld::fromId<ItemNode*>(m_xItemList->get_id(*xParent));
914 DBG_ASSERT( pParentNode && pParentNode->m_xNode.is(), "XFormsPage::RemoveEntry(): no parent XNode" );
915
916 Reference< css::xml::dom::XNode > xPNode;
917 Reference< css::xml::dom::XNode > xNode =
918 pParentNode->m_xNode->removeChild( pNode->m_xNode );
919 if ( xNode.is() )
920 xPNode = xNode->getParentNode();
921 DBG_ASSERT( !xPNode.is(), "XFormsPage::RemoveEntry(): node not removed" );
922 bRet = true;
923 }
924 }
925 catch ( Exception const & )
926 {
927 TOOLS_WARN_EXCEPTION( "svx.form", "XFormsPage::RemoveEntry()" );
928 }
929 }
930 else
931 {
932 DBG_ASSERT( pNode->m_xPropSet.is(), "XFormsPage::RemoveEntry(): no propset" );
933 bool bSubmission = ( DGTSubmission == m_eGroup );
934 TranslateId pResId = bSubmission ? RID_STR_QRY_REMOVE_SUBMISSION : RID_STR_QRY_REMOVE_BINDING;
935 OUString sProperty = bSubmission ? OUString(PN_SUBMISSION_ID) : OUString(PN_BINDING_ID);
936 OUString sSearch = bSubmission ? OUString(SUBMISSIONNAME) : OUString(BINDINGNAME);
937 OUString sName;
938 try
939 {
940 pNode->m_xPropSet->getPropertyValue( sProperty ) >>= sName;
941 }
942 catch ( Exception const & )
943 {
944 TOOLS_WARN_EXCEPTION( "svx.form", "XFormsPage::RemoveEntry()" );
945 }
946 std::unique_ptr<weld::MessageDialog> xQBox(Application::CreateMessageDialog(m_pNaviWin->GetFrameWeld(),
947 VclMessageType::Question, VclButtonsType::YesNo,
948 SvxResId(pResId)));
949 OUString sMessText = xQBox->get_primary_text();
950 sMessText = sMessText.replaceFirst( sSearch, sName);
951 xQBox->set_primary_text(sMessText);
952 if (xQBox->run() == RET_YES)
953 {
954 try
955 {
956 if ( bSubmission )
957 xModel->getSubmissions()->remove( Any( pNode->m_xPropSet ) );
958 else // then Binding Page
959 xModel->getBindings()->remove( Any( pNode->m_xPropSet ) );
960 bRet = true;
961 }
962 catch ( Exception const & )
963 {
964 TOOLS_WARN_EXCEPTION( "svx.form", "XFormsPage::RemoveEntry()" );
965 }
966 }
967 }
968
969 if (bRet)
970 {
971 m_xItemList->remove(*xEntry);
972 delete pNode;
973 }
974 }
975
976 return bRet;
977 }
978
979 IMPL_LINK(XFormsPage, KeyInputHdl, const KeyEvent&, rKEvt, bool)
980 {
981 bool bHandled = false;
982
983 sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode();
984 if (nCode == KEY_DELETE)
985 bHandled = DoMenuAction(u"delete");
986
987 return bHandled;
988 }
989
990 OUString XFormsPage::SetModel( const Reference< css::xforms::XModel >& _xModel, int _nPagePos )
991 {
992 DBG_ASSERT( _xModel.is(), "XFormsPage::SetModel(): invalid model" );
993
994 m_xUIHelper.set( _xModel, UNO_QUERY );
995 OUString sRet;
996 m_bHasModel = true;
997
998 switch ( m_eGroup )
999 {
1000 case DGTInstance :
1001 {
1002 DBG_ASSERT( _nPagePos != -1, "XFormsPage::SetModel(): invalid page position" );
1003 try
1004 {
1005 Reference< XContainer > xContainer( _xModel->getInstances(), UNO_QUERY );
1006 if ( xContainer.is() )
1007 m_pNaviWin->AddContainerBroadcaster( xContainer );
1008
1009 Reference< XEnumerationAccess > xNumAccess = _xModel->getInstances();
1010 if ( xNumAccess.is() )
1011 {
1012 Reference < XEnumeration > xNum = xNumAccess->createEnumeration();
1013 if ( xNum.is() && xNum->hasMoreElements() )
1014 {
1015 int nIter = 0;
1016 while ( xNum->hasMoreElements() )
1017 {
1018 if ( nIter == _nPagePos )
1019 {
1020 Sequence< PropertyValue > xPropSeq;
1021 Any aAny = xNum->nextElement();
1022 if ( aAny >>= xPropSeq )
1023 sRet = LoadInstance(xPropSeq);
1024 else
1025 {
1026 SAL_WARN( "svx.form", "XFormsPage::SetModel(): invalid instance" );
1027 }
1028 break;
1029 }
1030 else
1031 {
1032 xNum->nextElement();
1033 ++nIter;
1034 }
1035 }
1036 }
1037 }
1038 }
1039 catch( Exception const & )
1040 {
1041 TOOLS_WARN_EXCEPTION( "svx.form", "XFormsPage::SetModel()" );
1042 }
1043 break;
1044 }
1045
1046 case DGTSubmission :
1047 {
1048 DBG_ASSERT( _nPagePos == -1, "XFormsPage::SetModel(): invalid page position" );
1049 try
1050 {
1051 Reference< XContainer > xContainer( _xModel->getSubmissions(), UNO_QUERY );
1052 if ( xContainer.is() )
1053 m_pNaviWin->AddContainerBroadcaster( xContainer );
1054
1055 Reference< XEnumerationAccess > xNumAccess = _xModel->getSubmissions();
1056 if ( xNumAccess.is() )
1057 {
1058 Reference < XEnumeration > xNum = xNumAccess->createEnumeration();
1059 if ( xNum.is() && xNum->hasMoreElements() )
1060 {
1061 while ( xNum->hasMoreElements() )
1062 {
1063 Reference< XPropertySet > xPropSet;
1064 Any aAny = xNum->nextElement();
1065 if ( aAny >>= xPropSet )
1066 AddEntry( xPropSet );
1067 }
1068 }
1069 }
1070 }
1071 catch( Exception const & )
1072 {
1073 TOOLS_WARN_EXCEPTION( "svx.form", "XFormsPage::SetModel()" );
1074 }
1075 break;
1076 }
1077
1078 case DGTBinding :
1079 {
1080 DBG_ASSERT( _nPagePos == -1, "XFormsPage::SetModel(): invalid page position" );
1081 try
1082 {
1083 Reference< XContainer > xContainer( _xModel->getBindings(), UNO_QUERY );
1084 if ( xContainer.is() )
1085 m_pNaviWin->AddContainerBroadcaster( xContainer );
1086
1087 Reference< XEnumerationAccess > xNumAccess = _xModel->getBindings();
1088 if ( xNumAccess.is() )
1089 {
1090 Reference < XEnumeration > xNum = xNumAccess->createEnumeration();
1091 if ( xNum.is() && xNum->hasMoreElements() )
1092 {
1093 OUString aImage(RID_SVXBMP_ELEMENT);
1094 std::unique_ptr<weld::TreeIter> xRes(m_xItemList->make_iterator());
1095 while ( xNum->hasMoreElements() )
1096 {
1097 Reference< XPropertySet > xPropSet;
1098 Any aAny = xNum->nextElement();
1099 if ( aAny >>= xPropSet )
1100 {
1101 OUString sEntry;
1102 OUString sTemp;
1103 xPropSet->getPropertyValue( PN_BINDING_ID ) >>= sTemp;
1104 sEntry += sTemp + ": ";
1105 xPropSet->getPropertyValue( PN_BINDING_EXPR ) >>= sTemp;
1106 sEntry += sTemp;
1107
1108 ItemNode* pNode = new ItemNode( xPropSet );
1109
1110 OUString sId(weld::toId(pNode));
1111 m_xItemList->insert(nullptr, -1, &sEntry, &sId, nullptr, nullptr, false, xRes.get());
1112 m_xItemList->set_image(*xRes, aImage);
1113 }
1114 }
1115 }
1116 }
1117 }
1118 catch( Exception const & )
1119 {
1120 TOOLS_WARN_EXCEPTION( "svx.form", "XFormsPage::SetModel()" );
1121 }
1122 break;
1123 }
1124 default:
1125 OSL_FAIL( "XFormsPage::SetModel: unknown group!" );
1126 break;
1127 }
1128
1130
1131 return sRet;
1132 }
1133
1135 {
1136 m_bHasModel = false;
1138 }
1139
1140 OUString XFormsPage::LoadInstance(const Sequence< PropertyValue >& _xPropSeq)
1141 {
1142 OUString sRet;
1143 OUString sTemp;
1144 OUString sInstModel = PN_INSTANCE_MODEL;
1145 OUString sInstName = PN_INSTANCE_ID;
1146 OUString sInstURL = PN_INSTANCE_URL;
1147 for ( const PropertyValue& rProp : _xPropSeq )
1148 {
1149 if ( sInstModel == rProp.Name )
1150 {
1151 Reference< css::xml::dom::XNode > xRoot;
1152 if ( rProp.Value >>= xRoot )
1153 {
1154 try
1155 {
1156 Reference< XEventTarget > xTarget( xRoot, UNO_QUERY );
1157 if ( xTarget.is() )
1159
1160 OUString sNodeName =
1161 m_xUIHelper->getNodeDisplayName( xRoot, m_pNaviWin->IsShowDetails() );
1162 if ( sNodeName.isEmpty() )
1163 sNodeName = xRoot->getNodeName();
1164 if ( xRoot->hasChildNodes() )
1165 AddChildren(nullptr, xRoot);
1166 }
1167 catch ( Exception const & )
1168 {
1169 TOOLS_WARN_EXCEPTION( "svx.form", "XFormsPage::LoadInstance()" );
1170 }
1171 }
1172 }
1173 else if ( sInstName == rProp.Name && ( rProp.Value >>= sTemp ) )
1174 m_sInstanceName = sRet = sTemp;
1175 else if ( sInstURL == rProp.Name && ( rProp.Value >>= sTemp ) )
1176 m_sInstanceURL = sTemp;
1177 }
1178
1179 return sRet;
1180 }
1181
1182 bool XFormsPage::DoMenuAction(std::u16string_view rMenuID)
1183 {
1184 return DoToolBoxAction(rMenuID);
1185 }
1186
1187 void XFormsPage::SetMenuEntrySensitive(const OUString& rIdent, bool bSensitive)
1188 {
1190 return;
1191 m_xMenu->set_sensitive(rIdent, bSensitive);
1192 }
1193
1195 {
1196 bool bEnableAdd = false;
1197 bool bEnableEdit = false;
1198 bool bEnableRemove = false;
1199
1200 std::unique_ptr<weld::TreeIter> xEntry(m_xItemList->make_iterator());
1201 bool bEntry = m_xItemList->get_selected(xEntry.get());
1202 if (bEntry)
1203 {
1204 bEnableAdd = true;
1205 bool bSubmitChild = false;
1206 if (DGTSubmission == m_eGroup && m_xItemList->get_iter_depth(*xEntry))
1207 {
1208 m_xItemList->iter_parent(*xEntry);
1209 bSubmitChild = true;
1210 }
1211 ItemNode* pNode = weld::fromId<ItemNode*>(m_xItemList->get_id(*xEntry));
1212 if ( pNode && ( pNode->m_xNode.is() || pNode->m_xPropSet.is() ) )
1213 {
1214 bEnableEdit = true;
1215 bEnableRemove = !bSubmitChild;
1216 if ( DGTInstance == m_eGroup && !m_xItemList->get_iter_depth(*xEntry) )
1217 bEnableRemove = false;
1218 if ( pNode->m_xNode.is() )
1219 {
1220 try
1221 {
1222 css::xml::dom::NodeType eChildType = pNode->m_xNode->getNodeType();
1223 if ( eChildType != css::xml::dom::NodeType_ELEMENT_NODE
1224 && eChildType != css::xml::dom::NodeType_DOCUMENT_NODE )
1225 {
1226 bEnableAdd = false;
1227 }
1228 }
1229 catch ( Exception const & )
1230 {
1231 TOOLS_WARN_EXCEPTION( "svx.form", "XFormsPage::EnableMenuItems()" );
1232 }
1233 }
1234 }
1235 }
1236 else if ( m_eGroup != DGTInstance )
1237 bEnableAdd = true;
1238
1239 m_xToolBox->set_item_sensitive("additem", bEnableAdd);
1240 m_xToolBox->set_item_sensitive("addelement", bEnableAdd);
1241 m_xToolBox->set_item_sensitive("addattribute", bEnableAdd);
1242 m_xToolBox->set_item_sensitive("edit", bEnableEdit);
1243 m_xToolBox->set_item_sensitive("delete", bEnableRemove);
1244
1245 if (m_xMenu)
1246 {
1247 SetMenuEntrySensitive("additem", bEnableAdd);
1248 SetMenuEntrySensitive("addelement", bEnableAdd);
1249 SetMenuEntrySensitive("addattribute", bEnableAdd);
1250 SetMenuEntrySensitive("edit", bEnableEdit);
1251 SetMenuEntrySensitive("delete", bEnableRemove);
1252 }
1253 if ( DGTInstance != m_eGroup )
1254 return;
1255
1256 TranslateId pResId1 = RID_STR_DATANAV_EDIT_ELEMENT;
1257 TranslateId pResId2 = RID_STR_DATANAV_REMOVE_ELEMENT;
1258 if (bEntry)
1259 {
1260 ItemNode* pNode = weld::fromId<ItemNode*>(m_xItemList->get_id(*xEntry));
1261 if ( pNode && pNode->m_xNode.is() )
1262 {
1263 try
1264 {
1265 css::xml::dom::NodeType eChildType = pNode->m_xNode->getNodeType();
1266 if ( eChildType == css::xml::dom::NodeType_ATTRIBUTE_NODE )
1267 {
1268 pResId1 = RID_STR_DATANAV_EDIT_ATTRIBUTE;
1269 pResId2 = RID_STR_DATANAV_REMOVE_ATTRIBUTE;
1270 }
1271 }
1272 catch ( Exception const & )
1273 {
1274 TOOLS_WARN_EXCEPTION( "svx.form", "XFormsPage::EnableMenuItems()" );
1275 }
1276 }
1277 }
1278 m_xToolBox->set_item_label("edit", SvxResId(pResId1));
1279 m_xToolBox->set_item_label("delete", SvxResId(pResId2));
1280 if (m_xMenu)
1281 {
1282 m_xMenu->set_label("edit", SvxResId( pResId1 ) );
1283 m_xMenu->set_label("delete", SvxResId( pResId2 ) );
1284 }
1285 }
1286
1288 : m_xParent(pParent)
1289 , m_xModelsBox(rBuilder.weld_combo_box("modelslist"))
1290 , m_xModelBtn(rBuilder.weld_menu_button("modelsbutton"))
1291 , m_xTabCtrl(rBuilder.weld_notebook("tabcontrol"))
1292 , m_xInstanceBtn(rBuilder.weld_menu_button("instances"))
1293 , m_nLastSelectedPos(-1)
1294 , m_bShowDetails(false)
1295 , m_bIsNotifyDisabled(false)
1296 , m_aUpdateTimer("svx DataNavigatorWindow m_aUpdateTimer")
1297 , m_xDataListener(new DataListener(this))
1298 {
1299 // handler
1300 m_xModelsBox->connect_changed( LINK( this, DataNavigatorWindow, ModelSelectListBoxHdl ) );
1301 Link<const OUString&, void> aLink1 = LINK( this, DataNavigatorWindow, MenuSelectHdl );
1302 m_xModelBtn->connect_selected(aLink1);
1303 m_xInstanceBtn->connect_selected(aLink1);
1304 Link<weld::Toggleable&,void> aLink2 = LINK( this, DataNavigatorWindow, MenuActivateHdl );
1305 m_xModelBtn->connect_toggled( aLink2 );
1306 m_xInstanceBtn->connect_toggled( aLink2 );
1307 m_xTabCtrl->connect_enter_page( LINK( this, DataNavigatorWindow, ActivatePageHdl ) );
1308 m_aUpdateTimer.SetTimeout( 2000 );
1310
1311 // init tabcontrol
1312 OUString sPageId("instance");
1313 SvtViewOptions aViewOpt( EViewType::TabDialog, CFGNAME_DATANAVIGATOR );
1314 if ( aViewOpt.Exists() )
1315 {
1316 OUString sNewPageId = aViewOpt.GetPageID();
1317 if (m_xTabCtrl->get_page_index(sNewPageId) != -1)
1318 sPageId = sNewPageId;
1320 }
1321
1322 m_xInstanceBtn->set_item_active("instancesdetails", m_bShowDetails);
1323
1324 m_xTabCtrl->set_current_page(sPageId);
1325 ActivatePageHdl(sPageId);
1326
1327 // get our frame
1328 DBG_ASSERT( pBindings != nullptr,
1329 "DataNavigatorWindow::LoadModels(): no SfxBindings; can't get frame" );
1331 DBG_ASSERT( m_xFrame.is(), "DataNavigatorWindow::LoadModels(): no frame" );
1332 // add frameaction listener
1333 Reference< XFrameActionListener > xListener = m_xDataListener;
1334 m_xFrame->addFrameActionListener( xListener );
1335
1336 // load xforms models of the current document
1337 LoadModels();
1338
1339 // tdf#154322 select the first entry of the current page by default
1340 if (XFormsPage* pPage = GetPage(sPageId))
1341 pPage->SelectFirstEntry();
1342 }
1343
1345 {
1346 Reference< XFrameActionListener > xListener = m_xDataListener;
1347 m_xFrame->removeFrameActionListener( xListener );
1348
1349 SvtViewOptions aViewOpt( EViewType::TabDialog, CFGNAME_DATANAVIGATOR );
1350 aViewOpt.SetPageID(m_xTabCtrl->get_current_page_ident());
1352
1353 m_xInstPage.reset();
1354 m_xSubmissionPage.reset();
1355 m_xBindingPage.reset();
1356
1357 sal_Int32 i, nCount = m_aPageList.size();
1358 for ( i = 0; i < nCount; ++i )
1359 m_aPageList[i].reset();
1360 m_aPageList.clear();
1361
1363 m_xDataListener.clear();
1364 }
1365
1366 IMPL_LINK( DataNavigatorWindow, ModelSelectListBoxHdl, weld::ComboBox&, rBox, void )
1367 {
1368 ModelSelectHdl(&rBox);
1369 }
1370
1372 {
1373 sal_Int32 nPos = m_xModelsBox->get_active();
1374 // pBox == NULL, if you want to force a new fill.
1375 if ( nPos != m_nLastSelectedPos || !pBox )
1376 {
1378 ClearAllPageModels( pBox != nullptr );
1379 InitPages();
1381 }
1382 }
1383
1384 IMPL_LINK(DataNavigatorWindow, MenuSelectHdl, const OUString&, rIdent, void)
1385 {
1386 bool bIsDocModified = false;
1387 Reference< css::xforms::XFormsUIHelper1 > xUIHelper;
1388 sal_Int32 nSelectedPos = m_xModelsBox->get_active();
1389 OUString sSelectedModel(m_xModelsBox->get_text(nSelectedPos));
1390 Reference< css::xforms::XModel > xModel;
1391 try
1392 {
1393 Any aAny = m_xDataContainer->getByName( sSelectedModel );
1394 if ( aAny >>= xModel )
1395 xUIHelper.set( xModel, UNO_QUERY );
1396 }
1397 catch ( Exception const & )
1398 {
1399 TOOLS_WARN_EXCEPTION( "svx.form", "DataNavigatorWindow::MenuSelectHdl()" );
1400 }
1401 DBG_ASSERT( xUIHelper.is(), "DataNavigatorWindow::MenuSelectHdl(): no UIHelper" );
1402
1403 m_bIsNotifyDisabled = true;
1404
1405 if (rIdent == "modelsadd")
1406 {
1407 AddModelDialog aDlg(GetFrameWeld(), false);
1408 bool bShowDialog = true;
1409 while ( bShowDialog )
1410 {
1411 bShowDialog = false;
1412 if (aDlg.run() == RET_OK)
1413 {
1414 OUString sNewName = aDlg.GetName();
1415 bool bDocumentData = aDlg.GetModifyDoc();
1416
1417 if (m_xModelsBox->find_text(sNewName) != -1)
1418 {
1419 // error: model name already exists
1420 std::unique_ptr<weld::MessageDialog> xErrBox(Application::CreateMessageDialog(GetFrameWeld(),
1421 VclMessageType::Warning, VclButtonsType::Ok,
1422 SvxResId(RID_STR_DOUBLE_MODELNAME)));
1423 xErrBox->set_primary_text(xErrBox->get_primary_text().replaceFirst(MSG_VARIABLE, sNewName));
1424 xErrBox->run();
1425 bShowDialog = true;
1426 }
1427 else
1428 {
1429 try
1430 {
1431 // add new model to frame model
1432 Reference< css::xforms::XModel > xNewModel(
1433 xUIHelper->newModel( m_xFrameModel, sNewName ), UNO_SET_THROW );
1434
1435 Reference< XPropertySet > xModelProps( xNewModel, UNO_QUERY_THROW );
1436 xModelProps->setPropertyValue("ExternalData", Any( !bDocumentData ) );
1437
1438 m_xModelsBox->append_text(sNewName);
1439 m_xModelsBox->set_active(m_xModelsBox->get_count() - 1);
1440 ModelSelectHdl(m_xModelsBox.get());
1441 bIsDocModified = true;
1442 }
1443 catch ( Exception const & )
1444 {
1445 TOOLS_WARN_EXCEPTION( "svx.form", "DataNavigatorWindow::MenuSelectHdl()" );
1446 }
1447 }
1448 }
1449 }
1450 }
1451 else if (rIdent == "modelsedit")
1452 {
1453 AddModelDialog aDlg(GetFrameWeld(), true);
1454 aDlg.SetName( sSelectedModel );
1455
1456 bool bDocumentData( false );
1457 try
1458 {
1459 Reference< css::xforms::XFormsSupplier > xFormsSupp( m_xFrameModel, UNO_QUERY_THROW );
1460 Reference< XNameContainer > xXForms( xFormsSupp->getXForms(), UNO_SET_THROW );
1461 Reference< XPropertySet > xModelProps( xXForms->getByName( sSelectedModel ), UNO_QUERY_THROW );
1462 bool bExternalData = false;
1463 OSL_VERIFY( xModelProps->getPropertyValue( "ExternalData" ) >>= bExternalData );
1464 bDocumentData = !bExternalData;
1465 }
1466 catch( const Exception& )
1467 {
1469 }
1470 aDlg.SetModifyDoc( bDocumentData );
1471
1472 if (aDlg.run() == RET_OK)
1473 {
1474 if ( aDlg.GetModifyDoc() != bDocumentData )
1475 {
1476 bDocumentData = aDlg.GetModifyDoc();
1477 try
1478 {
1479 Reference< css::xforms::XFormsSupplier > xFormsSupp( m_xFrameModel, UNO_QUERY_THROW );
1480 Reference< XNameContainer > xXForms( xFormsSupp->getXForms(), UNO_SET_THROW );
1481 Reference< XPropertySet > xModelProps( xXForms->getByName( sSelectedModel ), UNO_QUERY_THROW );
1482 xModelProps->setPropertyValue( "ExternalData", Any( !bDocumentData ) );
1483 bIsDocModified = true;
1484 }
1485 catch( const Exception& )
1486 {
1488 }
1489 }
1490
1491 OUString sNewName = aDlg.GetName();
1492 if ( !sNewName.isEmpty() && ( sNewName != sSelectedModel ) )
1493 {
1494 try
1495 {
1496 xUIHelper->renameModel( m_xFrameModel, sSelectedModel, sNewName );
1497
1498 m_xModelsBox->remove(nSelectedPos);
1499 m_xModelsBox->append_text(sNewName);
1500 m_xModelsBox->set_active(m_xModelsBox->get_count() - 1);
1501 bIsDocModified = true;
1502 }
1503 catch ( Exception const & )
1504 {
1505 TOOLS_WARN_EXCEPTION( "svx.form", "DataNavigatorWindow::MenuSelectHdl()" );
1506 }
1507 }
1508 }
1509 }
1510 else if (rIdent == "modelsremove")
1511 {
1512 std::unique_ptr<weld::MessageDialog> xQBox(Application::CreateMessageDialog(GetFrameWeld(),
1513 VclMessageType::Question, VclButtonsType::YesNo,
1514 SvxResId( RID_STR_QRY_REMOVE_MODEL)));
1515 OUString sText = xQBox->get_primary_text();
1516 sText = sText.replaceFirst( MODELNAME, sSelectedModel );
1517 xQBox->set_primary_text(sText);
1518 if (xQBox->run() == RET_YES)
1519 {
1520 try
1521 {
1522 xUIHelper->removeModel( m_xFrameModel, sSelectedModel );
1523 }
1524 catch ( Exception const & )
1525 {
1526 TOOLS_WARN_EXCEPTION( "svx.form", "DataNavigatorWindow::MenuSelectHdl()" );
1527 }
1528 m_xModelsBox->remove(nSelectedPos);
1529 if (m_xModelsBox->get_count() <= nSelectedPos)
1530 nSelectedPos = m_xModelsBox->get_count() - 1;
1531 m_xModelsBox->set_active(nSelectedPos);
1532 ModelSelectHdl(m_xModelsBox.get());
1533 bIsDocModified = true;
1534 }
1535 }
1536 else if (rIdent == "instancesadd")
1537 {
1538 AddInstanceDialog aDlg(GetFrameWeld(), false);
1539 if (aDlg.run() == RET_OK)
1540 {
1541 OUString sPageId = GetNewPageId(); // ModelSelectHdl will cause a page of this id to be created
1542
1543 OUString sName = aDlg.GetName();
1544 if (sName.isEmpty())
1545 {
1546 SAL_WARN( "svx.form", "DataNavigatorWindow::CreateInstancePage(): instance without name" );
1547 sName = "untitled";
1548 }
1549
1550 OUString sURL = aDlg.GetURL();
1551 bool bLinkOnce = aDlg.IsLinkInstance();
1552 try
1553 {
1554 xUIHelper->newInstance( sName, sURL, !bLinkOnce );
1555 }
1556 catch ( Exception const & )
1557 {
1558 TOOLS_WARN_EXCEPTION( "svx.form", "DataNavigatorWindow::MenuSelectHdl()" );
1559 }
1560 ModelSelectHdl( nullptr );
1561
1562 XFormsPage* pPage = GetPage(sPageId);
1563 pPage->SetInstanceName(sName);
1564 pPage->SetInstanceURL(sURL);
1565 pPage->SetLinkOnce(bLinkOnce);
1566 ActivatePageHdl(sPageId);
1567
1568 bIsDocModified = true;
1569 }
1570 }
1571 else if (rIdent == "instancesedit")
1572 {
1573 OUString sIdent = GetCurrentPage();
1574 XFormsPage* pPage = GetPage(sIdent);
1575 if ( pPage )
1576 {
1577 AddInstanceDialog aDlg(GetFrameWeld(), true);
1578 aDlg.SetName( pPage->GetInstanceName() );
1579 aDlg.SetURL( pPage->GetInstanceURL() );
1580 aDlg.SetLinkInstance( pPage->GetLinkOnce() );
1581 OUString sOldName = aDlg.GetName();
1582 if (aDlg.run() == RET_OK)
1583 {
1584 OUString sNewName = aDlg.GetName();
1585 OUString sURL = aDlg.GetURL();
1586 bool bLinkOnce = aDlg.IsLinkInstance();
1587 try
1588 {
1589 xUIHelper->renameInstance( sOldName,
1590 sNewName,
1591 sURL,
1592 !bLinkOnce );
1593 }
1594 catch ( Exception const & )
1595 {
1596 TOOLS_WARN_EXCEPTION( "svx.form", "DataNavigatorWindow::MenuSelectHdl()" );
1597 }
1598 pPage->SetInstanceName(sNewName);
1599 pPage->SetInstanceURL(sURL);
1600 pPage->SetLinkOnce(bLinkOnce);
1601 m_xTabCtrl->set_tab_label_text(sIdent, sNewName);
1602 bIsDocModified = true;
1603 }
1604 }
1605 }
1606 else if (rIdent == "instancesremove")
1607 {
1608 OUString sIdent = GetCurrentPage();
1609 XFormsPage* pPage = GetPage(sIdent);
1610 if (pPage)
1611 {
1612 OUString sInstName = pPage->GetInstanceName();
1613 std::unique_ptr<weld::MessageDialog> xQBox(Application::CreateMessageDialog(GetFrameWeld(),
1614 VclMessageType::Question, VclButtonsType::YesNo,
1615 SvxResId(RID_STR_QRY_REMOVE_INSTANCE)));
1616 OUString sMessText = xQBox->get_primary_text();
1617 sMessText = sMessText.replaceFirst( INSTANCENAME, sInstName );
1618 xQBox->set_primary_text(sMessText);
1619 if (xQBox->run() == RET_YES)
1620 {
1621 bool bDoRemove = false;
1622 if (IsAdditionalPage(sIdent))
1623 {
1624 auto aPageListEnd = m_aPageList.end();
1625 auto aFoundPage = std::find_if(m_aPageList.begin(), aPageListEnd,
1626 [pPage](const auto&elem) { return elem.get() == pPage; });
1627 if ( aFoundPage != aPageListEnd )
1628 {
1629 m_aPageList.erase( aFoundPage );
1630 bDoRemove = true;
1631 }
1632 }
1633 else
1634 {
1635 m_xInstPage.reset();
1636 bDoRemove = true;
1637 }
1638
1639 if ( bDoRemove )
1640 {
1641 try
1642 {
1643 xUIHelper->removeInstance( sInstName );
1644 }
1645 catch (const Exception&)
1646 {
1647 TOOLS_WARN_EXCEPTION( "svx.form", "DataNavigatorWindow::MenuSelectHdl()" );
1648 }
1649 m_xTabCtrl->remove_page(sIdent);
1650 m_xTabCtrl->set_current_page("instance");
1651 ModelSelectHdl( nullptr );
1652 bIsDocModified = true;
1653 }
1654 }
1655 }
1656 }
1657 else if (rIdent == "instancesdetails")
1658 {
1659 m_bShowDetails = !m_bShowDetails;
1660 m_xInstanceBtn->set_item_active("instancesdetails", m_bShowDetails);
1661 ModelSelectHdl(m_xModelsBox.get());
1662 }
1663 else
1664 {
1665 SAL_WARN( "svx.form", "DataNavigatorWindow::MenuSelectHdl(): wrong menu item" );
1666 }
1667
1668 m_bIsNotifyDisabled = false;
1669
1670 if ( bIsDocModified )
1671 SetDocModified();
1672 }
1673
1674 bool DataNavigatorWindow::IsAdditionalPage(std::u16string_view rIdent)
1675 {
1676 return o3tl::starts_with(rIdent, u"additional");
1677 }
1678
1679 IMPL_LINK( DataNavigatorWindow, MenuActivateHdl, weld::Toggleable&, rBtn, void )
1680 {
1681 if (m_xInstanceBtn.get() == &rBtn)
1682 {
1683 OUString sIdent(m_xTabCtrl->get_current_page_ident());
1684 bool bIsInstPage = (IsAdditionalPage(sIdent) || sIdent == "instance");
1685 m_xInstanceBtn->set_item_sensitive( "instancesedit", bIsInstPage );
1686 m_xInstanceBtn->set_item_sensitive( "instancesremove",
1687 bIsInstPage && m_xTabCtrl->get_n_pages() > MIN_PAGE_COUNT );
1688 m_xInstanceBtn->set_item_sensitive( "instancesdetails", bIsInstPage );
1689 }
1690 else if (m_xModelBtn.get() == &rBtn)
1691 {
1692 // we need at least one model!
1693 m_xModelBtn->set_item_sensitive("modelsremove", m_xModelsBox->get_count() > 1 );
1694 }
1695 else
1696 {
1697 SAL_WARN( "svx.form", "DataNavigatorWindow::MenuActivateHdl(): wrong button" );
1698 }
1699 }
1700
1701 IMPL_LINK(DataNavigatorWindow, ActivatePageHdl, const OUString&, rIdent, void)
1702 {
1703 XFormsPage* pPage = GetPage(rIdent);
1704 if (!pPage)
1705 return;
1706 if (m_xDataContainer.is() && !pPage->HasModel())
1707 SetPageModel(rIdent);
1708 }
1709
1711 {
1712 ModelSelectHdl( nullptr );
1713 }
1714
1716 {
1717 XFormsPage* pPage = nullptr;
1718 if (rCurId == "submissions")
1719 {
1720 if (!m_xSubmissionPage)
1721 m_xSubmissionPage.reset(new XFormsPage(m_xTabCtrl->get_page(rCurId), this, DGTSubmission));
1722 pPage = m_xSubmissionPage.get();
1723 }
1724 else if (rCurId == "bindings")
1725 {
1726 if (!m_xBindingPage)
1727 m_xBindingPage.reset(new XFormsPage(m_xTabCtrl->get_page(rCurId), this, DGTBinding));
1728 pPage = m_xBindingPage.get();
1729 }
1730 else if (rCurId == "instance")
1731 {
1732 if (!m_xInstPage)
1733 m_xInstPage.reset(new XFormsPage(m_xTabCtrl->get_page(rCurId), this, DGTInstance));
1734 pPage = m_xInstPage.get();
1735 }
1736 else
1737 {
1738 sal_uInt16 nPos = m_xTabCtrl->get_page_index(rCurId);
1739 if (HasFirstInstancePage() && nPos > 0)
1740 nPos--;
1741 if (m_aPageList.size() > nPos)
1742 pPage = m_aPageList[nPos].get();
1743 else
1744 {
1745 m_aPageList.emplace_back(std::make_unique<XFormsPage>(m_xTabCtrl->get_page(rCurId), this, DGTInstance));
1746 pPage = m_aPageList.back().get();
1747 }
1748 }
1749 return pPage;
1750 }
1751
1753 {
1754 return m_xTabCtrl->get_current_page_ident();
1755 }
1756
1758 {
1759 if ( !m_xFrameModel.is() )
1760 {
1761 // get model of active frame
1762 Reference< XController > xCtrl = m_xFrame->getController();
1763 if ( xCtrl.is() )
1764 {
1765 try
1766 {
1767 m_xFrameModel = xCtrl->getModel();
1768 }
1769 catch ( Exception const & )
1770 {
1771 TOOLS_WARN_EXCEPTION( "svx.form", "DataNavigatorWindow::LoadModels()" );
1772 }
1773 }
1774 }
1775
1776 if ( m_xFrameModel.is() )
1777 {
1778 try
1779 {
1780 Reference< css::xforms::XFormsSupplier > xFormsSupp( m_xFrameModel, UNO_QUERY );
1781 if ( xFormsSupp.is() )
1782 {
1783 Reference< XNameContainer > xContainer = xFormsSupp->getXForms();
1784 if ( xContainer.is() )
1785 {
1786 m_xDataContainer = xContainer;
1787 const Sequence< OUString > aNameList = m_xDataContainer->getElementNames();
1788 for ( const OUString& rName : aNameList )
1789 {
1790 Any aAny = m_xDataContainer->getByName( rName );
1791 Reference< css::xforms::XModel > xFormsModel;
1792 if ( aAny >>= xFormsModel )
1793 m_xModelsBox->append_text(xFormsModel->getID());
1794 }
1795 }
1796 }
1797 }
1798 catch( Exception const & )
1799 {
1800 TOOLS_WARN_EXCEPTION( "svx.form", "DataNavigatorWindow::LoadModels()" );
1801 }
1802 }
1803
1804 if (m_xModelsBox->get_count() > 0)
1805 {
1806 m_xModelsBox->set_active(0);
1808 }
1809 }
1810
1811 void DataNavigatorWindow::SetPageModel(const OUString& rIdent)
1812 {
1813 OUString sModel(m_xModelsBox->get_active_text());
1814 try
1815 {
1816 Any aAny = m_xDataContainer->getByName( sModel );
1817 Reference< css::xforms::XModel > xFormsModel;
1818 if ( aAny >>= xFormsModel )
1819 {
1820 int nPagePos = -1;
1821 XFormsPage* pPage = GetPage(rIdent);
1822 DBG_ASSERT( pPage, "DataNavigatorWindow::SetPageModel(): no page" );
1823 if (IsAdditionalPage(rIdent) || rIdent == "instance")
1824 {
1825 // instance page
1826 nPagePos = m_xTabCtrl->get_page_index(rIdent);
1827 }
1828 m_bIsNotifyDisabled = true;
1829 OUString sText = pPage->SetModel( xFormsModel, nPagePos );
1830 m_bIsNotifyDisabled = false;
1831 if (!sText.isEmpty())
1832 m_xTabCtrl->set_tab_label_text(rIdent, sText);
1833 }
1834 }
1835 catch (const NoSuchElementException& )
1836 {
1837 SAL_WARN( "svx.form", "DataNavigatorWindow::SetPageModel(): no such element" );
1838 }
1839 catch( Exception const & )
1840 {
1841 TOOLS_WARN_EXCEPTION( "svx.form", "DataNavigatorWindow::SetPageModel()" );
1842 }
1843 }
1844
1846 {
1847 OUString sModel(m_xModelsBox->get_active_text());
1848 try
1849 {
1850 Any aAny = m_xDataContainer->getByName( sModel );
1851 Reference< css::xforms::XModel > xModel;
1852 if ( aAny >>= xModel )
1853 {
1854 Reference< XEnumerationAccess > xNumAccess = xModel->getInstances();
1855 if ( xNumAccess.is() )
1856 {
1857 Reference < XEnumeration > xNum = xNumAccess->createEnumeration();
1858 if ( xNum.is() && xNum->hasMoreElements() )
1859 {
1860 sal_Int32 nAlreadyLoadedCount = m_aPageList.size();
1861 if ( !HasFirstInstancePage() && nAlreadyLoadedCount > 0 )
1862 nAlreadyLoadedCount--;
1863 sal_Int32 nIdx = 0;
1864 while ( xNum->hasMoreElements() )
1865 {
1866 if ( nIdx > nAlreadyLoadedCount )
1867 {
1868 Sequence< PropertyValue > xPropSeq;
1869 if ( xNum->nextElement() >>= xPropSeq )
1870 CreateInstancePage( xPropSeq );
1871 else
1872 {
1873 SAL_WARN( "svx.form", "DataNavigator::InitPages(): invalid instance" );
1874 }
1875 }
1876 else
1877 xNum->nextElement();
1878 nIdx++;
1879 }
1880 }
1881 }
1882 }
1883 }
1884 catch ( NoSuchElementException& )
1885 {
1886 SAL_WARN( "svx.form", "DataNavigatorWindow::SetPageModel(): no such element" );
1887 }
1888 catch( Exception const & )
1889 {
1890 TOOLS_WARN_EXCEPTION( "svx.form", "DataNavigatorWindow::SetPageModel()" );
1891 }
1892 }
1893
1895 {
1896 if ( m_xInstPage )
1897 m_xInstPage->ClearModel();
1898 if ( m_xSubmissionPage )
1899 m_xSubmissionPage->ClearModel();
1900 if ( m_xBindingPage )
1901 m_xBindingPage->ClearModel();
1902
1903 sal_Int32 nCount = m_aPageList.size();
1904 for (sal_Int32 i = 0; i < nCount; ++i)
1905 {
1906 XFormsPage* pPage = m_aPageList[i].get();
1907 pPage->ClearModel();
1908 }
1909
1910 if ( bClearPages )
1911 {
1912 m_aPageList.clear();
1913 while ( m_xTabCtrl->get_n_pages() > MIN_PAGE_COUNT )
1914 m_xTabCtrl->remove_page(m_xTabCtrl->get_page_ident(1));
1915 }
1916 }
1917
1918 void DataNavigatorWindow::CreateInstancePage( const Sequence< PropertyValue >& _xPropSeq )
1919 {
1920 OUString sInstName;
1921 auto pProp = std::find_if(_xPropSeq.begin(), _xPropSeq.end(),
1922 [](const PropertyValue& rProp) { return PN_INSTANCE_ID == rProp.Name; });
1923 if (pProp != _xPropSeq.end())
1924 pProp->Value >>= sInstName;
1925
1926 OUString sPageId = GetNewPageId();
1927 if ( sInstName.isEmpty() )
1928 {
1929 SAL_WARN( "svx.form", "DataNavigatorWindow::CreateInstancePage(): instance without name" );
1930 sInstName = "untitled";
1931 }
1932 m_xTabCtrl->insert_page(sPageId, sInstName, m_xTabCtrl->get_n_pages() - 2);
1933 }
1934
1936 {
1937 return m_xTabCtrl->get_page_ident(0) == "instance";
1938 }
1939
1941 {
1942 int nMax = 0;
1943
1944 int nCount = m_xTabCtrl->get_n_pages();
1945 for (int i = 0; i < nCount; ++i)
1946 {
1947 OUString sIdent = m_xTabCtrl->get_page_ident(i);
1948 OUString sNumber;
1949 if (!sIdent.startsWith("additional", &sNumber))
1950 continue;
1951 int nPageId = sNumber.toInt32();
1952 if (nMax < nPageId)
1953 nMax = nPageId;
1954 }
1955
1956 return "additional" + OUString::number(nMax + 1);
1957 }
1958
1960 {
1961 SfxObjectShell* pCurrentDoc = SfxObjectShell::Current();
1962 DBG_ASSERT( pCurrentDoc, "DataNavigatorWindow::SetDocModified(): no objectshell" );
1963 if (pCurrentDoc && !pCurrentDoc->IsModified() && pCurrentDoc->IsEnableSetModified())
1964 pCurrentDoc->SetModified();
1965 }
1966
1968 {
1969 if ( m_bIsNotifyDisabled )
1970 return;
1971
1972 if ( _bLoadAll )
1973 {
1974 // reset all members
1976 m_xDataContainer.clear();
1977 m_xFrameModel.clear();
1978 m_xModelsBox->clear();
1979 m_nLastSelectedPos = -1;
1980 // for a reload
1981 LoadModels();
1982 }
1983 else
1985 }
1986
1987 void DataNavigatorWindow::AddContainerBroadcaster( const css::uno::Reference< css::container::XContainer >& xContainer )
1988 {
1989 Reference< XContainerListener > xListener = m_xDataListener;
1990 xContainer->addContainerListener( xListener );
1991 m_aContainerList.push_back( xContainer );
1992 }
1993
1994
1995 void DataNavigatorWindow::AddEventBroadcaster( const css::uno::Reference< css::xml::dom::events::XEventTarget >& xTarget )
1996 {
1997 Reference< XEventListener > xListener = m_xDataListener;
1998 xTarget->addEventListener( EVENTTYPE_CHARDATA, xListener, true );
1999 xTarget->addEventListener( EVENTTYPE_CHARDATA, xListener, false );
2000 xTarget->addEventListener( EVENTTYPE_ATTR, xListener, true );
2001 xTarget->addEventListener( EVENTTYPE_ATTR, xListener, false );
2002 m_aEventTargetList.push_back( xTarget );
2003 }
2004
2006 {
2007 Reference< XContainerListener > xContainerListener = m_xDataListener;
2008 sal_Int32 i, nCount = m_aContainerList.size();
2009 for ( i = 0; i < nCount; ++i )
2010 m_aContainerList[i]->removeContainerListener( xContainerListener );
2011 Reference< XEventListener > xEventListener = m_xDataListener;
2012 nCount = m_aEventTargetList.size();
2013 for ( i = 0; i < nCount; ++i )
2014 {
2015 m_aEventTargetList[i]->removeEventListener( EVENTTYPE_CHARDATA, xEventListener, true );
2016 m_aEventTargetList[i]->removeEventListener( EVENTTYPE_CHARDATA, xEventListener, false );
2017 m_aEventTargetList[i]->removeEventListener( EVENTTYPE_ATTR, xEventListener, true );
2018 m_aEventTargetList[i]->removeEventListener( EVENTTYPE_ATTR, xEventListener, false );
2019 }
2020 }
2021
2023 : SfxDockingWindow(_pBindings, _pMgr, _pParent, "DataNavigator", "svx/ui/datanavigator.ui")
2024 , SfxControllerItem(SID_FM_DATANAVIGATOR_CONTROL, *_pBindings)
2025 , m_xDataWin(new DataNavigatorWindow(this, *m_xBuilder, _pBindings))
2026 {
2027 SetText( SvxResId( RID_STR_DATANAVIGATOR ) );
2028
2029 Size aSize = GetOptimalSize();
2030 Size aLogSize = PixelToLogic(aSize, MapMode(MapUnit::MapAppFont));
2032 }
2033
2035 {
2036 disposeOnce();
2037 }
2038
2040 {
2041 m_xDataWin.reset();
2044 }
2045
2047 {
2048 }
2049
2051 {
2052 if ( ( eAlign == SfxChildAlignment::TOP ) || ( eAlign == SfxChildAlignment::BOTTOM ) )
2053 return Size();
2054
2055 return SfxDockingWindow::CalcDockingSize( eAlign );
2056 }
2057
2059 {
2060 switch ( eAlign )
2061 {
2062 case SfxChildAlignment::LEFT:
2063 case SfxChildAlignment::RIGHT:
2064 case SfxChildAlignment::NOALIGNMENT:
2065 return eAlign;
2066 default:
2067 break;
2068 }
2069 return eActAlign;
2070 }
2071
2072 SFX_IMPL_DOCKINGWINDOW( DataNavigatorManager, SID_FM_SHOW_DATANAVIGATOR )
2073
2074 DataNavigatorManager::DataNavigatorManager(
2075 vcl::Window* _pParent, sal_uInt16 _nId, SfxBindings* _pBindings, SfxChildWinInfo* _pInfo ) :
2076
2077 SfxChildWindow( _pParent, _nId )
2078
2079 {
2080 SetWindow( VclPtr<DataNavigator>::Create( _pBindings, this, _pParent ) );
2081 SetAlignment(SfxChildAlignment::RIGHT);
2082 GetWindow()->SetSizePixel( Size( 250, 400 ) );
2083 static_cast<SfxDockingWindow*>(GetWindow())->Initialize( _pInfo );
2084 }
2085
2087 const Reference< css::xforms::XFormsUIHelper1 >& _rUIHelper)
2088 : GenericDialogController(pParent, "svx/ui/adddataitemdialog.ui", "AddDataItemDialog")
2089 , m_xUIHelper(_rUIHelper)
2090 , m_pItemNode(_pNode)
2091 , m_eItemType(DITNone)
2092 , m_sFL_Element(SvxResId(RID_STR_ELEMENT))
2093 , m_sFL_Attribute(SvxResId(RID_STR_ATTRIBUTE))
2094 , m_sFL_Binding(SvxResId(RID_STR_BINDING))
2095 , m_sFT_BindingExp(SvxResId(RID_STR_BINDING_EXPR))
2096 , m_xItemFrame(m_xBuilder->weld_frame("itemframe"))
2097 , m_xNameFT(m_xBuilder->weld_label("nameft"))
2098 , m_xNameED(m_xBuilder->weld_entry("name"))
2099 , m_xDefaultFT(m_xBuilder->weld_label("valueft"))
2100 , m_xDefaultED(m_xBuilder->weld_entry("value"))
2101 , m_xDefaultBtn(m_xBuilder->weld_button("browse"))
2102 , m_xSettingsFrame(m_xBuilder->weld_widget("settingsframe"))
2103 , m_xDataTypeLB(m_xBuilder->weld_combo_box("datatype"))
2104 , m_xRequiredCB(m_xBuilder->weld_check_button("required"))
2105 , m_xRequiredBtn(m_xBuilder->weld_button("requiredcond"))
2106 , m_xRelevantCB(m_xBuilder->weld_check_button("relevant"))
2107 , m_xRelevantBtn(m_xBuilder->weld_button("relevantcond"))
2108 , m_xConstraintCB(m_xBuilder->weld_check_button("constraint"))
2109 , m_xConstraintBtn(m_xBuilder->weld_button("constraintcond"))
2110 , m_xReadonlyCB(m_xBuilder->weld_check_button("readonly"))
2111 , m_xReadonlyBtn(m_xBuilder->weld_button("readonlycond"))
2112 , m_xCalculateCB(m_xBuilder->weld_check_button("calculate"))
2113 , m_xCalculateBtn(m_xBuilder->weld_button("calculatecond"))
2114 , m_xOKBtn(m_xBuilder->weld_button("ok"))
2115 {
2116 InitDialog();
2117 InitFromNode();
2119 Check(nullptr);
2120 }
2121
2123 {
2124 if ( m_xTempBinding.is() )
2125 {
2126 Reference< css::xforms::XModel > xModel( m_xUIHelper, UNO_QUERY );
2127 if ( xModel.is() )
2128 {
2129 try
2130 {
2131 Reference < XSet > xBindings = xModel->getBindings();
2132 if ( xBindings.is() )
2133 xBindings->remove( Any( m_xTempBinding ) );
2134 }
2135 catch (const Exception&)
2136 {
2137 TOOLS_WARN_EXCEPTION( "svx.form", "AddDataItemDialog::Dtor()" );
2138 }
2139 }
2140 }
2141 if( m_xUIHelper.is() && m_xBinding.is() )
2142 {
2143 // remove binding, if it does not convey 'useful' information
2144 m_xUIHelper->removeBindingIfUseless( m_xBinding );
2145 }
2146 }
2147
2149 {
2150 Check(&rBox);
2151 }
2152
2154 {
2155 // Condition buttons are only enable if their check box is checked
2156 m_xReadonlyBtn->set_sensitive( m_xReadonlyCB->get_active() );
2157 m_xRequiredBtn->set_sensitive( m_xRequiredCB->get_active() );
2158 m_xRelevantBtn->set_sensitive( m_xRelevantCB->get_active() );
2159 m_xConstraintBtn->set_sensitive( m_xConstraintCB->get_active() );
2160 m_xCalculateBtn->set_sensitive( m_xCalculateCB->get_active() );
2161
2162 if ( !(pBox && m_xTempBinding.is()) )
2163 return;
2164
2165 OUString sTemp, sPropName;
2166 if ( m_xRequiredCB.get() == pBox )
2167 sPropName = PN_REQUIRED_EXPR;
2168 else if ( m_xRelevantCB.get() == pBox )
2169 sPropName = PN_RELEVANT_EXPR;
2170 else if ( m_xConstraintCB.get() == pBox )
2171 sPropName = PN_CONSTRAINT_EXPR;
2172 else if ( m_xReadonlyCB.get() == pBox )
2173 sPropName = PN_READONLY_EXPR;
2174 else if ( m_xCalculateCB.get() == pBox )
2175 sPropName = PN_CALCULATE_EXPR;
2176 bool bIsChecked = pBox->get_active();
2177 m_xTempBinding->getPropertyValue( sPropName ) >>= sTemp;
2178 if ( bIsChecked && sTemp.isEmpty() )
2179 sTemp = TRUE_VALUE;
2180 else if ( !bIsChecked && !sTemp.isEmpty() )
2181 sTemp.clear();
2182 m_xTempBinding->setPropertyValue( sPropName, Any( sTemp ) );
2183 }
2184
2185 IMPL_LINK(AddDataItemDialog, ConditionHdl, weld::Button&, rBtn, void)
2186 {
2187 OUString sPropName;
2188 if ( m_xDefaultBtn.get() == &rBtn )
2189 sPropName = PN_BINDING_EXPR;
2190 else if ( m_xRequiredBtn.get() == &rBtn )
2191 sPropName = PN_REQUIRED_EXPR;
2192 else if ( m_xRelevantBtn.get() == &rBtn )
2193 sPropName = PN_RELEVANT_EXPR;
2194 else if ( m_xConstraintBtn.get() == &rBtn )
2195 sPropName = PN_CONSTRAINT_EXPR;
2196 else if (m_xReadonlyBtn.get() == &rBtn)
2197 sPropName = PN_READONLY_EXPR;
2198 else if (m_xCalculateBtn.get() == &rBtn)
2199 sPropName = PN_CALCULATE_EXPR;
2200 AddConditionDialog aDlg(m_xDialog.get(), sPropName, m_xTempBinding);
2201 bool bIsDefBtn = ( m_xDefaultBtn.get() == &rBtn );
2202 OUString sCondition;
2203 if ( bIsDefBtn )
2204 sCondition = m_xDefaultED->get_text();
2205 else
2206 {
2207 OUString sTemp;
2208 m_xTempBinding->getPropertyValue( sPropName ) >>= sTemp;
2209 if ( sTemp.isEmpty() )
2210 sTemp = TRUE_VALUE;
2211 sCondition = sTemp;
2212 }
2213 aDlg.SetCondition( sCondition );
2214
2215 if (aDlg.run() == RET_OK)
2216 {
2217 OUString sNewCondition = aDlg.GetCondition();
2218 if ( bIsDefBtn )
2219 m_xDefaultED->set_text(sNewCondition);
2220 else
2221 {
2222
2223 m_xTempBinding->setPropertyValue(
2224 sPropName, Any( sNewCondition ) );
2225 }
2226 }
2227 }
2228
2229 static void copyPropSet( const Reference< XPropertySet >& xFrom, Reference< XPropertySet > const & xTo )
2230 {
2231 DBG_ASSERT( xFrom.is(), "copyPropSet(): no source" );
2232 DBG_ASSERT( xTo.is(), "copyPropSet(): no target" );
2233
2234 try
2235 {
2236 // get property names & infos, and iterate over target properties
2237 const Sequence< Property > aProperties = xTo->getPropertySetInfo()->getProperties();
2238 Reference< XPropertySetInfo > xFromInfo = xFrom->getPropertySetInfo();
2239 for ( const Property& rProperty : aProperties )
2240 {
2241 const OUString& rName = rProperty.Name;
2242
2243 // if both set have the property, copy the value
2244 // (catch and ignore exceptions, if any)
2245 if ( xFromInfo->hasPropertyByName( rName ) )
2246 {
2247 // don't set readonly properties
2248 Property aProperty = xFromInfo->getPropertyByName( rName );
2249 if ( ( aProperty.Attributes & PropertyAttribute::READONLY ) == 0 )
2250 xTo->setPropertyValue(rName, xFrom->getPropertyValue( rName ));
2251 }
2252 // else: no property? then ignore.
2253 }
2254 }
2255 catch ( Exception const & )
2256 {
2257 TOOLS_WARN_EXCEPTION( "svx.form", "copyPropSet()" );
2258 }
2259 }
2260
2262 {
2263 bool bIsHandleBinding = ( DITBinding == m_eItemType );
2264 bool bIsHandleText = ( DITText == m_eItemType );
2265 OUString sNewName( m_xNameED->get_text() );
2266
2267 if ( ( !bIsHandleBinding && !bIsHandleText && !m_xUIHelper->isValidXMLName( sNewName ) ) ||
2268 ( bIsHandleBinding && sNewName.isEmpty() ) )
2269 {
2270 // Error and don't close the dialog
2271 std::unique_ptr<weld::MessageDialog> xErrBox(Application::CreateMessageDialog(m_xDialog.get(),
2272 VclMessageType::Warning, VclButtonsType::Ok,
2273 SvxResId(RID_STR_INVALID_XMLNAME)));
2274 xErrBox->set_primary_text(xErrBox->get_primary_text().replaceFirst(MSG_VARIABLE, sNewName));
2275 xErrBox->run();
2276 return;
2277 }
2278
2279 OUString sDataType( m_xDataTypeLB->get_active_text() );
2280 m_xTempBinding->setPropertyValue( PN_BINDING_TYPE, Any( sDataType ) );
2281
2282 if ( bIsHandleBinding )
2283 {
2284 // copy properties from temp binding to original binding
2285 copyPropSet( m_xTempBinding, m_pItemNode->m_xPropSet );
2286 try
2287 {
2288 OUString sValue = m_xNameED->get_text();
2289 m_pItemNode->m_xPropSet->setPropertyValue( PN_BINDING_ID, Any( sValue ) );
2290 sValue = m_xDefaultED->get_text();
2291 m_pItemNode->m_xPropSet->setPropertyValue( PN_BINDING_EXPR, Any( sValue ) );
2292 }
2293 catch ( Exception const & )
2294 {
2295 TOOLS_WARN_EXCEPTION( "svx.form", "AddDataDialog::OKHdl()" );
2296 }
2297 }
2298 else
2299 {
2300 // copy properties from temp binding to original binding
2301 copyPropSet( m_xTempBinding, m_xBinding );
2302 try
2303 {
2304 if ( bIsHandleText )
2305 m_xUIHelper->setNodeValue( m_pItemNode->m_xNode, m_xDefaultED->get_text() );
2306 else
2307 {
2308 Reference< css::xml::dom::XNode > xNewNode =
2309 m_xUIHelper->renameNode( m_pItemNode->m_xNode, m_xNameED->get_text() );
2310 m_xUIHelper->setNodeValue( xNewNode, m_xDefaultED->get_text() );
2311 m_pItemNode->m_xNode = xNewNode;
2312 }
2313 }
2314 catch ( Exception const & )
2315 {
2316 TOOLS_WARN_EXCEPTION( "svx.form", "AddDataDialog::OKHdl()" );
2317 }
2318 }
2319 // then close the dialog
2320 m_xDialog->response(RET_OK);
2321 }
2322
2324 {
2325 // set handler
2326 Link<weld::Toggleable&,void> aLink = LINK( this, AddDataItemDialog, CheckHdl );
2327 m_xRequiredCB->connect_toggled( aLink );
2328 m_xRelevantCB->connect_toggled( aLink );
2329 m_xConstraintCB->connect_toggled( aLink );
2330 m_xReadonlyCB->connect_toggled( aLink );
2331 m_xCalculateCB->connect_toggled( aLink );
2332
2333 Link<weld::Button&,void> aLink2 = LINK( this, AddDataItemDialog, ConditionHdl );
2334 m_xDefaultBtn->connect_clicked( aLink2 );
2335 m_xRequiredBtn->connect_clicked( aLink2 );
2336 m_xRelevantBtn->connect_clicked( aLink2 );
2337 m_xConstraintBtn->connect_clicked( aLink2 );
2338 m_xReadonlyBtn->connect_clicked( aLink2 );
2339 m_xCalculateBtn->connect_clicked( aLink2 );
2340
2341 m_xOKBtn->connect_clicked( LINK( this, AddDataItemDialog, OKHdl ) );
2342 }
2343
2345 {
2346 if ( m_pItemNode )
2347 {
2348 if ( m_pItemNode->m_xNode.is() )
2349 {
2350 try
2351 {
2352 // detect type of the node
2353 css::xml::dom::NodeType eChildType = m_pItemNode->m_xNode->getNodeType();
2354 switch ( eChildType )
2355 {
2356 case css::xml::dom::NodeType_ATTRIBUTE_NODE:
2358 break;
2359 case css::xml::dom::NodeType_ELEMENT_NODE:
2361 break;
2362 case css::xml::dom::NodeType_TEXT_NODE:
2364 break;
2365 default:
2366 OSL_FAIL( "AddDataItemDialog::InitFronNode: cannot handle this node type!" );
2367 break;
2368 }
2369
2376 Reference< css::xml::dom::XNode > xNode = m_pItemNode->m_xNode;
2377 m_xBinding = m_xUIHelper->getBindingForNode( xNode, true );
2378 if ( m_xBinding.is() )
2379 {
2380 Reference< css::xforms::XModel > xModel( m_xUIHelper, UNO_QUERY );
2381 if ( xModel.is() )
2382 {
2383 m_xTempBinding = m_xUIHelper->cloneBindingAsGhost( m_xBinding );
2384 Reference < XSet > xBindings = xModel->getBindings();
2385 if ( xBindings.is() )
2386 xBindings->insert( Any( m_xTempBinding ) );
2387 }
2388 }
2389
2390 if ( m_eItemType != DITText )
2391 {
2392 OUString sName( m_xUIHelper->getNodeName( m_pItemNode->m_xNode ) );
2393 m_xNameED->set_text( sName );
2394 }
2395 m_xDefaultED->set_text( m_pItemNode->m_xNode->getNodeValue() );
2396 }
2397 catch( Exception const & )
2398 {
2399 TOOLS_WARN_EXCEPTION( "svx.form", "AddDataItemDialog::InitFromNode()" );
2400 }
2401 }
2402 else if ( m_pItemNode->m_xPropSet.is() )
2403 {
2405 Reference< css::xforms::XModel > xModel( m_xUIHelper, UNO_QUERY );
2406 if ( xModel.is() )
2407 {
2408 try
2409 {
2410 m_xTempBinding = m_xUIHelper->cloneBindingAsGhost( m_pItemNode->m_xPropSet );
2411 Reference < XSet > xBindings = xModel->getBindings();
2412 if ( xBindings.is() )
2413 xBindings->insert( Any( m_xTempBinding ) );
2414 }
2415 catch ( Exception const & )
2416 {
2417 TOOLS_WARN_EXCEPTION( "svx.form", "AddDataItemDialog::InitFromNode()" );
2418 }
2419 }
2420 try
2421 {
2422 Reference< XPropertySetInfo > xInfo = m_pItemNode->m_xPropSet->getPropertySetInfo();
2423 OUString sTemp;
2424 if ( xInfo->hasPropertyByName( PN_BINDING_ID ) )
2425 {
2426 m_pItemNode->m_xPropSet->getPropertyValue( PN_BINDING_ID ) >>= sTemp;
2427 m_xNameED->set_text( sTemp );
2428 m_pItemNode->m_xPropSet->getPropertyValue( PN_BINDING_EXPR ) >>= sTemp;
2429 m_xDefaultED->set_text( sTemp );
2430 }
2431 else if ( xInfo->hasPropertyByName( PN_SUBMISSION_BIND ) )
2432 {
2433 m_pItemNode->m_xPropSet->getPropertyValue( PN_SUBMISSION_ID ) >>= sTemp;
2434 m_xNameED->set_text( sTemp );
2435 }
2436 }
2437 catch( Exception const & )
2438 {
2439 TOOLS_WARN_EXCEPTION( "svx.form", "AddDataItemDialog::InitFromNode()" );
2440 }
2441
2442 m_xDefaultBtn->show();
2443 }
2444
2445 if ( m_xTempBinding.is() )
2446 {
2447 try
2448 {
2449 OUString sTemp;
2450 if ( ( m_xTempBinding->getPropertyValue( PN_REQUIRED_EXPR ) >>= sTemp )
2451 && !sTemp.isEmpty() )
2452 m_xRequiredCB->set_active(true);
2453 if ( ( m_xTempBinding->getPropertyValue( PN_RELEVANT_EXPR ) >>= sTemp )
2454 && !sTemp.isEmpty() )
2455 m_xRelevantCB->set_active(true);
2456 if ( ( m_xTempBinding->getPropertyValue( PN_CONSTRAINT_EXPR ) >>= sTemp )
2457 && !sTemp.isEmpty() )
2458 m_xConstraintCB->set_active(true);
2459 if ( ( m_xTempBinding->getPropertyValue( PN_READONLY_EXPR ) >>= sTemp )
2460 && !sTemp.isEmpty() )
2461 m_xReadonlyCB->set_active(true);
2462 if ( ( m_xTempBinding->getPropertyValue( PN_CALCULATE_EXPR ) >>= sTemp )
2463 && !sTemp.isEmpty() )
2464 m_xCalculateCB->set_active(true);
2465 }
2466 catch (const Exception&)
2467 {
2468 TOOLS_WARN_EXCEPTION( "svx.form", "AddDataItemDialog::InitFromNode()" );
2469 }
2470 }
2471 }
2472
2473 if ( DITText == m_eItemType )
2474 {
2475 m_xSettingsFrame->hide();
2476 m_xNameFT->set_sensitive(false);
2477 m_xNameED->set_sensitive(false);
2478 }
2479 }
2480
2482 {
2483 if ( m_eItemType == DITText )
2484 return;
2485
2486 Reference< css::xforms::XModel > xModel( m_xUIHelper, UNO_QUERY );
2487 if ( !xModel.is() )
2488 return;
2489
2490 try
2491 {
2492 Reference< css::xforms::XDataTypeRepository > xDataTypes =
2493 xModel->getDataTypeRepository();
2494 if ( xDataTypes.is() )
2495 {
2496 const Sequence< OUString > aNameList = xDataTypes->getElementNames();
2497 for ( const OUString& rName : aNameList )
2498 m_xDataTypeLB->append_text(rName);
2499 }
2500
2501 if ( m_xTempBinding.is() )
2502 {
2503 OUString sTemp;
2504 if ( m_xTempBinding->getPropertyValue( PN_BINDING_TYPE ) >>= sTemp )
2505 {
2506 int nPos = m_xDataTypeLB->find_text(sTemp);
2507 if (nPos == -1)
2508 {
2509 m_xDataTypeLB->append_text(sTemp);
2510 nPos = m_xDataTypeLB->get_count() - 1;
2511 }
2512 m_xDataTypeLB->set_active(nPos);
2513 }
2514 }
2515 }
2516 catch ( Exception const & )
2517 {
2518 TOOLS_WARN_EXCEPTION( "svx.form", "AddDataItemDialog::InitDataTypeBox()" );
2519 }
2520 }
2521
2523 {
2524 OUString sText;
2525
2526 switch ( _eType )
2527 {
2528 case DITAttribute :
2529 {
2530 sText = m_sFL_Attribute;
2531 break;
2532 }
2533
2534 case DITBinding :
2535 {
2536 sText = m_sFL_Binding;
2537 m_xDefaultFT->set_label(m_sFT_BindingExp);
2538 break;
2539 }
2540
2541 default:
2542 {
2543 sText = m_sFL_Element;
2544 }
2545 }
2546
2547 m_xItemFrame->set_label(sText);
2548 }
2549
2551 OUString _aPropertyName,
2552 const Reference< XPropertySet >& _rPropSet)
2553 : GenericDialogController(pParent, "svx/ui/addconditiondialog.ui", "AddConditionDialog")
2554 , m_aResultIdle("svx AddConditionDialog m_aResultIdle")
2555 , m_sPropertyName(std::move(_aPropertyName))
2556 , m_xBinding(_rPropSet)
2557 , m_xConditionED(m_xBuilder->weld_text_view("condition"))
2558 , m_xResultWin(m_xBuilder->weld_text_view("result"))
2559 , m_xEditNamespacesBtn(m_xBuilder->weld_button("edit"))
2560 , m_xOKBtn(m_xBuilder->weld_button("ok"))
2561 {
2562 DBG_ASSERT( m_xBinding.is(), "AddConditionDialog::Ctor(): no Binding" );
2563
2564 m_xConditionED->set_size_request(m_xConditionED->get_approximate_digit_width() * 52,
2565 m_xConditionED->get_height_rows(4));
2566 m_xResultWin->set_size_request(m_xResultWin->get_approximate_digit_width() * 52,
2567 m_xResultWin->get_height_rows(4));
2568
2569 m_xConditionED->connect_changed( LINK( this, AddConditionDialog, ModifyHdl ) );
2570 m_xEditNamespacesBtn->connect_clicked( LINK( this, AddConditionDialog, EditHdl ) );
2571 m_xOKBtn->connect_clicked( LINK( this, AddConditionDialog, OKHdl ) );
2572 m_aResultIdle.SetPriority( TaskPriority::LOWEST );
2574
2575 if ( !m_sPropertyName.isEmpty() )
2576 {
2577 try
2578 {
2579 OUString sTemp;
2580 if ( ( m_xBinding->getPropertyValue( m_sPropertyName ) >>= sTemp )
2581 && !sTemp.isEmpty() )
2582 {
2583 m_xConditionED->set_text( sTemp );
2584 }
2585 else
2586 {
2588 m_xConditionED->set_text( TRUE_VALUE );
2589 }
2590
2591 Reference< css::xforms::XModel > xModel;
2592 if ( ( m_xBinding->getPropertyValue( PN_BINDING_MODEL ) >>= xModel ) && xModel.is() )
2593 m_xUIHelper.set( xModel, UNO_QUERY );
2594 }
2595 catch (const Exception&)
2596 {
2597 TOOLS_WARN_EXCEPTION( "svx.form", "AddConditionDialog::Ctor()" );
2598 }
2599 }
2600
2601 DBG_ASSERT( m_xUIHelper.is(), "AddConditionDialog::Ctor(): no UIHelper" );
2602 ResultHdl( &m_aResultIdle );
2603 }
2604
2606 {
2607 }
2608
2610 {
2611 Reference< XNameContainer > xNameContnr;
2612 try
2613 {
2614 m_xBinding->getPropertyValue( PN_BINDING_NAMESPACES ) >>= xNameContnr;
2615 }
2616 catch ( Exception const & )
2617 {
2618 TOOLS_WARN_EXCEPTION( "svx.form", "AddDataItemDialog::EditHdl()" );
2619 }
2620 NamespaceItemDialog aDlg(this, xNameContnr);
2621 aDlg.run();
2622 try
2623 {
2624 m_xBinding->setPropertyValue( PN_BINDING_NAMESPACES, Any( xNameContnr ) );
2625 }
2626 catch ( Exception const & )
2627 {
2628 TOOLS_WARN_EXCEPTION( "svx.form", "AddDataItemDialog::EditHdl()" );
2629 }
2630 }
2631
2633 {
2634 m_xDialog->response(RET_OK);
2635 }
2636
2638 {
2639 m_aResultIdle.Start();
2640 }
2641
2643 {
2644 OUString sCondition = comphelper::string::strip(m_xConditionED->get_text(), ' ');
2645 OUString sResult;
2646 if ( !sCondition.isEmpty() )
2647 {
2648 try
2649 {
2650 sResult = m_xUIHelper->getResultForExpression( m_xBinding, ( m_sPropertyName == PN_BINDING_EXPR ), sCondition );
2651 }
2652 catch ( Exception const & )
2653 {
2654 TOOLS_WARN_EXCEPTION( "svx.form", "AddConditionDialog::ResultHdl()" );
2655 }
2656 }
2657 m_xResultWin->set_text(sResult);
2658 }
2659
2660 NamespaceItemDialog::NamespaceItemDialog(AddConditionDialog* pCondDlg, Reference<XNameContainer>& rContainer)
2661 : GenericDialogController(pCondDlg->getDialog(), "svx/ui/namespacedialog.ui", "NamespaceDialog")
2662 , m_pConditionDlg(pCondDlg)
2663 , m_rNamespaces(rContainer)
2664 , m_xNamespacesList(m_xBuilder->weld_tree_view("namespaces"))
2665 , m_xAddNamespaceBtn(m_xBuilder->weld_button("add"))
2666 , m_xEditNamespaceBtn(m_xBuilder->weld_button("edit"))
2667 , m_xDeleteNamespaceBtn(m_xBuilder->weld_button("delete"))
2668 , m_xOKBtn(m_xBuilder->weld_button("ok"))
2669 {
2670 m_xNamespacesList->set_size_request(m_xNamespacesList->get_approximate_digit_width() * 80,
2671 m_xNamespacesList->get_height_rows(8));
2672
2673 std::vector<int> aWidths
2674 {
2675 o3tl::narrowing<int>(m_xNamespacesList->get_approximate_digit_width() * 20)
2676 };
2677 m_xNamespacesList->set_column_fixed_widths(aWidths);
2678
2679 m_xNamespacesList->connect_changed( LINK( this, NamespaceItemDialog, SelectHdl ) );
2680 Link<weld::Button&,void> aLink = LINK( this, NamespaceItemDialog, ClickHdl );
2681 m_xAddNamespaceBtn->connect_clicked( aLink );
2682 m_xEditNamespaceBtn->connect_clicked( aLink );
2683 m_xDeleteNamespaceBtn->connect_clicked( aLink );
2684 m_xOKBtn->connect_clicked( LINK( this, NamespaceItemDialog, OKHdl ) );
2685
2687 SelectHdl(*m_xNamespacesList);
2688 }
2689
2691 {
2692 }
2693
2695 {
2696 bool bEnable = m_xNamespacesList->get_selected_index() != -1;
2697 m_xEditNamespaceBtn->set_sensitive( bEnable );
2698 m_xDeleteNamespaceBtn->set_sensitive( bEnable );
2699 }
2700
2701 IMPL_LINK( NamespaceItemDialog, ClickHdl, weld::Button&, rButton, void )
2702 {
2703 if (m_xAddNamespaceBtn.get() == &rButton)
2704 {
2705 ManageNamespaceDialog aDlg(m_xDialog.get(), m_pConditionDlg, false);
2706 if (aDlg.run() == RET_OK)
2707 {
2708 m_xNamespacesList->append_text(aDlg.GetPrefix());
2709 int nRow = m_xNamespacesList->n_children();
2710 m_xNamespacesList->set_text(nRow - 1, aDlg.GetURL(), 1);
2711 }
2712 }
2713 else if (m_xEditNamespaceBtn.get() == &rButton)
2714 {
2715 ManageNamespaceDialog aDlg(m_xDialog.get(), m_pConditionDlg, true);
2716 int nEntry = m_xNamespacesList->get_selected_index();
2717 DBG_ASSERT( nEntry != -1, "NamespaceItemDialog::ClickHdl(): no entry" );
2718 OUString sPrefix(m_xNamespacesList->get_text(nEntry, 0));
2719 aDlg.SetNamespace(sPrefix, m_xNamespacesList->get_text(nEntry, 1));
2720 if (aDlg.run() == RET_OK)
2721 {
2722 // if a prefix was changed, mark the old prefix as 'removed'
2723 if( sPrefix != aDlg.GetPrefix() )
2724 m_aRemovedList.push_back( sPrefix );
2725
2726 m_xNamespacesList->set_text(nEntry, aDlg.GetPrefix(), 0);
2727 m_xNamespacesList->set_text(nEntry, aDlg.GetURL(), 1);
2728 }
2729 }
2730 else if (m_xDeleteNamespaceBtn.get() == &rButton)
2731 {
2732 int nEntry = m_xNamespacesList->get_selected_index();
2733 DBG_ASSERT( nEntry != -1, "NamespaceItemDialog::ClickHdl(): no entry" );
2734 OUString sPrefix(m_xNamespacesList->get_text(nEntry, 0));
2735 m_aRemovedList.push_back( sPrefix );
2736 m_xNamespacesList->remove(nEntry);
2737 }
2738 else
2739 {
2740 SAL_WARN( "svx.form", "NamespaceItemDialog::ClickHdl(): invalid button" );
2741 }
2742
2743 SelectHdl(*m_xNamespacesList);
2744 }
2745
2747 {
2748 try
2749 {
2750 // update namespace container
2751 sal_Int32 i, nRemovedCount = m_aRemovedList.size();
2752 for( i = 0; i < nRemovedCount; ++i )
2753 m_rNamespaces->removeByName( m_aRemovedList[i] );
2754
2755 sal_Int32 nEntryCount = m_xNamespacesList->n_children();
2756 for( i = 0; i < nEntryCount; ++i )
2757 {
2758 OUString sPrefix(m_xNamespacesList->get_text(i, 0));
2759 OUString sURL(m_xNamespacesList->get_text(i, 1));
2760
2761 if ( m_rNamespaces->hasByName( sPrefix ) )
2762 m_rNamespaces->replaceByName( sPrefix, Any( sURL ) );
2763 else
2764 m_rNamespaces->insertByName( sPrefix, Any( sURL ) );
2765 }
2766 }
2767 catch ( Exception const & )
2768 {
2769 TOOLS_WARN_EXCEPTION( "svx.form", "NamespaceItemDialog::OKHdl()" );
2770 }
2771 // and close the dialog
2772 m_xDialog->response(RET_OK);
2773 }
2774
2776 {
2777 try
2778 {
2779 int nRow = 0;
2780 const Sequence< OUString > aAllNames = m_rNamespaces->getElementNames();
2781 for ( const OUString& sPrefix : aAllNames )
2782 {
2783 if ( m_rNamespaces->hasByName( sPrefix ) )
2784 {
2785 OUString sURL;
2786 Any aAny = m_rNamespaces->getByName( sPrefix );
2787 if (aAny >>= sURL)
2788 {
2789 m_xNamespacesList->append_text(sPrefix);
2790 m_xNamespacesList->set_text(nRow, sURL, 1);
2791 ++nRow;
2792 }
2793 }
2794 }
2795 }
2796 catch ( Exception const & )
2797 {
2798 TOOLS_WARN_EXCEPTION( "svx.form", "NamespaceItemDialog::LoadNamespaces()" );
2799 }
2800 }
2801
2803 : GenericDialogController(pParent, "svx/ui/addnamespacedialog.ui", "AddNamespaceDialog")
2804 , m_pConditionDlg(pCondDlg)
2805 , m_xPrefixED(m_xBuilder->weld_entry("prefix"))
2806 , m_xUrlED(m_xBuilder->weld_entry("url"))
2807 , m_xOKBtn(m_xBuilder->weld_button("ok"))
2808 , m_xAltTitle(m_xBuilder->weld_label("alttitle"))
2809 {
2810 if (bIsEdit)
2811 m_xDialog->set_title(m_xAltTitle->get_label());
2812
2813 m_xOKBtn->connect_clicked(LINK(this, ManageNamespaceDialog, OKHdl));
2814 }
2815
2817 {
2818 }
2819
2821 {
2822 OUString sPrefix = m_xPrefixED->get_text();
2823
2824 try
2825 {
2826 if (!m_pConditionDlg->GetUIHelper()->isValidPrefixName(sPrefix))
2827 {
2828 std::unique_ptr<weld::MessageDialog> xErrBox(Application::CreateMessageDialog(m_xDialog.get(),
2829 VclMessageType::Warning, VclButtonsType::Ok,
2830 SvxResId(RID_STR_INVALID_XMLPREFIX)));
2831 xErrBox->set_primary_text(xErrBox->get_primary_text().replaceFirst(MSG_VARIABLE, sPrefix));
2832 xErrBox->run();
2833 return;
2834 }
2835 }
2836 catch ( Exception const & )
2837 {
2838 TOOLS_WARN_EXCEPTION( "svx.form", "ManageNamespacesDialog::OKHdl()" );
2839 }
2840
2841 // no error so close the dialog
2842 m_xDialog->response(RET_OK);
2843 }
2844
2846 weld::Window* pParent, ItemNode* _pNode,
2847 const Reference< css::xforms::XFormsUIHelper1 >& _rUIHelper)
2848 : GenericDialogController(pParent, "svx/ui/addsubmissiondialog.ui", "AddSubmissionDialog")
2849 , m_pItemNode(_pNode)
2850 , m_xUIHelper(_rUIHelper)
2851 , m_xNameED(m_xBuilder->weld_entry("name"))
2852 , m_xActionED(m_xBuilder->weld_entry("action"))
2853 , m_xMethodLB(m_xBuilder->weld_combo_box("method"))
2854 , m_xRefED(m_xBuilder->weld_entry("expression"))
2855 , m_xRefBtn(m_xBuilder->weld_button("browse"))
2856 , m_xBindLB(m_xBuilder->weld_combo_box("binding"))
2857 , m_xReplaceLB(m_xBuilder->weld_combo_box("replace"))
2858 , m_xOKBtn(m_xBuilder->weld_button("ok"))
2859 {
2860 FillAllBoxes();
2861
2862 m_xRefBtn->connect_clicked( LINK( this, AddSubmissionDialog, RefHdl ) );
2863 m_xOKBtn->connect_clicked( LINK( this, AddSubmissionDialog, OKHdl ) );
2864 }
2865
2867 {
2868 // #i38991# if we have added a binding, we need to remove it as well.
2869 if( m_xCreatedBinding.is() && m_xUIHelper.is() )
2870 m_xUIHelper->removeBindingIfUseless( m_xCreatedBinding );
2871 }
2872
2874 {
2875 AddConditionDialog aDlg(m_xDialog.get(), PN_BINDING_EXPR, m_xTempBinding );
2876 aDlg.SetCondition( m_xRefED->get_text() );
2877 if ( aDlg.run() == RET_OK )
2878 m_xRefED->set_text(aDlg.GetCondition());
2879 }
2880
2882 {
2883 OUString sName(m_xNameED->get_text());
2884 if(sName.isEmpty())
2885 {
2886 std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(m_xDialog.get(),
2887 VclMessageType::Warning, VclButtonsType::Ok,
2888 SvxResId(RID_STR_EMPTY_SUBMISSIONNAME)));
2889 xErrorBox->run();
2890 return;
2891 }
2892
2893 if ( !m_xSubmission.is() )
2894 {
2895 DBG_ASSERT( !m_xNewSubmission.is(),
2896 "AddSubmissionDialog::OKHdl(): new submission already exists" );
2897
2898 // add a new submission
2899 Reference< css::xforms::XModel > xModel( m_xUIHelper, UNO_QUERY );
2900 if ( xModel.is() )
2901 {
2902 try
2903 {
2904 m_xNewSubmission = xModel->createSubmission();
2905 m_xSubmission = m_xNewSubmission;
2906 }
2907 catch ( Exception const & )
2908 {
2909 TOOLS_WARN_EXCEPTION( "svx.form", "AddSubmissionDialog::OKHdl()" );
2910 }
2911 }
2912 }
2913
2914 if ( m_xSubmission.is() )
2915 {
2916 OUString sTemp = m_xNameED->get_text();
2917 try
2918 {
2919 m_xSubmission->setPropertyValue( PN_SUBMISSION_ID, Any( sTemp ) );
2920 sTemp = m_xActionED->get_text();
2921 m_xSubmission->setPropertyValue( PN_SUBMISSION_ACTION, Any( sTemp ) );
2922 sTemp = m_aMethodString.toAPI( m_xMethodLB->get_active_text() );
2923 m_xSubmission->setPropertyValue( PN_SUBMISSION_METHOD, Any( sTemp ) );
2924 sTemp = m_xRefED->get_text();
2925 m_xSubmission->setPropertyValue( PN_SUBMISSION_REF, Any( sTemp ) );
2926 OUString sEntry = m_xBindLB->get_active_text();
2927 sal_Int32 nColonIdx = sEntry.indexOf(':');
2928 if (nColonIdx != -1)
2929 sEntry = sEntry.copy(0, nColonIdx);
2930 sTemp = sEntry;
2931 m_xSubmission->setPropertyValue( PN_SUBMISSION_BIND, Any( sTemp ) );
2932 sTemp = m_aReplaceString.toAPI( m_xReplaceLB->get_active_text() );
2933 m_xSubmission->setPropertyValue( PN_SUBMISSION_REPLACE, Any( sTemp ) );
2934 }
2935 catch ( Exception const & )
2936 {
2937 TOOLS_WARN_EXCEPTION( "svx.form", "AddSubmissionDialog::OKHdl()" );
2938 }
2939 }
2940
2941 m_xDialog->response(RET_OK);
2942 }
2943
2945 {
2946 // method box
2947 m_xMethodLB->append_text(SvxResId(RID_STR_METHOD_POST));
2948 m_xMethodLB->append_text(SvxResId(RID_STR_METHOD_PUT));
2949 m_xMethodLB->append_text(SvxResId(RID_STR_METHOD_GET));
2950 m_xMethodLB->set_active(0);
2951
2952 // binding box
2953 Reference< css::xforms::XModel > xModel( m_xUIHelper, UNO_QUERY );
2954 if ( xModel.is() )
2955 {
2956 try
2957 {
2958 Reference< XEnumerationAccess > xNumAccess = xModel->getBindings();
2959 if ( xNumAccess.is() )
2960 {
2961 Reference < XEnumeration > xNum = xNumAccess->createEnumeration();
2962 if ( xNum.is() && xNum->hasMoreElements() )
2963 {
2964 while ( xNum->hasMoreElements() )
2965 {
2966 Reference< XPropertySet > xPropSet;
2967 Any aAny = xNum->nextElement();
2968 if ( aAny >>= xPropSet )
2969 {
2970 OUString sEntry;
2971 OUString sTemp;
2972 xPropSet->getPropertyValue( PN_BINDING_ID ) >>= sTemp;
2973 sEntry += sTemp + ": ";
2974 xPropSet->getPropertyValue( PN_BINDING_EXPR ) >>= sTemp;
2975 sEntry += sTemp;
2976 m_xBindLB->append_text(sEntry);
2977
2978 if ( !m_xTempBinding.is() )
2979 m_xTempBinding = xPropSet;
2980 }
2981 }
2982 }
2983 }
2984 }
2985 catch ( Exception const & )
2986 {
2987 TOOLS_WARN_EXCEPTION( "svx.form", "AddSubmissionDialog::FillAllBoxes()" );
2988 }
2989 }
2990
2991 // #i36342# we need a temporary binding; create one if no existing binding
2992 // is found
2993 if( !m_xTempBinding.is() )
2994 {
2995 m_xCreatedBinding = m_xUIHelper->getBindingForNode(
2996 Reference<css::xml::dom::XNode>(
2997 xModel->getDefaultInstance()->getDocumentElement(),
2998 UNO_QUERY_THROW ),
2999 true );
3001 }
3002
3003 // replace box
3004 m_xReplaceLB->append_text(SvxResId(RID_STR_REPLACE_NONE));
3005 m_xReplaceLB->append_text(SvxResId(RID_STR_REPLACE_INST));
3006 m_xReplaceLB->append_text(SvxResId(RID_STR_REPLACE_DOC));
3007
3008
3009 // init the controls with the values of the submission
3010 if ( m_pItemNode && m_pItemNode->m_xPropSet.is() )
3011 {
3013 try
3014 {
3015 OUString sTemp;
3016 m_xSubmission->getPropertyValue( PN_SUBMISSION_ID ) >>= sTemp;
3017 m_xNameED->set_text( sTemp );
3018 m_xSubmission->getPropertyValue( PN_SUBMISSION_ACTION ) >>= sTemp;
3019 m_xActionED->set_text( sTemp );
3020 m_xSubmission->getPropertyValue( PN_SUBMISSION_REF ) >>= sTemp;
3021 m_xRefED->set_text(sTemp);
3022
3023 m_xSubmission->getPropertyValue( PN_SUBMISSION_METHOD ) >>= sTemp;
3024 sTemp = m_aMethodString.toUI( sTemp );
3025 sal_Int32 nPos = m_xMethodLB->find_text( sTemp );
3026 if (nPos == -1)
3027 {
3028 m_xMethodLB->append_text( sTemp );
3029 nPos = m_xMethodLB->get_count() - 1;
3030 }
3031 m_xMethodLB->set_active( nPos );
3032
3033 m_xSubmission->getPropertyValue( PN_SUBMISSION_BIND ) >>= sTemp;
3034 nPos = m_xBindLB->find_text(sTemp);
3035 if (nPos == -1)
3036 {
3037 m_xBindLB->append_text(sTemp);
3038 nPos = m_xBindLB->get_count() - 1;
3039 }
3040 m_xBindLB->set_active(nPos);
3041
3042 m_xSubmission->getPropertyValue( PN_SUBMISSION_REPLACE ) >>= sTemp;
3043 sTemp = m_aReplaceString.toUI( sTemp );
3044 if ( sTemp.isEmpty() )
3045 sTemp = m_xReplaceLB->get_text(0); // first entry == "none"
3046 nPos = m_xReplaceLB->find_text(sTemp);
3047 if (nPos == -1)
3048 {
3049 m_xReplaceLB->append_text(sTemp);
3050 nPos = m_xReplaceLB->get_count() - 1;
3051 }
3052 m_xReplaceLB->set_active(nPos);
3053 }
3054 catch ( Exception const & )
3055 {
3056 TOOLS_WARN_EXCEPTION( "svx.form", "AddSubmissionDialog::FillAllBoxes()" );
3057 }
3058 }
3059
3060 m_xRefBtn->set_sensitive(m_xTempBinding.is());
3061 }
3062
3064 : GenericDialogController(pParent, "svx/ui/addmodeldialog.ui", "AddModelDialog")
3065 , m_xNameED(m_xBuilder->weld_entry("name"))
3066 , m_xModifyCB(m_xBuilder->weld_check_button("modify"))
3067 , m_xAltTitle(m_xBuilder->weld_label("alttitle"))
3068 {
3069 if (bIsEdit)
3070 m_xDialog->set_title(m_xAltTitle->get_label());
3071 }
3072
3074 {
3075 }
3076
3078 : GenericDialogController(pParent, "svx/ui/addinstancedialog.ui", "AddInstanceDialog")
3079 , m_xNameED(m_xBuilder->weld_entry("name"))
3080 , m_xURLED(new SvtURLBox(m_xBuilder->weld_combo_box("url")))
3081 , m_xFilePickerBtn(m_xBuilder->weld_button("browse"))
3082 , m_xLinkInstanceCB(m_xBuilder->weld_check_button("link"))
3083 , m_xAltTitle(m_xBuilder->weld_label("alttitle"))
3084 {
3085 if (_bEdit)
3086 m_xDialog->set_title(m_xAltTitle->get_label());
3087
3088 m_xURLED->DisableHistory();
3089 m_xFilePickerBtn->connect_clicked(LINK(this, AddInstanceDialog, FilePickerHdl));
3090
3091 // load the filter name from fps resource
3092 m_sAllFilterName = Translate::get(STR_FILTERNAME_ALL, Translate::Create("fps"));
3093 }
3094
3096 {
3097 }
3098
3100 {
3102 css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE,
3103 FileDialogFlags::NONE, m_xDialog.get());
3105
3106 aDlg.AddFilter( m_sAllFilterName, FILEDIALOG_FILTER_ALL );
3107 OUString sFilterName( "XML" );
3108 aDlg.AddFilter( sFilterName, "*.xml" );
3109 aDlg.SetCurrentFilter( sFilterName );
3110
3111 if (aDlg.Execute() == ERRCODE_NONE)
3112 m_xURLED->set_entry_text(aDlg.GetPath());
3113 }
3114
3116 : MessageDialogController(pParent, "svx/ui/formlinkwarndialog.ui",
3117 "FormLinkWarnDialog")
3118 {
3119 }
3120
3121}
3122
3123/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
PropertiesInfo aProperties
constexpr OUStringLiteral sModel
Reference< XExecutableDialog > m_xDialog
sal_uInt16 nPageId
SfxChildAlignment
static std::unique_ptr< weld::Builder > CreateBuilder(weld::Widget *pParent, const OUString &rUIFile, bool bMobile=false, sal_uInt64 nLOKWindowId=0)
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
std::unique_ptr< weld::Container > m_xContainer
SfxDispatcher * GetDispatcher() const
virtual void dispose()
SfxViewFrame * GetFrame() const
void Initialize(SfxChildWinInfo *pInfo)
void SetAlignment(SfxChildAlignment eAlign)
void SetFloatingSize(const Size &rSize)
virtual Size CalcDockingSize(SfxChildAlignment)
virtual void dispose() override
const css::uno::Reference< css::frame::XFrame > & GetFrameInterface() const
bool IsEnableSetModified() const
bool IsModified() const
static SAL_WARN_UNUSED_RESULT SfxObjectShell * Current()
virtual void SetModified(bool bModified=true)
SfxFrame & GetFrame() const
void SetPageID(const OUString &rID)
css::uno::Any GetUserItem(const OUString &sName) const
void SetUserItem(const OUString &sName, const css::uno::Any &aValue)
OUString GetPageID() const
bool Exists() const
void SetPriority(TaskPriority ePriority)
void SetTimeout(sal_uInt64 nTimeoutMs)
void SetInvokeHandler(const Link< Timer *, void > &rLink)
virtual void Start(bool bStartTimer=true) override
const_iterator find(const Value &x) const
const_iterator end() const
OUString GetPath() const
void AddFilter(const OUString &rFilterName, const OUString &rExtension)
void SetCurrentFilter(const OUString &rFilter)
void SetContext(Context _eNewContext)
std::unique_ptr< weld::TextView > m_xConditionED
Definition: datanavi.hxx:416
AddConditionDialog(weld::Window *pParent, OUString _aPropertyName, const css::uno::Reference< css::beans::XPropertySet > &_rBinding)
Definition: datanavi.cxx:2550
OUString GetCondition() const
Definition: datanavi.hxx:432
css::uno::Reference< css::xforms::XFormsUIHelper1 > m_xUIHelper
Definition: datanavi.hxx:412
std::unique_ptr< weld::Button > m_xOKBtn
Definition: datanavi.hxx:419
std::unique_ptr< weld::TextView > m_xResultWin
Definition: datanavi.hxx:417
std::unique_ptr< weld::Button > m_xEditNamespacesBtn
Definition: datanavi.hxx:418
css::uno::Reference< css::beans::XPropertySet > m_xBinding
Definition: datanavi.hxx:414
virtual ~AddConditionDialog() override
Definition: datanavi.cxx:2605
void SetCondition(const OUString &_rCondition)
Definition: datanavi.hxx:433
std::unique_ptr< weld::Button > m_xRelevantBtn
Definition: datanavi.hxx:378
css::uno::Reference< css::beans::XPropertySet > m_xBinding
Definition: datanavi.hxx:356
std::unique_ptr< weld::Widget > m_xSettingsFrame
Definition: datanavi.hxx:373
css::uno::Reference< css::xforms::XFormsUIHelper1 > m_xUIHelper
Definition: datanavi.hxx:354
std::unique_ptr< weld::ComboBox > m_xDataTypeLB
Definition: datanavi.hxx:374
std::unique_ptr< weld::Button > m_xCalculateBtn
Definition: datanavi.hxx:384
std::unique_ptr< weld::CheckButton > m_xReadonlyCB
Definition: datanavi.hxx:381
css::uno::Reference< css::beans::XPropertySet > m_xTempBinding
Definition: datanavi.hxx:358
std::unique_ptr< weld::Button > m_xOKBtn
Definition: datanavi.hxx:385
std::unique_ptr< weld::Button > m_xConstraintBtn
Definition: datanavi.hxx:380
std::unique_ptr< weld::Button > m_xRequiredBtn
Definition: datanavi.hxx:376
std::unique_ptr< weld::Entry > m_xDefaultED
Definition: datanavi.hxx:371
std::unique_ptr< weld::CheckButton > m_xCalculateCB
Definition: datanavi.hxx:383
void InitText(DataItemType _eType)
Definition: datanavi.cxx:2522
void Check(const weld::Toggleable *pBox)
Definition: datanavi.cxx:2153
std::unique_ptr< weld::Label > m_xNameFT
Definition: datanavi.hxx:368
AddDataItemDialog(weld::Window *pParent, ItemNode *_pNode, const css::uno::Reference< css::xforms::XFormsUIHelper1 > &_rUIHelper)
Definition: datanavi.cxx:2086
std::unique_ptr< weld::CheckButton > m_xRequiredCB
Definition: datanavi.hxx:375
std::unique_ptr< weld::Button > m_xDefaultBtn
Definition: datanavi.hxx:372
std::unique_ptr< weld::Frame > m_xItemFrame
Definition: datanavi.hxx:367
std::unique_ptr< weld::Label > m_xDefaultFT
Definition: datanavi.hxx:370
std::unique_ptr< weld::Button > m_xReadonlyBtn
Definition: datanavi.hxx:382
std::unique_ptr< weld::CheckButton > m_xConstraintCB
Definition: datanavi.hxx:379
std::unique_ptr< weld::Entry > m_xNameED
Definition: datanavi.hxx:369
virtual ~AddDataItemDialog() override
Definition: datanavi.cxx:2122
std::unique_ptr< weld::CheckButton > m_xRelevantCB
Definition: datanavi.hxx:377
void SetName(const OUString &rName)
Definition: datanavi.hxx:568
std::unique_ptr< SvtURLBox > m_xURLED
Definition: datanavi.hxx:556
void SetLinkInstance(bool bLink)
Definition: datanavi.hxx:572
void SetURL(const OUString &rURL)
Definition: datanavi.hxx:570
std::unique_ptr< weld::Button > m_xFilePickerBtn
Definition: datanavi.hxx:557
virtual ~AddInstanceDialog() override
Definition: datanavi.cxx:3095
OUString GetURL() const
Definition: datanavi.hxx:569
std::unique_ptr< weld::Label > m_xAltTitle
Definition: datanavi.hxx:559
bool IsLinkInstance() const
Definition: datanavi.hxx:571
AddInstanceDialog(weld::Window *pParent, bool _bEdit)
Definition: datanavi.cxx:3077
OUString GetName() const
Definition: datanavi.hxx:567
void SetModifyDoc(const bool bModify)
Definition: datanavi.hxx:547
AddModelDialog(weld::Window *pParent, bool _bEdit)
Definition: datanavi.cxx:3063
virtual ~AddModelDialog() override
Definition: datanavi.cxx:3073
bool GetModifyDoc() const
Definition: datanavi.hxx:546
std::unique_ptr< weld::Label > m_xAltTitle
Definition: datanavi.hxx:537
OUString GetName() const
Definition: datanavi.hxx:543
void SetName(const OUString &_rName)
Definition: datanavi.hxx:544
std::unique_ptr< weld::Button > m_xRefBtn
Definition: datanavi.hxx:514
std::unique_ptr< weld::ComboBox > m_xMethodLB
Definition: datanavi.hxx:512
const css::uno::Reference< css::xforms::XSubmission > & GetNewSubmission() const
Definition: datanavi.hxx:529
ReplaceString m_aReplaceString
Definition: datanavi.hxx:495
css::uno::Reference< css::xforms::XFormsUIHelper1 > m_xUIHelper
Definition: datanavi.hxx:500
std::unique_ptr< weld::Entry > m_xActionED
Definition: datanavi.hxx:511
std::unique_ptr< weld::ComboBox > m_xBindLB
Definition: datanavi.hxx:515
css::uno::Reference< css::beans::XPropertySet > m_xCreatedBinding
Definition: datanavi.hxx:508
std::unique_ptr< weld::ComboBox > m_xReplaceLB
Definition: datanavi.hxx:516
css::uno::Reference< css::beans::XPropertySet > m_xTempBinding
Definition: datanavi.hxx:506
AddSubmissionDialog(weld::Window *pParent, ItemNode *pNode, const css::uno::Reference< css::xforms::XFormsUIHelper1 > &rUIHelper)
Definition: datanavi.cxx:2845
std::unique_ptr< weld::Entry > m_xNameED
Definition: datanavi.hxx:510
std::unique_ptr< weld::Entry > m_xRefED
Definition: datanavi.hxx:513
virtual ~AddSubmissionDialog() override
Definition: datanavi.cxx:2866
css::uno::Reference< css::beans::XPropertySet > m_xSubmission
Definition: datanavi.hxx:504
std::unique_ptr< weld::Button > m_xOKBtn
Definition: datanavi.hxx:517
weld::Window * GetFrameWeld() const
Definition: datanavi.hxx:317
DataNavigatorWindow(vcl::Window *pParent, weld::Builder &rBuilder, SfxBindings const *pBindings)
Definition: datanavi.cxx:1287
void NotifyChanges(bool _bLoadAll=false)
Definition: datanavi.cxx:1967
void CreateInstancePage(const css::uno::Sequence< css::beans::PropertyValue > &_xPropSeq)
Definition: datanavi.cxx:1918
std::unique_ptr< weld::MenuButton > m_xModelBtn
Definition: datanavi.hxx:261
void DisableNotify(bool _bDisable)
Definition: datanavi.hxx:320
css::uno::Reference< css::frame::XFrame > m_xFrame
Definition: datanavi.hxx:285
static bool IsAdditionalPage(std::u16string_view rIdent)
Definition: datanavi.cxx:1674
XFormsPage * GetPage(const OUString &rCurId)
Definition: datanavi.cxx:1715
std::unique_ptr< XFormsPage > m_xSubmissionPage
Definition: datanavi.hxx:266
std::unique_ptr< weld::ComboBox > m_xModelsBox
Definition: datanavi.hxx:260
void ClearAllPageModels(bool bClearPages)
Definition: datanavi.cxx:1894
std::unique_ptr< weld::Notebook > m_xTabCtrl
Definition: datanavi.hxx:262
std::vector< std::unique_ptr< XFormsPage > > m_aPageList
Definition: datanavi.hxx:273
css::uno::Reference< css::frame::XModel > m_xFrameModel
Definition: datanavi.hxx:287
void ModelSelectHdl(const weld::ComboBox *)
Definition: datanavi.cxx:1371
std::unique_ptr< XFormsPage > m_xBindingPage
Definition: datanavi.hxx:267
void SetPageModel(const OUString &rCurId)
Definition: datanavi.cxx:1811
std::vector< css::uno::Reference< css::xml::dom::events::XEventTarget > > m_aEventTargetList
Definition: datanavi.hxx:277
::rtl::Reference< DataListener > m_xDataListener
Definition: datanavi.hxx:281
void AddContainerBroadcaster(const css::uno::Reference< css::container::XContainer > &xContainer)
Definition: datanavi.cxx:1987
css::uno::Reference< css::container::XNameContainer > m_xDataContainer
Definition: datanavi.hxx:283
void AddEventBroadcaster(const css::uno::Reference< css::xml::dom::events::XEventTarget > &xTarget)
Definition: datanavi.cxx:1995
std::unique_ptr< XFormsPage > m_xInstPage
Definition: datanavi.hxx:265
OUString GetNewPageId() const
Definition: datanavi.cxx:1940
std::vector< css::uno::Reference< css::container::XContainer > > m_aContainerList
Definition: datanavi.hxx:275
bool HasFirstInstancePage() const
Definition: datanavi.cxx:1935
std::unique_ptr< weld::MenuButton > m_xInstanceBtn
Definition: datanavi.hxx:263
OUString GetCurrentPage() const
Definition: datanavi.cxx:1752
virtual Size CalcDockingSize(SfxChildAlignment) override
Definition: datanavi.cxx:2050
void StateChangedAtToolBoxControl(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem *pState) override
Definition: datanavi.cxx:2046
virtual void dispose() override
Definition: datanavi.cxx:2039
virtual ~DataNavigator() override
Definition: datanavi.cxx:2034
std::unique_ptr< DataNavigatorWindow > m_xDataWin
Definition: datanavi.hxx:326
DataNavigator(SfxBindings *pBindings, SfxChildWindow *pMgr, vcl::Window *pParent)
Definition: datanavi.cxx:2022
virtual SfxChildAlignment CheckAlignment(SfxChildAlignment, SfxChildAlignment) override
Definition: datanavi.cxx:2058
DataTreeDropTarget(weld::TreeView &rWidget)
Definition: datanavi.cxx:121
virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent &rEvt) override
Definition: datanavi.cxx:131
virtual sal_Int8 AcceptDrop(const AcceptDropEvent &rEvt) override
Definition: datanavi.cxx:126
LinkedInstanceWarningBox(weld::Widget *pParent)
Definition: datanavi.cxx:3115
OUString GetPrefix() const
Definition: datanavi.hxx:487
ManageNamespaceDialog(weld::Window *pParent, AddConditionDialog *_pCondDlg, bool bIsEdit)
Definition: datanavi.cxx:2802
virtual ~ManageNamespaceDialog() override
Definition: datanavi.cxx:2816
void SetNamespace(const OUString &_rPrefix, const OUString &_rURL)
Definition: datanavi.hxx:482
std::unique_ptr< weld::Button > m_xOKBtn
Definition: datanavi.hxx:473
std::unique_ptr< weld::Label > m_xAltTitle
Definition: datanavi.hxx:474
OUString const & toUI(std::u16string_view rStr) const
convert from API to UI; put is default.
Definition: datanavi.hxx:148
std::unique_ptr< weld::TreeView > m_xNamespacesList
Definition: datanavi.hxx:449
virtual ~NamespaceItemDialog() override
Definition: datanavi.cxx:2690
std::unique_ptr< weld::Button > m_xOKBtn
Definition: datanavi.hxx:453
std::unique_ptr< weld::Button > m_xAddNamespaceBtn
Definition: datanavi.hxx:450
std::unique_ptr< weld::Button > m_xEditNamespaceBtn
Definition: datanavi.hxx:451
css::uno::Reference< css::container::XNameContainer > & m_rNamespaces
Definition: datanavi.hxx:447
std::unique_ptr< weld::Button > m_xDeleteNamespaceBtn
Definition: datanavi.hxx:452
NamespaceItemDialog(AddConditionDialog *pParent, css::uno::Reference< css::container::XNameContainer > &_rContainer)
Definition: datanavi.cxx:2660
OUString const & toUI(std::u16string_view rStr) const
convert submission replace string from API value to UI value.
Definition: datanavi.hxx:103
OUString LoadInstance(const css::uno::Sequence< css::beans::PropertyValue > &_xPropSeq)
Definition: datanavi.cxx:1140
std::unique_ptr< weld::Toolbar > m_xToolBox
Definition: datanavi.hxx:187
std::unique_ptr< weld::Menu > m_xMenu
Definition: datanavi.hxx:188
void AddEntry(std::unique_ptr< ItemNode > _pNewNode, bool _bIsElement, weld::TreeIter *pRet=nullptr)
Definition: datanavi.cxx:706
void SetInstanceName(const OUString &name)
Definition: datanavi.hxx:245
OUString SetModel(const css::uno::Reference< css::xforms::XModel > &_xModel, int _nPagePos)
Definition: datanavi.cxx:990
css::uno::Reference< css::xforms::XFormsUIHelper1 > m_xUIHelper
Definition: datanavi.hxx:197
void AddChildren(const weld::TreeIter *_pParent, const css::uno::Reference< css::xml::dom::XNode > &_xNode)
Definition: datanavi.cxx:329
DataNavigatorWindow * m_pNaviWin
Definition: datanavi.hxx:199
std::unique_ptr< weld::TreeView > m_xItemList
Definition: datanavi.hxx:189
void SetLinkOnce(bool bLinkOnce)
Definition: datanavi.hxx:247
const OUString & GetInstanceName() const
Definition: datanavi.hxx:242
o3tl::sorted_vector< OUString > m_aRemovedMenuEntries
Definition: datanavi.hxx:192
void EditEntry(const css::uno::Reference< css::beans::XPropertySet > &_rPropSet)
Definition: datanavi.cxx:806
OUString GetServiceNameForNode(const css::uno::Reference< css::xml::dom::XNode > &xNode)
Definition: datanavi.hxx:251
ReplaceString m_aReplaceString
Definition: datanavi.hxx:184
XFormsPage(weld::Container *pParent, DataNavigatorWindow *_pNaviWin, DataGroupType _eGroup)
Definition: datanavi.cxx:201
css::uno::Reference< css::beans::XPropertySet > GetBindingForNode(const css::uno::Reference< css::xml::dom::XNode > &xNode)
Definition: datanavi.hxx:250
bool DoMenuAction(std::u16string_view rMenuID)
Definition: datanavi.cxx:1182
bool HasModel() const
Definition: datanavi.hxx:233
bool GetLinkOnce() const
Definition: datanavi.hxx:244
DataGroupType m_eGroup
Definition: datanavi.hxx:201
weld::Container * m_pParent
Definition: datanavi.hxx:186
OUString m_sInstanceURL
Definition: datanavi.hxx:207
virtual ~XFormsPage() override
Definition: datanavi.cxx:244
void SetMenuEntrySensitive(const OUString &rIdent, bool bSensitive)
Definition: datanavi.cxx:1187
void SetInstanceURL(const OUString &url)
Definition: datanavi.hxx:246
const css::uno::Reference< css::xforms::XFormsUIHelper1 > & GetXFormsHelper() const
Definition: datanavi.hxx:253
MethodString m_aMethodString
Definition: datanavi.hxx:183
const OUString & GetInstanceURL() const
Definition: datanavi.hxx:243
OUString m_sInstanceName
Definition: datanavi.hxx:206
void DeleteAndClearTree()
Definition: datanavi.cxx:183
std::unique_ptr< weld::TreeIter > m_xScratchIter
Definition: datanavi.hxx:190
bool DoToolBoxAction(std::u16string_view rToolBoxID)
Definition: datanavi.cxx:400
virtual void move(weld::Widget *pWidget, weld::Container *pNewParent)=0
virtual short run()
void set_title(const OUString &rTitle)
std::shared_ptr< weld::Dialog > m_xDialog
virtual bool get_active() const=0
int nCount
constexpr OUStringLiteral MODELNAME
Definition: datanavi.cxx:65
constexpr OUStringLiteral INSTANCENAME
Definition: datanavi.cxx:66
constexpr OUStringLiteral SUBMISSIONNAME
Definition: datanavi.cxx:69
#define MIN_PAGE_COUNT
Definition: datanavi.cxx:108
constexpr OUStringLiteral ATTRIBUTENAME
Definition: datanavi.cxx:68
constexpr OUStringLiteral CFGNAME_SHOWDETAILS
Definition: datanavi.cxx:63
constexpr OUStringLiteral BINDINGNAME
Definition: datanavi.cxx:70
constexpr OUStringLiteral ELEMENTNAME
Definition: datanavi.cxx:67
constexpr OUStringLiteral MSG_VARIABLE
Definition: datanavi.cxx:64
constexpr OUStringLiteral CFGNAME_DATANAVIGATOR
Definition: datanavi.cxx:62
#define DBG_ASSERT(sCon, aError)
#define TOOLS_WARN_EXCEPTION(area, stream)
#define DBG_UNHANDLED_EXCEPTION(...)
OUString SvxResId(TranslateId aId)
Definition: dialmgr.cxx:24
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
virtual void SetText(const OUString &rStr) override
float u
#define ERRCODE_NONE
Reference< XInterface > xTarget
DocumentType eType
constexpr OUStringLiteral FM_COMPONENT_COMMANDBUTTON
Definition: fmservs.hxx:36
OUString sName
constexpr OUStringLiteral FILEDIALOG_FILTER_ALL
OUString sPrefix
constexpr sal_uInt16 KEY_DELETE
sal_uInt16 nPos
#define SAL_WARN(area, stream)
std::locale Create(std::string_view aPrefixName, const LanguageTag &rLocale)
OUString get(TranslateId sContextAndId, const std::locale &loc)
@ Exception
OString strip(const OString &rIn, char c)
int i
constexpr bool starts_with(std::basic_string_view< charT, traits > sv, std::basic_string_view< charT, traits > x) noexcept
class FmSearchEngine - Impl class for FmSearchDialog
constexpr OUStringLiteral PN_CONSTRAINT_EXPR
Definition: datanavi.cxx:89
constexpr OUStringLiteral PN_RELEVANT_EXPR
Definition: datanavi.cxx:87
constexpr OUStringLiteral PN_SUBMISSION_ACTION
Definition: datanavi.cxx:97
DataItemType
Definition: datanavi.hxx:68
@ DITAttribute
Definition: datanavi.hxx:71
@ DITElement
Definition: datanavi.hxx:72
@ DITNone
Definition: datanavi.hxx:69
@ DITBinding
Definition: datanavi.hxx:73
@ DITText
Definition: datanavi.hxx:70
constexpr OUStringLiteral PN_REQUIRED_EXPR
Definition: datanavi.cxx:88
constexpr OUStringLiteral PN_SUBMISSION_BIND
Definition: datanavi.cxx:95
constexpr OUStringLiteral PN_INSTANCE_MODEL
Definition: datanavi.cxx:77
constexpr OUStringLiteral NEW_ELEMENT
Definition: datanavi.cxx:103
constexpr OUStringLiteral TRUE_VALUE
Definition: datanavi.cxx:102
IMPL_LINK_NOARG(XFormsPage, ItemSelectHdl, weld::TreeView &, void)
Definition: datanavi.cxx:256
constexpr OUStringLiteral PN_SUBMISSION_ID
Definition: datanavi.cxx:94
constexpr OUStringLiteral PN_BINDING_MODEL
Definition: datanavi.cxx:84
constexpr OUStringLiteral PN_SUBMISSION_REPLACE
Definition: datanavi.cxx:99
constexpr OUStringLiteral PN_BINDING_TYPE
Definition: datanavi.cxx:91
constexpr OUStringLiteral NEW_ATTRIBUTE
Definition: datanavi.cxx:104
constexpr OUStringLiteral EVENTTYPE_ATTR
Definition: datanavi.cxx:106
constexpr OUStringLiteral PN_BINDING_EXPR
Definition: datanavi.cxx:83
constexpr OUStringLiteral EVENTTYPE_CHARDATA
Definition: datanavi.cxx:105
constexpr OUStringLiteral PN_READONLY_EXPR
Definition: datanavi.cxx:86
constexpr OUStringLiteral PN_BINDING_ID
Definition: datanavi.cxx:82
constexpr OUStringLiteral PN_INSTANCE_ID
Definition: datanavi.cxx:78
constexpr OUStringLiteral PN_SUBMISSION_METHOD
Definition: datanavi.cxx:98
IMPL_LINK(XFormsPage, PopupMenuHdl, const CommandEvent &, rCEvt, bool)
Definition: datanavi.cxx:136
constexpr OUStringLiteral PN_INSTANCE_URL
Definition: datanavi.cxx:79
DataGroupType
Definition: datanavi.hxx:60
@ DGTSubmission
Definition: datanavi.hxx:63
@ DGTBinding
Definition: datanavi.hxx:64
@ DGTInstance
Definition: datanavi.hxx:62
constexpr OUStringLiteral PN_SUBMISSION_REF
Definition: datanavi.cxx:96
constexpr OUStringLiteral PN_BINDING_NAMESPACES
Definition: datanavi.cxx:85
static void copyPropSet(const Reference< XPropertySet > &xFrom, Reference< XPropertySet > const &xTo)
Definition: datanavi.cxx:2229
constexpr OUStringLiteral PN_CALCULATE_EXPR
Definition: datanavi.cxx:90
OUString toId(const void *pValue)
SFX_IMPL_DOCKINGWINDOW(SwNavigatorWrapper, SID_NAVIGATOR)
SfxItemState
Reference< css::xml::dom::XNode > m_xNode
Definition: datanavi.cxx:112
Reference< XPropertySet > m_xPropSet
Definition: datanavi.cxx:113
ItemNode(const Reference< css::xml::dom::XNode > &_rxNode)
Definition: datanavi.cxx:115
ItemNode(const Reference< XPropertySet > &_rxSet)
Definition: datanavi.cxx:117
Reference< XModel > xModel
#define DND_ACTION_COPY
#define DND_ACTION_NONE
signed char sal_Int8
OUString sId
RET_OK
RET_YES