diff options
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/uibase/sidebar/PageFormatPanel.cxx | 34 | ||||
-rw-r--r-- | sw/source/uibase/sidebar/PageMarginUtils.hxx | 21 | ||||
-rw-r--r-- | sw/uiconfig/swriter/ui/pageformatpanel.ui | 1 |
3 files changed, 43 insertions, 13 deletions
diff --git a/sw/source/uibase/sidebar/PageFormatPanel.cxx b/sw/source/uibase/sidebar/PageFormatPanel.cxx index 5bf359dc69e1..c61e304b05b5 100644 --- a/sw/source/uibase/sidebar/PageFormatPanel.cxx +++ b/sw/source/uibase/sidebar/PageFormatPanel.cxx @@ -244,24 +244,27 @@ IMPL_LINK_NOARG_TYPED(PageFormatPanel, PaperModifyMarginHdl, ListBox&, void) switch ( mpMarginSelectBox->GetSelectEntryPos() ) { case 0: - SetNarrow(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored); + SetNone(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored); break; case 1: - SetModerate(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored); + SetNarrow(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored); break; case 2: - SetNormal075(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored); + SetModerate(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored); break; case 3: - SetNormal100(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored); + SetNormal075(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored); break; case 4: - SetNormal125(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored); + SetNormal100(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored); break; case 5: - SetWide(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored); + SetNormal125(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored); break; case 6: + SetWide(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored); + break; + case 7: SetMirrored(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored); break; default: @@ -335,41 +338,46 @@ void PageFormatPanel::UpdateMarginBox() mnPageBottomMargin = mpPageULMarginItem->GetLower(); bool bMirrored = (mpPageItem->GetPageUsage() == SVX_PAGE_MIRROR); - if( IsNarrow(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored) ) + if( IsNone(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored) ) { mpMarginSelectBox->SelectEntryPos(0); mpMarginSelectBox->RemoveEntry(aCustomEntry); } - else if( IsModerate(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored) ) + else if( IsNarrow(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored) ) { mpMarginSelectBox->SelectEntryPos(1); mpMarginSelectBox->RemoveEntry(aCustomEntry); } - else if( IsNormal075(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored) ) + else if( IsModerate(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored) ) { mpMarginSelectBox->SelectEntryPos(2); mpMarginSelectBox->RemoveEntry(aCustomEntry); } - else if( IsNormal100(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored) ) + else if( IsNormal075(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored) ) { mpMarginSelectBox->SelectEntryPos(3); mpMarginSelectBox->RemoveEntry(aCustomEntry); } - else if( IsNormal125(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored) ) + else if( IsNormal100(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored) ) { mpMarginSelectBox->SelectEntryPos(4); mpMarginSelectBox->RemoveEntry(aCustomEntry); } - else if( IsWide(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored) ) + else if( IsNormal125(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored) ) { mpMarginSelectBox->SelectEntryPos(5); mpMarginSelectBox->RemoveEntry(aCustomEntry); } - else if( IsMirrored(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored) ) + else if( IsWide(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored) ) { mpMarginSelectBox->SelectEntryPos(6); mpMarginSelectBox->RemoveEntry(aCustomEntry); } + else if( IsMirrored(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored) ) + { + mpMarginSelectBox->SelectEntryPos(7); + mpMarginSelectBox->RemoveEntry(aCustomEntry); + } else { if(mpMarginSelectBox->GetEntryPos(aCustomEntry) == LISTBOX_ENTRY_NOTFOUND) diff --git a/sw/source/uibase/sidebar/PageMarginUtils.hxx b/sw/source/uibase/sidebar/PageMarginUtils.hxx index da8b73cadbed..7e29cef6d6b4 100644 --- a/sw/source/uibase/sidebar/PageMarginUtils.hxx +++ b/sw/source/uibase/sidebar/PageMarginUtils.hxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #include <cmath> +#define SWPAGE_NO_MARGIN 0 #define SWPAGE_NARROW_VALUE 720 #define SWPAGE_MODERATE_LR 1080 #define SWPAGE_NORMAL_VALUE 1136 @@ -27,6 +28,26 @@ namespace sw { namespace sidebar{ +bool IsNone( const long nPageLeftMargin, const long nPageRightMargin, + const long nPageTopMargin, const long nPageBottomMargin, bool bMirrored) +{ + return( std::abs(nPageLeftMargin - SWPAGE_NO_MARGIN) <= SWPAGE_UNIT_THRESHOLD && + std::abs(nPageRightMargin - SWPAGE_NO_MARGIN ) <= SWPAGE_UNIT_THRESHOLD && + std::abs(nPageTopMargin - SWPAGE_NO_MARGIN) <= SWPAGE_UNIT_THRESHOLD && + std::abs(nPageBottomMargin - SWPAGE_NO_MARGIN) <= SWPAGE_UNIT_THRESHOLD && + !bMirrored ); +} + +void SetNone( long& nPageLeftMargin, long& nPageRightMargin, + long& nPageTopMargin, long& nPageBottomMargin, bool& bMirrored) +{ + nPageLeftMargin = SWPAGE_NO_MARGIN; + nPageRightMargin = SWPAGE_NO_MARGIN; + nPageTopMargin = SWPAGE_NO_MARGIN; + nPageBottomMargin = SWPAGE_NO_MARGIN; + bMirrored = false; +} + bool IsNarrow( const long nPageLeftMargin, const long nPageRightMargin, const long nPageTopMargin, const long nPageBottomMargin, bool bMirrored) { diff --git a/sw/uiconfig/swriter/ui/pageformatpanel.ui b/sw/uiconfig/swriter/ui/pageformatpanel.ui index 46fc942d14c8..b1cff199f910 100644 --- a/sw/uiconfig/swriter/ui/pageformatpanel.ui +++ b/sw/uiconfig/swriter/ui/pageformatpanel.ui @@ -154,6 +154,7 @@ <property name="visible">True</property> <property name="can_focus">False</property> <items> + <item translatable="yes">None</item> <item translatable="yes">Narrow</item> <item translatable="yes">Moderate</item> <item translatable="yes">Normal 0.75"</item> |