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