tdf#93901: apply handling in style/edit dialog improved

introduced SfxTabPage::ChangesApplied() to enable resetting values
to their initial state while editing styles

Change-Id: I60fd68d8464e12e795b0e0d2f2e53882a225c181
Reviewed-on: https://gerrit.libreoffice.org/18467
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
This commit is contained in:
Oliver Specht 2015-09-10 11:01:26 +02:00 committed by Thorsten Behrens
parent 88b6dd3ea7
commit a212ef2b6e
12 changed files with 139 additions and 20 deletions

View File

@ -54,6 +54,7 @@ public:
virtual bool FillItemSet( SfxItemSet* rCoreAttrs ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* ) SAL_OVERRIDE;
virtual void ChangesApplied() SAL_OVERRIDE;
void HideShadowControls();
virtual void PageCreated(const SfxAllItemSet& aSet) SAL_OVERRIDE;

View File

@ -151,6 +151,7 @@ public:
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void ChangesApplied() SAL_OVERRIDE;
void SetFontList( const SvxFontListItem& rItem );
void EnableRelativeMode();
@ -233,6 +234,7 @@ public:
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void ChangesApplied() SAL_OVERRIDE;
void DisableControls( sal_uInt16 nDisable );
void EnableFlash();
@ -316,6 +318,7 @@ public:
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void ChangesApplied() SAL_OVERRIDE;
virtual void FillUserData() SAL_OVERRIDE;
/// the writer uses SID_ATTR_BRUSH as font background
void SetPreviewBackgroundToCharacter();

View File

@ -163,6 +163,7 @@ public:
virtual bool FillItemSet(SfxItemSet*) SAL_OVERRIDE;
virtual void Reset(const SfxItemSet*) SAL_OVERRIDE;
virtual void ChangesApplied() SAL_OVERRIDE;
virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE;
virtual sfxpg DeactivatePage(SfxItemSet* pSet) SAL_OVERRIDE;
virtual void PointChanged(vcl::Window* pWindow, RECT_POINT eRP) SAL_OVERRIDE;
@ -296,6 +297,7 @@ public:
virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet * ) SAL_OVERRIDE;
virtual void ChangesApplied() SAL_OVERRIDE;
virtual void ActivatePage( const SfxItemSet& rSet ) SAL_OVERRIDE;
virtual sfxpg DeactivatePage( SfxItemSet* pSet ) SAL_OVERRIDE;
virtual void PointChanged( vcl::Window* pWindow, RECT_POINT eRP ) SAL_OVERRIDE;

View File

@ -109,6 +109,7 @@ public:
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void ChangesApplied() SAL_OVERRIDE;
void SetPageWidth( sal_uInt16 nPageWidth );
@ -172,6 +173,7 @@ public:
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void ChangesApplied() SAL_OVERRIDE;
void EnableJustifyExt();
virtual void PageCreated(const SfxAllItemSet& aSet) SAL_OVERRIDE;
@ -207,6 +209,7 @@ public:
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void ChangesApplied() SAL_OVERRIDE;
void DisablePageBreak();
@ -288,6 +291,7 @@ public:
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void ChangesApplied() SAL_OVERRIDE;
};

View File

@ -599,6 +599,13 @@ void SvxBorderTabPage::Reset( const SfxItemSet* rSet )
m_pSynchronizeCB->Check(mbSync);
}
void SvxBorderTabPage::ChangesApplied()
{
m_pLeftMF->SaveValue();
m_pRightMF->SaveValue();
m_pTopMF->SaveValue();
m_pBottomMF->SaveValue();
}
SfxTabPage::sfxpg SvxBorderTabPage::DeactivatePage( SfxItemSet* _pSet )

View File

