Page orientation popup converted to use outside sidebar

* popup converted to .ui file
* added .uno:Orientation
* label & icon for .uno:Orientation
* control inserted to the notebookbar.ui (Page layout tab)

Change-Id: I93f35a65c4461635d0cfd1afd4546a9d2a8c4d04
Reviewed-on: https://gerrit.libreoffice.org/28405
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
This commit is contained in:
Szymon Kłos
2016-08-26 14:00:03 +02:00
committed by Samuel Mehrbrodt
parent 74ab2a6861
commit cbe43883e4
24 changed files with 476 additions and 331 deletions

View File

Before

Width:  |  Height:  |  Size: 255 B

After

Width:  |  Height:  |  Size: 255 B

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 286 B

After

Width:  |  Height:  |  Size: 286 B

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -242,6 +242,7 @@
#define SID_ATTR_PAGE ( SID_SVX_START + 50 )
#define SID_ATTR_PAGE_SIZE ( SID_SVX_START + 51 )
#define SID_ATTR_PAGE_MAXSIZE ( SID_SVX_START + 52 )
#define SID_ATTR_PAGE_ORIENTATION ( SID_SVX_START + 53 )
#define SID_ATTR_PAGE_PAPERBIN ( SID_SVX_START + 54 )
#define SID_ATTR_PAGE_EXT1 ( SID_SVX_START + 56 )
#define SID_ATTR_PAGE_EXT2 ( SID_SVX_START + 57 )

View File

@@ -2817,6 +2817,14 @@
<value>1</value>
</prop>
</node>
<node oor:name=".uno:Orientation" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Orientation</value>
</prop>
<prop oor:name="Properties" oor:type="xs:int">
<value>1</value>
</prop>
</node>
</node>
</node>
</oor:component-data>

View File

@@ -6099,6 +6099,25 @@ SvxPageItem AttributePage SID_ATTR_PAGE
]
SvxPageItem Orientation SID_ATTR_PAGE_ORIENTATION
[
AutoUpdate = FALSE,
FastCall = FALSE,
ReadOnlyDoc = TRUE,
Toggle = FALSE,
Container = FALSE,
RecordAbsolute = FALSE,
RecordPerSet;
AccelConfig = FALSE,
MenuConfig = FALSE,
ToolBoxConfig = FALSE,
GroupId = GID_FORMAT;
]
SvxAutoKernItem PairKerning SID_ATTR_CHAR_AUTOKERN
[

View File

@@ -677,6 +677,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
sw/source/uibase/shells/txtnum \
sw/source/uibase/sidebar/StylePresetsPanel \
sw/source/uibase/sidebar/PageOrientationControl \
sw/source/uibase/sidebar/PageOrientationPopup \
sw/source/uibase/sidebar/PageMarginControl \
sw/source/uibase/sidebar/PageSizeControl \
sw/source/uibase/sidebar/PageColumnControl \

View File

@@ -206,6 +206,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/pageorientationcontrol \
sw/uiconfig/swriter/ui/paradialog \
sw/uiconfig/swriter/ui/picturedialog \
sw/uiconfig/swriter/ui/picturepage \

View File

@@ -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_PAGEORIENTATIONPOPUP_HXX
#define INCLUDED_SW_INC_PAGEORIENTATIONPOPUP_HXX
#include <sfx2/tbxctrl.hxx>
#include <swdllapi.h>
#include <vcl/vclenum.hxx>
#include <functional>
class SW_DLLPUBLIC PageOrientationPopup : public SfxToolBoxControl
{
public:
SFX_DECL_TOOLBOX_CONTROL();
PageOrientationPopup(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx);
virtual ~PageOrientationPopup();
virtual VclPtr<SfxPopupWindow> CreatePopupWindow() override;
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -402,6 +402,10 @@ interface BaseTextEditView
ExecMethod = Execute ;
StateMethod = GetState ;
]
SID_ATTR_PAGE_ORIENTATION // status()
[
StateMethod = GetState ;
]
SID_ATTR_PAGE_SIZE // status(final|play)
[
ExecMethod = Execute ;

View File

@@ -22,14 +22,6 @@
#include "PagePropertyPanel.hrc"
#include "helpid.h"
Image IMG_PAGE_PORTRAIT
{
ImageBitmap = Bitmap{File = "sidebar/pageproppanel/portraitcopy_24x24.png";};
};
Image IMG_PAGE_LANDSCAPE
{
ImageBitmap = Bitmap{File = "sidebar/pageproppanel/Landscapecopy_24x24.png";};
};
Image IMG_PAGE_NARROW
{
ImageBitmap = Bitmap{File = "sidebar/pageproppanel/format_L_narrow_24x24.png";};
@@ -191,40 +183,6 @@ Image IMG_PAGE_COLUMN_NONE_L
ImageBitmap = Bitmap{File = "sidebar/pageproppanel/columncopy_24x24.png";};
};
// popup for page orientation attribute
Control RID_POPUP_SWPAGE_ORIENTATION
{
OutputSize = TRUE;
DialogControl = TRUE;
Border = FALSE;
Size = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL * 2 + POPUP_BORDER_WIDTH + VS_WIDTH, ITEM_HEIGHT*2 + POPUPPANEL_MARGIN_SMALL*2 );
Control VS_ORIENTATION
{
Pos = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL + OFFSET_X, POPUPPANEL_MARGIN_SMALL + OFFSET_Y);
Size = MAP_APPFONT ( VS_WIDTH , ITEM_HEIGHT*2);
HelpID = HID_SWPAGE_VS_ORIENTATION;
TabStop = TRUE ;
Text = "Orientation";
};
Image IMG_PORTRAIT
{
ImageBitmap = Bitmap{File = "sidebar/pageproppanel/portraitcopy_24x24.png";};
};
Image IMG_LANDSCAPE
{
ImageBitmap = Bitmap{File = "sidebar/pageproppanel/Landscapecopy_24x24.png";};
};
String STR_PORTRAIT
{
Text [ en-US ] = "Portrait";
};
String STR_LANDSCAPE
{
Text [ en-US ] = "Landscape";
};
};
// popup for page style's margin attributes
Control RID_POPUP_SWPAGE_MARGIN
{

View File

@@ -110,6 +110,7 @@
#include <barcfg.hxx>
#include <svx/rubydialog.hxx>
#include <svtools/colorcfg.hxx>
#include <PageOrientationPopup.hxx>
#include <unotools/configmgr.hxx>
#include <unotools/moduleoptions.hxx>
@@ -291,6 +292,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);
PageOrientationPopup::RegisterControl(SID_ATTR_PAGE_ORIENTATION, pMod);
SvxColorToolBoxControl::RegisterControl( SID_EXTRUSION_3D_COLOR, pMod );

