2010-10-27 13:11:31 +01:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-11-21 22:06:52 +00:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2004-02-03 16:22:46 +00:00
|
|
|
|
2013-10-28 03:41:20 +01:00
|
|
|
#ifndef INCLUDED_SVX_INC_GALBRWS2_HXX
|
|
|
|
#define INCLUDED_SVX_INC_GALBRWS2_HXX
|
2004-02-03 16:22:46 +00:00
|
|
|
|
|
|
|
#include <vcl/lstbox.hxx>
|
|
|
|
#include <vcl/button.hxx>
|
|
|
|
#include <vcl/fixed.hxx>
|
|
|
|
#include <vcl/timer.hxx>
|
|
|
|
#include <vcl/toolbox.hxx>
|
|
|
|
#include <svtools/transfer.hxx>
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <svl/lstner.hxx>
|
2014-08-27 08:46:28 +01:00
|
|
|
#include <svx/galctrl.hxx>
|
2005-01-21 14:32:00 +00:00
|
|
|
#include <svtools/miscopt.hxx>
|
2004-02-03 16:22:46 +00:00
|
|
|
|
2013-05-07 05:39:15 +00:00
|
|
|
#include <com/sun/star/frame/XDispatch.hpp>
|
2014-08-27 08:46:28 +01:00
|
|
|
#include <com/sun/star/uno/XComponentContext.hpp>
|
2013-05-07 05:39:15 +00:00
|
|
|
#include <com/sun/star/util/XURLTransformer.hpp>
|
|
|
|
|
2014-02-25 20:51:35 +01:00
|
|
|
|
2004-02-03 16:22:46 +00:00
|
|
|
enum GalleryBrowserMode
|
|
|
|
{
|
|
|
|
GALLERYBROWSERMODE_NONE = 0,
|
|
|
|
GALLERYBROWSERMODE_ICON = 1,
|
|
|
|
GALLERYBROWSERMODE_LIST = 2,
|
|
|
|
GALLERYBROWSERMODE_PREVIEW = 3
|
|
|
|
};
|
|
|
|
|
2014-02-25 20:51:35 +01:00
|
|
|
|
2017-02-06 13:51:47 +02:00
|
|
|
enum class GalleryBrowserTravel
|
2004-02-03 16:22:46 +00:00
|
|
|
{
|
2017-02-06 13:51:47 +02:00
|
|
|
First, Last, Previous, Next
|
2004-02-03 16:22:46 +00:00
|
|
|
};
|
|
|
|
|
2016-05-13 14:23:36 +02:00
|
|
|
enum class GalleryItemFlags {
|
|
|
|
ThemeName = 0x0001,
|
|
|
|
Title = 0x0002,
|
|
|
|
Path = 0x0004
|
|
|
|
};
|
|
|
|
namespace o3tl
|
|
|
|
{
|
|
|
|
template<> struct typed_flags<GalleryItemFlags> : is_typed_flags<GalleryItemFlags, 0x0007> {};
|
|
|
|
}
|
2004-02-03 16:22:46 +00:00
|
|
|
|
2014-02-25 20:51:35 +01:00
|
|
|
|
2004-02-03 16:22:46 +00:00
|
|
|
class GalleryToolBox : public ToolBox
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual void KeyInput( const KeyEvent& rKEvt ) override;
|
2004-02-03 16:22:46 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
GalleryToolBox( GalleryBrowser2* pParent );
|
|
|
|
};
|
|
|
|
|
2014-02-25 20:51:35 +01:00
|
|
|
|
2004-02-03 16:22:46 +00:00
|
|
|
class Gallery;
|
|
|
|
class GalleryTheme;
|
|
|
|
class GalleryIconView;
|
|
|
|
class GalleryListView;
|
|
|
|
class GalleryPreview;
|
|
|
|
class Menu;
|
|
|
|
class SgaObject;
|
2013-05-07 05:39:15 +00:00
|
|
|
struct DispatchInfo;
|
2004-02-03 16:22:46 +00:00
|
|
|
|
2013-04-10 08:20:16 +00:00
|
|
|
namespace svx { namespace sidebar { class GalleryControl; } }
|
|
|
|
|
2004-02-03 16:22:46 +00:00
|
|
|
class GalleryBrowser2 : public Control, public SfxListener
|
|
|
|
{
|
|
|
|
friend class GalleryBrowser;
|
2013-04-10 08:20:16 +00:00
|
|
|
friend class svx::sidebar::GalleryControl;
|
2006-10-12 10:43:12 +00:00
|
|
|
using Window::KeyInput;
|
2004-02-03 16:22:46 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2005-01-21 14:32:00 +00:00
|
|
|
SvtMiscOptions maMiscOptions;
|
2004-02-03 16:22:46 +00:00
|
|
|
Gallery* mpGallery;
|
|
|
|
GalleryTheme* mpCurTheme;
|
2015-03-09 14:29:30 +02:00
|
|
|
VclPtr<GalleryIconView> mpIconView;
|
|
|
|
VclPtr<GalleryListView> mpListView;
|
|
|
|
VclPtr<GalleryPreview> mpPreview;
|
2015-01-13 14:52:40 +02:00
|
|
|
VclPtr<GalleryToolBox> maViewBox;
|
|
|
|
VclPtr<FixedLine> maSeparator;
|
|
|
|
VclPtr<FixedText> maInfoBar;
|
|
|
|
sal_uIntPtr mnCurActionPos;
|
2004-02-03 16:22:46 +00:00
|
|
|
GalleryBrowserMode meMode;
|
|
|
|
GalleryBrowserMode meLastMode;
|
2013-05-07 05:39:15 +00:00
|
|
|
|
2015-10-30 14:59:47 +02:00
|
|
|
css::uno::Reference< css::uno::XComponentContext > m_xContext;
|
|
|
|
css::uno::Reference< css::util::XURLTransformer > m_xTransformer;
|
2004-02-03 16:22:46 +00:00
|
|
|
|
|
|
|
void InitSettings();
|
|
|
|
|
2011-01-10 16:11:35 +01:00
|
|
|
void ImplUpdateViews( sal_uInt16 nSelectionId );
|
2004-02-03 16:22:46 +00:00
|
|
|
void ImplUpdateInfoBar();
|
2011-01-10 16:11:35 +01:00
|
|
|
sal_uIntPtr ImplGetSelectedItemId( const Point* pSelPosPixel, Point& rSelPos );
|
|
|
|
void ImplSelectItemId( sal_uIntPtr nItemId );
|
2004-02-03 16:22:46 +00:00
|
|
|
|
|
|
|
// Control
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual void Resize() override;
|
|
|
|
virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
|
2004-02-03 16:22:46 +00:00
|
|
|
|
|
|
|
// SfxListener
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
|
2004-02-03 16:22:46 +00:00
|
|
|
|
2016-10-05 07:56:12 +02:00
|
|
|
DECL_LINK( SelectObjectHdl, GalleryListView*, void );
|
|
|
|
DECL_LINK( SelectObjectValueSetHdl, ValueSet*, void );
|
|
|
|
DECL_LINK( SelectTbxHdl, ToolBox*, void );
|
|
|
|
DECL_LINK( MiscHdl, LinkParamNone*, void );
|
2004-02-03 16:22:46 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
static GalleryBrowserMode meInitMode;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2016-05-13 14:23:36 +02:00
|
|
|
static OUString GetItemText( const GalleryTheme& rTheme, const SgaObject& rObj, GalleryItemFlags nItemTextFlags );
|
2004-02-03 16:22:46 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2014-12-26 10:05:05 +00:00
|
|
|
GalleryBrowser2(vcl::Window* pParent, Gallery* pGallery);
|
2016-09-13 13:09:01 +02:00
|
|
|
virtual ~GalleryBrowser2() override;
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual void dispose() override;
|
2004-02-03 16:22:46 +00:00
|
|
|
|
2013-09-04 11:25:23 +02:00
|
|
|
void SelectTheme( const OUString& rThemeName );
|
2004-02-03 16:22:46 +00:00
|
|
|
|
|
|
|
GalleryBrowserMode GetMode() const { return meMode; }
|
|
|
|
void SetMode( GalleryBrowserMode eMode );
|
|
|
|
|
2015-07-16 09:49:37 +02:00
|
|
|
vcl::Window* GetViewWindow() const;
|
2004-02-03 16:22:46 +00:00
|
|
|
|
|
|
|
void Travel( GalleryBrowserTravel eTravel );
|
|
|
|
|
|
|
|
INetURLObject GetURL() const;
|
2013-09-04 11:25:23 +02:00
|
|
|
OUString GetFilterName() const;
|
2004-02-03 16:22:46 +00:00
|
|
|
|
2017-05-04 12:21:07 +02:00
|
|
|
sal_Int8 AcceptDrop( DropTargetHelper& rTarget );
|
|
|
|
sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
|
|
|
|
void StartDrag( const Point* pDragPoint = nullptr );
|
|
|
|
void TogglePreview();
|
|
|
|
void ShowContextMenu( const Point* pContextPoint );
|
2014-09-23 11:20:40 +02:00
|
|
|
bool KeyInput( const KeyEvent& rEvt, vcl::Window* pWindow );
|
2013-05-07 05:39:15 +00:00
|
|
|
|
2015-10-30 14:59:47 +02:00
|
|
|
static css::uno::Reference< css::frame::XFrame > GetFrame();
|
2016-04-13 13:32:22 +02:00
|
|
|
const css::uno::Reference< css::util::XURLTransformer >& GetURLTransformer() const { return m_xTransformer; }
|
2013-05-07 05:39:15 +00:00
|
|
|
|
2017-04-14 14:33:10 +01:00
|
|
|
void Execute(const OString &rIdent);
|
2017-04-14 14:38:35 +01:00
|
|
|
void DispatchAdd(const css::uno::Reference<css::frame::XDispatch> &rxDispatch,
|
|
|
|
const css::util::URL &rURL);
|
2013-05-07 05:39:15 +00:00
|
|
|
|
2016-10-05 07:56:12 +02:00
|
|
|
DECL_STATIC_LINK( GalleryBrowser2, AsyncDispatch_Impl, void*, void );
|
2004-02-03 16:22:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
2010-10-27 13:11:31 +01:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|