@ -879,8 +879,6 @@ void SvxCharNamePage::Reset_Impl( const SfxItemSet& rSet, LanguageGroup eLangGrp
pLangBox->SaveValueLBB();
}
bool SvxCharNamePage::FillItemSet_Impl( SfxItemSet& rSet, LanguageGroup eLangGrp )
{
bool bModified = false;
@ -1234,8 +1232,21 @@ void SvxCharNamePage::Reset( const SfxItemSet* rSet )
SetPrevFontWidthScale( *rSet );
UpdatePreview_Impl();
}
void SvxCharNamePage::ChangesApplied()
{
m_pWestFontNameLB->SaveValue();
m_pWestFontStyleLB->SaveValue();
m_pWestFontSizeLB->SaveValue();
m_pWestFontLanguageLB->SaveValueLBB();
m_pEastFontNameLB->SaveValue();
m_pEastFontStyleLB->SaveValue();
m_pEastFontSizeLB->SaveValue();
m_pEastFontLanguageLB->SaveValueLBB();
m_pCTLFontNameLB->SaveValue();
m_pCTLFontStyleLB->SaveValue();
m_pCTLFontSizeLB->SaveValue();
m_pCTLFontLanguageLB->SaveValueLBB();
}
bool SvxCharNamePage::FillItemSet( SfxItemSet* rSet )
{
@ -2216,6 +2227,11 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet )
m_pPreviewWin->Invalidate();
// save this settings
ChangesApplied();
}
void SvxCharEffectsPage::ChangesApplied()
{
m_pUnderlineLB->SaveValue();
m_pUnderlineColorLB->SaveValue();
m_pOverlineLB->SaveValue();
@ -2231,8 +2247,8 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet )
m_pBlinkingBtn->SaveValue();
m_pHiddenBtn->SaveValue();
m_pFontColorLB->SaveValue();
}
}
bool SvxCharEffectsPage::FillItemSet( SfxItemSet* rSet )
@ -3200,10 +3216,15 @@ void SvxCharPositionPage::Reset( const SfxItemSet* rSet )
SID_ATTR_CHAR_WIDTH_FIT_TO_LINE ) ))
m_pFitToLineCB->Hide();
}
ChangesApplied();
}
void SvxCharPositionPage::ChangesApplied()
{
m_pHighPosBtn->SaveValue();
m_pNormalPosBtn->SaveValue();
m_pLowPosBtn->SaveValue();
m_pHighLowRB->SaveValue();
m_p0degRB->SaveValue();
m_p90degRB->SaveValue();
m_p270degRB->SaveValue();
@ -3215,7 +3236,6 @@ void SvxCharPositionPage::Reset( const SfxItemSet* rSet )
}
bool SvxCharPositionPage::FillItemSet( SfxItemSet* rSet )
{
// Position (high, normal or low)
@ -3555,8 +3575,6 @@ void SvxCharTwoLinesPage::Reset( const SfxItemSet* rSet )
SetPrevFontWidthScale( *rSet );
}
bool SvxCharTwoLinesPage::FillItemSet( SfxItemSet* rSet )
{
const SfxItemSet& rOldSet = GetItemSet();

View File

@ -586,6 +586,20 @@ void SvxStdParagraphTabPage::Reset( const SfxItemSet* rSet )
m_pContextualCB->SaveValue();
m_pLineDist->SaveValue();
}
void SvxStdParagraphTabPage::ChangesApplied()
{
m_pLeftIndent->SetValue(m_pLeftIndent->GetValue());
m_pRightIndent->SetValue(m_pRightIndent->GetValue());
m_pFLineIndent->SetValue(m_pFLineIndent->GetValue());
m_pLineDist->SaveValue();
m_pLineDistAtPercentBox->SaveValue();
m_pLineDistAtMetricBox->SaveValue();
m_pRegisterCB->SaveValue();
m_pTopDist->SetValue(m_pTopDist->GetValue());
m_pBottomDist->SetValue(m_pBottomDist->GetValue());
m_pContextualCB->SaveValue();
m_pAutoCB->SaveValue();
}
void SvxStdParagraphTabPage::EnableRelativeMode()
{
@ -1164,7 +1178,6 @@ bool SvxParaAlignTabPage::FillItemSet( SfxItemSet* rOutSet )
return bModified;
}
void SvxParaAlignTabPage::Reset( const SfxItemSet* rSet )
{
sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_ADJUST );
@ -1261,6 +1274,18 @@ void SvxParaAlignTabPage::Reset( const SfxItemSet* rSet )
UpdateExample_Impl();
}
void SvxParaAlignTabPage::ChangesApplied()
{
m_pTextDirectionLB->SaveValue();
m_pSnapToGridCB->SaveValue();
m_pVertAlignLB->SaveValue();
m_pLeft->SaveValue();
m_pRight->SaveValue();
m_pCenter->SaveValue();
m_pJustify->SaveValue();
m_pLastLineLB->SaveValue();
m_pExpandCB->SaveValue();
}
IMPL_LINK_NOARG_TYPED(SvxParaAlignTabPage, AlignHdl_Impl, Button*, void)
{
@ -1548,7 +1573,6 @@ bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
return bModified;
}
void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet )
{
sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_HYPHENZONE );
@ -1810,11 +1834,14 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet )
KeepTogetherHdl_Impl( 0 );
WidowHdl_Impl( 0 );
OrphanHdl_Impl( 0 );
ChangesApplied();
}
void SvxExtParagraphTabPage::ChangesApplied()
{
m_pHyphenBox->SaveValue();
m_pExtHyphenBeforeBox->SaveValue();
m_pExtHyphenAfterBox->SaveValue();
m_pMaxHyphenEdit->SaveValue();
m_pExtHyphenBeforeBox->SetValue(m_pExtHyphenBeforeBox->GetValue());
m_pExtHyphenAfterBox->SetValue(m_pExtHyphenAfterBox->GetValue());
m_pMaxHyphenEdit->SetValue(m_pMaxHyphenEdit->GetValue());
m_pPageBreakBox->SaveValue();
m_pBreakPositionLB->SaveValue();
m_pBreakTypeLB->SaveValue();
@ -1825,6 +1852,8 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet )
m_pKeepParaBox->SaveValue();
m_pWidowBox->SaveValue();
m_pOrphanBox->SaveValue();
m_pOrphanRowNo->SetValue(m_pOrphanRowNo->GetValue());
m_pWidowRowNo->SetValue(m_pWidowRowNo->GetValue());
}
SfxTabPage::sfxpg SvxExtParagraphTabPage::DeactivatePage( SfxItemSet* _pSet )
@ -2251,7 +2280,12 @@ void SvxAsianTabPage::Reset( const SfxItemSet* rSet )
//character distance not yet available
lcl_SetBox(*rSet, SID_ATTR_PARA_SCRIPTSPACE, *m_pScriptSpaceCB );
}
void SvxAsianTabPage::ChangesApplied()
{
m_pForbiddenRulesCB->SaveValue();
m_pHangingPunctCB->SaveValue();
m_pScriptSpaceCB->SaveValue();
}
IMPL_STATIC_LINK_TYPED( SvxAsianTabPage, ClickHdl_Impl, Button*, pBox, void )
{
static_cast<CheckBox*>(pBox)->EnableTriState( false );

View File

@ -461,6 +461,13 @@ void SvxTransparenceTabPage::Reset(const SfxItemSet* rAttrs)
}
// save values
ChangesApplied();
bool bActive = InitPreview ( *rAttrs );
InvalidatePreview ( bActive );
}
void SvxTransparenceTabPage::ChangesApplied()
{
m_pMtrTransparent->SaveValue();
m_pLbTrgrGradientType->SaveValue();
m_pMtrTrgrCenterX->SaveValue();
@ -469,9 +476,6 @@ void SvxTransparenceTabPage::Reset(const SfxItemSet* rAttrs)
m_pMtrTrgrBorder->SaveValue();
m_pMtrTrgrStartValue->SaveValue();
m_pMtrTrgrEndValue->SaveValue();
bool bActive = InitPreview ( *rAttrs );
InvalidatePreview ( bActive );
}
void SvxTransparenceTabPage::ActivatePage(const SfxItemSet& rSet)
@ -1815,6 +1819,27 @@ void SvxAreaTabPage::Reset( const SfxItemSet* rAttrs )
m_pMtrFldYOffset->SaveValue();
}
void SvxAreaTabPage::ChangesApplied()
{
m_pMtrFldXSize->SaveValue();
m_pMtrFldYSize->SaveValue();
m_pTypeLB->SaveValue();
m_pLbColor->SaveValue();
m_pLbGradient->SaveValue();
m_pLbHatching->SaveValue();
m_pLbHatchBckgrdColor->SaveValue();
m_pLbBitmap->SaveValue();
m_pTsbStepCount->SaveValue();
m_pNumFldStepCount->SaveValue();
m_pTsbTile->SaveValue();
m_pTsbStretch->SaveValue();
m_pTsbScale->SaveValue();
m_pRbtRow->SaveValue();
m_pRbtColumn->SaveValue();
m_pMtrFldOffset->SaveValue();
m_pMtrFldXOffset->SaveValue();
m_pMtrFldYOffset->SaveValue();
}
VclPtr<SfxTabPage> SvxAreaTabPage::Create( vcl::Window* pWindow,

View File

@ -264,6 +264,7 @@ public:
virtual void FillUserData();
virtual bool IsReadOnly() const;
virtual void PageCreated (const SfxAllItemSet& aSet);
virtual void ChangesApplied();
static const SfxPoolItem* GetItem( const SfxItemSet& rSet, sal_uInt16 nSlot, bool bDeep = true );
void SetFrame(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame);

View File

@ -296,7 +296,9 @@ void SfxTabPage::PageCreated( const SfxAllItemSet& /*aSet*/ )
DBG_ASSERT(false, "SfxTabPage::PageCreated should not be called");
}
void SfxTabPage::ChangesApplied()
{
}
void SfxTabPage::AddItemConnection( sfx::ItemConnectionBase* pConnection )
{
@ -924,7 +926,18 @@ bool SfxTabDialog::Apply()
{
bool bApplied = false;
if (PrepareLeaveCurrentPage())
{
bApplied = (Ok() == RET_OK);
//let the pages update their saved values
GetInputSetImpl()->Put(*GetOutputItemSet());
sal_uInt16 pageCount = m_pTabCtrl->GetPageCount();
for (sal_uInt16 pageIdx = 0; pageIdx < pageCount; ++pageIdx)
{
SfxTabPage* pPage = dynamic_cast<SfxTabPage*> (m_pTabCtrl->GetTabPage(m_pTabCtrl->GetPageId(pageIdx)));
if (pPage)
pPage->ChangesApplied();
}
}
return bApplied;
}

View File

@ -185,7 +185,17 @@ bool SwParagraphNumTabPage::FillItemSet( SfxItemSet* rSet )
return bModified;
}
void SwParagraphNumTabPage::Reset( const SfxItemSet* rSet )
void SwParagraphNumTabPage::ChangesApplied()
{
m_pOutlineLvLB->SaveValue();
m_pNumberStyleLB->SaveValue();
m_pNewStartCB->SaveValue();
m_pNewStartNumberCB->SaveValue();
m_pCountParaCB->SaveValue();
m_pRestartParaCountCB->SaveValue();
m_pRestartNF->SaveValue();
}
void SwParagraphNumTabPage::Reset(const SfxItemSet* rSet)
{
bool bHasNumberStyle = false;

View File

@ -77,6 +77,7 @@ public:
virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
virtual void ChangesApplied() SAL_OVERRIDE;
void EnableNewStart();
void DisableOutline();