untangle the bFmt == 2 hack
Firstly, IsFormat is unused so there's no "escape" of bFmt back into the outside world. Then bFmt has two purposes. Purpose 1 is 'not be a format dialog, be a format dialog, be a format dialog but hide standard button' so, lets just add an explicit "Hide standard button" method and call it in the (apparently) one place where it's necessary. Purpose 2 is to flag that "BaseFmtHdl" was called from clicking the "Standard" button at which point its set to 2. SfxTabDialog::Init_Impl had... " // bFmt = temporary Flag passed on in the Constructor(), // if bFmt == 2, then also sal_True, // additional suppression of the standard button, // after the Initializing set to sal_True again if ( bFmtFlag != 2 ) m_pBaseFmtBtn->Show(); else bFmtFlag = sal_True; " but the variable acted on is bFmtFlag a copy of bFmt, and is never read again after that line, so setting it to sal_True is meaningless. The comment suggests that the intent is to reset bFmt to true if it was 2 during initialization, which fits with the later use of bFmt == 2 to indicate that the standard button was clicked, i.e. reset bFmt back to its standard value. So make bFmt a simple toggle of dialog as a format dialog or not, add a way to remove the standard button and add a second variable to indicate the standard button got pressed. Change-Id: I98a441f5f314845abe243e05b6d92fd71d7b0b04
This commit is contained in:
@@ -62,9 +62,7 @@ using namespace ::com::sun::star;
|
|||||||
|
|
||||||
ImpPDFTabDialog::ImpPDFTabDialog(Window* pParent, Sequence< PropertyValue >& rFilterData,
|
ImpPDFTabDialog::ImpPDFTabDialog(Window* pParent, Sequence< PropertyValue >& rFilterData,
|
||||||
const Reference< XComponent >& rxDoc)
|
const Reference< XComponent >& rxDoc)
|
||||||
: SfxTabDialog(pParent, "PdfOptionsDialog","filter/ui/pdfoptionsdialog.ui",
|
: SfxTabDialog(pParent, "PdfOptionsDialog","filter/ui/pdfoptionsdialog.ui"),
|
||||||
0, false),
|
|
||||||
|
|
||||||
maConfigItem( "Office.Common/Filter/PDF/Export/", &rFilterData ),
|
maConfigItem( "Office.Common/Filter/PDF/Export/", &rFilterData ),
|
||||||
maConfigI18N( "Office.Common/I18N/CTL/" ),
|
maConfigI18N( "Office.Common/I18N/CTL/" ),
|
||||||
mnSigningPageId(0),
|
mnSigningPageId(0),
|
||||||
|
@@ -93,7 +93,7 @@ friend class SfxTabDialogController;
|
|||||||
sal_uInt16* pRanges;
|
sal_uInt16* pRanges;
|
||||||
sal_uInt16 nAppPageId;
|
sal_uInt16 nAppPageId;
|
||||||
bool bItemsReset;
|
bool bItemsReset;
|
||||||
sal_Bool bFmt; // sal_True, sal_False or 2(some kind of hack)
|
bool bStandardPushed;
|
||||||
|
|
||||||
DECL_DLLPRIVATE_LINK( ActivatePageHdl, TabControl * );
|
DECL_DLLPRIVATE_LINK( ActivatePageHdl, TabControl * );
|
||||||
DECL_DLLPRIVATE_LINK( DeactivatePageHdl, TabControl * );
|
DECL_DLLPRIVATE_LINK( DeactivatePageHdl, TabControl * );
|
||||||
@@ -102,7 +102,7 @@ friend class SfxTabDialogController;
|
|||||||
DECL_DLLPRIVATE_LINK(BaseFmtHdl, void *);
|
DECL_DLLPRIVATE_LINK(BaseFmtHdl, void *);
|
||||||
DECL_DLLPRIVATE_LINK(UserHdl, void *);
|
DECL_DLLPRIVATE_LINK(UserHdl, void *);
|
||||||
DECL_DLLPRIVATE_LINK(CancelHdl, void *);
|
DECL_DLLPRIVATE_LINK(CancelHdl, void *);
|
||||||
SAL_DLLPRIVATE void Init_Impl( sal_Bool bFmtFlag, const OUString* pUserButtonText, const ResId* pResId );
|
SAL_DLLPRIVATE void Init_Impl(bool bFmtFlag, const OUString* pUserButtonText, const ResId* pResId);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual short Ok();
|
virtual short Ok();
|
||||||
@@ -128,12 +128,12 @@ protected:
|
|||||||
void SavePosAndId();
|
void SavePosAndId();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SfxTabDialog( Window* pParent,
|
SfxTabDialog(Window* pParent,
|
||||||
const OString& rID, const OUString& rUIXMLDescription,
|
const OString& rID, const OUString& rUIXMLDescription,
|
||||||
const SfxItemSet * = 0, sal_Bool bEditFmt = sal_False );
|
const SfxItemSet * = 0, bool bEditFmt = false);
|
||||||
SfxTabDialog( SfxViewFrame *pViewFrame, Window* pParent,
|
SfxTabDialog(SfxViewFrame *pViewFrame, Window* pParent,
|
||||||
const OString& rID, const OUString& rUIXMLDescription,
|
const OString& rID, const OUString& rUIXMLDescription,
|
||||||
const SfxItemSet * = 0, sal_Bool bEditFmt = sal_False );
|
const SfxItemSet * = 0, bool bEditFmt = false);
|
||||||
virtual ~SfxTabDialog();
|
virtual ~SfxTabDialog();
|
||||||
|
|
||||||
sal_uInt16 AddTabPage( const OString& rName, // Name of the label for the page in the notebook .ui
|
sal_uInt16 AddTabPage( const OString& rName, // Name of the label for the page in the notebook .ui
|
||||||
@@ -198,7 +198,6 @@ public:
|
|||||||
const sal_uInt16* GetInputRanges( const SfxItemPool& );
|
const sal_uInt16* GetInputRanges( const SfxItemPool& );
|
||||||
void SetInputSet( const SfxItemSet* pInSet );
|
void SetInputSet( const SfxItemSet* pInSet );
|
||||||
const SfxItemSet* GetOutputItemSet() const { return pOutSet; }
|
const SfxItemSet* GetOutputItemSet() const { return pOutSet; }
|
||||||
sal_Bool IsFormat() const { return bFmt; }
|
|
||||||
|
|
||||||
const PushButton& GetOKButton() const { return *m_pOKBtn; }
|
const PushButton& GetOKButton() const { return *m_pOKBtn; }
|
||||||
PushButton& GetOKButton() { return *m_pOKBtn; }
|
PushButton& GetOKButton() { return *m_pOKBtn; }
|
||||||
@@ -210,6 +209,7 @@ public:
|
|||||||
const PushButton* GetUserButton() const { return m_pUserBtn; }
|
const PushButton* GetUserButton() const { return m_pUserBtn; }
|
||||||
PushButton* GetUserButton() { return m_pUserBtn; }
|
PushButton* GetUserButton() { return m_pUserBtn; }
|
||||||
void RemoveResetButton();
|
void RemoveResetButton();
|
||||||
|
void RemoveStandardButton();
|
||||||
|
|
||||||
short Execute() SAL_OVERRIDE;
|
short Execute() SAL_OVERRIDE;
|
||||||
void StartExecuteModal( const Link& rEndDialogHdl ) SAL_OVERRIDE;
|
void StartExecuteModal( const Link& rEndDialogHdl ) SAL_OVERRIDE;
|
||||||
|
@@ -42,15 +42,15 @@ SfxStyleDialog::SfxStyleDialog
|
|||||||
Constructor: Add Manage TabPage, set ExampleSet from style.
|
Constructor: Add Manage TabPage, set ExampleSet from style.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
: SfxTabDialog( pParent, rID, rUIXMLDescription,
|
: SfxTabDialog(pParent, rID, rUIXMLDescription,
|
||||||
rStyle.GetItemSet().Clone(),
|
rStyle.GetItemSet().Clone(), true)
|
||||||
// return TRUE also without ParentSupport , but extended
|
|
||||||
// to suppress the standardButton
|
|
||||||
rStyle.HasParentSupport() ? sal_True : 2 )
|
|
||||||
|
|
||||||
, pStyle( &rStyle )
|
, pStyle( &rStyle )
|
||||||
|
|
||||||
{
|
{
|
||||||
|
// without ParentSupport suppress the standardButton
|
||||||
|
if (!rStyle.HasParentSupport())
|
||||||
|
RemoveStandardButton();
|
||||||
|
|
||||||
m_nOrganizerId = AddTabPage("organizer", SfxManageStyleSheetPage::Create, 0);
|
m_nOrganizerId = AddTabPage("organizer", SfxManageStyleSheetPage::Create, 0);
|
||||||
|
|
||||||
// With new template always set the management page as the current page
|
// With new template always set the management page as the current page
|
||||||
|
@@ -397,8 +397,7 @@ SfxTabDialog::SfxTabDialog
|
|||||||
const OString& rID, const OUString& rUIXMLDescription, //Dialog Name, Dialog .ui path
|
const OString& rID, const OUString& rUIXMLDescription, //Dialog Name, Dialog .ui path
|
||||||
const SfxItemSet* pItemSet, // Itemset with the data;
|
const SfxItemSet* pItemSet, // Itemset with the data;
|
||||||
// can be NULL, when Pages are onDemand
|
// can be NULL, when Pages are onDemand
|
||||||
sal_Bool bEditFmt // Flag: templates are processed
|
bool bEditFmt // when yes -> additional Button for standard
|
||||||
// when yes -> additional Button for standard
|
|
||||||
)
|
)
|
||||||
: TabDialog(pParent, rID, rUIXMLDescription)
|
: TabDialog(pParent, rID, rUIXMLDescription)
|
||||||
, pFrame(pViewFrame)
|
, pFrame(pViewFrame)
|
||||||
@@ -407,10 +406,10 @@ SfxTabDialog::SfxTabDialog
|
|||||||
, pRanges(0)
|
, pRanges(0)
|
||||||
, nAppPageId(USHRT_MAX)
|
, nAppPageId(USHRT_MAX)
|
||||||
, bItemsReset(false)
|
, bItemsReset(false)
|
||||||
, bFmt(bEditFmt)
|
, bStandardPushed(false)
|
||||||
, pExampleSet(0)
|
, pExampleSet(0)
|
||||||
{
|
{
|
||||||
Init_Impl( bFmt, NULL, NULL );
|
Init_Impl(bEditFmt, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -427,8 +426,7 @@ SfxTabDialog::SfxTabDialog
|
|||||||
const OString& rID, const OUString& rUIXMLDescription, //Dialog Name, Dialog .ui path
|
const OString& rID, const OUString& rUIXMLDescription, //Dialog Name, Dialog .ui path
|
||||||
const SfxItemSet* pItemSet, // Itemset with the data;
|
const SfxItemSet* pItemSet, // Itemset with the data;
|
||||||
// can be NULL, when Pages are onDemand
|
// can be NULL, when Pages are onDemand
|
||||||
sal_Bool bEditFmt // Flag: templates are processed
|
bool bEditFmt // when yes -> additional Button for standard
|
||||||
// when yes -> additional Button for standard
|
|
||||||
)
|
)
|
||||||
: TabDialog(pParent, rID, rUIXMLDescription)
|
: TabDialog(pParent, rID, rUIXMLDescription)
|
||||||
, pFrame(0)
|
, pFrame(0)
|
||||||
@@ -437,10 +435,10 @@ SfxTabDialog::SfxTabDialog
|
|||||||
, pRanges(0)
|
, pRanges(0)
|
||||||
, nAppPageId(USHRT_MAX)
|
, nAppPageId(USHRT_MAX)
|
||||||
, bItemsReset(false)
|
, bItemsReset(false)
|
||||||
, bFmt(bEditFmt)
|
, bStandardPushed(false)
|
||||||
, pExampleSet(0)
|
, pExampleSet(0)
|
||||||
{
|
{
|
||||||
Init_Impl(bFmt, NULL, NULL);
|
Init_Impl(bEditFmt, NULL, NULL);
|
||||||
DBG_WARNING( "Please use the Construtor with the ViewFrame" );
|
DBG_WARNING( "Please use the Construtor with the ViewFrame" );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -510,7 +508,7 @@ SfxTabDialog::~SfxTabDialog()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void SfxTabDialog::Init_Impl( sal_Bool bFmtFlag, const OUString* pUserButtonText, const ResId *pResId )
|
void SfxTabDialog::Init_Impl(bool bFmtFlag, const OUString* pUserButtonText, const ResId *pResId)
|
||||||
|
|
||||||
/* [Description]
|
/* [Description]
|
||||||
|
|
||||||
@@ -607,22 +605,12 @@ void SfxTabDialog::Init_Impl( sal_Bool bFmtFlag, const OUString* pUserButtonText
|
|||||||
m_pUserBtn->Show();
|
m_pUserBtn->Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: Check what is up with bFmt/bFmtFlag. Comment below suggests a
|
|
||||||
different behavior than implemented!! */
|
|
||||||
if ( bFmtFlag )
|
if ( bFmtFlag )
|
||||||
{
|
{
|
||||||
m_pBaseFmtBtn->SetText( SfxResId( STR_STANDARD_SHORTCUT ).toString() );
|
m_pBaseFmtBtn->SetText( SfxResId( STR_STANDARD_SHORTCUT ).toString() );
|
||||||
m_pBaseFmtBtn->SetClickHdl( LINK( this, SfxTabDialog, BaseFmtHdl ) );
|
m_pBaseFmtBtn->SetClickHdl( LINK( this, SfxTabDialog, BaseFmtHdl ) );
|
||||||
m_pBaseFmtBtn->SetHelpId( HID_TABDLG_STANDARD_BTN );
|
m_pBaseFmtBtn->SetHelpId( HID_TABDLG_STANDARD_BTN );
|
||||||
|
m_pBaseFmtBtn->Show();
|
||||||
// bFmt = temporary Flag passed on in the Constructor(),
|
|
||||||
// if bFmt == 2, then also sal_True,
|
|
||||||
// additional suppression of the standard button,
|
|
||||||
// after the Initializing set to sal_True again
|
|
||||||
if ( bFmtFlag != 2 )
|
|
||||||
m_pBaseFmtBtn->Show();
|
|
||||||
else
|
|
||||||
bFmtFlag = sal_True;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( pSet )
|
if ( pSet )
|
||||||
@@ -632,15 +620,16 @@ void SfxTabDialog::Init_Impl( sal_Bool bFmtFlag, const OUString* pUserButtonText
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void SfxTabDialog::RemoveResetButton()
|
void SfxTabDialog::RemoveResetButton()
|
||||||
{
|
{
|
||||||
m_pResetBtn->Hide();
|
m_pResetBtn->Hide();
|
||||||
pImpl->bHideResetBtn = true;
|
pImpl->bHideResetBtn = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SfxTabDialog::RemoveStandardButton()
|
||||||
|
{
|
||||||
|
m_pBaseFmtBtn->Hide();
|
||||||
|
}
|
||||||
|
|
||||||
short SfxTabDialog::Execute()
|
short SfxTabDialog::Execute()
|
||||||
{
|
{
|
||||||
@@ -922,7 +911,6 @@ short SfxTabDialog::Ok()
|
|||||||
RET_OK: if at least one page has returned from FillItemSet,
|
RET_OK: if at least one page has returned from FillItemSet,
|
||||||
otherwise RET_CANCEL.
|
otherwise RET_CANCEL.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
{
|
{
|
||||||
SavePosAndId(); //See fdo#38828 "Apply" resetting window position
|
SavePosAndId(); //See fdo#38828 "Apply" resetting window position
|
||||||
|
|
||||||
@@ -966,13 +954,11 @@ short SfxTabDialog::Ok()
|
|||||||
if ( pImpl->bModified || ( pOutSet && pOutSet->Count() > 0 ) )
|
if ( pImpl->bModified || ( pOutSet && pOutSet->Count() > 0 ) )
|
||||||
bModified |= true;
|
bModified |= true;
|
||||||
|
|
||||||
if ( bFmt == 2 )
|
if (bStandardPushed)
|
||||||
bModified |= true;
|
bModified |= true;
|
||||||
return bModified ? RET_OK : RET_CANCEL;
|
return bModified ? RET_OK : RET_CANCEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
IMPL_LINK_NOARG(SfxTabDialog, CancelHdl)
|
IMPL_LINK_NOARG(SfxTabDialog, CancelHdl)
|
||||||
{
|
{
|
||||||
EndDialog( RET_USER_CANCEL );
|
EndDialog( RET_USER_CANCEL );
|
||||||
@@ -1145,10 +1131,11 @@ IMPL_LINK_NOARG(SfxTabDialog, BaseFmtHdl)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
{
|
{
|
||||||
|
bStandardPushed = true;
|
||||||
|
|
||||||
const sal_uInt16 nId = m_pTabCtrl->GetCurPageId();
|
const sal_uInt16 nId = m_pTabCtrl->GetCurPageId();
|
||||||
Data_Impl* pDataObject = Find( pImpl->aData, nId );
|
Data_Impl* pDataObject = Find( pImpl->aData, nId );
|
||||||
DBG_ASSERT( pDataObject, "Id not known" );
|
DBG_ASSERT( pDataObject, "Id not known" );
|
||||||
bFmt = 2;
|
|
||||||
|
|
||||||
if ( pDataObject->fnGetRanges )
|
if ( pDataObject->fnGetRanges )
|
||||||
{
|
{
|
||||||
|
@@ -94,7 +94,7 @@ void SwLabDlg::PageCreated(sal_uInt16 nId, SfxTabPage &rPage)
|
|||||||
SwLabDlg::SwLabDlg(Window* pParent, const SfxItemSet& rSet,
|
SwLabDlg::SwLabDlg(Window* pParent, const SfxItemSet& rSet,
|
||||||
SwNewDBMgr* pDBMgr, sal_Bool bLabel)
|
SwNewDBMgr* pDBMgr, sal_Bool bLabel)
|
||||||
: SfxTabDialog(pParent, "LabelDialog",
|
: SfxTabDialog(pParent, "LabelDialog",
|
||||||
"modules/swriter/ui/labeldialog.ui", &rSet, false)
|
"modules/swriter/ui/labeldialog.ui", &rSet)
|
||||||
, pNewDBMgr(pDBMgr)
|
, pNewDBMgr(pDBMgr)
|
||||||
, pPrtPage(0)
|
, pPrtPage(0)
|
||||||
, aTypeIds(50, 10)
|
, aTypeIds(50, 10)
|
||||||
|
@@ -915,7 +915,7 @@ SwSvxNumBulletTabDialog::SwSvxNumBulletTabDialog(Window* pParent,
|
|||||||
const SfxItemSet* pSwItemSet, SwWrtShell & rSh)
|
const SfxItemSet* pSwItemSet, SwWrtShell & rSh)
|
||||||
: SfxTabDialog(pParent, "BulletsAndNumberingDialog",
|
: SfxTabDialog(pParent, "BulletsAndNumberingDialog",
|
||||||
"modules/swriter/ui/bulletsandnumbering.ui",
|
"modules/swriter/ui/bulletsandnumbering.ui",
|
||||||
pSwItemSet, sal_False)
|
pSwItemSet)
|
||||||
, rWrtSh(rSh)
|
, rWrtSh(rSh)
|
||||||
{
|
{
|
||||||
GetUserButton()->SetClickHdl(LINK(this, SwSvxNumBulletTabDialog, RemoveNumberingHdl));
|
GetUserButton()->SetClickHdl(LINK(this, SwSvxNumBulletTabDialog, RemoveNumberingHdl));
|
||||||
|
@@ -1202,7 +1202,7 @@ void SwTableColumnPage::SetVisibleWidth(sal_uInt16 nPos, SwTwips nNewWidth)
|
|||||||
SwTableTabDlg::SwTableTabDlg(Window* pParent, SfxItemPool&,
|
SwTableTabDlg::SwTableTabDlg(Window* pParent, SfxItemPool&,
|
||||||
const SfxItemSet* pItemSet, SwWrtShell* pSh)
|
const SfxItemSet* pItemSet, SwWrtShell* pSh)
|
||||||
: SfxTabDialog(0, pParent, "TablePropertiesDialog",
|
: SfxTabDialog(0, pParent, "TablePropertiesDialog",
|
||||||
"modules/swriter/ui/tableproperties.ui", pItemSet, 0)
|
"modules/swriter/ui/tableproperties.ui", pItemSet)
|
||||||
, pShell(pSh)
|
, pShell(pSh)
|
||||||
, m_nHtmlMode(::GetHtmlMode(pSh->GetView().GetDocShell()))
|
, m_nHtmlMode(::GetHtmlMode(pSh->GetView().GetDocShell()))
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user