From 3e19a763b95c45c275d15356ff5531e855cfcb03 Mon Sep 17 00:00:00 2001 From: Susobhan Ghosh Date: Mon, 13 Jun 2016 16:53:48 +0530 Subject: tdf#83830: Removal of Page Margin Panel Change-Id: I05c0b2ba42cf395a2b30ce658e1f1d034e95f21f Reviewed-on: https://gerrit.libreoffice.org/26217 Tested-by: Jenkins Reviewed-by: Katarina Behrens --- sw/source/uibase/sidebar/PageMarginPanel.cxx | 211 --------------------------- sw/source/uibase/sidebar/PageMarginPanel.hxx | 113 -------------- sw/source/uibase/sidebar/SwPanelFactory.cxx | 10 -- 3 files changed, 334 deletions(-) delete mode 100644 sw/source/uibase/sidebar/PageMarginPanel.cxx delete mode 100644 sw/source/uibase/sidebar/PageMarginPanel.hxx (limited to 'sw/source') diff --git a/sw/source/uibase/sidebar/PageMarginPanel.cxx b/sw/source/uibase/sidebar/PageMarginPanel.cxx deleted file mode 100644 index 0575408c1d89..000000000000 --- a/sw/source/uibase/sidebar/PageMarginPanel.cxx +++ /dev/null @@ -1,211 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include "PageMarginPanel.hxx" -#include -#include -#include -#include -#include -#include "cmdid.h" -#include -#include -#include - -namespace sw { namespace sidebar{ - -VclPtr PageMarginPanel::Create( - vcl::Window* pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame, - SfxBindings* pBindings) -{ - if( !pParent ) - throw ::com::sun::star::lang::IllegalArgumentException("no parent window given to PageMarginPanel::Create", nullptr, 0); - if( !rxFrame.is() ) - throw ::com::sun::star::lang::IllegalArgumentException("no XFrame given to PageMarginPanel::Create", nullptr, 0); - if( !pBindings ) - throw ::com::sun::star::lang::IllegalArgumentException("no SfxBindings given to PageMarginPanel::Create", nullptr, 0); - - return VclPtr::Create(pParent, rxFrame, pBindings); -} - -PageMarginPanel::PageMarginPanel( - vcl::Window* pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame, - SfxBindings* pBindings - ) : - PanelLayout(pParent, "PageMarginPanel" , "modules/swriter/ui/pagemarginpanel.ui", rxFrame), - mpBindings(pBindings), - meFUnit(), - meUnit(), - mnPageLeftMargin(0), - mnPageRightMargin(0), - mnPageTopMargin(0), - mnPageBottomMargin(0), - mpPageLRMarginItem( new SvxLongLRSpaceItem( 0, 0, SID_ATTR_PAGE_LRSPACE ) ), - mpPageULMarginItem( new SvxLongULSpaceItem( 0, 0, SID_ATTR_PAGE_ULSPACE ) ), - maSwPageLRControl(SID_ATTR_PAGE_LRSPACE, *pBindings, *this), - maSwPageULControl(SID_ATTR_PAGE_ULSPACE, *pBindings, *this), - maSwPageSizeControl(SID_ATTR_PAGE_SIZE, *pBindings, *this), - maSwPageMetricControl(SID_ATTR_METRIC, *pBindings, *this) -{ - get(mpLeftMarginEdit, "leftmargin"); - get(mpRightMarginEdit, "rightmargin"); - get(mpTopMarginEdit, "topmargin"); - get(mpBottomMarginEdit, "bottommargin"); - - Initialize(); -} - -PageMarginPanel::~PageMarginPanel() -{ - disposeOnce(); -} - -void PageMarginPanel::dispose() -{ - - mpLeftMarginEdit.disposeAndClear(); - mpRightMarginEdit.disposeAndClear(); - mpTopMarginEdit.disposeAndClear(); - mpBottomMarginEdit.disposeAndClear(); - - mpPageLRMarginItem.reset(); - mpPageULMarginItem.reset(); - - maSwPageULControl.dispose(); - maSwPageLRControl.dispose(); - maSwPageSizeControl.dispose(); - maSwPageMetricControl.dispose(); - - PanelLayout::dispose(); -} - -void PageMarginPanel::Initialize() -{ - meUnit = maSwPageSizeControl.GetCoreMetric(); - mpLeftMarginEdit->SetModifyHdl( LINK(this, PageMarginPanel, ModifyLRMarginHdl) ); - mpRightMarginEdit->SetModifyHdl( LINK(this, PageMarginPanel, ModifyLRMarginHdl) ); - mpTopMarginEdit->SetModifyHdl( LINK(this, PageMarginPanel, ModifyULMarginHdl) ); - mpBottomMarginEdit->SetModifyHdl( LINK(this, PageMarginPanel, ModifyULMarginHdl) ); -} - -void PageMarginPanel::MetricState( SfxItemState eState, const SfxPoolItem* pState ) -{ - meFUnit = FUNIT_NONE; - if ( pState && eState >= SfxItemState::DEFAULT ) - { - meFUnit = (FieldUnit)static_cast(pState )->GetValue(); - } - else - { - SfxViewFrame* pFrame = SfxViewFrame::Current(); - SfxObjectShell* pSh = nullptr; - if ( pFrame ) - pSh = pFrame->GetObjectShell(); - if ( pSh ) - { - SfxModule* pModule = pSh->GetModule(); - if ( pModule ) - { - const SfxPoolItem* pItem = pModule->GetItem( SID_ATTR_METRIC ); - if ( pItem ) - meFUnit = (FieldUnit)static_cast(pItem )->GetValue(); - } - else - { - SAL_WARN("sw.ui", ": no module found"); - } - } - } -/* - SetFieldUnit( *mpLeftMarginEdit.get(), meFUnit ); - SetFieldUnit( *mpRightMarginEdit.get(), meFUnit ); - SetFieldUnit( *mpTopMarginEdit.get(), meFUnit ); - SetFieldUnit( *mpBottomMarginEdit.get(), meFUnit ); -*/ -} - -void PageMarginPanel::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 PageMarginPanel::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 PageMarginPanel::NotifyItemUpdate( - const sal_uInt16 nSId, - const SfxItemState eState, - const SfxPoolItem* pState, - const bool bIsEnabled) -{ - (void)bIsEnabled; - switch( nSId ) - { - case SID_ATTR_PAGE_LRSPACE: - { - } - break; - case SID_ATTR_PAGE_ULSPACE: - { - } - break; - case SID_ATTR_METRIC: - MetricState(eState, pState); - break; - } -} - - - -IMPL_LINK_NOARG_TYPED( PageMarginPanel, ModifyLRMarginHdl, Edit&, void ) -{ - mnPageLeftMargin = GetCoreValue( *mpLeftMarginEdit.get(), meUnit ); - mnPageRightMargin = GetCoreValue( *mpRightMarginEdit.get(), meUnit ); - ExecuteMarginLRChange( mnPageLeftMargin, mnPageRightMargin ); -} - -IMPL_LINK_NOARG_TYPED( PageMarginPanel, ModifyULMarginHdl, Edit&, void ) -{ - mnPageTopMargin = GetCoreValue( *mpTopMarginEdit.get(), meUnit ); - mnPageBottomMargin = GetCoreValue( *mpBottomMarginEdit.get(), meUnit ); - ExecuteMarginULChange( mnPageTopMargin, mnPageBottomMargin ); -} - -} } - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/sidebar/PageMarginPanel.hxx b/sw/source/uibase/sidebar/PageMarginPanel.hxx deleted file mode 100644 index 39c7751f9546..000000000000 --- a/sw/source/uibase/sidebar/PageMarginPanel.hxx +++ /dev/null @@ -1,113 +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 . - */ -#ifndef INCLUDED_SW_SOURCE_UIBASE_SIDEBAR_PAGEMARGINPANEL_HXX -#define INCLUDED_SW_SOURCE_UIBASE_SIDEBAR_PAGEMARGINPANEL_HXX - -#include -#include - -#include -#include - -#include - -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace sw { namespace sidebar { - -class PageMarginPanel: - public PanelLayout, - public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface -{ -public: - static VclPtr Create( - vcl::Window* pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame, - SfxBindings* pBindings); - - virtual void NotifyItemUpdate( - const sal_uInt16 nSID, - const SfxItemState eState, - const SfxPoolItem* pState, - const bool bIsEnabled) override; - - SfxBindings* GetBindings() const { return mpBindings; } - - PageMarginPanel( - vcl::Window* pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame, - SfxBindings* pBindings); - virtual ~PageMarginPanel(); - virtual void dispose() override; - -private: - - SfxBindings* mpBindings; - - VclPtr mpLeftMarginEdit; - VclPtr mpRightMarginEdit; - VclPtr mpTopMarginEdit; - VclPtr mpBottomMarginEdit; - - FieldUnit meFUnit; - SfxMapUnit meUnit; - - long mnPageLeftMargin; - long mnPageRightMargin; - long mnPageTopMargin; - long mnPageBottomMargin; - - void Initialize(); - void ExecuteMarginLRChange( const long nPageLeftMargin, const long nPageRightMargin ); - void ExecuteMarginULChange( const long nPageTopMargin, const long nPageBottomMargin); - void MetricState( SfxItemState eState, const SfxPoolItem* pState ); - - std::unique_ptr mpPageLRMarginItem; - std::unique_ptr mpPageULMarginItem; - - ::sfx2::sidebar::ControllerItem maSwPageLRControl; - ::sfx2::sidebar::ControllerItem maSwPageULControl; - ::sfx2::sidebar::ControllerItem maSwPageSizeControl; - ::sfx2::sidebar::ControllerItem maSwPageMetricControl; - - DECL_LINK_TYPED( ModifyLRMarginHdl, Edit&, void ); - DECL_LINK_TYPED( ModifyULMarginHdl, Edit&, void ); - -}; - -} } // end of namespace sw::sidebar - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/sidebar/SwPanelFactory.cxx b/sw/source/uibase/sidebar/SwPanelFactory.cxx index c89ec5df5dd2..7f28f93bad2c 100644 --- a/sw/source/uibase/sidebar/SwPanelFactory.cxx +++ b/sw/source/uibase/sidebar/SwPanelFactory.cxx @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -134,15 +133,6 @@ Reference SAL_CALL SwPanelFactory::createUIElement ( pPanel, ui::LayoutSize(-1,-1,-1)); } - else if(rsResourceURL.endsWith("/PageMarginPanel")) - { - VclPtr pPanel = sw::sidebar::PageMarginPanel::Create( pParentWindow, xFrame, pBindings ); - xElement = sfx2::sidebar::SidebarPanelBase::Create( - rsResourceURL, - xFrame, - pPanel, - ui::LayoutSize(-1,-1,-1)); - } else if(rsResourceURL.endsWith("/PageStylesPanel")) { VclPtr pPanel = sw::sidebar::PageStylesPanel::Create( pParentWindow, xFrame ); -- cgit