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