LibreOffice Module cui (master)  1
insdlg.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 <com/sun/star/beans/XPropertySet.hpp>
21 #include <com/sun/star/beans/PropertyValue.hpp>
22 #include <com/sun/star/embed/EmbedStates.hpp>
23 #include <com/sun/star/embed/XInsertObjectDialog.hpp>
24 #include <com/sun/star/embed/MSOLEObjectSystemCreator.hpp>
25 #include <com/sun/star/task/InteractionHandler.hpp>
26 #include <com/sun/star/ucb/CommandAbortedException.hpp>
27 #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
28 #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
29 #include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
30 #include <com/sun/star/task/XStatusIndicatorFactory.hpp>
33 
34 #include <insdlg.hxx>
35 #include <dialmgr.hxx>
36 #include <osl/diagnose.h>
37 #include <svtools/imagemgr.hxx>
38 #include <svtools/strings.hrc>
39 #include <svtools/svtresid.hxx>
40 
41 #include <tools/urlobj.hxx>
42 #include <tools/debug.hxx>
43 #include <tools/stream.hxx>
44 #include <tools/diagnose_ex.h>
45 #include <vcl/image.hxx>
46 #include <vcl/weld.hxx>
47 #include <vcl/svapp.hxx>
48 #include <comphelper/classids.hxx>
49 #include <sfx2/filedlghelper.hxx>
50 #include <sfx2/frmdescr.hxx>
51 #include <sfx2/viewsh.hxx>
52 #include <comphelper/seqstream.hxx>
53 #include <sfx2/viewfrm.hxx>
54 
55 #include <strings.hrc>
56 
57 using namespace ::com::sun::star;
58 using namespace ::com::sun::star::lang;
59 using namespace ::com::sun::star::uno;
60 using namespace ::com::sun::star::container;
61 using namespace ::com::sun::star::ui::dialogs;
62 
64 {
65  return false;
66 }
67 
68 uno::Reference< io::XInputStream > InsertObjectDialog_Impl::GetIconIfIconified( OUString* /*pGraphicMediaType*/ )
69 {
70  return uno::Reference< io::XInputStream >();
71 }
72 
74  const OUString& rUIXMLDescription, const OString& rID,
75  const css::uno::Reference < css::embed::XStorage >& xStorage)
76  : GenericDialogController(pParent, rUIXMLDescription, rID)
77  , m_xStorage( xStorage )
78  , aCnt( m_xStorage )
79 {
80 }
81 
83 {
84  m_xDialog->response(RET_OK);
85  return true;
86 }
87 
89 {
90  sfx2::FileDialogHelper aHelper(ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::NONE, m_xDialog.get());
92  const Reference< XFilePicker3 >& xFilePicker = aHelper.GetFilePicker();
93 
94  // add filter
95  try
96  {
97  xFilePicker->appendFilter(CuiResId(RID_SVXSTR_FILTER_ALL), "*.*");
98  }
99  catch( const IllegalArgumentException& )
100  {
101  TOOLS_WARN_EXCEPTION("cui.dialogs", "caught IllegalArgumentException when registering filter" );
102  }
103 
104  if( xFilePicker->execute() == ExecutableDialogResults::OK )
105  {
106  Sequence< OUString > aPathSeq( xFilePicker->getSelectedFiles() );
107  INetURLObject aObj( aPathSeq[0] );
108  m_xEdFilepath->set_text(aObj.PathToFileName());
109  }
110 }
111 
112 IMPL_LINK(SvInsertOleDlg, RadioHdl, weld::Toggleable&, rButton, void)
113 {
114  if (!rButton.get_active())
115  return;
116 
117  if (m_xRbNewObject->get_active())
118  {
119  m_xObjectTypeFrame->show();
120  m_xFileFrame->hide();
121  }
122  else
123  {
124  m_xFileFrame->show();
125  m_xObjectTypeFrame->hide();
126  }
127 }
128 
130  const SvObjectServerList* pServers)
131  : InsertObjectDialog_Impl( pParent, "cui/ui/insertoleobject.ui", "InsertOLEObjectDialog", xStorage)
132  , m_pServers( pServers )
133  , m_xRbNewObject(m_xBuilder->weld_radio_button("createnew"))
134  , m_xRbObjectFromfile(m_xBuilder->weld_radio_button("createfromfile"))
135  , m_xObjectTypeFrame(m_xBuilder->weld_frame("objecttypeframe"))
136  , m_xLbObjecttype(m_xBuilder->weld_tree_view("types"))
137  , m_xFileFrame(m_xBuilder->weld_frame("fileframe"))
138  , m_xEdFilepath(m_xBuilder->weld_entry("urled"))
139  , m_xBtnFilepath(m_xBuilder->weld_button("urlbtn"))
140  , m_xCbFilelink(m_xBuilder->weld_check_button("linktofile"))
141  , m_xCbAsIcon(m_xBuilder->weld_check_button("asicon"))
142 {
143  m_xLbObjecttype->set_size_request(m_xLbObjecttype->get_approximate_digit_width() * 32,
144  m_xLbObjecttype->get_height_rows(6));
145  m_xLbObjecttype->connect_row_activated(LINK(this, SvInsertOleDlg, DoubleClickHdl));
146  m_xBtnFilepath->connect_clicked(LINK( this, SvInsertOleDlg, BrowseHdl));
147  Link<weld::Toggleable&,void> aLink( LINK( this, SvInsertOleDlg, RadioHdl ) );
148  m_xRbNewObject->connect_toggled( aLink );
149  m_xRbObjectFromfile->connect_toggled( aLink );
150  m_xRbNewObject->set_active(true);
151 }
152 
154 {
155  short nRet = RET_OK;
156  SvObjectServerList aObjS;
157  if ( !m_pServers )
158  {
159  // if no list was provided, take the complete one
160  aObjS.FillInsertObjects();
161  m_pServers = &aObjS;
162  }
163 
164  // fill listbox and select default
165  m_xLbObjecttype->freeze();
166  for ( size_t i = 0; i < m_pServers->Count(); i++ )
167  m_xLbObjecttype->append_text((*m_pServers)[i].GetHumanName());
168  m_xLbObjecttype->thaw();
169  m_xLbObjecttype->select(0);
170 
171  DBG_ASSERT( m_xStorage.is(), "No storage!");
172  if ( m_xStorage.is() && ( nRet = InsertObjectDialog_Impl::run() ) == RET_OK )
173  {
174  OUString aFileName;
175  OUString aName;
176  bool bCreateNew = IsCreateNew();
177  if ( bCreateNew )
178  {
179  // create and insert new embedded object
180  OUString aServerName = m_xLbObjecttype->get_selected_text();
181  const SvObjectServer* pS = m_pServers->Get( aServerName );
182  if ( pS )
183  {
184  if( pS->GetClassName() == SvGlobalName( SO3_OUT_CLASSID ) )
185  {
186  try
187  {
188  uno::Reference < embed::XInsertObjectDialog > xDialogCreator(
189  embed::MSOLEObjectSystemCreator::create( ::comphelper::getProcessComponentContext() ),
190  uno::UNO_QUERY );
191 
192  if ( xDialogCreator.is() )
193  {
194  aName = aCnt.CreateUniqueObjectName();
195 
196  uno::Reference<task::XStatusIndicator> xProgress;
197  OUString aProgressText;
199  if (pFrame)
200  {
201  // Have a current frame, create a matching progressbar, but don't start it yet.
202  uno::Reference<frame::XFrame> xFrame
203  = pFrame->GetFrame().GetFrameInterface();
204  uno::Reference<task::XStatusIndicatorFactory> xProgressFactory(
205  xFrame, uno::UNO_QUERY);
206  if (xProgressFactory.is())
207  {
208  xProgress = xProgressFactory->createStatusIndicator();
209  if (xProgress)
210  {
211  aProgressText = CuiResId(RID_SVXSTR_OLE_INSERT);
212  }
213  }
214  }
215 
216  const embed::InsertedObjectInfo aNewInf = xDialogCreator->createInstanceByDialog(
217  m_xStorage,
218  aName,
219  {comphelper::makePropertyValue("StatusIndicator", xProgress),
220  comphelper::makePropertyValue("StatusIndicatorText", aProgressText)} );
221 
222  OSL_ENSURE( aNewInf.Object.is(), "The object must be created or an exception must be thrown!" );
223  m_xObj = aNewInf.Object;
224  for ( const auto& opt : aNewInf.Options )
225  if ( opt.Name == "Icon" )
226  {
227  opt.Value >>= m_aIconMetaFile;
228  }
229  else if ( opt.Name == "IconFormat" )
230  {
231  datatransfer::DataFlavor aFlavor;
232  if ( opt.Value >>= aFlavor )
233  m_aIconMediaType = aFlavor.MimeType;
234  }
235 
236  }
237  }
238  catch( ucb::CommandAbortedException& )
239  {
240  // the user has pressed cancel
241  }
242  catch( uno::Exception& )
243  {
244  // TODO: Error handling
245  }
246  }
247  else
248  {
249  // create object with desired ClassId
251  }
252 
253  if ( !m_xObj.is() )
254  {
255  if( !aFileName.isEmpty() ) // from OLE Dialog
256  {
257  // object couldn't be created from file
258  // global Resource from svtools (former so3 resource)
259  OUString aErr(SvtResId(STR_ERROR_OBJNOCREATE_FROM_FILE));
260  aErr = aErr.replaceFirst( "%", aFileName );
261 
262  std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_xDialog.get(),
263  VclMessageType::Warning, VclButtonsType::Ok, aErr));
264  xBox->run();
265  }
266  else
267  {
268  // object couldn't be created
269  // global Resource from svtools (former so3 resource)
270  OUString aErr(SvtResId(STR_ERROR_OBJNOCREATE));
271  aErr = aErr.replaceFirst( "%", aServerName );
272 
273  std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_xDialog.get(),
274  VclMessageType::Warning, VclButtonsType::Ok, aErr));
275  xBox->run();
276  }
277  }
278  }
279  }
280  else
281  {
282  aFileName = m_xEdFilepath->get_text();
284  aURL.SetSmartProtocol( INetProtocol::File );
285  aURL.SetSmartURL( aFileName );
287  bool bLink = m_xCbFilelink->get_active();
288 
289  if ( !aFileName.isEmpty() )
290  {
291  // create MediaDescriptor for file to create object from
292  uno::Sequence < beans::PropertyValue > aMedium( 2 );
293  aMedium[0].Name = "URL";
294  aMedium[0].Value <<= aFileName;
295 
296  uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
297  uno::Reference< task::XInteractionHandler2 > xInteraction(
298  task::InteractionHandler::createWithParent(xContext, nullptr) );
299 
300  aMedium[1].Name = "InteractionHandler";
301  aMedium[1].Value <<= xInteraction;
302 
303  // create object from media descriptor
304 
305  uno::Reference<task::XStatusIndicator> xProgress;
307  if (pFrame)
308  {
309  // Have a current frame, create visual indication that insert is in progress.
310  uno::Reference<frame::XFrame> xFrame = pFrame->GetFrame().GetFrameInterface();
311  uno::Reference<task::XStatusIndicatorFactory> xProgressFactory(xFrame, uno::UNO_QUERY);
312  if (xProgressFactory.is())
313  {
314  xProgress = xProgressFactory->createStatusIndicator();
315  if (xProgress)
316  {
317  OUString aOleInsert(CuiResId(RID_SVXSTR_OLE_INSERT));
318  xProgress->start(aOleInsert, 100);
319  }
320  }
321  }
322 
323  if ( bLink )
324  m_xObj = aCnt.InsertEmbeddedLink( aMedium, aName );
325  else
326  m_xObj = aCnt.InsertEmbeddedObject( aMedium, aName );
327 
328  if (xProgress.is())
329  {
330  xProgress->end();
331  }
332  }
333 
334  if ( !m_xObj.is() )
335  {
336  // object couldn't be created from file
337  // global Resource from svtools (former so3 resource)
338  OUString aErr(SvtResId(STR_ERROR_OBJNOCREATE_FROM_FILE));
339  aErr = aErr.replaceFirst( "%", aFileName );
340 
341  std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_xDialog.get(),
342  VclMessageType::Warning, VclButtonsType::Ok, aErr));
343  xBox->run();
344  }
345  else
346  {
347  if (m_xCbAsIcon->get_active())
348  {
349  //something nice here I guess would be to write the filename into
350  //the image with this icon above it
351  Image aImage = SvFileInformationManager::GetImage(aURL, true);
352  SvMemoryStream aTemp;
353  WriteDIBBitmapEx(aImage.GetBitmapEx(), aTemp);
354  m_aIconMetaFile = Sequence<sal_Int8>(static_cast<const sal_Int8*>(aTemp.GetData()), aTemp.TellEnd());
355  m_aIconMediaType = "application/x-openoffice-bitmap;windows_formatname=\"Bitmap\"";
356  }
357  }
358  }
359  }
360 
361  m_pServers = nullptr;
362  return nRet;
363 }
364 
365 uno::Reference< io::XInputStream > SvInsertOleDlg::GetIconIfIconified( OUString* pGraphicMediaType )
366 {
367  if ( m_aIconMetaFile.hasElements() )
368  {
369  if ( pGraphicMediaType )
370  *pGraphicMediaType = m_aIconMediaType;
371 
372  return uno::Reference< io::XInputStream >( new ::comphelper::SequenceInputStream( m_aIconMetaFile ) );
373  }
374 
375  return uno::Reference< io::XInputStream >();
376 }
377 
378 
380  const css::uno::Reference < css::embed::XStorage >& xStorage)
381  : InsertObjectDialog_Impl(pParent, "cui/ui/insertfloatingframe.ui", "InsertFloatingFrameDialog",
382  xStorage)
383 {
384  Init();
385 }
386 
388  const uno::Reference < embed::XEmbeddedObject >& xObj)
389  : InsertObjectDialog_Impl(pParent, "cui/ui/insertfloatingframe.ui", "InsertFloatingFrameDialog",
390  uno::Reference<embed::XStorage>())
391 {
392  m_xObj = xObj;
393 
394  Init();
395 }
396 
398 {
399  m_xEDName = m_xBuilder->weld_entry("edname");
400  m_xEDURL = m_xBuilder->weld_entry("edurl");
401  m_xBTOpen = m_xBuilder->weld_button("buttonbrowse");
402  m_xRBScrollingOn = m_xBuilder->weld_radio_button("scrollbaron");
403  m_xRBScrollingOff = m_xBuilder->weld_radio_button("scrollbaroff");
404  m_xRBScrollingAuto = m_xBuilder->weld_radio_button("scrollbarauto");
405  m_xRBFrameBorderOn = m_xBuilder->weld_radio_button("borderon");
406  m_xRBFrameBorderOff = m_xBuilder->weld_radio_button("borderoff");
407  m_xFTMarginWidth = m_xBuilder->weld_label("widthlabel");
408  m_xNMMarginWidth = m_xBuilder->weld_spin_button("width");
409  m_xCBMarginWidthDefault = m_xBuilder->weld_check_button("defaultwidth");
410  m_xFTMarginHeight = m_xBuilder->weld_label("heightlabel");
411  m_xNMMarginHeight = m_xBuilder->weld_spin_button("height");
412  m_xCBMarginHeightDefault = m_xBuilder->weld_check_button("defaultheight");
413 
415  m_xCBMarginWidthDefault->connect_toggled(aLink);
416  m_xCBMarginHeightDefault->connect_toggled(aLink);
417 
418  m_xCBMarginWidthDefault->set_active(true);
419  m_xCBMarginHeightDefault->set_active(true);
420  m_xRBScrollingAuto->set_active(true);
421  m_xRBFrameBorderOn->set_active(true);
422 
423  m_xBTOpen->connect_clicked(LINK(this, SfxInsertFloatingFrameDialog, OpenHdl));
424 }
425 
427 {
428  short nRet = RET_OK;
429  bool bOK = false;
430  uno::Reference < beans::XPropertySet > xSet;
431  if ( m_xObj.is() )
432  {
433  try
434  {
435  if ( m_xObj->getCurrentState() == embed::EmbedStates::LOADED )
436  m_xObj->changeState( embed::EmbedStates::RUNNING );
437  xSet.set( m_xObj->getComponent(), uno::UNO_QUERY );
438  OUString aStr;
439  uno::Any aAny = xSet->getPropertyValue( "FrameURL" );
440  if ( aAny >>= aStr )
441  m_xEDURL->set_text( aStr );
442  aAny = xSet->getPropertyValue( "FrameName" );
443  if ( aAny >>= aStr )
444  m_xEDName->set_text(aStr);
445 
446  sal_Int32 nSize = SIZE_NOT_SET;
447  aAny = xSet->getPropertyValue( "FrameMarginWidth" );
448  aAny >>= nSize;
449 
450  if ( nSize == SIZE_NOT_SET )
451  {
452  m_xCBMarginWidthDefault->set_active(true);
453  m_xNMMarginWidth->set_text(OUString::number(DEFAULT_MARGIN_WIDTH));
454  m_xFTMarginWidth->set_sensitive(false);
455  m_xNMMarginWidth->set_sensitive(false);
456  }
457  else
458  m_xNMMarginWidth->set_text(OUString::number(nSize));
459 
460  aAny = xSet->getPropertyValue( "FrameMarginHeight" );
461  aAny >>= nSize;
462 
463  if ( nSize == SIZE_NOT_SET )
464  {
465  m_xCBMarginHeightDefault->set_active(true);
466  m_xNMMarginHeight->set_text(OUString::number(DEFAULT_MARGIN_HEIGHT));
467  m_xFTMarginHeight->set_sensitive(false);
468  m_xNMMarginHeight->set_sensitive(false);
469  }
470  else
471  m_xNMMarginHeight->set_text(OUString::number(nSize));
472 
473  bool bScrollOn = false;
474  bool bScrollOff = false;
475  bool bScrollAuto = false;
476 
477  bool bSet = false;
478  aAny = xSet->getPropertyValue( "FrameIsAutoScroll" );
479  aAny >>= bSet;
480  if ( !bSet )
481  {
482  aAny = xSet->getPropertyValue( "FrameIsScrollingMode" );
483  aAny >>= bSet;
484  bScrollOn = bSet;
485  bScrollOff = !bSet;
486  }
487  else
488  bScrollAuto = true;
489 
490  m_xRBScrollingOn->set_sensitive(bScrollOn);
491  m_xRBScrollingOff->set_sensitive(bScrollOff);
492  m_xRBScrollingAuto->set_sensitive(bScrollAuto);
493 
494  bSet = false;
495  aAny = xSet->getPropertyValue( "FrameIsAutoBorder" );
496  aAny >>= bSet;
497  if ( !bSet )
498  {
499  aAny = xSet->getPropertyValue( "FrameIsBorder" );
500  aAny >>= bSet;
501  m_xRBFrameBorderOn->set_active(bSet);
502  m_xRBFrameBorderOff->set_active(!bSet);
503  }
504 
505  bOK = true;
506  }
507  catch ( uno::Exception& )
508  {
509  OSL_FAIL( "No IFrame!" );
510  }
511  }
512  else
513  {
514  DBG_ASSERT( m_xStorage.is(), "No storage!");
515  bOK = m_xStorage.is();
516  }
517 
518  if (!bOK)
519  return RET_OK;
520 
522  if ( nRet == RET_OK )
523  {
524  OUString aURL;
525  if (!m_xEDURL->get_text().isEmpty())
526  {
527  // URL can be a valid and absolute URL or a system file name
528  INetURLObject aObj;
529  aObj.SetSmartProtocol( INetProtocol::File );
530  if ( aObj.SetSmartURL( m_xEDURL->get_text() ) )
532  }
533 
534  if ( !m_xObj.is() && !aURL.isEmpty() )
535  {
536  // create the object
537  OUString aName;
538  SvGlobalName aClassId( SO3_IFRAME_CLASSID );
539  m_xObj = aCnt.CreateEmbeddedObject( aClassId.GetByteSequence(), aName );
540  if ( m_xObj->getCurrentState() == embed::EmbedStates::LOADED )
541  m_xObj->changeState( embed::EmbedStates::RUNNING );
542  xSet.set( m_xObj->getComponent(), uno::UNO_QUERY );
543  }
544 
545  if ( m_xObj.is() )
546  {
547  try
548  {
549  bool bIPActive = m_xObj->getCurrentState() == embed::EmbedStates::INPLACE_ACTIVE;
550  if ( bIPActive )
551  m_xObj->changeState( embed::EmbedStates::RUNNING );
552 
553  OUString aName = m_xEDName->get_text();
554  ScrollingMode eScroll = ScrollingMode::No;
555  if (m_xRBScrollingOn->get_active())
556  eScroll = ScrollingMode::Yes;
557  if (m_xRBScrollingOff->get_active())
558  eScroll = ScrollingMode::No;
559  if (m_xRBScrollingAuto->get_active())
560  eScroll = ScrollingMode::Auto;
561 
562  bool bHasBorder = m_xRBFrameBorderOn->get_active();
563 
564  tools::Long lMarginWidth;
565  if (!m_xCBMarginWidthDefault->get_active())
566  lMarginWidth = static_cast<tools::Long>(m_xNMMarginWidth->get_text().toInt32());
567  else
568  lMarginWidth = SIZE_NOT_SET;
569 
570  tools::Long lMarginHeight;
571  if (!m_xCBMarginHeightDefault->get_active())
572  lMarginHeight = static_cast<tools::Long>(m_xNMMarginHeight->get_text().toInt32());
573  else
574  lMarginHeight = SIZE_NOT_SET;
575 
576  xSet->setPropertyValue( "FrameURL", Any( aURL ) );
577  xSet->setPropertyValue( "FrameName", Any( aName ) );
578 
579  if ( eScroll == ScrollingMode::Auto )
580  xSet->setPropertyValue( "FrameIsAutoScroll", Any( true ) );
581  else
582  xSet->setPropertyValue( "FrameIsScrollingMode", Any( eScroll == ScrollingMode::Yes ) );
583 
584  xSet->setPropertyValue( "FrameIsBorder", Any( bHasBorder ) );
585  xSet->setPropertyValue( "FrameMarginWidth", Any( sal_Int32( lMarginWidth ) ) );
586  xSet->setPropertyValue( "FrameMarginHeight", Any( sal_Int32( lMarginHeight ) ) );
587 
588  if ( bIPActive )
589  m_xObj->changeState( embed::EmbedStates::INPLACE_ACTIVE );
590  }
591  catch ( uno::Exception& )
592  {
593  OSL_FAIL( "No IFrame!" );
594  }
595  }
596  }
597 
598  return nRet;
599 }
600 
602 {
603  weld::CheckButton& rCB = dynamic_cast<weld::CheckButton&>(rButton);
604  if (&rCB == m_xCBMarginWidthDefault.get())
605  {
606  if (rCB.get_active())
607  m_xNMMarginWidth->set_text(OUString::number(DEFAULT_MARGIN_WIDTH));
608  m_xFTMarginWidth->set_sensitive(!rCB.get_active());
609  m_xNMMarginWidth->set_sensitive(!rCB.get_active());
610  }
611 
612  if (&rCB == m_xCBMarginHeightDefault.get())
613  {
614  if (rCB.get_active())
615  m_xNMMarginHeight->set_text(OUString::number(DEFAULT_MARGIN_HEIGHT));
616  m_xFTMarginHeight->set_sensitive(!rCB.get_active());
617  m_xNMMarginHeight->set_sensitive(!rCB.get_active());
618  }
619 }
620 
622 {
623  // create the file dialog
624  sfx2::FileDialogHelper aFileDlg(
625  ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::NONE, OUString(),
626  SfxFilterFlags::NONE, SfxFilterFlags::NONE, m_xDialog.get());
627 
628  // set the title
629  aFileDlg.SetTitle(CuiResId(RID_SVXSTR_SELECT_FILE_IFRAME));
630 
631  // show the dialog
632  if ( aFileDlg.Execute() == ERRCODE_NONE )
633  m_xEDURL->set_text(INetURLObject(aFileDlg.GetPath()).GetMainURL(INetURLObject::DecodeMechanism::WithCharset));
634 }
635 
636 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::shared_ptr< weld::Dialog > m_xDialog
std::unique_ptr< weld::Entry > m_xEDURL
Definition: insdlg.hxx:84
css::uno::Reference< css::embed::XEmbeddedObject > CreateEmbeddedObject(const css::uno::Sequence< sal_Int8 > &, OUString &, OUString const *pBaseURL=nullptr)
URL aURL
std::unique_ptr< weld::SpinButton > m_xNMMarginWidth
Definition: insdlg.hxx:95
SvInsertOleDlg(weld::Window *pParent, const css::uno::Reference< css::embed::XStorage > &xStorage, const SvObjectServerList *pServers)
Definition: insdlg.cxx:129
std::unique_ptr< weld::Builder > m_xBuilder
std::unique_ptr< weld::Label > m_xFTMarginHeight
Definition: insdlg.hxx:97
signed char sal_Int8
std::unique_ptr< weld::CheckButton > m_xCbAsIcon
Definition: insdlg.hxx:63
#define SO3_IFRAME_CLASSID
long Long
Reference< XFrame > xFrame
InsertObjectDialog_Impl(weld::Window *pParent, const OUString &rUIXMLDescription, const OString &rID, const css::uno::Reference< css::embed::XStorage > &xStorage)
Definition: insdlg.cxx:73
exports com.sun.star. embed
Reference
css::uno::Sequence< sal_Int8 > GetByteSequence() const
std::unique_ptr< weld::Button > m_xBtnFilepath
Definition: insdlg.hxx:61
css::uno::Reference< css::embed::XEmbeddedObject > InsertEmbeddedLink(const css::uno::Sequence< css::beans::PropertyValue > &, OUString &)
IMPL_LINK_NOARG(SvInsertOleDlg, DoubleClickHdl, weld::TreeView &, bool)
Definition: insdlg.cxx:82
#define DEFAULT_MARGIN_WIDTH
std::unique_ptr< weld::Button > m_xBTOpen
Definition: insdlg.hxx:85
virtual css::uno::Reference< css::io::XInputStream > GetIconIfIconified(OUString *pGraphicMediaType)
Definition: insdlg.cxx:68
virtual sal_uInt64 TellEnd() override
const SvObjectServer * Get(std::u16string_view rHumanName) const
ScrollingMode
SfxFrame & GetFrame() const
#define SO3_OUT_CLASSID
std::unique_ptr< weld::CheckButton > m_xCBMarginHeightDefault
Definition: insdlg.hxx:99
OUString CuiResId(TranslateId aKey)
Definition: cuiresmgr.cxx:23
#define TOOLS_WARN_EXCEPTION(area, stream)
bool WriteDIBBitmapEx(const BitmapEx &rSource, SvStream &rOStm)
std::unique_ptr< weld::RadioButton > m_xRbObjectFromfile
Definition: insdlg.hxx:56
#define DBG_ASSERT(sCon, aError)
int i
void SetSmartProtocol(INetProtocol eTheSmartScheme)
std::unique_ptr< weld::RadioButton > m_xRBScrollingAuto
Definition: insdlg.hxx:89
comphelper::EmbeddedObjectContainer aCnt
Definition: insdlg.hxx:36
#define DEFAULT_MARGIN_HEIGHT
std::unique_ptr< weld::CheckButton > m_xCbFilelink
Definition: insdlg.hxx:62
virtual short run() override
Definition: insdlg.cxx:153
OUString m_aIconMediaType
Definition: insdlg.hxx:53
Any aHelper
std::unique_ptr< weld::CheckButton > m_xCBMarginWidthDefault
Definition: insdlg.hxx:96
static SVT_DLLPUBLIC Image GetImage(const INetURLObject &rURL, bool bBig=false, css::uno::Reference< css::ucb::XCommandEnvironment > const &env=utl::UCBContentHelper::getDefaultCommandEnvironment())
const css::uno::Reference< css::embed::XStorage > m_xStorage
Definition: insdlg.hxx:35
css::uno::Reference< css::embed::XEmbeddedObject > m_xObj
Definition: insdlg.hxx:34
css::uno::Reference< css::io::XInputStream > GetIconIfIconified(OUString *pGraphicMediaType) override
get replacement for the iconified embedded object and the mediatype of the replacement ...
Definition: insdlg.cxx:365
std::unique_ptr< weld::Label > m_xFTMarginWidth
Definition: insdlg.hxx:94
const char * pS
void SetTitle(const OUString &rNewTitle)
const css::uno::Reference< css::frame::XFrame > & GetFrameInterface() const
std::unique_ptr< weld::RadioButton > m_xRBScrollingOff
Definition: insdlg.hxx:88
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
css::uno::Sequence< sal_Int8 > m_aIconMetaFile
Definition: insdlg.hxx:52
static SfxViewFrame * Current()
size_t Count() const
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
#define ERRCODE_NONE
const SvGlobalName & GetClassName() const
std::unique_ptr< weld::TreeView > m_xLbObjecttype
Definition: insdlg.hxx:58
OUString aName
IMPL_LINK(SvInsertOleDlg, RadioHdl, weld::Toggleable &, rButton, void)
Definition: insdlg.cxx:112
RET_OK
std::unique_ptr< weld::RadioButton > m_xRBFrameBorderOn
Definition: insdlg.hxx:91
Reference< XExecutableDialog > m_xDialog
virtual short run()
Reference< XComponentContext > getProcessComponentContext()
std::unique_ptr< weld::RadioButton > m_xRBScrollingOn
Definition: insdlg.hxx:87
BitmapEx GetBitmapEx() const
bool InsertEmbeddedObject(const css::uno::Reference< css::embed::XEmbeddedObject > &, OUString &)
std::unique_ptr< weld::RadioButton > m_xRBFrameBorderOff
Definition: insdlg.hxx:92
virtual bool IsCreateNew() const
Definition: insdlg.cxx:63
std::unique_ptr< weld::Entry > m_xEdFilepath
Definition: insdlg.hxx:60
std::unique_ptr< weld::RadioButton > m_xRbNewObject
Definition: insdlg.hxx:55
OUString SvtResId(TranslateId aId)
std::unique_ptr< weld::SpinButton > m_xNMMarginHeight
Definition: insdlg.hxx:98
SfxInsertFloatingFrameDialog(weld::Window *pParent, const css::uno::Reference< css::embed::XStorage > &xStorage)
Definition: insdlg.cxx:379
std::unique_ptr< weld::Entry > m_xEDName
Definition: insdlg.hxx:83
virtual short run() override
Definition: insdlg.cxx:426
virtual bool get_active() const =0
aStr
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, bool bMobile=false)
#define SIZE_NOT_SET
virtual void set_sensitive(bool sensitive)=0
bool SetSmartURL(OUString const &rTheAbsURIRef, EncodeMechanism eMechanism=EncodeMechanism::WasEncoded, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8, FSysStyle eStyle=FSysStyle::Detect)
const void * GetData()
const SvObjectServerList * m_pServers
Definition: insdlg.hxx:50
bool IsCreateNew() const override
Definition: insdlg.hxx:68