LibreOffice Module svx (master)  1
galbrws2.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 
21 #include <sot/formats.hxx>
22 #include <vcl/commandevent.hxx>
23 #include <vcl/event.hxx>
24 #include <vcl/transfer.hxx>
25 #include <vcl/virdev.hxx>
26 #include <sfx2/bindings.hxx>
27 #include <sfx2/viewfrm.hxx>
28 #include <vcl/graphicfilter.hxx>
29 #include <helpids.h>
30 #include <svx/svxids.hrc>
31 #include <galobj.hxx>
32 #include <svx/gallery1.hxx>
33 #include <svx/galtheme.hxx>
34 #include <svx/galctrl.hxx>
35 #include <svx/galmisc.hxx>
36 #include <galbrws2.hxx>
37 #include <vcl/svapp.hxx>
38 #include <vcl/weld.hxx>
39 #include <svx/svxdlg.hxx>
40 #include <svx/galleryitem.hxx>
43 #include <com/sun/star/frame/FrameSearchFlag.hpp>
44 #include <com/sun/star/frame/XDispatchProvider.hpp>
45 #include <com/sun/star/frame/XFrame.hpp>
46 #include <com/sun/star/gallery/GalleryItemType.hpp>
47 #include <com/sun/star/graphic/XGraphic.hpp>
48 #include <com/sun/star/lang/XComponent.hpp>
49 #include <com/sun/star/style/GraphicLocation.hpp>
50 
51 #include <cassert>
52 #include <map>
53 #include <memory>
54 #include <cppuhelper/implbase.hxx>
55 #include <osl/diagnose.h>
56 
58 
60 {
61  css::util::URL TargetURL;
62  css::uno::Sequence< css::beans::PropertyValue > Arguments;
63  css::uno::Reference< css::frame::XDispatch > Dispatch;
64 };
65 
66 IMPL_STATIC_LINK( GalleryBrowser2, AsyncDispatch_Impl, void*, p, void )
67 {
68  DispatchInfo* pDispatchInfo = static_cast<DispatchInfo*>(p);
69  if ( pDispatchInfo && pDispatchInfo->Dispatch.is() )
70  {
71  try
72  {
73  pDispatchInfo->Dispatch->dispatch( pDispatchInfo->TargetURL,
74  pDispatchInfo->Arguments );
75  }
76  catch ( const css::uno::Exception& )
77  {
78  }
79  }
80 
81  delete pDispatchInfo;
82 }
83 
84 namespace
85 {
86 
87 struct CommandInfo
88 {
89  css::util::URL URL;
90  css::uno::Reference< css::frame::XDispatch > Dispatch;
91 
92  explicit CommandInfo( const OUString &rURL )
93  {
94  URL.Complete = rURL;
95  }
96 };
97 
98 class GalleryThemePopup : public ::cppu::WeakImplHelper< css::frame::XStatusListener >
99 {
100 private:
101  const GalleryTheme* mpTheme;
102  sal_uInt32 mnObjectPos;
103  bool mbPreview;
104  std::unique_ptr<weld::Builder> mxBuilder;
105  std::unique_ptr<weld::Menu> mxPopupMenu;
106  std::unique_ptr<weld::Menu> mxBackgroundPopup;
107  GalleryBrowser2* mpBrowser;
108 
109  typedef std::map< int, CommandInfo > CommandInfoMap;
110  CommandInfoMap m_aCommandInfo;
111 
112  static void Execute( const CommandInfo &rCmdInfo,
113  const css::uno::Sequence< css::beans::PropertyValue > &rArguments );
114 
115  void MenuSelectHdl(const OString& rIdent);
116  void BackgroundMenuSelectHdl(sal_uInt16 nId);
117 public:
118  GalleryThemePopup(weld::Widget* pParent,
119  const GalleryTheme* pTheme,
120  sal_uInt32 nObjectPos,
121  bool bPreview,
122  GalleryBrowser2* pBrowser);
123 
124  void ExecutePopup(weld::Widget* pParent, const ::Point &rPos);
125 
126  virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent &rEvent) override;
127  virtual void SAL_CALL disposing( const css::lang::EventObject &rSource) override;
128 };
129 
130 
131 GalleryThemePopup::GalleryThemePopup(
132  weld::Widget* pParent,
133  const GalleryTheme* pTheme,
134  sal_uInt32 nObjectPos,
135  bool bPreview,
136  GalleryBrowser2* pBrowser )
137  : mpTheme( pTheme )
138  , mnObjectPos( nObjectPos )
139  , mbPreview( bPreview )
140  , mxBuilder(Application::CreateBuilder(pParent, "svx/ui/gallerymenu2.ui"))
141  , mxPopupMenu(mxBuilder->weld_menu("menu"))
142  , mxBackgroundPopup(mxBuilder->weld_menu("backgroundmenu"))
143  , mpBrowser( pBrowser )
144 {
145  // SID_GALLERY_ENABLE_ADDCOPY
146  m_aCommandInfo.emplace(
147  SID_GALLERY_ENABLE_ADDCOPY,
148  CommandInfo( ".uno:GalleryEnableAddCopy" ));
149  // SID_GALLERY_BG_BRUSH
150  m_aCommandInfo.emplace(
151  SID_GALLERY_BG_BRUSH,
152  CommandInfo( ".uno:BackgroundImage" ));
153  // SID_GALLERY_FORMATS
154  m_aCommandInfo.emplace(
155  SID_GALLERY_FORMATS,
156  CommandInfo( ".uno:InsertGalleryPic" ));
157 
158 }
159 
160 void SAL_CALL GalleryThemePopup::statusChanged(
161  const css::frame::FeatureStateEvent &rEvent )
162 {
163  const OUString &rURL = rEvent.FeatureURL.Complete;
164  if ( rURL == ".uno:GalleryEnableAddCopy" )
165  {
166  if ( !rEvent.IsEnabled )
167  {
168  mxPopupMenu->set_visible("add", false);
169  }
170  }
171  else if ( rURL == ".uno:BackgroundImage" )
172  {
173  mxBackgroundPopup->clear();
174  if ( rEvent.IsEnabled )
175  {
176  OUString sItem;
177  css::uno::Sequence< OUString > sItems;
178  if ( ( rEvent.State >>= sItem ) && sItem.getLength() )
179  {
180  mxBackgroundPopup->append(OUString::number(1), sItem);
181  }
182  else if ( ( rEvent.State >>= sItems ) && sItems.hasElements() )
183  {
184  sal_uInt16 nId = 1;
185  for ( const OUString& rStr : std::as_const(sItems) )
186  {
187  mxBackgroundPopup->append(OUString::number(nId), rStr);
188  nId++;
189  }
190  }
191  }
192  }
193 }
194 
195 void SAL_CALL GalleryThemePopup::disposing(
196  const css::lang::EventObject &/*rSource*/)
197 {
198 }
199 
200 void GalleryThemePopup::Execute(
201  const CommandInfo &rCmdInfo,
202  const css::uno::Sequence< css::beans::PropertyValue > &rArguments )
203 {
204  if ( rCmdInfo.Dispatch.is() )
205  {
206  std::unique_ptr<DispatchInfo> pInfo(new DispatchInfo);
207  pInfo->TargetURL = rCmdInfo.URL;
208  pInfo->Arguments = rArguments;
209  pInfo->Dispatch = rCmdInfo.Dispatch;
210 
212  LINK( nullptr, GalleryBrowser2, AsyncDispatch_Impl), pInfo.get() ) )
213  pInfo.release();
214  }
215 }
216 
217 void GalleryThemePopup::ExecutePopup(weld::Widget* pParent, const ::Point &rPos)
218 {
219  css::uno::Reference< css::frame::XStatusListener > xThis( this );
220 
221  const SgaObjKind eObjKind = mpTheme->GetObjectKind( mnObjectPos );
223 
224  const_cast< GalleryTheme* >( mpTheme )->GetURL( mnObjectPos, aURL );
225  const bool bValidURL = ( aURL.GetProtocol() != INetProtocol::NotValid );
226 
227  mxPopupMenu->set_visible("add", bValidURL && SgaObjKind::Sound != eObjKind);
228 
229  mxPopupMenu->set_visible("preview", bValidURL);
230  mxPopupMenu->set_active("preview", mbPreview);
231 
232  if( mpTheme->IsReadOnly() || !mpTheme->GetObjectCount() )
233  {
234  mxPopupMenu->set_visible("delete", false);
235  mxPopupMenu->set_visible("title", false);
236  if (mpTheme->IsReadOnly())
237  mxPopupMenu->set_visible("paste", false);
238 
239  if (!mpTheme->GetObjectCount())
240  mxPopupMenu->set_visible("copy", false);
241  }
242  else
243  {
244  mxPopupMenu->set_visible("delete", !mbPreview);
245  mxPopupMenu->set_visible("title", true);
246  mxPopupMenu->set_visible("copy", true);
247  mxPopupMenu->set_visible("paste", true);
248  }
249 
250  // update status
251  css::uno::Reference< css::frame::XDispatchProvider> xDispatchProvider(
252  GalleryBrowser2::GetFrame(), css::uno::UNO_QUERY );
253  css::uno::Reference< css::util::XURLTransformer > xTransformer(
254  mpBrowser->GetURLTransformer() );
255  for ( auto& rInfo : m_aCommandInfo )
256  {
257  try
258  {
259  CommandInfo &rCmdInfo = rInfo.second;
260  if ( xTransformer.is() )
261  xTransformer->parseStrict( rCmdInfo.URL );
262 
263  if ( xDispatchProvider.is() )
264  {
265  rCmdInfo.Dispatch = xDispatchProvider->queryDispatch(
266  rCmdInfo.URL,
267  "_self",
268  css::frame::FrameSearchFlag::SELF );
269  }
270 
271  if ( rCmdInfo.Dispatch.is() )
272  {
273  rCmdInfo.Dispatch->addStatusListener( this, rCmdInfo.URL );
274  rCmdInfo.Dispatch->removeStatusListener( this, rCmdInfo.URL );
275  }
276  }
277  catch ( ... )
278  {}
279  }
280 
281  if( !mxBackgroundPopup->n_children() || ( eObjKind == SgaObjKind::SvDraw ) || ( eObjKind == SgaObjKind::Sound ) )
282  mxPopupMenu->set_visible("background", false);
283  else
284  mxPopupMenu->set_visible("background", true);
285 
286  MenuSelectHdl(mxPopupMenu->popup_at_rect(pParent, tools::Rectangle(rPos, Size(1,1))));
287 }
288 
289 void GalleryThemePopup::MenuSelectHdl(const OString& rIdent)
290 {
291  if (rIdent.isEmpty())
292  return;
293 
294  sal_uInt16 nSubMenuId = rIdent.toUInt32();
295  if (nSubMenuId)
296  {
297  BackgroundMenuSelectHdl(nSubMenuId-1);
298  return;
299  }
300 
301  if (rIdent == "add")
302  {
303  const CommandInfoMap::const_iterator it = m_aCommandInfo.find( SID_GALLERY_FORMATS );
304  if (it != m_aCommandInfo.end())
305  mpBrowser->DispatchAdd(it->second.Dispatch, it->second.URL);
306  }
307  else
308  mpBrowser->Execute(rIdent);
309 }
310 
311 void GalleryThemePopup::BackgroundMenuSelectHdl(sal_uInt16 nPos)
312 {
313  OUString aURL( mpBrowser->GetURL().GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
314  OUString aFilterName( mpBrowser->GetFilterName() );
315 
316  css::uno::Sequence< css::beans::PropertyValue > aArgs{
317  comphelper::makePropertyValue("Background.Transparent", sal_Int32( 0 )), // 0 - 100
318  comphelper::makePropertyValue("Background.BackColor", sal_Int32( - 1 )),
319  comphelper::makePropertyValue("Background.URL", aURL),
320  comphelper::makePropertyValue("Background.Filtername", aFilterName), // FIXME name should be FilterName
321  comphelper::makePropertyValue("Background.Position", css::style::GraphicLocation_TILED),
322  comphelper::makePropertyValue("Position", nPos)
323  };
324 
325  const CommandInfoMap::const_iterator it = m_aCommandInfo.find( SID_GALLERY_BG_BRUSH );
326  if ( it != m_aCommandInfo.end() )
327  Execute( it->second, aArgs );
328 }
329 
330 } // end anonymous namespace
331 
333  : mpGallery(pGallery)
334  , mpCurTheme(nullptr)
335  , mxIconView(new GalleryIconView(this, rBuilder.weld_scrolled_window("galleryscroll", true)))
336  , mxIconViewWin(new weld::CustomWeld(rBuilder, "gallery", *mxIconView))
337  , mxListView(rBuilder.weld_tree_view("gallerylist"))
338  , mxPreview(new GalleryPreview(this, rBuilder.weld_scrolled_window("previewscroll")))
339  , mxPreviewWin(new weld::CustomWeld(rBuilder, "preview", *mxPreview))
340  , mxIconButton(rBuilder.weld_toggle_button("icon"))
341  , mxListButton(rBuilder.weld_toggle_button("list"))
342  , mxInfoBar(rBuilder.weld_label("label"))
343  , maPreviewSize(28, 28)
344  , mnCurActionPos ( 0xffffffff )
346  , meLastMode ( GALLERYBROWSERMODE_NONE )
347 {
349 
350  int nHeight = mxListView->get_height_rows(10);
351  mxListView->set_size_request(-1, nHeight);
352  mxIconView->set_size_request(-1, nHeight);
353 
354  m_xTransformer.set(
355  m_xContext->getServiceManager()->createInstanceWithContext(
356  "com.sun.star.util.URLTransformer", m_xContext ),
357  css::uno::UNO_QUERY );
358 
359  mxIconButton->set_help_id(HID_GALLERY_ICONVIEW);
360  mxListButton->set_help_id(HID_GALLERY_LISTVIEW);
361 
362  mxIconButton->connect_toggled( LINK( this, GalleryBrowser2, SelectTbxHdl ) );
363  mxListButton->connect_toggled( LINK( this, GalleryBrowser2, SelectTbxHdl ) );
364 
365  mxIconView->SetSelectHdl( LINK( this, GalleryBrowser2, SelectObjectValueSetHdl ) );
366  mxListView->connect_visible_range_changed(LINK(this, GalleryBrowser2, VisRowsScrolledHdl));
367  mxListView->connect_size_allocate(LINK(this, GalleryBrowser2, SizeAllocHdl));
368  mxListView->connect_changed( LINK( this, GalleryBrowser2, SelectObjectHdl ) );
369  mxListView->connect_popup_menu(LINK(this, GalleryBrowser2, PopupMenuHdl));
370  mxListView->connect_key_press(LINK(this, GalleryBrowser2, KeyInputHdl));
371  mxListView->connect_row_activated(LINK(this, GalleryBrowser2, RowActivatedHdl));
372  mxDragDropTargetHelper.reset(new GalleryDragDrop(this, mxListView->get_drop_target()));
373  mxListView->connect_drag_begin(LINK(this, GalleryBrowser2, DragBeginHdl));
374 
375  mxListView->set_help_id(HID_GALLERY_WINDOW);
376 
378 }
379 
380 IMPL_LINK(GalleryBrowser2, PopupMenuHdl, const CommandEvent&, rCEvt, bool)
381 {
382  if (rCEvt.GetCommand() != CommandEventId::ContextMenu)
383  return false;
384  ShowContextMenu(rCEvt);
385  return true;
386 }
387 
388 IMPL_LINK(GalleryBrowser2, KeyInputHdl, const KeyEvent&, rKEvt, bool)
389 {
390  return KeyInput(rKEvt);
391 }
392 
394 {
395  TogglePreview();
396  return true;
397 }
398 
400 {
401  if (mpCurTheme)
402  mpGallery->ReleaseTheme( mpCurTheme, *this );
403 }
404 
406 {
407  const GalleryHint& rGalleryHint = static_cast<const GalleryHint&>(rHint);
408 
409  switch( rGalleryHint.GetType() )
410  {
412  {
414  SetMode( meLastMode );
415 
416  ImplUpdateViews( reinterpret_cast<size_t>(rGalleryHint.GetData1()) + 1 );
417  }
418  break;
419 
420  default:
421  break;
422  }
423 }
424 
426 {
427  sal_Int8 nRet = DND_ACTION_NONE;
428 
429  if( mpCurTheme && !mpCurTheme->IsReadOnly() )
430  {
431  if( !mpCurTheme->IsDragging() )
432  {
433  if( rTarget.IsDropFormatSupported( SotClipboardFormatId::DRAWING ) ||
434  rTarget.IsDropFormatSupported( SotClipboardFormatId::FILE_LIST ) ||
435  rTarget.IsDropFormatSupported( SotClipboardFormatId::SIMPLE_FILE ) ||
436  rTarget.IsDropFormatSupported( SotClipboardFormatId::SVXB ) ||
437  rTarget.IsDropFormatSupported( SotClipboardFormatId::GDIMETAFILE ) ||
438  rTarget.IsDropFormatSupported( SotClipboardFormatId::BITMAP ) )
439  {
440  nRet = DND_ACTION_COPY;
441  }
442  }
443  else
444  nRet = DND_ACTION_COPY;
445  }
446 
447  return nRet;
448 }
449 
451 {
452  sal_Int8 nRet = DND_ACTION_NONE;
453 
454  if( mpCurTheme )
455  {
456  Point aSelPos;
457  const sal_uInt32 nItemId = ImplGetSelectedItemId( &rEvt.maPosPixel, aSelPos );
458  const sal_uInt32 nInsertPos = (nItemId ? (nItemId - 1) : mpCurTheme->GetObjectCount());
459 
460  if( mpCurTheme->IsDragging() )
461  mpCurTheme->ChangeObjectPos( mpCurTheme->GetDragPos(), nInsertPos );
462  else
463  nRet = mpCurTheme->InsertTransferable( rEvt.maDropEvent.Transferable, nInsertPos ) ? 1 : 0;
464  }
465 
466  return nRet;
467 }
468 
470 {
471  if (!mpCurTheme)
472  return true;
473  return m_xHelper->StartDrag();
474 }
475 
476 IMPL_LINK(GalleryBrowser2, DragBeginHdl, bool&, rUnsetDragIcon, bool)
477 {
478  rUnsetDragIcon = false;
479  return StartDrag();
480 }
481 
483 {
486 }
487 
489 {
490  Point aMousePos = rCEvt.GetMousePosPixel();
491  Point aSelPos;
492  const sal_uInt32 nItemId = ImplGetSelectedItemId( rCEvt.IsMouseEvent() ? &aMousePos : nullptr, aSelPos );
493 
494  if( !(mpCurTheme && nItemId && ( nItemId <= mpCurTheme->GetObjectCount() )) )
495  return;
496 
497  ImplSelectItemId( nItemId );
498 
499  css::uno::Reference< css::frame::XFrame > xFrame( GetFrame() );
500  if ( !xFrame.is() )
501  return;
502 
503  weld::Widget* pParent = GetViewWindow();
504  mnCurActionPos = nItemId - 1;
506  new GalleryThemePopup(
507  pParent,
508  mpCurTheme,
511  this ) );
512  xPopup->ExecutePopup(pParent, aSelPos);
513 }
514 
516 {
517  return mxIconButton->has_focus() || mxListButton->has_focus();
518 }
519 
521 {
522  Point aSelPos;
523  const sal_uInt32 nItemId = ImplGetSelectedItemId( nullptr, aSelPos );
524  bool bRet = false;
525 
526  if (!ViewBoxHasFocus() && nItemId && mpCurTheme)
527  {
528  OString sExecuteIdent;
529  INetURLObject aURL;
530 
531  mpCurTheme->GetURL( nItemId - 1, aURL );
532 
533  const bool bValidURL = ( aURL.GetProtocol() != INetProtocol::NotValid );
534  bool bPreview = bValidURL;
535  bool bDelete = false;
536  bool bTitle = false;
537 
539  {
540  bDelete = ( GALLERYBROWSERMODE_PREVIEW != GetMode() );
541  bTitle = true;
542  }
543 
544  switch( rKEvt.GetKeyCode().GetCode() )
545  {
546  case KEY_SPACE:
547  case KEY_RETURN:
548  case KEY_P:
549  {
550  if( bPreview )
551  {
552  TogglePreview();
553  bRet = true;
554  }
555  }
556  break;
557 
558  case KEY_INSERT:
559  case KEY_I:
560  {
561  // Inserting a gallery item in the document must be dispatched
562  if( bValidURL )
563  {
564  DispatchAdd(css::uno::Reference<css::frame::XDispatch>(), css::util::URL());
565  return true;
566  }
567  }
568  break;
569 
570  case KEY_DELETE:
571  case KEY_D:
572  {
573  if( bDelete )
574  sExecuteIdent = "delete";
575  }
576  break;
577 
578  case KEY_T:
579  {
580  if( bTitle )
581  sExecuteIdent = "title";
582  }
583  break;
584 
585  default:
586  break;
587  }
588 
589  if (!sExecuteIdent.isEmpty())
590  {
591  Execute(sExecuteIdent);
592  bRet = true;
593  }
594  }
595 
596  return bRet;
597 }
598 
599 void GalleryBrowser2::SelectTheme( std::u16string_view rThemeName )
600 {
601  if( mpCurTheme )
602  mpGallery->ReleaseTheme( mpCurTheme, *this );
603 
604  mpCurTheme = mpGallery->AcquireTheme( rThemeName, *this );
605 
606  m_xHelper.set(new GalleryTransferable(mpCurTheme, 0, true));
608  mxListView->enable_drag_source(xHelper, DND_ACTION_COPY | DND_ACTION_LINK);
609  mxIconView->SetDragDataTransferrable(xHelper, DND_ACTION_COPY | DND_ACTION_LINK);
610  mxPreview->SetDragDataTransferrable(xHelper, DND_ACTION_COPY | DND_ACTION_LINK);
611 
612  mxIconView->SetTheme(mpCurTheme);
613  mxPreview->SetTheme(mpCurTheme);
614 
616  meMode = meLastMode;
617 
618  ImplUpdateViews( 1 );
619 
620  bool bIconMode = (GALLERYBROWSERMODE_ICON == GetMode());
621  mxIconButton->set_sensitive(true);
622  mxListButton->set_sensitive(true);
623  mxIconButton->set_active(bIconMode);
624  mxListButton->set_active(!bIconMode);
625 }
626 
628 {
629  if( GetMode() == eMode )
630  return;
631 
632  meLastMode = GetMode();
633 
634  switch( eMode )
635  {
637  {
638  mxListView->hide();
639 
640  mxPreview->Hide();
641  mxPreview->SetGraphic( Graphic() );
643 
644  mxIconView->Show();
645 
646  mxIconButton->set_sensitive(true);
647  mxListButton->set_sensitive(true);
648 
649  mxIconButton->set_active(true);
650  mxListButton->set_active(false);
651  }
652  break;
653 
655  {
656  mxIconView->Hide();
657 
658  mxPreview->Hide();
659  mxPreview->SetGraphic( Graphic() );
661 
662  mxListView->show();
663  UpdateRows(true);
664 
665  mxIconButton->set_sensitive(true);
666  mxListButton->set_sensitive(true);
667 
668  mxIconButton->set_active(false);
669  mxListButton->set_active(true);
670  }
671  break;
672 
674  {
675  Graphic aGraphic;
676  Point aSelPos;
677  const sal_uInt32 nItemId = ImplGetSelectedItemId( nullptr, aSelPos );
678 
679  if( nItemId )
680  {
681  const sal_uInt32 nPos = nItemId - 1;
682 
683  mxIconView->Hide();
684  mxListView->hide();
685 
686  if( mpCurTheme )
687  mpCurTheme->GetGraphic( nPos, aGraphic );
688 
689  mxPreview->SetGraphic( aGraphic );
690  mxPreview->Show();
691 
694 
695  mxIconButton->set_sensitive(false);
696  mxListButton->set_sensitive(false);
697  }
698  }
699  break;
700 
701  default:
702  break;
703  }
704 
706 }
707 
709 {
710  weld::Widget* pRet;
711 
712  switch( GetMode() )
713  {
714  case GALLERYBROWSERMODE_LIST: pRet = mxListView.get(); break;
715  case GALLERYBROWSERMODE_PREVIEW: pRet = mxPreview->GetDrawingArea(); break;
716 
717  default:
718  pRet = mxIconView->GetDrawingArea();
719  break;
720  }
721 
722  return pRet;
723 }
724 
726 {
727  if( !mpCurTheme )
728  return;
729 
730  Point aSelPos;
731  const sal_uInt32 nItemId = ImplGetSelectedItemId( nullptr, aSelPos );
732 
733  if( !nItemId )
734  return;
735 
736  sal_uInt32 nNewItemId = nItemId;
737 
738  switch( eTravel )
739  {
740  case GalleryBrowserTravel::First: nNewItemId = 1; break;
741  case GalleryBrowserTravel::Last: nNewItemId = mpCurTheme->GetObjectCount(); break;
742  case GalleryBrowserTravel::Previous: nNewItemId--; break;
743  case GalleryBrowserTravel::Next: nNewItemId++; break;
744  default:
745  break;
746  }
747 
748  if( nNewItemId < 1 )
749  nNewItemId = 1;
750  else if( nNewItemId > mpCurTheme->GetObjectCount() )
751  nNewItemId = mpCurTheme->GetObjectCount();
752 
753  if( nNewItemId == nItemId )
754  return;
755 
756  ImplSelectItemId( nNewItemId );
758 
760  return;
761 
762  Graphic aGraphic;
763  const sal_uInt32 nPos = nNewItemId - 1;
764 
765  mpCurTheme->GetGraphic( nPos, aGraphic );
766  mxPreview->SetGraphic( aGraphic );
767 
768  if( SgaObjKind::Sound == mpCurTheme->GetObjectKind( nPos ) )
770 
771  mxPreview->Invalidate();
772 }
773 
774 void GalleryBrowser2::ImplUpdateViews( sal_uInt16 nSelectionId )
775 {
776  mxIconView->Hide();
777  mxListView->hide();
778  mxPreview->Hide();
779 
780  mxIconView->Clear();
781  mxListView->clear();
782 
783  if( mpCurTheme )
784  {
785  const int nAlwaysUpToDate = 15;
786 
787  mxListView->freeze();
788 
789  sal_uInt32 nCount = mpCurTheme->GetObjectCount();
790  for (sal_uInt32 i = 0; i < nCount; ++i)
791  {
792  mxIconView->InsertItem(i + 1); // skip reserved id 0
793  mxListView->append(OUString::number(i), ""); // create on-demand in VisRowsScrolledHdl
794 
795  if (i == nAlwaysUpToDate) // fill in the first block
796  UpdateRows(false);
797  }
798 
799  if (nCount < nAlwaysUpToDate) // if less than block size, fill in all of them
800  UpdateRows(false);
801 
802  mxListView->thaw();
803 
804  ImplSelectItemId( std::min<sal_uInt16>( nSelectionId, mpCurTheme->GetObjectCount() ) );
805  }
806 
807  switch( GetMode() )
808  {
809  case GALLERYBROWSERMODE_ICON: mxIconView->Show(); break;
811  mxListView->show();
812  UpdateRows(true);
813  break;
814  case GALLERYBROWSERMODE_PREVIEW: mxPreview->Show(); break;
815 
816  default:
817  break;
818  }
819 
821 }
822 
823 void GalleryBrowser2::UpdateRows(bool bVisibleOnly)
824 {
825  auto lambda = [this](weld::TreeIter& rEntry){
826  // id is non-null if the preview is pending creation
827  OUString sId(mxListView->get_id(rEntry));
828  if (sId.isEmpty())
829  return false;
830 
831  // get the icon for the listview
832  BitmapEx aBitmapEx;
833  Size aPreparedSize;
834 
835  OUString sItemTextTitle;
836  OUString sItemTextPath;
837 
838  sal_Int32 i = sId.toUInt32();
839  mpCurTheme->GetPreviewBitmapExAndStrings(i, aBitmapEx, aPreparedSize, sItemTextTitle, sItemTextPath);
840 
841  bool bNeedToCreate(aBitmapEx.IsEmpty());
842  if (!bNeedToCreate && (sItemTextTitle.isEmpty() || aPreparedSize != maPreviewSize))
843  bNeedToCreate = true;
844 
845  if (bNeedToCreate)
846  {
847  std::unique_ptr<SgaObject> xObj = mpCurTheme->AcquireObject(i);
848  if (xObj)
849  {
850  aBitmapEx = xObj->createPreviewBitmapEx(maPreviewSize);
851  sItemTextTitle = GalleryBrowser2::GetItemText(*xObj, GalleryItemFlags::Title);
853 
854  mpCurTheme->SetPreviewBitmapExAndStrings(i, aBitmapEx, maPreviewSize, sItemTextTitle, sItemTextPath);
855  }
856  }
857 
858  ScopedVclPtr<VirtualDevice> xDev(mxListView->create_virtual_device());
859  xDev->SetOutputSizePixel(maPreviewSize);
860 
861  if (!aBitmapEx.IsEmpty())
862  {
863  const Size aBitmapExSizePixel(aBitmapEx.GetSizePixel());
864  const Point aPos(
865  ((maPreviewSize.Width() - aBitmapExSizePixel.Width()) >> 1),
866  ((maPreviewSize.Height() - aBitmapExSizePixel.Height()) >> 1));
867 
868  if (aBitmapEx.IsAlpha())
869  {
870  // draw checkered background
871  GalleryIconView::drawTransparenceBackground(*xDev, aPos, aBitmapExSizePixel);
872  }
873 
874  xDev->DrawBitmapEx(aPos, aBitmapEx);
875  }
876 
877  mxListView->set_text(rEntry, sItemTextTitle);
878  mxListView->set_image(rEntry, *xDev);
879  mxListView->set_id(rEntry, OUString());
880 
881  return false;
882  };
883 
884  if (bVisibleOnly)
885  {
886  // ensure all visible entries are up to date
887  mxListView->visible_foreach(lambda);
888  // and ensure all selected entries are up to date
889  mxListView->selected_foreach(lambda);
890  return;
891  }
892 
893  mxListView->all_foreach(lambda);
894 }
895 
896 IMPL_LINK_NOARG(GalleryBrowser2, VisRowsScrolledHdl, weld::TreeView&, void)
897 {
898  UpdateRows(true);
899 }
900 
901 IMPL_LINK_NOARG(GalleryBrowser2, SizeAllocHdl, const Size&, void)
902 {
903  UpdateRows(true);
904 }
905 
907 {
908  if (!mpCurTheme)
909  return;
910  mxInfoBar->set_label( mpCurTheme->GetName() );
911 }
912 
914 {
915  if (!mpCurTheme)
916  return;
917  auto nSelectedObject = (GALLERYBROWSERMODE_ICON == GetMode()) ? (mxIconView->GetSelectedItemId() - 1) : mxListView->get_selected_index();
918  m_xHelper->SelectObject(nSelectedObject);
919 }
920 
921 sal_uInt32 GalleryBrowser2::ImplGetSelectedItemId( const Point* pSelPos, Point& rSelPos )
922 {
923  sal_uInt32 nRet = 0;
924 
926  {
927  nRet = ( ( GALLERYBROWSERMODE_ICON == meLastMode ) ? mxIconView->GetSelectedItemId() : ( mxListView->get_selected_index() + 1 ) );
928 
929  if( pSelPos )
930  rSelPos = *pSelPos;
931  else
932  {
933  Size aOutputSizePixel(mxPreview->GetOutputSizePixel());
934  rSelPos = Point( aOutputSizePixel.Width() >> 1, aOutputSizePixel.Height() >> 1 );
935  }
936  }
937  else if (GALLERYBROWSERMODE_ICON == GetMode())
938  {
939  if (pSelPos)
940  {
941  nRet = mxIconView->GetItemId( *pSelPos );
942  rSelPos = *pSelPos;
943  }
944  else
945  {
946  nRet = mxIconView->GetSelectedItemId();
947  rSelPos = mxIconView->GetItemRect(nRet).Center();
948  }
949  }
950  else
951  {
952  std::unique_ptr<weld::TreeIter> xIter = mxListView->make_iterator();
953  if( pSelPos )
954  {
955  if (mxListView->get_dest_row_at_pos(*pSelPos, xIter.get(), false))
956  nRet = mxListView->get_iter_index_in_parent(*xIter) + 1;
957  rSelPos = *pSelPos;
958  }
959  else
960  {
961  if (mxListView->get_selected(xIter.get()))
962  {
963  nRet = mxListView->get_iter_index_in_parent(*xIter) + 1;
964  rSelPos = mxListView->get_row_area(*xIter).Center();
965  }
966  }
967  }
968 
969  if( nRet && ( !mpCurTheme || ( nRet > mpCurTheme->GetObjectCount() ) ) )
970  {
971  nRet = 0;
972  }
973 
974  return nRet;
975 }
976 
977 void GalleryBrowser2::ImplSelectItemId(sal_uInt32 nItemId)
978 {
979  if( nItemId )
980  {
981  mxIconView->SelectItem(nItemId);
982  mxListView->select( nItemId - 1 );
984  }
985 }
986 
987 css::uno::Reference< css::frame::XFrame >
989 {
990  css::uno::Reference< css::frame::XFrame > xFrame;
991  SfxViewFrame* pCurrentViewFrame = SfxViewFrame::Current();
992  if ( pCurrentViewFrame )
993  {
994  SfxBindings& rBindings = pCurrentViewFrame->GetBindings();
995  xFrame.set( rBindings.GetActiveFrame() );
996  }
997 
998  return xFrame;
999 }
1000 
1002  const css::uno::Reference< css::frame::XDispatch > &rxDispatch,
1003  const css::util::URL &rURL)
1004 {
1005  Point aSelPos;
1006  const sal_uInt32 nItemId = ImplGetSelectedItemId( nullptr, aSelPos );
1007 
1008  if( !mpCurTheme || !nItemId )
1009  return;
1010 
1011  mnCurActionPos = nItemId - 1;
1012 
1013  css::uno::Reference< css::frame::XDispatch > xDispatch( rxDispatch );
1014  css::util::URL aURL = rURL;
1015 
1016  if ( !xDispatch.is() )
1017  {
1018  css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider(
1019  GetFrame(), css::uno::UNO_QUERY );
1020  if ( !xDispatchProvider.is() || !m_xTransformer.is() )
1021  return;
1022 
1023  aURL.Complete = ".uno:InsertGalleryPic";
1024  m_xTransformer->parseStrict( aURL );
1025  xDispatch = xDispatchProvider->queryDispatch(
1026  aURL,
1027  "_self",
1028  css::frame::FrameSearchFlag::SELF );
1029  }
1030 
1031  if ( !xDispatch.is() )
1032  return;
1033 
1034  sal_Int8 nType = 0;
1035  OUString aFilterName;
1036  css::uno::Reference< css::lang::XComponent > xDrawing;
1037  css::uno::Reference< css::graphic::XGraphic > xGraphic;
1038 
1039  aFilterName = GetFilterName();
1040 
1042  {
1043  case SgaObjKind::Bitmap:
1044  case SgaObjKind::Animation:
1045  case SgaObjKind::Inet:
1046  // TODO drawing objects are inserted as drawings only via drag&drop
1047  case SgaObjKind::SvDraw:
1048  nType = css::gallery::GalleryItemType::GRAPHIC;
1049  break;
1050 
1051  case SgaObjKind::Sound :
1052  nType = css::gallery::GalleryItemType::MEDIA;
1053  break;
1054 
1055  default:
1057  break;
1058  }
1059 
1060  Graphic aGraphic;
1061  bool bGraphic = mpCurTheme->GetGraphic( mnCurActionPos, aGraphic );
1062  if ( bGraphic && !aGraphic.IsNone() )
1063  xGraphic.set( aGraphic.GetXGraphic() );
1064  OSL_ENSURE( xGraphic.is(), "gallery item is graphic, but the reference is invalid!" );
1065 
1066  css::uno::Sequence< css::beans::PropertyValue > aSeq{
1072  };
1073  assert(aSeq.getLength() == SVXGALLERYITEM_PARAMS);
1074 
1075  css::uno::Sequence< css::beans::PropertyValue > aArgs{ comphelper::makePropertyValue(
1077 
1078  std::unique_ptr<DispatchInfo> pInfo(new DispatchInfo);
1079  pInfo->TargetURL = aURL;
1080  pInfo->Arguments = aArgs;
1081  pInfo->Dispatch = xDispatch;
1082 
1084  LINK( nullptr, GalleryBrowser2, AsyncDispatch_Impl), pInfo.get() ) )
1085  pInfo.release();
1086 }
1087 
1088 void GalleryBrowser2::Execute(std::string_view rIdent)
1089 {
1090  Point aSelPos;
1091  const sal_uInt32 nItemId = ImplGetSelectedItemId( nullptr, aSelPos );
1092 
1093  if( !(mpCurTheme && nItemId) )
1094  return;
1095 
1096  mnCurActionPos = nItemId - 1;
1097 
1098  if (rIdent == "preview")
1100  else if (rIdent == "delete")
1101  {
1102  if (!mpCurTheme->IsReadOnly())
1103  {
1104  std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetViewWindow(), "svx/ui/querydeleteobjectdialog.ui"));
1105  std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("QueryDeleteObjectDialog"));
1106  if (xQuery->run() == RET_YES)
1107  {
1109  }
1110  }
1111  }
1112  else if (rIdent == "title")
1113  {
1114  std::unique_ptr<SgaObject> pObj = mpCurTheme->AcquireObject( mnCurActionPos );
1115 
1116  if( pObj )
1117  {
1118  const OUString aOldTitle( GetItemText( *pObj, GalleryItemFlags::Title ) );
1119 
1122  if( aDlg->Execute() == RET_OK )
1123  {
1124  OUString aNewTitle( aDlg->GetTitle() );
1125 
1126  if( ( aNewTitle.isEmpty() && !pObj->GetTitle().isEmpty() ) || ( aNewTitle != aOldTitle ) )
1127  {
1128  if( aNewTitle.isEmpty() )
1129  aNewTitle = "__<empty>__";
1130 
1131  pObj->SetTitle( aNewTitle );
1132  mpCurTheme->InsertObject( *pObj );
1133  }
1134  }
1135  }
1136  }
1137  else if (rIdent == "copy")
1138  {
1140  }
1141  else if (rIdent == "paste")
1142  {
1143  if( !mpCurTheme->IsReadOnly() )
1144  {
1145  weld::Widget* pParent = GetViewWindow();
1148  }
1149  }
1150 }
1151 
1152 OUString GalleryBrowser2::GetItemText( const SgaObject& rObj, GalleryItemFlags nItemTextFlags )
1153 {
1154  OUString aRet;
1155 
1156  const INetURLObject& aURL(rObj.GetURL());
1157 
1158  if( nItemTextFlags & GalleryItemFlags::Title )
1159  {
1160  OUString aTitle( rObj.GetTitle() );
1161 
1162  if( aTitle.isEmpty() )
1164 
1165  if( aTitle.isEmpty() )
1166  {
1168  aTitle = aTitle.copy( aTitle.lastIndexOf('/')+1 );
1169  }
1170 
1171  aRet += aTitle;
1172  }
1173 
1174  if( nItemTextFlags & GalleryItemFlags::Path )
1175  {
1176  const OUString aPath( aURL.getFSysPath( FSysStyle::Detect ) );
1177 
1178  if( !aPath.isEmpty() && ( nItemTextFlags & GalleryItemFlags::Title ) )
1179  aRet += " (";
1180 
1181  aRet += aURL.getFSysPath( FSysStyle::Detect );
1182 
1183  if( !aPath.isEmpty() && ( nItemTextFlags & GalleryItemFlags::Title ) )
1184  aRet += ")";
1185  }
1186 
1187  return aRet;
1188 }
1189 
1191 {
1192  INetURLObject aURL;
1193 
1194  if( mpCurTheme && mnCurActionPos != 0xffffffff )
1196 
1197  return aURL;
1198 }
1199 
1201 {
1202  OUString aFilterName;
1203 
1204  if( mpCurTheme && mnCurActionPos != 0xffffffff )
1205  {
1206  const SgaObjKind eObjKind = mpCurTheme->GetObjectKind( mnCurActionPos );
1207 
1208  if( ( SgaObjKind::Bitmap == eObjKind ) || ( SgaObjKind::Animation == eObjKind ) )
1209  {
1211  INetURLObject aURL;
1212  mpCurTheme->GetURL( mnCurActionPos, aURL );
1213  sal_uInt16 nFilter = rFilter.GetImportFormatNumberForShortName(aURL.GetFileExtension());
1214 
1215  if( GRFILTER_FORMAT_DONTKNOW != nFilter )
1216  aFilterName = rFilter.GetImportFormatName( nFilter );
1217  }
1218  }
1219 
1220  return aFilterName;
1221 }
1222 
1223 IMPL_LINK_NOARG(GalleryBrowser2, SelectObjectValueSetHdl, ValueSet*, void)
1224 {
1225  ImplUpdateSelection();
1226 }
1227 
1229 {
1230  ImplUpdateSelection();
1231 }
1232 
1233 IMPL_LINK(GalleryBrowser2, SelectTbxHdl, weld::Toggleable&, rBox, void)
1234 {
1235  if (&rBox == mxIconButton.get())
1236  SetMode(rBox.get_active() ? GALLERYBROWSERMODE_ICON : GALLERYBROWSERMODE_LIST);
1237  else if (&rBox == mxListButton.get())
1238  SetMode(rBox.get_active() ? GALLERYBROWSERMODE_LIST : GALLERYBROWSERMODE_ICON);
1239 }
1240 
1241 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SAL_DLLPRIVATE bool IsDragging() const
Definition: galtheme.hxx:99
sal_Int8 AcceptDrop(const DropTargetHelper &rTarget)
Definition: galbrws2.cxx:425
URL aURL
css::uno::Reference< css::uno::XComponentContext > m_xContext
Definition: galbrws2.hxx:94
bool InsertObject(const SgaObject &rObj, sal_uInt32 nPos=SAL_MAX_UINT32)
Definition: galtheme.cxx:118
const css::datatransfer::dnd::DropTargetDropEvent maDropEvent
static css::uno::Reference< css::frame::XFrame > GetFrame()
Definition: galbrws2.cxx:988
#define DND_ACTION_COPY
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: galbrws2.cxx:405
GalleryBrowserMode meMode
Definition: galbrws2.hxx:91
bool IsNone() const
bool StartDrag()
Definition: galbrws2.cxx:469
SAL_DLLPRIVATE const INetURLObject & GetObjectURL(sal_uInt32 nPos) const
Definition: galtheme.hxx:128
signed char sal_Int8
OUString getBase(sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true, DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
void DispatchAdd(const css::uno::Reference< css::frame::XDispatch > &rxDispatch, const css::util::URL &rURL)
Definition: galbrws2.cxx:1001
static SvxAbstractDialogFactory * Create()
Definition: svxdlg.cxx:22
static OUString GetItemText(const SgaObject &rObj, GalleryItemFlags nItemTextFlags)
Definition: galbrws2.cxx:1152
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
Reference< XFrame > xFrame
OUString GetImportFormatName(sal_uInt16 nFormat)
css::uno::Reference< css::frame::XFrame > GetActiveFrame() const
constexpr OUStringLiteral SVXGALLERYITEM_URL
Definition: galleryitem.hxx:33
GalleryBrowserTravel
Definition: galbrws2.hxx:42
const ::avmedia::MediaItem * Execute(const SdrMarkView *pSdrView, SfxRequest const &rReq)
std::unique_ptr< weld::ToggleButton > mxIconButton
Definition: galbrws2.hxx:85
void RemoveObject(sal_uInt32 nPos)
Definition: galtheme.cxx:167
sal_Int16 nId
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
sal_uInt16 GetCode() const
std::unique_ptr< weld::Label > mxInfoBar
Definition: galbrws2.hxx:87
SAL_DLLPRIVATE void SetPreviewBitmapExAndStrings(sal_uInt32 nPos, const BitmapEx &rBitmapEx, const Size &rSize, const OUString &rTitle, const OUString &rPath)
Definition: galtheme.cxx:157
SAL_DLLPRIVATE SgaObjKind GetObjectKind(sal_uInt32 nPos) const
Definition: galtheme.hxx:121
virtual css::uno::Reference< css::datatransfer::clipboard::XClipboard > get_clipboard() const =0
virtual VclPtr< AbstractTitleDialog > CreateTitleDialog(weld::Widget *pParent, const OUString &rOldText)=0
constexpr sal_uInt16 KEY_SPACE
void ImplUpdateSelection()
Definition: galbrws2.cxx:913
void SelectTheme(std::u16string_view rThemeName)
Definition: galbrws2.cxx:599
std::unique_ptr< weld::ToggleButton > mxListButton
Definition: galbrws2.hxx:86
constexpr tools::Long Width() const
SAL_DLLPRIVATE bool GetURL(sal_uInt32 nPos, INetURLObject &rURL)
Definition: galtheme.cxx:482
std::unique_ptr< GalleryDragDrop > mxDragDropTargetHelper
Definition: galbrws2.hxx:82
bool IsAlpha() const
RET_YES
SAL_DLLPRIVATE sal_uInt32 GetDragPos() const
Definition: galtheme.hxx:109
constexpr OStringLiteral HID_GALLERY_ICONVIEW
Definition: helpids.h:30
bool IsMouseEvent() const
constexpr sal_uInt16 KEY_D
int nCount
#define DND_ACTION_NONE
IMPL_STATIC_LINK(GalleryBrowser2, AsyncDispatch_Impl, void *, p, void)
Definition: galbrws2.cxx:66
SAL_DLLPRIVATE void CopyToClipboard(const weld::Widget &rWidget, sal_uInt32 nPos)
Definition: galtheme.cxx:630
static GalleryBrowserMode meInitMode
Definition: galbrws2.hxx:119
#define SVXGALLERYITEM_PARAMS
Definition: galleryitem.hxx:37
ColorMode meMode
sal_uInt32 mnCurActionPos
Definition: galbrws2.hxx:90
constexpr OUStringLiteral SVXGALLERYITEM_TYPE
Definition: galleryitem.hxx:32
void * GetData1() const
Definition: galmisc.hxx:194
bool IsEmpty() const
GalleryHintType GetType() const
Definition: galmisc.hxx:191
SgaObjKind
Definition: galmisc.hxx:55
constexpr OUStringLiteral SVXGALLERYITEM_FILTER
Definition: galleryitem.hxx:34
OUString getFSysPath(FSysStyle eStyle, sal_Unicode *pDelimiter=nullptr) const
void UpdateRows(bool bVisibleOnly)
Definition: galbrws2.cxx:823
constexpr OUStringLiteral SVXGALLERYITEM_ARGNAME
Definition: galleryitem.hxx:38
void Travel(GalleryBrowserTravel eTravel)
Definition: galbrws2.cxx:725
int i
GalleryBrowserMode meLastMode
Definition: galbrws2.hxx:92
constexpr OUStringLiteral EMPTY
rtl::Reference< GalleryTransferable > m_xHelper
Definition: galbrws2.hxx:89
constexpr OUStringLiteral SVXGALLERYITEM_DRAWING
Definition: galleryitem.hxx:35
Size maPreviewSize
Definition: galbrws2.hxx:88
SfxBindings & GetBindings()
SAL_DLLPRIVATE void GetPreviewBitmapExAndStrings(sal_uInt32 nPos, BitmapEx &rBitmapEx, Size &rSize, OUString &rTitle, OUString &rPath)
Definition: galtheme.cxx:147
bool ChangeObjectPos(sal_uInt32 nOldPos, sal_uInt32 nNewPos)
Definition: galtheme.cxx:182
GalleryBrowser2(weld::Builder &rBuilder, Gallery *pGallery)
Definition: galbrws2.cxx:332
GalleryBrowserMode
Definition: galbrws2.hxx:33
css::uno::Sequence< css::beans::PropertyValue > Arguments
Definition: galbrws2.cxx:62
#define GRFILTER_FORMAT_DONTKNOW
SAL_DLLPRIVATE bool InsertTransferable(const css::uno::Reference< css::datatransfer::XTransferable > &rxTransferable, sal_uInt32 nInsertPos)
Definition: galtheme.cxx:533
SAL_DLLPRIVATE sal_uInt32 GetObjectCount() const
Definition: galtheme.hxx:82
bool GetGraphic(sal_uInt32 nPos, Graphic &rGraphic)
Definition: galtheme.cxx:311
#define DND_ACTION_LINK
OUString GetFilterName() const
Definition: galbrws2.cxx:1200
void ShowContextMenu(const CommandEvent &rCEvt)
Definition: galbrws2.cxx:488
GalleryBrowserMode GetMode() const
Definition: galbrws2.hxx:132
constexpr sal_uInt16 KEY_RETURN
const Point & GetMousePosPixel() const
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
void TogglePreview()
Definition: galbrws2.cxx:482
virtual OUString GetURL() const override
const vcl::KeyCode & GetKeyCode() const
weld::Widget * GetViewWindow() const
Definition: galbrws2.cxx:708
static SfxViewFrame * Current()
GalleryTheme * mpCurTheme
Definition: galbrws2.hxx:78
Reference< XDispatch > xDispatch
static void PreviewMedia(const INetURLObject &rURL)
Definition: galctrl.cxx:198
sal_Int8 ExecuteDrop(const ExecuteDropEvent &rEvt)
Definition: galbrws2.cxx:450
IMPL_LINK(GalleryBrowser2, PopupMenuHdl, const CommandEvent &, rCEvt, bool)
Definition: galbrws2.cxx:380
static void drawTransparenceBackground(vcl::RenderContext &rOut, const Point &rPos, const Size &rSize)
Definition: galctrl.cxx:275
void ReleaseTheme(GalleryTheme *pTheme, SfxListener &rListener)
Definition: gallery1.cxx:707
std::unique_ptr< GalleryIconView > mxIconView
Definition: galbrws2.hxx:79
constexpr OStringLiteral HID_GALLERY_WINDOW
Definition: helpids.h:34
constexpr tools::Long Height() const
void ImplUpdateInfoBar()
Definition: galbrws2.cxx:906
virtual void grab_focus()=0
sal_uInt32 ImplGetSelectedItemId(const Point *pSelPosPixel, Point &rSelPos)
Definition: galbrws2.cxx:921
INetProtocol GetProtocol() const
RET_OK
OUString GetFileExtension() const
void * p
Reference< XComponentContext > getProcessComponentContext()
QPRO_FUNC_TYPE nType
Sequence< sal_Int8 > aSeq
void ImplSelectItemId(sal_uInt32 nItemId)
Definition: galbrws2.cxx:977
IMPL_LINK_NOARG(GalleryBrowser2, RowActivatedHdl, weld::TreeView &, bool)
Definition: galbrws2.cxx:393
bool IsDropFormatSupported(SotClipboardFormatId nFormat) const
std::unique_ptr< weld::TreeView > mxListView
Definition: galbrws2.hxx:81
std::unique_ptr< GalleryPreview > mxPreview
Definition: galbrws2.hxx:83
INetURLObject GetURL() const
Definition: galbrws2.cxx:1190
css::uno::Reference< css::graphic::XGraphic > GetXGraphic() const
bool KeyInput(const KeyEvent &rEvt)
Definition: galbrws2.cxx:520
static GraphicFilter & GetGraphicFilter()
void SetMode(GalleryBrowserMode eMode)
Definition: galbrws2.cxx:627
constexpr sal_uInt16 KEY_I
constexpr sal_uInt16 KEY_T
constexpr sal_uInt16 KEY_P
css::util::URL TargetURL
Definition: galbrws2.cxx:61
const OUString & GetName() const
Definition: galtheme.cxx:777
constexpr sal_uInt16 KEY_DELETE
static TransferableDataHelper CreateFromClipboard(const css::uno::Reference< css::datatransfer::clipboard::XClipboard > &rClipboard)
bool IsReadOnly() const
Definition: galtheme.cxx:774
constexpr sal_uInt16 KEY_INSERT
const Size & GetSizePixel() const
constexpr OUStringLiteral SVXGALLERYITEM_GRAPHIC
Definition: galleryitem.hxx:36
css::uno::Reference< css::frame::XDispatch > Dispatch
Definition: galbrws2.cxx:63
const css::uno::Reference< css::datatransfer::XTransferable > & GetTransferable() const
bool ViewBoxHasFocus() const
Definition: galbrws2.cxx:515
css::uno::Reference< css::util::XURLTransformer > m_xTransformer
Definition: galbrws2.hxx:95
GalleryTheme * AcquireTheme(std::u16string_view rThemeName, SfxListener &rListener)
Definition: gallery1.cxx:693
sal_uInt16 GetImportFormatNumberForShortName(std::u16string_view rShortName)
static std::unique_ptr< weld::Builder > CreateBuilder(weld::Widget *pParent, const OUString &rUIFile, bool bMobile=false, sal_uInt64 nLOKWindowId=0)
GalleryItemFlags
Definition: galbrws2.hxx:47
Gallery * mpGallery
Definition: galbrws2.hxx:77
std::unique_ptr< SgaObject > AcquireObject(sal_uInt32 nPos)
Definition: galtheme.cxx:142
constexpr OStringLiteral HID_GALLERY_LISTVIEW
Definition: helpids.h:31
void ImplUpdateViews(sal_uInt16 nSelectionId)
Definition: galbrws2.cxx:774
void Execute(std::string_view rIdent)
Definition: galbrws2.cxx:1088
OUString sId