[Libreoffice-commits] core.git: sc/source sc/uiconfig sw/source
Caolán McNamara
caolanm at redhat.com
Fri Oct 27 07:57:29 UTC 2017
sc/source/ui/inc/tptable.hxx | 8 +-
sc/source/ui/pagedlg/tptable.cxx | 77 ++++++++++++++++-----
sc/uiconfig/scalc/ui/sheetprintpage.ui | 95 +++++++++-----------------
sw/source/core/doc/DocumentRedlineManager.cxx | 5 +
sw/source/core/doc/docredln.cxx | 2
5 files changed, 110 insertions(+), 77 deletions(-)
New commits:
commit bdd7c74a499ea550a10e47d159c2d2d80c940fc0
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Oct 26 12:49:44 2017 +0100
Resolves: tdf#113455 Impossible to clear width/height in pages
Change-Id: I88f80d417108822ceeb73c07cb49892925a2e57f
Reviewed-on: https://gerrit.libreoffice.org/43891
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sc/source/ui/inc/tptable.hxx b/sc/source/ui/inc/tptable.hxx
index f3d01eef310d..3b01422a68ce 100644
--- a/sc/source/ui/inc/tptable.hxx
+++ b/sc/source/ui/inc/tptable.hxx
@@ -46,6 +46,9 @@ private:
void ShowImage();
private:
+ sal_uInt16 m_nOrigScalePageWidth;
+ sal_uInt16 m_nOrigScalePageHeight;
+
VclPtr<RadioButton> m_pBtnTopDown;
VclPtr<RadioButton> m_pBtnLeftRight;
VclPtr<FixedImage> m_pBmpPageDir;
@@ -66,7 +69,9 @@ private:
VclPtr<MetricField> m_pEdScaleAll;
VclPtr<VclGrid> m_pGrHeightWidth;
VclPtr<NumericField> m_pEdScalePageWidth;
+ VclPtr<CheckBox> m_pCbScalePageWidth;
VclPtr<NumericField> m_pEdScalePageHeight;
+ VclPtr<CheckBox> m_pCbScalePageHeight;
VclPtr<VclHBox> m_pBxScalePageNum;
VclPtr<NumericField> m_pEdScalePageNum;
@@ -74,8 +79,9 @@ private:
// Handler:
DECL_LINK(PageDirHdl, Button*, void);
- DECL_LINK( PageNoHdl, Button*, void );
+ DECL_LINK(PageNoHdl, Button*, void);
DECL_LINK(ScaleHdl, ListBox&, void);
+ DECL_LINK(ToggleHdl, CheckBox&, void);
};
#endif // INCLUDED_SC_SOURCE_UI_INC_TPTABLE_HXX
diff --git a/sc/source/ui/pagedlg/tptable.cxx b/sc/source/ui/pagedlg/tptable.cxx
index be608b015f53..6b9585d79c3f 100644
--- a/sc/source/ui/pagedlg/tptable.cxx
+++ b/sc/source/ui/pagedlg/tptable.cxx
@@ -55,9 +55,11 @@ static bool lcl_PutScaleItem2( sal_uInt16 nWhich,
SfxItemSet& rCoreSet,
const SfxItemSet& rOldSet,
const ListBox& rListBox,
- sal_uInt16 nLBEntry,
+ sal_uInt16 nLBEntry,
const NumericField& rEd1,
- const NumericField& rEd2 );
+ sal_uInt16 nOrigScalePageWidth,
+ const NumericField& rEd2,
+ sal_uInt16 nOrigScalePageHeight );
static bool lcl_PutBoolItem( sal_uInt16 nWhich,
SfxItemSet& rCoreSet,
@@ -84,9 +86,10 @@ bool WAS_DEFAULT(sal_uInt16 w, SfxItemSet const & s)
#define SC_TPTABLE_SCALE_TO 1
#define SC_TPTABLE_SCALE_TO_PAGES 2
-ScTablePage::ScTablePage( vcl::Window* pParent, const SfxItemSet& rCoreAttrs ) :
-
- SfxTabPage( pParent, "SheetPrintPage","modules/scalc/ui/sheetprintpage.ui", &rCoreAttrs )
+ScTablePage::ScTablePage(vcl::Window* pParent, const SfxItemSet& rCoreAttrs)
+ : SfxTabPage(pParent, "SheetPrintPage","modules/scalc/ui/sheetprintpage.ui", &rCoreAttrs)
+ , m_nOrigScalePageWidth(0)
+ , m_nOrigScalePageHeight(0)
{
get(m_pBtnTopDown,"radioBTN_TOPDOWN");
get(m_pBtnLeftRight,"radioBTN_LEFTRIGHT");
@@ -108,7 +111,9 @@ ScTablePage::ScTablePage( vcl::Window* pParent, const SfxItemSet& rCoreAttrs ) :
get(m_pEdScaleAll,"spinED_SCALEALL");
get(m_pGrHeightWidth,"gridWH");
get(m_pEdScalePageWidth,"spinED_SCALEPAGEWIDTH");
+ get(m_pCbScalePageWidth,"unsetwidth");
get(m_pEdScalePageHeight,"spinED_SCALEPAGEHEIGHT");
+ get(m_pCbScalePageHeight,"unsetheight");
get(m_pBxScalePageNum,"boxNP");
get(m_pEdScalePageNum,"spinED_SCALEPAGENUM");
@@ -118,7 +123,8 @@ ScTablePage::ScTablePage( vcl::Window* pParent, const SfxItemSet& rCoreAttrs ) :
m_pBtnTopDown->SetClickHdl( PAGEDIR_HDL );
m_pBtnLeftRight->SetClickHdl( PAGEDIR_HDL );
m_pLbScaleMode->SetSelectHdl( LINK(this,ScTablePage,ScaleHdl) );
-
+ m_pCbScalePageWidth->SetToggleHdl(LINK(this, ScTablePage, ToggleHdl));
+ m_pCbScalePageHeight->SetToggleHdl(LINK(this, ScTablePage, ToggleHdl));
}
void ScTablePage::ShowImage()
@@ -152,7 +158,9 @@ void ScTablePage::dispose()
m_pBxScaleAll.clear();
m_pEdScaleAll.clear();
m_pGrHeightWidth.clear();
+ m_pCbScalePageWidth.clear();
m_pEdScalePageWidth.clear();
+ m_pCbScalePageHeight.clear();
m_pEdScalePageHeight.clear();
m_pBxScalePageNum.clear();
m_pEdScalePageNum.clear();
@@ -209,10 +217,12 @@ void ScTablePage::Reset( const SfxItemSet* rCoreSet )
/* width==0 and height==0 is invalid state, used as "not selected".
Dialog shows width=height=1 then. */
bool bValid = nWidth || nHeight;
- if( bValid )
+ if (bValid)
m_pLbScaleMode->SelectEntryPos( SC_TPTABLE_SCALE_TO );
m_pEdScalePageWidth->SetValue( bValid ? nWidth : 1 );
m_pEdScalePageHeight->SetValue( bValid ? nHeight : 1 );
+ m_pCbScalePageWidth->Check(bValid && !nWidth);
+ m_pCbScalePageHeight->Check(bValid && !nHeight);
}
nWhich = GetWhich(SID_SCATTR_PAGE_SCALETOPAGES);
@@ -250,8 +260,8 @@ void ScTablePage::Reset( const SfxItemSet* rCoreSet )
m_pBtnPageNo->SaveValue();
m_pEdPageNo->SaveValue();
m_pEdScaleAll->SaveValue();
- m_pEdScalePageWidth->SaveValue();
- m_pEdScalePageHeight->SaveValue();
+ m_nOrigScalePageWidth = m_pEdScalePageWidth->IsEnabled() ? m_pEdScalePageWidth->GetValue() : 0;
+ m_nOrigScalePageHeight = m_pEdScalePageHeight->IsEnabled() ? m_pEdScalePageHeight->GetValue() : 0;
m_pEdScalePageNum->SaveValue();
}
@@ -323,7 +333,7 @@ bool ScTablePage::FillItemSet( SfxItemSet* rCoreSet )
*rCoreSet, rOldSet, *m_pBtnDrawings );
// scaling:
- if( !m_pEdScalePageWidth->GetValue() && !m_pEdScalePageHeight->GetValue() )
+ if( !m_pEdScalePageWidth->IsEnabled() && !m_pEdScalePageHeight->IsEnabled() )
{
m_pLbScaleMode->SelectEntryPos( SC_TPTABLE_SCALE_PERCENT );
m_pEdScaleAll->SetValue( 100 );
@@ -337,7 +347,8 @@ bool ScTablePage::FillItemSet( SfxItemSet* rCoreSet )
bDataChanged |= lcl_PutScaleItem2( GetWhich(SID_SCATTR_PAGE_SCALETO),
*rCoreSet, rOldSet,
*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),
*rCoreSet, rOldSet,
@@ -393,6 +404,36 @@ IMPL_LINK_NOARG(ScTablePage, ScaleHdl, ListBox&, void)
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:
static bool lcl_PutBoolItem( sal_uInt16 nWhich,
@@ -456,16 +497,18 @@ static bool lcl_PutScaleItem2( sal_uInt16 nWhich,
SfxItemSet& rCoreSet,
const SfxItemSet& rOldSet,
const ListBox& rListBox,
- sal_uInt16 nLBEntry,
+ sal_uInt16 nLBEntry,
const NumericField& rEd1,
- const NumericField& rEd2 )
+ sal_uInt16 nOrigScalePageWidth,
+ const NumericField& rEd2,
+ sal_uInt16 nOrigScalePageHeight )
{
- sal_uInt16 nValue1 = (sal_uInt16)rEd1.GetValue();
- sal_uInt16 nValue2 = (sal_uInt16)rEd2.GetValue();
+ sal_uInt16 nValue1 = rEd1.IsEnabled() ? rEd1.GetValue() : 0;
+ sal_uInt16 nValue2 = rEd2.IsEnabled() ? rEd2.GetValue() : 0;
bool bIsSel = (rListBox.GetSelectedEntryPos() == nLBEntry);
bool bDataChanged = (rListBox.GetSavedValue() != nLBEntry) ||
- rEd1.IsValueChangedFromSaved() ||
- rEd2.IsValueChangedFromSaved() ||
+ nValue1 != nOrigScalePageWidth ||
+ nValue1 != nOrigScalePageHeight ||
!WAS_DEFAULT( nWhich, rOldSet );
if( bDataChanged )
diff --git a/sc/uiconfig/scalc/ui/sheetprintpage.ui b/sc/uiconfig/scalc/ui/sheetprintpage.ui
index 83330ca7f31c..4daeadf15309 100644
--- a/sc/uiconfig/scalc/ui/sheetprintpage.ui
+++ b/sc/uiconfig/scalc/ui/sheetprintpage.ui
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.20.0 -->
<interface domain="sc">
- <!-- interface-requires gtk+ 3.0 -->
+ <requires lib="gtk+" version="3.0"/>
<object class="GtkAdjustment" id="adjustmentFirstPage">
<property name="lower">1.05</property>
<property name="upper">9999.0400000000009</property>
@@ -72,8 +73,6 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -93,8 +92,6 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -110,8 +107,6 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -125,8 +120,6 @@
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -176,8 +169,6 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -213,8 +204,6 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -231,8 +220,6 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -248,8 +235,6 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -265,8 +250,6 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -282,8 +265,6 @@
<packing>
<property name="left_attach">2</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -299,8 +280,6 @@
<packing>
<property name="left_attach">2</property>
<property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -316,8 +295,6 @@
<packing>
<property name="left_attach">2</property>
<property name="top_attach">2</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -333,8 +310,6 @@
<packing>
<property name="left_attach">2</property>
<property name="top_attach">3</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -367,8 +342,6 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -392,16 +365,14 @@
<object class="GtkLabel" id="labelScalingMode">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="sheetprintpage|labelScalingMode">Scaling _mode:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">comboLB_SCALEMODE</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -419,10 +390,10 @@
<object class="GtkLabel" id="labelSF">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="sheetprintpage|labelSF">_Scaling factor:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">spinED_SCALEALL:0%</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
@@ -435,7 +406,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">•</property>
- <property name="invisible_char_set">True</property>
<property name="adjustment">adjustmentScalingFactor</property>
</object>
<packing>
@@ -462,32 +432,28 @@
<object class="GtkLabel" id="labelWP">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="sheetprintpage|labelWP">_Width in pages:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">spinED_SCALEPAGEWIDTH</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="labelHP">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="sheetprintpage|labelHP">_Height in pages:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">spinED_SCALEPAGEHEIGHT</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -496,14 +462,11 @@
<property name="can_focus">True</property>
<property name="invisible_char">•</property>
<property name="shadow_type">none</property>
- <property name="invisible_char_set">True</property>
<property name="adjustment">adjustmentPage</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -511,14 +474,37 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">•</property>
- <property name="invisible_char_set">True</property>
<property name="adjustment">adjustmentPage</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="unsetwidth">
+ <property name="label" translatable="yes" context="sheetprintpage|unsetwidth">Unspecified</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="unsetheight">
+ <property name="label" translatable="yes" context="sheetprintpage|unsetheight">Unspecified</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="top_attach">1</property>
</packing>
</child>
</object>
@@ -537,10 +523,10 @@
<object class="GtkLabel" id="labelNP">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="sheetprintpage|labelNP">N_umber of pages:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">spinED_SCALEPAGENUM</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
@@ -553,7 +539,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">•</property>
- <property name="invisible_char_set">True</property>
<property name="adjustment">adjustmentPage</property>
<property name="update_policy">if-valid</property>
</object>
@@ -574,19 +559,12 @@
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
- <placeholder/>
- </child>
- <child>
<object class="GtkComboBoxText" id="comboLB_SCALEMODE">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="entry_text_column">0</property>
- <property name="id_column">1</property>
<items>
<item translatable="yes" context="sheetprintpage|comboLB_SCALEMODE">Reduce/enlarge printout</item>
<item translatable="yes" context="sheetprintpage|comboLB_SCALEMODE">Fit print range(s) to width/height</item>
@@ -596,10 +574,11 @@
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
+ <child>
+ <placeholder/>
+ </child>
</object>
</child>
</object>
@@ -618,8 +597,6 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
</object>
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx
index 92557481bd8d..672412edfeba 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -759,6 +759,8 @@ Behaviour of Delete-Redline:
IDocumentRedlineAccess::AppendResult
DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCallDelete)
{
+ fprintf(stderr, "AppendRedline %p\n", pNewRedl);
+
bool bMerged = false;
CHECK_REDLINE( *this )
@@ -1248,7 +1250,10 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCall
delete pNewRedl;
pNewRedl = nullptr;
if (eCmpPos == SwComparePosition::Inside)
+ {
+ fprintf(stderr, "pRedl is %p\n", pRedl);
pRedl->MaybeNotifyModification();
+ }
break;
case SwComparePosition::Outside:
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 71072603c730..ce038afec36a 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -1043,6 +1043,7 @@ SwRangeRedline::SwRangeRedline( const SwRangeRedline& rCpy )
SwRangeRedline::~SwRangeRedline()
{
+ fprintf(stderr, "start death of %p\n", this);
if( pContentSect )
{
// delete the ContentSection
@@ -1051,6 +1052,7 @@ SwRangeRedline::~SwRangeRedline()
delete pContentSect;
}
delete pRedlineData;
+ fprintf(stderr, "end death of %p\n", this);
}
void SwRangeRedline::MaybeNotifyModification()
More information about the Libreoffice-commits
mailing list