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,
|
||||
const Reference< XComponent >& rxDoc)
|
||||
: SfxTabDialog(pParent, "PdfOptionsDialog","filter/ui/pdfoptionsdialog.ui",
|
||||
0, false),
|
||||
|
||||
: SfxTabDialog(pParent, "PdfOptionsDialog","filter/ui/pdfoptionsdialog.ui"),
|
||||
maConfigItem( "Office.Common/Filter/PDF/Export/", &rFilterData ),
|
||||
maConfigI18N( "Office.Common/I18N/CTL/" ),
|
||||
mnSigningPageId(0),
|
||||
|
@@ -93,7 +93,7 @@ friend class SfxTabDialogController;
|
||||
sal_uInt16* pRanges;
|
||||
sal_uInt16 nAppPageId;
|
||||
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( DeactivatePageHdl, TabControl * );
|
||||
@@ -102,7 +102,7 @@ friend class SfxTabDialogController;
|
||||
DECL_DLLPRIVATE_LINK(BaseFmtHdl, void *);
|
||||
DECL_DLLPRIVATE_LINK(UserHdl, 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:
|
||||
virtual short Ok();
|
||||
@@ -128,12 +128,12 @@ protected:
|
||||
void SavePosAndId();
|
||||
|
||||
public:
|
||||
SfxTabDialog( Window* pParent,
|
||||
const OString& rID, const OUString& rUIXMLDescription,
|
||||
const SfxItemSet * = 0, sal_Bool bEditFmt = sal_False );
|
||||
SfxTabDialog( SfxViewFrame *pViewFrame, Window* pParent,
|
||||
const OString& rID, const OUString& rUIXMLDescription,
|
||||
const SfxItemSet * = 0, sal_Bool bEditFmt = sal_False );
|
||||
SfxTabDialog(Window* pParent,
|
||||
const OString& rID, const OUString& rUIXMLDescription,
|
||||
const SfxItemSet * = 0, bool bEditFmt = false);
|
||||
SfxTabDialog(SfxViewFrame *pViewFrame, Window* pParent,
|
||||
const OString& rID, const OUString& rUIXMLDescription,
|
||||
const SfxItemSet * = 0, bool bEditFmt = false);
|
||||
virtual ~SfxTabDialog();
|
||||
|
||||
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& );
|
||||
void SetInputSet( const SfxItemSet* pInSet );
|
||||
const SfxItemSet* GetOutputItemSet() const { return pOutSet; }
|
||||
sal_Bool IsFormat() const { return bFmt; }
|
||||
|
||||
const PushButton& GetOKButton() const { return *m_pOKBtn; }
|
||||
PushButton& GetOKButton() { return *m_pOKBtn; }
|
||||
@@ -210,6 +209,7 @@ public:
|
||||
const PushButton* GetUserButton() const { return m_pUserBtn; }
|
||||
PushButton* GetUserButton() { return m_pUserBtn; }
|
||||
void RemoveResetButton();
|
||||
void RemoveStandardButton();
|
||||
|
||||
short Execute() SAL_OVERRIDE;
|
||||
void StartExecuteModal( const Link& rEndDialogHdl ) SAL_OVERRIDE;
|
||||
|
@@ -42,15 +42,15 @@ SfxStyleDialog::SfxStyleDialog
|
||||
Constructor: Add Manage TabPage, set ExampleSet from style.
|
||||
*/
|
||||
|
||||
: SfxTabDialog( pParent, rID, rUIXMLDescription,
|
||||
rStyle.GetItemSet().Clone(),
|
||||
// return TRUE also without ParentSupport , but extended
|
||||
// to suppress the standardButton
|
||||
rStyle.HasParentSupport() ? sal_True : 2 )
|
||||
|
||||
: SfxTabDialog(pParent, rID, rUIXMLDescription,
|
||||
rStyle.GetItemSet().Clone(), true)
|
||||
, pStyle( &rStyle )
|
||||
|
||||
{
|
||||
// without ParentSupport suppress the standardButton
|
||||
if (!rStyle.HasParentSupport())
|
||||
RemoveStandardButton();
|
||||
|
||||
m_nOrganizerId = AddTabPage("organizer", SfxManageStyleSheetPage::Create, 0);
|
||||
|
||||
// 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 SfxItemSet* pItemSet, // Itemset with the data;
|
||||
// can be NULL, when Pages are onDemand
|
||||
sal_Bool bEditFmt // Flag: templates are processed
|
||||
// when yes -> additional Button for standard
|
||||
bool bEditFmt // when yes -> additional Button for standard
|
||||
)
|
||||
: TabDialog(pParent, rID, rUIXMLDescription)
|
||||
, pFrame(pViewFrame)
|
||||
@@ -407,10 +406,10 @@ SfxTabDialog::SfxTabDialog
|
||||
, pRanges(0)
|
||||
, nAppPageId(USHRT_MAX)
|
||||
, bItemsReset(false)
|
||||
, bFmt(bEditFmt)
|
||||
, bStandardPushed(false)
|
||||
, 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 SfxItemSet* pItemSet, // Itemset with the data;
|
||||
// can be NULL, when Pages are onDemand
|
||||
sal_Bool bEditFmt // Flag: templates are processed
|
||||
// when yes -> additional Button for standard
|
||||
bool bEditFmt // when yes -> additional Button for standard
|
||||
)
|
||||
: TabDialog(pParent, rID, rUIXMLDescription)
|
||||
, pFrame(0)
|
||||
@@ -437,10 +435,10 @@ SfxTabDialog::SfxTabDialog
|
||||
, pRanges(0)
|
||||
, nAppPageId(USHRT_MAX)
|
||||
, bItemsReset(false)
|
||||
, bFmt(bEditFmt)
|
||||
, bStandardPushed(false)
|
||||
, pExampleSet(0)
|
||||
{
|
||||
Init_Impl(bFmt, NULL, NULL);
|
||||
Init_Impl(bEditFmt, NULL, NULL);
|
||||
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]
|
||||
|
||||
@@ -607,22 +605,12 @@ void SfxTabDialog::Init_Impl( sal_Bool bFmtFlag, const OUString* pUserButtonText
|
||||
m_pUserBtn->Show();
|
||||
}
|
||||
|
||||
/* TODO: Check what is up with bFmt/bFmtFlag. Comment below suggests a
|
||||
different behavior than implemented!! */
|
||||
if ( bFmtFlag )
|
||||
{
|
||||
m_pBaseFmtBtn->SetText( SfxResId( STR_STANDARD_SHORTCUT ).toString() );
|
||||
m_pBaseFmtBtn->SetClickHdl( LINK( this, SfxTabDialog, BaseFmtHdl ) );
|
||||
m_pBaseFmtBtn->SetHelpId( HID_TABDLG_STANDARD_BTN );
|
||||
|
||||
// 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;
|
||||
m_pBaseFmtBtn->Show();
|
||||
}
|
||||
|
||||
if ( pSet )
|
||||
@@ -632,15 +620,16 @@ void SfxTabDialog::Init_Impl( sal_Bool bFmtFlag, const OUString* pUserButtonText
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SfxTabDialog::RemoveResetButton()
|
||||
{
|
||||
m_pResetBtn->Hide();
|
||||
pImpl->bHideResetBtn = true;
|
||||
}
|
||||
|
||||
|
||||
void SfxTabDialog::RemoveStandardButton()
|
||||
{
|
||||
m_pBaseFmtBtn->Hide();
|
||||
}
|
||||
|
||||
short SfxTabDialog::Execute()
|
||||
{
|
||||
@@ -922,7 +911,6 @@ short SfxTabDialog::Ok()
|
||||
RET_OK: if at least one page has returned from FillItemSet,
|
||||
otherwise RET_CANCEL.
|
||||
*/
|
||||
|
||||
{
|
||||
SavePosAndId(); //See fdo#38828 "Apply" resetting window position
|
||||
|
||||
@@ -966,13 +954,11 @@ short SfxTabDialog::Ok()
|
||||
if ( pImpl->bModified || ( pOutSet && pOutSet->Count() > 0 ) )
|
||||
bModified |= true;
|
||||
|
||||
if ( bFmt == 2 )
|
||||
if (bStandardPushed)
|
||||
bModified |= true;
|
||||
return bModified ? RET_OK : RET_CANCEL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
IMPL_LINK_NOARG(SfxTabDialog, CancelHdl)
|
||||
{
|
||||
EndDialog( RET_USER_CANCEL );
|
||||
@@ -1145,10 +1131,11 @@ IMPL_LINK_NOARG(SfxTabDialog, BaseFmtHdl)
|
||||
*/
|
||||
|
||||
{
|
||||
bStandardPushed = true;
|
||||
|
||||
const sal_uInt16 nId = m_pTabCtrl->GetCurPageId();
|
||||
Data_Impl* pDataObject = Find( pImpl->aData, nId );
|
||||
DBG_ASSERT( pDataObject, "Id not known" );
|
||||
bFmt = 2;
|
||||
|
||||
if ( pDataObject->fnGetRanges )
|
||||
{
|
||||
|
@@ -94,7 +94,7 @@ void SwLabDlg::PageCreated(sal_uInt16 nId, SfxTabPage &rPage)
|
||||
SwLabDlg::SwLabDlg(Window* pParent, const SfxItemSet& rSet,
|
||||
SwNewDBMgr* pDBMgr, sal_Bool bLabel)
|
||||
: SfxTabDialog(pParent, "LabelDialog",
|
||||
"modules/swriter/ui/labeldialog.ui", &rSet, false)
|
||||
"modules/swriter/ui/labeldialog.ui", &rSet)
|
||||
, pNewDBMgr(pDBMgr)
|
||||
, pPrtPage(0)
|
||||
, aTypeIds(50, 10)
|
||||
|
@@ -915,7 +915,7 @@ SwSvxNumBulletTabDialog::SwSvxNumBulletTabDialog(Window* pParent,
|
||||
const SfxItemSet* pSwItemSet, SwWrtShell & rSh)
|
||||
: SfxTabDialog(pParent, "BulletsAndNumberingDialog",
|
||||
"modules/swriter/ui/bulletsandnumbering.ui",
|
||||
pSwItemSet, sal_False)
|
||||
pSwItemSet)
|
||||
, rWrtSh(rSh)
|
||||
{
|
||||
GetUserButton()->SetClickHdl(LINK(this, SwSvxNumBulletTabDialog, RemoveNumberingHdl));
|
||||
|
@@ -1202,7 +1202,7 @@ void SwTableColumnPage::SetVisibleWidth(sal_uInt16 nPos, SwTwips nNewWidth)
|
||||
SwTableTabDlg::SwTableTabDlg(Window* pParent, SfxItemPool&,
|
||||
const SfxItemSet* pItemSet, SwWrtShell* pSh)
|
||||
: SfxTabDialog(0, pParent, "TablePropertiesDialog",
|
||||
"modules/swriter/ui/tableproperties.ui", pItemSet, 0)
|
||||
"modules/swriter/ui/tableproperties.ui", pItemSet)
|
||||
, pShell(pSh)
|
||||
, m_nHtmlMode(::GetHtmlMode(pSh->GetView().GetDocShell()))
|
||||
{
|
||||
|
Reference in New Issue
Block a user