startcenter: Disable tabs for modules not installed
Change-Id: I74dbd1dab44efa87a78ad3268658895f2d1542db
This commit is contained in:
parent
c09a301dbe
commit
454ff1a48e
@ -70,21 +70,22 @@ BackingWindow::BackingWindow( Window* i_pParent ) :
|
||||
"sfx/ui/startcenter.ui",
|
||||
"StartCenter" );
|
||||
|
||||
get(mpOpenButton, "open");
|
||||
get(mpTemplateButton, "templates");
|
||||
get(mpOpenButton, "open");
|
||||
get(mpTemplateButton, "templates");
|
||||
|
||||
get(mpWriterButton, "writer");
|
||||
get(mpCalcButton, "calc");
|
||||
get(mpImpressButton, "impress");
|
||||
get(mpDrawButton, "draw");
|
||||
get(mpDBButton, "database");
|
||||
get(mpMathButton, "math");
|
||||
get(mpModuleNotebook, "modules_notebook");
|
||||
|
||||
get(mpWriterButton, "writer");
|
||||
get(mpCalcButton, "calc");
|
||||
get(mpImpressButton, "impress");
|
||||
get(mpDrawButton, "draw");
|
||||
get(mpDBButton, "database");
|
||||
get(mpMathButton, "math");
|
||||
|
||||
get(mpExtensionsButton, "extension");
|
||||
get(mpInfoButton, "info");
|
||||
get(mpTplRepButton, "add_temp");
|
||||
|
||||
|
||||
get( mpAllRecentThumbnails, "all_recent");
|
||||
get( mpWriterRecentThumbnails, "writer_recent");
|
||||
get( mpCalcRecentThumbnails, "calc_recent");
|
||||
@ -93,23 +94,6 @@ BackingWindow::BackingWindow( Window* i_pParent ) :
|
||||
get( mpDatabaseRecentThumbnails, "database_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
|
||||
{
|
||||
mxContext.set( ::comphelper::getProcessComponentContext(), uno::UNO_SET_THROW );
|
||||
@ -211,23 +195,39 @@ void BackingWindow::initControls()
|
||||
aFileNewAppsAvailable.insert( sURL );
|
||||
}
|
||||
|
||||
setupButton( mpWriterButton, WRITER_URL, aFileNewAppsAvailable,
|
||||
aModuleOptions, SvtModuleOptions::E_SWRITER );
|
||||
setupButton( mpDrawButton, DRAW_URL, aFileNewAppsAvailable,
|
||||
aModuleOptions, SvtModuleOptions::E_SDRAW );
|
||||
setupButton( mpCalcButton, CALC_URL, aFileNewAppsAvailable,
|
||||
aModuleOptions, SvtModuleOptions::E_SCALC );
|
||||
setupButton( mpDBButton, BASE_URL, aFileNewAppsAvailable,
|
||||
aModuleOptions, SvtModuleOptions::E_SDATABASE );
|
||||
setupButton( mpImpressButton, IMPRESS_WIZARD_URL, aFileNewAppsAvailable,
|
||||
aModuleOptions, SvtModuleOptions::E_SIMPRESS );
|
||||
setupButton( mpMathButton, MATH_URL, aFileNewAppsAvailable,
|
||||
aModuleOptions, SvtModuleOptions::E_SMATH );
|
||||
setupModuleTab( "tab_writer", mpWriterRecentThumbnails, TYPE_WRITER,
|
||||
WRITER_URL, aFileNewAppsAvailable, aModuleOptions,
|
||||
SvtModuleOptions::E_SWRITER );
|
||||
setupModuleTab( "tab_calc", mpCalcRecentThumbnails, TYPE_CALC,
|
||||
DRAW_URL, aFileNewAppsAvailable, aModuleOptions,
|
||||
SvtModuleOptions::E_SDRAW );
|
||||
setupModuleTab( "tab_impress", mpImpressRecentThumbnails, TYPE_IMPRESS,
|
||||
CALC_URL, aFileNewAppsAvailable, aModuleOptions,
|
||||
SvtModuleOptions::E_SCALC );
|
||||
setupModuleTab( "tab_draw", mpDrawRecentThumbnails, TYPE_DRAW,
|
||||
BASE_URL, aFileNewAppsAvailable, aModuleOptions,
|
||||
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,
|
||||
aModuleOptions, SvtModuleOptions::E_SWRITER );
|
||||
setupButton( mpTemplateButton, "", aFileNewAppsAvailable,
|
||||
aModuleOptions, SvtModuleOptions::E_SWRITER );
|
||||
// File types for mpAllRecentThumbnails are added in the above calls
|
||||
// of setupModuleTab. TYPE_OTHER is always added.
|
||||
mpAllRecentThumbnails->mnFileTypes |= TYPE_OTHER;
|
||||
mpAllRecentThumbnails->loadRecentDocs();
|
||||
|
||||
setupButton( mpWriterButton );
|
||||
setupButton( mpDrawButton );
|
||||
setupButton( mpCalcButton );
|
||||
setupButton( mpDBButton );
|
||||
setupButton( mpImpressButton );
|
||||
setupButton( mpMathButton );
|
||||
|
||||
setupButton( mpOpenButton );
|
||||
setupButton( mpTemplateButton );
|
||||
|
||||
setupExternalLink( mpExtensionsButton );
|
||||
setupExternalLink( mpInfoButton );
|
||||
@ -238,17 +238,27 @@ void BackingWindow::initControls()
|
||||
mpWriterButton->GrabFocus();
|
||||
}
|
||||
|
||||
void BackingWindow::setupButton( PushButton* pButton, const OUString &rURL,
|
||||
const std::set<OUString>& rURLS,
|
||||
SvtModuleOptions& rOpt, SvtModuleOptions::EModule eMod )
|
||||
void BackingWindow::setupModuleTab(const OString& rTabName, RecentDocsView* pRecView, int nFileTypes,
|
||||
const OUString &rURL, const std::set<OUString>& rURLS, SvtModuleOptions& rOpt,
|
||||
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()) )
|
||||
{
|
||||
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
|
||||
Font aFont;
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include <vcl/builder.hxx>
|
||||
#include <vcl/button.hxx>
|
||||
#include <vcl/tabctrl.hxx>
|
||||
#include <vcl/layout.hxx>
|
||||
|
||||
#include <sfx2/recentdocsview.hxx>
|
||||
@ -49,6 +50,8 @@ class BackingWindow
|
||||
PushButton* mpOpenButton;
|
||||
PushButton* mpTemplateButton;
|
||||
|
||||
TabControl* mpModuleNotebook;
|
||||
|
||||
PushButton* mpWriterButton;
|
||||
PushButton* mpCalcButton;
|
||||
PushButton* mpImpressButton;
|
||||
@ -68,19 +71,16 @@ class BackingWindow
|
||||
RecentDocsView* mpDatabaseRecentThumbnails;
|
||||
RecentDocsView* mpMathRecentThumbnails;
|
||||
|
||||
BitmapEx maBackgroundLeft;
|
||||
BitmapEx maBackgroundMiddle;
|
||||
BitmapEx maBackgroundRight;
|
||||
|
||||
Rectangle maStartCentButtons;
|
||||
|
||||
bool mbInitControls;
|
||||
sal_Int32 mnHideExternalLinks;
|
||||
svt::AcceleratorExecute* mpAccExec;
|
||||
|
||||
void setupButton( PushButton* pButton, const OUString& rURL, const std::set<OUString>& rURLS,
|
||||
SvtModuleOptions& rOpt, SvtModuleOptions::EModule eMod );
|
||||
|
||||
void setupModuleTab( const OString& rTabName, RecentDocsView* pRecView, int nFileTypes,
|
||||
const OUString& rURL, const std::set<OUString>& rURLS, SvtModuleOptions& rOpt,
|
||||
SvtModuleOptions::EModule eMod );
|
||||
void setupButton( PushButton* pButton );
|
||||
void setupExternalLink( PushButton* pButton );
|
||||
|
||||
void dispatchURL( const OUString& i_rURL,
|
||||
|
@ -44,7 +44,7 @@
|
||||
<property name="row_spacing">12</property>
|
||||
<property name="column_spacing">12</property>
|
||||
<child>
|
||||
<object class="GtkNotebook" id="notebook1">
|
||||
<object class="GtkNotebook" id="modules_notebook">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hexpand">True</property>
|
||||
@ -87,7 +87,7 @@
|
||||
</object>
|
||||
</child>
|
||||
<child type="tab">
|
||||
<object class="GtkLabel" id="label1">
|
||||
<object class="GtkLabel" id="tab_all">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">All Recent</property>
|
||||
@ -150,7 +150,7 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child type="tab">
|
||||
<object class="GtkLabel" id="label2">
|
||||
<object class="GtkLabel" id="tab_writer">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Documents</property>
|
||||
@ -214,7 +214,7 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child type="tab">
|
||||
<object class="GtkLabel" id="label3">
|
||||
<object class="GtkLabel" id="tab_calc">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Spreadsheets</property>
|
||||
@ -278,7 +278,7 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child type="tab">
|
||||
<object class="GtkLabel" id="label4">
|
||||
<object class="GtkLabel" id="tab_impress">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Presentations</property>
|
||||
@ -342,7 +342,7 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child type="tab">
|
||||
<object class="GtkLabel" id="label5">
|
||||
<object class="GtkLabel" id="tab_draw">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Drawings</property>
|
||||
@ -406,7 +406,7 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child type="tab">
|
||||
<object class="GtkLabel" id="label6">
|
||||
<object class="GtkLabel" id="tab_database">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Databases</property>
|
||||
@ -470,7 +470,7 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child type="tab">
|
||||
<object class="GtkLabel" id="label7">
|
||||
<object class="GtkLabel" id="tab_math">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Formulas</property>
|
||||
|
Loading…
x
Reference in New Issue
Block a user