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", true)))
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  return;
500 
501  ImplSelectItemId( nItemId );
502 
503  css::uno::Reference< css::frame::XFrame > xFrame( GetFrame() );
504  if ( !xFrame.is() )
505  return;
506 
507  weld::Widget* pParent = GetViewWindow();
508  mnCurActionPos = nItemId - 1;
510  new GalleryThemePopup(
511  pParent,
512  mpCurTheme,
515  this ) );
516  xPopup->ExecutePopup(pParent, aSelPos);
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  return;
635 
636  meLastMode = GetMode();
637 
638  switch( eMode )
639  {
641  {
642  mxListView->hide();
643 
644  mxPreview->Hide();
645  mxPreview->SetGraphic( Graphic() );
647 
648  mxIconView->Show();
649 
650  mxIconButton->set_sensitive(true);
651  mxListButton->set_sensitive(true);
652 
653  mxIconButton->set_active(true);
654  mxListButton->set_active(false);
655  }
656  break;
657 
659  {
660  mxIconView->Hide();
661 
662  mxPreview->Hide();
663  mxPreview->SetGraphic( Graphic() );
665 
666  mxListView->show();
667  UpdateRows(true);
668 
669  mxIconButton->set_sensitive(true);
670  mxListButton->set_sensitive(true);
671 
672  mxIconButton->set_active(false);
673  mxListButton->set_active(true);
674  }
675  break;
676 
678  {
679  Graphic aGraphic;
680  Point aSelPos;
681  const sal_uInt32 nItemId = ImplGetSelectedItemId( nullptr, aSelPos );
682 
683  if( nItemId )
684  {
685  const sal_uInt32 nPos = nItemId - 1;
686 
687  mxIconView->Hide();
688  mxListView->hide();
689 
690  if( mpCurTheme )
691  mpCurTheme->GetGraphic( nPos, aGraphic );
692 
693  mxPreview->SetGraphic( aGraphic );
694  mxPreview->Show();
695 
698 
699  mxIconButton->set_sensitive(false);
700  mxListButton->set_sensitive(false);
701  }
702  }
703  break;
704 
705  default:
706  break;
707  }
708 
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  return;
733 
734  Point aSelPos;
735  const sal_uInt32 nItemId = ImplGetSelectedItemId( nullptr, aSelPos );
736 
737  if( !nItemId )
738  return;
739 
740  sal_uInt32 nNewItemId = nItemId;
741 
742  switch( eTravel )
743  {
744  case GalleryBrowserTravel::First: nNewItemId = 1; break;
745  case GalleryBrowserTravel::Last: nNewItemId = mpCurTheme->GetObjectCount(); break;
746  case GalleryBrowserTravel::Previous: nNewItemId--; break;
747  case GalleryBrowserTravel::Next: nNewItemId++; break;
748  default:
749  break;
750  }
751 
752  if( nNewItemId < 1 )
753  nNewItemId = 1;
754  else if( nNewItemId > mpCurTheme->GetObjectCount() )
755  nNewItemId = mpCurTheme->GetObjectCount();
756 
757  if( nNewItemId == nItemId )
758  return;
759 
760  ImplSelectItemId( nNewItemId );
762 
764  return;
765 
766  Graphic aGraphic;
767  const sal_uInt32 nPos = nNewItemId - 1;
768 
769  mpCurTheme->GetGraphic( nPos, aGraphic );
770  mxPreview->SetGraphic( aGraphic );
771 
772  if( SgaObjKind::Sound == mpCurTheme->GetObjectKind( nPos ) )
774 
775  mxPreview->Invalidate();
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  sal_uInt32 nCount = mpCurTheme->GetObjectCount();
794  for (sal_uInt32 i = 0; i < nCount; ++i)
795  {
796  mxIconView->InsertItem(i + 1); // skip reserved id 0
797  mxListView->append(OUString::number(i), ""); // create on-demand in VisRowsScrolledHdl
798 
799  if (i == nAlwaysUpToDate) // fill in the first block
800  UpdateRows(false);
801  }
802 
803  if (nCount < nAlwaysUpToDate) // if less than block size, fill in all of them
804  UpdateRows(false);
805 
806  mxListView->thaw();
807 
808  ImplSelectItemId( std::min<sal_uInt16>( nSelectionId, mpCurTheme->GetObjectCount() ) );
809  }
810 
811  switch( GetMode() )
812  {
813  case GALLERYBROWSERMODE_ICON: mxIconView->Show(); break;
815  mxListView->show();
816  UpdateRows(true);
817  break;
818  case GALLERYBROWSERMODE_PREVIEW: mxPreview->Show(); break;
819 
820  default:
821  break;
822  }
823 
825 }
826 
827 void GalleryBrowser2::UpdateRows(bool bVisibleOnly)
828 {
829  auto lambda = [this](weld::TreeIter& rEntry){
830  // id is non-null if the preview is pending creation
831  OUString sId(mxListView->get_id(rEntry));
832  if (sId.isEmpty())
833  return false;
834 
835  // get the icon for the listview
836  BitmapEx aBitmapEx;
837  Size aPreparedSize;
838 
839  OUString sItemTextTitle;
840  OUString sItemTextPath;
841 
842  sal_Int32 i = sId.toUInt32();
843  mpCurTheme->GetPreviewBitmapExAndStrings(i, aBitmapEx, aPreparedSize, sItemTextTitle, sItemTextPath);
844 
845  bool bNeedToCreate(aBitmapEx.IsEmpty());
846  if (!bNeedToCreate && (sItemTextTitle.isEmpty() || aPreparedSize != maPreviewSize))
847  bNeedToCreate = true;
848 
849  if (bNeedToCreate)
850  {
851  std::unique_ptr<SgaObject> xObj = mpCurTheme->AcquireObject(i);
852  if (xObj)
853  {
854  aBitmapEx = xObj->createPreviewBitmapEx(maPreviewSize);
855  sItemTextTitle = GalleryBrowser2::GetItemText(*xObj, GalleryItemFlags::Title);
857 
858  mpCurTheme->SetPreviewBitmapExAndStrings(i, aBitmapEx, maPreviewSize, sItemTextTitle, sItemTextPath);
859  }
860  }
861 
862  if (!aBitmapEx.IsEmpty())
863  {
864  const Size aBitmapExSizePixel(aBitmapEx.GetSizePixel());
865  const Point aPos(
866  ((maPreviewSize.Width() - aBitmapExSizePixel.Width()) >> 1),
867  ((maPreviewSize.Height() - aBitmapExSizePixel.Height()) >> 1));
868 
869  mxDev->Erase();
870 
871  if (aBitmapEx.IsTransparent())
872  {
873  // draw checkered background
874  GalleryIconView::drawTransparenceBackground(*mxDev, aPos, aBitmapExSizePixel);
875  }
876 
877  mxDev->DrawBitmapEx(aPos, aBitmapEx);
878  }
879 
880  mxListView->set_text(rEntry, sItemTextTitle);
881  mxListView->set_image(rEntry, *mxDev);
882  mxListView->set_id(rEntry, OUString());
883 
884  return false;
885  };
886 
887  if (bVisibleOnly)
888  {
889  // ensure all visible entries are up to date
890  mxListView->visible_foreach(lambda);
891  // and ensure all selected entries are up to date
892  mxListView->selected_foreach(lambda);
893  return;
894  }
895 
896  mxListView->all_foreach(lambda);
897 }
898 
899 IMPL_LINK_NOARG(GalleryBrowser2, VisRowsScrolledHdl, weld::TreeView&, void)
900 {
901  UpdateRows(true);
902 }
903 
904 IMPL_LINK_NOARG(GalleryBrowser2, SizeAllocHdl, const Size&, void)
905 {
906  UpdateRows(true);
907 }
908 
910 {
911  if (!mpCurTheme)
912  return;
913  mxInfoBar->set_label( mpCurTheme->GetName() );
914 }
915 
917 {
918  if (!mpCurTheme)
919  return;
920  auto nSelectedObject = (GALLERYBROWSERMODE_ICON == GetMode()) ? (mxIconView->GetSelectedItemId() - 1) : mxListView->get_selected_index();
921  m_xHelper->SelectObject(nSelectedObject);
922 }
923 
924 sal_uInt32 GalleryBrowser2::ImplGetSelectedItemId( const Point* pSelPos, Point& rSelPos )
925 {
926  sal_uInt32 nRet = 0;
927 
929  {
930  nRet = ( ( GALLERYBROWSERMODE_ICON == meLastMode ) ? mxIconView->GetSelectedItemId() : ( mxListView->get_selected_index() + 1 ) );
931 
932  if( pSelPos )
933  rSelPos = *pSelPos;
934  else
935  {
936  Size aOutputSizePixel(mxPreview->GetOutputSizePixel());
937  rSelPos = Point( aOutputSizePixel.Width() >> 1, aOutputSizePixel.Height() >> 1 );
938  }
939  }
940  else if (GALLERYBROWSERMODE_ICON == GetMode())
941  {
942  if (pSelPos)
943  {
944  nRet = mxIconView->GetItemId( *pSelPos );
945  rSelPos = *pSelPos;
946  }
947  else
948  {
949  nRet = mxIconView->GetSelectedItemId();
950  rSelPos = mxIconView->GetItemRect(nRet).Center();
951  }
952  }
953  else
954  {
955  std::unique_ptr<weld::TreeIter> xIter = mxListView->make_iterator();
956  if( pSelPos )
957  {
958  if (mxListView->get_dest_row_at_pos(*pSelPos, xIter.get(), false))
959  nRet = mxListView->get_iter_index_in_parent(*xIter) + 1;
960  rSelPos = *pSelPos;
961  }
962  else
963  {
964  if (mxListView->get_selected(xIter.get()))
965  {
966  nRet = mxListView->get_iter_index_in_parent(*xIter) + 1;
967  rSelPos = mxListView->get_row_area(*xIter).Center();
968  }
969  }
970  }
971 
972  if( nRet && ( !mpCurTheme || ( nRet > mpCurTheme->GetObjectCount() ) ) )
973  {
974  nRet = 0;
975  }
976 
977  return nRet;
978 }
979 
980 void GalleryBrowser2::ImplSelectItemId(sal_uInt32 nItemId)
981 {
982  if( nItemId )
983  {
984  mxIconView->SelectItem(nItemId);
985  mxListView->select( nItemId - 1 );
987  }
988 }
989 
990 css::uno::Reference< css::frame::XFrame >
992 {
993  css::uno::Reference< css::frame::XFrame > xFrame;
994  SfxViewFrame* pCurrentViewFrame = SfxViewFrame::Current();
995  if ( pCurrentViewFrame )
996  {
997  SfxBindings& rBindings = pCurrentViewFrame->GetBindings();
998  xFrame.set( rBindings.GetActiveFrame() );
999  }
1000 
1001  return xFrame;
1002 }
1003 
1005  const css::uno::Reference< css::frame::XDispatch > &rxDispatch,
1006  const css::util::URL &rURL)
1007 {
1008  Point aSelPos;
1009  const sal_uInt32 nItemId = ImplGetSelectedItemId( nullptr, aSelPos );
1010 
1011  if( !mpCurTheme || !nItemId )
1012  return;
1013 
1014  mnCurActionPos = nItemId - 1;
1015 
1016  css::uno::Reference< css::frame::XDispatch > xDispatch( rxDispatch );
1017  css::util::URL aURL = rURL;
1018 
1019  if ( !xDispatch.is() )
1020  {
1021  css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider(
1022  GetFrame(), css::uno::UNO_QUERY );
1023  if ( !xDispatchProvider.is() || !m_xTransformer.is() )
1024  return;
1025 
1026  aURL.Complete = ".uno:InsertGalleryPic";
1027  m_xTransformer->parseStrict( aURL );
1028  xDispatch = xDispatchProvider->queryDispatch(
1029  aURL,
1030  "_self",
1031  css::frame::FrameSearchFlag::SELF );
1032  }
1033 
1034  if ( !xDispatch.is() )
1035  return;
1036 
1037  sal_Int8 nType = 0;
1038  OUString aFilterName;
1039  css::uno::Reference< css::lang::XComponent > xDrawing;
1040  css::uno::Reference< css::graphic::XGraphic > xGraphic;
1041 
1042  aFilterName = GetFilterName();
1043 
1045  {
1046  case SgaObjKind::Bitmap:
1047  case SgaObjKind::Animation:
1048  case SgaObjKind::Inet:
1049  // TODO drawing objects are inserted as drawings only via drag&drop
1050  case SgaObjKind::SvDraw:
1051  nType = css::gallery::GalleryItemType::GRAPHIC;
1052  break;
1053 
1054  case SgaObjKind::Sound :
1055  nType = css::gallery::GalleryItemType::MEDIA;
1056  break;
1057 
1058  default:
1059  nType = css::gallery::GalleryItemType::EMPTY;
1060  break;
1061  }
1062 
1063  Graphic aGraphic;
1064  bool bGraphic = mpCurTheme->GetGraphic( mnCurActionPos, aGraphic );
1065  if ( bGraphic && !aGraphic.IsNone() )
1066  xGraphic.set( aGraphic.GetXGraphic() );
1067  OSL_ENSURE( xGraphic.is(), "gallery item is graphic, but the reference is invalid!" );
1068 
1069  css::uno::Sequence< css::beans::PropertyValue > aSeq( SVXGALLERYITEM_PARAMS );
1070 
1071  aSeq[0].Name = SVXGALLERYITEM_TYPE;
1072  aSeq[0].Value <<= nType;
1073  aSeq[1].Name = SVXGALLERYITEM_URL;
1074  aSeq[1].Value <<= OUString();
1075  aSeq[2].Name = SVXGALLERYITEM_FILTER;
1076  aSeq[2].Value <<= aFilterName;
1077  aSeq[3].Name = SVXGALLERYITEM_DRAWING;
1078  aSeq[3].Value <<= xDrawing;
1079  aSeq[4].Name = SVXGALLERYITEM_GRAPHIC;
1080  aSeq[4].Value <<= xGraphic;
1081 
1082  css::uno::Sequence< css::beans::PropertyValue > aArgs( 1 );
1083  aArgs[0].Name = SVXGALLERYITEM_ARGNAME;
1084  aArgs[0].Value <<= aSeq;
1085 
1086  std::unique_ptr<DispatchInfo> pInfo(new DispatchInfo);
1087  pInfo->TargetURL = aURL;
1088  pInfo->Arguments = aArgs;
1089  pInfo->Dispatch = xDispatch;
1090 
1092  LINK( nullptr, GalleryBrowser2, AsyncDispatch_Impl), pInfo.get() ) )
1093  pInfo.release();
1094 }
1095 
1096 void GalleryBrowser2::Execute(const OString &rIdent)
1097 {
1098  Point aSelPos;
1099  const sal_uInt32 nItemId = ImplGetSelectedItemId( nullptr, aSelPos );
1100 
1101  if( !(mpCurTheme && nItemId) )
1102  return;
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 OUString GalleryBrowser2::GetItemText( const SgaObject& rObj, GalleryItemFlags nItemTextFlags )
1160 {
1161  OUString aRet;
1162 
1163  const INetURLObject& aURL(rObj.GetURL());
1164 
1165  if( nItemTextFlags & GalleryItemFlags::Title )
1166  {
1167  OUString aTitle( rObj.GetTitle() );
1168 
1169  if( aTitle.isEmpty() )
1171 
1172  if( aTitle.isEmpty() )
1173  {
1175  aTitle = aTitle.copy( aTitle.lastIndexOf('/')+1 );
1176  }
1177 
1178  aRet += aTitle;
1179  }
1180 
1181  if( nItemTextFlags & GalleryItemFlags::Path )
1182  {
1183  const OUString aPath( aURL.getFSysPath( FSysStyle::Detect ) );
1184 
1185  if( !aPath.isEmpty() && ( nItemTextFlags & GalleryItemFlags::Title ) )
1186  aRet += " (";
1187 
1188  aRet += aURL.getFSysPath( FSysStyle::Detect );
1189 
1190  if( !aPath.isEmpty() && ( nItemTextFlags & GalleryItemFlags::Title ) )
1191  aRet += ")";
1192  }
1193 
1194  return aRet;
1195 }
1196 
1198 {
1199  INetURLObject aURL;
1200 
1201  if( mpCurTheme && mnCurActionPos != 0xffffffff )
1203 
1204  return aURL;
1205 }
1206 
1208 {
1209  OUString aFilterName;
1210 
1211  if( mpCurTheme && mnCurActionPos != 0xffffffff )
1212  {
1213  const SgaObjKind eObjKind = mpCurTheme->GetObjectKind( mnCurActionPos );
1214 
1215  if( ( SgaObjKind::Bitmap == eObjKind ) || ( SgaObjKind::Animation == eObjKind ) )
1216  {
1218  INetURLObject aURL;
1219  mpCurTheme->GetURL( mnCurActionPos, aURL );
1220  sal_uInt16 nFilter = rFilter.GetImportFormatNumberForShortName(aURL.GetFileExtension());
1221 
1222  if( GRFILTER_FORMAT_DONTKNOW != nFilter )
1223  aFilterName = rFilter.GetImportFormatName( nFilter );
1224  }
1225  }
1226 
1227  return aFilterName;
1228 }
1229 
1230 IMPL_LINK_NOARG(GalleryBrowser2, SelectObjectValueSetHdl, ValueSet*, void)
1231 {
1232  ImplUpdateSelection();
1233 }
1234 
1236 {
1237  ImplUpdateSelection();
1238 }
1239 
1240 IMPL_LINK(GalleryBrowser2, SelectTbxHdl, weld::ToggleButton&, rBox, void)
1241 {
1242  if (&rBox == mxIconButton.get())
1243  SetMode(rBox.get_active() ? GALLERYBROWSERMODE_ICON : GALLERYBROWSERMODE_LIST);
1244  else if (&rBox == mxListButton.get())
1245  SetMode(rBox.get_active() ? GALLERYBROWSERMODE_LIST : GALLERYBROWSERMODE_ICON);
1246 }
1247 
1248 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SAL_DLLPRIVATE bool IsDragging() const
Definition: galtheme.hxx:101
sal_Int8 AcceptDrop(const DropTargetHelper &rTarget)
Definition: galbrws2.cxx:429
void Execute(const OString &rIdent)
Definition: galbrws2.cxx:1096
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:131
const css::datatransfer::dnd::DropTargetDropEvent maDropEvent
static css::uno::Reference< css::frame::XFrame > GetFrame()
Definition: galbrws2.cxx:991
GalleryTheme * AcquireTheme(const OUString &rThemeName, SfxListener &rListener)
Definition: gallery1.cxx:694
#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
SAL_DLLPRIVATE const INetURLObject & GetObjectURL(sal_uInt32 nPos) const
Definition: galtheme.hxx:130
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:1004
static SvxAbstractDialogFactory * Create()
Definition: svxdlg.cxx:22
static OUString GetItemText(const SgaObject &rObj, GalleryItemFlags nItemTextFlags)
Definition: galbrws2.cxx:1159
#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
static weld::Builder * CreateBuilder(weld::Widget *pParent, const OUString &rUIFile, bool bMobile=false)
void RemoveObject(sal_uInt32 nPos)
Definition: galtheme.cxx:180
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:170
SAL_DLLPRIVATE SgaObjKind GetObjectKind(sal_uInt32 nPos) const
Definition: galtheme.hxx:123
virtual VclPtr< AbstractTitleDialog > CreateTitleDialog(weld::Widget *pParent, const OUString &rOldText)=0
constexpr sal_uInt16 KEY_SPACE
void ImplUpdateSelection()
Definition: galbrws2.cxx:916
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:495
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:111
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: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:827
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 void GetPreviewBitmapExAndStrings(sal_uInt32 nPos, BitmapEx &rBitmapEx, Size &rSize, OUString &rTitle, OUString &rPath)
Definition: galtheme.cxx:160
bool ChangeObjectPos(sal_uInt32 nOldPos, sal_uInt32 nNewPos)
Definition: galtheme.cxx:195
tools::Long Width() const
GalleryBrowser2(weld::Builder &rBuilder, Gallery *pGallery)
Definition: galbrws2.cxx:333
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:546
SAL_DLLPRIVATE sal_uInt32 GetObjectCount() const
Definition: galtheme.hxx:84
VclPtr< VirtualDevice > mxDev
Definition: galbrws2.hxx:88
bool GetGraphic(sal_uInt32 nPos, Graphic &rGraphic)
Definition: galtheme.cxx:324
#define DND_ACTION_LINK
OUString GetFilterName() const
Definition: galbrws2.cxx:1207
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:643
#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
void ReleaseTheme(GalleryTheme *pTheme, SfxListener &rListener)
Definition: gallery1.cxx:708
std::unique_ptr< GalleryIconView > mxIconView
Definition: galbrws2.hxx:79
void ImplUpdateInfoBar()
Definition: galbrws2.cxx:909
virtual void grab_focus()=0
sal_uInt32 ImplGetSelectedItemId(const Point *pSelPosPixel, Point &rSelPos)
Definition: galbrws2.cxx:924
INetProtocol GetProtocol() const
RET_OK
#define SVXGALLERYITEM_DRAWING
Definition: galleryitem.hxx:35
OUString GetFileExtension() const
tools::Long Height() const
void * p
Reference< XComponentContext > getProcessComponentContext()
QPRO_FUNC_TYPE nType
Sequence< sal_Int8 > aSeq
void ImplSelectItemId(sal_uInt32 nItemId)
Definition: galbrws2.cxx:980
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:1197
bool KeyInput(const KeyEvent &rEvt)
Definition: galbrws2.cxx:524
OUString sId
static GraphicFilter & GetGraphicFilter()
void SetMode(GalleryBrowserMode eMode)
Definition: galbrws2.cxx:631
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:790
constexpr sal_uInt16 KEY_DELETE
static TransferableDataHelper CreateFromClipboard(const css::uno::Reference< css::datatransfer::clipboard::XClipboard > &rClipboard)
bool IsReadOnly() const
Definition: galtheme.cxx:787
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
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:155
void ImplUpdateViews(sal_uInt16 nSelectionId)
Definition: galbrws2.cxx:778