startcenter: Disable tabs for modules not installed
Change-Id: I74dbd1dab44efa87a78ad3268658895f2d1542db
This commit is contained in:
@@ -73,6 +73,8 @@ BackingWindow::BackingWindow( Window* i_pParent ) :
|
|||||||
get(mpOpenButton, "open");
|
get(mpOpenButton, "open");
|
||||||
get(mpTemplateButton, "templates");
|
get(mpTemplateButton, "templates");
|
||||||
|
|
||||||
|
get(mpModuleNotebook, "modules_notebook");
|
||||||
|
|
||||||
get(mpWriterButton, "writer");
|
get(mpWriterButton, "writer");
|
||||||
get(mpCalcButton, "calc");
|
get(mpCalcButton, "calc");
|
||||||
get(mpImpressButton, "impress");
|
get(mpImpressButton, "impress");
|
||||||
@@ -84,7 +86,6 @@ BackingWindow::BackingWindow( Window* i_pParent ) :
|
|||||||
get(mpInfoButton, "info");
|
get(mpInfoButton, "info");
|
||||||
get(mpTplRepButton, "add_temp");
|
get(mpTplRepButton, "add_temp");
|
||||||
|
|
||||||
|
|
||||||
get( mpAllRecentThumbnails, "all_recent");
|
get( mpAllRecentThumbnails, "all_recent");
|
||||||
get( mpWriterRecentThumbnails, "writer_recent");
|
get( mpWriterRecentThumbnails, "writer_recent");
|
||||||
get( mpCalcRecentThumbnails, "calc_recent");
|
get( mpCalcRecentThumbnails, "calc_recent");
|
||||||
@@ -93,23 +94,6 @@ BackingWindow::BackingWindow( Window* i_pParent ) :
|
|||||||
get( mpDatabaseRecentThumbnails, "database_recent");
|
get( mpDatabaseRecentThumbnails, "database_recent");
|
||||||
get( mpMathRecentThumbnails, "math_recent");
|
get( mpMathRecentThumbnails, "math_recent");
|
||||||
|
|
||||||
mpAllRecentThumbnails ->addFileType(TYPE_WRITER | TYPE_CALC |
|
|
||||||
TYPE_IMPRESS | TYPE_DRAW | TYPE_DATABASE | TYPE_MATH | TYPE_OTHER);
|
|
||||||
mpWriterRecentThumbnails ->addFileType(TYPE_WRITER);
|
|
||||||
mpCalcRecentThumbnails ->addFileType(TYPE_CALC);
|
|
||||||
mpImpressRecentThumbnails ->addFileType(TYPE_IMPRESS);
|
|
||||||
mpDrawRecentThumbnails ->addFileType(TYPE_DRAW);
|
|
||||||
mpDatabaseRecentThumbnails ->addFileType(TYPE_DATABASE);
|
|
||||||
mpMathRecentThumbnails ->addFileType(TYPE_MATH);
|
|
||||||
|
|
||||||
mpAllRecentThumbnails ->loadRecentDocs();
|
|
||||||
mpWriterRecentThumbnails ->loadRecentDocs();
|
|
||||||
mpCalcRecentThumbnails ->loadRecentDocs();
|
|
||||||
mpImpressRecentThumbnails ->loadRecentDocs();
|
|
||||||
mpDrawRecentThumbnails ->loadRecentDocs();
|
|
||||||
mpDatabaseRecentThumbnails ->loadRecentDocs();
|
|
||||||
mpMathRecentThumbnails ->loadRecentDocs();
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
mxContext.set( ::comphelper::getProcessComponentContext(), uno::UNO_SET_THROW );
|
mxContext.set( ::comphelper::getProcessComponentContext(), uno::UNO_SET_THROW );
|
||||||
@@ -211,23 +195,39 @@ void BackingWindow::initControls()
|
|||||||
aFileNewAppsAvailable.insert( sURL );
|
aFileNewAppsAvailable.insert( sURL );
|
||||||
}
|
}
|
||||||
|
|
||||||
setupButton( mpWriterButton, WRITER_URL, aFileNewAppsAvailable,
|
setupModuleTab( "tab_writer", mpWriterRecentThumbnails, TYPE_WRITER,
|
||||||
aModuleOptions, SvtModuleOptions::E_SWRITER );
|
WRITER_URL, aFileNewAppsAvailable, aModuleOptions,
|
||||||
setupButton( mpDrawButton, DRAW_URL, aFileNewAppsAvailable,
|
SvtModuleOptions::E_SWRITER );
|
||||||
aModuleOptions, SvtModuleOptions::E_SDRAW );
|
setupModuleTab( "tab_calc", mpCalcRecentThumbnails, TYPE_CALC,
|
||||||
setupButton( mpCalcButton, CALC_URL, aFileNewAppsAvailable,
|
DRAW_URL, aFileNewAppsAvailable, aModuleOptions,
|
||||||
aModuleOptions, SvtModuleOptions::E_SCALC );
|
SvtModuleOptions::E_SDRAW );
|
||||||
setupButton( mpDBButton, BASE_URL, aFileNewAppsAvailable,
|
setupModuleTab( "tab_impress", mpImpressRecentThumbnails, TYPE_IMPRESS,
|
||||||
aModuleOptions, SvtModuleOptions::E_SDATABASE );
|
CALC_URL, aFileNewAppsAvailable, aModuleOptions,
|
||||||
setupButton( mpImpressButton, IMPRESS_WIZARD_URL, aFileNewAppsAvailable,
|
SvtModuleOptions::E_SCALC );
|
||||||
aModuleOptions, SvtModuleOptions::E_SIMPRESS );
|
setupModuleTab( "tab_draw", mpDrawRecentThumbnails, TYPE_DRAW,
|
||||||
setupButton( mpMathButton, MATH_URL, aFileNewAppsAvailable,
|
BASE_URL, aFileNewAppsAvailable, aModuleOptions,
|
||||||
aModuleOptions, SvtModuleOptions::E_SMATH );
|
SvtModuleOptions::E_SDATABASE );
|
||||||
|
setupModuleTab( "tab_database", mpDatabaseRecentThumbnails, TYPE_DATABASE,
|
||||||
|
IMPRESS_WIZARD_URL, aFileNewAppsAvailable, aModuleOptions,
|
||||||
|
SvtModuleOptions::E_SIMPRESS );
|
||||||
|
setupModuleTab( "tab_math", mpMathRecentThumbnails, TYPE_MATH,
|
||||||
|
MATH_URL, aFileNewAppsAvailable, aModuleOptions,
|
||||||
|
SvtModuleOptions::E_SMATH );
|
||||||
|
|
||||||
setupButton( mpOpenButton, "", aFileNewAppsAvailable,
|
// File types for mpAllRecentThumbnails are added in the above calls
|
||||||
aModuleOptions, SvtModuleOptions::E_SWRITER );
|
// of setupModuleTab. TYPE_OTHER is always added.
|
||||||
setupButton( mpTemplateButton, "", aFileNewAppsAvailable,
|
mpAllRecentThumbnails->mnFileTypes |= TYPE_OTHER;
|
||||||
aModuleOptions, SvtModuleOptions::E_SWRITER );
|
mpAllRecentThumbnails->loadRecentDocs();
|
||||||
|
|
||||||
|
setupButton( mpWriterButton );
|
||||||
|
setupButton( mpDrawButton );
|
||||||
|
setupButton( mpCalcButton );
|
||||||
|
setupButton( mpDBButton );
|
||||||
|
setupButton( mpImpressButton );
|
||||||
|
setupButton( mpMathButton );
|
||||||
|
|
||||||
|
setupButton( mpOpenButton );
|
||||||
|
setupButton( mpTemplateButton );
|
||||||
|
|
||||||
setupExternalLink( mpExtensionsButton );
|
setupExternalLink( mpExtensionsButton );
|
||||||
setupExternalLink( mpInfoButton );
|
setupExternalLink( mpInfoButton );
|
||||||
@@ -238,17 +238,27 @@ void BackingWindow::initControls()
|
|||||||
mpWriterButton->GrabFocus();
|
mpWriterButton->GrabFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BackingWindow::setupButton( PushButton* pButton, const OUString &rURL,
|
void BackingWindow::setupModuleTab(const OString& rTabName, RecentDocsView* pRecView, int nFileTypes,
|
||||||
const std::set<OUString>& rURLS,
|
const OUString &rURL, const std::set<OUString>& rURLS, SvtModuleOptions& rOpt,
|
||||||
SvtModuleOptions& rOpt, SvtModuleOptions::EModule eMod )
|
SvtModuleOptions::EModule eMod)
|
||||||
{
|
{
|
||||||
pButton->SetClickHdl( LINK( this, BackingWindow, ClickHdl ) );
|
|
||||||
|
|
||||||
// disable the parts that are not installed
|
|
||||||
if( !rURL.isEmpty() && (!rOpt.IsModuleInstalled( eMod ) || rURLS.find( rURL ) == rURLS.end()) )
|
if( !rURL.isEmpty() && (!rOpt.IsModuleInstalled( eMod ) || rURLS.find( rURL ) == rURLS.end()) )
|
||||||
{
|
{
|
||||||
pButton->Enable( sal_False );
|
// disable the parts that are not installed
|
||||||
|
mpModuleNotebook->RemovePage( mpModuleNotebook->GetPageId(rTabName) );
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// if a module is installed, add that filetype to the "All" page
|
||||||
|
mpAllRecentThumbnails-> mnFileTypes |= nFileTypes;
|
||||||
|
pRecView->mnFileTypes |= nFileTypes;
|
||||||
|
pRecView->loadRecentDocs();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void BackingWindow::setupButton( PushButton* pButton )
|
||||||
|
{
|
||||||
|
pButton->SetClickHdl( LINK( this, BackingWindow, ClickHdl ) );
|
||||||
|
|
||||||
// setup text - slighly larger font than normal labels on the texts
|
// setup text - slighly larger font than normal labels on the texts
|
||||||
Font aFont;
|
Font aFont;
|
||||||
|
@@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include <vcl/builder.hxx>
|
#include <vcl/builder.hxx>
|
||||||
#include <vcl/button.hxx>
|
#include <vcl/button.hxx>
|
||||||
|
#include <vcl/tabctrl.hxx>
|
||||||
#include <vcl/layout.hxx>
|
#include <vcl/layout.hxx>
|
||||||
|
|
||||||
#include <sfx2/recentdocsview.hxx>
|
#include <sfx2/recentdocsview.hxx>
|
||||||
@@ -49,6 +50,8 @@ class BackingWindow
|
|||||||
PushButton* mpOpenButton;
|
PushButton* mpOpenButton;
|
||||||
PushButton* mpTemplateButton;
|
PushButton* mpTemplateButton;
|
||||||
|
|
||||||
|
TabControl* mpModuleNotebook;
|
||||||
|
|
||||||
PushButton* mpWriterButton;
|
PushButton* mpWriterButton;
|
||||||
PushButton* mpCalcButton;
|
PushButton* mpCalcButton;
|
||||||
PushButton* mpImpressButton;
|
PushButton* mpImpressButton;
|
||||||
@@ -68,19 +71,16 @@ class BackingWindow
|
|||||||
RecentDocsView* mpDatabaseRecentThumbnails;
|
RecentDocsView* mpDatabaseRecentThumbnails;
|
||||||
RecentDocsView* mpMathRecentThumbnails;
|
RecentDocsView* mpMathRecentThumbnails;
|
||||||
|
|
||||||
BitmapEx maBackgroundLeft;
|
|
||||||
BitmapEx maBackgroundMiddle;
|
|
||||||
BitmapEx maBackgroundRight;
|
|
||||||
|
|
||||||
Rectangle maStartCentButtons;
|
Rectangle maStartCentButtons;
|
||||||
|
|
||||||
bool mbInitControls;
|
bool mbInitControls;
|
||||||
sal_Int32 mnHideExternalLinks;
|
sal_Int32 mnHideExternalLinks;
|
||||||
svt::AcceleratorExecute* mpAccExec;
|
svt::AcceleratorExecute* mpAccExec;
|
||||||
|
|
||||||
void setupButton( PushButton* pButton, const OUString& rURL, const std::set<OUString>& rURLS,
|
void setupModuleTab( const OString& rTabName, RecentDocsView* pRecView, int nFileTypes,
|
||||||
SvtModuleOptions& rOpt, SvtModuleOptions::EModule eMod );
|
const OUString& rURL, const std::set<OUString>& rURLS, SvtModuleOptions& rOpt,
|
||||||
|
SvtModuleOptions::EModule eMod );
|
||||||
|
void setupButton( PushButton* pButton );
|
||||||
void setupExternalLink( PushButton* pButton );
|
void setupExternalLink( PushButton* pButton );
|
||||||
|
|
||||||
void dispatchURL( const OUString& i_rURL,
|
void dispatchURL( const OUString& i_rURL,
|
||||||
|
@@ -44,7 +44,7 @@
|
|||||||
<property name="row_spacing">12</property>
|
<property name="row_spacing">12</property>
|
||||||
<property name="column_spacing">12</property>
|
<property name="column_spacing">12</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkNotebook" id="notebook1">
|
<object class="GtkNotebook" id="modules_notebook">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="hexpand">True</property>
|
<property name="hexpand">True</property>
|
||||||
@@ -87,7 +87,7 @@
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child type="tab">
|
<child type="tab">
|
||||||
<object class="GtkLabel" id="label1">
|
<object class="GtkLabel" id="tab_all">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="label" translatable="yes">All Recent</property>
|
<property name="label" translatable="yes">All Recent</property>
|
||||||
@@ -150,7 +150,7 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child type="tab">
|
<child type="tab">
|
||||||
<object class="GtkLabel" id="label2">
|
<object class="GtkLabel" id="tab_writer">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="label" translatable="yes">Documents</property>
|
<property name="label" translatable="yes">Documents</property>
|
||||||
@@ -214,7 +214,7 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child type="tab">
|
<child type="tab">
|
||||||
<object class="GtkLabel" id="label3">
|
<object class="GtkLabel" id="tab_calc">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="label" translatable="yes">Spreadsheets</property>
|
<property name="label" translatable="yes">Spreadsheets</property>
|
||||||
@@ -278,7 +278,7 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child type="tab">
|
<child type="tab">
|
||||||
<object class="GtkLabel" id="label4">
|
<object class="GtkLabel" id="tab_impress">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="label" translatable="yes">Presentations</property>
|
<property name="label" translatable="yes">Presentations</property>
|
||||||
@@ -342,7 +342,7 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child type="tab">
|
<child type="tab">
|
||||||
<object class="GtkLabel" id="label5">
|
<object class="GtkLabel" id="tab_draw">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="label" translatable="yes">Drawings</property>
|
<property name="label" translatable="yes">Drawings</property>
|
||||||
@@ -406,7 +406,7 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child type="tab">
|
<child type="tab">
|
||||||
<object class="GtkLabel" id="label6">
|
<object class="GtkLabel" id="tab_database">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="label" translatable="yes">Databases</property>
|
<property name="label" translatable="yes">Databases</property>
|
||||||
@@ -470,7 +470,7 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child type="tab">
|
<child type="tab">
|
||||||
<object class="GtkLabel" id="label7">
|
<object class="GtkLabel" id="tab_math">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="label" translatable="yes">Formulas</property>
|
<property name="label" translatable="yes">Formulas</property>
|
||||||
|
Reference in New Issue
Block a user