View File

@@ -18,47 +18,50 @@
*/
#include "PageOrientationControl.hxx"
#include "PagePropertyPanel.hxx"
#include "PagePropertyPanel.hrc"
#include "PageMarginControl.hxx"
#include <swtypes.hxx>
#include <sfx2/viewsh.hxx>
#include <sfx2/dispatch.hxx>
#include <svx/svxids.hrc>
#include <cmdid.h>
#include <svx/sidebar/ValueSetWithTextControl.hxx>
#include <vcl/settings.hxx>
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 {
PageOrientationControl::PageOrientationControl(
vcl::Window* pParent,
PagePropertyPanel& rPanel,
const bool bLandscape )
: svx::sidebar::PopupControl( pParent, SW_RES(RID_POPUP_SWPAGE_ORIENTATION) )
, mpOrientationValueSet( VclPtr<svx::sidebar::ValueSetWithTextControl>::Create( svx::sidebar::ValueSetWithTextControl::ControlType::ImageText, this, SW_RES(VS_ORIENTATION) ) )
, mbLandscape( bLandscape )
, mrPagePropPanel(rPanel)
PageOrientationControl::PageOrientationControl( sal_uInt16 nId )
: SfxPopupWindow( nId, "PageOrientationControl", "modules/swriter/ui/pageorientationcontrol.ui" )
, mpPageItem( new SvxPageItem(SID_ATTR_PAGE) )
, mpPageSizeItem( new SvxSizeItem(SID_ATTR_PAGE_SIZE) )
, mpPageLRMarginItem( new SvxLongLRSpaceItem( 0, 0, SID_ATTR_PAGE_LRSPACE ) )
, mpPageULMarginItem( new SvxLongULSpaceItem( 0, 0, SID_ATTR_PAGE_ULSPACE ) )
{
mpOrientationValueSet->SetStyle( mpOrientationValueSet->GetStyle() | WB_3DLOOK | WB_NO_DIRECTSELECT );
mpOrientationValueSet->SetColor(GetSettings().GetStyleSettings().GetMenuColor());
get(m_pPortrait, "portrait");
get(m_pLandscape, "landscape");
// initialize <ValueSetWithText> control
{
mpOrientationValueSet->AddItem(Image(SW_RES(IMG_PORTRAIT)), nullptr,
SW_RES(STR_PORTRAIT), nullptr);
mpOrientationValueSet->AddItem(Image(SW_RES(IMG_LANDSCAPE)), nullptr,
SW_RES(STR_LANDSCAPE), nullptr );
}
mpOrientationValueSet->SetSelectHdl(LINK(this, PageOrientationControl,ImplOrientationHdl ));
mpOrientationValueSet->SetNoSelection();
mpOrientationValueSet->StartSelection();
mpOrientationValueSet->Show();
mpOrientationValueSet->SelectItem( mbLandscape ? 2 : 1 );
mpOrientationValueSet->GrabFocus();
mpOrientationValueSet->SetFormat();
mpOrientationValueSet->Invalidate();
mpOrientationValueSet->StartSelection();
FreeResource();
m_pPortrait->SetClickHdl( LINK( this, PageOrientationControl,ImplOrientationHdl ) );
m_pLandscape->SetClickHdl( LINK( this, PageOrientationControl,ImplOrientationHdl ) );
}
PageOrientationControl::~PageOrientationControl()
@@ -68,26 +71,130 @@ PageOrientationControl::~PageOrientationControl()
void PageOrientationControl::dispose()
{
mpOrientationValueSet.disposeAndClear();
svx::sidebar::PopupControl::dispose();
m_pPortrait.disposeAndClear();
m_pLandscape.disposeAndClear();
mpPageItem.reset();
mpPageLRMarginItem.reset();
mpPageULMarginItem.reset();
mpPageSizeItem.reset();
SfxPopupWindow::dispose();
}
IMPL_LINK_TYPED(PageOrientationControl, ImplOrientationHdl, ValueSet*, pControl, void)
void PageOrientationControl::ExecuteMarginLRChange(
const long nPageLeftMargin,
const long nPageRightMargin )
{
mpOrientationValueSet->SetNoSelection();
if ( pControl == mpOrientationValueSet )
mpPageLRMarginItem->SetLeft( nPageLeftMargin );
mpPageLRMarginItem->SetRight( nPageRightMargin );
SfxViewShell::Current()->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_LRSPACE,
SfxCallMode::RECORD, { mpPageLRMarginItem.get() });
}
void PageOrientationControl::ExecuteMarginULChange(
const long nPageTopMargin,
const long nPageBottomMargin )
{
const sal_uInt32 iPos = mpOrientationValueSet->GetSelectItemId();
const bool bChanged = ( ( iPos == 1 ) && mbLandscape ) ||
( ( iPos == 2 ) && !mbLandscape );
if ( bChanged )
mpPageULMarginItem->SetUpper( nPageTopMargin );
mpPageULMarginItem->SetLower( nPageBottomMargin );
SfxViewShell::Current()->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_ULSPACE,
SfxCallMode::RECORD, { mpPageULMarginItem.get() });
}
void PageOrientationControl::ExecuteOrientationChange( const bool bLandscape )
{
mbLandscape = !mbLandscape;
mrPagePropPanel.ExecuteOrientationChange( mbLandscape );
css::uno::Reference< css::document::XUndoManager > mxUndoManager(
getUndoManager( SfxViewFrame::Current()->GetFrame().GetFrameInterface() ) );
if ( mxUndoManager.is() )
mxUndoManager->enterUndoContext( "" );
const SfxPoolItem* pItem;
SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState(SID_ATTR_PAGE_SIZE, pItem);
SvxSizeItem* pSizeItem = static_cast<SvxSizeItem*>(pItem->Clone());
if ( pSizeItem )
mpPageSizeItem.reset( pSizeItem );
SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState(SID_ATTR_PAGE_LRSPACE, pItem);
SvxLongLRSpaceItem* pLRItem = static_cast<SvxLongLRSpaceItem*>(pItem->Clone());
if ( pLRItem )
mpPageLRMarginItem.reset( pLRItem );
SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState(SID_ATTR_PAGE_ULSPACE, pItem);
SvxLongULSpaceItem* pULItem = static_cast<SvxLongULSpaceItem*>(pItem->Clone());
if ( pULItem )
mpPageULMarginItem.reset( pULItem );
{
// set new page orientation
mpPageItem->SetLandscape( bLandscape );
// swap the width and height of the page size
const long nRotatedWidth = mpPageSizeItem->GetSize().Height();
const long nRotatedHeight = mpPageSizeItem->GetSize().Width();
mpPageSizeItem->SetSize(Size(nRotatedWidth, nRotatedHeight));
// apply changed attributes
if (SfxViewShell::Current())
{
SfxViewShell::Current()->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_SIZE,
SfxCallMode::RECORD, { mpPageSizeItem.get(), mpPageItem.get() });
}
}
mrPagePropPanel.ClosePageOrientationPopup();
// check, if margin values still fit to the changed page size.
// if not, adjust margin values
{
const long nML = mpPageLRMarginItem->GetLeft();
const long nMR = mpPageLRMarginItem->GetRight();
const long nTmpPW = nML + nMR + MINBODY;
const long nPW = mpPageSizeItem->GetSize().Width();
if ( nTmpPW > nPW )
{
if ( nML <= nMR )
{
ExecuteMarginLRChange( mpPageLRMarginItem->GetLeft(), nMR - (nTmpPW - nPW ) );
}
else
{
ExecuteMarginLRChange( nML - (nTmpPW - nPW ), mpPageLRMarginItem->GetRight() );
}
}
const long nMT = mpPageULMarginItem->GetUpper();
const long nMB = mpPageULMarginItem->GetLower();
const long nTmpPH = nMT + nMB + MINBODY;
const long nPH = mpPageSizeItem->GetSize().Height();
if ( nTmpPH > nPH )
{
if ( nMT <= nMB )
{
ExecuteMarginULChange( mpPageULMarginItem->GetUpper(), nMB - ( nTmpPH - nPH ) );
}
else
{
ExecuteMarginULChange( nMT - ( nTmpPH - nPH ), mpPageULMarginItem->GetLower() );
}
}
}
if ( mxUndoManager.is() )
mxUndoManager->leaveUndoContext();
}
IMPL_LINK_TYPED(PageOrientationControl, ImplOrientationHdl, Button*, pControl, void)
{
if ( pControl == m_pPortrait.get() )
ExecuteOrientationChange( false );
else
ExecuteOrientationChange( true );
EndPopupMode();
}
} } // end of namespace sw::sidebar

