21#include <osl/diagnose.h>
25#include <com/sun/star/ui/XUIConfigurationManager.hpp>
26#include <com/sun/star/ui/theModuleUIConfigurationManagerSupplier.hpp>
27#include <com/sun/star/ui/XImageManager.hpp>
28#include <com/sun/star/ui/ImageType.hpp>
29#include <com/sun/star/sdbcx/XViewsSupplier.hpp>
30#include <com/sun/star/graphic/XGraphic.hpp>
31#include <com/sun/star/util/URL.hpp>
32#include <core_resource.hxx>
40using namespace ::
dbaui;
50using ::com::sun::star::util::URL;
51using ::com::sun::star::sdb::application::NamedDatabaseObject;
53TaskEntry::TaskEntry(
const char* _pAsciiUNOCommand,
TranslateId _pHelpID,
TranslateId pTitleResourceID,
bool _bHideWhenDisabled )
54 :sUNOCommand( OUString::createFromAscii( _pAsciiUNOCommand ) )
56 ,sTitle(
DBA_RES(pTitleResourceID) )
57 ,bHideWhenDisabled( _bHideWhenDisabled )
66 pHelpTextId = weld::fromId<TaskEntry*>(
m_xTreeView->get_id(nCurEntry))->pHelpID;
72 m_nCursorIndex = rTreeView.get_cursor_index();
73 if (m_nCursorIndex != -1)
76 aCommand.Complete = weld::fromId<TaskEntry*>(rTreeView.get_id(m_nCursorIndex))->sUNOCommand;
77 getDetailView()->getBorderWin().getView()->getAppController().executeChecked(
aCommand, Sequence< PropertyValue >() );
96 m_xTreeView->select(m_nCursorIndex != -1 ? m_nCursorIndex : 0);
101 m_nCursorIndex = m_xTreeView->get_cursor_index();
102 m_xTreeView->unselect_all();
107 m_nCursorIndex = m_xTreeView->get_cursor_index();
112 :
OChildWindow(pParent,
"dbaccess/ui/taskwindow.ui",
"TaskWindow")
113 , m_xTreeView(m_xBuilder->weld_tree_view(
"treeview"))
114 , m_xDescription(m_xBuilder->weld_label(
"description"))
115 , m_xHelpText(m_xBuilder->weld_text_view(
"helptext"))
116 , m_pDetailView(pDetailView)
153 theModuleUIConfigurationManagerSupplier::get(
getDetailView()->getBorderWin().
getView()->getORB() );
155 "com.sun.star.sdb.OfficeDatabaseDocument"
161 OUString* pCommands = aCommands.getArray();
162 for (
auto const& copyTask : _rList)
164 *pCommands = copyTask.sUNOCommand;
169 ImageType::SIZE_DEFAULT | ImageType::COLOR_NORMAL ,
176 for (
auto const& task : _rList)
205 : m_xBuilder(
Application::CreateBuilder(pParent,
"dbaccess/ui/appdetailwindow.ui"))
206 ,
m_xContainer(m_xBuilder->weld_container(
"AppDetailWindow"))
207 , m_xHorzSplitter(m_xBuilder->weld_paned(
"splitter"))
208 , m_xTasksParent(m_xBuilder->weld_container(
"tasks"))
209 , m_xContainerParent(m_xBuilder->weld_container(
"container"))
212 , m_rBorderWin(rBorder)
217 std::shared_ptr<OChildWindow> xTasks = std::make_shared<OTasksWindow>(
m_xTasks->getChildContainer(),
this);
249 OSL_ENSURE( !rData.
aTasks.empty(),
"OApplicationDetailView::impl_createPage: no tasks at all!?" );
250 bool bEnabled = !rData.
aTasks.empty()
265 rList.clear(); rList.reserve( 4 );
270 rList.emplace_back(
".uno:DBNewTable", RID_STR_TABLES_HELP_TEXT_DESIGN, RID_STR_NEW_TABLE );
271 rList.emplace_back(
".uno:DBNewTableAutoPilot", RID_STR_TABLES_HELP_TEXT_WIZARD, RID_STR_NEW_TABLE_AUTO );
272 rList.emplace_back(
".uno:DBNewView", RID_STR_VIEWS_HELP_TEXT_DESIGN, RID_STR_NEW_VIEW,
true );
273 _rData.
pTitleId = RID_STR_TABLES_CONTAINER;
277 rList.emplace_back(
".uno:DBNewForm", RID_STR_FORMS_HELP_TEXT, RID_STR_NEW_FORM );
278 rList.emplace_back(
".uno:DBNewFormAutoPilot", RID_STR_FORMS_HELP_TEXT_WIZARD, RID_STR_NEW_FORM_AUTO );
279 _rData.
pTitleId = RID_STR_FORMS_CONTAINER;
283 rList.emplace_back(
".uno:DBNewReport", RID_STR_REPORT_HELP_TEXT, RID_STR_NEW_REPORT,
true );
284 rList.emplace_back(
".uno:DBNewReportAutoPilot", RID_STR_REPORTS_HELP_TEXT_WIZARD, RID_STR_NEW_REPORT_AUTO );
285 _rData.
pTitleId = RID_STR_REPORTS_CONTAINER;
289 rList.emplace_back(
".uno:DBNewQuery", RID_STR_QUERIES_HELP_TEXT, RID_STR_NEW_QUERY );
290 rList.emplace_back(
".uno:DBNewQueryAutoPilot", RID_STR_QUERIES_HELP_TEXT_WIZARD, RID_STR_NEW_QUERY_AUTO );
291 rList.emplace_back(
".uno:DBNewQuerySql", RID_STR_QUERIES_HELP_TEXT_SQL, RID_STR_NEW_QUERY_SQL );
292 _rData.
pTitleId = RID_STR_QUERIES_CONTAINER;
296 OSL_FAIL(
"OApplicationDetailView::impl_fillTaskPaneData: illegal element type!" );
300 for (TaskEntryList::iterator pTask = rList.begin(); pTask != rList.end();)
302 if ( pTask->bHideWhenDisabled
303 && !
getBorderWin().
getView()->getCommandController().isCommandEnabled( pTask->sUNOCommand )
305 pTask = rList.erase( pTask );
317 OSL_ENSURE( ( _eType >= 0 ) && ( _eType <
E_ELEMENT_TYPE_COUNT ),
"OApplicationDetailView::impl_getTaskPaneData: illegal element type!" );
447 ,
const OUString& _rOldName
448 ,
const OUString& _rNewName )
474 const OUString& _sName,
TreeListBox & getListBox() const
virtual bool isCommandEnabled(sal_uInt16 _nCommandId) const =0
checks if the given Command is enabled
virtual bool isDataSourceReadOnly() const =0
checks if the selected data source is read only
OApplicationView * getView() const
void sortUp()
sorts all entries descending
static bool isLeaf(const weld::TreeView &rTreeView, const weld::TreeIter &rEntry)
returns if an entry is a leaf
void sortDown()
sorts all entries ascending
bool isSortUp() const
returns <TRUE> if it sorts ascending
PreviewMode getPreviewMode() const
returns the preview mode
OUString getQualifiedName(const weld::TreeIter *_pEntry) const
return the qualified name.
void elementReplaced(ElementType eType, const OUString &_rOldName, const OUString &_rNewName)
replaces an objects name with a new one
vcl::Window * getMenuParent() const
get the menu parent window for the given control
sal_Int32 getSelectionCount()
returns the count of selected entries
bool isALeafSelected() const
returns if one of the selected entries is a leaf
void selectAll()
select all entries in the visible control
std::unique_ptr< weld::TreeIter > getEntry(const Point &rPosPixel) const
bool isFilled() const
returns <TRUE> when a detail page was filled
DBTreeViewBase * getCurrentView() const
returns the current visible tree list box
void adjustMenuPosition(const weld::TreeView &rControl, ::Point &rPos) const
void elementRemoved(ElementType _eType, const OUString &_rName)
removes an element from the detail page.
bool isPreviewEnabled() const
<TRUE> if the preview is enabled
sal_Int32 getElementCount() const
returns the count of entries
std::unique_ptr< weld::TreeIter > elementAdded(ElementType eType, const OUString &rName, const css::uno::Any &rObject)
adds a new object to the detail page.
void getSelectionElementNames(std::vector< OUString > &_rNames) const
returns the element names which are selected
void createPage(ElementType _eType, const css::uno::Reference< css::container::XNameAccess > &_xContainer)
creates the page for the specific type.
void describeCurrentSelectionForType(const ElementType _eType, css::uno::Sequence< css::sdb::application::NamedDatabaseObject > &_out_rSelectedObjects)
describes the current selection for the given ElementType
void selectElements(const css::uno::Sequence< OUString > &_aNames)
select all names on the currently selected container.
ElementType getElementType() const
return the element of currently select entry
void showPreview(const css::uno::Reference< css::ucb::XContent > &_xContent)
shows the Preview of the content when it is enabled.
void switchPreview(PreviewMode _eMode, bool _bForce=false)
switches to the given preview mode
void describeCurrentSelectionForControl(const weld::TreeView &rControl, css::uno::Sequence< css::sdb::application::NamedDatabaseObject > &_out_rSelectedObjects)
describes the current selection for the given control
void clearPages()
clears the detail pages
void createTablesPage(const css::uno::Reference< css::sdbc::XConnection > &_xConnection)
creates the tables page
sal_Int32 getElementCount() const
returns the count of entries
std::unique_ptr< weld::TreeIter > getEntry(const Point &rPosPixel) const
void impl_createPage(ElementType _eType, const css::uno::Reference< css::sdbc::XConnection > &_rxConnection, const css::uno::Reference< css::container::XNameAccess > &_rxNonTableElements)
void createPage(ElementType _eType, const css::uno::Reference< css::container::XNameAccess > &_xContainer)
creates the page for the specific type.
void impl_fillTaskPaneData(ElementType _eType, TaskPaneData &_rData) const
std::vector< TaskPaneData > m_aTaskPaneData
std::shared_ptr< OChildWindow > m_xControlHelper
void createTablesPage(const css::uno::Reference< css::sdbc::XConnection > &_xConnection)
creates the tables page
static bool isLeaf(const weld::TreeView &rTreeView, const weld::TreeIter &rEntry)
returns if an entry is a leaf
void selectAll()
select all entries in the detail page
OUString getQualifiedName(const weld::TreeIter *_pEntry) const
return the qualified name.
sal_Int32 getSelectionCount()
returns the count of selected entries
const OAppDetailPageHelper * GetControlHelper() const
void setTaskExternalMnemonics(MnemonicGenerator const &_rMnemonics)
void elementRemoved(ElementType _eType, const OUString &_rName)
removes an element from the detail page.
void sortUp()
sort the entries in the detail page up
PreviewMode getPreviewMode() const
returns the preview mode
std::unique_ptr< weld::Paned > m_xHorzSplitter
const TaskPaneData & impl_getTaskPaneData(ElementType _eType)
OTasksWindow & getTasksWindow() const
bool isCopyAllowed() override
ElementType getElementType() const
return the element of currently select entry
std::unique_ptr< weld::TreeIter > elementAdded(ElementType eType, const OUString &rName, const css::uno::Any &rObject)
adds a new object to the detail page.
bool isPasteAllowed() override
vcl::Window * getMenuParent() const
get the menu parent window for the given control
void selectElements(const css::uno::Sequence< OUString > &_aNames)
select all names on the currently selected container.
void describeCurrentSelectionForControl(const weld::TreeView &rControl, css::uno::Sequence< css::sdb::application::NamedDatabaseObject > &_out_rSelectedObjects)
describes the current selection for the given control
bool isALeafSelected() const
returns if one of the selected entries is a leaf
bool isPreviewEnabled() const
<TRUE> if the preview is enabled
OAppBorderWindow & getBorderWin() const
bool isFilled() const
returns <TRUE> when a detail page was filled
MnemonicGenerator m_aExternalMnemonics
void clearPages(bool _bTaskAlso=true)
clears the detail pages.
void showPreview(const css::uno::Reference< css::ucb::XContent > &_xContent)
shows the Preview of the content when it is enabled.
OAppBorderWindow & m_rBorderWin
void describeCurrentSelectionForType(const ElementType _eType, css::uno::Sequence< css::sdb::application::NamedDatabaseObject > &_out_rSelectedObjects)
describes the current selection for the given ElementType
void elementReplaced(ElementType eType, const OUString &_rOldName, const OUString &_rNewName)
replaces an objects name with a new one
bool isCutAllowed() override
~OApplicationDetailView()
bool isSortUp() const
returns <TRUE> if it sorts ascending
std::unique_ptr< OTitleWindow > m_xTasks
bool HasChildPathFocus() const
void sortDown()
sort the entries in the detail page down
std::unique_ptr< OTitleWindow > m_xTitleContainer
void switchPreview(PreviewMode _eMode)
switches to the given preview mode
OApplicationDetailView(weld::Container *pParent, OAppBorderWindow &rBorder, PreviewMode ePreviewMode)
void adjustMenuPosition(const weld::TreeView &rControl, ::Point &rPos) const
TreeListBox * getTreeWindow() const
void getSelectionElementNames(std::vector< OUString > &_rNames) const
returns the element names which are selected
void Enable(bool bEnable)
std::unique_ptr< weld::Container > m_xContainer
IController & getCommandController() const
void setHelpText(TranslateId pId)
OTasksWindow(weld::Container *pParent, OApplicationDetailView *pDetailView)
virtual void GrabFocus() override
void fillTaskEntryList(const TaskEntryList &_rList)
fills the Creation listbox with the necessary strings and images
OApplicationDetailView * getDetailView() const
std::unique_ptr< weld::Label > m_xDescription
virtual bool HasChildPathFocus() const override
std::unique_ptr< weld::TextView > m_xHelpText
std::unique_ptr< weld::TreeView > m_xTreeView
constexpr OUStringLiteral HID_APP_DESCRIPTION_TEXT
constexpr OUStringLiteral HID_APP_CREATION_LIST
constexpr OUStringLiteral HID_APP_HELP_TEXT
#define LINK(Instance, Class, Member)
IMPL_LINK_NOARG(OApplicationController, OnClipboardChanged, TransferableDataHelper *, void)
IMPL_LINK(OApplicationController, OnSelectContainer, void *, _pType, void)
std::vector< TaskEntry > TaskEntryList
SwView * getView(const uno::Reference< frame::XModel > &xModel)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
OUString toId(const void *pValue)
Reference< XNameAccess > m_xContainer
TaskEntryList aTasks
the tasks available in the pane
TranslateId pTitleId
the resource ID for the title of the pane