Kaydet (Commit) e4d7511d authored tarafından Maxim Monastirsky's avatar Maxim Monastirsky

tdf#106681 Styles category for the Add Commands dialog

Change-Id: I7332967863697d3ad68a533b9fc603de2fdc87ef
Reviewed-on: https://gerrit.libreoffice.org/37422Reviewed-by: 's avatarMaxim Monastirsky <momonasmon@gmail.com>
Tested-by: 's avatarMaxim Monastirsky <momonasmon@gmail.com>
üst a6be2788
......@@ -89,7 +89,6 @@ $(eval $(call gb_Library_add_exception_objects,cui,\
cui/source/customize/cfgutil \
cui/source/customize/eventdlg \
cui/source/customize/macropg \
cui/source/customize/selector \
cui/source/dialogs/about \
cui/source/dialogs/colorpicker \
cui/source/dialogs/cuicharmap \
......
......@@ -47,7 +47,7 @@
#include <dialmgr.hxx>
#include <cuires.hrc>
#include "helpid.hrc"
#include "selector.hxx"
#include "cfgutil.hxx"
#include "cfg.hxx"
......
......@@ -32,7 +32,7 @@
#include <com/sun/star/container/NoSuchElementException.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <dialmgr.hxx>
#include "selector.hxx"
#include "cfgutil.hxx"
#include "cfg.hxx"
#include "helpid.hrc"
#include <cuires.hrc>
......
This diff is collapsed.
......@@ -31,7 +31,7 @@
#include <bitmaps.hlst>
#include "scriptdlg.hxx"
#include <dialmgr.hxx>
#include "selector.hxx"
#include "cfgutil.hxx"
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/frame/XDesktop.hpp>
......
......@@ -39,7 +39,7 @@
#include "passwdomdlg.hxx"
#include "screenshotannotationdlg.hxx"
#include "cuihyperdlg.hxx"
#include "selector.hxx"
#include "cfgutil.hxx"
#include "SpellDialog.hxx"
#include "zoom.hxx"
#include "showcols.hxx"
......
......@@ -74,7 +74,7 @@
#include "postdlg.hxx"
#include "grfpage.hxx"
#include "scriptdlg.hxx"
#include "selector.hxx"
#include "cfgutil.hxx"
#include "macropg.hxx"
#include "sdrcelldlg.hxx"
#include "newtabledlg.hxx"
......
......@@ -46,7 +46,7 @@
#include <vector>
#include <vcl/msgbox.hxx>
#include "selector.hxx"
#include "cfgutil.hxx"
class SvxConfigEntry;
class SvxConfigPage;
......
......@@ -27,12 +27,16 @@
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/lang/XSingleComponentFactory.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/frame/XDispatchInformationProvider.hpp>
#include <com/sun/star/script/browse/XBrowseNode.hpp>
#include <vcl/timer.hxx>
#include <svtools/svtabbx.hxx>
#include <svtools/treelistbox.hxx>
#include <vcl/dialog.hxx>
#include <vcl/image.hxx>
class Button;
class SaveInData;
class SfxMacroInfoItem;
struct SfxStyleInfo_Impl
......@@ -81,6 +85,7 @@ enum class SfxCfgKind
GROUP_SCRIPTCONTAINER = 3,
FUNCTION_SCRIPT = 4,
GROUP_STYLES = 5,
GROUP_ALLFUNCTIONS = 6
};
struct SfxGroupInfo_Impl
......@@ -91,6 +96,7 @@ struct SfxGroupInfo_Impl
bool bWasOpened;
OUString sCommand;
OUString sLabel;
OUString sHelpText;
SfxGroupInfo_Impl( SfxCfgKind n, sal_uInt16 nr, void* pObj = nullptr ) :
nKind( n ), nUniqueID( nr ), pObject( pObj ), bWasOpened(false) {}
......@@ -116,6 +122,7 @@ public:
OUString GetCurCommand();
OUString GetCurLabel();
OUString GetSelectedScriptURI();
OUString GetHelpText();
void SetStylesInfo(SfxStylesInfo_Impl* pStyles);
};
......@@ -125,7 +132,7 @@ class SfxConfigGroupListBox : public SvTreeListBox
std::unique_ptr<SvxConfigGroupBoxResource_Impl> xImp;
VclPtr<SfxConfigFunctionListBox> pFunctionListBox;
SfxGroupInfoArr_Impl aArr;
SaveInData* m_pImageProvider;
OUString m_sModuleLongName;
css::uno::Reference< css::uno::XComponentContext > m_xContext;
css::uno::Reference< css::frame::XFrame > m_xFrame;
......@@ -146,7 +153,9 @@ class SfxConfigGroupListBox : public SvTreeListBox
void InitModule();
void FillScriptList(const css::uno::Reference< css::script::browse::XBrowseNode >& xRootNode,
SvTreeListEntry* pParentEntry, bool bCheapChildrenOnDemand);
void FillFunctionsList(const css::uno::Sequence< css::frame::DispatchInformation >& xCommands);
OUString MapCommand2UIName(const OUString& sCommand);
SfxStylesInfo_Impl* pStylesInfo;
......@@ -167,12 +176,57 @@ public:
bool bEventMode);
void SetFunctionListBox( SfxConfigFunctionListBox *pBox )
{ pFunctionListBox = pBox; }
void SetImageProvider( SaveInData* provider )
{ m_pImageProvider = provider; }
void GroupSelected();
void SelectMacro( const SfxMacroInfoItem* );
void SelectMacro( const OUString&, const OUString& );
void SetStylesInfo(SfxStylesInfo_Impl* pStyles);
};
class SvxScriptSelectorDialog : public ModalDialog
{
VclPtr<FixedText> m_pDialogDescription;
VclPtr<SfxConfigGroupListBox> m_pCategories;
VclPtr<SfxConfigFunctionListBox> m_pCommands;
VclPtr<PushButton> m_pOKButton;
VclPtr<PushButton> m_pCancelButton;
VclPtr<VclMultiLineEdit> m_pDescriptionText;
OUString m_sDefaultDesc;
SfxStylesInfo_Impl m_aStylesInfo;
bool m_bShowSlots;
Link<SvxScriptSelectorDialog&,void> m_aAddHdl;
DECL_LINK( ClickHdl, Button *, void );
DECL_LINK( SelectHdl, SvTreeListBox*, void );
DECL_LINK( FunctionDoubleClickHdl, SvTreeListBox*, bool );
void UpdateUI();
public:
SvxScriptSelectorDialog (
vcl::Window* pParent = nullptr,
bool bShowSlots = false,
const css::uno::Reference< css::frame::XFrame >& xFrame = nullptr
);
virtual ~SvxScriptSelectorDialog() override;
virtual void dispose() override;
void SetAddHdl( const Link<SvxScriptSelectorDialog&,void>& rLink ) { m_aAddHdl = rLink; }
const Link<SvxScriptSelectorDialog&,void>& GetAddHdl() const { return m_aAddHdl; }
void SetImageProvider(SaveInData* provider)
{
m_pCategories->SetImageProvider(provider);
}
OUString GetScriptURL() const;
OUString GetSelectedDisplayName();
void SetRunLabel();
void SetDialogDescription(const OUString& rDescription);
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* 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 .
*/
#ifndef INCLUDED_CUI_SOURCE_INC_SELECTOR_HXX
#define INCLUDED_CUI_SOURCE_INC_SELECTOR_HXX
#include <vcl/lstbox.hxx>
#include <vcl/fixed.hxx>
#include <vcl/group.hxx>
#include <vcl/menubtn.hxx>
#include <svtools/treelistbox.hxx>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/frame/DispatchInformation.hpp>
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/script/browse/XBrowseNode.hpp>
#include <memory>
class SaveInData;
#define SVX_CFGGROUP_FUNCTION 1
#define SVX_CFGFUNCTION_SLOT 2
#define SVX_CFGGROUP_SCRIPTCONTAINER 3
#define SVX_CFGFUNCTION_SCRIPT 4
#define SVX_CFGGROUP_ALLFUNCTIONS 5
struct SvxGroupInfo_Impl
{
sal_uInt16 nKind;
sal_uInt16 nOrd;
css::uno::Reference< css::script::browse::XBrowseNode >
xBrowseNode;
OUString sURL;
OUString sHelpText;
bool bWasOpened;
SvxGroupInfo_Impl( sal_uInt16 n, sal_uInt16 nr )
:nKind( n )
,nOrd( nr )
,xBrowseNode()
,sURL()
,sHelpText()
,bWasOpened(false)
{
}
SvxGroupInfo_Impl( sal_uInt16 n, sal_uInt16 nr, const css::uno::Reference< css::script::browse::XBrowseNode >& _rxNode )
:nKind( n )
,nOrd( nr )
,xBrowseNode( _rxNode )
,sURL()
,sHelpText()
,bWasOpened(false)
{
}
SvxGroupInfo_Impl( sal_uInt16 n, sal_uInt16 nr, const OUString& _rURL, const OUString& _rHelpText )
:nKind( n )
,nOrd( nr )
,xBrowseNode()
,sURL( _rURL )
,sHelpText( _rHelpText )
,bWasOpened(false)
{
}
};
typedef std::vector<std::unique_ptr<SvxGroupInfo_Impl> > SvxGroupInfoArr_Impl;
class SvxConfigFunctionListBox : public SvTreeListBox
{
friend class SvxConfigGroupListBox;
Timer aTimer;
SvTreeListEntry* pCurEntry;
SvxGroupInfoArr_Impl aArr;
SvTreeListEntry* m_pDraggingEntry;
DECL_LINK(TimerHdl, Timer *, void);
virtual void MouseMove( const MouseEvent& rMEvt ) override;
public:
SvxConfigFunctionListBox(vcl::Window* pParent, WinBits nStyle);
virtual ~SvxConfigFunctionListBox() override;
virtual void dispose() override;
void ClearAll();
OUString GetHelpText( SvTreeListEntry *pEntry );
using Window::GetHelpText;
SvTreeListEntry* GetLastSelectedEntry();
void FunctionSelected();
// drag n drop methods
virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
virtual DragDropMode NotifyStartDrag(
TransferDataContainer&, SvTreeListEntry* ) override;
virtual void DragFinished( sal_Int8 ) override;
};
class SvxConfigGroupListBox : public SvTreeListBox
{
SvxGroupInfoArr_Impl aArr;
bool m_bShowSlots;
VclPtr<SvxConfigFunctionListBox> pFunctionListBox;
SaveInData* m_pImageProvider;
css::uno::Reference
< css::frame::XFrame > m_xFrame;
css::uno::Reference
< css::container::XNameAccess > m_xModuleCommands;
Image m_hdImage;
Image m_libImage;
Image m_macImage;
Image m_docImage;
OUString m_sMyMacros;
OUString m_sProdMacros;
Image GetImage(
const css::uno::Reference< css::script::browse::XBrowseNode >& node,
css::uno::Reference< css::uno::XComponentContext > const & xCtx,
bool bIsRootNode
);
static css::uno::Reference< css::uno::XInterface > getDocumentModel(
css::uno::Reference< css::uno::XComponentContext > const & xCtx,
OUString& docName
);
private:
void fillScriptList(
const css::uno::Reference< css::script::browse::XBrowseNode >& _rxRootNode,
SvTreeListEntry* _pParentEntry,
bool _bCheapChildrenOnDemand
);
void fillFunctionList( const com::sun::star::uno::Sequence< com::sun::star::frame::DispatchInformation >& commands );
protected:
virtual void RequestingChildren( SvTreeListEntry *pEntry) override;
virtual bool Expand( SvTreeListEntry* pParent ) override;
public:
SvxConfigGroupListBox(vcl::Window* pParent, WinBits nStyle);
virtual ~SvxConfigGroupListBox() override;
virtual void dispose() override;
void Init(bool bShowSlots, const css::uno::Reference
< css::frame::XFrame >& xFrame);
void ClearAll();
void GroupSelected();
void SetFunctionListBox( SvxConfigFunctionListBox *pBox )
{ pFunctionListBox = pBox; }
void SetImageProvider( SaveInData* provider )
{ m_pImageProvider = provider; }
};
class SvxScriptSelectorDialog : public ModalDialog
{
VclPtr<FixedText> m_pDialogDescription;
VclPtr<SvxConfigGroupListBox> m_pCategories;
VclPtr<SvxConfigFunctionListBox> m_pCommands;
VclPtr<PushButton> m_pOKButton;
VclPtr<PushButton> m_pCancelButton;
VclPtr<VclMultiLineEdit> m_pDescriptionText;
OUString m_sDefaultDesc;
bool m_bShowSlots;
Link<SvxScriptSelectorDialog&,void> m_aAddHdl;
DECL_LINK( ClickHdl, Button *, void );
DECL_LINK( SelectHdl, SvTreeListBox*, void );
DECL_LINK( FunctionDoubleClickHdl, SvTreeListBox*, bool );
void UpdateUI();
public:
SvxScriptSelectorDialog (
vcl::Window* pParent = nullptr,
bool bShowSlots = false,
const css::uno::Reference< css::frame::XFrame >& xFrame = nullptr
);
virtual ~SvxScriptSelectorDialog() override;
virtual void dispose() override;
void SetAddHdl( const Link<SvxScriptSelectorDialog&,void>& rLink ) { m_aAddHdl = rLink; }
const Link<SvxScriptSelectorDialog&,void>& GetAddHdl() const { return m_aAddHdl; }
void SetImageProvider(SaveInData* provider)
{
m_pCategories->SetImageProvider(provider);
}
OUString GetScriptURL() const;
OUString GetSelectedDisplayName();
void SetRunLabel();
void SetDialogDescription(const OUString& rDescription);
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -159,7 +159,7 @@
<property name="top_padding">6</property>
<property name="left_padding">12</property>
<child>
<object class="cuilo-SvxConfigGroupListBox" id="categories:border">
<object class="cuilo-SfxConfigGroupListBox" id="categories:border">
<property name="width_request">280</property>
<property name="height_request">300</property>
<property name="visible">True</property>
......@@ -167,7 +167,7 @@
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="SvxConfigGroupListBox-selection1"/>
<object class="GtkTreeSelection" id="SfxConfigGroupListBox-selection1"/>
</child>
</object>
</child>
......@@ -231,7 +231,7 @@
<property name="top_padding">6</property>
<property name="left_padding">12</property>
<child>
<object class="cuilo-SvxConfigFunctionListBox" id="commands:border">
<object class="cuilo-SfxConfigFunctionListBox" id="commands:border">
<property name="width_request">280</property>
<property name="height_request">300</property>
<property name="visible">True</property>
......@@ -239,7 +239,7 @@
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="SvxConfigFunctionListBox-selection1"/>
<object class="GtkTreeSelection" id="SfxConfigFunctionListBox-selection1"/>
</child>
</object>
</child>
......
......@@ -544,12 +544,6 @@
<glade-widget-class title="SwIdxTreeListBox" name="swuilo-SwIdxTreeListBox"
generic-name="SwIdxTreeListBox" parent="svtlo-SvTreeListBox"
icon-name="widget-gtk-treeview"/>
<glade-widget-class title="SvxConfigGroupListBox" name="cuilo-SvxConfigGroupListBox"
generic-name="SvxConfigGroupListBox" parent="svtlo-SvTreeListBox"
icon-name="widget-gtk-treeview"/>
<glade-widget-class title="SvxConfigFunctionListBox`" name="cuilo-SvxConfigFunctionListBox"
generic-name="SvxConfigFunctionListBox" parent="svtlo-SvTreeListBox"
icon-name="widget-gtk-treeview"/>
<glade-widget-class title="Tooltip Tree List" name="swuilo-SwFldRefTreeListBox"
generic-name="Tooltip Tree List" parent="svtlo-SvTreeListBox"
icon-name="widget-gtk-treeview"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment