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