Kaydet (Commit) bdd7c74a authored tarafından Caolán McNamara's avatar Caolán McNamara

Resolves: tdf#113455 Impossible to clear width/height in pages

Change-Id: I88f80d417108822ceeb73c07cb49892925a2e57f
Reviewed-on: https://gerrit.libreoffice.org/43891Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 75c642da
...@@ -46,6 +46,9 @@ private: ...@@ -46,6 +46,9 @@ private:
void ShowImage(); void ShowImage();
private: private:
sal_uInt16 m_nOrigScalePageWidth;
sal_uInt16 m_nOrigScalePageHeight;
VclPtr<RadioButton> m_pBtnTopDown; VclPtr<RadioButton> m_pBtnTopDown;
VclPtr<RadioButton> m_pBtnLeftRight; VclPtr<RadioButton> m_pBtnLeftRight;
VclPtr<FixedImage> m_pBmpPageDir; VclPtr<FixedImage> m_pBmpPageDir;
...@@ -66,7 +69,9 @@ private: ...@@ -66,7 +69,9 @@ private:
VclPtr<MetricField> m_pEdScaleAll; VclPtr<MetricField> m_pEdScaleAll;
VclPtr<VclGrid> m_pGrHeightWidth; VclPtr<VclGrid> m_pGrHeightWidth;
VclPtr<NumericField> m_pEdScalePageWidth; VclPtr<NumericField> m_pEdScalePageWidth;
VclPtr<CheckBox> m_pCbScalePageWidth;
VclPtr<NumericField> m_pEdScalePageHeight; VclPtr<NumericField> m_pEdScalePageHeight;
VclPtr<CheckBox> m_pCbScalePageHeight;
VclPtr<VclHBox> m_pBxScalePageNum; VclPtr<VclHBox> m_pBxScalePageNum;
VclPtr<NumericField> m_pEdScalePageNum; VclPtr<NumericField> m_pEdScalePageNum;
...@@ -74,8 +79,9 @@ private: ...@@ -74,8 +79,9 @@ private:
// Handler: // Handler:
DECL_LINK(PageDirHdl, Button*, void); DECL_LINK(PageDirHdl, Button*, void);
DECL_LINK( PageNoHdl, Button*, void ); DECL_LINK(PageNoHdl, Button*, void);
DECL_LINK(ScaleHdl, ListBox&, void); DECL_LINK(ScaleHdl, ListBox&, void);
DECL_LINK(ToggleHdl, CheckBox&, void);
}; };
#endif // INCLUDED_SC_SOURCE_UI_INC_TPTABLE_HXX #endif // INCLUDED_SC_SOURCE_UI_INC_TPTABLE_HXX
......
...@@ -55,9 +55,11 @@ static bool lcl_PutScaleItem2( sal_uInt16 nWhich, ...@@ -55,9 +55,11 @@ static bool lcl_PutScaleItem2( sal_uInt16 nWhich,
SfxItemSet& rCoreSet, SfxItemSet& rCoreSet,
const SfxItemSet& rOldSet, const SfxItemSet& rOldSet,
const ListBox& rListBox, const ListBox& rListBox,
sal_uInt16 nLBEntry, sal_uInt16 nLBEntry,
const NumericField& rEd1, const NumericField& rEd1,
const NumericField& rEd2 ); sal_uInt16 nOrigScalePageWidth,
const NumericField& rEd2,
sal_uInt16 nOrigScalePageHeight );
static bool lcl_PutBoolItem( sal_uInt16 nWhich, static bool lcl_PutBoolItem( sal_uInt16 nWhich,
SfxItemSet& rCoreSet, SfxItemSet& rCoreSet,
...@@ -84,9 +86,10 @@ bool WAS_DEFAULT(sal_uInt16 w, SfxItemSet const & s) ...@@ -84,9 +86,10 @@ bool WAS_DEFAULT(sal_uInt16 w, SfxItemSet const & s)
#define SC_TPTABLE_SCALE_TO 1 #define SC_TPTABLE_SCALE_TO 1
#define SC_TPTABLE_SCALE_TO_PAGES 2 #define SC_TPTABLE_SCALE_TO_PAGES 2
ScTablePage::ScTablePage( vcl::Window* pParent, const SfxItemSet& rCoreAttrs ) : ScTablePage::ScTablePage(vcl::Window* pParent, const SfxItemSet& rCoreAttrs)
: SfxTabPage(pParent, "SheetPrintPage","modules/scalc/ui/sheetprintpage.ui", &rCoreAttrs)
SfxTabPage( pParent, "SheetPrintPage","modules/scalc/ui/sheetprintpage.ui", &rCoreAttrs ) , m_nOrigScalePageWidth(0)
, m_nOrigScalePageHeight(0)
{ {
get(m_pBtnTopDown,"radioBTN_TOPDOWN"); get(m_pBtnTopDown,"radioBTN_TOPDOWN");
get(m_pBtnLeftRight,"radioBTN_LEFTRIGHT"); get(m_pBtnLeftRight,"radioBTN_LEFTRIGHT");
...@@ -108,7 +111,9 @@ ScTablePage::ScTablePage( vcl::Window* pParent, const SfxItemSet& rCoreAttrs ) : ...@@ -108,7 +111,9 @@ ScTablePage::ScTablePage( vcl::Window* pParent, const SfxItemSet& rCoreAttrs ) :
get(m_pEdScaleAll,"spinED_SCALEALL"); get(m_pEdScaleAll,"spinED_SCALEALL");
get(m_pGrHeightWidth,"gridWH"); get(m_pGrHeightWidth,"gridWH");
get(m_pEdScalePageWidth,"spinED_SCALEPAGEWIDTH"); get(m_pEdScalePageWidth,"spinED_SCALEPAGEWIDTH");
get(m_pCbScalePageWidth,"unsetwidth");
get(m_pEdScalePageHeight,"spinED_SCALEPAGEHEIGHT"); get(m_pEdScalePageHeight,"spinED_SCALEPAGEHEIGHT");
get(m_pCbScalePageHeight,"unsetheight");
get(m_pBxScalePageNum,"boxNP"); get(m_pBxScalePageNum,"boxNP");
get(m_pEdScalePageNum,"spinED_SCALEPAGENUM"); get(m_pEdScalePageNum,"spinED_SCALEPAGENUM");
...@@ -118,7 +123,8 @@ ScTablePage::ScTablePage( vcl::Window* pParent, const SfxItemSet& rCoreAttrs ) : ...@@ -118,7 +123,8 @@ ScTablePage::ScTablePage( vcl::Window* pParent, const SfxItemSet& rCoreAttrs ) :
m_pBtnTopDown->SetClickHdl( PAGEDIR_HDL ); m_pBtnTopDown->SetClickHdl( PAGEDIR_HDL );
m_pBtnLeftRight->SetClickHdl( PAGEDIR_HDL ); m_pBtnLeftRight->SetClickHdl( PAGEDIR_HDL );
m_pLbScaleMode->SetSelectHdl( LINK(this,ScTablePage,ScaleHdl) ); m_pLbScaleMode->SetSelectHdl( LINK(this,ScTablePage,ScaleHdl) );
m_pCbScalePageWidth->SetToggleHdl(LINK(this, ScTablePage, ToggleHdl));
m_pCbScalePageHeight->SetToggleHdl(LINK(this, ScTablePage, ToggleHdl));
} }
void ScTablePage::ShowImage() void ScTablePage::ShowImage()
...@@ -152,7 +158,9 @@ void ScTablePage::dispose() ...@@ -152,7 +158,9 @@ void ScTablePage::dispose()
m_pBxScaleAll.clear(); m_pBxScaleAll.clear();
m_pEdScaleAll.clear(); m_pEdScaleAll.clear();
m_pGrHeightWidth.clear(); m_pGrHeightWidth.clear();
m_pCbScalePageWidth.clear();
m_pEdScalePageWidth.clear(); m_pEdScalePageWidth.clear();
m_pCbScalePageHeight.clear();
m_pEdScalePageHeight.clear(); m_pEdScalePageHeight.clear();
m_pBxScalePageNum.clear(); m_pBxScalePageNum.clear();
m_pEdScalePageNum.clear(); m_pEdScalePageNum.clear();
...@@ -209,10 +217,12 @@ void ScTablePage::Reset( const SfxItemSet* rCoreSet ) ...@@ -209,10 +217,12 @@ void ScTablePage::Reset( const SfxItemSet* rCoreSet )
/* width==0 and height==0 is invalid state, used as "not selected". /* width==0 and height==0 is invalid state, used as "not selected".
Dialog shows width=height=1 then. */ Dialog shows width=height=1 then. */
bool bValid = nWidth || nHeight; bool bValid = nWidth || nHeight;
if( bValid ) if (bValid)
m_pLbScaleMode->SelectEntryPos( SC_TPTABLE_SCALE_TO ); m_pLbScaleMode->SelectEntryPos( SC_TPTABLE_SCALE_TO );
m_pEdScalePageWidth->SetValue( bValid ? nWidth : 1 ); m_pEdScalePageWidth->SetValue( bValid ? nWidth : 1 );
m_pEdScalePageHeight->SetValue( bValid ? nHeight : 1 ); m_pEdScalePageHeight->SetValue( bValid ? nHeight : 1 );
m_pCbScalePageWidth->Check(bValid && !nWidth);
m_pCbScalePageHeight->Check(bValid && !nHeight);
} }
nWhich = GetWhich(SID_SCATTR_PAGE_SCALETOPAGES); nWhich = GetWhich(SID_SCATTR_PAGE_SCALETOPAGES);
...@@ -250,8 +260,8 @@ void ScTablePage::Reset( const SfxItemSet* rCoreSet ) ...@@ -250,8 +260,8 @@ void ScTablePage::Reset( const SfxItemSet* rCoreSet )
m_pBtnPageNo->SaveValue(); m_pBtnPageNo->SaveValue();
m_pEdPageNo->SaveValue(); m_pEdPageNo->SaveValue();
m_pEdScaleAll->SaveValue(); m_pEdScaleAll->SaveValue();
m_pEdScalePageWidth->SaveValue(); m_nOrigScalePageWidth = m_pEdScalePageWidth->IsEnabled() ? m_pEdScalePageWidth->GetValue() : 0;
m_pEdScalePageHeight->SaveValue(); m_nOrigScalePageHeight = m_pEdScalePageHeight->IsEnabled() ? m_pEdScalePageHeight->GetValue() : 0;
m_pEdScalePageNum->SaveValue(); m_pEdScalePageNum->SaveValue();
} }
...@@ -323,7 +333,7 @@ bool ScTablePage::FillItemSet( SfxItemSet* rCoreSet ) ...@@ -323,7 +333,7 @@ bool ScTablePage::FillItemSet( SfxItemSet* rCoreSet )
*rCoreSet, rOldSet, *m_pBtnDrawings ); *rCoreSet, rOldSet, *m_pBtnDrawings );
// scaling: // scaling:
if( !m_pEdScalePageWidth->GetValue() && !m_pEdScalePageHeight->GetValue() ) if( !m_pEdScalePageWidth->IsEnabled() && !m_pEdScalePageHeight->IsEnabled() )
{ {
m_pLbScaleMode->SelectEntryPos( SC_TPTABLE_SCALE_PERCENT ); m_pLbScaleMode->SelectEntryPos( SC_TPTABLE_SCALE_PERCENT );
m_pEdScaleAll->SetValue( 100 ); m_pEdScaleAll->SetValue( 100 );
...@@ -337,7 +347,8 @@ bool ScTablePage::FillItemSet( SfxItemSet* rCoreSet ) ...@@ -337,7 +347,8 @@ bool ScTablePage::FillItemSet( SfxItemSet* rCoreSet )
bDataChanged |= lcl_PutScaleItem2( GetWhich(SID_SCATTR_PAGE_SCALETO), bDataChanged |= lcl_PutScaleItem2( GetWhich(SID_SCATTR_PAGE_SCALETO),
*rCoreSet, rOldSet, *rCoreSet, rOldSet,
*m_pLbScaleMode, SC_TPTABLE_SCALE_TO, *m_pLbScaleMode, SC_TPTABLE_SCALE_TO,
*m_pEdScalePageWidth, *m_pEdScalePageHeight ); *m_pEdScalePageWidth, m_nOrigScalePageWidth,
*m_pEdScalePageHeight, m_nOrigScalePageHeight );
bDataChanged |= lcl_PutScaleItem( GetWhich(SID_SCATTR_PAGE_SCALETOPAGES), bDataChanged |= lcl_PutScaleItem( GetWhich(SID_SCATTR_PAGE_SCALETOPAGES),
*rCoreSet, rOldSet, *rCoreSet, rOldSet,
...@@ -393,6 +404,36 @@ IMPL_LINK_NOARG(ScTablePage, ScaleHdl, ListBox&, void) ...@@ -393,6 +404,36 @@ IMPL_LINK_NOARG(ScTablePage, ScaleHdl, ListBox&, void)
m_pBxScalePageNum->Show(m_pLbScaleMode->GetSelectedEntryPos() == SC_TPTABLE_SCALE_TO_PAGES); m_pBxScalePageNum->Show(m_pLbScaleMode->GetSelectedEntryPos() == SC_TPTABLE_SCALE_TO_PAGES);
} }
IMPL_LINK(ScTablePage, ToggleHdl, CheckBox&, rBox, void)
{
if (&rBox == m_pCbScalePageWidth)
{
if (rBox.IsChecked())
{
m_pEdScalePageWidth->SetText(OUString());
m_pEdScalePageWidth->Disable();
}
else
{
m_pEdScalePageWidth->SetValue(1);
m_pEdScalePageWidth->Enable();
}
}
else
{
if (rBox.IsChecked())
{
m_pEdScalePageHeight->SetText(OUString());
m_pEdScalePageHeight->Disable();
}
else
{
m_pEdScalePageHeight->SetValue(1);
m_pEdScalePageHeight->Enable();
}
}
}
// Helper functions for FillItemSet: // Helper functions for FillItemSet:
static bool lcl_PutBoolItem( sal_uInt16 nWhich, static bool lcl_PutBoolItem( sal_uInt16 nWhich,
...@@ -456,16 +497,18 @@ static bool lcl_PutScaleItem2( sal_uInt16 nWhich, ...@@ -456,16 +497,18 @@ static bool lcl_PutScaleItem2( sal_uInt16 nWhich,
SfxItemSet& rCoreSet, SfxItemSet& rCoreSet,
const SfxItemSet& rOldSet, const SfxItemSet& rOldSet,
const ListBox& rListBox, const ListBox& rListBox,
sal_uInt16 nLBEntry, sal_uInt16 nLBEntry,
const NumericField& rEd1, const NumericField& rEd1,
const NumericField& rEd2 ) sal_uInt16 nOrigScalePageWidth,
const NumericField& rEd2,
sal_uInt16 nOrigScalePageHeight )
{ {
sal_uInt16 nValue1 = (sal_uInt16)rEd1.GetValue(); sal_uInt16 nValue1 = rEd1.IsEnabled() ? rEd1.GetValue() : 0;
sal_uInt16 nValue2 = (sal_uInt16)rEd2.GetValue(); sal_uInt16 nValue2 = rEd2.IsEnabled() ? rEd2.GetValue() : 0;
bool bIsSel = (rListBox.GetSelectedEntryPos() == nLBEntry); bool bIsSel = (rListBox.GetSelectedEntryPos() == nLBEntry);
bool bDataChanged = (rListBox.GetSavedValue() != nLBEntry) || bool bDataChanged = (rListBox.GetSavedValue() != nLBEntry) ||
rEd1.IsValueChangedFromSaved() || nValue1 != nOrigScalePageWidth ||
rEd2.IsValueChangedFromSaved() || nValue1 != nOrigScalePageHeight ||
!WAS_DEFAULT( nWhich, rOldSet ); !WAS_DEFAULT( nWhich, rOldSet );
if( bDataChanged ) if( bDataChanged )
......
...@@ -759,6 +759,8 @@ Behaviour of Delete-Redline: ...@@ -759,6 +759,8 @@ Behaviour of Delete-Redline:
IDocumentRedlineAccess::AppendResult IDocumentRedlineAccess::AppendResult
DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCallDelete) DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCallDelete)
{ {
fprintf(stderr, "AppendRedline %p\n", pNewRedl);
bool bMerged = false; bool bMerged = false;
CHECK_REDLINE( *this ) CHECK_REDLINE( *this )
...@@ -1248,7 +1250,10 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCall ...@@ -1248,7 +1250,10 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCall
delete pNewRedl; delete pNewRedl;
pNewRedl = nullptr; pNewRedl = nullptr;
if (eCmpPos == SwComparePosition::Inside) if (eCmpPos == SwComparePosition::Inside)
{
fprintf(stderr, "pRedl is %p\n", pRedl);
pRedl->MaybeNotifyModification(); pRedl->MaybeNotifyModification();
}
break; break;
case SwComparePosition::Outside: case SwComparePosition::Outside:
......
...@@ -1043,6 +1043,7 @@ SwRangeRedline::SwRangeRedline( const SwRangeRedline& rCpy ) ...@@ -1043,6 +1043,7 @@ SwRangeRedline::SwRangeRedline( const SwRangeRedline& rCpy )
SwRangeRedline::~SwRangeRedline() SwRangeRedline::~SwRangeRedline()
{ {
fprintf(stderr, "start death of %p\n", this);
if( pContentSect ) if( pContentSect )
{ {
// delete the ContentSection // delete the ContentSection
...@@ -1051,6 +1052,7 @@ SwRangeRedline::~SwRangeRedline() ...@@ -1051,6 +1052,7 @@ SwRangeRedline::~SwRangeRedline()
delete pContentSect; delete pContentSect;
} }
delete pRedlineData; delete pRedlineData;
fprintf(stderr, "end death of %p\n", this);
} }
void SwRangeRedline::MaybeNotifyModification() void SwRangeRedline::MaybeNotifyModification()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment