diff options
19 files changed, 446 insertions, 319 deletions
diff --git a/icon-themes/breeze/sw/res/sidebar/pageproppanel/column_L_copy_24x24.png b/icon-themes/breeze/cmd/lc_pagecolumntype.png Binary files differindex 28c5809f7cf4..28c5809f7cf4 100644 --- a/icon-themes/breeze/sw/res/sidebar/pageproppanel/column_L_copy_24x24.png +++ b/icon-themes/breeze/cmd/lc_pagecolumntype.png diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/column_L_copy_24x24.png b/icon-themes/galaxy/cmd/lc_pagecolumntype.png Binary files differindex 49625cdf1901..49625cdf1901 100644 --- a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/column_L_copy_24x24.png +++ b/icon-themes/galaxy/cmd/lc_pagecolumntype.png diff --git a/icon-themes/sifr/sw/res/sidebar/pageproppanel/column_L_copy_24x24.png b/icon-themes/sifr/cmd/lc_pagecolumntype.png Binary files differindex f3073bdb83c7..f3073bdb83c7 100644 --- a/icon-themes/sifr/sw/res/sidebar/pageproppanel/column_L_copy_24x24.png +++ b/icon-themes/sifr/cmd/lc_pagecolumntype.png diff --git a/icon-themes/tango/sw/res/sidebar/pageproppanel/column_L_copy_24x24.png b/icon-themes/tango/cmd/lc_pagecolumntype.png Binary files differindex 66b1b674fc37..66b1b674fc37 100644 --- a/icon-themes/tango/sw/res/sidebar/pageproppanel/column_L_copy_24x24.png +++ b/icon-themes/tango/cmd/lc_pagecolumntype.png diff --git a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu index a8072e8c3a63..6986e60fb706 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu @@ -1051,6 +1051,9 @@ <prop oor:name="Label" oor:type="xs:string"> <value xml:lang="en-US">Page Column Type</value> </prop> + <prop oor:name="Properties" oor:type="xs:int"> + <value>1</value> + </prop> </node> <node oor:name=".uno:BackgroundDialog" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk index 7288a85d6292..793c3ff2939a 100644 --- a/sw/Library_sw.mk +++ b/sw/Library_sw.mk @@ -681,6 +681,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\ sw/source/uibase/sidebar/PageMarginControl \ sw/source/uibase/sidebar/PageSizeControl \ sw/source/uibase/sidebar/PageColumnControl \ + sw/source/uibase/sidebar/PageColumnPopup \ sw/source/uibase/sidebar/PagePropertyPanel \ sw/source/uibase/sidebar/PageFormatPanel \ sw/source/uibase/sidebar/PageHeaderPanel \ diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk index b91c4ddc57e9..0047dc3acbaf 100644 --- a/sw/UIConfig_swriter.mk +++ b/sw/UIConfig_swriter.mk @@ -207,6 +207,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\ sw/uiconfig/swriter/ui/notebookbar \ sw/uiconfig/swriter/ui/notebookbar_groups \ sw/uiconfig/swriter/ui/notebookbar_single \ + sw/uiconfig/swriter/ui/pagecolumncontrol \ sw/uiconfig/swriter/ui/pageorientationcontrol \ sw/uiconfig/swriter/ui/paradialog \ sw/uiconfig/swriter/ui/picturedialog \ diff --git a/sw/inc/PageColumnPopup.hxx b/sw/inc/PageColumnPopup.hxx new file mode 100644 index 000000000000..941c33c852f3 --- /dev/null +++ b/sw/inc/PageColumnPopup.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_PAGECOLUMNPOPUP_HXX +#define INCLUDED_SW_INC_PAGECOLUMNPOPUP_HXX + +#include <sfx2/tbxctrl.hxx> +#include <swdllapi.h> +#include <vcl/vclenum.hxx> +#include <functional> + +class SW_DLLPUBLIC PageColumnPopup : public SfxToolBoxControl +{ +public: + SFX_DECL_TOOLBOX_CONTROL(); + + PageColumnPopup(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx); + virtual ~PageColumnPopup(); + + virtual VclPtr<SfxPopupWindow> CreatePopupWindow() override; +}; + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/sidebar/PagePropertyPanel.src b/sw/source/ui/sidebar/PagePropertyPanel.src index 785861dd758d..901bc608c93b 100644 --- a/sw/source/ui/sidebar/PagePropertyPanel.src +++ b/sw/source/ui/sidebar/PagePropertyPanel.src @@ -154,10 +154,6 @@ Image IMG_PAGE_COLUMN_RIGHT { ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column_L_right_24x24.png";}; }; -Image IMG_PAGE_COLUMN_NONE -{ - ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column_L_copy_24x24.png";}; -}; Image IMG_PAGE_COLUMN_1_L { ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column1_24x24.png";}; @@ -439,91 +435,4 @@ Control RID_POPUP_SWPAGE_SIZE }; }; -// popup for page style's column attribute -Control RID_POPUP_SWPAGE_COLUMN -{ - OutputSize = TRUE; - DialogControl = TRUE; - Border = FALSE; - Size = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL * 2 + POPUP_BORDER_WIDTH + VS_WIDTH - 15, ITEM_HEIGHT*5 + POPUPPANEL_MARGIN_SMALL*2 + CONTROL_SPACING_VERTICAL + 15 ); - - Control VS_COLUMN - { - Pos = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL + OFFSET_X, POPUPPANEL_MARGIN_SMALL + OFFSET_Y); - Size = MAP_APPFONT ( VS_WIDTH -15 , ITEM_HEIGHT*5); - HelpID = HID_SWPAGE_VS_COLUMN; - TabStop = TRUE ; - Text = "Column"; - }; - PushButton CB_COLUMN_MORE - { - Pos = MAP_APPFONT ( POPUPPANEL_MARGIN_SMALL + 2*OFFSET_X, POPUPPANEL_MARGIN_SMALL + 2*OFFSET_Y + ITEM_HEIGHT*5 ) ; - Size = MAP_APPFONT ( VS_WIDTH - 2 - 15, 15 ) ; - HelpID = HID_SWPAGE_COLUMN_MORE; - TabStop = TRUE ; - Text [ en-US ] = "~More Options"; - QuickHelpText [ en-US ] = "More Options" ; - }; - Image IMG_ONE - { - ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column_L_1_24x24.png";}; - }; - Image IMG_TWO - { - ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column_L_2_24x24.png";}; - }; - Image IMG_THREE - { - ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column_L_3_24x24.png";}; - }; - Image IMG_LEFT - { - ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column_L_left_24x24.png";}; - }; - Image IMG_RIGHT - { - ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column_L_right_24x24.png";}; - }; - Image IMG_ONE_L - { - ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column1_24x24.png";}; - }; - Image IMG_TWO_L - { - ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column2_24x24.png";}; - }; - Image IMG_THREE_L - { - ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column3_24x24.png";}; - }; - Image IMG_LEFT_L - { - ImageBitmap = Bitmap{File = "sidebar/pageproppanel/columnleft_24x24.png";}; - }; - Image IMG_RIGHT_L - { - ImageBitmap = Bitmap{File = "sidebar/pageproppanel/columnright_24x24.png";}; - }; - String STR_ONE - { - Text [ en-US ] = "1 Column"; - }; - String STR_TWO - { - Text [ en-US ] = "2 Columns"; - }; - String STR_THREE - { - Text [ en-US ] = "3 Columns"; - }; - String STR_LEFT - { - Text [ en-US ] = "Left"; - }; - String STR_RIGHT - { - Text [ en-US ] = "Right"; - }; -}; - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx index e41b621ddd79..45be91e3c40e 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 <PageOrientationPopup.hxx> +#include <PageColumnPopup.hxx> #include <unotools/configmgr.hxx> #include <unotools/moduleoptions.hxx> @@ -293,6 +294,7 @@ void SwDLL::RegisterControls() svx::ParaULSpacingControl::RegisterControl(SID_ATTR_PARA_ULSPACE, pMod); svx::ParaLRSpacingControl::RegisterControl(SID_ATTR_PARA_LRSPACE, pMod); PageOrientationPopup::RegisterControl(SID_ATTR_PAGE_ORIENTATION, pMod); + PageColumnPopup::RegisterControl(SID_ATTR_PAGE_COLUMN, pMod); SvxColorToolBoxControl::RegisterControl( SID_EXTRUSION_3D_COLOR, pMod ); diff --git a/sw/source/uibase/sidebar/PageColumnControl.cxx b/sw/source/uibase/sidebar/PageColumnControl.cxx index 8d2697993bc4..04d24c43160a 100644 --- a/sw/source/uibase/sidebar/PageColumnControl.cxx +++ b/sw/source/uibase/sidebar/PageColumnControl.cxx @@ -28,52 +28,54 @@ #include <sfx2/bindings.hxx> #include <sfx2/dispatch.hxx> #include <vcl/settings.hxx> +#include <svx/svxids.hrc> namespace sw { namespace sidebar { -PageColumnControl::PageColumnControl( - vcl::Window* pParent, - PagePropertyPanel& rPanel, - const sal_uInt16 nColumnType, - const bool bLandscape ) - : svx::sidebar::PopupControl( pParent, SW_RES(RID_POPUP_SWPAGE_COLUMN) ) - , mpColumnValueSet( VclPtr<svx::sidebar::ValueSetWithTextControl>::Create( svx::sidebar::ValueSetWithTextControl::ControlType::ImageText, this, SW_RES(VS_COLUMN) ) ) - , maMoreButton( VclPtr<PushButton>::Create( this, SW_RES(CB_COLUMN_MORE) ) ) - , mnColumnType( nColumnType ) - , mrPagePropPanel(rPanel) +PageColumnControl::PageColumnControl( sal_uInt16 nId ) + : SfxPopupWindow( nId, "PageColumnControl", "modules/swriter/ui/pagecolumncontrol.ui" ) { - mpColumnValueSet->SetStyle( mpColumnValueSet->GetStyle() | WB_3DLOOK | WB_NO_DIRECTSELECT ); - mpColumnValueSet->SetColor(GetSettings().GetStyleSettings().GetMenuColor()); + get( m_pMoreButton, "moreoptions" ); + + bool bLandscape = false; + const SfxPoolItem *pItem; + if ( SfxViewFrame::Current() ) + { + SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState( SID_ATTR_PAGE, pItem ); + bLandscape = static_cast<const SvxPageItem*>(pItem)->IsLandscape(); + } if ( bLandscape ) { - mpColumnValueSet->AddItem(Image(SW_RES(IMG_ONE_L)), nullptr, SW_RES(STR_ONE), nullptr ); - mpColumnValueSet->AddItem(Image(SW_RES(IMG_TWO_L)), nullptr, SW_RES(STR_TWO), nullptr ); - mpColumnValueSet->AddItem(Image(SW_RES(IMG_THREE_L)), nullptr, SW_RES(STR_THREE), nullptr ); - mpColumnValueSet->AddItem(Image(SW_RES(IMG_LEFT_L)), nullptr, SW_RES(STR_LEFT), nullptr ); - mpColumnValueSet->AddItem(Image(SW_RES(IMG_RIGHT_L)), nullptr, SW_RES(STR_RIGHT), nullptr ); + get(m_pOneColumn, "column1L"); + get(m_pTwoColumns, "column2L"); + get(m_pThreeColumns, "column3L"); + get(m_pLeft, "columnleftL"); + get(m_pRight, "columnrightL"); } else { - mpColumnValueSet->AddItem(Image(SW_RES(IMG_ONE)), nullptr, SW_RES(STR_ONE), nullptr ); - mpColumnValueSet->AddItem(Image(SW_RES(IMG_TWO)), nullptr, SW_RES(STR_TWO), nullptr ); - mpColumnValueSet->AddItem(Image(SW_RES(IMG_THREE)), nullptr, SW_RES(STR_THREE), nullptr ); - mpColumnValueSet->AddItem(Image(SW_RES(IMG_LEFT)), nullptr, SW_RES(STR_LEFT), nullptr ); - mpColumnValueSet->AddItem(Image(SW_RES(IMG_RIGHT)), nullptr, SW_RES(STR_RIGHT), nullptr ); + get(m_pOneColumn, "column1"); + get(m_pTwoColumns, "column2"); + get(m_pThreeColumns, "column3"); + get(m_pLeft, "columnleft"); + get(m_pRight, "columnright"); } - mpColumnValueSet->SetNoSelection(); - mpColumnValueSet->SetSelectHdl( LINK(this, PageColumnControl,ImplColumnHdl ) ); - mpColumnValueSet->Show(); - mpColumnValueSet->SelectItem( mnColumnType ); - mpColumnValueSet->SetFormat(); - mpColumnValueSet->Invalidate(); - mpColumnValueSet->StartSelection(); + m_pOneColumn->Show(); + m_pTwoColumns->Show(); + m_pThreeColumns->Show(); + m_pLeft->Show(); + m_pRight->Show(); - maMoreButton->SetClickHdl( LINK( this, PageColumnControl, MoreButtonClickHdl_Impl ) ); - maMoreButton->GrabFocus(); + m_pOneColumn->SetClickHdl( LINK( this, PageColumnControl, ColumnButtonClickHdl_Impl ) ); + m_pTwoColumns->SetClickHdl( LINK( this, PageColumnControl, ColumnButtonClickHdl_Impl ) ); + m_pThreeColumns->SetClickHdl( LINK( this, PageColumnControl, ColumnButtonClickHdl_Impl ) ); + m_pLeft->SetClickHdl( LINK( this, PageColumnControl, ColumnButtonClickHdl_Impl ) ); + m_pRight->SetClickHdl( LINK( this, PageColumnControl, ColumnButtonClickHdl_Impl ) ); - FreeResource(); + m_pMoreButton->SetClickHdl( LINK( this, PageColumnControl, MoreButtonClickHdl_Impl ) ); + m_pMoreButton->GrabFocus(); } PageColumnControl::~PageColumnControl() @@ -83,32 +85,45 @@ PageColumnControl::~PageColumnControl() void PageColumnControl::dispose() { - mpColumnValueSet.disposeAndClear(); - maMoreButton.disposeAndClear(); - svx::sidebar::PopupControl::dispose(); + m_pOneColumn.disposeAndClear(); + m_pTwoColumns.disposeAndClear(); + m_pThreeColumns.disposeAndClear(); + m_pLeft.disposeAndClear(); + m_pRight.disposeAndClear(); + m_pMoreButton.disposeAndClear(); + SfxPopupWindow::dispose(); } -IMPL_LINK_TYPED(PageColumnControl, ImplColumnHdl, ValueSet*, pControl, void) +void PageColumnControl::ExecuteColumnChange( const sal_uInt16 nColumnType ) { - mpColumnValueSet->SetNoSelection(); - if ( pControl == mpColumnValueSet ) - { - const sal_uInt32 nColumnType = mpColumnValueSet->GetSelectItemId(); - if ( nColumnType != mnColumnType ) - { - mnColumnType = nColumnType; - mrPagePropPanel.ExecuteColumnChange( mnColumnType ); - } - } - - mrPagePropPanel.ClosePageColumnPopup(); + std::unique_ptr<SfxInt16Item> mpPageColumnTypeItem( new SfxInt16Item(SID_ATTR_PAGE_COLUMN) ); + mpPageColumnTypeItem->SetValue( nColumnType ); + if ( SfxViewFrame::Current() ) + SfxViewFrame::Current()->GetBindings().GetDispatcher()->ExecuteList(SID_ATTR_PAGE_COLUMN, + SfxCallMode::RECORD, { mpPageColumnTypeItem.get() }); } -IMPL_LINK_NOARG_TYPED(PageColumnControl, MoreButtonClickHdl_Impl, Button*, void) +IMPL_LINK_TYPED( PageColumnControl, ColumnButtonClickHdl_Impl, Button*, pButton, void ) { - mrPagePropPanel.GetBindings()->GetDispatcher()->Execute( FN_FORMAT_PAGE_COLUMN_DLG, SfxCallMode::ASYNCHRON ); + if ( pButton == m_pOneColumn.get() ) + ExecuteColumnChange( 1 ); + else if ( pButton == m_pTwoColumns.get() ) + ExecuteColumnChange( 2 ); + else if ( pButton == m_pThreeColumns.get() ) + ExecuteColumnChange( 3 ); + else if ( pButton == m_pLeft.get() ) + ExecuteColumnChange( 4 ); + else if ( pButton == m_pRight.get() ) + ExecuteColumnChange( 5 ); + + EndPopupMode(); +} - mrPagePropPanel.ClosePageColumnPopup(); +IMPL_LINK_NOARG_TYPED( PageColumnControl, MoreButtonClickHdl_Impl, Button*, void ) +{ + if ( SfxViewFrame::Current() ) + SfxViewFrame::Current()->GetBindings().GetDispatcher()->Execute( FN_FORMAT_PAGE_COLUMN_DLG, SfxCallMode::ASYNCHRON ); + EndPopupMode(); } } } // end of namespace sw::sidebar diff --git a/sw/source/uibase/sidebar/PageColumnControl.hxx b/sw/source/uibase/sidebar/PageColumnControl.hxx index 796cb84ea4ce..b116d5c41403 100644 --- a/sw/source/uibase/sidebar/PageColumnControl.hxx +++ b/sw/source/uibase/sidebar/PageColumnControl.hxx @@ -19,45 +19,33 @@ #ifndef INCLUDED_SW_SOURCE_UIBASE_SIDEBAR_PAGECOLUMNCONTROL_HXX #define INCLUDED_SW_SOURCE_UIBASE_SIDEBAR_PAGECOLUMNCONTROL_HXX -#include <svx/sidebar/PopupControl.hxx> - -#include <vcl/image.hxx> +#include <svx/tbxctl.hxx> #include <vcl/button.hxx> -#include <vector> - -namespace svx { namespace sidebar { - class ValueSetWithTextControl; -} } -class ValueSet; - namespace sw { namespace sidebar { class PagePropertyPanel; -class PageColumnControl - : public svx::sidebar::PopupControl +class PageColumnControl : public SfxPopupWindow { public: - PageColumnControl( - vcl::Window* pParent, - PagePropertyPanel& rPanel, - const sal_uInt16 nColumnType, - const bool bLandscape ); + PageColumnControl( sal_uInt16 nId ); virtual ~PageColumnControl(); virtual void dispose() override; private: - VclPtr< svx::sidebar::ValueSetWithTextControl> mpColumnValueSet; - VclPtr<PushButton> maMoreButton; - - sal_uInt16 mnColumnType; + VclPtr<PushButton> m_pOneColumn; + VclPtr<PushButton> m_pTwoColumns; + VclPtr<PushButton> m_pThreeColumns; + VclPtr<PushButton> m_pLeft; + VclPtr<PushButton> m_pRight; + VclPtr<PushButton> m_pMoreButton; - PagePropertyPanel& mrPagePropPanel; + static void ExecuteColumnChange( const sal_uInt16 nColumnType ); - DECL_LINK_TYPED(ImplColumnHdl, ValueSet*, void); - DECL_LINK_TYPED(MoreButtonClickHdl_Impl, Button*, void); + DECL_LINK_TYPED( ColumnButtonClickHdl_Impl, Button*, void ); + DECL_LINK_TYPED( MoreButtonClickHdl_Impl, Button*, void ); }; } } // end of namespace sw::sidebar diff --git a/sw/source/uibase/sidebar/PageColumnPopup.cxx b/sw/source/uibase/sidebar/PageColumnPopup.cxx new file mode 100644 index 000000000000..e8830cb0bf16 --- /dev/null +++ b/sw/source/uibase/sidebar/PageColumnPopup.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 <PageColumnPopup.hxx> +#include "PageColumnControl.hxx" +#include <svl/intitem.hxx> +#include <vcl/toolbox.hxx> + +SFX_IMPL_TOOLBOX_CONTROL(PageColumnPopup, SfxInt16Item); + +PageColumnPopup::PageColumnPopup(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx) + : SfxToolBoxControl(nSlotId, nId, rTbx) +{ + rTbx.SetItemBits(nId, ToolBoxItemBits::DROPDOWN | rTbx.GetItemBits(nId)); +} + +PageColumnPopup::~PageColumnPopup() +{ +} + +VclPtr<SfxPopupWindow> PageColumnPopup::CreatePopupWindow() +{ + VclPtr<sw::sidebar::PageColumnControl> pControl = VclPtr<sw::sidebar::PageColumnControl>::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 fa6d711e59d7..ea0f3741554b 100644 --- a/sw/source/uibase/sidebar/PagePropertyPanel.cxx +++ b/sw/source/uibase/sidebar/PagePropertyPanel.cxx @@ -29,7 +29,6 @@ #include <svx/sidebar/PopupContainer.hxx> #include "PageMarginControl.hxx" #include "PageSizeControl.hxx" -#include "PageColumnControl.hxx" #include <swtypes.hxx> #include <cmdid.h> @@ -53,7 +52,6 @@ const char UNO_MARGIN[] = ".uno:Margin"; const char UNO_SIZE[] = ".uno:Size"; -const char UNO_COLUMN[] = ".uno:Column"; namespace { const css::uno::Reference< css::document::XUndoManager > getUndoManager( const css::uno::Reference< css::frame::XFrame >& rxFrame ) @@ -134,25 +132,12 @@ PagePropertyPanel::PagePropertyPanel( , mImgLetter_L (SW_RES(IMG_PAGE_LETTER_L)) , mImgLegal_L (SW_RES(IMG_PAGE_LEGAL_L)) , mImgSizeNone_L (SW_RES(IMG_PAGE_SIZE_NONE_L)) - , mImgColumn1 (SW_RES(IMG_PAGE_COLUMN_1)) - , mImgColumn2 (SW_RES(IMG_PAGE_COLUMN_2)) - , mImgColumn3 (SW_RES(IMG_PAGE_COLUMN_3)) - , mImgLeft (SW_RES(IMG_PAGE_COLUMN_LEFT)) - , mImgRight (SW_RES(IMG_PAGE_COLUMN_RIGHT)) - , mImgColumnNone (SW_RES(IMG_PAGE_COLUMN_NONE)) - , mImgColumn1_L (SW_RES(IMG_PAGE_COLUMN_1_L)) - , mImgColumn2_L (SW_RES(IMG_PAGE_COLUMN_2_L)) - , mImgColumn3_L (SW_RES(IMG_PAGE_COLUMN_3_L)) - , mImgLeft_L (SW_RES(IMG_PAGE_COLUMN_LEFT_L)) - , mImgRight_L (SW_RES(IMG_PAGE_COLUMN_RIGHT_L)) - , mImgColumnNone_L (SW_RES(IMG_PAGE_COLUMN_NONE_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) ) , mePaper( PAPER_USER ) - , mpPageColumnTypeItem( new SfxInt16Item(SID_ATTR_PAGE_COLUMN) ) , meFUnit() , meUnit() @@ -161,7 +146,6 @@ PagePropertyPanel::PagePropertyPanel( , m_aSwPagePgLRControl(SID_ATTR_PAGE_LRSPACE, *pBindings, *this) , m_aSwPagePgSizeControl(SID_ATTR_PAGE_SIZE, *pBindings, *this) , m_aSwPagePgControl(SID_ATTR_PAGE, *pBindings, *this) - , m_aSwPageColControl(SID_ATTR_PAGE_COLUMN, *pBindings, *this) , m_aSwPagePgMetricControl(SID_ATTR_METRIC, *pBindings, *this) , maMarginPopup( this, @@ -170,9 +154,6 @@ PagePropertyPanel::PagePropertyPanel( , maSizePopup( this, [this] (svx::sidebar::PopupContainer *parent) { return this->CreatePageSizeControl(parent); }, OUString("Page size") ) - , maColumnPopup( this, - [this] (svx::sidebar::PopupContainer *parent) { return this->CreatePageColumnControl(parent); }, - OUString("Page columns") ) , mxUndoManager( getUndoManager( rxFrame ) ) @@ -181,7 +162,6 @@ PagePropertyPanel::PagePropertyPanel( // visible controls get(mpToolBoxMargin, "selectmargin"); get(mpToolBoxSize, "selectsize"); - get(mpToolBoxColumn, "selectcolumn"); Initialize(); mbInvalidateSIDAttrPageOnSIDAttrPageSizeNotify = true; @@ -206,16 +186,13 @@ void PagePropertyPanel::dispose() mpToolBoxMargin.clear(); mpToolBoxSize.clear(); - mpToolBoxColumn.clear(); m_aSwPagePgULControl.dispose(); m_aSwPagePgLRControl.dispose(); m_aSwPagePgSizeControl.dispose(); m_aSwPagePgControl.dispose(); - m_aSwPageColControl.dispose(); m_aSwPagePgMetricControl.dispose(); - maColumnPopup.dispose(); maSizePopup.dispose(); maMarginPopup.dispose(); @@ -258,14 +235,6 @@ void PagePropertyPanel::Initialize() maImgSize_L[6] = mImgLetter_L; maImgSize_L[7] = mImgLegal_L; - // popup for page column property - const sal_uInt16 nIdColumn = mpToolBoxColumn->GetItemId(UNO_COLUMN); - aLink = LINK( this, PagePropertyPanel, ClickColumnHdl ); - mpToolBoxColumn->SetDropdownClickHdl( aLink ); - mpToolBoxColumn->SetSelectHdl( aLink ); - mpToolBoxColumn->SetItemImage(nIdColumn, mImgColumn1); - mpToolBoxColumn->SetItemBits( nIdColumn, mpToolBoxColumn->GetItemBits( nIdColumn ) | ToolBoxItemBits::DROPDOWNONLY ); - meFUnit = GetModuleFieldUnit(); meUnit = m_aSwPagePgSizeControl.GetCoreMetric(); @@ -362,33 +331,6 @@ void PagePropertyPanel::ClosePageSizePopup() maSizePopup.Hide(); } -VclPtr< svx::sidebar::PopupControl> PagePropertyPanel::CreatePageColumnControl( svx::sidebar::PopupContainer* pParent ) -{ - return VclPtr<PageColumnControl>::Create( - - pParent, - *this, - mpPageColumnTypeItem->GetValue(), - mpPageItem->IsLandscape() ); -} - -void PagePropertyPanel::ExecuteColumnChange( const sal_uInt16 nColumnType ) -{ - mpPageColumnTypeItem->SetValue( nColumnType ); - mpBindings->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_COLUMN, - SfxCallMode::RECORD, { mpPageColumnTypeItem.get() }); -} - -IMPL_LINK_TYPED( PagePropertyPanel, ClickColumnHdl, ToolBox*, pToolBox, void ) -{ - maColumnPopup.Show( *pToolBox ); -} - -void PagePropertyPanel::ClosePageColumnPopup() -{ - maColumnPopup.Hide(); -} - void PagePropertyPanel::NotifyItemUpdate( const sal_uInt16 nSId, const SfxItemState eState, @@ -402,16 +344,6 @@ void PagePropertyPanel::NotifyItemUpdate( switch( nSId ) { - case SID_ATTR_PAGE_COLUMN: - { - if ( eState >= SfxItemState::DEFAULT && - pState && dynamic_cast< const SfxInt16Item *>( pState ) != nullptr ) - { - mpPageColumnTypeItem.reset( static_cast<SfxInt16Item*>(pState->Clone()) ); - ChangeColumnImage( mpPageColumnTypeItem->GetValue() ); - } - } - break; case SID_ATTR_PAGE_LRSPACE: if ( eState >= SfxItemState::DEFAULT && pState && dynamic_cast< const SvxLongLRSpaceItem *>( pState ) != nullptr ) @@ -585,62 +517,6 @@ void PagePropertyPanel::ChangeSizeImage() } } -void PagePropertyPanel::ChangeColumnImage( const sal_uInt16 nColumnType ) -{ - if ( mpPageItem.get() == nullptr ) - { - return; - } - - const sal_uInt16 nIdColumn = mpToolBoxColumn->GetItemId(UNO_COLUMN); - if ( !mpPageItem->IsLandscape() ) - { - switch( nColumnType ) - { - case 1: - mpToolBoxColumn->SetItemImage(nIdColumn, mImgColumn1); - break; - case 2: - mpToolBoxColumn->SetItemImage(nIdColumn, mImgColumn2); - break; - case 3: - mpToolBoxColumn->SetItemImage(nIdColumn, mImgColumn3); - break; - case 4: - mpToolBoxColumn->SetItemImage(nIdColumn, mImgLeft); - break; - case 5: - mpToolBoxColumn->SetItemImage(nIdColumn, mImgRight); - break; - default: - mpToolBoxColumn->SetItemImage(nIdColumn, mImgColumnNone); - } - } - else - { - switch( nColumnType ) - { - case 1: - mpToolBoxColumn->SetItemImage(nIdColumn, mImgColumn1_L); - break; - case 2: - mpToolBoxColumn->SetItemImage(nIdColumn, mImgColumn2_L); - break; - case 3: - mpToolBoxColumn->SetItemImage(nIdColumn, mImgColumn3_L); - break; - case 4: - mpToolBoxColumn->SetItemImage(nIdColumn, mImgLeft_L); - break; - case 5: - mpToolBoxColumn->SetItemImage(nIdColumn, mImgRight_L); - break; - default: - mpToolBoxColumn->SetItemImage(nIdColumn, mImgColumnNone_L); - } - } -} - void PagePropertyPanel::StartUndo() { if ( mxUndoManager.is() ) diff --git a/sw/source/uibase/sidebar/PagePropertyPanel.hrc b/sw/source/uibase/sidebar/PagePropertyPanel.hrc index 01d4df9ce654..c8af7bccf769 100644 --- a/sw/source/uibase/sidebar/PagePropertyPanel.hrc +++ b/sw/source/uibase/sidebar/PagePropertyPanel.hrc @@ -54,7 +54,6 @@ #define IMG_PAGE_COLUMN_3 (RC_SIDEBAR_BEGIN + 32) #define IMG_PAGE_COLUMN_LEFT (RC_SIDEBAR_BEGIN + 33) #define IMG_PAGE_COLUMN_RIGHT (RC_SIDEBAR_BEGIN + 34) -#define IMG_PAGE_COLUMN_NONE (RC_SIDEBAR_BEGIN + 35) #define IMG_PAGE_COLUMN_1_L (RC_SIDEBAR_BEGIN + 36) #define IMG_PAGE_COLUMN_2_L (RC_SIDEBAR_BEGIN + 37) #define IMG_PAGE_COLUMN_3_L (RC_SIDEBAR_BEGIN + 38) diff --git a/sw/source/uibase/sidebar/PagePropertyPanel.hxx b/sw/source/uibase/sidebar/PagePropertyPanel.hxx index 4c71d44c4fa7..72a7d4b52065 100644 --- a/sw/source/uibase/sidebar/PagePropertyPanel.hxx +++ b/sw/source/uibase/sidebar/PagePropertyPanel.hxx @@ -85,10 +85,6 @@ namespace sw { namespace sidebar { void ExecuteSizeChange( const Paper ePaper ); void ClosePageSizePopup(); - VclPtr< svx::sidebar::PopupControl> CreatePageColumnControl( svx::sidebar::PopupContainer* pParent ); - void ExecuteColumnChange( const sal_uInt16 nColumnType ); - void ClosePageColumnPopup(); - void StartUndo(); void EndUndo(); @@ -105,7 +101,6 @@ namespace sw { namespace sidebar { // toolboxes - on click open corresponding popup VclPtr<ToolBox> mpToolBoxMargin; VclPtr<ToolBox> mpToolBoxSize; - VclPtr<ToolBox> mpToolBoxColumn; Image* maImgSize; Image* maImgSize_L; @@ -137,18 +132,6 @@ namespace sw { namespace sidebar { Image mImgLetter_L; Image mImgLegal_L; Image mImgSizeNone_L; - Image mImgColumn1; - Image mImgColumn2; - Image mImgColumn3; - Image mImgLeft; - Image mImgRight; - Image mImgColumnNone; - Image mImgColumn1_L; - Image mImgColumn2_L; - Image mImgColumn3_L; - Image mImgLeft_L; - Image mImgRight_L; - Image mImgColumnNone_L; // item keeping the following page style attributes: // - page orientation @@ -167,9 +150,6 @@ namespace sw { namespace sidebar { // Paper corresponding to the page style's page size Paper mePaper; - // item keeping the page column type - std::unique_ptr<SfxInt16Item> mpPageColumnTypeItem; - FieldUnit meFUnit; MapUnit meUnit; @@ -178,13 +158,11 @@ namespace sw { namespace sidebar { ::sfx2::sidebar::ControllerItem m_aSwPagePgLRControl; ::sfx2::sidebar::ControllerItem m_aSwPagePgSizeControl; ::sfx2::sidebar::ControllerItem m_aSwPagePgControl; - ::sfx2::sidebar::ControllerItem m_aSwPageColControl; ::sfx2::sidebar::ControllerItem m_aSwPagePgMetricControl; // popups svx::sidebar::Popup maMarginPopup; svx::sidebar::Popup maSizePopup; - svx::sidebar::Popup maColumnPopup; const css::uno::Reference< css::document::XUndoManager > mxUndoManager; @@ -193,7 +171,6 @@ namespace sw { namespace sidebar { // handler for popup toolboxes to show the popups DECL_LINK_TYPED(ClickMarginHdl, ToolBox*, void); DECL_LINK_TYPED(ClickSizeHdl, ToolBox*, void); - DECL_LINK_TYPED(ClickColumnHdl, ToolBox*, void); void Initialize(); @@ -202,7 +179,6 @@ namespace sw { namespace sidebar { // helper to adjust popup toolbox' images void ChangeMarginImage(); void ChangeSizeImage(); - void ChangeColumnImage( const sal_uInt16 nColumnType ); }; diff --git a/sw/source/uibase/sidebar/PropertyPanel.hrc b/sw/source/uibase/sidebar/PropertyPanel.hrc index 7b36710f75a6..c4ca5a65e972 100644 --- a/sw/source/uibase/sidebar/PropertyPanel.hrc +++ b/sw/source/uibase/sidebar/PropertyPanel.hrc @@ -22,7 +22,6 @@ #include "rcid.hrc" #define RID_POPUP_SWPAGE_MARGIN (RC_PROPERTYPANEL_BEGIN + 3) -#define RID_POPUP_SWPAGE_COLUMN (RC_PROPERTYPANEL_BEGIN + 5) #define RID_POPUP_SWPAGE_SIZE (RC_PROPERTYPANEL_BEGIN + 6) diff --git a/sw/uiconfig/swriter/ui/notebookbar.ui b/sw/uiconfig/swriter/ui/notebookbar.ui index c2b7b5521052..bb2bc60261c2 100644 --- a/sw/uiconfig/swriter/ui/notebookbar.ui +++ b/sw/uiconfig/swriter/ui/notebookbar.ui @@ -2806,6 +2806,33 @@ </packing> </child> <child> + <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="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:PageColumnType</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> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> + <child> <object class="sfxlo-BigToolBox" id="orientationbox"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -2829,7 +2856,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">3</property> + <property name="position">4</property> </packing> </child> <child> @@ -2841,7 +2868,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">4</property> + <property name="position">5</property> </packing> </child> <child> @@ -2858,7 +2885,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">6</property> + <property name="position">7</property> </packing> </child> </object> diff --git a/sw/uiconfig/swriter/ui/pagecolumncontrol.ui b/sw/uiconfig/swriter/ui/pagecolumncontrol.ui new file mode 100644 index 000000000000..c61992e9c271 --- /dev/null +++ b/sw/uiconfig/swriter/ui/pagecolumncontrol.ui @@ -0,0 +1,244 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.18.3 --> +<interface> + <requires lib="gtk+" version="3.10"/> + <object class="GtkImage" id="image_column1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="pixbuf">sw/res/sidebar/pageproppanel/column_L_1_24x24.png</property> + </object> + <object class="GtkImage" id="image_column1L"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="pixbuf">sw/res/sidebar/pageproppanel/column1_24x24.png</property> + </object> + <object class="GtkImage" id="image_column2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="pixbuf">sw/res/sidebar/pageproppanel/column_L_2_24x24.png</property> + </object> + <object class="GtkImage" id="image_column2L"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="pixbuf">sw/res/sidebar/pageproppanel/column2_24x24.png</property> + </object> + <object class="GtkImage" id="image_column3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="pixbuf">sw/res/sidebar/pageproppanel/column_L_3_24x24.png</property> + </object> + <object class="GtkImage" id="image_column3L"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="pixbuf">sw/res/sidebar/pageproppanel/column3_24x24.png</property> + </object> + <object class="GtkImage" id="image_columnleft"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="pixbuf">sw/res/sidebar/pageproppanel/column_L_left_24x24.png</property> + </object> + <object class="GtkImage" id="image_columnleftL"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="pixbuf">sw/res/sidebar/pageproppanel/columnleft_24x24.png</property> + </object> + <object class="GtkImage" id="image_columnright"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="pixbuf">sw/res/sidebar/pageproppanel/column_L_right_24x24.png</property> + </object> + <object class="GtkImage" id="image_columnrightL"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="pixbuf">sw/res/sidebar/pageproppanel/columnright_24x24.png</property> + </object> + <object class="GtkWindow" id="PageColumnControl"> + <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="column1"> + <property name="label" translatable="yes">1 Column</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="image">image_column1</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="column2"> + <property name="label" translatable="yes">2 Columns</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="image">image_column2</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">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="column3"> + <property name="label" translatable="yes">3 Columns</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="image">image_column3</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="columnleft"> + <property name="label" translatable="yes">Left</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="image">image_columnleft</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="columnright"> + <property name="label" translatable="yes">Right</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="image">image_columnright</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="column1L"> + <property name="label" translatable="yes">1 Column</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="image">image_column1L</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="column2L"> + <property name="label" translatable="yes">2 Columns</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="image">image_column2L</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">6</property> + </packing> + </child> + <child> + <object class="GtkButton" id="column3L"> + <property name="label" translatable="yes">3 Columns</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="image">image_column3L</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="columnleftL"> + <property name="label" translatable="yes">Left</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="image">image_columnleftL</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="columnrightL"> + <property name="label" translatable="yes">Right</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="image">image_columnrightL</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="GtkButton" id="moreoptions"> + <property name="label" translatable="yes">_More Options</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">More Options</property> + <property name="relief">none</property> + <property name="use_underline">True</property> + <property name="always_show_image">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">11</property> + </packing> + </child> + </object> + </child> + </object> +</interface> |