From 558faa307d87510c2d9d12b23c12f261c424f835 Mon Sep 17 00:00:00 2001 From: Szymon Kłos Date: Wed, 28 Sep 2016 16:08:53 +0200 Subject: Page margin popup converted to use outside sidebar Change-Id: I3c4cc20fc8f2818677a77f848a1566bb56ceb7c6 Reviewed-on: https://gerrit.libreoffice.org/29363 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt --- icon-themes/breeze/cmd/lc_pagemargin.png | Bin 0 -> 237 bytes .../sidebar/pageproppanel/format_L_copy_24x24.png | Bin 237 -> 0 bytes .../sidebar/pageproppanel/format_L_copy_24x24.png | Bin 187 -> 0 bytes icon-themes/elementary/cmd/lc_pagemargin.png | Bin 0 -> 123 bytes .../sidebar/pageproppanel/format_L_copy_24x24.png | Bin 123 -> 0 bytes icon-themes/galaxy/cmd/lc_pagemargin.png | Bin 0 -> 123 bytes .../sidebar/pageproppanel/format_L_copy_24x24.png | Bin 123 -> 0 bytes icon-themes/sifr/cmd/lc_pagemargin.png | Bin 0 -> 402 bytes icon-themes/tango/cmd/lc_pagemargin.png | Bin 0 -> 980 bytes .../sidebar/pageproppanel/format_L_copy_24x24.png | Bin 980 -> 0 bytes .../org/openoffice/Office/UI/WriterCommands.xcu | 8 + sw/Library_sw.mk | 1 + sw/UIConfig_swriter.mk | 1 + sw/inc/PageMarginPopup.hxx | 41 ++ sw/inc/cmdid.h | 1 + sw/sdi/_viewsh.sdi | 5 + sw/sdi/swriter.sdi | 18 + sw/source/ui/sidebar/PagePropertyPanel.src | 258 +-------- sw/source/uibase/app/swmodule.cxx | 2 + sw/source/uibase/sidebar/PageColumnControl.cxx | 1 - sw/source/uibase/sidebar/PageColumnControl.hxx | 4 + sw/source/uibase/sidebar/PageMarginControl.cxx | 624 ++++++++++++--------- sw/source/uibase/sidebar/PageMarginControl.hxx | 97 ++-- sw/source/uibase/sidebar/PageMarginPopup.cxx | 46 ++ sw/source/uibase/sidebar/PagePropertyPanel.cxx | 301 +--------- sw/source/uibase/sidebar/PagePropertyPanel.hrc | 106 ---- sw/source/uibase/sidebar/PagePropertyPanel.hxx | 88 +-- sw/source/uibase/sidebar/PageSizeControl.cxx | 3 +- sw/source/uibase/sidebar/PropertyPanel.hrc | 7 +- sw/source/uibase/sidebar/WrapPropertyPanel.cxx | 1 - sw/uiconfig/swriter/ui/notebookbar.ui | 55 +- sw/uiconfig/swriter/ui/pagemargincontrol.ui | 442 +++++++++++++++ sw/uiconfig/swriter/ui/sidebarpage.ui | 7 +- 33 files changed, 1010 insertions(+), 1107 deletions(-) create mode 100644 icon-themes/breeze/cmd/lc_pagemargin.png delete mode 100644 icon-themes/breeze/sw/res/sidebar/pageproppanel/format_L_copy_24x24.png delete mode 100644 icon-themes/breeze_dark/sw/res/sidebar/pageproppanel/format_L_copy_24x24.png create mode 100644 icon-themes/elementary/cmd/lc_pagemargin.png delete mode 100644 icon-themes/elementary/sw/res/sidebar/pageproppanel/format_L_copy_24x24.png create mode 100644 icon-themes/galaxy/cmd/lc_pagemargin.png delete mode 100644 icon-themes/galaxy/sw/res/sidebar/pageproppanel/format_L_copy_24x24.png create mode 100644 icon-themes/sifr/cmd/lc_pagemargin.png create mode 100644 icon-themes/tango/cmd/lc_pagemargin.png delete mode 100644 icon-themes/tango/sw/res/sidebar/pageproppanel/format_L_copy_24x24.png create mode 100644 sw/inc/PageMarginPopup.hxx create mode 100644 sw/source/uibase/sidebar/PageMarginPopup.cxx delete mode 100644 sw/source/uibase/sidebar/PagePropertyPanel.hrc create mode 100644 sw/uiconfig/swriter/ui/pagemargincontrol.ui diff --git a/icon-themes/breeze/cmd/lc_pagemargin.png b/icon-themes/breeze/cmd/lc_pagemargin.png new file mode 100644 index 000000000000..51ba15145acd Binary files /dev/null and b/icon-themes/breeze/cmd/lc_pagemargin.png differ diff --git a/icon-themes/breeze/sw/res/sidebar/pageproppanel/format_L_copy_24x24.png b/icon-themes/breeze/sw/res/sidebar/pageproppanel/format_L_copy_24x24.png deleted file mode 100644 index 51ba15145acd..000000000000 Binary files a/icon-themes/breeze/sw/res/sidebar/pageproppanel/format_L_copy_24x24.png and /dev/null differ diff --git a/icon-themes/breeze_dark/sw/res/sidebar/pageproppanel/format_L_copy_24x24.png b/icon-themes/breeze_dark/sw/res/sidebar/pageproppanel/format_L_copy_24x24.png deleted file mode 100644 index b5cc8b36ff12..000000000000 Binary files a/icon-themes/breeze_dark/sw/res/sidebar/pageproppanel/format_L_copy_24x24.png and /dev/null differ diff --git a/icon-themes/elementary/cmd/lc_pagemargin.png b/icon-themes/elementary/cmd/lc_pagemargin.png new file mode 100644 index 000000000000..49625cdf1901 Binary files /dev/null and b/icon-themes/elementary/cmd/lc_pagemargin.png differ diff --git a/icon-themes/elementary/sw/res/sidebar/pageproppanel/format_L_copy_24x24.png b/icon-themes/elementary/sw/res/sidebar/pageproppanel/format_L_copy_24x24.png deleted file mode 100644 index 49625cdf1901..000000000000 Binary files a/icon-themes/elementary/sw/res/sidebar/pageproppanel/format_L_copy_24x24.png and /dev/null differ diff --git a/icon-themes/galaxy/cmd/lc_pagemargin.png b/icon-themes/galaxy/cmd/lc_pagemargin.png new file mode 100644 index 000000000000..49625cdf1901 Binary files /dev/null and b/icon-themes/galaxy/cmd/lc_pagemargin.png differ diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/format_L_copy_24x24.png b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/format_L_copy_24x24.png deleted file mode 100644 index 49625cdf1901..000000000000 Binary files a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/format_L_copy_24x24.png and /dev/null differ diff --git a/icon-themes/sifr/cmd/lc_pagemargin.png b/icon-themes/sifr/cmd/lc_pagemargin.png new file mode 100644 index 000000000000..3c36f7c305de Binary files /dev/null and b/icon-themes/sifr/cmd/lc_pagemargin.png differ diff --git a/icon-themes/tango/cmd/lc_pagemargin.png b/icon-themes/tango/cmd/lc_pagemargin.png new file mode 100644 index 000000000000..daae87cad35c Binary files /dev/null and b/icon-themes/tango/cmd/lc_pagemargin.png differ diff --git a/icon-themes/tango/sw/res/sidebar/pageproppanel/format_L_copy_24x24.png b/icon-themes/tango/sw/res/sidebar/pageproppanel/format_L_copy_24x24.png deleted file mode 100644 index daae87cad35c..000000000000 Binary files a/icon-themes/tango/sw/res/sidebar/pageproppanel/format_L_copy_24x24.png and /dev/null differ diff --git a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu index a0c4ac457f2a..8df4e9271bcd 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu @@ -2875,6 +2875,14 @@ 1 + + + Page Margin + + + 1 + + diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk index 6f0877fc0cda..fa18519a6bab 100644 --- a/sw/Library_sw.mk +++ b/sw/Library_sw.mk @@ -679,6 +679,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\ sw/source/uibase/sidebar/PageOrientationControl \ sw/source/uibase/sidebar/PageOrientationPopup \ sw/source/uibase/sidebar/PageMarginControl \ + sw/source/uibase/sidebar/PageMarginPopup \ sw/source/uibase/sidebar/PageSizeControl \ sw/source/uibase/sidebar/PageSizePopup \ sw/source/uibase/sidebar/PageColumnControl \ diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk index 45a52d82087f..7e7e649629e1 100644 --- a/sw/UIConfig_swriter.mk +++ b/sw/UIConfig_swriter.mk @@ -208,6 +208,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\ sw/uiconfig/swriter/ui/notebookbar_groups \ sw/uiconfig/swriter/ui/notebookbar_single \ sw/uiconfig/swriter/ui/pagecolumncontrol \ + sw/uiconfig/swriter/ui/pagemargincontrol \ sw/uiconfig/swriter/ui/pageorientationcontrol \ sw/uiconfig/swriter/ui/pagesizecontrol \ sw/uiconfig/swriter/ui/paradialog \ diff --git a/sw/inc/PageMarginPopup.hxx b/sw/inc/PageMarginPopup.hxx new file mode 100644 index 000000000000..52695206de85 --- /dev/null +++ b/sw/inc/PageMarginPopup.hxx @@ -0,0 +1,41 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_SW_INC_PAGEMARGINPOPUP_HXX +#define INCLUDED_SW_INC_PAGEMARGINPOPUP_HXX + +#include +#include +#include +#include + +class SW_DLLPUBLIC PageMarginPopup : public SfxToolBoxControl +{ +public: + SFX_DECL_TOOLBOX_CONTROL(); + + PageMarginPopup(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx); + virtual ~PageMarginPopup() override; + + virtual VclPtr CreatePopupWindow() override; +}; + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h index 284bcfb95dcb..30eb2f49f964 100644 --- a/sw/inc/cmdid.h +++ b/sw/inc/cmdid.h @@ -859,6 +859,7 @@ #define SID_ATTR_PAGE_FOOTER_LRMARGIN (FN_SIDEBAR + 8) #define SID_ATTR_PAGE_FOOTER_SPACING (FN_SIDEBAR + 9) #define SID_ATTR_PAGE_FOOTER_LAYOUT (FN_SIDEBAR + 10) +#define SID_ATTR_PAGE_MARGIN (FN_SIDEBAR + 11) //Member IDs for Fill / SetVariable of items #define MID_STYLE 0xe0 diff --git a/sw/sdi/_viewsh.sdi b/sw/sdi/_viewsh.sdi index 99f3fb657d60..eed84838b98a 100644 --- a/sw/sdi/_viewsh.sdi +++ b/sw/sdi/_viewsh.sdi @@ -522,6 +522,11 @@ interface BaseTextEditView StateMethod = StateTabWin ; DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] + SID_ATTR_PAGE_MARGIN + [ + StateMethod = StateTabWin ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] SID_THESAURUS // status(final|play) [ diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi index 93c18fae6b15..d28cf5215fcb 100644 --- a/sw/sdi/swriter.sdi +++ b/sw/sdi/swriter.sdi @@ -7471,6 +7471,24 @@ SvxLongLRSpaceItem SwPageLRMargin SID_ATTR_PAGE_LRSPACE GroupId = GID_FORMAT; ] +SfxVoidItem PageMargin SID_ATTR_PAGE_MARGIN + +[ + AutoUpdate = FALSE, + FastCall = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + + + AccelConfig = FALSE, + MenuConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_FORMAT; +] + SfxBoolItem SwPageHeaderItem SID_ATTR_PAGE_HEADER [ diff --git a/sw/source/ui/sidebar/PagePropertyPanel.src b/sw/source/ui/sidebar/PagePropertyPanel.src index 6544520cba7a..78816a2971c6 100644 --- a/sw/source/ui/sidebar/PagePropertyPanel.src +++ b/sw/source/ui/sidebar/PagePropertyPanel.src @@ -19,265 +19,31 @@ #include #include "PropertyPanel.hrc" -#include "PagePropertyPanel.hrc" #include "helpid.h" -Image IMG_PAGE_NARROW +String STR_MARGIN_TOOLTIP_LEFT { - ImageBitmap = Bitmap{File = "sidebar/pageproppanel/format_L_narrow_24x24.png";}; + Text [ en-US ] = "Left: "; }; -Image IMG_PAGE_NORMAL +String STR_MARGIN_TOOLTIP_RIGHT { - ImageBitmap = Bitmap{File = "sidebar/pageproppanel/format_L_nomal_24x24.png";}; + Text [ en-US ] = ". Right: "; }; -Image IMG_PAGE_WIDE +String STR_MARGIN_TOOLTIP_INNER { - ImageBitmap = Bitmap{File = "sidebar/pageproppanel/format_L_wide_24x24.png";}; + Text [ en-US ] = "Inner: "; }; -Image IMG_PAGE_MIRRORED +String STR_MARGIN_TOOLTIP_OUTER { - ImageBitmap = Bitmap{File = "sidebar/pageproppanel/format_L_mirror_24x24.png";}; + Text [ en-US ] = ". Outer: "; }; -Image IMG_PAGE_MARGIN_CUSTOM +String STR_MARGIN_TOOLTIP_TOP { - ImageBitmap = Bitmap{File = "sidebar/pageproppanel/format_L_copy_24x24.png";}; + Text [ en-US ] = ". Top: "; }; -Image IMG_PAGE_NARROW_L +String STR_MARGIN_TOOLTIP_BOT { - ImageBitmap = Bitmap{File = "sidebar/pageproppanel/formatnarrow_24x24.png";}; -}; -Image IMG_PAGE_NORMAL_L -{ - ImageBitmap = Bitmap{File = "sidebar/pageproppanel/formatnormal_24x24.png";}; -}; -Image IMG_PAGE_WIDE_L -{ - ImageBitmap = Bitmap{File = "sidebar/pageproppanel/formatwide_24x24.png";}; -}; -Image IMG_PAGE_MIRRORED_L -{ - ImageBitmap = Bitmap{File = "sidebar/pageproppanel/formatmirror_24x24.png";}; -}; -Image IMG_PAGE_MARGIN_CUSTOM_L -{ - ImageBitmap = Bitmap{File = "sidebar/pageproppanel/formatcopy_24x24.png";}; -}; - -// popup for page style's margin attributes -Control RID_POPUP_SWPAGE_MARGIN -{ - OutputSize = TRUE; - DialogControl = TRUE; - Border = FALSE; - Size = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL * 2 + POPUP_BORDER_WIDTH + VS_WIDTH, MARGIN_PANEL_HEIGHT ); - - Control VS_MARGIN - { - Pos = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL + OFFSET_X, POPUPPANEL_MARGIN_SMALL + OFFSET_Y ); - Size = MAP_APPFONT ( VS_WIDTH , ITEM_HEIGHT*5); - HelpID = HID_SWPAGE_VS_MARGIN; - TabStop = TRUE ; - Text = "Margin"; - }; - FixedText FT_CUSTOM - { - Pos = MAP_APPFONT ( FT_CUSTOM_X, FT_CUSTOM_Y ); - Size = MAP_APPFONT ( MBOX_WIDTH + 30, TEXT_HEIGHT) ; - Text [ en-US ] = "Custom:"; - }; - FixedText FT_LEFT - { - Pos = MAP_APPFONT ( FT_X, FT_LEFT_Y ); - Size = MAP_APPFONT ( 25, TEXT_HEIGHT) ; - Text [ en-US ] = "~Left:"; - }; - FixedText FT_INNER - { - Pos = MAP_APPFONT ( FT_X, FT_LEFT_Y ); - Size = MAP_APPFONT ( 25, TEXT_HEIGHT) ; - Text [ en-US ] = "I~nner:"; - }; - MetricField MF_SWLEFT_MARGIN - { - Border = TRUE; - Pos = MAP_APPFONT ( MF_X , LEFT_MF_Y ); - Size = MAP_APPFONT ( MBOX_WIDTH - 12, MBOX_HEIGHT ); - HelpID = HID_SWPAGE_LEFT_MARGIN; - Left = TRUE; - Repeat = TRUE; - Spin = TRUE; - Maximum = 9999; - DecimalDigits = 2; - Unit = FUNIT_CM; - Last = 9999; - SpinSize = 10; - }; - FixedText FT_RIGHT - { - Pos = MAP_APPFONT ( FT_X, FT_RIGHT_Y ); - Size = MAP_APPFONT ( 25, TEXT_HEIGHT) ; - Text [ en-US ] = "~Right:"; - }; - FixedText FT_OUTER - { - Pos = MAP_APPFONT ( FT_X, FT_RIGHT_Y ); - Size = MAP_APPFONT ( 25, TEXT_HEIGHT) ; - Text [ en-US ] = "O~uter:"; - }; - MetricField MF_SWRIGHT_MARGIN - { - Border = TRUE; - Pos = MAP_APPFONT ( MF_X , RIGHT_MF_Y ); - Size = MAP_APPFONT ( MBOX_WIDTH - 12, MBOX_HEIGHT ); - HelpID = HID_SWPAGE_RIGHT_MARGIN; - Left = TRUE; - Repeat = TRUE; - Spin = TRUE; - Maximum = 9999; - DecimalDigits = 2; - Unit = FUNIT_CM; - Last = 9999; - SpinSize = 10; - }; - FixedText FT_TOP - { - Pos = MAP_APPFONT ( FT_X, FT_TOP_Y ); - Size = MAP_APPFONT ( 25, TEXT_HEIGHT) ; - Text [ en-US ] = "~Top:"; - }; - MetricField MF_SWTOP_MARGIN - { - Border = TRUE; - Pos = MAP_APPFONT ( MF_X , TOP_MF_Y ); - Size = MAP_APPFONT ( MBOX_WIDTH - 12, MBOX_HEIGHT ); - HelpID = HID_SWPAGE_TOP_MARGIN; - Left = TRUE; - Repeat = TRUE; - Spin = TRUE; - Maximum = 9999; - DecimalDigits = 2; - Unit = FUNIT_CM; - Last = 9999; - SpinSize = 10; - }; - FixedText FT_BOTTOM - { - Pos = MAP_APPFONT ( FT_X, FT_BOTTOM_Y ); - Size = MAP_APPFONT ( 25, TEXT_HEIGHT) ; - Text [ en-US ] = "~Bottom:"; - }; - MetricField MF_SWBOTTOM_MARGIN - { - Border = TRUE; - Pos = MAP_APPFONT ( MF_X , BOTTOM_MF_Y ); - Size = MAP_APPFONT ( MBOX_WIDTH - 12, MBOX_HEIGHT ); - HelpID = HID_SWPAGE_BOTTOM_MARGIN; - Left = TRUE; - Repeat = TRUE; - Spin = TRUE; - Maximum = 9999; - DecimalDigits = 2; - Unit = FUNIT_CM; - Last = 9999; - SpinSize = 10; - }; - MetricField FLD_WIDTH_HEIGHT - { - Border = TRUE; - Left = TRUE; - Repeat = TRUE; - Spin = TRUE; - Maximum = 9999; - DecimalDigits = 2; - Unit = FUNIT_CM; - Last = 9999; - SpinSize = 10; - }; - - Image IMG_NARROW - { - ImageBitmap = Bitmap{File = "sidebar/pageproppanel/format_L_narrow_24x24.png";}; - }; - Image IMG_NORMAL - { - ImageBitmap = Bitmap{File = "sidebar/pageproppanel/format_L_nomal_24x24.png";}; - }; - Image IMG_WIDE - { - ImageBitmap = Bitmap{File = "sidebar/pageproppanel/format_L_wide_24x24.png";}; - }; - Image IMG_MIRRORED - { - ImageBitmap = Bitmap{File = "sidebar/pageproppanel/format_L_mirror_24x24.png";}; - }; - Image IMG_NARROW_L - { - ImageBitmap = Bitmap{File = "sidebar/pageproppanel/formatnarrow_24x24.png";}; - }; - Image IMG_NORMAL_L - { - ImageBitmap = Bitmap{File = "sidebar/pageproppanel/formatnormal_24x24.png";}; - }; - Image IMG_WIDE_L - { - ImageBitmap = Bitmap{File = "sidebar/pageproppanel/formatwide_24x24.png";}; - }; - Image IMG_MIRRORED_L - { - ImageBitmap = Bitmap{File = "sidebar/pageproppanel/formatmirror_24x24.png";}; - }; - Image IMG_CUSTOM - { - ImageBitmap = Bitmap{File = "sidebar/pageproppanel/last_custom_common.png";}; - }; - Image IMG_CUSTOM_DIS - { - ImageBitmap = Bitmap{File = "sidebar/pageproppanel/last_custom_common_grey.png";}; - }; - String STR_LCVALUE - { - Text [ en-US ] = "Last Custom Values"; - }; - String STR_NARROW - { - Text [ en-US ] = "Narrow"; - }; - String STR_NORMAL - { - Text [ en-US ] = "Normal"; - }; - String STR_WIDE - { - Text [ en-US ] = "Wide"; - }; - String STR_MIRRORED - { - Text [ en-US ] = "Mirrored"; - }; - String STR_MARGIN_TOOLTIP_LEFT - { - Text [ en-US ] = "Left: "; - }; - String STR_MARGIN_TOOLTIP_RIGHT - { - Text [ en-US ] = ". Right: "; - }; - String STR_MARGIN_TOOLTIP_INNER - { - Text [ en-US ] = "Inner: "; - }; - String STR_MARGIN_TOOLTIP_OUTER - { - Text [ en-US ] = ". Outer: "; - }; - String STR_MARGIN_TOOLTIP_TOP - { - Text [ en-US ] = ". Top: "; - }; - String STR_MARGIN_TOOLTIP_BOT - { - Text [ en-US ] = ". Bottom: "; - }; + Text [ en-US ] = ". Bottom: "; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx index 5244398963ad..eaa726bea839 100644 --- a/sw/source/uibase/app/swmodule.cxx +++ b/sw/source/uibase/app/swmodule.cxx @@ -111,6 +111,7 @@ #include #include #include +#include #include #include @@ -294,6 +295,7 @@ void SwDLL::RegisterControls() svx::TextUnderlinePopup::RegisterControl(SID_ATTR_CHAR_UNDERLINE, pMod); svx::ParaULSpacingControl::RegisterControl(SID_ATTR_PARA_ULSPACE, pMod); svx::ParaLRSpacingControl::RegisterControl(SID_ATTR_PARA_LRSPACE, pMod); + PageMarginPopup::RegisterControl(SID_ATTR_PAGE_MARGIN, pMod); PageOrientationPopup::RegisterControl(SID_ATTR_PAGE_ORIENTATION, pMod); PageColumnPopup::RegisterControl(SID_ATTR_PAGE_COLUMN, pMod); PageSizePopup::RegisterControl(SID_ATTR_PAGE_SIZE, pMod); diff --git a/sw/source/uibase/sidebar/PageColumnControl.cxx b/sw/source/uibase/sidebar/PageColumnControl.cxx index 04d24c43160a..3b1fd05f2d30 100644 --- a/sw/source/uibase/sidebar/PageColumnControl.cxx +++ b/sw/source/uibase/sidebar/PageColumnControl.cxx @@ -19,7 +19,6 @@ #include "PageColumnControl.hxx" #include "PagePropertyPanel.hxx" -#include "PagePropertyPanel.hrc" #include #include diff --git a/sw/source/uibase/sidebar/PageColumnControl.hxx b/sw/source/uibase/sidebar/PageColumnControl.hxx index 79551ae93fa1..f83943dee1c2 100644 --- a/sw/source/uibase/sidebar/PageColumnControl.hxx +++ b/sw/source/uibase/sidebar/PageColumnControl.hxx @@ -21,6 +21,10 @@ #include #include +#include +#include +#include +#include namespace sw { namespace sidebar { diff --git a/sw/source/uibase/sidebar/PageMarginControl.cxx b/sw/source/uibase/sidebar/PageMarginControl.cxx index ca73e952dfe0..b53227532e95 100644 --- a/sw/source/uibase/sidebar/PageMarginControl.cxx +++ b/sw/source/uibase/sidebar/PageMarginControl.cxx @@ -23,11 +23,18 @@ #include "PageMarginControl.hxx" #include "PagePropertyPanel.hxx" -#include "PagePropertyPanel.hrc" +#include "PropertyPanel.hrc" + +#include +#include +#include +#include #include +#include + +#include -#include #include #define SWPAGE_LEFT_GVALUE "Sw_Page_Left" @@ -36,99 +43,180 @@ #define SWPAGE_DOWN_GVALUE "Sw_Page_Down" #define SWPAGE_MIRROR_GVALUE "Sw_Page_Mirrored" +namespace +{ + FieldUnit lcl_GetFieldUnit() + { + FieldUnit eUnit = FUNIT_INCH; + const SfxPoolItem* pItem = nullptr; + SfxItemState eState = SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState( SID_ATTR_METRIC, pItem ); + if ( pItem && eState >= SfxItemState::DEFAULT ) + { + eUnit = (FieldUnit)static_cast( pItem )->GetValue(); + } + else + { + return SfxModule::GetCurrentFieldUnit(); + } + + return eUnit; + } + + MapUnit lcl_GetUnit() + { + SfxItemPool &rPool = SfxGetpApp()->GetPool(); + sal_uInt16 nWhich = rPool.GetWhich( SID_ATTR_PAGE_SIZE ); + return rPool.GetMetric( nWhich ); + } + + const css::uno::Reference< css::document::XUndoManager > getUndoManager( const css::uno::Reference< css::frame::XFrame >& rxFrame ) + { + const css::uno::Reference< css::frame::XController >& xController = rxFrame->getController(); + if ( xController.is() ) + { + const css::uno::Reference< css::frame::XModel >& xModel = xController->getModel(); + if ( xModel.is() ) + { + const css::uno::Reference< css::document::XUndoManagerSupplier > xSuppUndo( xModel, css::uno::UNO_QUERY_THROW ); + if ( xSuppUndo.is() ) + { + const css::uno::Reference< css::document::XUndoManager > xUndoManager( xSuppUndo->getUndoManager(), css::uno::UNO_QUERY_THROW ); + return xUndoManager; + } + } + } + + return css::uno::Reference< css::document::XUndoManager > (); + } +} + namespace sw { namespace sidebar { -PageMarginControl::PageMarginControl( - vcl::Window* pParent, - PagePropertyPanel& rPanel, - const SvxLongLRSpaceItem& aPageLRMargin, - const SvxLongULSpaceItem& aPageULMargin, - const bool bMirrored, - const Size& rPageSize, - const bool bLandscape, - const FieldUnit eFUnit, - const MapUnit eUnit ) - : svx::sidebar::PopupControl( pParent, SW_RES(RID_POPUP_SWPAGE_MARGIN) ) - , mpMarginValueSet( VclPtr::Create( svx::sidebar::ValueSetWithTextControl::ControlType::ImageText, this, SW_RES(VS_MARGIN) ) ) - , maCustom(VclPtr::Create(this, SW_RES(FT_CUSTOM))) - , maLeft(VclPtr::Create(this, SW_RES(FT_LEFT))) - , maInner(VclPtr::Create(this, SW_RES(FT_INNER))) - , maLeftMarginEdit(VclPtr::Create(this, SW_RES(MF_SWLEFT_MARGIN))) - , maRight(VclPtr::Create(this, SW_RES(FT_RIGHT))) - , maOuter(VclPtr::Create(this, SW_RES(FT_OUTER))) - , maRightMarginEdit(VclPtr::Create(this, SW_RES(MF_SWRIGHT_MARGIN))) - , maTop(VclPtr::Create(this, SW_RES(FT_TOP))) - , maTopMarginEdit(VclPtr::Create(this, SW_RES(MF_SWTOP_MARGIN))) - , maBottom(VclPtr::Create(this, SW_RES(FT_BOTTOM))) - , maBottomMarginEdit(VclPtr::Create(this, SW_RES(MF_SWBOTTOM_MARGIN))) - , maWidthHeightField(VclPtr::Create( this, SW_RES(FLD_WIDTH_HEIGHT) ) ) - , mnPageLeftMargin( aPageLRMargin.GetLeft() ) - , mnPageRightMargin( aPageLRMargin.GetRight() ) - , mnPageTopMargin( aPageULMargin.GetUpper() ) - , mnPageBottomMargin( aPageULMargin.GetLower() ) - , mbMirrored( bMirrored ) - , meUnit( eUnit ) - , mbUserCustomValuesAvailable(false) - , mnUserCustomPageLeftMargin(0) - , mnUserCustomPageRightMargin(0) - , mnUserCustomPageTopMargin(0) - , mnUserCustomPageBottomMargin(0) - , mbUserCustomMirrored(false) - , mbCustomValuesUsed( false ) - , mrPagePropPanel(rPanel) +PageMarginControl::PageMarginControl( sal_uInt16 nId ) + : SfxPopupWindow( nId, "PageMarginControl", "modules/swriter/ui/pagemargincontrol.ui" ) + , m_eUnit( lcl_GetUnit() ) + , m_bUserCustomValuesAvailable( false ) + , m_nUserCustomPageLeftMargin( 0 ) + , m_nUserCustomPageRightMargin( 0 ) + , m_nUserCustomPageTopMargin( 0 ) + , m_nUserCustomPageBottomMargin( 0 ) + , m_bUserCustomMirrored( false ) + , m_bCustomValuesUsed( false ) { - maWidthHeightField->Hide(); - SetFieldUnit( *maWidthHeightField.get(), eFUnit ); - - mbUserCustomValuesAvailable = GetUserCustomValues(); + bool bLandscape = false; + const SfxPoolItem* pItem; + const SvxSizeItem* pSize = nullptr; + const SvxLongLRSpaceItem* pLRItem = nullptr; + const SvxLongULSpaceItem* pULItem = nullptr; + if ( SfxViewFrame::Current() ) + { + SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState( SID_ATTR_PAGE, pItem ); + bLandscape = static_cast( pItem )->IsLandscape(); + m_bMirrored = static_cast( pItem )->GetPageUsage() == SVX_PAGE_MIRROR; + SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState( SID_ATTR_PAGE_SIZE, pItem ); + pSize = static_cast( pItem ); + SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState( SID_ATTR_PAGE_LRSPACE, pItem ); + pLRItem = static_cast( pItem ); + SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState( SID_ATTR_PAGE_ULSPACE, pItem ); + pULItem = static_cast( pItem ); + } - mpMarginValueSet->SetStyle( mpMarginValueSet->GetStyle() | WB_3DLOOK | WB_NO_DIRECTSELECT ); - mpMarginValueSet->SetColor( GetSettings().GetStyleSettings().GetMenuColor() ); + if ( pLRItem ) + { + m_nPageLeftMargin = pLRItem->GetLeft(); + m_nPageRightMargin = pLRItem->GetRight(); + } - FillValueSet( bLandscape, mbUserCustomValuesAvailable ); + if ( pULItem ) + { + m_nPageTopMargin = pULItem->GetUpper(); + m_nPageBottomMargin = pULItem->GetLower(); + } - mpMarginValueSet->SetNoSelection(); - mpMarginValueSet->SetSelectHdl( LINK(this, PageMarginControl,ImplMarginHdl ) ); - mpMarginValueSet->Show(); + if ( bLandscape ) + { + get( m_pNarrow, "narrowL" ); + get( m_pNormal, "normalL" ); + get( m_pWide, "wideL" ); + get( m_pMirrored, "mirroredL" ); + get( m_pLast, "lastL" ); + } + else + { + get( m_pNarrow, "narrow" ); + get( m_pNormal, "normal" ); + get( m_pWide, "wide" ); + get( m_pMirrored, "mirrored" ); + get( m_pLast, "last" ); + } - SelectValueSetItem(); + m_pNarrow->Show(); + m_pNormal->Show(); + m_pWide->Show(); + m_pMirrored->Show(); + m_pLast->Show(); + + m_pNarrow->SetClickHdl( LINK( this, PageMarginControl, SelectMarginHdl ) ); + m_pNormal->SetClickHdl( LINK( this, PageMarginControl, SelectMarginHdl ) ); + m_pWide->SetClickHdl( LINK( this, PageMarginControl, SelectMarginHdl ) ); + m_pMirrored->SetClickHdl( LINK( this, PageMarginControl, SelectMarginHdl ) ); + m_pLast->SetClickHdl( LINK( this, PageMarginControl, SelectMarginHdl ) ); + + get( m_pContainer, "container" ); + m_pWidthHeightField = VclPtr::Create( m_pContainer.get(), (WinBits)0 ); + m_pWidthHeightField->Hide(); + m_pWidthHeightField->SetUnit( FUNIT_CM ); + m_pWidthHeightField->SetMax( 9999 ); + m_pWidthHeightField->SetDecimalDigits( 2 ); + m_pWidthHeightField->SetSpinSize( 10 ); + m_pWidthHeightField->SetLast( 9999 ); + SetFieldUnit( *m_pWidthHeightField.get(), lcl_GetFieldUnit() ); + + m_bUserCustomValuesAvailable = GetUserCustomValues(); + + FillHelpText( m_bUserCustomValuesAvailable ); + + get( m_pLeftMarginEdit, "left" ); + get( m_pRightMarginEdit, "right" ); + get( m_pTopMarginEdit, "top" ); + get( m_pBottomMarginEdit, "bottom" ); - SetFieldUnit( *maLeftMarginEdit.get(), eFUnit ); Link aLinkLR = LINK( this, PageMarginControl, ModifyLRMarginHdl ); - maLeftMarginEdit->SetModifyHdl( aLinkLR ); - SetMetricValue( *maLeftMarginEdit.get(), mnPageLeftMargin, meUnit ); + m_pLeftMarginEdit->SetModifyHdl( aLinkLR ); + SetMetricValue( *m_pLeftMarginEdit.get(), m_nPageLeftMargin, m_eUnit ); - SetFieldUnit( *maRightMarginEdit.get(), eFUnit ); - maRightMarginEdit->SetModifyHdl( aLinkLR ); - SetMetricValue( *maRightMarginEdit.get(), mnPageRightMargin, meUnit ); + m_pRightMarginEdit->SetModifyHdl( aLinkLR ); + SetMetricValue( *m_pRightMarginEdit.get(), m_nPageRightMargin, m_eUnit ); Link aLinkUL = LINK( this, PageMarginControl, ModifyULMarginHdl ); - SetFieldUnit( *maTopMarginEdit.get(), eFUnit ); - maTopMarginEdit->SetModifyHdl( aLinkUL ); - SetMetricValue( *maTopMarginEdit.get(), mnPageTopMargin, meUnit ); + m_pTopMarginEdit->SetModifyHdl( aLinkUL ); + SetMetricValue( *m_pTopMarginEdit.get(), m_nPageTopMargin, m_eUnit ); - SetFieldUnit( *maBottomMarginEdit.get(), eFUnit ); - maBottomMarginEdit->SetModifyHdl( aLinkUL ); - SetMetricValue( *maBottomMarginEdit.get(), mnPageBottomMargin, meUnit ); + m_pBottomMarginEdit->SetModifyHdl( aLinkUL ); + SetMetricValue( *m_pBottomMarginEdit.get(), m_nPageBottomMargin, m_eUnit ); - SetMetricFieldMaxValues(rPageSize); + m_aPageSize = pSize->GetSize(); + SetMetricFieldMaxValues( m_aPageSize ); - if ( mbMirrored ) + get( m_pLeft, "leftLabel" ); + get( m_pRight, "rightLabel" ); + get( m_pInner, "innerLabel" ); + get( m_pOuter, "outerLabel" ); + + if ( m_bMirrored ) { - maLeft->Hide(); - maRight->Hide(); - maInner->Show(); - maOuter->Show(); + m_pLeft->Hide(); + m_pRight->Hide(); + m_pInner->Show(); + m_pOuter->Show(); } else { - maLeft->Show(); - maRight->Show(); - maInner->Hide(); - maOuter->Hide(); + m_pLeft->Show(); + m_pRight->Show(); + m_pInner->Hide(); + m_pOuter->Hide(); } - - FreeResource(); } PageMarginControl::~PageMarginControl() @@ -138,63 +226,64 @@ PageMarginControl::~PageMarginControl() void PageMarginControl::dispose() { - mpMarginValueSet.disposeAndClear(); - StoreUserCustomValues(); - maCustom.disposeAndClear(); - maLeft.disposeAndClear(); - maInner.disposeAndClear(); - maLeftMarginEdit.disposeAndClear(); - maRight.disposeAndClear(); - maOuter.disposeAndClear(); - maRightMarginEdit.disposeAndClear(); - maTop.disposeAndClear(); - maTopMarginEdit.disposeAndClear(); - maBottom.disposeAndClear(); - maBottomMarginEdit.disposeAndClear(); - maWidthHeightField.disposeAndClear(); - svx::sidebar::PopupControl::dispose(); + m_pLeft.disposeAndClear(); + m_pRight.disposeAndClear(); + m_pInner.disposeAndClear(); + m_pOuter.disposeAndClear(); + m_pLeftMarginEdit.disposeAndClear(); + m_pRightMarginEdit.disposeAndClear(); + m_pTopMarginEdit.disposeAndClear(); + m_pBottomMarginEdit.disposeAndClear(); + m_pNarrow.disposeAndClear(); + m_pNormal.disposeAndClear(); + m_pWide.disposeAndClear(); + m_pMirrored.disposeAndClear(); + m_pLast.disposeAndClear(); + + m_pWidthHeightField.disposeAndClear(); + m_pContainer.disposeAndClear(); + + SfxPopupWindow::dispose(); } -void PageMarginControl::SetMetricFieldMaxValues(const Size& rPageSize) +void PageMarginControl::SetMetricFieldMaxValues( const Size& rPageSize ) { - const long nML = maLeftMarginEdit->Denormalize( maLeftMarginEdit->GetValue(FUNIT_TWIP) ); - const long nMR = maRightMarginEdit->Denormalize( maRightMarginEdit->GetValue(FUNIT_TWIP) ); - const long nMT = maTopMarginEdit->Denormalize(maTopMarginEdit->GetValue(FUNIT_TWIP) ); - const long nMB = maBottomMarginEdit->Denormalize( maBottomMarginEdit->GetValue(FUNIT_TWIP) ); + const long nML = m_pLeftMarginEdit->Denormalize( m_pLeftMarginEdit->GetValue( FUNIT_TWIP ) ); + const long nMR = m_pRightMarginEdit->Denormalize( m_pRightMarginEdit->GetValue( FUNIT_TWIP ) ); + const long nMT = m_pTopMarginEdit->Denormalize( m_pTopMarginEdit->GetValue( FUNIT_TWIP ) ); + const long nMB = m_pBottomMarginEdit->Denormalize( m_pBottomMarginEdit->GetValue( FUNIT_TWIP ) ); - const long nPH = LogicToLogic( rPageSize.Height(), (MapUnit)meUnit, MAP_TWIP ); - const long nPW = LogicToLogic( rPageSize.Width(), (MapUnit)meUnit, MAP_TWIP ); + const long nPH = LogicToLogic( rPageSize.Height(), (MapUnit)m_eUnit, MAP_TWIP ); + const long nPW = LogicToLogic( rPageSize.Width(), (MapUnit)m_eUnit, MAP_TWIP ); // Left long nMax = nPW - nMR - MINBODY; - maLeftMarginEdit->SetMax(maLeftMarginEdit->Normalize(nMax), FUNIT_TWIP); + m_pLeftMarginEdit->SetMax( m_pLeftMarginEdit->Normalize( nMax ), FUNIT_TWIP ); // Right nMax = nPW - nML - MINBODY; - maRightMarginEdit->SetMax(maRightMarginEdit->Normalize(nMax), FUNIT_TWIP); + m_pRightMarginEdit->SetMax( m_pRightMarginEdit->Normalize( nMax ), FUNIT_TWIP ); //Top nMax = nPH - nMB - MINBODY; - maTopMarginEdit->SetMax(maTopMarginEdit->Normalize(nMax), FUNIT_TWIP); + m_pTopMarginEdit->SetMax( m_pTopMarginEdit->Normalize( nMax ), FUNIT_TWIP ); //Bottom nMax = nPH - nMT - MINBODY; - maBottomMarginEdit->SetMax(maTopMarginEdit->Normalize(nMax), FUNIT_TWIP); + m_pBottomMarginEdit->SetMax( m_pTopMarginEdit->Normalize( nMax ), FUNIT_TWIP ); } -void PageMarginControl::FillValueSet( - const bool bLandscape, - const bool bUserCustomValuesAvailable ) +void PageMarginControl::FillHelpText( const bool bUserCustomValuesAvailable ) { - const OUString aLeft = SW_RESSTR(STR_MARGIN_TOOLTIP_LEFT); - const OUString aRight = SW_RESSTR(STR_MARGIN_TOOLTIP_RIGHT); - const OUString aTop = SW_RESSTR(STR_MARGIN_TOOLTIP_TOP); - const OUString aBottom = SW_RESSTR(STR_MARGIN_TOOLTIP_BOT); + const OUString aLeft = SW_RESSTR( STR_MARGIN_TOOLTIP_LEFT ); + const OUString aRight = SW_RESSTR( STR_MARGIN_TOOLTIP_RIGHT ); + const OUString aTop = SW_RESSTR( STR_MARGIN_TOOLTIP_TOP ); + const OUString aBottom = SW_RESSTR( STR_MARGIN_TOOLTIP_BOT ); - SetMetricValue( *maWidthHeightField.get(), SWPAGE_NARROW_VALUE, meUnit ); - const OUString aNarrowValText = maWidthHeightField->GetText(); + SetMetricValue( *m_pWidthHeightField.get(), SWPAGE_NARROW_VALUE, m_eUnit ); + const OUString aNarrowValText = m_pWidthHeightField->GetText(); OUString aHelpText = aLeft; aHelpText += aNarrowValText; aHelpText += aRight; @@ -203,12 +292,10 @@ void PageMarginControl::FillValueSet( aHelpText += aNarrowValText; aHelpText += aBottom; aHelpText += aNarrowValText; - mpMarginValueSet->AddItem( - Image((bLandscape) ? SW_RES(IMG_NARROW_L) : SW_RES(IMG_NARROW)), - SW_RESSTR(STR_NARROW), &aHelpText ); + m_pNarrow->SetQuickHelpText( aHelpText ); - SetMetricValue( *maWidthHeightField.get(), SWPAGE_NORMAL_VALUE, meUnit ); - const OUString aNormalValText = maWidthHeightField->GetText(); + SetMetricValue( *m_pWidthHeightField.get(), SWPAGE_NORMAL_VALUE, m_eUnit ); + const OUString aNormalValText = m_pWidthHeightField->GetText(); aHelpText = aLeft; aHelpText += aNormalValText; aHelpText += aRight; @@ -217,14 +304,12 @@ void PageMarginControl::FillValueSet( aHelpText += aNormalValText; aHelpText += aBottom; aHelpText += aNormalValText; - mpMarginValueSet->AddItem( - Image((bLandscape) ? SW_RES(IMG_NORMAL_L) : SW_RES(IMG_NORMAL)), - SW_RESSTR(STR_NORMAL), &aHelpText ); - - SetMetricValue( *maWidthHeightField.get(), SWPAGE_WIDE_VALUE1, meUnit ); - const OUString aWide1ValText = maWidthHeightField->GetText(); - SetMetricValue( *maWidthHeightField.get(), SWPAGE_WIDE_VALUE2, meUnit ); - const OUString aWide2ValText = maWidthHeightField->GetText(); + m_pNormal->SetQuickHelpText( aHelpText ); + + SetMetricValue( *m_pWidthHeightField.get(), SWPAGE_WIDE_VALUE1, m_eUnit ); + const OUString aWide1ValText = m_pWidthHeightField->GetText(); + SetMetricValue( *m_pWidthHeightField.get(), SWPAGE_WIDE_VALUE2, m_eUnit ); + const OUString aWide2ValText = m_pWidthHeightField->GetText(); aHelpText = aLeft; aHelpText += aWide2ValText; aHelpText += aRight; @@ -233,15 +318,13 @@ void PageMarginControl::FillValueSet( aHelpText += aWide1ValText; aHelpText += aBottom; aHelpText += aWide1ValText; - mpMarginValueSet->AddItem( - Image((bLandscape) ? SW_RES(IMG_WIDE_L) : SW_RES(IMG_WIDE)), - SW_RESSTR(STR_WIDE), &aHelpText ); + m_pWide->SetQuickHelpText( aHelpText ); - const OUString aInner = SW_RESSTR(STR_MARGIN_TOOLTIP_INNER); - const OUString aOuter = SW_RESSTR(STR_MARGIN_TOOLTIP_OUTER); + const OUString aInner = SW_RESSTR( STR_MARGIN_TOOLTIP_INNER ); + const OUString aOuter = SW_RESSTR( STR_MARGIN_TOOLTIP_OUTER ); - SetMetricValue( *maWidthHeightField.get(), SWPAGE_WIDE_VALUE3, meUnit ); - const OUString aWide3ValText = maWidthHeightField->GetText(); + SetMetricValue( *m_pWidthHeightField.get(), SWPAGE_WIDE_VALUE3, m_eUnit ); + const OUString aWide3ValText = m_pWidthHeightField->GetText(); aHelpText = aInner; aHelpText += aWide3ValText; aHelpText += aOuter; @@ -250,181 +333,162 @@ void PageMarginControl::FillValueSet( aHelpText += aWide1ValText; aHelpText += aBottom; aHelpText += aWide1ValText; - mpMarginValueSet->AddItem( - Image((bLandscape) ? SW_RES(IMG_MIRRORED_L) : SW_RES(IMG_MIRRORED)), - SW_RESSTR(STR_MIRRORED), &aHelpText ); + m_pMirrored->SetQuickHelpText( aHelpText ); if ( bUserCustomValuesAvailable ) { - aHelpText = mbUserCustomMirrored ? aInner : aLeft; - SetMetricValue( *maWidthHeightField.get(), mnUserCustomPageLeftMargin, meUnit ); - aHelpText += maWidthHeightField->GetText(); - aHelpText += mbUserCustomMirrored ? aOuter : aRight; - SetMetricValue( *maWidthHeightField.get(), mnUserCustomPageRightMargin, meUnit ); - aHelpText += maWidthHeightField->GetText(); + aHelpText = m_bUserCustomMirrored ? aInner : aLeft; + SetMetricValue( *m_pWidthHeightField.get(), m_nUserCustomPageLeftMargin, m_eUnit ); + aHelpText += m_pWidthHeightField->GetText(); + aHelpText += m_bUserCustomMirrored ? aOuter : aRight; + SetMetricValue( *m_pWidthHeightField.get(), m_nUserCustomPageRightMargin, m_eUnit ); + aHelpText += m_pWidthHeightField->GetText(); aHelpText += aTop; - SetMetricValue( *maWidthHeightField.get(), mnUserCustomPageTopMargin, meUnit ); - aHelpText += maWidthHeightField->GetText(); + SetMetricValue( *m_pWidthHeightField.get(), m_nUserCustomPageTopMargin, m_eUnit ); + aHelpText += m_pWidthHeightField->GetText(); aHelpText += aBottom; - SetMetricValue( *maWidthHeightField.get(), mnUserCustomPageBottomMargin, meUnit ); - aHelpText += maWidthHeightField->GetText(); + SetMetricValue( *m_pWidthHeightField.get(), m_nUserCustomPageBottomMargin, m_eUnit ); + aHelpText += m_pWidthHeightField->GetText(); } else { aHelpText.clear(); } - mpMarginValueSet->AddItem( - Image((bUserCustomValuesAvailable) ? SW_RES(IMG_CUSTOM) : SW_RES(IMG_CUSTOM_DIS)), - SW_RESSTR(STR_LCVALUE), &aHelpText ); + m_pLast->SetQuickHelpText( aHelpText ); } -void PageMarginControl::SelectValueSetItem() +IMPL_LINK_TYPED( PageMarginControl, SelectMarginHdl, Button*, pControl, void ) { - const long cTolerance = 5; - - if( std::abs(mnPageLeftMargin - SWPAGE_NARROW_VALUE) <= cTolerance && - std::abs(mnPageRightMargin - SWPAGE_NARROW_VALUE) <= cTolerance && - std::abs(mnPageTopMargin - SWPAGE_NARROW_VALUE) <= cTolerance && - std::abs(mnPageBottomMargin - SWPAGE_NARROW_VALUE) <= cTolerance && - !mbMirrored ) + bool bMirrored = false; + bool bApplyNewPageMargins = true; + if( pControl == m_pNarrow.get() ) { - mpMarginValueSet->SelectItem(1); + m_nPageLeftMargin = SWPAGE_NARROW_VALUE; + m_nPageRightMargin = SWPAGE_NARROW_VALUE; + m_nPageTopMargin = SWPAGE_NARROW_VALUE; + m_nPageBottomMargin = SWPAGE_NARROW_VALUE; + bMirrored = false; } - else if( std::abs(mnPageLeftMargin - SWPAGE_NORMAL_VALUE) <= cTolerance && - std::abs(mnPageRightMargin - SWPAGE_NORMAL_VALUE) <= cTolerance && - std::abs(mnPageTopMargin - SWPAGE_NORMAL_VALUE) <= cTolerance && - std::abs(mnPageBottomMargin - SWPAGE_NORMAL_VALUE) <= cTolerance && - !mbMirrored ) + if( pControl == m_pNormal.get() ) { - mpMarginValueSet->SelectItem(2); + m_nPageLeftMargin = SWPAGE_NORMAL_VALUE; + m_nPageRightMargin = SWPAGE_NORMAL_VALUE; + m_nPageTopMargin = SWPAGE_NORMAL_VALUE; + m_nPageBottomMargin = SWPAGE_NORMAL_VALUE; + bMirrored = false; } - else if( std::abs(mnPageLeftMargin - SWPAGE_WIDE_VALUE2) <= cTolerance && - std::abs(mnPageRightMargin - SWPAGE_WIDE_VALUE2) <= cTolerance && - std::abs(mnPageTopMargin - SWPAGE_WIDE_VALUE1) <= cTolerance && - std::abs(mnPageBottomMargin - SWPAGE_WIDE_VALUE1) <= cTolerance && - !mbMirrored ) + if( pControl == m_pWide.get() ) { - mpMarginValueSet->SelectItem(3); + m_nPageLeftMargin = SWPAGE_WIDE_VALUE2; + m_nPageRightMargin = SWPAGE_WIDE_VALUE2; + m_nPageTopMargin = SWPAGE_WIDE_VALUE1; + m_nPageBottomMargin = SWPAGE_WIDE_VALUE1; + bMirrored = false; } - else if( std::abs(mnPageLeftMargin - SWPAGE_WIDE_VALUE3) <= cTolerance && - std::abs(mnPageRightMargin - SWPAGE_WIDE_VALUE1) <= cTolerance && - std::abs(mnPageTopMargin - SWPAGE_WIDE_VALUE1) <= cTolerance && - std::abs(mnPageBottomMargin - SWPAGE_WIDE_VALUE1) <= cTolerance && - mbMirrored ) + if( pControl == m_pMirrored.get() ) { - mpMarginValueSet->SelectItem(4); + m_nPageLeftMargin = SWPAGE_WIDE_VALUE3; + m_nPageRightMargin = SWPAGE_WIDE_VALUE1; + m_nPageTopMargin = SWPAGE_WIDE_VALUE1; + m_nPageBottomMargin = SWPAGE_WIDE_VALUE1; + bMirrored = true; } - else + if( pControl == m_pLast.get() ) { - mpMarginValueSet->SelectItem(0); + if ( m_bUserCustomValuesAvailable ) + { + m_nPageLeftMargin = m_nUserCustomPageLeftMargin; + m_nPageRightMargin = m_nUserCustomPageRightMargin; + m_nPageTopMargin = m_nUserCustomPageTopMargin; + m_nPageBottomMargin = m_nUserCustomPageBottomMargin; + bMirrored = m_bUserCustomMirrored; + } + else + { + bApplyNewPageMargins = false; + } } - mpMarginValueSet->SetFormat(); - mpMarginValueSet->Invalidate(); - mpMarginValueSet->StartSelection(); -}; -IMPL_LINK_TYPED(PageMarginControl, ImplMarginHdl, ValueSet*, pControl, void) -{ - if ( pControl == mpMarginValueSet ) + if ( bApplyNewPageMargins ) { - bool bMirrored = false; - bool bApplyNewPageMargins = true; - switch ( mpMarginValueSet->GetSelectItemId() ) + const css::uno::Reference< css::document::XUndoManager > xUndoManager( getUndoManager( SfxViewFrame::Current()->GetFrame().GetFrameInterface() ) ); + if ( xUndoManager.is() ) + xUndoManager->enterUndoContext( "" ); + + ExecuteMarginLRChange( m_nPageLeftMargin, m_nPageRightMargin ); + ExecuteMarginULChange( m_nPageTopMargin, m_nPageBottomMargin ); + if ( m_bMirrored != bMirrored ) { - case 1: - mnPageLeftMargin = SWPAGE_NARROW_VALUE; - mnPageRightMargin = SWPAGE_NARROW_VALUE; - mnPageTopMargin = SWPAGE_NARROW_VALUE; - mnPageBottomMargin = SWPAGE_NARROW_VALUE; - bMirrored = false; - break; - case 2: - mnPageLeftMargin = SWPAGE_NORMAL_VALUE; - mnPageRightMargin = SWPAGE_NORMAL_VALUE; - mnPageTopMargin = SWPAGE_NORMAL_VALUE; - mnPageBottomMargin = SWPAGE_NORMAL_VALUE; - bMirrored = false; - break; - case 3: - mnPageLeftMargin = SWPAGE_WIDE_VALUE2; - mnPageRightMargin = SWPAGE_WIDE_VALUE2; - mnPageTopMargin = SWPAGE_WIDE_VALUE1; - mnPageBottomMargin = SWPAGE_WIDE_VALUE1; - bMirrored = false; - break; - case 4: - mnPageLeftMargin = SWPAGE_WIDE_VALUE3; - mnPageRightMargin = SWPAGE_WIDE_VALUE1; - mnPageTopMargin = SWPAGE_WIDE_VALUE1; - mnPageBottomMargin = SWPAGE_WIDE_VALUE1; - bMirrored = true; - break; - case 5: - if ( mbUserCustomValuesAvailable ) - { - mnPageLeftMargin = mnUserCustomPageLeftMargin; - mnPageRightMargin = mnUserCustomPageRightMargin; - mnPageTopMargin = mnUserCustomPageTopMargin; - mnPageBottomMargin = mnUserCustomPageBottomMargin; - bMirrored = mbUserCustomMirrored; - } - else - { - bApplyNewPageMargins = false; - } - break; + m_bMirrored = bMirrored; + ExecutePageLayoutChange( m_bMirrored ); } - if ( bApplyNewPageMargins ) - { - mrPagePropPanel.StartUndo(); - mpMarginValueSet->SetNoSelection(); - mrPagePropPanel.ExecuteMarginLRChange( mnPageLeftMargin, mnPageRightMargin ); - mrPagePropPanel.ExecuteMarginULChange( mnPageTopMargin, mnPageBottomMargin ); - if ( mbMirrored != bMirrored ) - { - mbMirrored = bMirrored; - mrPagePropPanel.ExecutePageLayoutChange( mbMirrored ); - } - mrPagePropPanel.EndUndo(); + if ( xUndoManager.is() ) + xUndoManager->leaveUndoContext(); - mbCustomValuesUsed = false; - mrPagePropPanel.ClosePageMarginPopup(); - } - else - { - // back to initial selection - SelectValueSetItem(); - } + m_bCustomValuesUsed = false; + EndPopupMode(); + } +} + +void PageMarginControl::ExecuteMarginLRChange( + const long nPageLeftMargin, + const long nPageRightMargin ) +{ + if ( SfxViewFrame::Current() ) + { + std::unique_ptr pPageLRMarginItem( new SvxLongLRSpaceItem( 0, 0, SID_ATTR_PAGE_LRSPACE ) ); + pPageLRMarginItem->SetLeft( nPageLeftMargin ); + pPageLRMarginItem->SetRight( nPageRightMargin ); + SfxViewFrame::Current()->GetBindings().GetDispatcher()->ExecuteList( SID_ATTR_PAGE_LRSPACE, + SfxCallMode::RECORD, { pPageLRMarginItem.get() } ); + pPageLRMarginItem.reset(); + } +} + +void PageMarginControl::ExecuteMarginULChange( + const long nPageTopMargin, + const long nPageBottomMargin ) +{ + if ( SfxViewFrame::Current() ) + { + std::unique_ptr pPageULMarginItem( new SvxLongULSpaceItem( 0, 0, SID_ATTR_PAGE_ULSPACE ) ); + pPageULMarginItem->SetUpper( nPageTopMargin ); + pPageULMarginItem->SetLower( nPageBottomMargin ); + SfxViewFrame::Current()->GetBindings().GetDispatcher()->ExecuteList( SID_ATTR_PAGE_ULSPACE, + SfxCallMode::RECORD, { pPageULMarginItem.get() } ); + pPageULMarginItem.reset(); + } +} + +void PageMarginControl::ExecutePageLayoutChange( const bool bMirrored ) +{ + if ( SfxViewFrame::Current() ) + { + std::unique_ptr pPageItem( new SvxPageItem( SID_ATTR_PAGE ) ); + pPageItem->SetPageUsage( bMirrored ? SVX_PAGE_MIRROR : SVX_PAGE_ALL ); + SfxViewFrame::Current()->GetBindings().GetDispatcher()->ExecuteList( SID_ATTR_PAGE, + SfxCallMode::RECORD, { pPageItem.get() } ); + pPageItem.reset(); } } IMPL_LINK_NOARG_TYPED( PageMarginControl, ModifyLRMarginHdl, Edit&, void ) { - mpMarginValueSet->SetNoSelection(); - mpMarginValueSet->SelectItem(0); - mpMarginValueSet->SetFormat(); - mpMarginValueSet->Invalidate(); - mpMarginValueSet->StartSelection(); - - mnPageLeftMargin = GetCoreValue( *maLeftMarginEdit.get(), meUnit ); - mnPageRightMargin = GetCoreValue( *maRightMarginEdit.get(), meUnit ); - mrPagePropPanel.ExecuteMarginLRChange( mnPageLeftMargin, mnPageRightMargin ); - mbCustomValuesUsed = true; + m_nPageLeftMargin = GetCoreValue( *m_pLeftMarginEdit.get(), m_eUnit ); + m_nPageRightMargin = GetCoreValue( *m_pRightMarginEdit.get(), m_eUnit ); + ExecuteMarginLRChange( m_nPageLeftMargin, m_nPageRightMargin ); + SetMetricFieldMaxValues( m_aPageSize ); + m_bCustomValuesUsed = true; } IMPL_LINK_NOARG_TYPED( PageMarginControl, ModifyULMarginHdl, Edit&, void ) { - mpMarginValueSet->SetNoSelection(); - mpMarginValueSet->SelectItem(0); - mpMarginValueSet->SetFormat(); - mpMarginValueSet->Invalidate(); - mpMarginValueSet->StartSelection(); - - mnPageTopMargin = GetCoreValue( *maTopMarginEdit.get(), meUnit ); - mnPageBottomMargin = GetCoreValue( *maBottomMarginEdit.get(), meUnit ); - mrPagePropPanel.ExecuteMarginULChange( mnPageTopMargin, mnPageBottomMargin ); - mbCustomValuesUsed = true; + m_nPageTopMargin = GetCoreValue( *m_pTopMarginEdit.get(), m_eUnit ); + m_nPageBottomMargin = GetCoreValue( *m_pBottomMarginEdit.get(), m_eUnit ); + ExecuteMarginULChange( m_nPageTopMargin, m_nPageBottomMargin ); + SetMetricFieldMaxValues( m_aPageSize ); + m_bCustomValuesUsed = true; } bool PageMarginControl::GetUserCustomValues() @@ -439,7 +503,7 @@ bool PageMarginControl::GetUserCustomValues() if ( aSeq.getLength()) aSeq[0].Value >>= aTmp; OUString aWinData( aTmp ); - mnUserCustomPageLeftMargin = aWinData.toInt32(); + m_nUserCustomPageLeftMargin = aWinData.toInt32(); bUserCustomValuesAvailable = true; } @@ -451,7 +515,7 @@ bool PageMarginControl::GetUserCustomValues() if ( aSeq.getLength()) aSeq[0].Value >>= aTmp; OUString aWinData( aTmp ); - mnUserCustomPageRightMargin = aWinData.toInt32(); + m_nUserCustomPageRightMargin = aWinData.toInt32(); bUserCustomValuesAvailable = true; } @@ -460,10 +524,10 @@ bool PageMarginControl::GetUserCustomValues() { css::uno::Sequence < css::beans::NamedValue > aSeq = aWinOpt3.GetUserData(); OUString aTmp; - if ( aSeq.getLength()) + if ( aSeq.getLength() ) aSeq[0].Value >>= aTmp; OUString aWinData( aTmp ); - mnUserCustomPageTopMargin = aWinData.toInt32(); + m_nUserCustomPageTopMargin = aWinData.toInt32(); bUserCustomValuesAvailable = true; } @@ -475,7 +539,7 @@ bool PageMarginControl::GetUserCustomValues() if ( aSeq.getLength()) aSeq[0].Value >>= aTmp; OUString aWinData( aTmp ); - mnUserCustomPageBottomMargin = aWinData.toInt32(); + m_nUserCustomPageBottomMargin = aWinData.toInt32(); bUserCustomValuesAvailable = true; } @@ -487,7 +551,7 @@ bool PageMarginControl::GetUserCustomValues() if ( aSeq.getLength()) aSeq[0].Value >>= aTmp; OUString aWinData( aTmp ); - mbUserCustomMirrored = aWinData.toInt32() != 0; + m_bUserCustomMirrored = aWinData.toInt32() != 0; bUserCustomValuesAvailable = true; } @@ -496,36 +560,36 @@ bool PageMarginControl::GetUserCustomValues() void PageMarginControl::StoreUserCustomValues() { - if ( !mbCustomValuesUsed ) + if ( !m_bCustomValuesUsed ) { return; } - css::uno::Sequence < css::beans::NamedValue > aSeq(1); + css::uno::Sequence < css::beans::NamedValue > aSeq( 1 ); SvtViewOptions aWinOpt( E_WINDOW, SWPAGE_LEFT_GVALUE ); aSeq[0].Name = "mnPageLeftMargin"; - aSeq[0].Value <<= OUString::number( mnPageLeftMargin ); + aSeq[0].Value <<= OUString::number( m_nPageLeftMargin ); aWinOpt.SetUserData( aSeq ); SvtViewOptions aWinOpt2( E_WINDOW, SWPAGE_RIGHT_GVALUE ); aSeq[0].Name = "mnPageRightMargin"; - aSeq[0].Value <<= OUString::number( mnPageRightMargin ); + aSeq[0].Value <<= OUString::number( m_nPageRightMargin ); aWinOpt2.SetUserData( aSeq ); SvtViewOptions aWinOpt3( E_WINDOW, SWPAGE_TOP_GVALUE ); aSeq[0].Name = "mnPageTopMargin"; - aSeq[0].Value <<= OUString::number( mnPageTopMargin ); + aSeq[0].Value <<= OUString::number( m_nPageTopMargin ); aWinOpt3.SetUserData( aSeq ); SvtViewOptions aWinOpt4( E_WINDOW, SWPAGE_DOWN_GVALUE ); aSeq[0].Name = "mnPageBottomMargin"; - aSeq[0].Value <<= OUString::number( mnPageBottomMargin ); + aSeq[0].Value <<= OUString::number( m_nPageBottomMargin ); aWinOpt4.SetUserData( aSeq ); SvtViewOptions aWinOpt5( E_WINDOW, SWPAGE_MIRROR_GVALUE ); aSeq[0].Name = "mbMirrored"; - aSeq[0].Value <<= OUString::number( (mbMirrored ? 1 : 0) ); + aSeq[0].Value <<= OUString::number( (m_bMirrored ? 1 : 0) ); aWinOpt5.SetUserData( aSeq ); } diff --git a/sw/source/uibase/sidebar/PageMarginControl.hxx b/sw/source/uibase/sidebar/PageMarginControl.hxx index 1956d5d6d801..5336b14bf26f 100644 --- a/sw/source/uibase/sidebar/PageMarginControl.hxx +++ b/sw/source/uibase/sidebar/PageMarginControl.hxx @@ -29,6 +29,9 @@ #include #include #include +#include + +#include #define SWPAGE_NARROW_VALUE 720 #define SWPAGE_NORMAL_VALUE 1136 @@ -36,84 +39,78 @@ #define SWPAGE_WIDE_VALUE2 2880 #define SWPAGE_WIDE_VALUE3 1800 -namespace svx { namespace sidebar { - class ValueSetWithTextControl; -} } -class ValueSet; - static const long MINBODY = 284; //0.5 cm in twips namespace sw { namespace sidebar { class PagePropertyPanel; -class PageMarginControl - : public svx::sidebar::PopupControl +class PageMarginControl : public SfxPopupWindow { public: - PageMarginControl( - vcl::Window* pParent, - PagePropertyPanel& rPanel, - const SvxLongLRSpaceItem& aPageLRMargin, - const SvxLongULSpaceItem& aPageULMargin, - const bool bMirrored, - const Size& rPageSize, - const bool bLandscape, - const FieldUnit eFUnit, - const MapUnit eUnit ); + PageMarginControl( sal_uInt16 nId ); virtual ~PageMarginControl() override; virtual void dispose() override; private: - VclPtr< svx::sidebar::ValueSetWithTextControl> mpMarginValueSet; - - VclPtr maCustom; - VclPtr maLeft; - VclPtr maInner; - VclPtr maLeftMarginEdit; - VclPtr maRight; - VclPtr maOuter; - VclPtr maRightMarginEdit; - VclPtr maTop; - VclPtr maTopMarginEdit; - VclPtr maBottom; - VclPtr maBottomMarginEdit; + VclPtr m_pNarrow; + VclPtr m_pNormal; + VclPtr m_pWide; + VclPtr m_pMirrored; + VclPtr m_pLast; + + VclPtr m_pLeft; + VclPtr m_pRight; + VclPtr m_pInner; + VclPtr m_pOuter; + + VclPtr m_pContainer; + + VclPtr m_pLeftMarginEdit; + VclPtr m_pRightMarginEdit; + VclPtr m_pTopMarginEdit; + VclPtr m_pBottomMarginEdit; // hidden metric field - VclPtr maWidthHeightField; + VclPtr m_pWidthHeightField; - long mnPageLeftMargin; - long mnPageRightMargin; - long mnPageTopMargin; - long mnPageBottomMargin; - bool mbMirrored; + long m_nPageLeftMargin; + long m_nPageRightMargin; + long m_nPageTopMargin; + long m_nPageBottomMargin; + bool m_bMirrored; - const MapUnit meUnit; + const MapUnit m_eUnit; - bool mbUserCustomValuesAvailable; - long mnUserCustomPageLeftMargin; - long mnUserCustomPageRightMargin; - long mnUserCustomPageTopMargin; - long mnUserCustomPageBottomMargin; - bool mbUserCustomMirrored; + Size m_aPageSize; - bool mbCustomValuesUsed; + bool m_bUserCustomValuesAvailable; + long m_nUserCustomPageLeftMargin; + long m_nUserCustomPageRightMargin; + long m_nUserCustomPageTopMargin; + long m_nUserCustomPageBottomMargin; + bool m_bUserCustomMirrored; - PagePropertyPanel& mrPagePropPanel; + bool m_bCustomValuesUsed; - DECL_LINK_TYPED( ImplMarginHdl, ValueSet*, void ); + DECL_LINK_TYPED( SelectMarginHdl, Button*, void ); DECL_LINK_TYPED( ModifyLRMarginHdl, Edit&, void ); DECL_LINK_TYPED( ModifyULMarginHdl, Edit&, void ); + static void ExecuteMarginLRChange( + const long nPageLeftMargin, + const long nPageRightMargin ); + static void ExecuteMarginULChange( + const long nPageTopMargin, + const long nPageBottomMargin ); + static void ExecutePageLayoutChange( const bool bMirrored ); + void SetMetricFieldMaxValues(const Size& rPageSize); bool GetUserCustomValues(); void StoreUserCustomValues(); - void FillValueSet( - const bool bLandscape, - const bool bUserCustomValuesAvailable ); - void SelectValueSetItem(); + void FillHelpText( const bool bUserCustomValuesAvailable ); }; } } // end of namespace sw::sidebar diff --git a/sw/source/uibase/sidebar/PageMarginPopup.cxx b/sw/source/uibase/sidebar/PageMarginPopup.cxx new file mode 100644 index 000000000000..29bf80111bf7 --- /dev/null +++ b/sw/source/uibase/sidebar/PageMarginPopup.cxx @@ -0,0 +1,46 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include +#include "PageMarginControl.hxx" +#include +#include + +SFX_IMPL_TOOLBOX_CONTROL(PageMarginPopup, SfxVoidItem); + +PageMarginPopup::PageMarginPopup(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx) + : SfxToolBoxControl(nSlotId, nId, rTbx) +{ + rTbx.SetItemBits(nId, ToolBoxItemBits::DROPDOWNONLY | rTbx.GetItemBits(nId)); +} + +PageMarginPopup::~PageMarginPopup() +{ +} + +VclPtr PageMarginPopup::CreatePopupWindow() +{ + VclPtr pControl = VclPtr::Create(GetSlotId()); + pControl->StartPopupMode(&GetToolBox(), FloatWinPopupFlags::GrabFocus|FloatWinPopupFlags::NoAppFocusClose); + SetPopupWindow(pControl); + + return pControl; +} + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/sidebar/PagePropertyPanel.cxx b/sw/source/uibase/sidebar/PagePropertyPanel.cxx index 9094088b250e..a051a472d7c5 100644 --- a/sw/source/uibase/sidebar/PagePropertyPanel.cxx +++ b/sw/source/uibase/sidebar/PagePropertyPanel.cxx @@ -22,12 +22,8 @@ #include #include "PagePropertyPanel.hxx" -#include "PagePropertyPanel.hrc" - -#include "PropertyPanel.hrc" #include -#include "PageMarginControl.hxx" #include #include @@ -47,81 +43,15 @@ #include #include -#include - -const char UNO_MARGIN[] = ".uno:Margin"; - -namespace { - const css::uno::Reference< css::document::XUndoManager > getUndoManager( const css::uno::Reference< css::frame::XFrame >& rxFrame ) - { - const css::uno::Reference< css::frame::XController >& xController = rxFrame->getController(); - if ( xController.is() ) - { - const css::uno::Reference< css::frame::XModel >& xModel = xController->getModel(); - if ( xModel.is() ) - { - const css::uno::Reference< css::document::XUndoManagerSupplier > xSuppUndo( xModel, css::uno::UNO_QUERY_THROW ); - if ( xSuppUndo.is() ) - { - const css::uno::Reference< css::document::XUndoManager > xUndoManager( xSuppUndo->getUndoManager(), css::uno::UNO_QUERY_THROW ); - return xUndoManager; - } - } - } - - return css::uno::Reference< css::document::XUndoManager > (); - } -} namespace sw { namespace sidebar { PagePropertyPanel::PagePropertyPanel( vcl::Window* pParent, const css::uno::Reference< css::frame::XFrame>& rxFrame, - SfxBindings* pBindings) + SfxBindings* ) : PanelLayout(pParent, "PagePropertyPanel", "modules/swriter/ui/sidebarpage.ui", rxFrame) - , mpBindings(pBindings) - - // image resources - , maImgSize (nullptr) - , maImgSize_L (nullptr) - , mImgNarrow (SW_RES(IMG_PAGE_NARROW)) - , mImgNormal (SW_RES(IMG_PAGE_NORMAL)) - , mImgWide (SW_RES(IMG_PAGE_WIDE)) - , mImgMirrored (SW_RES(IMG_PAGE_MIRRORED)) - , mImgMarginCustom (SW_RES(IMG_PAGE_MARGIN_CUSTOM)) - , mImgNarrow_L (SW_RES(IMG_PAGE_NARROW_L)) - , mImgNormal_L (SW_RES(IMG_PAGE_NORMAL_L)) - , mImgWide_L (SW_RES(IMG_PAGE_WIDE_L)) - , mImgMirrored_L (SW_RES(IMG_PAGE_MIRRORED_L)) - , mImgMarginCustom_L (SW_RES(IMG_PAGE_MARGIN_CUSTOM_L)) - - , mpPageItem( new SvxPageItem(SID_ATTR_PAGE) ) - , mpPageLRMarginItem( new SvxLongLRSpaceItem( 0, 0, SID_ATTR_PAGE_LRSPACE ) ) - , mpPageULMarginItem( new SvxLongULSpaceItem( 0, 0, SID_ATTR_PAGE_ULSPACE ) ) - , mpPageSizeItem( new SvxSizeItem(SID_ATTR_PAGE_SIZE) ) - - , meFUnit() - , meUnit() - - , m_aSwPagePgULControl(SID_ATTR_PAGE_ULSPACE, *pBindings, *this) - , m_aSwPagePgLRControl(SID_ATTR_PAGE_LRSPACE, *pBindings, *this) - , m_aSwPagePgSizeControl(SID_ATTR_PAGE_SIZE, *pBindings, *this) - , m_aSwPagePgMetricControl(SID_ATTR_METRIC, *pBindings, *this) - - , maMarginPopup( this, - [this] (svx::sidebar::PopupContainer *parent) { return this->CreatePageMarginControl(parent); }, - OUString("Page margins") ) - - , mxUndoManager( getUndoManager( rxFrame ) ) - - , mbInvalidateSIDAttrPageOnSIDAttrPageSizeNotify( false ) { - // visible controls - get(mpToolBoxMargin, "selectmargin"); - - Initialize(); - mbInvalidateSIDAttrPageOnSIDAttrPageSizeNotify = true; } PagePropertyPanel::~PagePropertyPanel() @@ -131,238 +61,9 @@ PagePropertyPanel::~PagePropertyPanel() void PagePropertyPanel::dispose() { - delete[] maImgSize; - maImgSize = nullptr; - delete[] maImgSize_L; - maImgSize_L = nullptr; - - mpPageItem.reset(); - mpPageLRMarginItem.reset(); - mpPageULMarginItem.reset(); - mpPageSizeItem.reset(); - - mpToolBoxMargin.clear(); - - m_aSwPagePgULControl.dispose(); - m_aSwPagePgLRControl.dispose(); - m_aSwPagePgSizeControl.dispose(); - m_aSwPagePgMetricControl.dispose(); - - maMarginPopup.dispose(); - PanelLayout::dispose(); } -void PagePropertyPanel::Initialize() -{ - // popup for page margins - const sal_uInt16 nIdMargin = mpToolBoxMargin->GetItemId(UNO_MARGIN); - Link aLink = LINK( this, PagePropertyPanel, ClickMarginHdl ); - mpToolBoxMargin->SetDropdownClickHdl( aLink ); - mpToolBoxMargin->SetSelectHdl( aLink ); - mpToolBoxMargin->SetItemImage(nIdMargin, mImgNormal); - mpToolBoxMargin->SetItemBits( nIdMargin, mpToolBoxMargin->GetItemBits( nIdMargin ) | ToolBoxItemBits::DROPDOWNONLY ); - - meFUnit = GetModuleFieldUnit(); - meUnit = m_aSwPagePgSizeControl.GetCoreMetric(); - - // 'pull' for page style's attribute values - mpBindings->Update( SID_ATTR_PAGE_LRSPACE ); - mpBindings->Update( SID_ATTR_PAGE_ULSPACE ); - mpBindings->Update( SID_ATTR_PAGE ); - mpBindings->Update( SID_ATTR_PAGE_SIZE ); -} - -VclPtr< svx::sidebar::PopupControl> PagePropertyPanel::CreatePageMarginControl( svx::sidebar::PopupContainer* pParent ) -{ - return VclPtr::Create( - - pParent, - *this, - *mpPageLRMarginItem.get(), - *mpPageULMarginItem.get(), - mpPageItem->GetPageUsage() == SVX_PAGE_MIRROR, - mpPageSizeItem->GetSize(), - mpPageItem->IsLandscape(), - meFUnit, - meUnit ); -} - -void PagePropertyPanel::ExecuteMarginLRChange( - const long nPageLeftMargin, - const long nPageRightMargin ) -{ - mpPageLRMarginItem->SetLeft( nPageLeftMargin ); - mpPageLRMarginItem->SetRight( nPageRightMargin ); - GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_LRSPACE, - SfxCallMode::RECORD, { mpPageLRMarginItem.get() }); -} - -void PagePropertyPanel::ExecuteMarginULChange( - const long nPageTopMargin, - const long nPageBottomMargin ) -{ - mpPageULMarginItem->SetUpper( nPageTopMargin ); - mpPageULMarginItem->SetLower( nPageBottomMargin ); - GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_ULSPACE, - SfxCallMode::RECORD, { mpPageULMarginItem.get() }); -} - -void PagePropertyPanel::ExecutePageLayoutChange( const bool bMirrored ) -{ - mpPageItem->SetPageUsage( bMirrored ? SVX_PAGE_MIRROR : SVX_PAGE_ALL ); - GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_PAGE, - SfxCallMode::RECORD, { mpPageItem.get() }); -} - -IMPL_LINK_TYPED( PagePropertyPanel, ClickMarginHdl, ToolBox*, pToolBox, void ) -{ - maMarginPopup.Show( *pToolBox ); -} - -void PagePropertyPanel::ClosePageMarginPopup() -{ - maMarginPopup.Hide(); -} - -void PagePropertyPanel::NotifyItemUpdate( - const sal_uInt16 nSId, - const SfxItemState eState, - const SfxPoolItem* pState, - const bool bIsEnabled) -{ - (void)bIsEnabled; - - if (IsDisposed()) - return; - - switch( nSId ) - { - case SID_ATTR_PAGE_LRSPACE: - if ( eState >= SfxItemState::DEFAULT && - pState && dynamic_cast< const SvxLongLRSpaceItem *>( pState ) != nullptr ) - { - mpPageLRMarginItem.reset( static_cast(pState->Clone()) ); - ChangeMarginImage(); - } - break; - - case SID_ATTR_PAGE_ULSPACE: - if ( eState >= SfxItemState::DEFAULT && - pState && dynamic_cast< const SvxLongULSpaceItem *>( pState ) != nullptr ) - { - mpPageULMarginItem.reset( static_cast(pState->Clone()) ); - ChangeMarginImage(); - } - break; - - case SID_ATTR_PAGE_SIZE: - if ( mbInvalidateSIDAttrPageOnSIDAttrPageSizeNotify ) - { - mpBindings->Invalidate( SID_ATTR_PAGE, true ); - } - if ( eState >= SfxItemState::DEFAULT && - pState && dynamic_cast< const SvxSizeItem *>( pState ) != nullptr ) - { - mpPageSizeItem.reset( static_cast(pState->Clone()) ); - } - break; - case SID_ATTR_METRIC: - MetricState( eState, pState ); - break; - } -} - -void PagePropertyPanel::MetricState( SfxItemState eState, const SfxPoolItem* pState ) -{ - meFUnit = FUNIT_NONE; - if ( pState && eState >= SfxItemState::DEFAULT ) - { - meFUnit = (FieldUnit)static_cast(pState )->GetValue(); - } - else - { - SfxViewFrame* pFrame = SfxViewFrame::Current(); - SfxObjectShell* pSh = nullptr; - if ( pFrame ) - pSh = pFrame->GetObjectShell(); - if ( pSh ) - { - SfxModule* pModule = pSh->GetModule(); - if ( pModule ) - { - const SfxPoolItem* pItem = pModule->GetItem( SID_ATTR_METRIC ); - if ( pItem ) - meFUnit = (FieldUnit)static_cast(pItem )->GetValue(); - } - else - { - SAL_WARN("sw.ui", ": no module found"); - } - } - } -} - -void PagePropertyPanel::ChangeMarginImage() -{ - if ( mpPageLRMarginItem.get() == nullptr || - mpPageULMarginItem.get() == nullptr || - mpPageItem.get() == nullptr ) - { - return; - } - - const long cTolerance = 5; - const sal_uInt16 nIdMargin = mpToolBoxMargin->GetItemId(UNO_MARGIN); - - if( std::abs(mpPageLRMarginItem->GetLeft() - SWPAGE_NARROW_VALUE) <= cTolerance && - std::abs(mpPageLRMarginItem->GetRight() - SWPAGE_NARROW_VALUE) <= cTolerance && - std::abs(mpPageULMarginItem->GetUpper() - SWPAGE_NARROW_VALUE) <= cTolerance && - std::abs(mpPageULMarginItem->GetLower() - SWPAGE_NARROW_VALUE) <= cTolerance && - mpPageItem->GetPageUsage() != SVX_PAGE_MIRROR ) - mpToolBoxMargin->SetItemImage( nIdMargin, mpPageItem->IsLandscape() ? mImgNarrow_L : mImgNarrow ); - - else if( std::abs(mpPageLRMarginItem->GetLeft() - SWPAGE_NORMAL_VALUE) <= cTolerance && - std::abs(mpPageLRMarginItem->GetRight() - SWPAGE_NORMAL_VALUE) <= cTolerance && - std::abs(mpPageULMarginItem->GetUpper() - SWPAGE_NORMAL_VALUE) <= cTolerance && - std::abs(mpPageULMarginItem->GetLower() - SWPAGE_NORMAL_VALUE) <= cTolerance && - mpPageItem->GetPageUsage() != SVX_PAGE_MIRROR ) - mpToolBoxMargin->SetItemImage( nIdMargin, mpPageItem->IsLandscape() ? mImgNormal_L : mImgNormal ); - - else if( std::abs(mpPageLRMarginItem->GetLeft() - SWPAGE_WIDE_VALUE2) <= cTolerance && - std::abs(mpPageLRMarginItem->GetRight() - SWPAGE_WIDE_VALUE2) <= cTolerance && - std::abs(mpPageULMarginItem->GetUpper() - SWPAGE_WIDE_VALUE1) <= cTolerance && - std::abs(mpPageULMarginItem->GetLower() - SWPAGE_WIDE_VALUE1) <= cTolerance && - mpPageItem->GetPageUsage() != SVX_PAGE_MIRROR ) - mpToolBoxMargin->SetItemImage( nIdMargin, mpPageItem->IsLandscape() ? mImgWide_L : mImgWide ); - - else if( std::abs(mpPageLRMarginItem->GetLeft() - SWPAGE_WIDE_VALUE3) <= cTolerance && - std::abs(mpPageLRMarginItem->GetRight() - SWPAGE_WIDE_VALUE1) <= cTolerance && - std::abs(mpPageULMarginItem->GetUpper() - SWPAGE_WIDE_VALUE1) <= cTolerance && - std::abs(mpPageULMarginItem->GetLower() - SWPAGE_WIDE_VALUE1) <= cTolerance && - mpPageItem->GetPageUsage() == SVX_PAGE_MIRROR ) - mpToolBoxMargin->SetItemImage( nIdMargin, mpPageItem->IsLandscape() ? mImgMirrored_L : mImgMirrored ); - - else - mpToolBoxMargin->SetItemImage( nIdMargin, mpPageItem->IsLandscape() ? mImgMarginCustom_L : mImgMarginCustom ); -} - -void PagePropertyPanel::StartUndo() -{ - if ( mxUndoManager.is() ) - { - mxUndoManager->enterUndoContext( "" ); - } -} - -void PagePropertyPanel::EndUndo() -{ - if ( mxUndoManager.is() ) - { - mxUndoManager->leaveUndoContext(); - } -} - } } // end of namespace ::sw::sidebar /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/sidebar/PagePropertyPanel.hrc b/sw/source/uibase/sidebar/PagePropertyPanel.hrc deleted file mode 100644 index 7c87d7ef0e8b..000000000000 --- a/sw/source/uibase/sidebar/PagePropertyPanel.hrc +++ /dev/null @@ -1,106 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include -#include "PropertyPanel.hrc" - -// global definitions -#define IMG_PAGE_NARROW (RC_SIDEBAR_BEGIN + 2) -#define IMG_PAGE_NORMAL (RC_SIDEBAR_BEGIN + 3) -#define IMG_PAGE_WIDE (RC_SIDEBAR_BEGIN + 4) -#define IMG_PAGE_MIRRORED (RC_SIDEBAR_BEGIN + 5) -#define IMG_PAGE_MARGIN_CUSTOM (RC_SIDEBAR_BEGIN + 6) -#define IMG_PAGE_NARROW_L (RC_SIDEBAR_BEGIN + 7) -#define IMG_PAGE_NORMAL_L (RC_SIDEBAR_BEGIN + 8) -#define IMG_PAGE_WIDE_L (RC_SIDEBAR_BEGIN + 9) -#define IMG_PAGE_MIRRORED_L (RC_SIDEBAR_BEGIN + 10) -#define IMG_PAGE_MARGIN_CUSTOM_L (RC_SIDEBAR_BEGIN+ 11) - -// local - -#define MF_SWLEFT_MARGIN 18 -#define MF_SWRIGHT_MARGIN 19 -#define MF_SWTOP_MARGIN 20 -#define MF_SWBOTTOM_MARGIN 21 -#define VS_SIZE 23 -#define STR_LCVALUE 24 -#define FT_CUSTOM 25 -#define FLD_WIDTH_HEIGHT 26 - -#define IMG_NARROW 32 -#define IMG_NORMAL 33 -#define IMG_WIDE 34 -#define IMG_MIRRORED 35 -#define STR_NARROW 36 -#define STR_NORMAL 37 -#define STR_WIDE 38 -#define STR_MIRRORED 39 -#define VS_MARGIN 40 -#define IMG_CUSTOM 41 -#define FT_LEFT 42 -#define FT_RIGHT 43 -#define FT_TOP 44 -#define FT_BOTTOM 45 -#define FT_INNER 46 -#define FT_OUTER 47 -#define VS_COLUMN 49 -#define MBOX_WIDTH 50 - -#define IMG_NARROW_L 109 -#define IMG_NORMAL_L 110 -#define IMG_WIDE_L 111 -#define IMG_MIRRORED_L 112 - -#define IMG_CUSTOM_DIS 121 - -#define STR_MARGIN_TOOLTIP_LEFT 122 -#define STR_MARGIN_TOOLTIP_RIGHT 123 -#define STR_MARGIN_TOOLTIP_INNER 124 -#define STR_MARGIN_TOOLTIP_OUTER 125 -#define STR_MARGIN_TOOLTIP_TOP 126 -#define STR_MARGIN_TOOLTIP_BOT 127 - -#define POPUP_MARGIN 4 -#define VS_WIDTH 78 -#define ITEM_HEIGHT 17 -#define ITEM_HEIGHT2 15 - -// Position - -#define FT_CUSTOM_X POPUP_MARGIN + OFFSET_X -#define FT_CUSTOM_Y POPUPPANEL_MARGIN_SMALL * 2 + ITEM_HEIGHT * 5 - -#define POP_BORDER_X POPUP_MARGIN + OFFSET_X + 1 -#define POP_BORDER_Y POPUPPANEL_MARGIN_SMALL * 3 + ITEM_HEIGHT * 5 + TEXT_HEIGHT -#define BD_HEIGHT MBOX_HEIGHT*4 + CONTROL_SPACING_VERTICAL*5 - -#define FT_X POP_BORDER_X + CONTROL_SPACING_HORIZONTAL -#define MF_X FT_X + 25 + CONTROL_SPACING_HORIZONTAL -#define LEFT_MF_Y POP_BORDER_Y + CONTROL_SPACING_VERTICAL -#define RIGHT_MF_Y LEFT_MF_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL -#define TOP_MF_Y RIGHT_MF_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL -#define BOTTOM_MF_Y TOP_MF_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL -#define FT_LEFT_Y LEFT_MF_Y + 1 -#define FT_RIGHT_Y RIGHT_MF_Y + 1 -#define FT_TOP_Y TOP_MF_Y + 1 -#define FT_BOTTOM_Y BOTTOM_MF_Y + 1 - -#define MARGIN_PANEL_HEIGHT POP_BORDER_Y + BD_HEIGHT + POPUP_MARGIN + OFFSET_Y - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/sidebar/PagePropertyPanel.hxx b/sw/source/uibase/sidebar/PagePropertyPanel.hxx index a9bded236ef1..e3cd3e995c1f 100644 --- a/sw/source/uibase/sidebar/PagePropertyPanel.hxx +++ b/sw/source/uibase/sidebar/PagePropertyPanel.hxx @@ -49,35 +49,9 @@ namespace svx { namespace sidebar { namespace sw { namespace sidebar { - class PagePropertyPanel - : public PanelLayout, - public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface + class PagePropertyPanel : public PanelLayout { public: - // interface of ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface - virtual void NotifyItemUpdate( - const sal_uInt16 nSId, - const SfxItemState eState, - const SfxPoolItem* pState, - const bool bIsEnabled) override; - - SfxBindings* GetBindings() const - { - return mpBindings; - } - - VclPtr< svx::sidebar::PopupControl> CreatePageMarginControl( svx::sidebar::PopupContainer* pParent ); - void ExecuteMarginLRChange( - const long nPageLeftMargin, - const long nPageRightMargin ); - void ExecuteMarginULChange( - const long nPageTopMargin, - const long nPageBottomMargin ); - void ExecutePageLayoutChange( const bool bMirrored ); - void ClosePageMarginPopup(); - - void StartUndo(); - void EndUndo(); PagePropertyPanel( vcl::Window* pParent, @@ -86,66 +60,6 @@ namespace sw { namespace sidebar { private: virtual ~PagePropertyPanel() override; virtual void dispose() override; - - SfxBindings* mpBindings; - - // toolboxes - on click open corresponding popup - VclPtr mpToolBoxMargin; - - Image* maImgSize; - Image* maImgSize_L; - Image mImgNarrow; - Image mImgNormal; - Image mImgWide; - Image mImgMirrored; - Image mImgMarginCustom; - Image mImgNarrow_L; - Image mImgNormal_L; - Image mImgWide_L; - Image mImgMirrored_L; - Image mImgMarginCustom_L; - - // item keeping the following page style attributes: - // - page orientation - // - page usage - only left, only right, both, mirrored - // item also hold the numbering type for the page style which should - // be kept stable. - std::unique_ptr mpPageItem; - - // item keeping the page style's left and right margins - std::unique_ptr mpPageLRMarginItem; - // item keeping the page style's top and bottom margins - std::unique_ptr mpPageULMarginItem; - - // item keeping the page style's page size - std::unique_ptr mpPageSizeItem; - - FieldUnit meFUnit; - MapUnit meUnit; - - // controller items - ::sfx2::sidebar::ControllerItem m_aSwPagePgULControl; - ::sfx2::sidebar::ControllerItem m_aSwPagePgLRControl; - ::sfx2::sidebar::ControllerItem m_aSwPagePgSizeControl; - ::sfx2::sidebar::ControllerItem m_aSwPagePgMetricControl; - - // popups - svx::sidebar::Popup maMarginPopup; - - const css::uno::Reference< css::document::XUndoManager > mxUndoManager; - - bool mbInvalidateSIDAttrPageOnSIDAttrPageSizeNotify; - - // handler for popup toolboxes to show the popups - DECL_LINK_TYPED(ClickMarginHdl, ToolBox*, void); - - void Initialize(); - - void MetricState( SfxItemState eState, const SfxPoolItem* pState ); - - // helper to adjust popup toolbox' images - void ChangeMarginImage(); - }; } } // end of namespace ::sw::sidebar diff --git a/sw/source/uibase/sidebar/PageSizeControl.cxx b/sw/source/uibase/sidebar/PageSizeControl.cxx index eb0ee63ed3a9..29a2f0304814 100644 --- a/sw/source/uibase/sidebar/PageSizeControl.cxx +++ b/sw/source/uibase/sidebar/PageSizeControl.cxx @@ -19,7 +19,6 @@ #include "PageSizeControl.hxx" #include "PagePropertyPanel.hxx" -#include "PagePropertyPanel.hrc" #include #include @@ -34,6 +33,8 @@ #include #include +#include +#include namespace { diff --git a/sw/source/uibase/sidebar/PropertyPanel.hrc b/sw/source/uibase/sidebar/PropertyPanel.hrc index 5143a3dc7d10..c705574d2051 100644 --- a/sw/source/uibase/sidebar/PropertyPanel.hrc +++ b/sw/source/uibase/sidebar/PropertyPanel.hrc @@ -21,7 +21,12 @@ #include "rcid.hrc" -#define RID_POPUP_SWPAGE_MARGIN (RC_PROPERTYPANEL_BEGIN + 3) +#define STR_MARGIN_TOOLTIP_LEFT (RC_PROPERTYPANEL_BEGIN + 1) +#define STR_MARGIN_TOOLTIP_RIGHT (RC_PROPERTYPANEL_BEGIN + 2) +#define STR_MARGIN_TOOLTIP_INNER (RC_PROPERTYPANEL_BEGIN + 3) +#define STR_MARGIN_TOOLTIP_OUTER (RC_PROPERTYPANEL_BEGIN + 4) +#define STR_MARGIN_TOOLTIP_TOP (RC_PROPERTYPANEL_BEGIN + 5) +#define STR_MARGIN_TOOLTIP_BOT (RC_PROPERTYPANEL_BEGIN + 6) #endif diff --git a/sw/source/uibase/sidebar/WrapPropertyPanel.cxx b/sw/source/uibase/sidebar/WrapPropertyPanel.cxx index 63517d7a438d..8897123ea3dc 100644 --- a/sw/source/uibase/sidebar/WrapPropertyPanel.cxx +++ b/sw/source/uibase/sidebar/WrapPropertyPanel.cxx @@ -18,7 +18,6 @@ */ #include "WrapPropertyPanel.hxx" -#include "PropertyPanel.hrc" #include #include diff --git a/sw/uiconfig/swriter/ui/notebookbar.ui b/sw/uiconfig/swriter/ui/notebookbar.ui index 5209a50ad0c5..faeff25335ce 100644 --- a/sw/uiconfig/swriter/ui/notebookbar.ui +++ b/sw/uiconfig/swriter/ui/notebookbar.ui @@ -39,11 +39,6 @@ False cmd/lc_fontwork.png - - True - False - cmd/lc_formatcolumns.png - True False @@ -2806,18 +2801,18 @@ - + True False center False - + False True False True - .uno:PageColumnType + .uno:AttributePageSize True @@ -2833,18 +2828,18 @@ - + True False center False - + False True False True - .uno:AttributePageSize + .uno:PageColumnType True @@ -2880,18 +2875,6 @@ - - False - True - 4 - - - - - True - False - vertical - False True @@ -2899,15 +2882,25 @@ - + True - True - True - .uno:FormatColumns - FormatColumnsImg - none - top - True + False + center + False + + + False + True + False + True + .uno:PageMargin + True + + + False + True + + False diff --git a/sw/uiconfig/swriter/ui/pagemargincontrol.ui b/sw/uiconfig/swriter/ui/pagemargincontrol.ui new file mode 100644 index 000000000000..921d1cebb2bc --- /dev/null +++ b/sw/uiconfig/swriter/ui/pagemargincontrol.ui @@ -0,0 +1,442 @@ + + + + + + 9999 + 0.10000000000000001 + 10 + + + True + False + sw/res/sidebar/pageproppanel/format_L_copy_24x24.png + + + True + False + sw/res/sidebar/pageproppanel/formatcopy_24x24.png + + + True + False + sw/res/sidebar/pageproppanel/format_L_mirror_24x24.png + + + True + False + sw/res/sidebar/pageproppanel/formatmirror_24x24.png + + + True + False + sw/res/sidebar/pageproppanel/format_L_narrow_24x24.png + + + True + False + sw/res/sidebar/pageproppanel/formatnarrow_24x24.png + + + True + False + sw/res/sidebar/pageproppanel/format_L_nomal_24x24.png + + + True + False + sw/res/sidebar/pageproppanel/formatnormal_24x24.png + + + True + False + sw/res/sidebar/pageproppanel/format_L_wide_24x24.png + + + True + False + sw/res/sidebar/pageproppanel/formatwide_24x24.png + + + False + True + True + 4 + False + True + popup-menu + True + False + + + True + False + 6 + True + True + vertical + 6 + + + Narrow + True + True + narrowImg + none + 0 + + + False + True + 0 + + + + + Normal + True + True + normalImg + none + 0 + True + + + False + True + 1 + + + + + Wide + True + True + wideImg + none + 0 + + + False + True + 2 + + + + + Mirrored + True + True + mirrore + none + 0 + + + False + True + 3 + + + + + Last Custom Value + True + True + lastImg + none + 0 + + + False + True + 4 + + + + + Narrow + True + True + narrowLImg + none + 0 + + + False + True + 5 + + + + + Normal + True + True + normalLImg + none + 0 + True + + + False + True + 6 + + + + + Wide + True + True + wideLImg + none + 0 + + + False + True + 7 + + + + + Mirrored + True + True + mirroredLImg + none + 0 + + + False + True + 8 + + + + + Last Custom Value + True + True + lastLImg + none + 0 + + + False + True + 9 + + + + + True + False + 0 + none + + + True + False + 12 + + + True + False + 6 + 6 + + + True + False + _Top + True + 0 + + + 0 + 2 + + + + + True + False + _Bottom + True + 0 + + + 0 + 3 + + + + + True + False + + + True + False + _Left + True + 0 + + + False + True + 0 + + + + + True + False + I_nner + True + 0 + + + False + True + 1 + + + + + 0 + 0 + + + + + True + False + + + True + False + _Right + True + 0 + + + False + True + 0 + + + + + True + False + O_uter + True + 0 + + + False + True + 1 + + + + + 0 + 1 + + + + + True + True + True + 0,00 + adjustment1 + 2 + + + 1 + 0 + + + + + True + True + True + 0,00 + adjustment1 + 2 + + + 1 + 1 + + + + + True + True + True + 0,00 + adjustment1 + 2 + + + 1 + 2 + + + + + True + True + True + 0,00 + adjustment1 + 2 + + + 1 + 3 + + + + + + + + + True + False + Custom + + + + + False + True + 10 + + + + + True + False + vertical + + + + + + False + True + 11 + + + + + + diff --git a/sw/uiconfig/swriter/ui/sidebarpage.ui b/sw/uiconfig/swriter/ui/sidebarpage.ui index a9f889309ef2..fd8ca7d8d823 100644 --- a/sw/uiconfig/swriter/ui/sidebarpage.ui +++ b/sw/uiconfig/swriter/ui/sidebarpage.ui @@ -2,6 +2,7 @@ + True False @@ -54,7 +55,7 @@ False True Size - .uno:Size + .uno:AttributePageSize toolbutton3 True @@ -82,7 +83,7 @@ False True Columns - .uno:Column + .uno:PageColumnType toolbutton4 True @@ -109,7 +110,7 @@ False True Margin - .uno:Margin + .uno:PageMargin toolbutton2 True -- cgit