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