View File

@@ -19,37 +19,40 @@
#ifndef INCLUDED_SW_SOURCE_UIBASE_SIDEBAR_PAGEORIENTATIONCONTROL_HXX
#define INCLUDED_SW_SOURCE_UIBASE_SIDEBAR_PAGEORIENTATIONCONTROL_HXX
#include <svx/sidebar/PopupControl.hxx>
namespace svx { namespace sidebar {
class ValueSetWithTextControl;
} }
class ValueSet;
#include <svx/tbxctl.hxx>
#include <svx/pageitem.hxx>
#include <svx/rulritem.hxx>
#include <editeng/sizeitem.hxx>
#include <com/sun/star/document/XUndoManager.hpp>
#include <com/sun/star/document/XUndoManagerSupplier.hpp>
class Button;
namespace sw { namespace sidebar {
class PagePropertyPanel;
class PageOrientationControl
: public svx::sidebar::PopupControl
class PageOrientationControl : public SfxPopupWindow
{
public:
PageOrientationControl(
vcl::Window* pParent,
PagePropertyPanel& rPanel,
const bool bLandscape );
PageOrientationControl(sal_uInt16 nId);
virtual ~PageOrientationControl();
virtual void dispose() override;
private:
VclPtr< svx::sidebar::ValueSetWithTextControl> mpOrientationValueSet;
VclPtr<PushButton> m_pPortrait;
VclPtr<PushButton> m_pLandscape;
bool mbLandscape;
std::unique_ptr<SvxPageItem> mpPageItem;
std::unique_ptr<SvxSizeItem> mpPageSizeItem;
std::unique_ptr<SvxLongLRSpaceItem> mpPageLRMarginItem;
std::unique_ptr<SvxLongULSpaceItem> mpPageULMarginItem;
PagePropertyPanel& mrPagePropPanel;
void ExecuteMarginULChange(const long nPageTopMargin, const long nPageBottomMargin);
void ExecuteMarginLRChange(const long nPageLeftMargin, const long nPageRightMargin);
void ExecuteOrientationChange(const bool bLandscape);
DECL_LINK_TYPED(ImplOrientationHdl, ValueSet*, void);
DECL_LINK_TYPED(ImplOrientationHdl, Button*, void);
};
} } // end of namespace sw::sidebar

