diff options
author | Szymon Kłos <eszkadev@gmail.com> | 2016-09-28 16:08:53 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2016-09-29 07:07:58 +0000 |
commit | 558faa307d87510c2d9d12b23c12f261c424f835 (patch) | |
tree | d2f264bb7a95d9af3c426a3a598536ca16ce7339 | |
parent | 2bebc1fc2e76f73d953ca1e1f64803fd4c42a62c (diff) |
Page margin popup converted to use outside sidebar
Change-Id: I3c4cc20fc8f2818677a77f848a1566bb56ceb7c6
Reviewed-on: https://gerrit.libreoffice.org/29363
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
29 files changed, 1010 insertions, 1107 deletions
diff --git a/icon-themes/breeze/sw/res/sidebar/pageproppanel/format_L_copy_24x24.png b/icon-themes/breeze/cmd/lc_pagemargin.png Binary files differindex 51ba15145acd..51ba15145acd 100644 --- a/icon-themes/breeze/sw/res/sidebar/pageproppanel/format_L_copy_24x24.png +++ b/icon-themes/breeze/cmd/lc_pagemargin.png 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 Binary files differdeleted file mode 100644 index b5cc8b36ff12..000000000000 --- a/icon-themes/breeze_dark/sw/res/sidebar/pageproppanel/format_L_copy_24x24.png +++ /dev/null diff --git a/icon-themes/elementary/sw/res/sidebar/pageproppanel/format_L_copy_24x24.png b/icon-themes/elementary/cmd/lc_pagemargin.png Binary files differindex 49625cdf1901..49625cdf1901 100644 --- a/icon-themes/elementary/sw/res/sidebar/pageproppanel/format_L_copy_24x24.png +++ b/icon-themes/elementary/cmd/lc_pagemargin.png diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/format_L_copy_24x24.png b/icon-themes/galaxy/cmd/lc_pagemargin.png Binary files differindex 49625cdf1901..49625cdf1901 100644 --- a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/format_L_copy_24x24.png +++ b/icon-themes/galaxy/cmd/lc_pagemargin.png diff --git a/icon-themes/sifr/cmd/lc_pagemargin.png b/icon-themes/sifr/cmd/lc_pagemargin.png Binary files differnew file mode 100644 index 000000000000..3c36f7c305de --- /dev/null +++ b/icon-themes/sifr/cmd/lc_pagemargin.png diff --git a/icon-themes/tango/sw/res/sidebar/pageproppanel/format_L_copy_24x24.png b/icon-themes/tango/cmd/lc_pagemargin.png Binary files differindex daae87cad35c..daae87cad35c 100644 --- a/icon-themes/tango/sw/res/sidebar/pageproppanel/format_L_copy_24x24.png +++ b/icon-themes/tango/cmd/lc_pagemargin.png 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 @@ <value>1</value> </prop> </node> + <node oor:name=".uno:PageMargin" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Page Margin</value> + </prop> + <prop oor:name="Properties" oor:type="xs:int"> + <value>1</value> + </prop> + </node> </node> </node> </oor:component-data> 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 <sfx2/tbxctrl.hxx> +#include <swdllapi.h> +#include <vcl/vclenum.hxx> +#include <functional> + +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<SfxPopupWindow> 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 <sfx2/sidebar/ResourceDefinitions.hrc> #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 <svx/rubydialog.hxx> #include <svtools/colorcfg.hxx> #include <PageSizePopup.hxx> +#include <PageMarginPopup.hxx> #include <PageOrientationPopup.hxx> #include <PageColumnPopup.hxx> @@ -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 <cmdid.h> #include <swtypes.hxx> 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 <svx/tbxctl.hxx> #include <vcl/button.hxx> +#include <svx/pageitem.hxx> +#include <editeng/sizeitem.hxx> +#include <svl/intitem.hxx> +#include <editeng/sizeitem.hxx> 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 <sfx2/dispatch.hxx> +#include <svx/svxids.hrc> +#include <svl/itempool.hxx> +#include <svl/intitem.hxx> #include <swtypes.hxx> +#include <cmdid.h> + +#include <com/sun/star/document/XUndoManagerSupplier.hpp> -#include <svx/sidebar/ValueSetWithTextControl.hxx> #include <vcl/settings.hxx> #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<const SfxUInt16Item*>( 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<svx::sidebar::ValueSetWithTextControl>::Create( svx::sidebar::ValueSetWithTextControl::ControlType::ImageText, this, SW_RES(VS_MARGIN) ) ) - , maCustom(VclPtr<FixedText>::Create(this, SW_RES(FT_CUSTOM))) - , maLeft(VclPtr<FixedText>::Create(this, SW_RES(FT_LEFT))) - , maInner(VclPtr<FixedText>::Create(this, SW_RES(FT_INNER))) - , maLeftMarginEdit(VclPtr<MetricField>::Create(this, SW_RES(MF_SWLEFT_MARGIN))) - , maRight(VclPtr<FixedText>::Create(this, SW_RES(FT_RIGHT))) - , maOuter(VclPtr<FixedText>::Create(this, SW_RES(FT_OUTER))) - , maRightMarginEdit(VclPtr<MetricField>::Create(this, SW_RES(MF_SWRIGHT_MARGIN))) - , maTop(VclPtr<FixedText>::Create(this, SW_RES(FT_TOP))) - , maTopMarginEdit(VclPtr<MetricField>::Create(this, SW_RES(MF_SWTOP_MARGIN))) - , maBottom(VclPtr<FixedText>::Create(this, SW_RES(FT_BOTTOM))) - , maBottomMarginEdit(VclPtr<MetricField>::Create(this, SW_RES(MF_SWBOTTOM_MARGIN))) - , maWidthHeightField(VclPtr<MetricField>::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<const SvxPageItem*>( pItem )->IsLandscape(); + m_bMirrored = static_cast<const SvxPageItem*>( pItem )->GetPageUsage() == SVX_PAGE_MIRROR; + SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState( SID_ATTR_PAGE_SIZE, pItem ); + pSize = static_cast<const SvxSizeItem*>( pItem ); + SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState( SID_ATTR_PAGE_LRSPACE, pItem ); + pLRItem = static_cast<const SvxLongLRSpaceItem*>( pItem ); + SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState( SID_ATTR_PAGE_ULSPACE, pItem ); + pULItem = static_cast<const SvxLongULSpaceItem*>( 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<MetricField>::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<Edit&,void> 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<Edit&,void> 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<SvxLongLRSpaceItem> 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<SvxLongULSpaceItem> 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<SvxPageItem> 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 <vcl/field.hxx> #include <svtools/unitconv.hxx> #include <vector> +#include <vcl/layout.hxx> + +#include <svx/tbxctl.hxx> #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<FixedText> maCustom; - VclPtr<FixedText> maLeft; - VclPtr<FixedText> maInner; - VclPtr<MetricField> maLeftMarginEdit; - VclPtr<FixedText> maRight; - VclPtr<FixedText> maOuter; - VclPtr<MetricField> maRightMarginEdit; - VclPtr<FixedText> maTop; - VclPtr<MetricField> maTopMarginEdit; - VclPtr<FixedText> maBottom; - VclPtr<MetricField> maBottomMarginEdit; + VclPtr<PushButton> m_pNarrow; + VclPtr<PushButton> m_pNormal; + VclPtr<PushButton> m_pWide; + VclPtr<PushButton> m_pMirrored; + VclPtr<PushButton> m_pLast; + + VclPtr<FixedText> m_pLeft; + VclPtr<FixedText> m_pRight; + VclPtr<FixedText> m_pInner; + VclPtr<FixedText> m_pOuter; + + VclPtr<VclVBox> m_pContainer; + + VclPtr<MetricField> m_pLeftMarginEdit; + VclPtr<MetricField> m_pRightMarginEdit; + VclPtr<MetricField> m_pTopMarginEdit; + VclPtr<MetricField> m_pBottomMarginEdit; // hidden metric field - VclPtr<MetricField> maWidthHeightField; + VclPtr<MetricField> 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 <PageMarginPopup.hxx> +#include "PageMarginControl.hxx" +#include <svx/pageitem.hxx> +#include <vcl/toolbox.hxx> + +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<SfxPopupWindow> PageMarginPopup::CreatePopupWindow() +{ + VclPtr<sw::sidebar::PageMarginControl> pControl = VclPtr<sw::sidebar::PageMarginControl>::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 <cstdlib> #include "PagePropertyPanel.hxx" -#include "PagePropertyPanel.hrc" - -#include "PropertyPanel.hrc" #include <svx/sidebar/PopupContainer.hxx> -#include "PageMarginControl.hxx" #include <swtypes.hxx> #include <cmdid.h> @@ -47,81 +43,15 @@ #include <com/sun/star/frame/XController.hpp> #include <com/sun/star/frame/XModel.hpp> -#include <com/sun/star/document/XUndoManagerSupplier.hpp> - -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<ToolBox *, void> 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<PageMarginControl>::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<SvxLongLRSpaceItem*>(pState->Clone()) ); - ChangeMarginImage(); - } - break; - - case SID_ATTR_PAGE_ULSPACE: - if ( eState >= SfxItemState::DEFAULT && - pState && dynamic_cast< const SvxLongULSpaceItem *>( pState ) != nullptr ) - { - mpPageULMarginItem.reset( static_cast<SvxLongULSpaceItem*>(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<SvxSizeItem*>(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<const SfxUInt16Item*>(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<const SfxUInt16Item*>(pItem )->GetValue(); - } - else - { - SAL_WARN("sw.ui", "<PagePropertyPanel::MetricState(..)>: 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 <rcid.hrc> -#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<ToolBox> 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<SvxPageItem> mpPageItem; - - // item keeping the page style's left and right margins - std::unique_ptr<SvxLongLRSpaceItem> mpPageLRMarginItem; - // item keeping the page style's top and bottom margins - std::unique_ptr<SvxLongULSpaceItem> mpPageULMarginItem; - - // item keeping the page style's page size - std::unique_ptr<SvxSizeItem> 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 <cmdid.h> #include <swtypes.hxx> @@ -34,6 +33,8 @@ #include <vcl/settings.hxx> #include <svl/itempool.hxx> +#include <svl/intitem.hxx> +#include <editeng/sizeitem.hxx> 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 <cmdid.h> #include <swtypes.hxx> 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 @@ <property name="can_focus">False</property> <property name="pixbuf">cmd/lc_fontwork.png</property> </object> - <object class="GtkImage" id="FormatColumnsImg"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="pixbuf">cmd/lc_formatcolumns.png</property> - </object> <object class="GtkImage" id="GalleryImg"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -2806,18 +2801,18 @@ </packing> </child> <child> - <object class="sfxlo-BigToolBox" id="columnbox"> + <object class="sfxlo-BigToolBox" id="sizebox"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="valign">center</property> <property name="show_arrow">False</property> <child> - <object class="GtkMenuToolButton" id="Columns"> + <object class="GtkMenuToolButton" id="Size"> <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">False</property> <property name="is_important">True</property> - <property name="action_name">.uno:PageColumnType</property> + <property name="action_name">.uno:AttributePageSize</property> <property name="use_underline">True</property> </object> <packing> @@ -2833,18 +2828,18 @@ </packing> </child> <child> - <object class="sfxlo-BigToolBox" id="sizebox"> + <object class="sfxlo-BigToolBox" id="columnbox"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="valign">center</property> <property name="show_arrow">False</property> <child> - <object class="GtkMenuToolButton" id="Size"> + <object class="GtkMenuToolButton" id="Columns"> <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">False</property> <property name="is_important">True</property> - <property name="action_name">.uno:AttributePageSize</property> + <property name="action_name">.uno:PageColumnType</property> <property name="use_underline">True</property> </object> <packing> @@ -2883,31 +2878,29 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">4</property> - </packing> - </child> - <child> - <object class="GtkSeparator" id="separator21"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="orientation">vertical</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> <property name="position">5</property> </packing> </child> <child> - <object class="vcllo-SmallButton" id="FormatColumns"> + <object class="sfxlo-BigToolBox" id="marginbox"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="action_name">.uno:FormatColumns</property> - <property name="image">FormatColumnsImg</property> - <property name="relief">none</property> - <property name="image_position">top</property> - <property name="always_show_image">True</property> + <property name="can_focus">False</property> + <property name="valign">center</property> + <property name="show_arrow">False</property> + <child> + <object class="GtkMenuToolButton" id="Margin"> + <property name="use_action_appearance">False</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="is_important">True</property> + <property name="action_name">.uno:PageMargin</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> </object> <packing> <property name="expand">False</property> 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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.18.3 --> +<interface> + <requires lib="gtk+" version="3.10"/> + <object class="GtkAdjustment" id="adjustment1"> + <property name="upper">9999</property> + <property name="step_increment">0.10000000000000001</property> + <property name="page_increment">10</property> + </object> + <object class="GtkImage" id="lastImg"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="pixbuf">sw/res/sidebar/pageproppanel/format_L_copy_24x24.png</property> + </object> + <object class="GtkImage" id="lastLImg"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="pixbuf">sw/res/sidebar/pageproppanel/formatcopy_24x24.png</property> + </object> + <object class="GtkImage" id="mirrore"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="pixbuf">sw/res/sidebar/pageproppanel/format_L_mirror_24x24.png</property> + </object> + <object class="GtkImage" id="mirroredLImg"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="pixbuf">sw/res/sidebar/pageproppanel/formatmirror_24x24.png</property> + </object> + <object class="GtkImage" id="narrowImg"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="pixbuf">sw/res/sidebar/pageproppanel/format_L_narrow_24x24.png</property> + </object> + <object class="GtkImage" id="narrowLImg"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="pixbuf">sw/res/sidebar/pageproppanel/formatnarrow_24x24.png</property> + </object> + <object class="GtkImage" id="normalImg"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="pixbuf">sw/res/sidebar/pageproppanel/format_L_nomal_24x24.png</property> + </object> + <object class="GtkImage" id="normalLImg"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="pixbuf">sw/res/sidebar/pageproppanel/formatnormal_24x24.png</property> + </object> + <object class="GtkImage" id="wideImg"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="pixbuf">sw/res/sidebar/pageproppanel/format_L_wide_24x24.png</property> + </object> + <object class="GtkImage" id="wideLImg"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="pixbuf">sw/res/sidebar/pageproppanel/formatwide_24x24.png</property> + </object> + <object class="GtkWindow" id="PageMarginControl"> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="border_width">4</property> + <property name="resizable">False</property> + <property name="destroy_with_parent">True</property> + <property name="type_hint">popup-menu</property> + <property name="skip_pager_hint">True</property> + <property name="deletable">False</property> + <child> + <object class="GtkBox" id="box"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="margin_right">6</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> + <child> + <object class="GtkButton" id="narrow"> + <property name="label" translatable="yes">Narrow</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="image">narrowImg</property> + <property name="relief">none</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="normal"> + <property name="label" translatable="yes">Normal</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="image">normalImg</property> + <property name="relief">none</property> + <property name="xalign">0</property> + <property name="always_show_image">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="wide"> + <property name="label" translatable="yes">Wide</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="image">wideImg</property> + <property name="relief">none</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkButton" id="mirrored"> + <property name="label" translatable="yes">Mirrored</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="image">mirrore</property> + <property name="relief">none</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> + <child> + <object class="GtkButton" id="last"> + <property name="label" translatable="yes">Last Custom Value</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="image">lastImg</property> + <property name="relief">none</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">4</property> + </packing> + </child> + <child> + <object class="GtkButton" id="narrowL"> + <property name="label" translatable="yes">Narrow</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="image">narrowLImg</property> + <property name="relief">none</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">5</property> + </packing> + </child> + <child> + <object class="GtkButton" id="normalL"> + <property name="label" translatable="yes">Normal</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="image">normalLImg</property> + <property name="relief">none</property> + <property name="xalign">0</property> + <property name="always_show_image">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">6</property> + </packing> + </child> + <child> + <object class="GtkButton" id="wideL"> + <property name="label" translatable="yes">Wide</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="image">wideLImg</property> + <property name="relief">none</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">7</property> + </packing> + </child> + <child> + <object class="GtkButton" id="mirroredL"> + <property name="label" translatable="yes">Mirrored</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="image">mirroredLImg</property> + <property name="relief">none</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">8</property> + </packing> + </child> + <child> + <object class="GtkButton" id="lastL"> + <property name="label" translatable="yes">Last Custom Value</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="image">lastLImg</property> + <property name="relief">none</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">9</property> + </packing> + </child> + <child> + <object class="GtkFrame" id="frame1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="left_padding">12</property> + <child> + <object class="GtkGrid" id="grid1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="row_spacing">6</property> + <property name="column_spacing">6</property> + <child> + <object class="GtkLabel" id="label4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">_Top</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">2</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label5"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">_Bottom</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">3</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkLabel" id="leftLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">_Left</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="innerLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">I_nner</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkLabel" id="rightLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">_Right</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="outerLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">O_uter</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="left:0cm"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="text" translatable="yes">0,00</property> + <property name="adjustment">adjustment1</property> + <property name="digits">2</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="right:0cm"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="text" translatable="yes">0,00</property> + <property name="adjustment">adjustment1</property> + <property name="digits">2</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="top:0cm"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="text" translatable="yes">0,00</property> + <property name="adjustment">adjustment1</property> + <property name="digits">2</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">2</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="bottom:0cm"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="text" translatable="yes">0,00</property> + <property name="adjustment">adjustment1</property> + <property name="digits">2</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">3</property> + </packing> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Custom</property> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">10</property> + </packing> + </child> + <child> + <object class="GtkBox" id="container"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">11</property> + </packing> + </child> + </object> + </child> + </object> +</interface> 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 @@ <!-- Generated with glade 3.18.3 --> <interface> <requires lib="gtk+" version="3.0"/> + <requires lib="LibreOffice" version="1.0"/> <object class="GtkGrid" id="PagePropertyPanel"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -54,7 +55,7 @@ <property name="can_focus">False</property> <property name="has_tooltip">True</property> <property name="tooltip_text" translatable="yes">Size</property> - <property name="action_name">.uno:Size</property> + <property name="action_name">.uno:AttributePageSize</property> <property name="label">toolbutton3</property> <property name="use_underline">True</property> </object> @@ -82,7 +83,7 @@ <property name="can_focus">False</property> <property name="has_tooltip">True</property> <property name="tooltip_text" translatable="yes">Columns</property> - <property name="action_name">.uno:Column</property> + <property name="action_name">.uno:PageColumnType</property> <property name="label">toolbutton4</property> <property name="use_underline">True</property> </object> @@ -109,7 +110,7 @@ <property name="can_focus">False</property> <property name="has_tooltip">True</property> <property name="tooltip_text" translatable="yes">Margin</property> - <property name="action_name">.uno:Margin</property> + <property name="action_name">.uno:PageMargin</property> <property name="label">toolbutton2</property> <property name="use_underline">True</property> </object> |