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 
54 
56 {
57  css::util::URL TargetURL;
58  css::uno::Sequence< css::beans::PropertyValue > Arguments;
59  css::uno::Reference< css::frame::XDispatch > Dispatch;
60 };
61 
62 IMPL_STATIC_LINK( GalleryBrowser2, AsyncDispatch_Impl, void*, p, void )
63 {
64  DispatchInfo* pDispatchInfo = static_cast<DispatchInfo*>(p);
65  if ( pDispatchInfo && pDispatchInfo->Dispatch.is() )
66  {
67  try
68  {
69  pDispatchInfo->Dispatch->dispatch( pDispatchInfo->TargetURL,
70  pDispatchInfo->Arguments );
71  }
72  catch ( const css::uno::Exception& )
73  {
74  }
75  }
76 
77  delete pDispatchInfo;
78 }
79 
80 namespace
81 {
82 
83 struct CommandInfo
84 {
85  css::util::URL URL;
86  css::uno::Reference< css::frame::XDispatch > Dispatch;
87 
88  explicit CommandInfo( const OUString &rURL )
89  {
90  URL.Complete = rURL;
91  }
92 };
93 
94 class GalleryThemePopup : public ::cppu::WeakImplHelper< css::frame::XStatusListener >
95 {
96 private:
97  const GalleryTheme* mpTheme;
98  sal_uInt32 mnObjectPos;
99  bool mbPreview;
100  std::unique_ptr<weld::Builder> mxBuilder;
101  std::unique_ptr<weld::Menu> mxPopupMenu;
102  std::unique_ptr<weld::Menu> mxBackgroundPopup;
103  GalleryBrowser2* mpBrowser;
104 
105  typedef std::map< int, CommandInfo > CommandInfoMap;
106  CommandInfoMap m_aCommandInfo;
107 
108  static void Execute( const CommandInfo &rCmdInfo,
109  const css::uno::Sequence< css::beans::PropertyValue > &rArguments );
110 
111  void MenuSelectHdl(const OString& rIdent);
112  void BackgroundMenuSelectHdl(sal_uInt16 nId);
113 public:
114  GalleryThemePopup(weld::Widget* pParent,
115  const GalleryTheme* pTheme,
116  sal_uInt32 nObjectPos,
117  bool bPreview,
118  GalleryBrowser2* pBrowser);
119 
120  void ExecutePopup(weld::Widget* pParent, const ::Point &rPos);
121 
122  virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent &rEvent) override;
123  virtual void SAL_CALL disposing( const css::lang::EventObject &rSource) override;
124 };
125 
126 
127 GalleryThemePopup::GalleryThemePopup(
128  weld::Widget* pParent,
129  const GalleryTheme* pTheme,
130  sal_uInt32 nObjectPos,
131  bool bPreview,
132  GalleryBrowser2* pBrowser )
133  : mpTheme( pTheme )
134  , mnObjectPos( nObjectPos )
135  , mbPreview( bPreview )
136  , mxBuilder(Application::CreateBuilder(pParent, "svx/ui/gallerymenu2.ui"))
137  , mxPopupMenu(mxBuilder->weld_menu("menu"))
138  , mxBackgroundPopup(mxBuilder->weld_menu("backgroundmenu"))
139  , mpBrowser( pBrowser )
140 {
141  // SID_GALLERY_ENABLE_ADDCOPY
142  m_aCommandInfo.emplace(
143  SID_GALLERY_ENABLE_ADDCOPY,
144  CommandInfo( ".uno:GalleryEnableAddCopy" ));
145  // SID_GALLERY_BG_BRUSH
146  m_aCommandInfo.emplace(
147  SID_GALLERY_BG_BRUSH,
148  CommandInfo( ".uno:BackgroundImage" ));
149  // SID_GALLERY_FORMATS
150  m_aCommandInfo.emplace(
151  SID_GALLERY_FORMATS,
152  CommandInfo( ".uno:InsertGalleryPic" ));
153 
154 }
155 
156 void SAL_CALL GalleryThemePopup::statusChanged(
157  const css::frame::FeatureStateEvent &rEvent )
158 {
159  const OUString &rURL = rEvent.FeatureURL.Complete;
160  if ( rURL == ".uno:GalleryEnableAddCopy" )
161  {
162  if ( !rEvent.IsEnabled )
163  {
164  mxPopupMenu->set_visible("add", false);
165  }
166  }
167  else if ( rURL == ".uno:BackgroundImage" )
168  {
169  mxBackgroundPopup->clear();
170  if ( rEvent.IsEnabled )
171  {
172  OUString sItem;
173  css::uno::Sequence< OUString > sItems;
174  if ( ( rEvent.State >>= sItem ) && sItem.getLength() )
175  {
176  mxBackgroundPopup->append(OUString::number(1), sItem);
177  }
178  else if ( ( rEvent.State >>= sItems ) && sItems.hasElements() )
179  {
180  sal_uInt16 nId = 1;
181  for ( const OUString& rStr : std::as_const(sItems) )
182  {
183  mxBackgroundPopup->append(OUString::number(nId), rStr);
184  nId++;
185  }
186  }
187  }
188  }
189 }
190 
191 void SAL_CALL GalleryThemePopup::disposing(
192  const css::lang::EventObject &/*rSource*/)
193 {
194 }
195 
196 void GalleryThemePopup::Execute(
197  const CommandInfo &rCmdInfo,
198  const css::uno::Sequence< css::beans::PropertyValue > &rArguments )
199 {
200  if ( rCmdInfo.Dispatch.is() )
201  {
202  std::unique_ptr<DispatchInfo> pInfo(new DispatchInfo);
203  pInfo->TargetURL = rCmdInfo.URL;
204  pInfo->Arguments = rArguments;
205  pInfo->Dispatch = rCmdInfo.Dispatch;
206 
208  LINK( nullptr, GalleryBrowser2, AsyncDispatch_Impl), pInfo.get() ) )
209  pInfo.release();
210  }
211 }
212 
213 void GalleryThemePopup::ExecutePopup(weld::Widget* pParent, const ::Point &rPos)
214 {
215  css::uno::Reference< css::frame::XStatusListener > xThis( this );
216 
217  const SgaObjKind eObjKind = mpTheme->GetObjectKind( mnObjectPos );
219 
220  const_cast< GalleryTheme* >( mpTheme )->GetURL( mnObjectPos, aURL );
221  const bool bValidURL = ( aURL.GetProtocol() != INetProtocol::NotValid );
222 
223  mxPopupMenu->set_visible("add", bValidURL && SgaObjKind::Sound != eObjKind);
224 
225  mxPopupMenu->set_visible("preview", bValidURL);
226  mxPopupMenu->set_active("preview", mbPreview);
227 
228  if( mpTheme->IsReadOnly() || !mpTheme->GetObjectCount() )
229  {
230  mxPopupMenu->set_visible("delete", false);
231  mxPopupMenu->set_visible("title", false);
232  if (mpTheme->IsReadOnly())
233  mxPopupMenu->set_visible("paste", false);
234 
235  if (!mpTheme->GetObjectCount())
236  mxPopupMenu->set_visible("copy", false);
237  }
238  else
239  {
240  mxPopupMenu->set_visible("delete", !mbPreview);
241  mxPopupMenu->set_visible("title", true);
242  mxPopupMenu->set_visible("copy", true);
243  mxPopupMenu->set_visible("paste", true);
244  }
245 
246  // update status
247  css::uno::Reference< css::frame::XDispatchProvider> xDispatchProvider(
248  GalleryBrowser2::GetFrame(), css::uno::UNO_QUERY );
249  css::uno::Reference< css::util::XURLTransformer > xTransformer(
250  mpBrowser->GetURLTransformer() );
251  for ( auto& rInfo : m_aCommandInfo )
252  {
253  try
254  {
255  CommandInfo &rCmdInfo = rInfo.second;
256  if ( xTransformer.is() )
257  xTransformer->parseStrict( rCmdInfo.URL );
258 
259  if ( xDispatchProvider.is() )
260  {
261  rCmdInfo.Dispatch = xDispatchProvider->queryDispatch(
262  rCmdInfo.URL,
263  "_self",
264  css::frame::FrameSearchFlag::SELF );
265  }
266 
267  if ( rCmdInfo.Dispatch.is() )
268  {
269  rCmdInfo.Dispatch->addStatusListener( this, rCmdInfo.URL );
270  rCmdInfo.Dispatch->removeStatusListener( this, rCmdInfo.URL );
271  }
272  }
273  catch ( ... )
274  {}
275  }
276 
277  if( !mxBackgroundPopup->n_children() || ( eObjKind == SgaObjKind::SvDraw ) || ( eObjKind == SgaObjKind::Sound ) )
278  mxPopupMenu->set_visible("background", false);
279  else
280  mxPopupMenu->set_visible("background", true);
281 
282  MenuSelectHdl(mxPopupMenu->popup_at_rect(pParent, tools::Rectangle(rPos, Size(1,1))));
283 }
284 
285 void GalleryThemePopup::MenuSelectHdl(const OString& rIdent)
286 {
287  if (rIdent.isEmpty())
288  return;
289 
290  sal_uInt16 nSubMenuId = rIdent.toUInt32();
291  if (nSubMenuId)
292  {
293  BackgroundMenuSelectHdl(nSubMenuId-1);
294  return;
295  }
296 
297  if (rIdent == "add")
298  {
299  const CommandInfoMap::const_iterator it = m_aCommandInfo.find( SID_GALLERY_FORMATS );
300  if (it != m_aCommandInfo.end())
301  mpBrowser->DispatchAdd(it->second.Dispatch, it->second.URL);
302  }
303  else
304  mpBrowser->Execute(rIdent);
305 }
306 
307 void GalleryThemePopup::BackgroundMenuSelectHdl(sal_uInt16 nPos)
308 {
309  OUString aURL( mpBrowser->GetURL().GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
310  OUString aFilterName( mpBrowser->GetFilterName() );
311 
312  css::uno::Sequence< css::beans::PropertyValue > aArgs( 6 );
313  aArgs[0].Name = "Background.Transparent";
314  aArgs[0].Value <<= sal_Int32( 0 ); // 0 - 100
315  aArgs[1].Name = "Background.BackColor";
316  aArgs[1].Value <<= sal_Int32( - 1 );
317  aArgs[2].Name = "Background.URL";
318  aArgs[2].Value <<= aURL;
319  aArgs[3].Name = "Background.Filtername"; // FIXME should be FilterName
320  aArgs[3].Value <<= aFilterName;
321  aArgs[4].Name = "Background.Position";
322  aArgs[4].Value <<= css::style::GraphicLocation_TILED;
323  aArgs[5].Name = "Position";
324  aArgs[5].Value <<= nPos;
325 
326  const CommandInfoMap::const_iterator it = m_aCommandInfo.find( SID_GALLERY_BG_BRUSH );
327  if ( it != m_aCommandInfo.end() )
328  Execute( it->second, aArgs );
329 }
330 
331 } // end anonymous namespace
332 
334  : mpGallery(pGallery)
335  , mpCurTheme(nullptr)
336  , mxIconView(new GalleryIconView(this, rBuilder.weld_scrolled_window("galleryscroll")))
337  , mxIconViewWin(new weld::CustomWeld(rBuilder, "gallery", *mxIconView))
338  , mxListView(rBuilder.weld_tree_view("gallerylist"))
339  , mxPreview(new GalleryPreview(this, rBuilder.weld_scrolled_window("previewscroll")))
340  , mxPreviewWin(new weld::CustomWeld(rBuilder, "preview", *mxPreview))
341  , mxIconButton(rBuilder.weld_toggle_button("icon"))
342  , mxListButton(rBuilder.weld_toggle_button("list"))
343  , mxInfoBar(rBuilder.weld_label("label"))
344  , mxDev(mxListView->create_virtual_device())
345  , maPreviewSize(28, 28)
346  , mnCurActionPos ( 0xffffffff )
348  , meLastMode ( GALLERYBROWSERMODE_NONE )
349 {
351 
353 
354  int nHeight = mxListView->get_height_rows(10);
355  mxListView->set_size_request(-1, nHeight);
356  mxIconView->set_size_request(-1, nHeight);
357 
358  m_xTransformer.set(
359  m_xContext->getServiceManager()->createInstanceWithContext(
360  "com.sun.star.util.URLTransformer", m_xContext ),
361  css::uno::UNO_QUERY );
362 
363  mxIconButton->set_help_id(HID_GALLERY_ICONVIEW);
364  mxListButton->set_help_id(HID_GALLERY_LISTVIEW);
365 
366  mxIconButton->connect_toggled( LINK( this, GalleryBrowser2, SelectTbxHdl ) );
367  mxListButton->connect_toggled( LINK( this, GalleryBrowser2, SelectTbxHdl ) );
368 
369  mxIconView->SetSelectHdl( LINK( this, GalleryBrowser2, SelectObjectValueSetHdl ) );
370  mxListView->connect_visible_range_changed(LINK(this, GalleryBrowser2, VisRowsScrolledHdl));
371  mxListView->connect_size_allocate(LINK(this, GalleryBrowser2, SizeAllocHdl));
372  mxListView->connect_changed( LINK( this, GalleryBrowser2, SelectObjectHdl ) );
373  mxListView->connect_popup_menu(LINK(this, GalleryBrowser2, PopupMenuHdl));
374  mxListView->connect_key_press(LINK(this, GalleryBrowser2, KeyInputHdl));
375  mxListView->connect_row_activated(LINK(this, GalleryBrowser2, RowActivatedHdl));
376  mxDragDropTargetHelper.reset(new GalleryDragDrop(this, mxListView->get_drop_target()));
377  mxListView->connect_drag_begin(LINK(this, GalleryBrowser2, DragBeginHdl));
378 
379  mxListView->set_help_id(HID_GALLERY_WINDOW);
380 
382 }
383 
384 IMPL_LINK(GalleryBrowser2, PopupMenuHdl, const CommandEvent&, rCEvt, bool)
385 {
386  if (rCEvt.GetCommand() != CommandEventId::ContextMenu)
387  return false;
388  ShowContextMenu(rCEvt);
389  return true;
390 }
391 
392 IMPL_LINK(GalleryBrowser2, KeyInputHdl, const KeyEvent&, rKEvt, bool)
393 {
394  return KeyInput(rKEvt);
395 }
396 
398 {
399  TogglePreview();
400  return true;
401 }
402 
404 {
405  if (mpCurTheme)
406  mpGallery->ReleaseTheme( mpCurTheme, *this );
407 }
408 
410 {
411  const GalleryHint& rGalleryHint = static_cast<const GalleryHint&>(rHint);
412 
413  switch( rGalleryHint.GetType() )
414  {
416  {
418  SetMode( meLastMode );
419 
420  ImplUpdateViews( reinterpret_cast<size_t>(rGalleryHint.GetData1()) + 1 );
421  }
422  break;
423 
424  default:
425  break;
426  }
427 }
428 
430 {
431  sal_Int8 nRet = DND_ACTION_NONE;
432 
433  if( mpCurTheme && !mpCurTheme->IsReadOnly() )
434  {
435  if( !mpCurTheme->IsDragging() )
436  {
437  if( rTarget.IsDropFormatSupported( SotClipboardFormatId::DRAWING ) ||
438  rTarget.IsDropFormatSupported( SotClipboardFormatId::FILE_LIST ) ||
439  rTarget.IsDropFormatSupported( SotClipboardFormatId::SIMPLE_FILE ) ||
440  rTarget.IsDropFormatSupported( SotClipboardFormatId::SVXB ) ||
441  rTarget.IsDropFormatSupported( SotClipboardFormatId::GDIMETAFILE ) ||
442  rTarget.IsDropFormatSupported( SotClipboardFormatId::BITMAP ) )
443  {
444  nRet = DND_ACTION_COPY;
445  }
446  }
447  else
448  nRet = DND_ACTION_COPY;
449  }
450 
451  return nRet;
452 }
453 
455 {
456  sal_Int8 nRet = DND_ACTION_NONE;
457 
458  if( mpCurTheme )
459  {
460  Point aSelPos;
461  const sal_uInt32 nItemId = ImplGetSelectedItemId( &rEvt.maPosPixel, aSelPos );
462  const sal_uInt32 nInsertPos = (nItemId ? (nItemId - 1) : mpCurTheme->GetObjectCount());
463 
464  if( mpCurTheme->IsDragging() )
465  mpCurTheme->ChangeObjectPos( mpCurTheme->GetDragPos(), nInsertPos );
466  else
467  nRet = mpCurTheme->InsertTransferable( rEvt.maDropEvent.Transferable, nInsertPos ) ? 1 : 0;
468  }
469 
470  return nRet;
471 }
472 
474 {
475  if (!mpCurTheme)
476  return true;
477  return m_xHelper->StartDrag();
478 }
479 
480 IMPL_LINK(GalleryBrowser2, DragBeginHdl, bool&, rUnsetDragIcon, bool)
481 {
482  rUnsetDragIcon = false;
483  return StartDrag();
484 }
485 
487 {
490 }
491 
493 {
494  Point aMousePos = rCEvt.GetMousePosPixel();
495  Point aSelPos;
496  const sal_uInt32 nItemId = ImplGetSelectedItemId( rCEvt.IsMouseEvent() ? &aMousePos : nullptr, aSelPos );
497 
498  if( mpCurTheme && nItemId && ( nItemId <= mpCurTheme->GetObjectCount() ) )
499  {
500  ImplSelectItemId( nItemId );
501 
502  css::uno::Reference< css::frame::XFrame > xFrame( GetFrame() );
503  if ( xFrame.is() )
504  {
505  weld::Widget* pParent = GetViewWindow();
506  mnCurActionPos = nItemId - 1;
508  new GalleryThemePopup(
509  pParent,
510  mpCurTheme,
513  this ) );
514  xPopup->ExecutePopup(pParent, aSelPos);
515  }
516  }
517 }
518 
520 {
521  return mxIconButton->has_focus() || mxListButton->has_focus();
522 }
523 
525 {
526  Point aSelPos;
527  const sal_uInt32 nItemId = ImplGetSelectedItemId( nullptr, aSelPos );
528  bool bRet = false;
529 
530  if (!ViewBoxHasFocus() && nItemId && mpCurTheme)
531  {
532  OString sExecuteIdent;
533  INetURLObject aURL;
534 
535  mpCurTheme->GetURL( nItemId - 1, aURL );
536 
537  const bool bValidURL = ( aURL.GetProtocol() != INetProtocol::NotValid );
538  bool bPreview = bValidURL;
539  bool bDelete = false;
540  bool bTitle = false;
541 
543  {
544  bDelete = ( GALLERYBROWSERMODE_PREVIEW != GetMode() );
545  bTitle = true;
546  }
547 
548  switch( rKEvt.GetKeyCode().GetCode() )
549  {
550  case KEY_SPACE:
551  case KEY_RETURN:
552  case KEY_P:
553  {
554  if( bPreview )
555  {
556  TogglePreview();
557  bRet = true;
558  }
559  }
560  break;
561 
562  case KEY_INSERT:
563  case KEY_I:
564  {
565  // Inserting a gallery item in the document must be dispatched
566  if( bValidURL )
567  {
568  DispatchAdd(css::uno::Reference<css::frame::XDispatch>(), css::util::URL());
569  return true;
570  }
571  }
572  break;
573 
574  case KEY_DELETE:
575  case KEY_D:
576  {
577  if( bDelete )
578  sExecuteIdent = "delete";
579  }
580  break;
581 
582  case KEY_T:
583  {
584  if( bTitle )
585  sExecuteIdent = "title";
586  }
587  break;
588 
589  default:
590  break;
591  }
592 
593  if (!sExecuteIdent.isEmpty())
594  {
595  Execute(sExecuteIdent);
596  bRet = true;
597  }
598  }
599 
600  return bRet;
601 }
602 
603 void GalleryBrowser2::SelectTheme( const OUString& rThemeName )
604 {
605  if( mpCurTheme )
606  mpGallery->ReleaseTheme( mpCurTheme, *this );
607 
608  mpCurTheme = mpGallery->AcquireTheme( rThemeName, *this );
609 
610  m_xHelper.set(new GalleryTransferable(mpCurTheme, 0, true));
612  mxListView->enable_drag_source(xHelper, DND_ACTION_COPY | DND_ACTION_LINK);
613  mxIconView->SetDragDataTransferrable(xHelper, DND_ACTION_COPY | DND_ACTION_LINK);
614  mxPreview->SetDragDataTransferrable(xHelper, DND_ACTION_COPY | DND_ACTION_LINK);
615 
616  mxIconView->SetTheme(mpCurTheme);
617  mxPreview->SetTheme(mpCurTheme);
618 
620  meMode = meLastMode;
621 
622  ImplUpdateViews( 1 );
623 
624  bool bIconMode = (GALLERYBROWSERMODE_ICON == GetMode());
625  mxIconButton->set_sensitive(true);
626  mxListButton->set_sensitive(true);
627  mxIconButton->set_active(bIconMode);
628  mxListButton->set_active(!bIconMode);
629 }
630 
632 {
633  if( GetMode() != eMode )
634  {
635  meLastMode = GetMode();
636 
637  switch( eMode )
638  {
640  {
641  mxListView->hide();
642 
643  mxPreview->Hide();
644  mxPreview->SetGraphic( Graphic() );
646 
647  mxIconView->Show();
648 
649  mxIconButton->set_sensitive(true);
650  mxListButton->set_sensitive(true);
651 
652  mxIconButton->set_active(true);
653  mxListButton->set_active(false);
654  }
655  break;
656 
658  {
659  mxIconView->Hide();
660 
661  mxPreview->Hide();
662  mxPreview->SetGraphic( Graphic() );
664 
665  mxListView->show();
666  UpdateRows(true);
667 
668  mxIconButton->set_sensitive(true);
669  mxListButton->set_sensitive(true);
670 
671  mxIconButton->set_active(false);
672  mxListButton->set_active(true);
673  }
674  break;
675 
677  {
678  Graphic aGraphic;
679  Point aSelPos;
680  const sal_uInt32 nItemId = ImplGetSelectedItemId( nullptr, aSelPos );
681 
682  if( nItemId )
683  {
684  const sal_uInt32 nPos = nItemId - 1;
685 
686  mxIconView->Hide();
687  mxListView->hide();
688 
689  if( mpCurTheme )
690  mpCurTheme->GetGraphic( nPos, aGraphic );
691 
692  mxPreview->SetGraphic( aGraphic );
693  mxPreview->Show();
694 
697 
698  mxIconButton->set_sensitive(false);
699  mxListButton->set_sensitive(false);
700  }
701  }
702  break;
703 
704  default:
705  break;
706  }
707 
709  }
710 }
711 
713 {
714  weld::Widget* pRet;
715 
716  switch( GetMode() )
717  {
718  case GALLERYBROWSERMODE_LIST: pRet = mxListView.get(); break;
719  case GALLERYBROWSERMODE_PREVIEW: pRet = mxPreview->GetDrawingArea(); break;
720 
721  default:
722  pRet = mxIconView->GetDrawingArea();
723  break;
724  }
725 
726  return pRet;
727 }
728 
730 {
731  if( mpCurTheme )
732  {
733  Point aSelPos;
734  const sal_uInt32 nItemId = ImplGetSelectedItemId( nullptr, aSelPos );
735 
736  if( nItemId )
737  {
738  sal_uInt32 nNewItemId = nItemId;
739 
740  switch( eTravel )
741  {
742  case GalleryBrowserTravel::First: nNewItemId = 1; break;
743  case GalleryBrowserTravel::Last: nNewItemId = mpCurTheme->GetObjectCount(); break;
744  case GalleryBrowserTravel::Previous: nNewItemId--; break;
745  case GalleryBrowserTravel::Next: nNewItemId++; break;
746  default:
747  break;
748  }
749 
750  if( nNewItemId < 1 )
751  nNewItemId = 1;
752  else if( nNewItemId > mpCurTheme->GetObjectCount() )
753  nNewItemId = mpCurTheme->GetObjectCount();
754 
755  if( nNewItemId != nItemId )
756  {
757  ImplSelectItemId( nNewItemId );
759 
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  }
775  }
776 }
777 
778 void GalleryBrowser2::ImplUpdateViews( sal_uInt16 nSelectionId )
779 {
780  mxIconView->Hide();
781  mxListView->hide();
782  mxPreview->Hide();
783 
784  mxIconView->Clear();
785  mxListView->clear();
786 
787  if( mpCurTheme )
788  {
789  const int nAlwaysUpToDate = 15;
790 
791  mxListView->freeze();
792 
793  OUString sCreateOnDemand;
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), sCreateOnDemand); // 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.IsTransparent())
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()))
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(const OString &rIdent)
1098 {
1099  Point aSelPos;
1100  const sal_uInt32 nItemId = ImplGetSelectedItemId( nullptr, aSelPos );
1101 
1102  if( mpCurTheme && nItemId )
1103  {
1104  mnCurActionPos = nItemId - 1;
1105 
1106  if (rIdent == "preview")
1108  else if (rIdent == "delete")
1109  {
1110  if (!mpCurTheme->IsReadOnly())
1111  {
1112  std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetViewWindow(), "svx/ui/querydeleteobjectdialog.ui"));
1113  std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("QueryDeleteObjectDialog"));
1114  if (xQuery->run() == RET_YES)
1115  {
1117  }
1118  }
1119  }
1120  else if (rIdent == "title")
1121  {
1122  std::unique_ptr<SgaObject> pObj = mpCurTheme->AcquireObject( mnCurActionPos );
1123 
1124  if( pObj )
1125  {
1126  const OUString aOldTitle( GetItemText( *pObj, GalleryItemFlags::Title ) );
1127 
1130  if( aDlg->Execute() == RET_OK )
1131  {
1132  OUString aNewTitle( aDlg->GetTitle() );
1133 
1134  if( ( aNewTitle.isEmpty() && !pObj->GetTitle().isEmpty() ) || ( aNewTitle != aOldTitle ) )
1135  {
1136  if( aNewTitle.isEmpty() )
1137  aNewTitle = "__<empty>__";
1138 
1139  pObj->SetTitle( aNewTitle );
1140  mpCurTheme->InsertObject( *pObj );
1141  }
1142  }
1143  }
1144  }
1145  else if (rIdent == "copy")
1146  {
1148  }
1149  else if (rIdent == "paste")
1150  {
1151  if( !mpCurTheme->IsReadOnly() )
1152  {
1155  }
1156  }
1157  }
1158 }
1159 
1160 OUString GalleryBrowser2::GetItemText( const SgaObject& rObj, GalleryItemFlags nItemTextFlags )
1161 {
1162  OUString aRet;
1163 
1164  const INetURLObject& aURL(rObj.GetURL());
1165 
1166  if( nItemTextFlags & GalleryItemFlags::Title )
1167  {
1168  OUString aTitle( rObj.GetTitle() );
1169 
1170  if( aTitle.isEmpty() )
1172 
1173  if( aTitle.isEmpty() )
1174  {
1176  aTitle = aTitle.copy( aTitle.lastIndexOf('/')+1 );
1177  }
1178 
1179  aRet += aTitle;
1180  }
1181 
1182  if( nItemTextFlags & GalleryItemFlags::Path )
1183  {
1184  const OUString aPath( aURL.getFSysPath( FSysStyle::Detect ) );
1185 
1186  if( !aPath.isEmpty() && ( nItemTextFlags & GalleryItemFlags::Title ) )
1187  aRet += " (";
1188 
1189  aRet += aURL.getFSysPath( FSysStyle::Detect );
1190 
1191  if( !aPath.isEmpty() && ( nItemTextFlags & GalleryItemFlags::Title ) )
1192  aRet += ")";
1193  }
1194 
1195  return aRet;
1196 }
1197 
1199 {
1200  INetURLObject aURL;
1201 
1202  if( mpCurTheme && mnCurActionPos != 0xffffffff )
1204 
1205  return aURL;
1206 }
1207 
1209 {
1210  OUString aFilterName;
1211 
1212  if( mpCurTheme && mnCurActionPos != 0xffffffff )
1213  {
1214  const SgaObjKind eObjKind = mpCurTheme->GetObjectKind( mnCurActionPos );
1215 
1216  if( ( SgaObjKind::Bitmap == eObjKind ) || ( SgaObjKind::Animation == eObjKind ) )
1217  {
1219  INetURLObject aURL;
1220  mpCurTheme->GetURL( mnCurActionPos, aURL );
1221  sal_uInt16 nFilter = rFilter.GetImportFormatNumberForShortName(aURL.GetFileExtension());
1222 
1223  if( GRFILTER_FORMAT_DONTKNOW != nFilter )
1224  aFilterName = rFilter.GetImportFormatName( nFilter );
1225  }
1226  }
1227 
1228  return aFilterName;
1229 }
1230 
1231 IMPL_LINK_NOARG(GalleryBrowser2, SelectObjectValueSetHdl, ValueSet*, void)
1232 {
1233  ImplUpdateSelection();
1234 }
1235 
1237 {
1238  ImplUpdateSelection();
1239 }
1240 
1241 IMPL_LINK(GalleryBrowser2, SelectTbxHdl, weld::ToggleButton&, rBox, void)
1242 {
1243  if (&rBox == mxIconButton.get())
1244  SetMode(rBox.get_active() ? GALLERYBROWSERMODE_ICON : GALLERYBROWSERMODE_LIST);
1245  else if (&rBox == mxListButton.get())
1246  SetMode(rBox.get_active() ? GALLERYBROWSERMODE_LIST : GALLERYBROWSERMODE_ICON);
1247 }
1248 
1249 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
long Width() const
SAL_DLLPRIVATE bool IsDragging() const
Definition: galtheme.hxx:146
void Execute(const OString &rIdent)
Definition: galbrws2.cxx:1097
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:360
const css::datatransfer::dnd::DropTargetDropEvent maDropEvent
static css::uno::Reference< css::frame::XFrame > GetFrame()
Definition: galbrws2.cxx:992
GalleryTheme * AcquireTheme(const OUString &rThemeName, SfxListener &rListener)
Definition: gallery1.cxx:739
#define DND_ACTION_COPY
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: galbrws2.cxx:409
GalleryBrowserMode meMode
Definition: galbrws2.hxx:92
void SelectTheme(const OUString &rThemeName)
Definition: galbrws2.cxx:603
bool IsNone() const
bool StartDrag()
Definition: galbrws2.cxx:473
long Height() const
SAL_DLLPRIVATE const INetURLObject & GetObjectURL(sal_uInt32 nPos) const
Definition: galtheme.hxx:176
signed char sal_Int8
#define SVXGALLERYITEM_TYPE
Definition: galleryitem.hxx:32
void DrawBitmapEx(const Point &rDestPt, const BitmapEx &rBitmapEx)
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:23
static OUString GetItemText(const SgaObject &rObj, GalleryItemFlags nItemTextFlags)
Definition: galbrws2.cxx:1160
#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
std::unique_ptr< weld::ToggleButton > mxIconButton
Definition: galbrws2.hxx:85
void RemoveObject(sal_uInt32 nPos)
Definition: galtheme.cxx:430
sal_Int16 nId
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
sal_uInt16 GetCode() const
css::uno::Reference< css::datatransfer::clipboard::XClipboard > VCL_DLLPUBLIC GetSystemClipboard()
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:420
SAL_DLLPRIVATE SgaObjKind GetObjectKind(sal_uInt32 nPos) const
Definition: galtheme.hxx:169
virtual VclPtr< AbstractTitleDialog > CreateTitleDialog(weld::Widget *pParent, const OUString &rOldText)=0
constexpr sal_uInt16 KEY_SPACE
void ImplUpdateSelection()
Definition: galbrws2.cxx:917
SAL_DLLPRIVATE void GetPreviewBitmapExAndStrings(sal_uInt32 nPos, BitmapEx &rBitmapEx, Size &rSize, OUString &rTitle, OUString &rPath) const
Definition: galtheme.cxx:410
css::uno::Reference< css::graphic::XGraphic > GetXGraphic() const
std::unique_ptr< weld::ToggleButton > mxListButton
Definition: galbrws2.hxx:86
SAL_DLLPRIVATE bool GetURL(sal_uInt32 nPos, INetURLObject &rURL)
Definition: galtheme.cxx:1037
std::unique_ptr< GalleryDragDrop > mxDragDropTargetHelper
Definition: galbrws2.hxx:82
RET_YES
#define HID_GALLERY_WINDOW
Definition: helpids.h:32
SAL_DLLPRIVATE sal_uInt32 GetDragPos() const
Definition: galtheme.hxx:156
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:62
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:193
bool IsEmpty() const
GalleryHintType GetType() const
Definition: galmisc.hxx:190
SgaObjKind
Definition: galmisc.hxx:54
OUString getFSysPath(FSysStyle eStyle, sal_Unicode *pDelimiter=nullptr) const
void UpdateRows(bool bVisibleOnly)
Definition: galbrws2.cxx:828
void Travel(GalleryBrowserTravel eTravel)
Definition: galbrws2.cxx:729
int i
GalleryBrowserMode meLastMode
Definition: galbrws2.hxx:93
rtl::Reference< GalleryTransferable > m_xHelper
Definition: galbrws2.hxx:90
Size maPreviewSize
Definition: galbrws2.hxx:89
bool SetOutputSizePixel(const Size &rNewSize, bool bErase=true)
SfxBindings & GetBindings()
SAL_DLLPRIVATE bool ChangeObjectPos(sal_uInt32 nOldPos, sal_uInt32 nNewPos)
Definition: galtheme.cxx:449
GalleryBrowser2(weld::Builder &rBuilder, Gallery *pGallery)
Definition: galbrws2.cxx:333
sal_uInt16 GetImportFormatNumberForShortName(const OUString &rShortName)
GalleryBrowserMode
Definition: galbrws2.hxx:33
css::uno::Sequence< css::beans::PropertyValue > Arguments
Definition: galbrws2.cxx:58
#define GRFILTER_FORMAT_DONTKNOW
SAL_DLLPRIVATE bool InsertTransferable(const css::uno::Reference< css::datatransfer::XTransferable > &rxTransferable, sal_uInt32 nInsertPos)
Definition: galtheme.cxx:1122
SAL_DLLPRIVATE sal_uInt32 GetObjectCount() const
Definition: galtheme.hxx:123
VclPtr< VirtualDevice > mxDev
Definition: galbrws2.hxx:88
bool GetGraphic(sal_uInt32 nPos, Graphic &rGraphic)
Definition: galtheme.cxx:727
#define DND_ACTION_LINK
OUString GetFilterName() const
Definition: galbrws2.cxx:1208
bool IsTransparent() const
void ShowContextMenu(const CommandEvent &rCEvt)
Definition: galbrws2.cxx:492
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:486
const vcl::KeyCode & GetKeyCode() const
SAL_DLLPRIVATE void CopyToClipboard(sal_uInt32 nPos)
Definition: galtheme.cxx:1219
#define SVXGALLERYITEM_ARGNAME
Definition: galleryitem.hxx:38
weld::Widget * GetViewWindow() const
Definition: galbrws2.cxx:712
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:454
IMPL_LINK(GalleryBrowser2, PopupMenuHdl, const CommandEvent &, rCEvt, bool)
Definition: galbrws2.cxx:384
static void drawTransparenceBackground(vcl::RenderContext &rOut, const Point &rPos, const Size &rSize)
Definition: galctrl.cxx:275
sal_Int8 AcceptDrop(DropTargetHelper &rTarget)
Definition: galbrws2.cxx:429
void ReleaseTheme(GalleryTheme *pTheme, SfxListener &rListener)
Definition: gallery1.cxx:753
std::unique_ptr< GalleryIconView > mxIconView
Definition: galbrws2.hxx:79
void ImplUpdateInfoBar()
Definition: galbrws2.cxx:910
virtual void grab_focus()=0
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:397
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:1198
bool KeyInput(const KeyEvent &rEvt)
Definition: galbrws2.cxx:524
OUString sId
static GraphicFilter & GetGraphicFilter()
void SetMode(GalleryBrowserMode eMode)
Definition: galbrws2.cxx:631
static weld::Builder * CreateBuilder(weld::Widget *pParent, const OUString &rUIFile)
constexpr sal_uInt16 KEY_I
constexpr sal_uInt16 KEY_T
constexpr sal_uInt16 KEY_P
css::util::URL TargetURL
Definition: galbrws2.cxx:57
const OUString & GetName() const
Definition: galtheme.cxx:1466
constexpr sal_uInt16 KEY_DELETE
static TransferableDataHelper CreateFromClipboard(const css::uno::Reference< css::datatransfer::clipboard::XClipboard > &rClipboard)
bool IsReadOnly() const
Definition: galtheme.cxx:1458
constexpr sal_uInt16 KEY_INSERT
const Size & GetSizePixel() const
css::uno::Reference< css::frame::XDispatch > Dispatch
Definition: galbrws2.cxx:59
#define HID_GALLERY_LISTVIEW
Definition: helpids.h:29
const css::uno::Reference< css::datatransfer::XTransferable > & GetTransferable() const
bool ViewBoxHasFocus() const
Definition: galbrws2.cxx:519
css::uno::Reference< css::util::XURLTransformer > m_xTransformer
Definition: galbrws2.hxx:96
Reference< XGraphic > xGraphic
GalleryItemFlags
Definition: galbrws2.hxx:47
Gallery * mpGallery
Definition: galbrws2.hxx:77
std::unique_ptr< SgaObject > AcquireObject(sal_uInt32 nPos)
Definition: galtheme.cxx:405
void ImplUpdateViews(sal_uInt16 nSelectionId)
Definition: galbrws2.cxx:778