View File

@@ -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 <PageOrientationPopup.hxx>
#include "PageOrientationControl.hxx"
#include <svx/pageitem.hxx>
#include <vcl/toolbox.hxx>
SFX_IMPL_TOOLBOX_CONTROL(PageOrientationPopup, SvxPageItem);
PageOrientationPopup::PageOrientationPopup(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx)
: SfxToolBoxControl(nSlotId, nId, rTbx)
{
rTbx.SetItemBits(nId, ToolBoxItemBits::DROPDOWN | rTbx.GetItemBits(nId));
}
PageOrientationPopup::~PageOrientationPopup()
{
}
VclPtr<SfxPopupWindow> PageOrientationPopup::CreatePopupWindow()
{
VclPtr<sw::sidebar::PageOrientationControl> pControl = VclPtr<sw::sidebar::PageOrientationControl>::Create(GetSlotId());
pControl->StartPopupMode(&GetToolBox(), FloatWinPopupFlags::GrabFocus|FloatWinPopupFlags::NoAppFocusClose);
SetPopupWindow(pControl);
return pControl;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -27,7 +27,6 @@
#include "PropertyPanel.hrc"
#include <svx/sidebar/PopupContainer.hxx>
#include "PageOrientationControl.hxx"
#include "PageMarginControl.hxx"
#include "PageSizeControl.hxx"
#include "PageColumnControl.hxx"
@@ -52,7 +51,6 @@
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/document/XUndoManagerSupplier.hpp>
const char UNO_ORIENTATION[] = ".uno:Orientation";
const char UNO_MARGIN[] = ".uno:Margin";
const char UNO_SIZE[] = ".uno:Size";
const char UNO_COLUMN[] = ".uno:Column";
@@ -108,8 +106,6 @@ PagePropertyPanel::PagePropertyPanel(
// image resources
, maImgSize (nullptr)
, maImgSize_L (nullptr)
, mImgPortrait (SW_RES(IMG_PAGE_PORTRAIT))
, mImgLandscape (SW_RES(IMG_PAGE_LANDSCAPE))
, mImgNarrow (SW_RES(IMG_PAGE_NARROW))
, mImgNormal (SW_RES(IMG_PAGE_NORMAL))
, mImgWide (SW_RES(IMG_PAGE_WIDE))
@@ -168,9 +164,6 @@ PagePropertyPanel::PagePropertyPanel(
, m_aSwPageColControl(SID_ATTR_PAGE_COLUMN, *pBindings, *this)
, m_aSwPagePgMetricControl(SID_ATTR_METRIC, *pBindings, *this)
, maOrientationPopup( this,
[this] (svx::sidebar::PopupContainer *parent) { return this->CreatePageOrientationControl(parent); },
OUString("Page orientation") )
, maMarginPopup( this,
[this] (svx::sidebar::PopupContainer *parent) { return this->CreatePageMarginControl(parent); },
OUString("Page margins") )
@@ -186,7 +179,6 @@ PagePropertyPanel::PagePropertyPanel(
, mbInvalidateSIDAttrPageOnSIDAttrPageSizeNotify( false )
{
// visible controls
get(mpToolBoxOrientation, "selectorientation");
get(mpToolBoxMargin, "selectmargin");
get(mpToolBoxSize, "selectsize");
get(mpToolBoxColumn, "selectcolumn");
@@ -212,7 +204,6 @@ void PagePropertyPanel::dispose()
mpPageULMarginItem.reset();
mpPageSizeItem.reset();
mpToolBoxOrientation.clear();
mpToolBoxMargin.clear();
mpToolBoxSize.clear();
mpToolBoxColumn.clear();
@@ -227,24 +218,15 @@ void PagePropertyPanel::dispose()
maColumnPopup.dispose();
maSizePopup.dispose();
maMarginPopup.dispose();
maOrientationPopup.dispose();
PanelLayout::dispose();
}
void PagePropertyPanel::Initialize()
{
// popup for page orientation
const sal_uInt16 nIdOrientation = mpToolBoxOrientation->GetItemId(UNO_ORIENTATION);
Link<ToolBox *, void> aLink = LINK( this, PagePropertyPanel, ClickOrientationHdl );
mpToolBoxOrientation->SetDropdownClickHdl( aLink );
mpToolBoxOrientation->SetSelectHdl( aLink );
mpToolBoxOrientation->SetItemImage( nIdOrientation, mImgPortrait);
mpToolBoxOrientation->SetItemBits( nIdOrientation, mpToolBoxOrientation->GetItemBits( nIdOrientation ) | ToolBoxItemBits::DROPDOWNONLY );
// popup for page margins
const sal_uInt16 nIdMargin = mpToolBoxMargin->GetItemId(UNO_MARGIN);
aLink = LINK( this, PagePropertyPanel, ClickMarginHdl );
Link<ToolBox *, void> aLink = LINK( this, PagePropertyPanel, ClickMarginHdl );
mpToolBoxMargin->SetDropdownClickHdl( aLink );
mpToolBoxMargin->SetSelectHdl( aLink );
mpToolBoxMargin->SetItemImage(nIdMargin, mImgNormal);
@@ -294,82 +276,6 @@ void PagePropertyPanel::Initialize()
mpBindings->Update( SID_ATTR_PAGE_SIZE );
}
VclPtr< svx::sidebar::PopupControl> PagePropertyPanel::CreatePageOrientationControl( svx::sidebar::PopupContainer* pParent )
{
return VclPtr<PageOrientationControl>::Create( pParent, *this , mpPageItem->IsLandscape() );
}
IMPL_LINK_TYPED( PagePropertyPanel, ClickOrientationHdl, ToolBox*, pToolBox, void )
{
maOrientationPopup.Show( *pToolBox );
}
void PagePropertyPanel::ExecuteOrientationChange( const bool bLandscape )
{
StartUndo();
{
// set new page orientation
mpPageItem->SetLandscape( bLandscape );
// swap the width and height of the page size
const long nRotatedWidth = mpPageSizeItem->GetSize().Height();
const long nRotatedHeight = mpPageSizeItem->GetSize().Width();
mpPageSizeItem->SetSize(Size(nRotatedWidth, nRotatedHeight));
// apply changed attributes
GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_SIZE,
SfxCallMode::RECORD, { mpPageSizeItem.get(), mpPageItem.get() });
}
// check, if margin values still fit to the changed page size.
// if not, adjust margin values
{
const long nML = mpPageLRMarginItem->GetLeft();
const long nMR = mpPageLRMarginItem->GetRight();
const long nTmpPW = nML + nMR + MINBODY;
const long nPW = mpPageSizeItem->GetSize().Width();
if ( nTmpPW > nPW )
{
if ( nML <= nMR )
{
ExecuteMarginLRChange( mpPageLRMarginItem->GetLeft(), nMR - (nTmpPW - nPW ) );
}
else
{
ExecuteMarginLRChange( nML - (nTmpPW - nPW ), mpPageLRMarginItem->GetRight() );
}
}
const long nMT = mpPageULMarginItem->GetUpper();
const long nMB = mpPageULMarginItem->GetLower();
const long nTmpPH = nMT + nMB + MINBODY;
const long nPH = mpPageSizeItem->GetSize().Height();
if ( nTmpPH > nPH )
{
if ( nMT <= nMB )
{
ExecuteMarginULChange( mpPageULMarginItem->GetUpper(), nMB - ( nTmpPH - nPH ) );
}
else
{
ExecuteMarginULChange( nMT - ( nTmpPH - nPH ), mpPageULMarginItem->GetLower() );
}
}
}
EndUndo();
}
void PagePropertyPanel::ClosePageOrientationPopup()
{
maOrientationPopup.Hide();
}
VclPtr< svx::sidebar::PopupControl> PagePropertyPanel::CreatePageMarginControl( svx::sidebar::PopupContainer* pParent )
{
return VclPtr<PageMarginControl>::Create(
@@ -524,26 +430,6 @@ void PagePropertyPanel::NotifyItemUpdate(
}
break;
case SID_ATTR_PAGE:
if ( eState >= SfxItemState::DEFAULT &&
pState && dynamic_cast< const SvxPageItem *>( pState ) != nullptr )
{
const sal_uInt16 nIdOrientation = mpToolBoxOrientation->GetItemId(UNO_ORIENTATION);
mpPageItem.reset( static_cast<SvxPageItem*>(pState->Clone()) );
if ( mpPageItem->IsLandscape() )
{
mpToolBoxOrientation->SetItemImage(nIdOrientation, mImgLandscape);
}
else
{
mpToolBoxOrientation->SetItemImage(nIdOrientation, mImgPortrait);
}
ChangeMarginImage();
ChangeSizeImage();
ChangeColumnImage( mpPageColumnTypeItem->GetValue() );
}
break;
case SID_ATTR_PAGE_SIZE:
if ( mbInvalidateSIDAttrPageOnSIDAttrPageSizeNotify )
{

View File

@@ -21,8 +21,6 @@
#include "PropertyPanel.hrc"
// global definitions
#define IMG_PAGE_PORTRAIT (RC_SIDEBAR_BEGIN + 0)
#define IMG_PAGE_LANDSCAPE (RC_SIDEBAR_BEGIN + 1)
#define IMG_PAGE_NARROW (RC_SIDEBAR_BEGIN + 2)
#define IMG_PAGE_NORMAL (RC_SIDEBAR_BEGIN + 3)
#define IMG_PAGE_WIDE (RC_SIDEBAR_BEGIN + 4)
@@ -65,10 +63,6 @@
#define IMG_PAGE_COLUMN_NONE_L (RC_SIDEBAR_BEGIN + 41)
// local
#define IMG_PORTRAIT 10
#define IMG_LANDSCAPE 11
#define STR_PORTRAIT 12
#define STR_LANDSCAPE 13
#define MF_SWLEFT_MARGIN 18
#define MF_SWRIGHT_MARGIN 19
@@ -79,7 +73,6 @@
#define FT_CUSTOM 25
#define FLD_WIDTH_HEIGHT 26
#define VS_ORIENTATION 29
#define IMG_NARROW 32
#define IMG_NORMAL 33
#define IMG_WIDE 34

View File

@@ -71,10 +71,6 @@ namespace sw { namespace sidebar {
return mpBindings;
}
VclPtr< svx::sidebar::PopupControl> CreatePageOrientationControl( svx::sidebar::PopupContainer* pParent );
void ExecuteOrientationChange( const bool bLandscape );
void ClosePageOrientationPopup();
VclPtr< svx::sidebar::PopupControl> CreatePageMarginControl( svx::sidebar::PopupContainer* pParent );
void ExecuteMarginLRChange(
const long nPageLeftMargin,
@@ -107,15 +103,12 @@ namespace sw { namespace sidebar {
SfxBindings* mpBindings;
// toolboxes - on click open corresponding popup
VclPtr<ToolBox> mpToolBoxOrientation;
VclPtr<ToolBox> mpToolBoxMargin;
VclPtr<ToolBox> mpToolBoxSize;
VclPtr<ToolBox> mpToolBoxColumn;
Image* maImgSize;
Image* maImgSize_L;
Image mImgPortrait;
Image mImgLandscape;
Image mImgNarrow;
Image mImgNormal;
Image mImgWide;
@@ -189,7 +182,6 @@ namespace sw { namespace sidebar {
::sfx2::sidebar::ControllerItem m_aSwPagePgMetricControl;
// popups
svx::sidebar::Popup maOrientationPopup;
svx::sidebar::Popup maMarginPopup;
svx::sidebar::Popup maSizePopup;
svx::sidebar::Popup maColumnPopup;
@@ -199,7 +191,6 @@ namespace sw { namespace sidebar {
bool mbInvalidateSIDAttrPageOnSIDAttrPageSizeNotify;
// handler for popup toolboxes to show the popups
DECL_LINK_TYPED(ClickOrientationHdl, ToolBox*, void);
DECL_LINK_TYPED(ClickMarginHdl, ToolBox*, void);
DECL_LINK_TYPED(ClickSizeHdl, ToolBox*, void);
DECL_LINK_TYPED(ClickColumnHdl, ToolBox*, void);

View File

@@ -22,7 +22,6 @@
#include "rcid.hrc"
#define RID_POPUP_SWPAGE_MARGIN (RC_PROPERTYPANEL_BEGIN + 3)
#define RID_POPUP_SWPAGE_ORIENTATION (RC_PROPERTYPANEL_BEGIN + 4)
#define RID_POPUP_SWPAGE_COLUMN (RC_PROPERTYPANEL_BEGIN + 5)
#define RID_POPUP_SWPAGE_SIZE (RC_PROPERTYPANEL_BEGIN + 6)

View File

@@ -147,6 +147,7 @@ void SwView::GetState(SfxItemSet &rSet)
case SID_PRINTDOCDIRECT:
GetSlotState( nWhich, SfxViewShell::GetInterface(), &rSet );
break;
case SID_ATTR_PAGE_ORIENTATION:
case SID_ATTR_PAGE:
case SID_ATTR_PAGE_SIZE:
case SID_ATTR_PAGE_PAPERBIN:

View File

@@ -2650,6 +2650,80 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="sfxlo-DropdownBox" id="ParaSpacingSection">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="sfxlo-NotebookbarToolBox" id="ulspacing">
<property name="width_request">210</property>
<property name="height_request">72</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes">Indent</property>
<child>
<object class="GtkToolButton" id="ULSpacing">
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="is_important">True</property>
<property name="action_name">.uno:ULSpacing</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">0</property>
</packing>
</child>
<child>
<object class="sfxlo-NotebookbarToolBox" id="lrspacing">
<property name="width_request">200</property>
<property name="height_request">72</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes">Indent</property>
<child>
<object class="GtkToolButton" id="LeftRightParaMargin">
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="is_important">True</property>
<property name="action_name">.uno:LeftRightParaMargin</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">1</property>
</packing>
</child>
<style>
<class name="priority-3"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="sfxlo-DropdownBox" id="box15">
<property name="visible">True</property>
@@ -2726,6 +2800,33 @@
<property name="position">2</property>
</packing>
</child>
<child>
<object class="sfxlo-BigToolBox" id="orientationbox">
<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="Orientation">
<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:Orientation</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="GtkSeparator" id="separator21">
<property name="visible">True</property>
@@ -2735,7 +2836,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>
@@ -2752,81 +2853,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">5</property>
</packing>
</child>
<child>
<object class="sfxlo-DropdownBox" id="ParaSpacingSection">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="sfxlo-NotebookbarToolBox" id="ulspacing">
<property name="width_request">210</property>
<property name="height_request">72</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes">Indent</property>
<child>
<object class="GtkToolButton" id="ULSpacing">
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="is_important">True</property>
<property name="action_name">.uno:ULSpacing</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">0</property>
</packing>
</child>
<child>
<object class="sfxlo-NotebookbarToolBox" id="lrspacing">
<property name="width_request">200</property>
<property name="height_request">72</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes">Indent</property>
<child>
<object class="GtkToolButton" id="LeftRightParaMargin">
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="is_important">True</property>
<property name="action_name">.uno:LeftRightParaMargin</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">1</property>
</packing>
</child>
<style>
<class name="priority-3"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">5</property>
<property name="position">6</property>
</packing>
</child>
</object>

View File

@@ -0,0 +1,71 @@
<?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_landscape">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixbuf">sw/res/sidebar/pageproppanel/Landscapecopy_24x24.png</property>
</object>
<object class="GtkImage" id="image_portrait">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixbuf">cmd/lc_orientation.png</property>
</object>
<object class="GtkWindow" id="PageOrientationControl">
<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="portrait">
<property name="label" translatable="yes">Portrait</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="image">image_portrait</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="landscape">
<property name="label" translatable="yes">Landscape</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Single</property>
<property name="image">image_landscape</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>
</object>
</child>
</object>
</interface>

View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<!-- interface-requires gtk+ 3.0 -->
<requires lib="gtk+" version="3.0"/>
<object class="GtkGrid" id="PagePropertyPanel">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -16,7 +17,7 @@
<property name="column_spacing">6</property>
<property name="column_homogeneous">True</property>
<child>
<object class="GtkToolbar" id="selectorientation">
<object class="sfxlo-SidebarToolBox" id="selectorientation">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
@@ -27,9 +28,7 @@
<property name="can_focus">False</property>
<property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes">Orientation</property>
<property name="use_action_appearance">False</property>
<property name="action_name">.uno:Orientation</property>
<property name="label" translatable="no">toolbutton1</property>
<property name="use_underline">True</property>
</object>
<packing>
@@ -41,8 +40,6 @@
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
@@ -57,9 +54,8 @@
<property name="can_focus">False</property>
<property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes">Size</property>
<property name="use_action_appearance">False</property>
<property name="action_name">.uno:Size</property>
<property name="label" translatable="no">toolbutton3</property>
<property name="label">toolbutton3</property>
<property name="use_underline">True</property>
</object>
<packing>
@@ -71,8 +67,6 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
@@ -88,9 +82,8 @@
<property name="can_focus">False</property>
<property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes">Columns</property>
<property name="use_action_appearance">False</property>
<property name="action_name">.uno:Column</property>
<property name="label" translatable="no">toolbutton4</property>
<property name="label">toolbutton4</property>
<property name="use_underline">True</property>
</object>
<packing>
@@ -102,8 +95,6 @@
<packing>
<property name="left_attach">3</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
@@ -118,9 +109,8 @@
<property name="can_focus">False</property>
<property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes">Margin</property>
<property name="use_action_appearance">False</property>
<property name="action_name">.uno:Margin</property>
<property name="label" translatable="no">toolbutton2</property>
<property name="label">toolbutton2</property>
<property name="use_underline">True</property>
</object>
<packing>
@@ -132,16 +122,12 @@
<packing>
<property name="left_attach">2</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>