diff options
author | Oliver-Rainer Wittmann <orw@apache.org> | 2013-04-10 08:20:16 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2013-05-20 11:33:10 +0100 |
commit | d02f75a8c36705924ddd6a5921fe3012fafce812 (patch) | |
tree | 40da9f25714a77f5e9e17ef7bee81c33a1a11b4b /sc/source/ui/sidebar | |
parent | d8d55787b81cdc955b73c8befa4ab608f46e32aa (diff) |
Resolves: #i121420# merge sidebar feature
(cherry picked from commit 0a0a9b32aa5bf1ce2554ad37cbba3c7a105db2b5)
Conflicts:
chart2/source/controller/dialogs/dlg_View3D.cxx
chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx
chart2/source/controller/drawinglayer/ViewElementListProvider.cxx
chart2/source/controller/inc/ViewElementListProvider.hxx
chart2/source/controller/inc/dlg_View3D.hxx
chart2/source/controller/main/ShapeController.cxx
chart2/source/inc/chartview/DrawModelWrapper.hxx
chart2/source/view/main/DrawModelWrapper.cxx
cui/source/inc/border.hxx
cui/source/inc/cuitabarea.hxx
cui/source/inc/cuitabline.hxx
cui/source/inc/sdrcelldlg.hxx
cui/source/inc/treeopt.hxx
cui/source/options/optchart.cxx
cui/source/options/optchart.hxx
cui/source/options/optcolor.cxx
cui/source/options/treeopt.cxx
cui/source/tabpages/backgrnd.cxx
cui/source/tabpages/border.cxx
cui/source/tabpages/chardlg.cxx
cui/source/tabpages/numpages.cxx
cui/source/tabpages/tpcolor.cxx
cui/source/tabpages/tplneend.cxx
editeng/inc/editeng/outliner.hxx
extensions/source/propctrlr/standardcontrol.cxx
framework/source/register/registerservices.cxx
offapi/com/sun/star/ui/makefile.mk
officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
officecfg/registry/data/org/openoffice/Office/UI/makefile.mk
officecfg/registry/schema/org/openoffice/Office/UI/makefile.mk
postprocess/packregistry/makefile.mk
reportdesign/source/ui/dlg/Condition.cxx
reportdesign/source/ui/misc/UITools.cxx
sc/inc/document.hxx
sc/inc/helpids.h
sc/inc/sc.hrc
sc/prj/build.lst
sc/sdi/scalc.sdi
sc/source/core/data/documen9.cxx
sc/source/core/data/drwlayer.cxx
sc/source/ui/app/scdll.cxx
sc/source/ui/app/typemap.cxx
sc/source/ui/dbgui/scendlg.cxx
sc/source/ui/docshell/docsh2.cxx
sc/source/ui/docshell/docsh4.cxx
sc/source/ui/drawfunc/chartsh.cxx
sc/source/ui/drawfunc/drawsh.cxx
sc/source/ui/drawfunc/drawsh2.cxx
sc/source/ui/drawfunc/drawsh4.cxx
sc/source/ui/drawfunc/drformsh.cxx
sc/source/ui/drawfunc/drtxtob.cxx
sc/source/ui/drawfunc/drtxtob1.cxx
sc/source/ui/drawfunc/drtxtob2.cxx
sc/source/ui/drawfunc/graphsh.cxx
sc/source/ui/drawfunc/oleobjsh.cxx
sc/source/ui/inc/chartsh.hxx
sc/source/ui/inc/formatsh.hxx
sc/source/ui/miscdlgs/tabbgcolordlg.cxx
sc/source/ui/navipi/navipi.cxx
sc/source/ui/optdlg/opredlin.cxx
sc/source/ui/optdlg/tpview.cxx
sc/source/ui/sidebar/makefile.mk
sc/source/ui/view/auditsh.cxx
sc/source/ui/view/cellsh.cxx
sc/source/ui/view/editsh.cxx
sc/source/ui/view/formatsh.cxx
sc/source/ui/view/pivotsh.cxx
sc/source/ui/view/tabvwsh.cxx
sc/util/makefile.mk
sd/inc/sdabstdlg.hxx
sd/prj/build.lst
sd/sdi/ToolPanelViewShell.sdi
sd/sdi/makefile.mk
sd/source/ui/accessibility/makefile.mk
sd/source/ui/animations/CustomAnimationDialog.cxx
sd/source/ui/dlg/PaneChildWindows.cxx
sd/source/ui/dlg/PaneShells.cxx
sd/source/ui/dlg/copydlg.cxx
sd/source/ui/dlg/navigatr.cxx
sd/source/ui/dlg/sddlgfact.cxx
sd/source/ui/dlg/sddlgfact.hxx
sd/source/ui/docshell/docshel3.cxx
sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.cxx
sd/source/ui/framework/factories/TaskPanelFactory.cxx
sd/source/ui/framework/factories/TaskPanelFactory.hxx
sd/source/ui/framework/factories/ViewShellWrapper.cxx
sd/source/ui/framework/factories/makefile.mk
sd/source/ui/framework/module/ImpressModule.cxx
sd/source/ui/framework/module/ToolPanelModule.cxx
sd/source/ui/framework/tools/FrameworkHelper.cxx
sd/source/ui/func/fuolbull.cxx
sd/source/ui/inc/DrawViewShell.hxx
sd/source/ui/inc/PaneChildWindows.hxx
sd/source/ui/inc/celltempl.hxx
sd/source/ui/inc/copydlg.hxx
sd/source/ui/inc/dlgpage.hxx
sd/source/ui/inc/framework/FrameworkHelper.hxx
sd/source/ui/inc/prltempl.hxx
sd/source/ui/inc/tabtempl.hxx
sd/source/ui/inc/taskpane/ILayoutableWindow.hxx
sd/source/ui/inc/taskpane/PanelId.hxx
sd/source/ui/inc/tpaction.hxx
sd/source/ui/sidebar/AllMasterPagesSelector.cxx
sd/source/ui/sidebar/AllMasterPagesSelector.hxx
sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx
sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx
sd/source/ui/sidebar/DocumentHelper.cxx
sd/source/ui/sidebar/DocumentHelper.hxx
sd/source/ui/sidebar/LayoutMenu.cxx
sd/source/ui/sidebar/LayoutMenu.hxx
sd/source/ui/sidebar/MasterPageContainer.cxx
sd/source/ui/sidebar/MasterPageContainer.hxx
sd/source/ui/sidebar/MasterPageContainerFiller.cxx
sd/source/ui/sidebar/MasterPageContainerFiller.hxx
sd/source/ui/sidebar/MasterPageContainerProviders.cxx
sd/source/ui/sidebar/MasterPageContainerProviders.hxx
sd/source/ui/sidebar/MasterPageContainerQueue.cxx
sd/source/ui/sidebar/MasterPageContainerQueue.hxx
sd/source/ui/sidebar/MasterPageDescriptor.cxx
sd/source/ui/sidebar/MasterPageDescriptor.hxx
sd/source/ui/sidebar/MasterPageObserver.cxx
sd/source/ui/sidebar/MasterPagesSelector.cxx
sd/source/ui/sidebar/MasterPagesSelector.hxx
sd/source/ui/sidebar/PreviewValueSet.cxx
sd/source/ui/sidebar/PreviewValueSet.hxx
sd/source/ui/sidebar/RecentMasterPagesSelector.cxx
sd/source/ui/sidebar/RecentlyUsedMasterPages.cxx
sd/source/ui/sidebar/SidebarShellManager.cxx
sd/source/ui/sidebar/SlideTransitionPanel.hxx
sd/source/ui/sidebar/makefile.mk
sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
sd/source/ui/table/TableDesignPane.hxx
sd/source/ui/toolpanel/ControlContainer.cxx
sd/source/ui/toolpanel/ControlContainerDescriptor.hxx
sd/source/ui/toolpanel/MethodGuard.hxx
sd/source/ui/toolpanel/ScrollPanel.cxx
sd/source/ui/toolpanel/SlideSorterCacheDisplay.cxx
sd/source/ui/toolpanel/SubToolPanel.cxx
sd/source/ui/toolpanel/TaskPaneFocusManager.cxx
sd/source/ui/toolpanel/TaskPaneTreeNode.cxx
sd/source/ui/toolpanel/TitleBar.cxx
sd/source/ui/toolpanel/TitledControl.cxx
sd/source/ui/toolpanel/ToolPanel.cxx
sd/source/ui/toolpanel/ToolPanel.hxx
sd/source/ui/toolpanel/ToolPanelFactory.cxx
sd/source/ui/toolpanel/ToolPanelUIElement.cxx
sd/source/ui/toolpanel/ToolPanelUIElement.hxx
sd/source/ui/toolpanel/ToolPanelViewShell.cxx
sd/source/ui/toolpanel/controls/CustomAnimationPanel.cxx
sd/source/ui/toolpanel/controls/CustomAnimationPanel.hxx
sd/source/ui/toolpanel/controls/MasterPagesPanel.cxx
sd/source/ui/toolpanel/controls/MasterPagesPanel.hxx
sd/source/ui/toolpanel/controls/SlideTransitionPanel.cxx
sd/source/ui/toolpanel/controls/SlideTransitionPanel.hxx
sd/source/ui/toolpanel/controls/TableDesignPanel.cxx
sd/source/ui/toolpanel/controls/TableDesignPanel.hxx
sd/source/ui/unoidl/UnoDocumentSettings.cxx
sd/source/ui/view/ViewShellBase.cxx
sd/source/ui/view/drtxtob.cxx
sd/source/ui/view/drviews3.cxx
sd/source/ui/view/drviews7.cxx
sd/source/ui/view/drviewsa.cxx
sd/source/ui/view/drviewsf.cxx
sd/source/ui/view/outlnvsh.cxx
sd/source/ui/view/sdview.cxx
sd/source/ui/view/viewshel.cxx
sd/uiconfig/sdraw/menubar/menubar.xml
sd/util/makefile.mk
sfx2/Package_inc.mk
sfx2/inc/sfx2/sfx.hrc
sfx2/inc/sfx2/sfxsids.hrc
sfx2/source/control/bindings.cxx
sfx2/source/dialog/templdlg.cxx
sfx2/source/inc/templdgi.hxx
svx/AllLangResTarget_svx.mk
svx/Package_inc.mk
svx/inc/svx/XPropertyTable.hxx
svx/inc/svx/bmpmask.hxx
svx/inc/svx/colrctrl.hxx
svx/inc/svx/dialogs.hrc
svx/inc/svx/dlgctrl.hxx
svx/inc/svx/dlgutil.hxx
svx/inc/svx/drawitem.hxx
svx/inc/svx/fontwork.hxx
svx/inc/svx/galbrws.hxx
svx/inc/svx/sdr/table/tablecontroller.hxx
svx/inc/svx/svdmodel.hxx
svx/inc/svx/svdstr.hrc
svx/inc/svx/svxids.hrc
svx/inc/svx/svxitems.hrc
svx/inc/svx/xattr.hxx
svx/inc/svx/xflgrit.hxx
svx/inc/svx/xflhtit.hxx
svx/inc/svx/xit.hxx
svx/inc/svx/xlineit.hxx
svx/inc/svx/xlndsit.hxx
svx/inc/svx/xlnedit.hxx
svx/inc/svx/xlnstit.hxx
svx/inc/svx/xtable.hxx
svx/sdi/svx.sdi
svx/source/dialog/_bmpmask.cxx
svx/source/dialog/dialcontrol.cxx
svx/source/dialog/dlgctrl.cxx
svx/source/dialog/dlgutil.cxx
svx/source/dialog/fontwork.cxx
svx/source/gallery2/galbrws.cxx
svx/source/gallery2/galbrws1.cxx
svx/source/gallery2/gallery1.cxx
svx/source/items/drawitem.cxx
svx/source/items/svxitems.src
svx/source/sdr/attribute/sdrformtextattribute.cxx
svx/source/sidebar/ColorPanel.hxx
svx/source/sidebar/EmptyPanel.hrc
svx/source/sidebar/EmptyPanel.hxx
svx/source/sidebar/gallery/GalleryPanel.hxx
svx/source/svdraw/svdedtv1.cxx
svx/source/svdraw/svdmodel.cxx
svx/source/svdraw/svdogrp.cxx
svx/source/svdraw/svdstr.src
svx/source/tbxctrls/tbcontrl.cxx
svx/source/unodraw/XPropertyTable.cxx
svx/source/unodraw/unoctabl.cxx
svx/source/xoutdev/XPropertyEntry.cxx
svx/source/xoutdev/xattr.cxx
svx/source/xoutdev/xattr2.cxx
svx/source/xoutdev/xtabbtmp.cxx
svx/source/xoutdev/xtabcolr.cxx
svx/source/xoutdev/xtabdash.cxx
svx/source/xoutdev/xtabgrdt.cxx
svx/source/xoutdev/xtabhtch.cxx
svx/source/xoutdev/xtable.cxx
svx/source/xoutdev/xtablend.cxx
svx/util/svx.component
sw/inc/cmdid.h
sw/inc/docsh.hxx
sw/inc/editsh.hxx
sw/inc/helpid.h
sw/inc/rcid.hrc
sw/inc/swabstdlg.hxx
sw/inc/swcommands.h
sw/sdi/swriter.sdi
sw/source/core/doc/docdesc.cxx
sw/source/core/draw/drawdoc.cxx
sw/source/ui/app/docsh2.cxx
sw/source/ui/app/docshdrw.cxx
sw/source/ui/app/docshini.cxx
sw/source/ui/app/docst.cxx
sw/source/ui/config/optpage.cxx
sw/source/ui/dialog/swdlgfact.cxx
sw/source/ui/dialog/swdlgfact.hxx
sw/source/ui/fmtui/tmpdlg.cxx
sw/source/ui/inc/tmpdlg.hxx
sw/source/ui/misc/pggrid.cxx
sw/source/ui/shells/annotsh.cxx
sw/source/ui/shells/basesh.cxx
sw/source/ui/shells/beziersh.cxx
sw/source/ui/shells/drawdlg.cxx
sw/source/ui/shells/drawsh.cxx
sw/source/ui/shells/drformsh.cxx
sw/source/ui/shells/drwbassh.cxx
sw/source/ui/shells/drwtxtex.cxx
sw/source/ui/shells/drwtxtsh.cxx
sw/source/ui/shells/frmsh.cxx
sw/source/ui/shells/grfsh.cxx
sw/source/ui/shells/olesh.cxx
sw/source/ui/shells/tabsh.cxx
sw/source/ui/shells/textsh.cxx
sw/source/ui/shells/textsh1.cxx
sw/source/ui/shells/txtnum.cxx
sw/source/ui/uiview/viewtab.cxx
sw/source/ui/uno/unofreg.cxx
sw/source/ui/utlui/navipi.cxx
sw/util/sw.component
vcl/inc/vcl/split.hxx
vcl/inc/vcl/window.hxx
vcl/inc/window.h
vcl/source/window/split.cxx
vcl/source/window/window.cxx
vcl/source/window/window4.cxx
Change-Id: Idebaff59f9d60e4e93290cefefdda4c5a1e9215e
Resolves: #i122194# Adapted license text in propertypanel.hrc
then renamed it to ResourceDefinitions.hrc
(cherry picked from commit e952d1401c1adc41934118ba7f542611ef9da11b)
Conflicts:
sfx2/Package_inc.mk
sfx2/source/sidebar/SidebarChildWindow.cxx
svx/source/sidebar/graphic/GraphicPropertyPanel.cxx
svx/source/sidebar/line/LinePropertyPanel.cxx
svx/source/sidebar/possize/PosSizePropertyPanel.cxx
sw/source/ui/sidebar/PagePropertyPanel.src
sw/source/ui/sidebar/WrapPropertyPanel.src
Change-Id: Ie009056a78ab108556717a501399c83b477b3548
Resolves: #i122194# finally I got the correct file name
Change-Id: If7a075af8c9a829f6f0a69f883c5c6d4ac97ba2a
More merge changes for optional sidebar:
revert toolpanel removal, restore and re-enable task pane
remove apparently un-used SidebarFactory module
add extra visibility annotation to ItemReceiverUpdate
Diffstat (limited to 'sc/source/ui/sidebar')
25 files changed, 4916 insertions, 0 deletions
diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx new file mode 100644 index 000000000000..3fb7bb278bb8 --- /dev/null +++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx @@ -0,0 +1,632 @@ +/* + * 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 <sfx2/sidebar/ResourceDefinitions.hrc> +#include <sfx2/sidebar/Theme.hxx> +#include <sfx2/sidebar/ControlFactory.hxx> +#include <AlignmentPropertyPanel.hxx> +#include <AlignmentPropertyPanel.hrc> +#include <editeng/justifyitem.hxx> +#include <svx/dialmgr.hxx> +#include "sc.hrc" +#include "scresid.hxx" +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <svx/algitem.hxx> +#include <svx/dlgutil.hxx> +#include <vcl/toolbox.hxx> +#include <svx/sidebar/SidebarDialControl.hxx> + +using namespace css; +using namespace cssu; +using ::sfx2::sidebar::ControlFactory; + +#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) + +////////////////////////////////////////////////////////////////////////////// +// namespace open + +namespace sc { namespace sidebar { + +////////////////////////////////////////////////////////////////////////////// + +AlignmentPropertyPanel::AlignmentPropertyPanel( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings) + : Control( + pParent, + ScResId(RID_PROPERTYPANEL_SC_ALIGNMENT)), + mpTBHorizontalBackground(ControlFactory::CreateToolBoxBackground(this)), + mpTBHorizontal(ControlFactory::CreateToolBox( + mpTBHorizontalBackground.get(), + ScResId(TBX_HORIZONTAL_ALIGNMENT))), + mpTBVerticalBackground(ControlFactory::CreateToolBoxBackground(this)), + mpTBVertical(ControlFactory::CreateToolBox( + mpTBVerticalBackground.get(), + ScResId(TBX_VERTICAL_ALIGN))), + mpFTLeftIndent(new FixedText(this, ScResId(FT_LEFT_INDENT))), + mpMFLeftIndent(new MetricField(this, ScResId(MF_LEFT_INDENT))), + mpCBXWrapText(new CheckBox(this, ScResId(CBX_WRAP))), + mpCBXMergeCell(new CheckBox(this, ScResId(CBX_MERGE))), + mpFtRotate(new FixedText(this, ScResId(FT_ORIENT))), + mpCtrlDial(new svx::sidebar::SidebarDialControl(this, ScResId(DIAL_CONTROL))), // , true)), + mpMtrAngle(new MetricBox(this, ScResId(CBOX_ANGLE))), + mpCbStacked(new CheckBox(this, ScResId(CBX_VERT))), + maAlignHorControl(SID_H_ALIGNCELL, *pBindings, *this), + maAlignVerControl(SID_V_ALIGNCELL, *pBindings, *this), + maLeftIndentControl(SID_ATTR_ALIGN_INDENT, *pBindings, *this), + maMergeCellControl(FID_MERGE_TOGGLE, *pBindings, *this), + maWrapTextControl(SID_ATTR_ALIGN_LINEBREAK, *pBindings, *this), + maAngleControl(SID_ATTR_ALIGN_DEGREES, *pBindings, *this), + maStackControl(SID_ATTR_ALIGN_STACKED, *pBindings, *this), + maIMGAlignLeft(ScResId(IMG_ALIGN_LEFT)), + maIMGAlignCenter(ScResId(IMG_ALIGN_CENTER)), + maIMGAlignRight(ScResId(IMG_ALIGN_RIGHT)), + maIMGAlignJust(ScResId(IMG_ALIGN_JUST)), + maIMGAlignTop(ScResId(IMG_ALIGN_TOP)), + maIMGAlignCenterV(ScResId(IMG_ALIGN_CENTER_V)), + maIMGAlignBottom(ScResId(IMG_ALIGN_BOTTOM)), + meHorAlignState(SVX_HOR_JUSTIFY_STANDARD), + meVerAlignState(SVX_VER_JUSTIFY_STANDARD), + mbMultiDisable(false), + mxFrame(rxFrame), + maContext(), + mpBindings(pBindings) +{ + Initialize(); + FreeResource(); + + mpFTLeftIndent->SetBackground(Wallpaper()); + mpFtRotate->SetBackground(Wallpaper()); +} + +////////////////////////////////////////////////////////////////////////////// + +AlignmentPropertyPanel::~AlignmentPropertyPanel() +{ +} + +////////////////////////////////////////////////////////////////////////////// + +void AlignmentPropertyPanel::Initialize() +{ + mpTBHorizontal->SetItemImage(ID_SUBSTLEFT, maIMGAlignLeft); + mpTBHorizontal->SetItemImage(ID_SUBSTCENTER, maIMGAlignCenter); + mpTBHorizontal->SetItemImage(ID_SUBSTRIGHT, maIMGAlignRight); + mpTBHorizontal->SetItemImage(ID_SUBSTJUSTIFY, maIMGAlignJust); + Size aTbxSize( mpTBHorizontal->CalcWindowSizePixel() ); + mpTBHorizontal->SetOutputSizePixel( aTbxSize ); + mpTBHorizontal->SetBackground(Wallpaper()); + mpTBHorizontal->SetPaintTransparent(true); + Link aLink = LINK(this, AlignmentPropertyPanel, TbxHorAlignSelectHdl); + mpTBHorizontal->SetSelectHdl ( aLink ); + + mpTBVertical->SetItemImage(IID_VERT_TOP, maIMGAlignTop); + mpTBVertical->SetItemImage(IID_VERT_CENTER, maIMGAlignCenterV); + mpTBVertical->SetItemImage(IID_VERT_BOTTOM, maIMGAlignBottom); + Size aTbxSize2( mpTBVertical->CalcWindowSizePixel() ); + mpTBVertical->SetOutputSizePixel( aTbxSize2 ); + mpTBVertical->SetBackground(Wallpaper()); + mpTBVertical->SetPaintTransparent(true); + aLink = LINK(this, AlignmentPropertyPanel, TbxVerAlignSelectHdl); + mpTBVertical->SetSelectHdl ( aLink ); + + mpFTLeftIndent->Disable(); + mpMFLeftIndent->Disable(); + mpMFLeftIndent->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Left Indent"))); //wj acc + aLink = LINK(this, AlignmentPropertyPanel, MFLeftIndentMdyHdl); + mpMFLeftIndent->SetModifyHdl ( aLink ); + + aLink = LINK(this, AlignmentPropertyPanel, CBOXMergnCellClkHdl); + mpCBXMergeCell->SetClickHdl ( aLink ); + + aLink = LINK(this, AlignmentPropertyPanel, CBOXWrapTextClkHdl); + mpCBXWrapText->SetClickHdl ( aLink ); + + //rotation control + mpCtrlDial->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Text Orientation"))); //wj acc + mpCtrlDial->SetModifyHdl(LINK( this, AlignmentPropertyPanel, RotationHdl)); + + //rotation + mpMtrAngle->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Text Orientation"))); //wj acc + mpMtrAngle->SetModifyHdl(LINK( this, AlignmentPropertyPanel, AngleModifiedHdl)); + mpMtrAngle->EnableAutocomplete( false ); + + //Vertical stacked + mpCbStacked->SetClickHdl( LINK( this, AlignmentPropertyPanel, ClickStackHdl ) ); + + mpMtrAngle->InsertValue(0, FUNIT_CUSTOM); + mpMtrAngle->InsertValue(45, FUNIT_CUSTOM); + mpMtrAngle->InsertValue(90, FUNIT_CUSTOM); + mpMtrAngle->InsertValue(135, FUNIT_CUSTOM); + mpMtrAngle->InsertValue(180, FUNIT_CUSTOM); + mpMtrAngle->InsertValue(225, FUNIT_CUSTOM); + mpMtrAngle->InsertValue(270, FUNIT_CUSTOM); + mpMtrAngle->InsertValue(315, FUNIT_CUSTOM); + mpMtrAngle->SetDropDownLineCount(mpMtrAngle->GetEntryCount()); + + mpTBHorizontal->SetAccessibleRelationLabeledBy(mpTBHorizontal.get()); + mpTBVertical->SetAccessibleRelationLabeledBy(mpTBVertical.get()); + mpMFLeftIndent->SetAccessibleRelationLabeledBy(mpFTLeftIndent.get()); + mpMtrAngle->SetAccessibleRelationLabeledBy(mpFtRotate.get()); +#ifdef HAS_IA2 + mpMtrAngle->SetMpSubEditAccLableBy(mpFtRotate.get()); +#endif +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK( AlignmentPropertyPanel, AngleModifiedHdl, void *, EMPTYARG ) +{ + OUString sTmp = mpMtrAngle->GetText(); + + sal_Unicode nChar = sTmp.isEmpty() ? 0 : sTmp[0]; + if((sTmp.getLength()== 1 && nChar == '-') || + (nChar != '-' && ((nChar < '0') || (nChar > '9') ) )) ////modify + return 0; + + double dTmp = sTmp.toDouble(); + FormatDegrees(dTmp); + + sal_Int64 nTmp = (sal_Int64)dTmp*100; + SfxInt32Item aAngleItem( SID_ATTR_ALIGN_DEGREES,(sal_uInt32) nTmp); + + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_ALIGN_DEGREES, SFX_CALLMODE_RECORD, &aAngleItem, 0L ); + return 0; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK( AlignmentPropertyPanel, RotationHdl, void *, EMPTYARG ) +{ + sal_Int32 nTmp = mpCtrlDial->GetRotation(); + SfxInt32Item aAngleItem( SID_ATTR_ALIGN_DEGREES,(sal_uInt32) nTmp); + + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_ALIGN_DEGREES, SFX_CALLMODE_RECORD, &aAngleItem, 0L ); + + return 0; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK( AlignmentPropertyPanel, ClickStackHdl, void *, EMPTYARG ) +{ + bool bVertical = mpCbStacked->IsChecked() ? true : false; + SfxBoolItem aStackItem( SID_ATTR_ALIGN_STACKED, bVertical ); + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_ALIGN_STACKED, SFX_CALLMODE_RECORD, &aStackItem, 0L ); + return 0; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK(AlignmentPropertyPanel, TbxHorAlignSelectHdl, ToolBox*, pToolBox) +{ + sal_uInt16 nId = pToolBox->GetCurItemId(); + + if(nId == ID_SUBSTLEFT) + { + if(meHorAlignState != SVX_HOR_JUSTIFY_LEFT) + meHorAlignState = SVX_HOR_JUSTIFY_LEFT; + else + meHorAlignState = SVX_HOR_JUSTIFY_STANDARD; + } + else if( nId == ID_SUBSTCENTER ) + { + if(meHorAlignState != SVX_HOR_JUSTIFY_CENTER) + meHorAlignState = SVX_HOR_JUSTIFY_CENTER; + else + meHorAlignState = SVX_HOR_JUSTIFY_STANDARD; + } + else if( nId == ID_SUBSTRIGHT ) + { + if(meHorAlignState != SVX_HOR_JUSTIFY_RIGHT) + meHorAlignState = SVX_HOR_JUSTIFY_RIGHT; + else + meHorAlignState = SVX_HOR_JUSTIFY_STANDARD; + } + else if( nId == ID_SUBSTJUSTIFY ) + { + if(meHorAlignState != SVX_HOR_JUSTIFY_BLOCK) + meHorAlignState = SVX_HOR_JUSTIFY_BLOCK; + else + meHorAlignState = SVX_HOR_JUSTIFY_STANDARD; + } + SvxHorJustifyItem aHorItem(meHorAlignState, SID_H_ALIGNCELL); + GetBindings()->GetDispatcher()->Execute(SID_H_ALIGNCELL, SFX_CALLMODE_RECORD, &aHorItem, 0L); + UpdateHorAlign(); + return 0; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK(AlignmentPropertyPanel, TbxVerAlignSelectHdl, ToolBox*, pToolBox) +{ + sal_uInt16 nId = pToolBox->GetCurItemId(); + + //Bold + if(nId == IID_VERT_TOP) + { + if(meVerAlignState != SVX_VER_JUSTIFY_TOP) + meVerAlignState = SVX_VER_JUSTIFY_TOP; + else + meVerAlignState = SVX_VER_JUSTIFY_STANDARD; + } + else if( nId == IID_VERT_CENTER ) + { + if(meVerAlignState != SVX_VER_JUSTIFY_CENTER) + meVerAlignState = SVX_VER_JUSTIFY_CENTER; + else + meVerAlignState = SVX_VER_JUSTIFY_STANDARD; + } + else if( nId == IID_VERT_BOTTOM ) + { + if(meVerAlignState != SVX_VER_JUSTIFY_BOTTOM) + meVerAlignState = SVX_VER_JUSTIFY_BOTTOM; + else + meVerAlignState = SVX_VER_JUSTIFY_STANDARD; + } + SvxVerJustifyItem aVerItem(meVerAlignState, SID_V_ALIGNCELL); + GetBindings()->GetDispatcher()->Execute(SID_V_ALIGNCELL, SFX_CALLMODE_RECORD, &aVerItem, 0L); + UpdateVerAlign(); + return 0; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK(AlignmentPropertyPanel, MFLeftIndentMdyHdl, void*, EMPTYARG) +{ + mpCBXWrapText->EnableTriState(false); + sal_uInt16 nVal = (sal_uInt16)mpMFLeftIndent->GetValue(); + SfxUInt16Item aItem( SID_ATTR_ALIGN_INDENT, (sal_uInt16)CalcToUnit( nVal, SFX_MAPUNIT_TWIP ) ); + + GetBindings()->GetDispatcher()->Execute(SID_ATTR_ALIGN_INDENT, SFX_CALLMODE_RECORD, &aItem, 0L); + return( 0L ); +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK(AlignmentPropertyPanel, CBOXMergnCellClkHdl, void*, EMPTYARG) +{ + bool bState = mpCBXMergeCell->IsChecked(); + + //Modified + //SfxBoolItem aItem( FID_MERGE_TOGGLE , bState); + //GetBindings()->GetDispatcher()->Execute(FID_MERGE_TOGGLE, SFX_CALLMODE_RECORD, &aItem, false, 0L); + if(bState) + GetBindings()->GetDispatcher()->Execute(FID_MERGE_ON, SFX_CALLMODE_RECORD); + else + GetBindings()->GetDispatcher()->Execute(FID_MERGE_OFF, SFX_CALLMODE_RECORD); + GetBindings()->Invalidate(FID_MERGE_TOGGLE,true,false); + //modified end + + return 0; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK(AlignmentPropertyPanel, CBOXWrapTextClkHdl, void*, EMPTYARG) +{ + bool bState = mpCBXWrapText->IsChecked(); + SfxBoolItem aItem( SID_ATTR_ALIGN_LINEBREAK , bState); + GetBindings()->GetDispatcher()->Execute(SID_ATTR_ALIGN_LINEBREAK, SFX_CALLMODE_RECORD, &aItem, 0L); + return 0; +} + +////////////////////////////////////////////////////////////////////////////// + +AlignmentPropertyPanel* AlignmentPropertyPanel::Create ( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings) +{ + if (pParent == NULL) + throw lang::IllegalArgumentException(A2S("no parent Window given to AlignmentPropertyPanel::Create"), NULL, 0); + if ( ! rxFrame.is()) + throw lang::IllegalArgumentException(A2S("no XFrame given to AlignmentPropertyPanel::Create"), NULL, 1); + if (pBindings == NULL) + throw lang::IllegalArgumentException(A2S("no SfxBindings given to AlignmentPropertyPanel::Create"), NULL, 2); + + return new AlignmentPropertyPanel( + pParent, + rxFrame, + pBindings); +} + +////////////////////////////////////////////////////////////////////////////// + +void AlignmentPropertyPanel::DataChanged( + const DataChangedEvent& rEvent) +{ + (void)rEvent; +} + +////////////////////////////////////////////////////////////////////////////// + +void AlignmentPropertyPanel::HandleContextChange( + const ::sfx2::sidebar::EnumContext aContext) +{ + if(maContext == aContext) + { + // Nothing to do. + return; + } + + maContext = aContext; + + + + // todo +} + +////////////////////////////////////////////////////////////////////////////// + +void AlignmentPropertyPanel::NotifyItemUpdate( + sal_uInt16 nSID, + SfxItemState eState, + const SfxPoolItem* pState) +{ + switch(nSID) + { + case SID_H_ALIGNCELL: + if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SvxHorJustifyItem) ) + { + const SvxHorJustifyItem* pItem = (const SvxHorJustifyItem*)pState; + meHorAlignState = (SvxCellHorJustify)pItem->GetValue(); + } + else + { + meHorAlignState = SVX_HOR_JUSTIFY_STANDARD; + } + UpdateHorAlign(); + break; + case SID_V_ALIGNCELL: + if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SvxVerJustifyItem) ) + { + const SvxVerJustifyItem* pItem = (const SvxVerJustifyItem*)pState; + meVerAlignState = (SvxCellVerJustify)pItem->GetValue(); + } + else + { + meVerAlignState = SVX_VER_JUSTIFY_STANDARD; + } + UpdateVerAlign(); + break; + case SID_ATTR_ALIGN_INDENT: + if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SfxUInt16Item) ) + { + const SfxUInt16Item* pItem = (const SfxUInt16Item*)pState; + sal_uInt16 nVal = pItem->GetValue(); + mpMFLeftIndent->SetValue( CalcToPoint(nVal, SFX_MAPUNIT_TWIP, 1) ); + } + else + { + mpMFLeftIndent->SetValue(0); + mpMFLeftIndent->SetText(String()); + } + break; + case FID_MERGE_TOGGLE: + if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SfxBoolItem) ) + { + mpCBXMergeCell->Enable(); + const SfxBoolItem* pItem = (const SfxBoolItem*)pState; + bool bVal = pItem->GetValue(); + if(bVal) + mpCBXMergeCell->Check(true); + else + mpCBXMergeCell->Check(false); + } + else + { + mpCBXMergeCell->Check(false); + mpCBXMergeCell->Disable(); + } + break; + + case SID_ATTR_ALIGN_LINEBREAK: + if(eState == SFX_ITEM_DISABLED) + { + mpCBXWrapText->EnableTriState(false); + mpCBXWrapText->Check(false); + mpCBXWrapText->Disable(); + } + else + { + mpCBXWrapText->Enable(); + if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SfxBoolItem) ) + { + mpCBXWrapText->EnableTriState(false); + const SfxBoolItem* pItem = (const SfxBoolItem*)pState; + bool bVal = pItem->GetValue(); + if(bVal) + mpCBXWrapText->Check(true); + else + mpCBXWrapText->Check(false); + } + else if(eState == SFX_ITEM_DONTCARE) + { + mpCBXWrapText->EnableTriState(true); + mpCBXWrapText->SetState(STATE_DONTKNOW); + } + } + break; + case SID_ATTR_ALIGN_DEGREES: + if (eState >= SFX_ITEM_AVAILABLE) + { + long nTmp = ((const SfxInt32Item*)pState)->GetValue(); + mpMtrAngle->SetValue( nTmp / 100); //wj + mpCtrlDial->SetRotation( nTmp ); + switch(nTmp) + { + case 0: + mpMtrAngle->SelectEntryPos(0); + break; + case 4500: + mpMtrAngle->SelectEntryPos(1); + break; + case 9000: + mpMtrAngle->SelectEntryPos(2); + break; + case 13500: + mpMtrAngle->SelectEntryPos(3); + break; + case 18000: + mpMtrAngle->SelectEntryPos(4); + break; + case 22500: + mpMtrAngle->SelectEntryPos(5); + break; + case 27000: + mpMtrAngle->SelectEntryPos(6); + break; + case 31500: + mpMtrAngle->SelectEntryPos(7); + } + } + else + { + mpMtrAngle->SetText( String() ); + mpCtrlDial->SetRotation( 0 ); + } + break; + case SID_ATTR_ALIGN_STACKED: + if (eState >= SFX_ITEM_AVAILABLE) + { + mpCbStacked->EnableTriState(false); + const SfxBoolItem* aStackItem = (const SfxBoolItem*)pState; + bool IsChecked = (bool)aStackItem->GetValue(); + if(IsChecked) + { + mpCbStacked->Check(IsChecked); + mpFtRotate->Disable(); + mpMtrAngle->Disable(); + mpCtrlDial->Disable(); + mbMultiDisable = true; + } + else + { + mpCbStacked->Check(IsChecked); + mpFtRotate->Enable(); + mpMtrAngle->Enable(); + mpCtrlDial->Enable(); + mbMultiDisable = false; + } + } + else + { + mbMultiDisable = true; + mpFtRotate->Disable(); + mpMtrAngle->Disable(); + mpCtrlDial->Disable(); + mpCbStacked->EnableTriState(true); + mpCbStacked->SetState(STATE_DONTKNOW); + } + } +} + +////////////////////////////////////////////////////////////////////////////// + +SfxBindings* AlignmentPropertyPanel::GetBindings() +{ + return mpBindings; +} + +////////////////////////////////////////////////////////////////////////////// + +void AlignmentPropertyPanel::FormatDegrees(double& dTmp) +{ + while(dTmp<0) + dTmp += 360; + while (dTmp > 359) //modify + dTmp = 359; +} + +////////////////////////////////////////////////////////////////////////////// + +void AlignmentPropertyPanel::UpdateHorAlign() +{ + mpTBHorizontal->SetItemState(ID_SUBSTLEFT, STATE_NOCHECK); + mpTBHorizontal->SetItemState(ID_SUBSTCENTER, STATE_NOCHECK); + mpTBHorizontal->SetItemState(ID_SUBSTRIGHT, STATE_NOCHECK); + mpTBHorizontal->SetItemState(ID_SUBSTJUSTIFY,STATE_NOCHECK); + mpFTLeftIndent->Disable(); + mpMFLeftIndent->Disable(); + if(meHorAlignState==SVX_HOR_JUSTIFY_REPEAT) + { + mpFtRotate->Disable(); + mpCtrlDial->Disable(); + mpMtrAngle->Disable(); + mpCbStacked->Disable(); + } + else + { + if(!mbMultiDisable) + { + mpFtRotate->Enable(); + mpCtrlDial->Enable(); + mpMtrAngle->Enable(); + } + else + { + mpFtRotate->Disable(); + mpCtrlDial->Disable(); + mpMtrAngle->Disable(); + } + mpCbStacked->Enable(); + } + switch(meHorAlignState) + { + case SVX_HOR_JUSTIFY_LEFT: + mpTBHorizontal->SetItemState(ID_SUBSTLEFT, STATE_CHECK); + mpFTLeftIndent->Enable(); + mpMFLeftIndent->Enable(); + break; + case SVX_HOR_JUSTIFY_CENTER:mpTBHorizontal->SetItemState(ID_SUBSTCENTER, STATE_CHECK);break; + case SVX_HOR_JUSTIFY_RIGHT: mpTBHorizontal->SetItemState(ID_SUBSTRIGHT, STATE_CHECK);break; + case SVX_HOR_JUSTIFY_BLOCK: mpTBHorizontal->SetItemState(ID_SUBSTJUSTIFY,STATE_CHECK);break; + default:; + } +} + +////////////////////////////////////////////////////////////////////////////// + +void AlignmentPropertyPanel::UpdateVerAlign() +{ + mpTBVertical->SetItemState(IID_VERT_TOP, STATE_NOCHECK); + mpTBVertical->SetItemState(IID_VERT_CENTER, STATE_NOCHECK); + mpTBVertical->SetItemState(IID_VERT_BOTTOM, STATE_NOCHECK); + + switch(meVerAlignState) + { + case SVX_VER_JUSTIFY_TOP: mpTBVertical->SetItemState(IID_VERT_TOP, STATE_CHECK);break; + case SVX_VER_JUSTIFY_CENTER:mpTBVertical->SetItemState(IID_VERT_CENTER, STATE_CHECK);break; + case SVX_VER_JUSTIFY_BOTTOM: mpTBVertical->SetItemState(IID_VERT_BOTTOM, STATE_CHECK);break; + default:; + } +} + +////////////////////////////////////////////////////////////////////////////// +// namespace close + +}} // end of namespace ::sc::sidebar + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.hrc b/sc/source/ui/sidebar/AlignmentPropertyPanel.hrc new file mode 100644 index 000000000000..96b795f06fac --- /dev/null +++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.hrc @@ -0,0 +1,84 @@ +/* + * 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 . + */ +// RID_PROPERTYPANEL_SC_ALIGNMENT-------------------------------------------------------------- +#define FT_ORIENT 1 +#define CBX_WRAP 5 +#define FT_LEFT_INDENT 7 +#define MF_LEFT_INDENT 8 +#define CBX_MERGE 9 +#define CBX_VERT 10 +#define CTL_SBSHAPE_POSREFERENCE 12 +#define CBOX_ANGLE 14 +#define TBX_HORIZONTAL_ALIGNMENT 15 +#define TBX_VERTICAL_ALIGN 16 +#define DIAL_CONTROL 17 +#define ID_SUBSTLEFT 20 +#define ID_SUBSTCENTER 21 +#define ID_SUBSTRIGHT 22 +#define ID_SUBSTJUSTIFY 23 +#define IID_VERT_TOP 24 +#define IID_VERT_CENTER 25 +#define IID_VERT_BOTTOM 26 + +#define MBOX_WIDTH 45 +#define TEXT_WIDTH 40 +#define FLIP_BUTTON_SIZE 13 +#define ALIGNMENT_TBX_HEIGHT 17 +#define ALIGNMENT_TBX_WIDTH 13 + +#define IMG_ALIGN_LEFT 50 +#define IMG_ALIGN_CENTER 51 +#define IMG_ALIGN_RIGHT 52 +#define IMG_ALIGN_JUST 53 +#define IMG_ALIGN_TOP 54 +#define IMG_ALIGN_CENTER_V 55 +#define IMG_ALIGN_BOTTOM 56 + +//---------------position----------------- + +#define ALIGNMENT_X SECTIONPAGE_MARGIN_HORIZONTAL +#define ALIGNMENT_Y SECTIONPAGE_MARGIN_VERTICAL_TOP +#define ALIGNMENT_VERT_X (ALIGNMENT_X + TBX_OUT_BORDER_OFFSET_X*2 + TOOLBOX_ITEM_WIDTH * 4 + CONTROL_SPACING_HORIZONTAL) +#define ALIGNMENT_VERT_Y ALIGNMENT_Y + +#define FT_LEFTINDENT_X ALIGNMENT_X +#define FT_LEFTINDENT_Y (ALIGNMENT_Y + TOOLBOX_ITEM_HEIGHT + TBX_OUT_BORDER_OFFSET_Y + CONTROL_SPACING_VERTICAL) +#define MTR_LEFTINDENT_X ALIGNMENT_X +#define MTR_LEFTINDENT_Y (FT_LEFTINDENT_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL) + +#define CBX_WRAP_X (ALIGNMENT_X + TEXT_WIDTH + 10 + CONTROL_SPACING_HORIZONTAL) +#define CBX_WRAP_Y (FT_LEFTINDENT_Y + 2) + +#define CBX_MERGE_X CBX_WRAP_X +#define CBX_MERGE_Y CBX_WRAP_Y + CBOX_HEIGHT + 2 + +#define FT_ORIENT_X ALIGNMENT_X +#define FT_ORIENT_Y MTR_LEFTINDENT_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL + +#define COMOBX_ROTATION_X FT_ORIENT_X + 30 + CONTROL_SPACING_HORIZONTAL +#define COMOBX_ROTATION_Y FT_ORIENT_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + 5 + +#define ROTATE_CONTROL_X FT_ORIENT_X +#define ROTATE_CONTROL_Y COMOBX_ROTATION_Y - 3 + +#define CBX_VERT_X COMOBX_ROTATION_X +#define CBX_VERT_Y COMOBX_ROTATION_Y + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL + 2 + +#define PANEL_HEIGHT CBX_VERT_Y + 6 + SECTIONPAGE_MARGIN_VERTICAL_BOT + +// eof diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx new file mode 100644 index 000000000000..07d3e06540b0 --- /dev/null +++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx @@ -0,0 +1,126 @@ +/* + * 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 SC_PROPERTYPANEL_ALIGNMENT_HXX +#define SC_PROPERTYPANEL_ALIGNMENT_HXX + +#include <sfx2/sidebar/SidebarPanelBase.hxx> +#include <sfx2/sidebar/ControllerItem.hxx> +#include <sfx2/sidebar/IContextChangeReceiver.hxx> +#include <vcl/fixed.hxx> +#include <boost/scoped_ptr.hpp> +#include <editeng/svxenum.hxx> + +class ToolBox; +class MetricField; +class MetricBox; +class CheckBox; +namespace svx { namespace sidebar { class SidebarDialControl; }} + +namespace sc { namespace sidebar { + +class AlignmentPropertyPanel +: public Control, + public ::sfx2::sidebar::IContextChangeReceiver, + public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface +{ +public: + static AlignmentPropertyPanel* Create( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings); + + virtual void DataChanged( + const DataChangedEvent& rEvent); + + virtual void HandleContextChange( + const ::sfx2::sidebar::EnumContext aContext); + + virtual void NotifyItemUpdate( + const sal_uInt16 nSId, + const SfxItemState eState, + const SfxPoolItem* pState); + + SfxBindings* GetBindings(); + +private: + //ui controls + ::boost::scoped_ptr<Window> mpTBHorizontalBackground; + ::boost::scoped_ptr< ToolBox > mpTBHorizontal; + ::boost::scoped_ptr<Window> mpTBVerticalBackground; + ::boost::scoped_ptr< ToolBox > mpTBVertical; + ::boost::scoped_ptr< FixedText > mpFTLeftIndent; + ::boost::scoped_ptr< MetricField > mpMFLeftIndent; + ::boost::scoped_ptr< CheckBox > mpCBXWrapText; + ::boost::scoped_ptr< CheckBox > mpCBXMergeCell; + ::boost::scoped_ptr< FixedText > mpFtRotate; + ::boost::scoped_ptr< svx::sidebar::SidebarDialControl > mpCtrlDial; + ::boost::scoped_ptr< MetricBox > mpMtrAngle; + ::boost::scoped_ptr< CheckBox > mpCbStacked; + + ::sfx2::sidebar::ControllerItem maAlignHorControl; + ::sfx2::sidebar::ControllerItem maAlignVerControl; + ::sfx2::sidebar::ControllerItem maLeftIndentControl; + ::sfx2::sidebar::ControllerItem maMergeCellControl; + ::sfx2::sidebar::ControllerItem maWrapTextControl; + ::sfx2::sidebar::ControllerItem maAngleControl; + ::sfx2::sidebar::ControllerItem maStackControl; + + Image maIMGAlignLeft; + Image maIMGAlignCenter; + Image maIMGAlignRight; + Image maIMGAlignJust; + Image maIMGAlignTop; + Image maIMGAlignCenterV; + Image maIMGAlignBottom; + + SvxCellHorJustify meHorAlignState; + SvxCellVerJustify meVerAlignState; + + /// bitfield + bool mbMultiDisable : 1; + + cssu::Reference<css::frame::XFrame> mxFrame; + ::sfx2::sidebar::EnumContext maContext; + SfxBindings* mpBindings; + + DECL_LINK( TbxHorAlignSelectHdl, ToolBox* ); + DECL_LINK( TbxVerAlignSelectHdl, ToolBox* ); + DECL_LINK( MFLeftIndentMdyHdl, void * ); + DECL_LINK( CBOXMergnCellClkHdl, void * ); + DECL_LINK( CBOXWrapTextClkHdl, void * ); + DECL_LINK( AngleModifiedHdl, void * ); + DECL_LINK( RotationHdl, void * ); + DECL_LINK( ClickStackHdl, void * ); + + // constructor/destuctor + AlignmentPropertyPanel( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings); + virtual ~AlignmentPropertyPanel(); + + void Initialize(); + void UpdateHorAlign(); + void UpdateVerAlign(); + void FormatDegrees(double& dTmp); +}; + +} } // end of namespace ::sc::sidebar + +#endif +// eof diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.src b/sc/source/ui/sidebar/AlignmentPropertyPanel.src new file mode 100644 index 000000000000..5a5501295524 --- /dev/null +++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.src @@ -0,0 +1,213 @@ +/* + * 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 "AlignmentPropertyPanel.hrc" +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include "sc.hrc" +#include "helpids.h" + +Control RID_PROPERTYPANEL_SC_ALIGNMENT +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + + Size = MAP_APPFONT( PROPERTYPAGE_WIDTH, PANEL_HEIGHT ); + HelpID = HID_PROPERTYPANEL_SC_ALIGN_SECTION; + Text [ en-US ] = "Alignment"; + + //------------ Alignment ------------- + ToolBox TBX_HORIZONTAL_ALIGNMENT + { + Pos = MAP_APPFONT ( ALIGNMENT_X , ALIGNMENT_Y ); + Size = MAP_APPFONT ( ALIGNMENT_TBX_WIDTH*4 ,ALIGNMENT_TBX_HEIGHT); + SVLook = TRUE ; + Border = FALSE ; + HelpID = HID_PROPERTY_PANEL_ALIGN_TBX_HOR; + Text [ en-US ] = "Horizontal Alignment" ; + ItemList = + { + ToolBoxItem + { + Identifier = ID_SUBSTLEFT ; + Text [ en-US ] = "Align Left" ; + HelpID = HID_PROPERTY_PANEL_ALIGN_TBI_HOR_L; + }; + ToolBoxItem + { + Identifier = ID_SUBSTCENTER ; + Text [ en-US ] = "Align Center" ; + HelpID = HID_PROPERTY_PANEL_ALIGN_TBI_HOR_C; + }; + ToolBoxItem + { + Identifier = ID_SUBSTRIGHT ; + Text [ en-US ] = "Align Right" ; + HelpID = HID_PROPERTY_PANEL_ALIGN_TBI_HOR_R; + }; + ToolBoxItem + { + Identifier = ID_SUBSTJUSTIFY ; + Text [ en-US ] = "Align Justified" ; + HelpID = HID_PROPERTY_PANEL_ALIGN_TBI_HOR_J; + }; + }; + }; + ToolBox TBX_VERTICAL_ALIGN + { + SVLook = TRUE ; + Border = FALSE ; + Pos = MAP_APPFONT ( ALIGNMENT_VERT_X, ALIGNMENT_VERT_Y ) ; + Size = MAP_APPFONT ( TOOLBOX_ITEM_WIDTH * 3 , TOOLBOX_ITEM_HEIGHT) ; + TabStop = TRUE ; + HelpID = HID_PROPERTY_PANEL_ALIGN_TBX_VER; + Text [ en-US ] = "Vertical Alignment" ; + ItemList = + { + ToolBoxItem + { + Identifier = IID_VERT_TOP ; + Text [ en-US ] = "Align Top" ; + HelpID = HID_PROPERTY_PANEL_ALIGN_TBI_VER_T; + }; + + ToolBoxItem + { + Identifier = IID_VERT_CENTER ; + Text [ en-US ] = "Align Center Vertically" ; + HelpID = HID_PROPERTY_PANEL_ALIGN_TBI_VER_C; + }; + + ToolBoxItem + { + Identifier = IID_VERT_BOTTOM ; + Text [ en-US ] = "Align Bottom" ; + HelpID = HID_PROPERTY_PANEL_ALIGN_TBI_VER_B; + }; + }; + }; + //------------ Left indent ------------ + FixedText FT_LEFT_INDENT + { + Pos = MAP_APPFONT ( FT_LEFTINDENT_X, FT_LEFTINDENT_Y ); + Size = MAP_APPFONT (CBX_WRAP_X - FT_LEFTINDENT_X - 1 , TEXT_HEIGHT) ; //MBOX_WIDTH + Text [ en-US ] = "Left ~indent:"; + }; + MetricField MF_LEFT_INDENT + { + Border = TRUE; + Pos = MAP_APPFONT ( MTR_LEFTINDENT_X , MTR_LEFTINDENT_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH, MBOX_HEIGHT ) ; + TabStop = TRUE; + Repeat = TRUE; + Spin = TRUE; + Minimum = 0; + Maximum = 990; + Unit = FUNIT_POINT; + SpinSize = 10; + QuickHelpText [ en-US ] = "Indents from the left edge."; + HelpID = HID_PROPERTY_PANEL_ALIGN_MBX_INDENT; + }; + CheckBox CBX_WRAP + { + Pos = MAP_APPFONT ( CBX_WRAP_X , CBX_WRAP_Y ) ; + Size = MAP_APPFONT (PROPERTYPAGE_WIDTH - CBX_WRAP_X - 1 , CBOX_HEIGHT ) ;// + TabStop = TRUE ; + Text [ en-US ] = "~Wrap text" ; + QuickHelpText [ en-US ] = "Wrap texts automatically."; + HelpID = HID_PROPERTY_PANEL_ALIGN_CBX_WRAP; + }; + CheckBox CBX_MERGE + { + Pos = MAP_APPFONT ( CBX_MERGE_X , CBX_MERGE_Y ) ; + Size = MAP_APPFONT ( PROPERTYPAGE_WIDTH - CBX_WRAP_X - 1 , CBOX_HEIGHT ) ;// + TabStop = TRUE ; + Text [ en-US ] = "~Merge cells" ; + QuickHelpText [ en-US ] = "Joins the selected cells into one."; + HelpID = HID_PROPERTY_PANEL_ALIGN_CBX_MERGE; + }; + //------------ Text orientation ------------ + FixedText FT_ORIENT + { + Pos = MAP_APPFONT ( FT_ORIENT_X, FT_ORIENT_Y ); + Size = MAP_APPFONT ( TEXT_WIDTH + 50, TEXT_HEIGHT) ; + Text [ en-US ] = "Text ~orientation:"; + }; + MetricBox CBOX_ANGLE + { + Border = TRUE ; + Pos = MAP_APPFONT ( COMOBX_ROTATION_X , COMOBX_ROTATION_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH + 20, MBOX_HEIGHT ) ; + Unit = FUNIT_CUSTOM ; + CustomUnitText [ en-US ] = " degrees"; + DecimalDigits = 0; + Minimum = 0; + Maximum = 359; + TabStop = TRUE ; + DropDown = TRUE ; + QuickHelpText [ en-US ] = "Select the angle for rotation."; + HelpID = HID_PROPERTY_PANEL_ALIGN_MBX_ANGLE; + }; + + Control DIAL_CONTROL + { + Pos = MAP_APPFONT ( ROTATE_CONTROL_X , ROTATE_CONTROL_Y ); + Size = MAP_PIXEL( 50, 50 ); + HelpID = HID_PROPERTY_PANEL_ALIGN_DIAL_CONTROL; + QuickHelpText [ en-US ] = "Drag to change the rotation value."; + }; + CheckBox CBX_VERT + { + Pos = MAP_APPFONT ( CBX_VERT_X , CBX_VERT_Y ) ; + Size = MAP_APPFONT ( MBOX_WIDTH + 20 , CBOX_HEIGHT + 5 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Vertically stacked" ; + QuickHelpText [ en-US ] = "Aligns text vertically."; + HelpID = HID_PROPERTY_PANEL_ALIGN_CBX_VERT; + }; + + Image IMG_ALIGN_LEFT + { + ImageBitmap = Bitmap{File = "sidebar/sc_alignleft.png";}; + }; + Image IMG_ALIGN_CENTER + { + ImageBitmap = Bitmap{File = "sidebar/sc_aligncenter.png";}; + }; + Image IMG_ALIGN_RIGHT + { + ImageBitmap = Bitmap{File = "sidebar/sc_alignright.png";}; + }; + Image IMG_ALIGN_JUST + { + ImageBitmap = Bitmap{File = "sidebar/sc_alignjust.png";}; + }; + Image IMG_ALIGN_TOP + { + ImageBitmap = Bitmap{File = "sidebar/sc_aligntop.png";}; + }; + Image IMG_ALIGN_CENTER_V + { + ImageBitmap = Bitmap{File = "sidebar/sc_aligncenter_v.png";}; + }; + Image IMG_ALIGN_BOTTOM + { + ImageBitmap = Bitmap{File = "sidebar/sc_alignbottom.png";}; + }; +}; + +// eof diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx new file mode 100644 index 000000000000..fe48df6ccf03 --- /dev/null +++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx @@ -0,0 +1,865 @@ +/* + * 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 <sfx2/sidebar/ResourceDefinitions.hrc> +#include <sfx2/sidebar/Theme.hxx> +#include <sfx2/sidebar/ControlFactory.hxx> +#include <CellAppearancePropertyPanel.hxx> +#include <CellAppearancePropertyPanel.hrc> +#include "sc.hrc" +#include "scresid.hxx" +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <vcl/fixed.hxx> +#include <svx/tbxcolorupdate.hxx> +#include <svl/eitem.hxx> +#include <editeng/borderline.hxx> +#include <editeng/boxitem.hxx> +#include <editeng/colritem.hxx> +#include <editeng/lineitem.hxx> +#include <vcl/svapp.hxx> +#include <svx/sidebar/ColorControl.hxx> +#include <boost/bind.hpp> +#include <svx/sidebar/PopupContainer.hxx> +#include <CellLineStyleControl.hxx> +#include <CellLineStylePopup.hxx> +#include <CellBorderUpdater.hxx> +#include <CellBorderStyleControl.hxx> +#include <CellBorderStylePopup.hxx> + +using namespace css; +using namespace cssu; + +#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) + +////////////////////////////////////////////////////////////////////////////// +// helpers + +namespace +{ + Color GetTransparentColor(void) + { + return COL_TRANSPARENT; + } +} // end of anonymous namespace + +////////////////////////////////////////////////////////////////////////////// +// namespace open + +namespace sc { namespace sidebar { + +////////////////////////////////////////////////////////////////////////////// + +svx::sidebar::PopupControl* CellAppearancePropertyPanel::CreateFillColorPopupControl(svx::sidebar::PopupContainer* pParent) +{ + const ScResId aResId(VS_NOFILLCOLOR); + + return new svx::sidebar::ColorControl( + pParent, + mpBindings, + ScResId(RID_POPUPPANEL_CELLAPPEARANCE_FILLCOLOR), + ScResId(VS_FILLCOLOR), + ::boost::bind(GetTransparentColor), + ::boost::bind(&CellAppearancePropertyPanel::SetFillColor, this, _1, _2), + pParent, + &aResId); +} + +void CellAppearancePropertyPanel::SetFillColor( + const String& /*rsColorName*/, + const Color aColor) +{ + const SvxColorItem aColorItem(aColor, SID_BACKGROUND_COLOR); + mpBindings->GetDispatcher()->Execute(SID_BACKGROUND_COLOR, SFX_CALLMODE_RECORD, &aColorItem, 0L); + maBackColor = aColor; +} + +////////////////////////////////////////////////////////////////////////////// + +svx::sidebar::PopupControl* CellAppearancePropertyPanel::CreateLineColorPopupControl(svx::sidebar::PopupContainer* pParent) +{ + return new svx::sidebar::ColorControl( + pParent, + mpBindings, + ScResId(RID_POPUPPANEL_CELLAPPEARANCE_LINECOLOR), + ScResId(VS_LINECOLOR), + ::boost::bind(GetTransparentColor), + ::boost::bind(&CellAppearancePropertyPanel::SetLineColor, this, _1, _2), + pParent, + 0); +} + +void CellAppearancePropertyPanel::SetLineColor( + const String& /*rsColorName*/, + const Color aColor) +{ + const SvxColorItem aColorItem(aColor, SID_FRAME_LINECOLOR); + mpBindings->GetDispatcher()->Execute(SID_FRAME_LINECOLOR, SFX_CALLMODE_RECORD, &aColorItem, 0L); + maLineColor = aColor; +} + +////////////////////////////////////////////////////////////////////////////// + +svx::sidebar::PopupControl* CellAppearancePropertyPanel::CreateCellLineStylePopupControl(svx::sidebar::PopupContainer* pParent) +{ + return new CellLineStyleControl(pParent, *this); +} + +void CellAppearancePropertyPanel::EndCellLineStylePopupMode(void) +{ + if(mpCellLineStylePopup.get()) + { + mpCellLineStylePopup->Hide(); + } +} + +////////////////////////////////////////////////////////////////////////////// + +svx::sidebar::PopupControl* CellAppearancePropertyPanel::CreateCellBorderStylePopupControl(svx::sidebar::PopupContainer* pParent) +{ + return new CellBorderStyleControl(pParent, *this); +} + +void CellAppearancePropertyPanel::EndCellBorderStylePopupMode(void) +{ + if(mpCellBorderStylePopup.get()) + { + mpCellBorderStylePopup->Hide(); + } +} + +////////////////////////////////////////////////////////////////////////////// + +CellAppearancePropertyPanel::CellAppearancePropertyPanel( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings) +: Control( + pParent, + ScResId(RID_PROPERTYPANEL_SC_APPEAR)), + + mpFTFillColor(new FixedText(this, ScResId(FT_BK_COLOR))), + mpTBFillColorBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), + mpTBFillColor(sfx2::sidebar::ControlFactory::CreateToolBox(mpTBFillColorBackground.get(), ScResId(TB_BK_COLOR))), + mpFillColorUpdater(new ::svx::ToolboxButtonColorUpdater(SID_ATTR_BRUSH, TBI_BK_COLOR, mpTBFillColor.get(), TBX_UPDATER_MODE_CHAR_COLOR_NEW)), + + mpFTCellBorder(new FixedText(this, ScResId(FT_BORDER))), + mpTBCellBorderBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), + mpTBCellBorder(sfx2::sidebar::ControlFactory::CreateToolBox(mpTBCellBorderBackground.get(), ScResId(TB_APP_BORDER))), + mpCellBorderUpdater(new CellBorderUpdater(TBI_BORDER, *mpTBCellBorder)), + + mpTBLineStyleBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), + mpTBLineStyle(sfx2::sidebar::ControlFactory::CreateToolBox(mpTBLineStyleBackground.get(), ScResId(TB_BORDER_LINE_STYLE))), + + mpTBLineColorBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), + mpTBLineColor(sfx2::sidebar::ControlFactory::CreateToolBox(mpTBLineColorBackground.get(), ScResId(TB_BORDER_LINE_COLOR))), + mpLineColorUpdater(new ::svx::ToolboxButtonColorUpdater(SID_FRAME_LINECOLOR, TBI_LINE_COLOR, mpTBLineColor.get(), TBX_UPDATER_MODE_CHAR_COLOR_NEW)), + + mpCBXShowGrid(new CheckBox(this, ScResId(CBX_SHOW_GRID))), + + maBackColorControl(SID_BACKGROUND_COLOR, *pBindings, *this), + maLineColorControl(SID_FRAME_LINECOLOR, *pBindings, *this), + maLineStyleControl(SID_FRAME_LINESTYLE, *pBindings, *this), + maBorderOuterControl(SID_ATTR_BORDER_OUTER, *pBindings, *this), + maBorderInnerControl(SID_ATTR_BORDER_INNER, *pBindings, *this), + maGridShowControl(SID_SCGRIDSHOW, *pBindings, *this), + maBorderTLBRControl(SID_ATTR_BORDER_DIAG_TLBR, *pBindings, *this), + maBorderBLTRControl(SID_ATTR_BORDER_DIAG_BLTR, *pBindings, *this), + + maIMGBKColor(ScResId(IMG_BK_COLOR)), + maIMGCellBorder(ScResId(IMG_CELL_BORDER)), + maIMGLineColor(ScResId(IMG_LINE_COLOR)), + maIMGLineStyle1(ScResId(IMG_LINE_STYLE1)), + maIMGLineStyle2(ScResId(IMG_LINE_STYLE2)), + maIMGLineStyle3(ScResId(IMG_LINE_STYLE3)), + maIMGLineStyle4(ScResId(IMG_LINE_STYLE4)), + maIMGLineStyle5(ScResId(IMG_LINE_STYLE5)), + maIMGLineStyle6(ScResId(IMG_LINE_STYLE6)), + maIMGLineStyle7(ScResId(IMG_LINE_STYLE7)), + maIMGLineStyle8(ScResId(IMG_LINE_STYLE8)), + maIMGLineStyle9(ScResId(IMG_LINE_STYLE9)), + + maBackColor(COL_TRANSPARENT), + maLineColor(COL_BLACK), + maTLBRColor(COL_BLACK), + maBLTRColor(COL_BLACK), + mnIn(0), + mnOut(0), + mnDis(0), + mnTLBRIn(0), + mnTLBROut(0), + mnTLBRDis(0), + mnBLTRIn(0), + mnBLTROut(0), + mnBLTRDis(0), + mbBackColorAvailable(true), + mbLineColorAvailable(true), + mbBorderStyleAvailable(true), + mbLeft(false), + mbRight(false), + mbTop(false), + mbBottom(false), + mbVer(false), + mbHor(false), + mbOuterBorder(false), + mbInnerBorder(false), + mbTLBR(false), + mbBLTR(false), + + maFillColorPopup(this, ::boost::bind(&CellAppearancePropertyPanel::CreateFillColorPopupControl, this, _1)), + maLineColorPopup(this, ::boost::bind(&CellAppearancePropertyPanel::CreateLineColorPopupControl, this, _1)), + mpCellLineStylePopup(), + mpCellBorderStylePopup(), + + mxFrame(rxFrame), + maContext(), + mpBindings(pBindings) +{ + Initialize(); + FreeResource(); +} + +////////////////////////////////////////////////////////////////////////////// + +CellAppearancePropertyPanel::~CellAppearancePropertyPanel() +{ + // Destroy the toolboxes, then their background windows. + mpTBFillColor.reset(); + mpTBCellBorder.reset(); + mpTBLineStyle.reset(); + mpTBLineColor.reset(); + + mpTBFillColorBackground.reset(); + mpTBCellBorderBackground.reset(); + mpTBLineStyleBackground.reset(); + mpTBLineColorBackground.reset(); +} + +////////////////////////////////////////////////////////////////////////////// + +void CellAppearancePropertyPanel::Initialize() +{ + mpTBFillColor->SetItemImage(TBI_BK_COLOR, maIMGBKColor); + mpTBFillColor->SetItemBits( TBI_BK_COLOR, mpTBFillColor->GetItemBits( TBI_BK_COLOR ) | TIB_DROPDOWNONLY ); + mpTBFillColor->SetQuickHelpText(TBI_BK_COLOR,String(ScResId(STR_QH_BK_COLOR))); //Add + Size aTbxSize1( mpTBFillColor->CalcWindowSizePixel() ); + mpTBFillColor->SetOutputSizePixel( aTbxSize1 ); + mpTBFillColor->SetBackground(Wallpaper()); + mpTBFillColor->SetPaintTransparent(true); + Link aLink = LINK(this, CellAppearancePropertyPanel, TbxBKColorSelectHdl); + mpTBFillColor->SetDropdownClickHdl ( aLink ); + mpTBFillColor->SetSelectHdl ( aLink ); + + mpTBCellBorder->SetItemImage(TBI_BORDER, maIMGCellBorder); + mpTBCellBorder->SetItemBits( TBI_BORDER, mpTBCellBorder->GetItemBits( TBI_BORDER ) | TIB_DROPDOWNONLY ); + mpTBCellBorder->SetQuickHelpText(TBI_BORDER,String(ScResId(STR_QH_BORDER))); //Add + Size aTbxSize2( mpTBCellBorder->CalcWindowSizePixel() ); + mpTBCellBorder->SetOutputSizePixel( aTbxSize2 ); + mpTBCellBorder->SetBackground(Wallpaper()); + mpTBCellBorder->SetPaintTransparent(true); + aLink = LINK(this, CellAppearancePropertyPanel, TbxCellBorderSelectHdl); + mpTBCellBorder->SetDropdownClickHdl ( aLink ); + mpTBCellBorder->SetSelectHdl ( aLink ); + + mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, maIMGLineStyle1); + mpTBLineStyle->SetItemBits( TBI_LINE_STYLE, mpTBLineStyle->GetItemBits( TBI_LINE_STYLE ) | TIB_DROPDOWNONLY ); + mpTBLineStyle->SetQuickHelpText(TBI_LINE_STYLE,String(ScResId(STR_QH_BORDER_LINE_STYLE))); //Add + Size aTbxSize3( mpTBLineStyle->CalcWindowSizePixel() ); + mpTBLineStyle->SetOutputSizePixel( aTbxSize3 ); + mpTBLineStyle->SetBackground(Wallpaper()); + mpTBLineStyle->SetPaintTransparent(true); + aLink = LINK(this, CellAppearancePropertyPanel, TbxLineStyleSelectHdl); + mpTBLineStyle->SetDropdownClickHdl ( aLink ); + mpTBLineStyle->SetSelectHdl ( aLink ); + mpTBLineStyle->Disable(); + + mpTBLineColor->SetItemImage(TBI_LINE_COLOR, maIMGLineColor); + mpTBLineColor->SetItemBits( TBI_LINE_COLOR, mpTBLineColor->GetItemBits( TBI_LINE_COLOR ) | TIB_DROPDOWNONLY ); + mpTBLineColor->SetQuickHelpText(TBI_LINE_COLOR,String(ScResId(STR_QH_BORDER_LINE_COLOR))); //Add + Size aTbxSize4( mpTBLineColor->CalcWindowSizePixel() ); + mpTBLineColor->SetOutputSizePixel( aTbxSize4 ); + mpTBLineColor->SetBackground(Wallpaper()); + mpTBLineColor->SetPaintTransparent(true); + aLink = LINK(this, CellAppearancePropertyPanel, TbxLineColorSelectHdl); + mpTBLineColor->SetDropdownClickHdl ( aLink ); + mpTBLineColor->SetSelectHdl ( aLink ); + mpTBLineColor->Disable(); + + aLink = LINK(this, CellAppearancePropertyPanel, CBOXGridShowClkHdl); + mpCBXShowGrid->SetClickHdl ( aLink ); + + mpTBFillColor->SetAccessibleRelationLabeledBy(mpFTFillColor.get()); + mpTBLineColor->SetAccessibleRelationLabeledBy(mpTBLineColor.get()); + mpTBCellBorder->SetAccessibleRelationLabeledBy(mpFTCellBorder.get()); + mpTBLineStyle->SetAccessibleRelationLabeledBy(mpTBLineStyle.get()); +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK(CellAppearancePropertyPanel, TbxBKColorSelectHdl, ToolBox*, pToolBox) +{ + sal_uInt16 nId = pToolBox->GetCurItemId(); + if(nId == TBI_BK_COLOR) + { + maFillColorPopup.Show(*pToolBox); + maFillColorPopup.SetCurrentColor(maBackColor, mbBackColorAvailable); + } + return 0; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK(CellAppearancePropertyPanel, TbxLineColorSelectHdl, ToolBox*, pToolBox) +{ + sal_uInt16 nId = pToolBox->GetCurItemId(); + if(nId == TBI_LINE_COLOR) + { + maLineColorPopup.Show(*pToolBox); + maLineColorPopup.SetCurrentColor(maLineColor, mbLineColorAvailable); + } + return 0; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK(CellAppearancePropertyPanel, TbxCellBorderSelectHdl, ToolBox*, pToolBox) +{ + sal_uInt16 nId = pToolBox->GetCurItemId(); + + if(nId == TBI_BORDER) + { + // create popup on demand + if(!mpCellBorderStylePopup.get()) + { + mpCellBorderStylePopup.reset( + new CellBorderStylePopup( + this, + ::boost::bind(&CellAppearancePropertyPanel::CreateCellBorderStylePopupControl, this, _1))); + } + + if(mpCellBorderStylePopup.get()) + { + mpCellBorderStylePopup->Show(*pToolBox); + } + } + return 0; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK(CellAppearancePropertyPanel, TbxLineStyleSelectHdl, ToolBox*, pToolBox) +{ + sal_uInt16 nId = pToolBox->GetCurItemId(); + if(nId == TBI_LINE_STYLE) + { + // create popup on demand + if(!mpCellLineStylePopup.get()) + { + mpCellLineStylePopup.reset( + new CellLineStylePopup( + this, + ::boost::bind(&CellAppearancePropertyPanel::CreateCellLineStylePopupControl, this, _1))); + } + + if(mpCellLineStylePopup.get()) + { + mpCellLineStylePopup->SetLineStyleSelect(mnOut, mnIn, mnDis); + mpCellLineStylePopup->Show(*pToolBox); + } + } + return 0; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK(CellAppearancePropertyPanel, CBOXGridShowClkHdl, void*, EMPTYARG) +{ + bool bState = mpCBXShowGrid->IsChecked(); + SfxBoolItem aItem( SID_SCGRIDSHOW , bState); + GetBindings()->GetDispatcher()->Execute(SID_SCGRIDSHOW, SFX_CALLMODE_RECORD, &aItem, false, 0L); + return 0; +} + +////////////////////////////////////////////////////////////////////////////// + +CellAppearancePropertyPanel* CellAppearancePropertyPanel::Create ( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings) +{ + if (pParent == NULL) + throw lang::IllegalArgumentException(A2S("no parent Window given to CellAppearancePropertyPanel::Create"), NULL, 0); + if ( ! rxFrame.is()) + throw lang::IllegalArgumentException(A2S("no XFrame given to CellAppearancePropertyPanel::Create"), NULL, 1); + if (pBindings == NULL) + throw lang::IllegalArgumentException(A2S("no SfxBindings given to CellAppearancePropertyPanel::Create"), NULL, 2); + + return new CellAppearancePropertyPanel( + pParent, + rxFrame, + pBindings); +} + +////////////////////////////////////////////////////////////////////////////// + +void CellAppearancePropertyPanel::DataChanged( + const DataChangedEvent& rEvent) +{ + (void)rEvent; +} + +////////////////////////////////////////////////////////////////////////////// + +void CellAppearancePropertyPanel::HandleContextChange( + const ::sfx2::sidebar::EnumContext aContext) +{ + if(maContext == aContext) + { + // Nothing to do. + return; + } + + maContext = aContext; + + + + // todo +} + +////////////////////////////////////////////////////////////////////////////// + +void CellAppearancePropertyPanel::NotifyItemUpdate( + sal_uInt16 nSID, + SfxItemState eState, + const SfxPoolItem* pState) +{ + switch(nSID) + { + case SID_BACKGROUND_COLOR: + if(eState >= SFX_ITEM_DEFAULT) + { + const SvxColorItem* pSvxColorItem = dynamic_cast< const SvxColorItem* >(pState); + + if(pSvxColorItem) + { + maBackColor = ((const SvxColorItem*)pState)->GetValue(); + mbBackColorAvailable = true; + mpFillColorUpdater->Update(maBackColor); + break; + } + } + + mbBackColorAvailable = false; + maBackColor.SetColor(COL_TRANSPARENT); + mpFillColorUpdater->Update(COL_TRANSPARENT); + break; + case SID_FRAME_LINECOLOR: + if( eState == SFX_ITEM_DONTCARE) + { + mbLineColorAvailable = true; + maLineColor.SetColor( COL_TRANSPARENT ); + UpdateControlState(); + break; + } + + if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SvxColorItem) ) + { + const SvxColorItem* pSvxColorItem = dynamic_cast< const SvxColorItem* >(pState); + + if(pSvxColorItem) + { + maLineColor = ((const SvxColorItem*)pState)->GetValue(); + if(maLineColor == COL_AUTO) + mbLineColorAvailable = false; + else + { + mbLineColorAvailable = true; + // mpLineColorUpdater->Update(maLineColor); + } + + UpdateControlState(); + break; + } + } + + mbLineColorAvailable = false; + maLineColor.SetColor(COL_AUTO); + // mpLineColorUpdater->Update(maLineColor); + UpdateControlState(); + break; + case SID_FRAME_LINESTYLE: + if( eState == SFX_ITEM_DONTCARE ) + { + mbBorderStyleAvailable = true; + mnIn = 0; + mnOut = 0; + mnDis = 0; + SetStyleIcon(); + break; + } + + if(eState >= SFX_ITEM_DEFAULT) + { + const SvxLineItem* pSvxLineItem = dynamic_cast< const SvxLineItem* >(pState); + + if(pSvxLineItem) + { + const editeng::SvxBorderLine* mbLineItem = pSvxLineItem->GetLine(); + mnIn = mbLineItem->GetInWidth(); + mnOut = mbLineItem->GetOutWidth(); + mnDis = mbLineItem->GetDistance(); + + if(mnIn == 0 && mnOut == 0 && mnDis == 0) + mbBorderStyleAvailable = false; + else + mbBorderStyleAvailable = true; + + SetStyleIcon(); + break; + } + } + + mbBorderStyleAvailable = false; + SetStyleIcon(); + break; + case SID_ATTR_BORDER_OUTER: + if(eState >= SFX_ITEM_DEFAULT) + { + const SvxBoxItem* pBoxItem = dynamic_cast< const SvxBoxItem* >(pState); + + if(pBoxItem) + { + mbLeft=false, mbRight=false, mbTop=false, mbBottom=false; + + if(pBoxItem->GetLeft()) + mbLeft = true; + + if(pBoxItem->GetRight()) + mbRight = true; + + if(pBoxItem->GetTop()) + mbTop = true; + + if(pBoxItem->GetBottom()) + mbBottom = true; + + if(!Application::GetSettings().GetLayoutRTL()) + mpCellBorderUpdater->UpdateCellBorder(mbTop, mbBottom, mbLeft, mbRight, maIMGCellBorder, mbVer, mbHor); + else + mpCellBorderUpdater->UpdateCellBorder(mbTop, mbBottom, mbRight, mbLeft, maIMGCellBorder, mbVer, mbHor); + + if(mbLeft || mbRight || mbTop || mbBottom) + mbOuterBorder = true; + else + mbOuterBorder = false; + + UpdateControlState(); + } + } + break; + case SID_ATTR_BORDER_INNER: + if(eState >= SFX_ITEM_DEFAULT) + { + const SvxBoxInfoItem* pBoxInfoItem = dynamic_cast< const SvxBoxInfoItem* >(pState); + + if(pBoxInfoItem) + { + bool bLeft(false), bRight(false), bTop(false), bBottom(false); + + mbVer = false, mbHor = false; + + if(!pBoxInfoItem->IsValid( VALID_VERT ) || pBoxInfoItem->GetVert()) + mbVer = true; + + if(!pBoxInfoItem->IsValid( VALID_HORI ) || pBoxInfoItem->GetHori()) + mbHor = true; + + if(!pBoxInfoItem->IsValid( VALID_LEFT ) || mbLeft) + bLeft = true; + + if(!pBoxInfoItem->IsValid( VALID_RIGHT ) || mbRight) + bRight = true; + + if(!pBoxInfoItem->IsValid( VALID_TOP ) || mbTop) + bTop = true; + + if(!pBoxInfoItem->IsValid( VALID_BOTTOM ) || mbBottom) + bBottom = true; + + if(!Application::GetSettings().GetLayoutRTL()) + mpCellBorderUpdater->UpdateCellBorder(bTop, bBottom, bLeft, bRight, maIMGCellBorder, mbVer, mbHor); + else + mpCellBorderUpdater->UpdateCellBorder(bTop, bBottom, bRight, bLeft, maIMGCellBorder, mbVer, mbHor); + + if(mbVer || mbHor || bLeft || bRight || bTop || bBottom) + mbInnerBorder = true; + else + mbInnerBorder = false; + + UpdateControlState(); + } + } + break; + case SID_ATTR_BORDER_DIAG_TLBR: + if( eState == SFX_ITEM_DONTCARE ) + { + mbTLBR = true; + maTLBRColor.SetColor(COL_TRANSPARENT); + mnTLBRIn = mnTLBROut = mnTLBRDis = 0; + UpdateControlState(); + break; + } + + if(eState >= SFX_ITEM_DEFAULT) + { + const SvxLineItem* pItem = dynamic_cast< const SvxLineItem* >(pState); + + if(pItem) + { + const editeng::SvxBorderLine* aLine = pItem->GetLine(); + + if(!aLine) + { + mbTLBR = false; + } + else + { + mbTLBR = true; + maTLBRColor = aLine->GetColor(); + mnTLBRIn = aLine->GetInWidth(); + mnTLBROut = aLine->GetOutWidth(); + mnTLBRDis = aLine->GetDistance(); + + if(mnTLBRIn == 0 && mnTLBROut == 0 && mnTLBRDis == 0) + mbTLBR = false; + } + + UpdateControlState(); + break; + } + } + + mbTLBR = false; + UpdateControlState(); + break; + case SID_ATTR_BORDER_DIAG_BLTR: + if( eState == SFX_ITEM_DONTCARE ) + { + mbBLTR = true; + maBLTRColor.SetColor( COL_TRANSPARENT ); + mnBLTRIn = mnBLTROut = mnBLTRDis = 0; + UpdateControlState(); + break; + } + + if(eState >= SFX_ITEM_DEFAULT) + { + const SvxLineItem* pItem = dynamic_cast< const SvxLineItem* >(pState); + + if(pItem) + { + const editeng::SvxBorderLine* aLine = pItem->GetLine(); + + if(!aLine) + { + mbBLTR = false; + } + else + { + mbBLTR = true; + maBLTRColor = aLine->GetColor(); + mnBLTRIn = aLine->GetInWidth(); + mnBLTROut = aLine->GetOutWidth(); + mnBLTRDis = aLine->GetDistance(); + + if(mnBLTRIn == 0 && mnBLTROut == 0 && mnBLTRDis == 0) + mbBLTR = false; + } + + UpdateControlState(); + } + break; + } + + mbBLTR = false; + UpdateControlState(); + break; + case SID_SCGRIDSHOW: + if(eState >= SFX_ITEM_DEFAULT) + { + const SfxBoolItem* pItem = dynamic_cast< const SfxBoolItem* >(pState); + + if(pItem) + { + const bool bVal = pItem->GetValue(); + + if(bVal) + mpCBXShowGrid->Check(true); + else + mpCBXShowGrid->Check(false); + } + } + break; + } +} + +////////////////////////////////////////////////////////////////////////////// + +SfxBindings* CellAppearancePropertyPanel::GetBindings() +{ + return mpBindings; +} + +////////////////////////////////////////////////////////////////////////////// + +void CellAppearancePropertyPanel::SetStyleIcon() +{ + //FIXME: update for new line border possibilities + if(mnOut == DEF_LINE_WIDTH_0 && mnIn == 0 && mnDis == 0) //1 + mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, maIMGLineStyle1); + else if(mnOut == DEF_LINE_WIDTH_2 && mnIn == 0 && mnDis == 0) //2 + mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, maIMGLineStyle2); + else if(mnOut == DEF_LINE_WIDTH_3 && mnIn == 0 && mnDis == 0) //3 + mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, maIMGLineStyle3); + else if(mnOut == DEF_LINE_WIDTH_4 && mnIn == 0 && mnDis == 0) //4 + mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, maIMGLineStyle4); + else if(mnOut == DEF_LINE_WIDTH_0 && mnIn == DEF_LINE_WIDTH_0 && mnDis == DEF_LINE_WIDTH_1) //5 + mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, maIMGLineStyle5); + else if(mnOut == DEF_LINE_WIDTH_0 && mnIn == DEF_LINE_WIDTH_0 && mnDis == DEF_LINE_WIDTH_2) //6 + mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, maIMGLineStyle6); + else if(mnOut == DEF_LINE_WIDTH_1 && mnIn == DEF_LINE_WIDTH_2 && mnDis == DEF_LINE_WIDTH_1) //7 + mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, maIMGLineStyle7); + else if(mnOut == DEF_LINE_WIDTH_2 && mnIn == DEF_LINE_WIDTH_0 && mnDis == DEF_LINE_WIDTH_2) //8 + mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, maIMGLineStyle8); + else if(mnOut == DEF_LINE_WIDTH_2 && mnIn == DEF_LINE_WIDTH_2 && mnDis == DEF_LINE_WIDTH_2) //9 + mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, maIMGLineStyle9); + else + mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, maIMGLineStyle1); +} + +////////////////////////////////////////////////////////////////////////////// + +void CellAppearancePropertyPanel::UpdateControlState() +{ + if(mbOuterBorder || mbInnerBorder || mbTLBR || mbBLTR) + { + mpTBLineColor->Enable(); + mpTBLineStyle->Enable(); + + //set line color state + if( mbLineColorAvailable && !mbTLBR && !mbBLTR ) + mpLineColorUpdater->Update(maLineColor); + else if( !mbLineColorAvailable && mbTLBR && !mbBLTR ) + mpLineColorUpdater->Update(maTLBRColor); + else if ( !mbLineColorAvailable && !mbTLBR && mbBLTR ) + mpLineColorUpdater->Update(maBLTRColor); + else if( !mbLineColorAvailable && mbTLBR && mbBLTR) + { + if( maTLBRColor == maBLTRColor) + mpLineColorUpdater->Update(maBLTRColor); + else + mpLineColorUpdater->Update(COL_TRANSPARENT); + } + else if( mbLineColorAvailable && mbTLBR && !mbBLTR ) + { + if( maTLBRColor == maLineColor) + mpLineColorUpdater->Update(maLineColor); + else + mpLineColorUpdater->Update(COL_TRANSPARENT); + } + else if( mbLineColorAvailable && !mbTLBR && mbBLTR ) + { + if( maBLTRColor == maLineColor) + mpLineColorUpdater->Update(maLineColor); + else + mpLineColorUpdater->Update(COL_TRANSPARENT); + } + else + mpLineColorUpdater->Update(COL_TRANSPARENT); + + //set line style state + if( mbBorderStyleAvailable && !mbTLBR && !mbBLTR ) + { + } + else if( !mbBorderStyleAvailable && mbTLBR && !mbBLTR ) + { + mnIn = mnTLBRIn; + mnOut = mnTLBROut; + mnDis = mnTLBRDis; + } + else if ( !mbBorderStyleAvailable && !mbTLBR && mbBLTR ) + { + mnIn = mnBLTRIn; + mnOut = mnBLTROut; + mnDis = mnBLTRDis; + } + else if( !mbBorderStyleAvailable && mbTLBR && mbBLTR) + { + if( mnTLBRIn == mnBLTRIn && mnTLBROut == mnBLTROut && mnTLBRDis == mnBLTRDis) + { + mnIn = mnTLBRIn; + mnOut = mnTLBROut; + mnDis = mnTLBRDis; + } + else + { + mnIn = 0; + mnOut = 0; + mnDis = 0; + } + } + else if( mbBorderStyleAvailable && mbTLBR && !mbBLTR ) + { + if( mnTLBRIn != mnIn || mnTLBROut != mnOut || mnTLBRDis != mnDis) + { + mnIn = 0; + mnOut = 0; + mnDis = 0; + } + } + else if( mbBorderStyleAvailable && !mbTLBR && mbBLTR ) + { + if( mnBLTRIn != mnIn || mnBLTROut != mnOut || mnBLTRDis != mnDis ) + { + mnIn = 0; + mnOut = 0; + mnDis = 0; + } + } + else + { + mnIn = 0; + mnOut = 0; + mnDis = 0; + } + SetStyleIcon(); + } + else + { + mpTBLineColor->Disable(); + mpTBLineStyle->Disable(); + } +} + +////////////////////////////////////////////////////////////////////////////// +// namespace close + +}} // end of namespace ::sc::sidebar + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.hrc b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hrc new file mode 100644 index 000000000000..a0a3b9e2c16f --- /dev/null +++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hrc @@ -0,0 +1,114 @@ +/* + * 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 . + */ +#define FT_BK_COLOR 1 +#define TB_BK_COLOR 2 +#define TBI_BK_COLOR 3 +#define FT_BORDER 4 +#define TB_APP_BORDER 5 +#define TBI_BORDER 6 +#define TB_BORDER_LINE_STYLE 7 +#define TBI_LINE_STYLE 8 +#define TB_BORDER_LINE_COLOR 9 +#define TBI_LINE_COLOR 10 +#define CBX_SHOW_GRID 11 + +#define STR_QH_BK_COLOR 12 +#define STR_QH_BORDER 13 +#define STR_QH_BORDER_LINE_STYLE 14 +#define STR_QH_BORDER_LINE_COLOR 15 + +#define IMG_BK_COLOR 21 +#define IMG_CELL_BORDER 22 +#define IMG_LINE_COLOR 23 +#define IMG_LINE_STYLE1 25 +#define IMG_LINE_STYLE2 26 +#define IMG_LINE_STYLE3 27 +#define IMG_LINE_STYLE4 28 +#define IMG_LINE_STYLE5 29 +#define IMG_LINE_STYLE6 30 +#define IMG_LINE_STYLE7 31 +#define IMG_LINE_STYLE8 32 +#define IMG_LINE_STYLE9 33 + +//BACK_COLOR PAGE +#define VS_BACK_COLOR 1 +#define STR_AUTOMATICE 2 + +//LINE COLOR PAGE +#define VS_LINE_COLOR 1 + +//line style page +#define VS_STYLE 1 +#define PB_OPTIONS 2 +#define BMP_UNDERLINE_MORE 3 + +//line border page +#define TB_BORDER1 1 +#define TB_BORDER2 2 +#define TB_BORDER3 3 + +#define TBI_BORDER1_NONE 7 +#define TBI_BORDER1_ALL 8 +#define TBI_BORDER1_OUTER 9 +#define TBI_BORDER1_OUTERBOLD 10 +#define TBI_BORDER2_LEFT 11 +#define TBI_BORDER2_RIGHT 12 +#define TBI_BORDER2_TOP 13 +#define TBI_BORDER2_BOT 14 +#define TBI_BORDER2_BLTR 15 +#define TBI_BORDER2_TLBR 16 +#define TBI_BORDER2_TOPBOT 17 +#define TBI_BORDER2_LEFTRIGHT 18 +#define TBI_BORDER3_S1 19 +#define TBI_BORDER3_S2 20 +#define TBI_BORDER3_S3 21 +#define TBI_BORDER3_S4 22 +#define FL_1 23 +#define FL_2 24 + +#define IMG_BORDER1 25 +#define IMG_BORDER2 26 +#define IMG_BORDER3 27 +#define IMG_BORDER4 28 +#define IMG_BORDER5 29 +#define IMG_BORDER6 30 +#define IMG_BORDER7 31 +#define IMG_BORDER8 32 +#define IMG_BORDER9 33 +#define IMG_BORDER10 34 +#define IMG_BORDER11 35 +#define IMG_BORDER12 36 +#define IMG_BORDER13 37 +#define IMG_BORDER14 38 +#define IMG_BORDER15 39 +#define IMG_BORDER16 40 + +#define STR_BORDER_1 41 +#define STR_BORDER_2 42 +#define STR_BORDER_3 43 +#define STR_BORDER_4 44 +#define STR_BORDER_5 45 +#define STR_BORDER_6 46 +#define STR_BORDER_7 47 +#define STR_BORDER_8 48 + +#define VS_FILLCOLOR 1 +#define VS_NOFILLCOLOR 2 +#define VS_LINECOLOR 1 + +// eof diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx new file mode 100644 index 000000000000..184cd9580588 --- /dev/null +++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx @@ -0,0 +1,197 @@ +/* + * 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 SC_PROPERTYPANEL_APPEARANCE_HXX +#define SC_PROPERTYPANEL_APPEARANCE_HXX + +#include <sfx2/sidebar/SidebarPanelBase.hxx> +#include <sfx2/sidebar/ControllerItem.hxx> +#include <sfx2/sidebar/IContextChangeReceiver.hxx> +#include <boost/scoped_ptr.hpp> +#include <svx/sidebar/ColorPopup.hxx> + +class FixedText; +namespace svx { class ToolboxButtonColorUpdater; } +namespace sc { namespace sidebar { + class CellLineStylePopup; + class CellBorderStylePopup; + class CellLineStyleControl; + class CellBorderUpdater; +}} +class ToolBox; +class CheckBox; + +namespace sc { namespace sidebar { + +class CellAppearancePropertyPanel +: public Control, + public ::sfx2::sidebar::IContextChangeReceiver, + public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface +{ +private: + friend class CellLineStyleControl; + friend class CellBorderStyleControl; + +public: + static CellAppearancePropertyPanel* Create( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings); + + virtual void DataChanged( + const DataChangedEvent& rEvent); + + virtual void HandleContextChange( + const ::sfx2::sidebar::EnumContext aContext); + + virtual void NotifyItemUpdate( + const sal_uInt16 nSId, + const SfxItemState eState, + const SfxPoolItem* pState); + + SfxBindings* GetBindings(); + +private: + //ui controls + ::boost::scoped_ptr< FixedText > mpFTFillColor; + ::boost::scoped_ptr< Window > mpTBFillColorBackground; + ::boost::scoped_ptr< ToolBox > mpTBFillColor; + ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpFillColorUpdater; + + ::boost::scoped_ptr< FixedText > mpFTCellBorder; + ::boost::scoped_ptr< Window > mpTBCellBorderBackground; + ::boost::scoped_ptr< ToolBox > mpTBCellBorder; + ::boost::scoped_ptr< CellBorderUpdater > mpCellBorderUpdater; + + ::boost::scoped_ptr< Window > mpTBLineStyleBackground; + ::boost::scoped_ptr< ToolBox > mpTBLineStyle; + + ::boost::scoped_ptr< Window > mpTBLineColorBackground; + ::boost::scoped_ptr< ToolBox > mpTBLineColor; + ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpLineColorUpdater; + + ::boost::scoped_ptr< CheckBox > mpCBXShowGrid; + + ::sfx2::sidebar::ControllerItem maBackColorControl; + ::sfx2::sidebar::ControllerItem maLineColorControl; + ::sfx2::sidebar::ControllerItem maLineStyleControl; + ::sfx2::sidebar::ControllerItem maBorderOuterControl; + ::sfx2::sidebar::ControllerItem maBorderInnerControl; + ::sfx2::sidebar::ControllerItem maGridShowControl; + ::sfx2::sidebar::ControllerItem maBorderTLBRControl; + ::sfx2::sidebar::ControllerItem maBorderBLTRControl; + + // images + Image maIMGBKColor; + Image maIMGCellBorder; + Image maIMGLineColor; + Image maIMGLineStyle1; + Image maIMGLineStyle2; + Image maIMGLineStyle3; + Image maIMGLineStyle4; + Image maIMGLineStyle5; + Image maIMGLineStyle6; + Image maIMGLineStyle7; + Image maIMGLineStyle8; + Image maIMGLineStyle9; + + // cell background color + Color maBackColor; + + // cell line color(s) + Color maLineColor; + Color maTLBRColor; + Color maBLTRColor; + + // BorderStyle defines + sal_uInt16 mnIn; + sal_uInt16 mnOut; + sal_uInt16 mnDis; + sal_uInt16 mnTLBRIn; + sal_uInt16 mnTLBROut; + sal_uInt16 mnTLBRDis; + sal_uInt16 mnBLTRIn; + sal_uInt16 mnBLTROut; + sal_uInt16 mnBLTRDis; + + /// bitfield + bool mbBackColorAvailable : 1; + bool mbLineColorAvailable : 1; + bool mbBorderStyleAvailable : 1; + + // CellBorder defines + bool mbLeft : 1; + bool mbRight : 1; + bool mbTop : 1; + bool mbBottom : 1; + bool mbVer : 1; + bool mbHor : 1; + + bool mbOuterBorder : 1; // mbLeft || mbRight || mbTop || mbBottom + bool mbInnerBorder : 1; // mbVer || mbHor || bLeft || bRight || bTop || bBottom + + bool mbTLBR : 1; + bool mbBLTR : 1; + + // popups + svx::sidebar::ColorPopup maFillColorPopup; + svx::sidebar::ColorPopup maLineColorPopup; + ::boost::scoped_ptr< CellLineStylePopup > mpCellLineStylePopup; + ::boost::scoped_ptr< CellBorderStylePopup > mpCellBorderStylePopup; + + cssu::Reference<css::frame::XFrame> mxFrame; + ::sfx2::sidebar::EnumContext maContext; + SfxBindings* mpBindings; + + DECL_LINK(TbxBKColorSelectHdl, ToolBox*); + DECL_LINK(TbxLineColorSelectHdl, ToolBox*); + DECL_LINK(TbxCellBorderSelectHdl, ToolBox*); + DECL_LINK(TbxLineStyleSelectHdl, ToolBox*); + DECL_LINK(CBOXGridShowClkHdl, void*); + + // for fill color picker + svx::sidebar::PopupControl* CreateFillColorPopupControl(svx::sidebar::PopupContainer* pParent); + void SetFillColor(const String& rsColorName, const Color aColor); + + // for line color picker + svx::sidebar::PopupControl* CreateLineColorPopupControl(svx::sidebar::PopupContainer* pParent); + void SetLineColor(const String& rsColorName, const Color aColor); + + // for CellLineStyle popup + svx::sidebar::PopupControl* CreateCellLineStylePopupControl(svx::sidebar::PopupContainer* pParent); + void EndCellLineStylePopupMode(void); + + // for CellBorderStyle popup + svx::sidebar::PopupControl* CreateCellBorderStylePopupControl(svx::sidebar::PopupContainer* pParent); + void EndCellBorderStylePopupMode(void); + + // constructor/destuctor + CellAppearancePropertyPanel( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings); + virtual ~CellAppearancePropertyPanel(); + + void Initialize(); + void SetStyleIcon(); + void UpdateControlState(); +}; + +} } // end of namespace ::sc::sidebar + +#endif +// eof diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.src b/sc/source/ui/sidebar/CellAppearancePropertyPanel.src new file mode 100644 index 000000000000..cb870818bfd3 --- /dev/null +++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.src @@ -0,0 +1,495 @@ +/* + * 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 "CellAppearancePropertyPanel.hrc" +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include "sc.hrc" +#include "helpids.h" + +#define TOOLBOX_WIDTH 50 +#define TOOLBOX_HEIGHT 15 + +#define TOOLBOX_WIDTH_2 34 +#define TOOLBOX_HEIGHT_2 30 + +#define TOOLBOX_BORDER_WIDTH 107 +#define PB_BORDER_MOREBTN 57 +#define POPUPPANEL_MARGIN_SMALL_PIXEL 8 + +////////////////////////////////////////////////////////////////////////////// +// the basic propertypanel + +Control RID_PROPERTYPANEL_SC_APPEAR +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + + Size = MAP_APPFONT( PROPERTYPAGE_WIDTH, SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT * 2 + TEXT_CONTROL_SPACING_VERTICAL * 2 + TOOLBOX_HEIGHT + CONTROL_SPACING_VERTICAL * 2 + TOOLBOX_HEIGHT_2 + CBOX_HEIGHT + SECTIONPAGE_MARGIN_VERTICAL_BOT - 2); + HelpID = HID_PROPERTYPANEL_SC_CELL_SECTION ; + Text [ en-US ] = "Cell Appearance"; + + FixedText FT_BK_COLOR + { + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL, SECTIONPAGE_MARGIN_VERTICAL_TOP ); + Size = MAP_APPFONT ( PROPERTYPAGE_WIDTH - SECTIONPAGE_MARGIN_HORIZONTAL * 2 , TEXT_HEIGHT) ; + Text [ en-US ] = "~Cell background:"; + }; + ToolBox TB_BK_COLOR + { + SVLook = TRUE ; + Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL, SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL) ; + Size = MAP_APPFONT (TOOLBOX_WIDTH ,TOOLBOX_HEIGHT ) ; + TabStop = TRUE ; + HelpID = HID_PROPERTYPANEL_SC_TBX_BKCOLOR ; + Text [ en-US ] = "Cell Background"; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_BK_COLOR ; + DropDown = TRUE ; + Text [ en-US ] = "Cell background" ; + HelpID = HID_PROPERTYPANEL_SC_TBI_BKCOLOR; + }; + }; + }; + String STR_QH_BK_COLOR + { + Text [ en-US ] = "Select the background color of the selected cells." ; + }; + FixedText FT_BORDER + { + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL, SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + TOOLBOX_HEIGHT + CONTROL_SPACING_VERTICAL); + Size = MAP_APPFONT ( PROPERTYPAGE_WIDTH - SECTIONPAGE_MARGIN_HORIZONTAL * 2 , TEXT_HEIGHT) ; + Text [ en-US ] = "Cell ~border:"; + }; + ToolBox TB_APP_BORDER + { + SVLook = TRUE ; + Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL, SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT * 2 + TEXT_CONTROL_SPACING_VERTICAL * 2 + TOOLBOX_HEIGHT + CONTROL_SPACING_VERTICAL) ; + Size = MAP_APPFONT (TOOLBOX_WIDTH_2 ,TOOLBOX_HEIGHT_2 ) ; + TabStop = TRUE ; + HelpID = HID_PROPERTYPANEL_SC_TBX_BORDER ; + Text [ en-US ] = "Cell Border"; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_BORDER ; + DropDown = TRUE ; + Text [ en-US ] = "Cell border" ; + HelpID = HID_PROPERTYPANEL_SC_TBI_BORDER; + }; + }; + }; + String STR_QH_BORDER + { + Text [ en-US ] = "Specify the borders of the selected cells." ; + }; + ToolBox TB_BORDER_LINE_STYLE + { + SVLook = TRUE ; + Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL + TOOLBOX_WIDTH_2 + 3, SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT * 2 + TEXT_CONTROL_SPACING_VERTICAL * 2 + TOOLBOX_HEIGHT + CONTROL_SPACING_VERTICAL ) ; + Size = MAP_APPFONT (TOOLBOX_WIDTH ,TOOLBOX_HEIGHT) ; + TabStop = TRUE ; + HelpID = HID_PROPERTYPANEL_SC_TBX_STYLE ; + Text [ en-US ] = "Line Style"; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_LINE_STYLE ; + DropDown = TRUE ; + Text [ en-US ] = "Line style" ; + HelpID = HID_PROPERTYPANEL_SC_TBI_STYLE; + }; + }; + }; + String STR_QH_BORDER_LINE_STYLE + { + Text [ en-US ] = "Select the line style of the borders." ; + }; + ToolBox TB_BORDER_LINE_COLOR + { + SVLook = TRUE ; + Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL + TOOLBOX_WIDTH_2 + 3, SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT * 2 + TEXT_CONTROL_SPACING_VERTICAL * 2 + TOOLBOX_HEIGHT * 2 + CONTROL_SPACING_VERTICAL + 3) ; + Size = MAP_APPFONT (TOOLBOX_WIDTH ,TOOLBOX_HEIGHT ) ; + TabStop = TRUE ; + HelpID = HID_PROPERTYPANEL_SC_TBX_LINECOLOR ; + Text [ en-US ] = "Line Color"; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_LINE_COLOR ; + DropDown = TRUE ; + Text [ en-US ] = "Line color" ; + HelpID = HID_PROPERTYPANEL_SC_TBI_LINECOLOR; + }; + }; + }; + String STR_QH_BORDER_LINE_COLOR + { + Text [ en-US ] = "Select the line color of the borders." ; + }; + CheckBox CBX_SHOW_GRID + { + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL , SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT * 2 + TEXT_CONTROL_SPACING_VERTICAL * 2 + TOOLBOX_HEIGHT + CONTROL_SPACING_VERTICAL * 2 + TOOLBOX_HEIGHT_2 + 2) ; + Size = MAP_APPFONT ( 90 , CBOX_HEIGHT ) ; + TabStop = TRUE ; + Text [ en-US ] = "Show cell ~grid lines" ; + QuickHelpText [ en-US ] = "Show the grid lines of the cells in the entire spreadsheet."; + HelpID = HID_PROPERTYPANEL_SC_CBOX_SHOWGRID; + }; + + Image IMG_BK_COLOR + { + ImageBitmap = Bitmap{File = "sidebar/fill_color.png";}; + }; + Image IMG_CELL_BORDER + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder.png";}; + //MaskColor = STD_MASKCOLOR ; + }; + Image IMG_LINE_COLOR + { + ImageBitmap = Bitmap{File = "sidebar/Line_color.png";}; + }; + Image IMG_LINE_STYLE1 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_005.png";}; + }; + Image IMG_LINE_STYLE2 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_250.png";}; + }; + Image IMG_LINE_STYLE3 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_400.png";}; + }; + Image IMG_LINE_STYLE4 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_500.png";}; + }; + Image IMG_LINE_STYLE5 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_110.png";}; + }; + Image IMG_LINE_STYLE6 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_260.png";}; + }; + Image IMG_LINE_STYLE7 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_450.png";}; + }; + Image IMG_LINE_STYLE8 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_505.png";}; + }; + Image IMG_LINE_STYLE9 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_750.png";}; + }; +}; + +////////////////////////////////////////////////////////////////////////////// +// fill color popup + +Control RID_POPUPPANEL_CELLAPPEARANCE_FILLCOLOR +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + Size = MAP_APPFONT( POPUP_COLOR_PICKER_WIDTH , POPUP_COLOR_PICKER_HEIGHT ); + + Control VS_FILLCOLOR + { + HelpID = HID_PROPERTYPANEL_FILL_COLOR_VS; + Hide = TRUE ; + Pos = MAP_APPFONT ( OFFSET_X , OFFSET_Y ); + Size = MAP_APPFONT ( POPUP_COLOR_PICKER_WIDTH - OFFSET_X * 2, POPUP_COLOR_PICKER_HEIGHT - OFFSET_Y * 2); + TabStop = TRUE ; + Text [ en-US ] = "Color"; + }; + + String VS_NOFILLCOLOR + { + Text [ en-US ] = "No Color" ; + }; +}; + +////////////////////////////////////////////////////////////////////////////// +// line color popup + +Control RID_POPUPPANEL_CELLAPPEARANCE_LINECOLOR +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + Size = MAP_APPFONT( POPUP_COLOR_PICKER_WIDTH , POPUP_COLOR_PICKER_HEIGHT ); + + Control VS_LINECOLOR + { + HelpID = HID_PROPERTYPANEL_LINE_COLOR_VS; + Hide = TRUE ; + Pos = MAP_APPFONT ( OFFSET_X , OFFSET_Y ); + Size = MAP_APPFONT ( POPUP_COLOR_PICKER_WIDTH - OFFSET_X * 2, POPUP_COLOR_PICKER_HEIGHT - OFFSET_Y * 2); + TabStop = TRUE ; + Text [ en-US ] = "Color"; + }; +}; + +////////////////////////////////////////////////////////////////////////////// +// cell line style popup + +Control RID_POPUPPANEL_APPEARANCE_CELL_LINESTYLE +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + + Size = MAP_APPFONT( + POPUPPANEL_MARGIN_SMALL * 2 + POPUP_BORDER_WIDTH + 80, + 13 + POPUP_BORDER_HEIGHT + POPUPPANEL_MARGIN_SMALL * 2 + POPUPPANEL_MARGIN_LARGE + 12*9); + + Control VS_STYLE + { + HelpID = HID_PROPERTYPANEL_SC_STYLE_VS ; + Hide = TRUE ; + Pos = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL + OFFSET_X , POPUPPANEL_MARGIN_SMALL + OFFSET_Y ); + Size = MAP_APPFONT ( 80 , 12 * 9); + TabStop = TRUE ; + Text [ en-US ] = "Line Style"; + }; + PushButton PB_OPTIONS + { + HelpID = HID_PROPERTYPANEL_SC_STYLE_PB; + Pos = MAP_APPFONT ( POPUPPANEL_MARGIN_LARGE + OFFSET_X , POPUPPANEL_MARGIN_SMALL * 2 + OFFSET_Y + 12 * 9); + Size = MAP_APPFONT ( 75 , 12 ); + TabStop = TRUE; + Text [ en-US ] = "~More Options..."; + }; + Bitmap BMP_UNDERLINE_MORE + { + File = "sidebar/morebutton.png"; + }; +}; + +////////////////////////////////////////////////////////////////////////////// +// cell border style popup + +Control RID_POPUPPANEL_APPEARANCE_CELL_BORDERSTYLE +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + + Size = MAP_PIXEL( POPUPPANEL_MARGIN_SMALL_PIXEL * 2 + 108, POPUPPANEL_MARGIN_SMALL_PIXEL * 2 + 138); + + ToolBox TB_BORDER1 + { + SVLook = TRUE ; + Pos = MAP_PIXEL(POPUPPANEL_MARGIN_SMALL_PIXEL, POPUPPANEL_MARGIN_SMALL_PIXEL); //MAP_APPFONT (POPUPPANEL_MARGIN_SMALL + OFFSET_X + 1, POPUPPANEL_MARGIN_SMALL + OFFSET_Y + 1) ; + Size = MAP_PIXEL(TOOLBOX_BORDER_WIDTH, 31); //MAP_APPFONT (TOOLBOX_BORDER_WIDTH ,20) ; + TabStop = TRUE ; + HelpID = HID_PROPERTYPANEL_SC_BORDER1_TBX; + Text [ en-US ] = "Cell Border 1"; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_BORDER1_NONE ; + HelpID = HID_PROPERTYPANEL_SC_BORDER_TBI_NONE; + Text [ en-US ] = "No Border" ; + }; + ToolBoxItem + { + Identifier = TBI_BORDER1_ALL ; + HelpID = HID_PROPERTYPANEL_SC_BORDER_TBI_ALL; + Text [ en-US ] = "All Borders" ; + }; + ToolBoxItem + { + Identifier = TBI_BORDER1_OUTER ; + HelpID = HID_PROPERTYPANEL_SC_BORDER_TBI_OUTER; + Text [ en-US ] = "Outside Borders" ; + }; + ToolBoxItem + { + Identifier = TBI_BORDER1_OUTERBOLD ; + HelpID = HID_PROPERTYPANEL_SC_BORDER_TBI_OUTERBOLD; + Text [ en-US ] = "Thick Box Border" ; + }; + }; + }; + FixedLine FL_1 + { + Pos = MAP_PIXEL(POPUPPANEL_MARGIN_SMALL_PIXEL, POPUPPANEL_MARGIN_SMALL_PIXEL + 31); //MAP_APPFONT ( POPUPPANEL_MARGIN_SMALL + OFFSET_X + 1 , POPUPPANEL_MARGIN_SMALL + OFFSET_Y + 20 + 1) ; + Size = MAP_PIXEL(TOOLBOX_BORDER_WIDTH, 8); // MAP_APPFONT ( TOOLBOX_BORDER_WIDTH , 5 ) ; + }; + ToolBox TB_BORDER2 + { + SVLook = TRUE ; + Pos = MAP_PIXEL(POPUPPANEL_MARGIN_SMALL_PIXEL, POPUPPANEL_MARGIN_SMALL_PIXEL + 31 + 8); // MAP_APPFONT (POPUPPANEL_MARGIN_SMALL + OFFSET_X + 1, POPUPPANEL_MARGIN_SMALL + OFFSET_Y + 20 + 5 + 1) ; + Size = MAP_PIXEL (TOOLBOX_BORDER_WIDTH ,61) ; + TabStop = TRUE ; + HelpID = HID_PROPERTYPANEL_SC_BORDER2_TBX; + Text [ en-US ] = "Cell Border 2"; + }; + FixedLine FL_2 + { + Pos = MAP_PIXEL(POPUPPANEL_MARGIN_SMALL_PIXEL, POPUPPANEL_MARGIN_SMALL_PIXEL + 31 + 8 + 61); // MAP_APPFONT ( POPUPPANEL_MARGIN_SMALL + OFFSET_X + 1 , POPUPPANEL_MARGIN_SMALL + OFFSET_Y + 20 + 38 + 5 + 1) ; + Size = MAP_PIXEL ( TOOLBOX_BORDER_WIDTH , 8 ) ; + }; + ToolBox TB_BORDER3 + { + SVLook = TRUE ; + Pos = MAP_PIXEL(POPUPPANEL_MARGIN_SMALL_PIXEL, POPUPPANEL_MARGIN_SMALL_PIXEL + 31 +8 + 61 + 8); // MAP_APPFONT (POPUPPANEL_MARGIN_SMALL + OFFSET_X + 1, POPUPPANEL_MARGIN_SMALL + OFFSET_Y + 20 + 38 + 10 + 1) ; + Size = MAP_PIXEL (TOOLBOX_BORDER_WIDTH ,31) ; + TabStop = TRUE ; + HelpID = HID_PROPERTYPANEL_SC_BORDER3_TBX; + Text [ en-US ] = "Cell Border 3"; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_BORDER3_S1; + HelpID = HID_PROPERTYPANEL_SC_BORDER_TBI_S1; + Text [ en-US ] = "Thick Bottom Border" ; + }; + ToolBoxItem + { + Identifier = TBI_BORDER3_S2 ; + HelpID = HID_PROPERTYPANEL_SC_BORDER_TBI_S2; + Text [ en-US ] = "Double Bottom Border" ; + }; + ToolBoxItem + { + Identifier = TBI_BORDER3_S3 ; + HelpID = HID_PROPERTYPANEL_SC_BORDER_TBI_S3; + Text [ en-US ] = "Top and Thick Bottom Borders" ; + }; + ToolBoxItem + { + Identifier = TBI_BORDER3_S4 ; + HelpID = HID_PROPERTYPANEL_SC_BORDER_TBI_S4; + Text [ en-US ] = "Top and Double Bottom Borders" ; + }; + }; + }; + + Image IMG_BORDER1 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_Empty_18x18.png";}; + }; + Image IMG_BORDER2 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_All_18x18.png";}; + }; + Image IMG_BORDER3 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_FourBorders_18x18.png";}; + }; + Image IMG_BORDER4 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_FourBorders_Thick_18x18.png";}; + }; + Image IMG_BORDER5 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_Left_18x18.png";}; + }; + Image IMG_BORDER6 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_Right_18x18.png";}; + }; + Image IMG_BORDER7 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_Top_18x18.png";}; + }; + Image IMG_BORDER8 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_Bottom_18x18.png";}; + }; + Image IMG_BORDER9 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_RightDiagonal_18x18.png";}; + }; + Image IMG_BORDER10 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_LeftDiagonal_18x18.png";}; + }; + Image IMG_BORDER11 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_TopAndBottom_18x18.png";}; + }; + Image IMG_BORDER12 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_LeftAndRight_18x18.png";}; + }; + Image IMG_BORDER13 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_Bottom_Thick_18x18.png";}; + }; + Image IMG_BORDER14 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_Bottom_Double_18x18.png";}; + }; + Image IMG_BORDER15 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_TopThin_BottomThick_18x18.png";}; + }; + Image IMG_BORDER16 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_TopSingle_BottomDouble_18x18.png";}; + }; + String STR_BORDER_1 + { + Text [ en-US ] = "Left Border"; + }; + String STR_BORDER_2 + { + Text [ en-US ] = "Right Border"; + }; + String STR_BORDER_3 + { + Text [ en-US ] = "Top Border"; + }; + String STR_BORDER_4 + { + Text [ en-US ] = "Bottom Border"; + }; + String STR_BORDER_5 + { + Text [ en-US ] = "Diagonal Up Border"; + }; + String STR_BORDER_6 + { + Text [ en-US ] = "Diagonal Down Border"; + }; + String STR_BORDER_7 + { + Text [ en-US ] = "Top and Bottom Borders"; + }; + String STR_BORDER_8 + { + Text [ en-US ] = "Left and Right Borders"; + }; +}; + +// eof diff --git a/sc/source/ui/sidebar/CellBorderStyleControl.cxx b/sc/source/ui/sidebar/CellBorderStyleControl.cxx new file mode 100644 index 000000000000..867d1c0308cf --- /dev/null +++ b/sc/source/ui/sidebar/CellBorderStyleControl.cxx @@ -0,0 +1,344 @@ +/* + * 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 <CellBorderStyleControl.hxx> +#include "sc.hrc" +#include "scresid.hxx" +#include <CellAppearancePropertyPanel.hrc> +#include <editeng/boxitem.hxx> +#include <editeng/borderline.hxx> +#include <CellAppearancePropertyPanel.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <vcl/svapp.hxx> +#include <editeng/lineitem.hxx> + +namespace sc { namespace sidebar { + +#define FRM_VALID_LEFT 0x01 +#define FRM_VALID_RIGHT 0x02 +#define FRM_VALID_TOP 0x04 +#define FRM_VALID_BOTTOM 0x08 +#define FRM_VALID_HINNER 0x10 +#define FRM_VALID_VINNER 0x20 +#define FRM_VALID_OUTER 0x0f +#define FRM_VALID_ALL 0xff + +CellBorderStyleControl::CellBorderStyleControl(Window* pParent, CellAppearancePropertyPanel& rPanel) +: svx::sidebar::PopupControl(pParent, ScResId(RID_POPUPPANEL_APPEARANCE_CELL_BORDERSTYLE)), + mrCellAppearancePropertyPanel(rPanel), + maTBBorder1(this, ScResId(TB_BORDER1)), + maTBBorder2(this, ScResId(TB_BORDER2)), + maTBBorder3(this, ScResId(TB_BORDER3)), + maFL1(this, ScResId(FL_1)), + maFL2(this, ScResId(FL_2)), + mpImageList(0) +{ + Initialize(); + FreeResource(); +} + +CellBorderStyleControl::~CellBorderStyleControl(void) +{ + delete[] mpImageList; +} + +void CellBorderStyleControl::Initialize() +{ + mpImageList = new Image[16]; + mpImageList[0] = Image(ScResId(IMG_BORDER1)); + mpImageList[1] = Image(ScResId(IMG_BORDER2)); + mpImageList[2] = Image(ScResId(IMG_BORDER3)); + mpImageList[3] = Image(ScResId(IMG_BORDER4)); + mpImageList[4] = Image(ScResId(IMG_BORDER5)); + mpImageList[5] = Image(ScResId(IMG_BORDER6)); + mpImageList[6] = Image(ScResId(IMG_BORDER7)); + mpImageList[7] = Image(ScResId(IMG_BORDER8)); + mpImageList[8] = Image(ScResId(IMG_BORDER9)); + mpImageList[9] = Image(ScResId(IMG_BORDER10)); + mpImageList[10] = Image(ScResId(IMG_BORDER11)); + mpImageList[11] = Image(ScResId(IMG_BORDER12)); + mpImageList[12] = Image(ScResId(IMG_BORDER13)); + mpImageList[13] = Image(ScResId(IMG_BORDER14)); + mpImageList[14] = Image(ScResId(IMG_BORDER15)); + mpImageList[15] = Image(ScResId(IMG_BORDER16)); + + maTBBorder1.SetItemImage(TBI_BORDER1_NONE, mpImageList[0]); + maTBBorder1.SetItemImage(TBI_BORDER1_ALL, mpImageList[1]); + maTBBorder1.SetItemImage(TBI_BORDER1_OUTER, mpImageList[2]); + maTBBorder1.SetItemImage(TBI_BORDER1_OUTERBOLD, mpImageList[3]); + maTBBorder1.SetBackground(Wallpaper()); + maTBBorder1.SetPaintTransparent(true); + Size aTbxSize( maTBBorder1.CalcWindowSizePixel() ); + maTBBorder1.SetOutputSizePixel( aTbxSize ); + Link aLink = LINK(this, CellBorderStyleControl, TB1SelectHdl); + maTBBorder1.SetSelectHdl ( aLink ); + + maTBBorder2.SetLineCount(2); + maTBBorder2.InsertItem(TBI_BORDER2_LEFT, mpImageList[4]); + maTBBorder2.InsertItem(TBI_BORDER2_RIGHT, mpImageList[5]); + maTBBorder2.InsertItem(TBI_BORDER2_TOP, mpImageList[6]); + maTBBorder2.InsertItem(TBI_BORDER2_BOT, mpImageList[7]); + maTBBorder2.InsertBreak(); + maTBBorder2.InsertItem(TBI_BORDER2_BLTR, mpImageList[8]); + maTBBorder2.InsertItem(TBI_BORDER2_TLBR, mpImageList[9]); + maTBBorder2.InsertItem(TBI_BORDER2_TOPBOT, mpImageList[10]); + maTBBorder2.InsertItem(TBI_BORDER2_LEFTRIGHT, mpImageList[11]); + maTBBorder2.SetBackground(Wallpaper()); + maTBBorder2.SetPaintTransparent(true); + aTbxSize = maTBBorder2.CalcWindowSizePixel() ; + maTBBorder2.SetOutputSizePixel( aTbxSize ); + maTBBorder2.SetHelpId(TBI_BORDER2_LEFT, HID_PROPERTYPANEL_SC_BORDER_TBI_LEFT); + maTBBorder2.SetHelpId(TBI_BORDER2_RIGHT, HID_PROPERTYPANEL_SC_BORDER_TBI_RIGHT); + maTBBorder2.SetHelpId(TBI_BORDER2_TOP, HID_PROPERTYPANEL_SC_BORDER_TBI_TOP); + maTBBorder2.SetHelpId(TBI_BORDER2_BOT, HID_PROPERTYPANEL_SC_BORDER_TBI_BOT); + maTBBorder2.SetHelpId(TBI_BORDER2_BLTR, HID_PROPERTYPANEL_SC_BORDER_TBI_BLTR); + maTBBorder2.SetHelpId(TBI_BORDER2_TLBR, HID_PROPERTYPANEL_SC_BORDER_TBI_TLBR); + maTBBorder2.SetHelpId(TBI_BORDER2_TOPBOT, HID_PROPERTYPANEL_SC_BORDER_TBI_TOPBOT); + maTBBorder2.SetHelpId(TBI_BORDER2_LEFTRIGHT, HID_PROPERTYPANEL_SC_BORDER_TBI_LEFTRIGHT); + maTBBorder2.SetItemText(TBI_BORDER2_LEFT, ScResId(STR_BORDER_1)); + maTBBorder2.SetItemText(TBI_BORDER2_RIGHT, ScResId(STR_BORDER_2)); + maTBBorder2.SetItemText(TBI_BORDER2_TOP, ScResId(STR_BORDER_3)); + maTBBorder2.SetItemText(TBI_BORDER2_BOT, ScResId(STR_BORDER_4)); + maTBBorder2.SetItemText(TBI_BORDER2_BLTR, ScResId(STR_BORDER_5)); + maTBBorder2.SetItemText(TBI_BORDER2_TLBR, ScResId(STR_BORDER_6)); + maTBBorder2.SetItemText(TBI_BORDER2_TOPBOT, ScResId(STR_BORDER_7)); + maTBBorder2.SetItemText(TBI_BORDER2_LEFTRIGHT, ScResId(STR_BORDER_8)); + aLink = LINK(this, CellBorderStyleControl, TB2SelectHdl); + maTBBorder2.SetSelectHdl ( aLink ); + + maTBBorder3.SetItemImage(TBI_BORDER3_S1, mpImageList[12]); + maTBBorder3.SetItemImage(TBI_BORDER3_S2, mpImageList[13]); + maTBBorder3.SetItemImage(TBI_BORDER3_S3, mpImageList[14]); + maTBBorder3.SetItemImage(TBI_BORDER3_S4, mpImageList[15]); + maTBBorder3.SetBackground(Wallpaper()); + maTBBorder3.SetPaintTransparent(true); + aTbxSize = maTBBorder3.CalcWindowSizePixel() ; + maTBBorder3.SetOutputSizePixel( aTbxSize ); + aLink = LINK(this, CellBorderStyleControl, TB3SelectHdl); + maTBBorder3.SetSelectHdl ( aLink ); +} + +IMPL_LINK(CellBorderStyleControl, TB1SelectHdl, ToolBox*, pToolBox) +{ + sal_uInt16 nId = pToolBox->GetCurItemId(); + ::Color aColBlack( COL_BLACK ); + SvxBoxItem aBorderOuter( SID_ATTR_BORDER_OUTER ); + SvxBoxInfoItem aBorderInner( SID_ATTR_BORDER_INNER ); + editeng::SvxBorderLine theDefLine(NULL, 1); + editeng::SvxBorderLine *pLeft = 0, *pRight = 0, *pTop = 0, *pBottom = 0; + sal_uInt8 nValidFlags = 0; + switch ( nId ) + { + case TBI_BORDER1_NONE: + { + nValidFlags |= FRM_VALID_ALL; + SvxLineItem aLineItem1( SID_ATTR_BORDER_DIAG_BLTR ); + SvxLineItem aLineItem2( SID_ATTR_BORDER_DIAG_TLBR ); + aLineItem1.SetLine( NULL ); //modify + aLineItem2.SetLine( NULL ); //modify + mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_ATTR_BORDER_DIAG_BLTR, SFX_CALLMODE_RECORD, &aLineItem1, 0L); + mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_ATTR_BORDER_DIAG_TLBR, SFX_CALLMODE_RECORD, &aLineItem2, 0L); + } + break; + case TBI_BORDER1_ALL: + pLeft = pRight = pTop = pBottom = &theDefLine; + aBorderInner.SetLine( &theDefLine, BOXINFO_LINE_HORI ); + aBorderInner.SetLine( &theDefLine, BOXINFO_LINE_VERT ); + nValidFlags |= FRM_VALID_ALL; + break; + case TBI_BORDER1_OUTER: + pLeft = pRight = pTop = pBottom = &theDefLine; + nValidFlags |= FRM_VALID_OUTER; + break; + case TBI_BORDER1_OUTERBOLD: + theDefLine.SetWidth(DEF_LINE_WIDTH_2); + pLeft = pRight = pTop = pBottom = &theDefLine; + nValidFlags |= FRM_VALID_OUTER; + break; + } + + aBorderOuter.SetLine( pLeft, BOX_LINE_LEFT ); + aBorderOuter.SetLine( pRight, BOX_LINE_RIGHT ); + aBorderOuter.SetLine( pTop, BOX_LINE_TOP ); + aBorderOuter.SetLine( pBottom, BOX_LINE_BOTTOM ); + + aBorderInner.SetValid( VALID_TOP, 0 != (nValidFlags&FRM_VALID_TOP )); + aBorderInner.SetValid( VALID_BOTTOM, 0 != (nValidFlags&FRM_VALID_BOTTOM )); + aBorderInner.SetValid( VALID_LEFT, 0 != (nValidFlags&FRM_VALID_LEFT)); + aBorderInner.SetValid( VALID_RIGHT, 0 != (nValidFlags&FRM_VALID_RIGHT )); + aBorderInner.SetValid( VALID_HORI, 0 != (nValidFlags&FRM_VALID_HINNER )); + aBorderInner.SetValid( VALID_VERT, 0 != (nValidFlags&FRM_VALID_VINNER)); + aBorderInner.SetValid( VALID_DISTANCE, true ); + aBorderInner.SetValid( VALID_DISABLE, false ); + + mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_ATTR_BORDER, SFX_CALLMODE_RECORD, &aBorderOuter, &aBorderInner, 0L); + mrCellAppearancePropertyPanel.EndCellBorderStylePopupMode(); + return 0; +} + +IMPL_LINK(CellBorderStyleControl, TB2SelectHdl, ToolBox *, pToolBox) +{ + sal_uInt16 nId = pToolBox->GetCurItemId(); + + if( nId != TBI_BORDER2_BLTR && nId != TBI_BORDER2_TLBR ) + { + ::Color aColBlack( COL_BLACK ); + SvxBoxItem aBorderOuter( SID_ATTR_BORDER_OUTER ); + SvxBoxInfoItem aBorderInner( SID_ATTR_BORDER_INNER ); + editeng::SvxBorderLine theDefLine(NULL, 1); + editeng::SvxBorderLine *pLeft = 0, + *pRight = 0, + *pTop = 0, + *pBottom = 0; + sal_uInt8 nValidFlags = 0; + switch ( nId ) + { + case TBI_BORDER2_LEFT: + pLeft = &theDefLine; + nValidFlags |= FRM_VALID_LEFT; + break; + case TBI_BORDER2_RIGHT: + // + if(!Application::GetSettings().GetLayoutRTL()) + { + pRight = &theDefLine; + nValidFlags |= FRM_VALID_RIGHT; + } + else + { + pLeft = &theDefLine; + nValidFlags |= FRM_VALID_LEFT; + } + break; + case TBI_BORDER2_TOP: + pTop = &theDefLine; + nValidFlags |= FRM_VALID_TOP; + break; + case TBI_BORDER2_BOT: + pBottom = &theDefLine; + nValidFlags |= FRM_VALID_BOTTOM; + break; + case TBI_BORDER2_TOPBOT: + pTop = pBottom = &theDefLine; + nValidFlags |= FRM_VALID_BOTTOM|FRM_VALID_TOP; + break; + case TBI_BORDER2_LEFTRIGHT: + pLeft = pRight = &theDefLine; + nValidFlags |= FRM_VALID_RIGHT|FRM_VALID_LEFT; + break; + } + aBorderOuter.SetLine( pLeft, BOX_LINE_LEFT ); + aBorderOuter.SetLine( pRight, BOX_LINE_RIGHT ); + aBorderOuter.SetLine( pTop, BOX_LINE_TOP ); + aBorderOuter.SetLine( pBottom, BOX_LINE_BOTTOM ); + + aBorderInner.SetValid( VALID_TOP, 0 != (nValidFlags&FRM_VALID_TOP )); + aBorderInner.SetValid( VALID_BOTTOM, 0 != (nValidFlags&FRM_VALID_BOTTOM )); + aBorderInner.SetValid( VALID_LEFT, 0 != (nValidFlags&FRM_VALID_LEFT)); + aBorderInner.SetValid( VALID_RIGHT, 0 != (nValidFlags&FRM_VALID_RIGHT )); + aBorderInner.SetValid( VALID_HORI, 0 != (nValidFlags&FRM_VALID_HINNER )); + aBorderInner.SetValid( VALID_VERT, 0 != (nValidFlags&FRM_VALID_VINNER)); + aBorderInner.SetValid( VALID_DISTANCE, true ); + aBorderInner.SetValid( VALID_DISABLE, false ); + + mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_ATTR_BORDER, SFX_CALLMODE_RECORD, &aBorderOuter, &aBorderInner, 0L); + } + else if(nId == TBI_BORDER2_BLTR) + { + editeng::SvxBorderLine aTmp( NULL, 1 ); + SvxLineItem aLineItem( SID_ATTR_BORDER_DIAG_BLTR ); + aLineItem.SetLine( &aTmp ); + mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_ATTR_BORDER_DIAG_BLTR, SFX_CALLMODE_RECORD, &aLineItem, 0L); + } + else if(nId == TBI_BORDER2_TLBR) + { + editeng::SvxBorderLine aTmp( NULL, 1 ); + SvxLineItem aLineItem( SID_ATTR_BORDER_DIAG_TLBR ); + aLineItem.SetLine( &aTmp ); + mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_ATTR_BORDER_DIAG_TLBR, SFX_CALLMODE_RECORD, &aLineItem, 0L); + } + + mrCellAppearancePropertyPanel.EndCellBorderStylePopupMode(); + return 0; +} + +IMPL_LINK(CellBorderStyleControl, TB3SelectHdl, ToolBox *, pToolBox) +{ + sal_uInt16 nId = pToolBox->GetCurItemId(); + + ::Color aColBlack( COL_BLACK ); + SvxBoxItem aBorderOuter( SID_ATTR_BORDER_OUTER ); + SvxBoxInfoItem aBorderInner( SID_ATTR_BORDER_INNER ); + editeng::SvxBorderLine *pTop = 0 , + *pBottom = 0 ; + sal_uInt8 nValidFlags = 0; + using namespace ::com::sun::star::table::BorderLineStyle; + + //FIXME: properly adapt to new line border model + + switch ( nId ) + { + case TBI_BORDER3_S1: + pBottom = new editeng::SvxBorderLine(NULL, DEF_LINE_WIDTH_2 ); + nValidFlags |= FRM_VALID_BOTTOM; + break; + case TBI_BORDER3_S2: + pBottom = new editeng::SvxBorderLine(NULL); + pBottom->GuessLinesWidths(DOUBLE, DEF_LINE_WIDTH_0, DEF_LINE_WIDTH_0, DEF_LINE_WIDTH_1); + nValidFlags |= FRM_VALID_BOTTOM; + break; + case TBI_BORDER3_S3: + pBottom = new editeng::SvxBorderLine(NULL, DEF_LINE_WIDTH_2 ); + pTop = new editeng::SvxBorderLine(NULL, 1); + nValidFlags |= FRM_VALID_BOTTOM|FRM_VALID_TOP; + break; + case TBI_BORDER3_S4: + pBottom = new editeng::SvxBorderLine(NULL); + pBottom->GuessLinesWidths(DOUBLE, DEF_LINE_WIDTH_0, DEF_LINE_WIDTH_0, DEF_LINE_WIDTH_1); + pTop = new editeng::SvxBorderLine(NULL, 1); + nValidFlags |= FRM_VALID_BOTTOM|FRM_VALID_TOP; + break; + } + + aBorderOuter.SetLine( pTop, BOX_LINE_TOP ); + aBorderOuter.SetLine( pBottom, BOX_LINE_BOTTOM ); + aBorderOuter.SetLine( NULL, BOX_LINE_LEFT ); + aBorderOuter.SetLine( NULL, BOX_LINE_RIGHT ); + + aBorderInner.SetValid( VALID_TOP, 0 != (nValidFlags&FRM_VALID_TOP )); + aBorderInner.SetValid( VALID_BOTTOM, 0 != (nValidFlags&FRM_VALID_BOTTOM )); + aBorderInner.SetValid( VALID_LEFT, 0 != (nValidFlags&FRM_VALID_LEFT )); + aBorderInner.SetValid( VALID_RIGHT, 0 != (nValidFlags&FRM_VALID_RIGHT )); + aBorderInner.SetValid( VALID_HORI, 0 != (nValidFlags&FRM_VALID_HINNER )); + aBorderInner.SetValid( VALID_VERT, 0 != (nValidFlags&FRM_VALID_VINNER)); + aBorderInner.SetValid( VALID_DISTANCE, true ); + aBorderInner.SetValid( VALID_DISABLE, false ); + + mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_ATTR_BORDER, SFX_CALLMODE_RECORD, &aBorderOuter, &aBorderInner, 0L); + + delete pTop; + delete pBottom; + + mrCellAppearancePropertyPanel.EndCellBorderStylePopupMode(); + return 0; +} + +} } // end of namespace svx::sidebar + +// eof diff --git a/sc/source/ui/sidebar/CellBorderStyleControl.hxx b/sc/source/ui/sidebar/CellBorderStyleControl.hxx new file mode 100644 index 000000000000..8dd594094717 --- /dev/null +++ b/sc/source/ui/sidebar/CellBorderStyleControl.hxx @@ -0,0 +1,56 @@ +/* + * 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 SC_SIDEBAR_CELL_BORDER_STYLE_CONTROL_HXX +#define SC_SIDEBAR_CELL_BORDER_STYLE_CONTROL_HXX + +#include <svx/sidebar/PopupControl.hxx> +#include <vcl/button.hxx> +#include <vcl/toolbox.hxx> +#include <vcl/fixed.hxx> + +namespace sc { namespace sidebar { + +class CellAppearancePropertyPanel; + +class CellBorderStyleControl : public svx::sidebar::PopupControl +{ +private: + CellAppearancePropertyPanel& mrCellAppearancePropertyPanel; + ToolBox maTBBorder1; + ToolBox maTBBorder2; + ToolBox maTBBorder3; + FixedLine maFL1; + FixedLine maFL2; + Image* mpImageList; + + void Initialize(); + + DECL_LINK(TB1SelectHdl, ToolBox *); + DECL_LINK(TB2SelectHdl, ToolBox *); + DECL_LINK(TB3SelectHdl, ToolBox *); + +public: + CellBorderStyleControl(Window* pParent, CellAppearancePropertyPanel& rPanel); + virtual ~CellBorderStyleControl(void); +}; + +} } // end of namespace svx::sidebar + +#endif // SC_SIDEBAR_CELL_BORDER_STYLE_CONTROL_HXX + +// eof diff --git a/sc/source/ui/sidebar/CellBorderStylePopup.cxx b/sc/source/ui/sidebar/CellBorderStylePopup.cxx new file mode 100644 index 000000000000..f3dd43aa9196 --- /dev/null +++ b/sc/source/ui/sidebar/CellBorderStylePopup.cxx @@ -0,0 +1,37 @@ +/* + * 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 "CellBorderStylePopup.hxx" +#include "CellLineStyleControl.hxx" + +namespace sc { namespace sidebar { + +CellBorderStylePopup::CellBorderStylePopup ( + Window* pParent, + const ::boost::function<svx::sidebar::PopupControl*(svx::sidebar::PopupContainer*)>& rControlCreator) +: Popup(pParent, rControlCreator, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CellBorderStyle"))) +{ +} + +CellBorderStylePopup::~CellBorderStylePopup (void) +{ +} + +} } // end of namespace sc::sidebar + +// eof diff --git a/sc/source/ui/sidebar/CellBorderStylePopup.hxx b/sc/source/ui/sidebar/CellBorderStylePopup.hxx new file mode 100644 index 000000000000..1443a9682137 --- /dev/null +++ b/sc/source/ui/sidebar/CellBorderStylePopup.hxx @@ -0,0 +1,39 @@ +/* + * 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 _SC_SIDEBAR_CELL_BORDER_STYLE_POPUP_HXX_ +#define _SC_SIDEBAR_CELL_BORDER_STYLE_POPUP_HXX_ + +#include <svx/sidebar/Popup.hxx> +#include <boost/function.hpp> + +namespace sc { namespace sidebar { + +class CellBorderStylePopup : public svx::sidebar::Popup +{ +public : + CellBorderStylePopup( + Window* pParent, + const ::boost::function<svx::sidebar::PopupControl*(svx::sidebar::PopupContainer*)>& rControlCreator); + virtual ~CellBorderStylePopup(void); +}; + +} } // end of namespace sc::sidebar + +#endif // _SC_SIDEBAR_CELL_BORDER_STYLE_POPUP_HXX_ + +// eof diff --git a/sc/source/ui/sidebar/CellBorderUpdater.cxx b/sc/source/ui/sidebar/CellBorderUpdater.cxx new file mode 100644 index 000000000000..e3182611e7ae --- /dev/null +++ b/sc/source/ui/sidebar/CellBorderUpdater.cxx @@ -0,0 +1,122 @@ +/* + * 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 <CellBorderUpdater.hxx> +#include <vcl/bmpacc.hxx> +#include <vcl/svapp.hxx> + +namespace sc { namespace sidebar { + +CellBorderUpdater::CellBorderUpdater( + sal_uInt16 nTbxBtnId, + ToolBox& rTbx) +: mnBtnId(nTbxBtnId), + mrTbx(rTbx) +{ +} + +CellBorderUpdater::~CellBorderUpdater() +{ +} + +void CellBorderUpdater::UpdateCellBorder(bool bTop, bool bBot, bool bLeft, bool bRight, Image aImg, bool bVer, bool bHor) +{ + BitmapEx aBmpEx( aImg.GetBitmapEx() ); + Bitmap aBmp( aBmpEx.GetBitmap() ); + BitmapWriteAccess* pBmpAcc = aBmp.AcquireWriteAccess(); + const Size maBmpSize = aBmp.GetSizePixel(); + + if( pBmpAcc ) + { + Bitmap aMsk; + BitmapWriteAccess* pMskAcc; + + if( aBmpEx.IsAlpha() ) + pMskAcc = ( aMsk = aBmpEx.GetAlpha().GetBitmap() ).AcquireWriteAccess(); + else if( aBmpEx.IsTransparent() ) + pMskAcc = ( aMsk = aBmpEx.GetMask() ).AcquireWriteAccess(); + else + pMskAcc = NULL; + + pBmpAcc->SetLineColor( ::Application::GetSettings().GetStyleSettings().GetFieldTextColor() ) ; + pBmpAcc->SetFillColor( COL_BLACK); + + if(maBmpSize.Width() == 43 && maBmpSize.Height() == 43) + { + Point aTL(2, 1), aTR(42,1), aBL(2, 41), aBR(42, 41), aHL(2,21), aHR(42, 21), aVT(22,1), aVB(22, 41); + if( pMskAcc ) + { + pMskAcc->SetLineColor( COL_BLACK ); + pMskAcc->SetFillColor( COL_BLACK ); + } + if(bLeft) + { + pBmpAcc->DrawLine( aTL,aBL ); + if( pMskAcc ) + pMskAcc->DrawLine( aTL,aBL ); + } + if(bRight) + { + pBmpAcc->DrawLine( aTR,aBR ); + if( pMskAcc ) + pMskAcc->DrawLine( aTR,aBR ); + } + if(bTop) + { + pBmpAcc->DrawLine( aTL,aTR ); + if( pMskAcc ) + pMskAcc->DrawLine( aTL,aTR ); + } + if(bBot) + { + pBmpAcc->DrawLine( aBL,aBR ); + if( pMskAcc ) + pMskAcc->DrawLine( aBL,aBR ); + } + if(bVer) + { + pBmpAcc->DrawLine( aVT,aVB ); + if( pMskAcc ) + pMskAcc->DrawLine( aVT,aVB ); + } + if(bHor) + { + pBmpAcc->DrawLine( aHL,aHR ); + if( pMskAcc ) + pMskAcc->DrawLine( aHL,aHR ); + } + } + + aBmp.ReleaseAccess( pBmpAcc ); + if( pMskAcc ) + aMsk.ReleaseAccess( pMskAcc ); + + if( aBmpEx.IsAlpha() ) + aBmpEx = BitmapEx( aBmp, AlphaMask( aMsk ) ); + else if( aBmpEx.IsTransparent() ) + aBmpEx = BitmapEx( aBmp, aMsk ); + else + aBmpEx = aBmp; + + mrTbx.SetItemImage( mnBtnId, Image( aBmpEx ) ); + } +} + +} } // end of namespace svx::sidebar + +// eof diff --git a/sc/source/ui/sidebar/CellBorderUpdater.hxx b/sc/source/ui/sidebar/CellBorderUpdater.hxx new file mode 100644 index 000000000000..fcb02447c4fe --- /dev/null +++ b/sc/source/ui/sidebar/CellBorderUpdater.hxx @@ -0,0 +1,42 @@ +/* + * 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 SC_SIDEBAR_CELL_BORDER_UPDATER_HXX +#define SC_SIDEBAR_CELL_BORDER_UPDATER_HXX + +#include <vcl/toolbox.hxx> + +namespace sc { namespace sidebar { + +class CellBorderUpdater +{ +private: + sal_uInt16 mnBtnId; + ToolBox& mrTbx; + +public: + CellBorderUpdater(sal_uInt16 nTbxBtnId, ToolBox& rTbx); + ~CellBorderUpdater(); + + void UpdateCellBorder(bool bTop, bool bBot, bool bLeft, bool bRight, Image aImg, bool bVer, bool bHor); +}; + +} } // end of namespace svx::sidebar + +#endif // SC_SIDEBAR_CELL_BORDER_UPDATER_HXX + +// eof diff --git a/sc/source/ui/sidebar/CellLineStyleControl.cxx b/sc/source/ui/sidebar/CellLineStyleControl.cxx new file mode 100644 index 000000000000..339eff356dfb --- /dev/null +++ b/sc/source/ui/sidebar/CellLineStyleControl.cxx @@ -0,0 +1,254 @@ +/* + * 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 <CellLineStyleControl.hxx> +#include "sc.hrc" +#include "scresid.hxx" +#include <CellAppearancePropertyPanel.hrc> +#include <CellLineStyleValueSet.hxx> +#include <vcl/i18nhelp.hxx> +#include <editeng/boxitem.hxx> +#include <editeng/borderline.hxx> +#include <editeng/lineitem.hxx> +#include <CellAppearancePropertyPanel.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> + +namespace sc { namespace sidebar { + +CellLineStyleControl::CellLineStyleControl(Window* pParent, CellAppearancePropertyPanel& rPanel) +: svx::sidebar::PopupControl(pParent, ScResId(RID_POPUPPANEL_APPEARANCE_CELL_LINESTYLE)), + mrCellAppearancePropertyPanel(rPanel), + maPushButtonMoreOptions(this, ScResId(PB_OPTIONS)), + maCellLineStyleValueSet(this, ScResId(VS_STYLE)), + mpStr(0), + mbVSfocus(true) +{ + Initialize(); + FreeResource(); +} + +CellLineStyleControl::~CellLineStyleControl(void) +{ + delete[] mpStr; +} + +void CellLineStyleControl::Initialize() +{ + //maPushButtonMoreOptions.SetIcoPosX(2); + Link aLink = LINK(this, CellLineStyleControl, PBClickHdl); + maPushButtonMoreOptions.SetClickHdl(aLink); + + maCellLineStyleValueSet.SetStyle(maCellLineStyleValueSet.GetStyle()| WB_3DLOOK | WB_NO_DIRECTSELECT); + maCellLineStyleValueSet.SetControlBackground(GetSettings().GetStyleSettings().GetMenuColor()); + maCellLineStyleValueSet.SetColor(GetSettings().GetStyleSettings().GetMenuColor()); + + for(sal_uInt16 i = 1 ; i <= 9 ; i++) + { + maCellLineStyleValueSet.InsertItem(i); + } + + mpStr = new XubString[9]; + mpStr[0] = GetSettings().GetLocaleI18nHelper().GetNum( 5, 2 ).AppendAscii("pt"); + mpStr[1] = GetSettings().GetLocaleI18nHelper().GetNum( 250, 2 ).AppendAscii("pt"); + mpStr[2] = GetSettings().GetLocaleI18nHelper().GetNum( 400, 2 ).AppendAscii("pt"); + mpStr[3] = GetSettings().GetLocaleI18nHelper().GetNum( 500, 2 ).AppendAscii("pt"); + mpStr[4] = GetSettings().GetLocaleI18nHelper().GetNum( 110, 2 ).AppendAscii("pt"); + mpStr[5] = GetSettings().GetLocaleI18nHelper().GetNum( 260, 2 ).AppendAscii("pt"); + mpStr[6] = GetSettings().GetLocaleI18nHelper().GetNum( 450, 2 ).AppendAscii("pt"); + mpStr[7] = GetSettings().GetLocaleI18nHelper().GetNum( 505, 2 ).AppendAscii("pt"); + mpStr[8] = GetSettings().GetLocaleI18nHelper().GetNum( 750, 2 ).AppendAscii("pt"); + maCellLineStyleValueSet.SetUnit(mpStr); + + for(sal_uInt16 i = 1 ; i <= 9 ; i++) + { + maCellLineStyleValueSet.SetItemText(i, mpStr[i-1]); + } + + SetAllNoSel(); + aLink = LINK(this, CellLineStyleControl, VSSelectHdl); + maCellLineStyleValueSet.SetSelectHdl(aLink); + maCellLineStyleValueSet.StartSelection(); + maCellLineStyleValueSet.Show(); +} + +void CellLineStyleControl::GetFocus() +{ + if(!mbVSfocus) + { + maPushButtonMoreOptions.GrabFocus(); + } + else + { + maCellLineStyleValueSet.GrabFocus(); + } +} + +void CellLineStyleControl::SetAllNoSel() +{ + maCellLineStyleValueSet.SelectItem(0); + maCellLineStyleValueSet.SetNoSelection(); + maCellLineStyleValueSet.Format(); + Invalidate(); + maCellLineStyleValueSet.StartSelection(); +} + +IMPL_LINK(CellLineStyleControl, VSSelectHdl, void *, pControl) +{ + if(pControl == &maCellLineStyleValueSet) + { + const sal_uInt16 iPos(maCellLineStyleValueSet.GetSelectItemId()); + SvxLineItem aLineItem(SID_FRAME_LINESTYLE); + using namespace ::com::sun::star::table::BorderLineStyle; + editeng::SvxBorderStyle nStyle = SOLID; + sal_uInt16 n1 = 0; + sal_uInt16 n2 = 0; + sal_uInt16 n3 = 0; + + //FIXME: fully for new border line possibilities + + switch(iPos) + { + case 1: + n1 = DEF_LINE_WIDTH_0; + break; + case 2: + n1 = DEF_LINE_WIDTH_2; + break; + case 3: + n1 = DEF_LINE_WIDTH_3; + break; + case 4: + n1 = DEF_LINE_WIDTH_4; + break; + case 5: + n1 = DEF_LINE_WIDTH_0; + n2 = DEF_LINE_WIDTH_0; + n3 = DEF_LINE_WIDTH_1; + nStyle = DOUBLE; + break; + case 6: + n1 = DEF_LINE_WIDTH_0; + n2 = DEF_LINE_WIDTH_0; + n3 = DEF_LINE_WIDTH_2; + nStyle = DOUBLE; + break; + case 7: + n1 = DEF_LINE_WIDTH_1; + n2 = DEF_LINE_WIDTH_2; + n3 = DEF_LINE_WIDTH_1; + nStyle = DOUBLE; + break; + case 8: + n1 = DEF_LINE_WIDTH_2; + n2 = DEF_LINE_WIDTH_0; + n3 = DEF_LINE_WIDTH_2; + nStyle = DOUBLE; + break; + case 9: + n1 = DEF_LINE_WIDTH_2; + n2 = DEF_LINE_WIDTH_2; + n3 = DEF_LINE_WIDTH_2; + nStyle = DOUBLE; + break; + default: + break; + } + + editeng::SvxBorderLine aTmp; + aTmp.GuessLinesWidths(nStyle, n1, n2, n3); + aLineItem.SetLine( &aTmp ); + mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_FRAME_LINESTYLE, SFX_CALLMODE_RECORD, &aLineItem, 0L); + SetAllNoSel(); + mrCellAppearancePropertyPanel.EndCellLineStylePopupMode(); + } + + return(0L); +} + +IMPL_LINK(CellLineStyleControl, PBClickHdl, PushButton *, pPBtn) +{ + if(pPBtn == &maPushButtonMoreOptions) + { + if(mrCellAppearancePropertyPanel.GetBindings()) + { + mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_CELL_FORMAT_BORDER, SFX_CALLMODE_ASYNCHRON); + } + + mrCellAppearancePropertyPanel.EndCellLineStylePopupMode(); + } + + return 0; +} + +void CellLineStyleControl::SetLineStyleSelect(sal_uInt16 out, sal_uInt16 in, sal_uInt16 dis) +{ + SetAllNoSel(); + mbVSfocus = true; + + //FIXME: fully for new border line possibilities + + if(out == DEF_LINE_WIDTH_0 && in == 0 && dis == 0) //1 + { + maCellLineStyleValueSet.SetSelItem(1); + } + else if(out == DEF_LINE_WIDTH_2 && in == 0 && dis == 0) //2 + { + maCellLineStyleValueSet.SetSelItem(2); + } + else if(out == DEF_LINE_WIDTH_3 && in == 0 && dis == 0) //3 + { + maCellLineStyleValueSet.SetSelItem(3); + } + else if(out == DEF_LINE_WIDTH_4 && in == 0 && dis == 0) //4 + { + maCellLineStyleValueSet.SetSelItem(4); + } + else if(out == DEF_LINE_WIDTH_0 && in == DEF_LINE_WIDTH_0 && dis == DEF_LINE_WIDTH_1) //5 + { + maCellLineStyleValueSet.SetSelItem(5); + } + else if(out == DEF_LINE_WIDTH_0 && in == DEF_LINE_WIDTH_0 && dis == DEF_LINE_WIDTH_2) //6 + { + maCellLineStyleValueSet.SetSelItem(6); + } + else if(out == DEF_LINE_WIDTH_1 && in == DEF_LINE_WIDTH_2 && dis == DEF_LINE_WIDTH_1) //7 + { + maCellLineStyleValueSet.SetSelItem(7); + } + else if(out == DEF_LINE_WIDTH_2 && in == DEF_LINE_WIDTH_0 && dis == DEF_LINE_WIDTH_2) //8 + { + maCellLineStyleValueSet.SetSelItem(8); + } + else if(out == DEF_LINE_WIDTH_2 && in == DEF_LINE_WIDTH_2 && dis == DEF_LINE_WIDTH_2) //9 + { + maCellLineStyleValueSet.SetSelItem(9); + } + else + { + maCellLineStyleValueSet.SetSelItem(0); + mbVSfocus = false; + } + + maCellLineStyleValueSet.Format(); + maCellLineStyleValueSet.StartSelection(); +} + +} } // end of namespace svx::sidebar + +// eof diff --git a/sc/source/ui/sidebar/CellLineStyleControl.hxx b/sc/source/ui/sidebar/CellLineStyleControl.hxx new file mode 100644 index 000000000000..d7d47dad1f18 --- /dev/null +++ b/sc/source/ui/sidebar/CellLineStyleControl.hxx @@ -0,0 +1,68 @@ +/* + * 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 SC_SIDEBAR_CELL_LINE_STYLE_CONTROL_HXX +#define SC_SIDEBAR_CELL_LINE_STYLE_CONTROL_HXX + +#include <svx/sidebar/PopupControl.hxx> +#include <vcl/button.hxx> +#include <CellLineStyleValueSet.hxx> + +namespace sc { namespace sidebar { + +class CellAppearancePropertyPanel; + +class CellLineStyleControl : public svx::sidebar::PopupControl +{ +private: + CellAppearancePropertyPanel& mrCellAppearancePropertyPanel; + PushButton maPushButtonMoreOptions; + CellLineStyleValueSet maCellLineStyleValueSet; + XubString* mpStr; + + /// bitfield + bool mbVSfocus : 1; + + void Initialize(); + void SetAllNoSel(); + + DECL_LINK(VSSelectHdl, void*); + DECL_LINK(PBClickHdl, PushButton*); + +public: + CellLineStyleControl(Window* pParent, CellAppearancePropertyPanel& rPanel); + virtual ~CellLineStyleControl(void); + + void GetFocus(); + void SetLineStyleSelect(sal_uInt16 out, sal_uInt16 in, sal_uInt16 dis); + + ValueSet& GetValueSet() + { + return maCellLineStyleValueSet; + } + + Control& GetPushButton() + { + return maPushButtonMoreOptions; + } +}; + +} } // end of namespace svx::sidebar + +#endif // SC_SIDEBAR_CELL_LINE_STYLE_CONTROL_HXX + +// eof diff --git a/sc/source/ui/sidebar/CellLineStylePopup.cxx b/sc/source/ui/sidebar/CellLineStylePopup.cxx new file mode 100644 index 000000000000..23f80d9a44e3 --- /dev/null +++ b/sc/source/ui/sidebar/CellLineStylePopup.cxx @@ -0,0 +1,49 @@ +/* + * 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 "CellLineStylePopup.hxx" +#include "CellLineStyleControl.hxx" + +namespace sc { namespace sidebar { + +CellLineStylePopup::CellLineStylePopup ( + Window* pParent, + const ::boost::function<svx::sidebar::PopupControl*(svx::sidebar::PopupContainer*)>& rControlCreator) +: Popup(pParent, rControlCreator, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CellLineStyle"))) +{ +} + +CellLineStylePopup::~CellLineStylePopup (void) +{ +} + +void CellLineStylePopup::SetLineStyleSelect(sal_uInt16 out, sal_uInt16 in, sal_uInt16 dis) +{ + ProvideContainerAndControl(); + + CellLineStyleControl* pControl = dynamic_cast< CellLineStyleControl* >(mpControl.get()); + + if(pControl) + { + pControl->SetLineStyleSelect(out, in, dis); + } +} + +} } // end of namespace sc::sidebar + +// eof diff --git a/sc/source/ui/sidebar/CellLineStylePopup.hxx b/sc/source/ui/sidebar/CellLineStylePopup.hxx new file mode 100644 index 000000000000..8401dee217dc --- /dev/null +++ b/sc/source/ui/sidebar/CellLineStylePopup.hxx @@ -0,0 +1,41 @@ +/* + * 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 _SC_SIDEBAR_CELL_LINE_STYLE_POPUP_HXX_ +#define _SC_SIDEBAR_CELL_LINE_STYLE_POPUP_HXX_ + +#include <svx/sidebar/Popup.hxx> +#include <boost/function.hpp> + +namespace sc { namespace sidebar { + +class CellLineStylePopup : public svx::sidebar::Popup +{ +public : + CellLineStylePopup( + Window* pParent, + const ::boost::function<svx::sidebar::PopupControl*(svx::sidebar::PopupContainer*)>& rControlCreator); + virtual ~CellLineStylePopup(void); + + void SetLineStyleSelect(sal_uInt16 out, sal_uInt16 in, sal_uInt16 dis); +}; + +} } // end of namespace sc::sidebar + +#endif // _SC_SIDEBAR_CELL_LINE_STYLE_POPUP_HXX_ + +// eof diff --git a/sc/source/ui/sidebar/CellLineStyleValueSet.cxx b/sc/source/ui/sidebar/CellLineStyleValueSet.cxx new file mode 100644 index 000000000000..4f823f029841 --- /dev/null +++ b/sc/source/ui/sidebar/CellLineStyleValueSet.cxx @@ -0,0 +1,179 @@ +/* + * 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 <CellLineStyleValueSet.hxx> +#include <i18nlangtag/mslangid.hxx> + +namespace sc { namespace sidebar { + +CellLineStyleValueSet::CellLineStyleValueSet( Window* pParent, const ResId& rResId) +: ValueSet( pParent, rResId ), + pVDev(NULL), + nSelItem(0), + bCusEnable(false) +{ + strUnit = new XubString[9]; + SetColCount( 1 ); + SetLineCount( 9); +} + +CellLineStyleValueSet::~CellLineStyleValueSet() +{ + delete pVDev; + delete[] strUnit; +} + +void CellLineStyleValueSet::SetUnit(XubString* str) +{ + for(int i = 0; i < 9; i++) + { + strUnit[i] = str[i]; + } +} + +void CellLineStyleValueSet::SetSelItem(sal_uInt16 nSel) +{ + nSelItem = nSel; + if(nSel == 0) + { + SelectItem(1); + SetNoSelection(); + } + else + { + SelectItem(nSelItem); + GrabFocus(); + } +} + +sal_uInt16 CellLineStyleValueSet::GetSelItem() +{ + return nSelItem; +} + +void CellLineStyleValueSet::SetImage(Image img) +{ + imgCus = img; +} + +void CellLineStyleValueSet::SetCusEnable(bool bEnable) +{ + bCusEnable = bEnable; +} + +void CellLineStyleValueSet::UserDraw( const UserDrawEvent& rUDEvt ) +{ + Rectangle aRect = rUDEvt.GetRect(); + OutputDevice* pDev = rUDEvt.GetDevice(); + sal_uInt16 nItemId = rUDEvt.GetItemId(); + + long nRectHeight = aRect.GetHeight(); + long nRectWidth = aRect.GetWidth(); + Point aBLPos = aRect.TopLeft(); + + Font aOldFont = pDev->GetFont(); + Color aOldColor = pDev->GetLineColor(); + Color aOldFillColor = pDev->GetFillColor(); + + Font aFont(OutputDevice::GetDefaultFont(DEFAULTFONT_UI_SANS, MsLangId::getSystemLanguage(), DEFAULTFONT_FLAGS_ONLYONE)); + Size aSize = aFont.GetSize(); + aSize.Height() = nRectHeight*3/5; + aFont.SetSize( aSize ); + + Point aLineStart(aBLPos.X() + 5, aBLPos.Y() + ( nRectHeight - nItemId )/2); + Point aLineEnd(aBLPos.X() + nRectWidth * 7 / 9 - 15, aBLPos.Y() + ( nRectHeight - nItemId )/2); + long nTLX = aBLPos.X() + 5, nTLY = aBLPos.Y() + ( nRectHeight - nItemId )/2; + long nTRX = aBLPos.X() + nRectWidth * 7 / 9 - 15, nTRY = aBLPos.Y() + ( nRectHeight - nItemId )/2; + + if( nSelItem == nItemId ) + { + Color aBackColor(50,107,197); + Rectangle aBackRect = aRect; + aBackRect.Top() += 3; + aBackRect.Bottom() -= 2; + pDev->SetFillColor(aBackColor); + pDev->DrawRect(aBackRect); + } + else + { + pDev->SetFillColor( COL_TRANSPARENT ); + pDev->DrawRect(aRect); + } + + //draw text + if(nSelItem == nItemId ) + aFont.SetColor(COL_WHITE); + else + aFont.SetColor(GetSettings().GetStyleSettings().GetFieldTextColor()); //high contrast + + pDev->SetFont(aFont); + Point aStart(aBLPos.X() + nRectWidth * 7 / 9 - 5 , aBLPos.Y() + nRectHeight/6); + pDev->DrawText(aStart, strUnit[ nItemId - 1 ]); //can't set TEXT_DRAW_ENDELLIPSIS here, or the text will disapear + + //draw line + if( nSelItem == nItemId ) + { + pDev->SetFillColor(COL_WHITE); + pDev->SetLineColor(COL_WHITE); + } + else + { + pDev->SetFillColor(GetSettings().GetStyleSettings().GetFieldTextColor()); //high contrast + pDev->SetLineColor(GetSettings().GetStyleSettings().GetFieldTextColor()); //high contrast + } + + switch( nItemId ) + { + case 1: + case 2: + case 3: + case 4: + pDev->DrawRect(Rectangle(nTLX, nTLY , nTRX, nTRY + nItemId * 2 - 1 )); + break; + case 5: + pDev->DrawRect(Rectangle(nTLX, nTLY , nTRX, nTRY + 1 )); + pDev->DrawRect(Rectangle(nTLX, nTLY + 3 , nTRX, nTRY + 4 )); + break; + case 6: + pDev->DrawRect(Rectangle(nTLX, nTLY , nTRX, nTRY + 1 )); + pDev->DrawRect(Rectangle(nTLX, nTLY + 5 , nTRX, nTRY + 6 )); + break; + case 7: + pDev->DrawRect(Rectangle(nTLX, nTLY , nTRX, nTRY + 1 )); + pDev->DrawRect(Rectangle(nTLX, nTLY + 3 , nTRX, nTRY + 6 )); + break; + case 8: + pDev->DrawRect(Rectangle(nTLX, nTLY , nTRX, nTRY + 3 )); + pDev->DrawRect(Rectangle(nTLX, nTLY + 5 , nTRX, nTRY + 6 )); + break; + case 9: + pDev->DrawRect(Rectangle(nTLX, nTLY , nTRX, nTRY + 3 )); + pDev->DrawRect(Rectangle(nTLX, nTLY + 5 , nTRX, nTRY + 8 )); + break; + } + + Invalidate( aRect ); + pDev->SetLineColor(aOldColor); + pDev->SetFillColor(aOldFillColor); + pDev->SetFont(aOldFont); + +} + +} } // end of namespace svx::sidebar + +// eof diff --git a/sc/source/ui/sidebar/CellLineStyleValueSet.hxx b/sc/source/ui/sidebar/CellLineStyleValueSet.hxx new file mode 100644 index 000000000000..ebdfa53f2956 --- /dev/null +++ b/sc/source/ui/sidebar/CellLineStyleValueSet.hxx @@ -0,0 +1,50 @@ +/* + * 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 SC_SIDEBAR_CELL_LINE_STYLE_VALUE_SET_HXX +#define SC_SIDEBAR_CELL_LINE_STYLE_VALUE_SET_HXX + +#include <svtools/valueset.hxx> +#include <vcl/image.hxx> + +namespace sc { namespace sidebar { + +class CellLineStyleValueSet : public ValueSet +{ +private: + VirtualDevice* pVDev; + sal_uInt16 nSelItem; + XubString* strUnit; + Image imgCus; + bool bCusEnable; +public: + CellLineStyleValueSet( Window* pParent, const ResId& rResId); + virtual ~CellLineStyleValueSet(); + + void SetUnit(XubString* str); + void SetSelItem(sal_uInt16 nSel); + sal_uInt16 GetSelItem(); + void SetImage(Image img); + void SetCusEnable(bool bEnable); + virtual void UserDraw( const UserDrawEvent& rUDEvt ); +}; + +} } // end of namespace svx::sidebar + +#endif // SC_SIDEBAR_CELL_LINE_STYLE_VALUE_SET_HXX + +// eof diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx new file mode 100644 index 000000000000..2f5a805b3043 --- /dev/null +++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx @@ -0,0 +1,384 @@ +/* + * 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 <sfx2/sidebar/ResourceDefinitions.hrc> +#include <sfx2/sidebar/Theme.hxx> +#include <sfx2/sidebar/ControlFactory.hxx> +#include <NumberFormatPropertyPanel.hxx> +#include <NumberFormatPropertyPanel.hrc> +#include "sc.hrc" +#include "scresid.hxx" +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <vcl/fixed.hxx> +#include <vcl/lstbox.hxx> +#include <vcl/field.hxx> +#include <vcl/toolbox.hxx> +#include <svl/intitem.hxx> +#include <svl/stritem.hxx> + +using namespace css; +using namespace cssu; + +#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) + +////////////////////////////////////////////////////////////////////////////// +// namespace open + +namespace sc { namespace sidebar { + +////////////////////////////////////////////////////////////////////////////// + +NumberFormatPropertyPanel::NumberFormatPropertyPanel( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings) +: Control( + pParent, + ScResId(RID_PROPERTYPANEL_SC_NUMBERFORMAT)), + mpFtCategory(new FixedText(this, ScResId(FT_CATEGORY))), + mpLbCategory(new ListBox(this, ScResId(LB_CATEGORY))), + mpTBCategoryBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), + mpTBCategory(sfx2::sidebar::ControlFactory::CreateToolBox(mpTBCategoryBackground.get(), ScResId(TBX_CATEGORY))), + mpFtDecimals(new FixedText(this, ScResId(FT_DECIMALS))), + mpEdDecimals(new NumericField(this, ScResId(ED_DECIMALS))), + mpFtLeadZeroes(new FixedText(this, ScResId(FT_LEADZEROES))), + mpEdLeadZeroes(new NumericField(this, ScResId(ED_LEADZEROES))), + mpBtnNegRed(new CheckBox(this, ScResId(BTN_NEGRED))), + mpBtnThousand(new CheckBox(this, ScResId(BTN_THOUSAND))), + maNumFormatControl(SID_NUMBER_TYPE_FORMAT, *pBindings, *this), + + // Caution! SID_NUMBER_FORMAT is reworked in symphony code, may be needed (!) If + // yes, grep for it in SC and symphony (!) + maFormatControl(SID_NUMBER_FORMAT, *pBindings, *this), + + maImgNumber(ScResId(IMG_NUMBER)), + maImgPercent(ScResId(IMG_PERCENT)), + maImgCurrency(ScResId(IMG_CURRENCY)), + maImgDate(ScResId(IMG_DATE)), + maImgText(ScResId(IMG_TEXT)), + mnCategorySelected(0), + mxFrame(rxFrame), + maContext(), + mpBindings(pBindings) +{ + Initialize(); + FreeResource(); +} + +////////////////////////////////////////////////////////////////////////////// + +NumberFormatPropertyPanel::~NumberFormatPropertyPanel() +{ + // Destroy the toolboxes, then their background windows. + mpTBCategory.reset(); + mpTBCategoryBackground.reset(); +} + +////////////////////////////////////////////////////////////////////////////// + +void NumberFormatPropertyPanel::Initialize() +{ + Link aLink = LINK(this, NumberFormatPropertyPanel, NumFormatSelectHdl); + mpLbCategory->SetSelectHdl ( aLink ); + mpLbCategory->SelectEntryPos(0); + mpLbCategory->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Category"))); //wj acc + mpLbCategory->SetDropDownLineCount(mpLbCategory->GetEntryCount()); + + mpTBCategory->SetItemImage(ID_NUMBER, maImgNumber); + mpTBCategory->SetItemImage(ID_PERCENT, maImgPercent); + mpTBCategory->SetItemImage(ID_CURRENCY, maImgCurrency); + mpTBCategory->SetItemImage(ID_DATE, maImgDate); + mpTBCategory->SetItemImage(ID_TEXT, maImgText); + Size aTbxSize( mpTBCategory->CalcWindowSizePixel() ); + mpTBCategory->SetOutputSizePixel( aTbxSize ); + mpTBCategory->SetBackground(Wallpaper()); + mpTBCategory->SetPaintTransparent(true); + aLink = LINK(this, NumberFormatPropertyPanel, NumFormatHdl); + mpTBCategory->SetSelectHdl ( aLink ); + + aLink = LINK(this, NumberFormatPropertyPanel, NumFormatValueHdl); + + mpEdDecimals->SetModifyHdl( aLink ); + mpEdLeadZeroes->SetModifyHdl( aLink ); + mpEdDecimals->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Decimal Places"))); //wj acc + mpEdLeadZeroes->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Leading Zeroes"))); //wj acc + mpBtnNegRed->SetClickHdl( aLink ); + mpBtnThousand->SetClickHdl( aLink ); + + mpLbCategory->SetAccessibleRelationLabeledBy(mpFtCategory.get()); + mpTBCategory->SetAccessibleRelationLabeledBy(mpTBCategory.get()); + mpEdDecimals->SetAccessibleRelationLabeledBy(mpFtDecimals.get()); + mpEdLeadZeroes->SetAccessibleRelationLabeledBy(mpFtLeadZeroes.get()); +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK( NumberFormatPropertyPanel, NumFormatHdl, ToolBox*, pBox ) +{ + sal_uInt16 nVal = pBox->GetCurItemId(); + sal_uInt16 nId = 0; + switch(nVal) + { + case ID_NUMBER: + nId = 1; + break; + case ID_PERCENT: + nId = 2; + break; + case ID_CURRENCY: + nId = 3; + break; + case ID_DATE: + nId = 4; + break; + case ID_TEXT: + nId = 9; + break; + default: + ; + } + if( nId != mnCategorySelected ) + { + SfxUInt16Item aItem( SID_NUMBER_TYPE_FORMAT, nId ); + GetBindings()->GetDispatcher()->Execute(SID_NUMBER_TYPE_FORMAT, SFX_CALLMODE_RECORD, &aItem, 0L); + } + return 0L; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK( NumberFormatPropertyPanel, NumFormatSelectHdl, ListBox*, pBox ) +{ + sal_uInt16 nVal = pBox->GetSelectEntryPos(); + if( nVal != mnCategorySelected ) + { + SfxUInt16Item aItem( SID_NUMBER_TYPE_FORMAT, nVal ); + GetBindings()->GetDispatcher()->Execute(SID_NUMBER_TYPE_FORMAT, SFX_CALLMODE_RECORD, &aItem, 0L); + mnCategorySelected = nVal; + } + return 0L; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK( NumberFormatPropertyPanel, NumFormatValueHdl, void*, EMPTYARG ) +{ + String aFormat; + String sBreak = OUString(","); + bool bThousand = mpBtnThousand->IsEnabled() + && mpBtnThousand->IsChecked(); + bool bNegRed = mpBtnNegRed->IsEnabled() + && mpBtnNegRed->IsChecked(); + sal_uInt16 nPrecision = (mpEdDecimals->IsEnabled()) + ? (sal_uInt16)mpEdDecimals->GetValue() + : (sal_uInt16)0; + sal_uInt16 nLeadZeroes = (mpEdLeadZeroes->IsEnabled()) + ? (sal_uInt16)mpEdLeadZeroes->GetValue() + : (sal_uInt16)0; + + String sThousand = OUString::number(static_cast<sal_Int32>(bThousand)); + String sNegRed = OUString::number(static_cast<sal_Int32>(bNegRed)); + String sPrecision = OUString::number(nPrecision); + String sLeadZeroes = OUString::number(nLeadZeroes); + + aFormat += sThousand; + aFormat += sBreak; + aFormat += sNegRed; + aFormat += sBreak; + aFormat += sPrecision; + aFormat += sBreak; + aFormat += sLeadZeroes; + aFormat += sBreak; + + SfxStringItem aItem( SID_NUMBER_FORMAT, aFormat ); + GetBindings()->GetDispatcher()->Execute(SID_NUMBER_FORMAT, SFX_CALLMODE_RECORD, &aItem, 0L); + return 0L; +} + +////////////////////////////////////////////////////////////////////////////// + +NumberFormatPropertyPanel* NumberFormatPropertyPanel::Create ( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings) +{ + if (pParent == NULL) + throw lang::IllegalArgumentException(A2S("no parent Window given to NumberFormatPropertyPanel::Create"), NULL, 0); + if ( ! rxFrame.is()) + throw lang::IllegalArgumentException(A2S("no XFrame given to NumberFormatPropertyPanel::Create"), NULL, 1); + if (pBindings == NULL) + throw lang::IllegalArgumentException(A2S("no SfxBindings given to NumberFormatPropertyPanel::Create"), NULL, 2); + + return new NumberFormatPropertyPanel( + pParent, + rxFrame, + pBindings); +} + +////////////////////////////////////////////////////////////////////////////// + +void NumberFormatPropertyPanel::DataChanged( + const DataChangedEvent& rEvent) +{ + (void)rEvent; +} + +////////////////////////////////////////////////////////////////////////////// + +void NumberFormatPropertyPanel::HandleContextChange( + const ::sfx2::sidebar::EnumContext aContext) +{ + if(maContext == aContext) + { + // Nothing to do. + return; + } + + maContext = aContext; + + + + // todo +} + +////////////////////////////////////////////////////////////////////////////// + +void NumberFormatPropertyPanel::NotifyItemUpdate( + sal_uInt16 nSID, + SfxItemState eState, + const SfxPoolItem* pState) +{ + switch(nSID) + { + case SID_NUMBER_TYPE_FORMAT: + { + if( eState >= SFX_ITEM_AVAILABLE) + { + const SfxInt16Item* pItem = (const SfxInt16Item*)pState; + sal_uInt16 nVal = pItem->GetValue(); + mnCategorySelected = nVal; + mpLbCategory->SelectEntryPos(nVal); + if( nVal < 4 ) + { + mpBtnThousand->Enable(); + mpBtnNegRed->Enable(); + mpEdDecimals->Enable(); + mpEdLeadZeroes->Enable(); + } + else + { + mpBtnThousand->Disable(); + mpBtnNegRed->Disable(); + mpEdDecimals->Disable(); + mpEdLeadZeroes->Disable(); + } + } + else + { + mpLbCategory->SetNoSelection(); + mnCategorySelected = 0; + mpBtnThousand->Disable(); + mpBtnNegRed->Disable(); + mpEdDecimals->Disable(); + mpEdLeadZeroes->Disable(); + } + } + break; + case SID_NUMBER_FORMAT: + { + bool bThousand = 0; + bool bNegRed = 0; + sal_uInt16 nPrecision = 0; + sal_uInt16 nLeadZeroes = 0; + if( eState >= SFX_ITEM_AVAILABLE) + { + const SfxStringItem* pItem = (const SfxStringItem*)pState; + String aCode = pItem->GetValue(); + /* if(aCode.Equals(String::CreateFromAscii("General"))) + { + mnCategorySelected = 0; + mpLbCategory->SelectEntryPos(0); + mpBtnThousand->Check(0); + mpBtnNegRed->Check(0); + mpEdDecimals->SetValue(0); + mpEdLeadZeroes->SetValue(1); + break; + } + else if( mpLbCategory->GetSelectEntryPos() == 0 ) + { + mnCategorySelected = 1; + mpLbCategory->SelectEntryPos(1); + }*/ + sal_uInt16 aLen = aCode.Len(); + String* sFormat = new String[4]; + String sTmpStr = OUString(); + sal_uInt16 nCount = 0; + sal_uInt16 nStrCount = 0; + while( nCount < aLen ) + { + sal_Unicode cChar = aCode.GetChar(nCount); + if(cChar == sal_Unicode(',')) + { + sFormat[nStrCount] = sTmpStr; + sTmpStr = OUString(); + nStrCount++; + } + else + { + sTmpStr += cChar; + } + nCount++; + } + bThousand = sFormat[0].ToInt32(); + bNegRed = sFormat[1].ToInt32(); + nPrecision = (sal_uInt16)sFormat[2].ToInt32(); + nLeadZeroes = (sal_uInt16)sFormat[3].ToInt32(); + delete[] sFormat; + } + else + { + bThousand = 0; + bNegRed = 0; + nPrecision = 0; + nLeadZeroes = 1; + } + mpBtnThousand->Check(bThousand); + mpBtnNegRed->Check(bNegRed); + mpEdDecimals->SetValue(nPrecision); + mpEdLeadZeroes->SetValue(nLeadZeroes); + } + default: + ; + } +} + +////////////////////////////////////////////////////////////////////////////// + +SfxBindings* NumberFormatPropertyPanel::GetBindings() +{ + return mpBindings; +} + +////////////////////////////////////////////////////////////////////////////// +// namespace close + +}} // end of namespace ::sc::sidebar + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.hrc b/sc/source/ui/sidebar/NumberFormatPropertyPanel.hrc new file mode 100644 index 000000000000..13b17c32ef71 --- /dev/null +++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.hrc @@ -0,0 +1,70 @@ +/* + * 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 . + */ +#define FT_CATEGORY 1 +#define LB_CATEGORY 2 +#define FT_DECIMALS 3 +#define ED_DECIMALS 4 +#define FT_LEADZEROES 5 +#define ED_LEADZEROES 6 +#define BTN_NEGRED 7 +#define BTN_THOUSAND 8 +#define TBX_CATEGORY 9 +#define ID_NUMBER 10 +#define ID_PERCENT 11 +#define ID_CURRENCY 12 +#define ID_DATE 13 +#define ID_TEXT 14 +#define IMG_NUMBER 15 +#define IMG_PERCENT 16 +#define IMG_CURRENCY 17 +#define IMG_DATE 18 +#define IMG_TEXT 19 + +//===============================================================position============================================= + +#define MBOX_WIDTH 28 +#define NF_TOOLBOX_ITEM_HEIGHT 12 +#define CHECKBOX_HEIGHT 10 + +#define FT_CATEGORY_X SECTIONPAGE_MARGIN_HORIZONTAL +#define FT_CATEGORY_Y SECTIONPAGE_MARGIN_VERTICAL_TOP +#define LB_CATEGORY_X FT_CATEGORY_X +#define LB_CATEGORY_Y FT_CATEGORY_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + +#define TBX_CATEGORY_X SECTIONPAGE_MARGIN_HORIZONTAL + 1 +#define TBX_CATEGORY_Y LB_CATEGORY_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL + +#define FT_DECIMALS_X SECTIONPAGE_MARGIN_HORIZONTAL +#define FT_DECIMALS_Y TBX_CATEGORY_Y + NF_TOOLBOX_ITEM_HEIGHT + 4 + CONTROL_SPACING_VERTICAL +#define LB_DECIMALS_X FT_CATEGORY_X +#define LB_DECIMALS_Y FT_DECIMALS_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + +#define FT_LEADZEROES_X SECTIONPAGE_MARGIN_HORIZONTAL + MBOX_WIDTH*2 + CONTROL_SPACING_HORIZONTAL +#define FT_LEADZEROES_Y FT_DECIMALS_Y +#define LB_LEADZEROES_X FT_LEADZEROES_X +#define LB_LEADZEROES_Y FT_LEADZEROES_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + +#define BTN_NEGRED_X SECTIONPAGE_MARGIN_HORIZONTAL +#define BTN_NEGRED_Y LB_LEADZEROES_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL + +#define BTN_THOUSAND_X SECTIONPAGE_MARGIN_HORIZONTAL +#define BTN_THOUSAND_Y BTN_NEGRED_Y + CHECKBOX_HEIGHT + CONTROL_SPACING_VERTICAL - 3 + +#define PROPERTYPAGE_HEIGHT BTN_THOUSAND_Y + CHECKBOX_HEIGHT + 2 + +// eof diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx b/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx new file mode 100644 index 000000000000..98102f476297 --- /dev/null +++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx @@ -0,0 +1,104 @@ +/* + * 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 SC_PROPERTYPANEL_NUMFORMAT_HXX +#define SC_PROPERTYPANEL_NUMFORMAT_HXX + +#include <sfx2/sidebar/SidebarPanelBase.hxx> +#include <sfx2/sidebar/ControllerItem.hxx> +#include <sfx2/sidebar/IContextChangeReceiver.hxx> +#include <boost/scoped_ptr.hpp> + +class FixedText; +class ListBox; +class NumericField; + +namespace sc { namespace sidebar { + +class NumberFormatPropertyPanel +: public Control, + public ::sfx2::sidebar::IContextChangeReceiver, + public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface +{ +public: +public: + static NumberFormatPropertyPanel* Create( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings); + + virtual void DataChanged( + const DataChangedEvent& rEvent); + + virtual void HandleContextChange( + const ::sfx2::sidebar::EnumContext aContext); + + virtual void NotifyItemUpdate( + const sal_uInt16 nSId, + const SfxItemState eState, + const SfxPoolItem* pState); + + SfxBindings* GetBindings(); + +private: + //ui controls + ::boost::scoped_ptr< FixedText > mpFtCategory; + ::boost::scoped_ptr< ListBox > mpLbCategory; + ::boost::scoped_ptr< Window > mpTBCategoryBackground; + ::boost::scoped_ptr< ToolBox > mpTBCategory; + ::boost::scoped_ptr< FixedText > mpFtDecimals; + ::boost::scoped_ptr< NumericField > mpEdDecimals; + ::boost::scoped_ptr< FixedText > mpFtLeadZeroes; + ::boost::scoped_ptr< NumericField > mpEdLeadZeroes; + ::boost::scoped_ptr< CheckBox > mpBtnNegRed; + ::boost::scoped_ptr< CheckBox > mpBtnThousand; + + ::sfx2::sidebar::ControllerItem maNumFormatControl; + ::sfx2::sidebar::ControllerItem maFormatControl; + + // images + Image maImgNumber; + Image maImgPercent; + Image maImgCurrency; + Image maImgDate; + Image maImgText; + + sal_uInt16 mnCategorySelected; + + cssu::Reference<css::frame::XFrame> mxFrame; + ::sfx2::sidebar::EnumContext maContext; + SfxBindings* mpBindings; + + DECL_LINK(NumFormatHdl, ToolBox*); + DECL_LINK(NumFormatSelectHdl, ListBox*); + DECL_LINK(NumFormatValueHdl, void*); + + // constructor/destuctor + NumberFormatPropertyPanel( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings); + virtual ~NumberFormatPropertyPanel(); + + void Initialize(); +}; + +} } // end of namespace ::sc::sidebar + +#endif + +// eof diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.src b/sc/source/ui/sidebar/NumberFormatPropertyPanel.src new file mode 100644 index 000000000000..2111a5ca233f --- /dev/null +++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.src @@ -0,0 +1,183 @@ +/* + * 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 "NumberFormatPropertyPanel.hrc" +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include "sc.hrc" +#include "helpids.h" + +Control RID_PROPERTYPANEL_SC_NUMBERFORMAT +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + + Size = MAP_APPFONT( PROPERTYPAGE_WIDTH, PROPERTYPAGE_HEIGHT ); + HelpID = HID_PROPERTYPANEL_SC_NUM_SECTION ; + Text = "Number Format"; + + FixedText FT_CATEGORY + { + Pos = MAP_APPFONT ( FT_CATEGORY_X , FT_CATEGORY_Y ) ; + Size = MAP_APPFONT ( MBOX_WIDTH*4 , TEXT_HEIGHT ) ; + Text [ en-US ] = "~Category:" ; + }; + ListBox LB_CATEGORY + { + Border = TRUE ; + Pos = MAP_APPFONT ( LB_CATEGORY_X , LB_CATEGORY_Y ) ; + Size = MAP_APPFONT ( MBOX_WIDTH *2 , MBOX_HEIGHT ) ; + HelpID = HID_PROPERTY_PANEL_NUMFMT_LB_CATEGORY; + QuickHelpText [ en-US ] = "Select a category of contents."; + TabStop = TRUE ; + DropDown = TRUE ; + StringList [ en-US ] = + { + < "General" ; Default ; > ; + < "Number" ;> ; + < "Percent" ;> ; + < "Currency" ;> ; + < "Date" ;> ; + < "Time" ;> ; + < "Scientific" ;> ; + < "Fraction" ;> ; + < "Boolean Value" ;> ; + < "Text" ;> ; + }; + }; + ToolBox TBX_CATEGORY + { + Pos = MAP_APPFONT ( TBX_CATEGORY_X , TBX_CATEGORY_Y ); + SVLook = TRUE ; + Border = FALSE ; + HelpID = HID_PROPERTY_PANEL_NUMFMT_TBX_CATEGORY; + Text = "Format"; + ItemList = + { + ToolBoxItem + { + Identifier = ID_NUMBER ; + Text [ en-US ] = "Number" ; + HelpID = HID_PROPERTY_PANEL_NUMFMT_ID_NUMBER; + }; + ToolBoxItem + { + Identifier = ID_PERCENT ; + Text [ en-US ] = "Percent" ; + HelpID = HID_PROPERTY_PANEL_NUMFMT_ID_PERCENT; + }; + ToolBoxItem + { + Identifier = ID_CURRENCY ; + Text [ en-US ] = "Currency" ; + HelpID = HID_PROPERTY_PANEL_NUMFMT_ID_CURRENCY; + }; + ToolBoxItem + { + Identifier = ID_DATE ; + Text [ en-US ] = "Date" ; + HelpID = HID_PROPERTY_PANEL_NUMFMT_ID_DATE; + }; + ToolBoxItem + { + Identifier = ID_TEXT ; + Text [ en-US ] = "Text" ; + HelpID = HID_PROPERTY_PANEL_NUMFMT_ID_TEXT; + }; + }; + }; + FixedText FT_DECIMALS + { + Pos = MAP_APPFONT ( FT_DECIMALS_X , FT_DECIMALS_Y ) ; + Size = MAP_APPFONT ( MBOX_WIDTH *2, TEXT_HEIGHT ) ; + Text [ en-US ] = "~Decimal places:" ; + }; + NumericField ED_DECIMALS + { + Border = TRUE ; + Pos = MAP_APPFONT ( LB_DECIMALS_X , LB_DECIMALS_Y ) ; + Size = MAP_APPFONT ( MBOX_WIDTH , MBOX_HEIGHT ) ; + HelpID = HID_PROPERTY_PANEL_NUMFMT_ED_DECIMALS; + QuickHelpText [ en-US ] = "Enter the number of decimal places that you want to display."; + Spin = TRUE ; + Maximum = 20 ; + Last = 15 ; + First = 0 ; + StrictFormat = TRUE ; + SpinSize = 1 ; + Repeat = TRUE ; + }; + FixedText FT_LEADZEROES + { + Pos = MAP_APPFONT ( FT_LEADZEROES_X , FT_LEADZEROES_Y ) ; + Size = MAP_APPFONT (PROPERTYPAGE_WIDTH - MBOX_WIDTH *2 - SECTIONPAGE_MARGIN_HORIZONTAL * 2, TEXT_HEIGHT ) ; // + Text [ en-US ] = "Leading ~zeroes:" ; + }; + NumericField ED_LEADZEROES + { + Border = TRUE ; + Pos = MAP_APPFONT ( LB_LEADZEROES_X , LB_LEADZEROES_Y ) ; + Size = MAP_APPFONT ( MBOX_WIDTH , MBOX_HEIGHT ) ; + HelpID = HID_PROPERTY_PANEL_NUMFMT_ED_LEADZEROES; + QuickHelpText [ en-US ] = "Enter the maximum number of zeroes to display before the decimal point."; + Spin = TRUE ; + Maximum = 20 ; + Last = 15 ; + First = 0 ; + StrictFormat = TRUE ; + SpinSize = 1 ; + Repeat = TRUE ; + }; + CheckBox BTN_NEGRED + { + Pos = MAP_APPFONT ( BTN_NEGRED_X , BTN_NEGRED_Y ) ; + Size = MAP_APPFONT ( 100 , CHECKBOX_HEIGHT ) ; + HelpID = HID_PROPERTY_PANEL_NUMFMT_BTN_NEGRED; + QuickHelpText [ en-US ] = "Changes the font color of negative numbers to red."; + Text [ en-US ] = "~Negative numbers red" ; + }; + CheckBox BTN_THOUSAND + { + Pos = MAP_APPFONT ( BTN_THOUSAND_X , BTN_THOUSAND_Y ) ; + Size = MAP_APPFONT ( 100 , CHECKBOX_HEIGHT ) ; + HelpID = HID_PROPERTY_PANEL_NUMFMT_BTN_THOUSAND; + QuickHelpText [ en-US ] = "Inserts a separator between thousands."; + Text [ en-US ] = "~Thousands separator" ; + }; + Image IMG_NUMBER + { + ImageBitmap = Bitmap{File = "sidebar/123.png";}; + }; + Image IMG_PERCENT + { + ImageBitmap = Bitmap{File = "sidebar/percent.png";}; + }; + Image IMG_CURRENCY + { + ImageBitmap = Bitmap{File = "sidebar/money.png";}; + }; + Image IMG_DATE + { + ImageBitmap = Bitmap{File = "sidebar/canlendar.png";}; + }; + Image IMG_TEXT + { + ImageBitmap = Bitmap{File = "sidebar/ABC.png";}; + }; +}; + +// eof diff --git a/sc/source/ui/sidebar/ScPanelFactory.cxx b/sc/source/ui/sidebar/ScPanelFactory.cxx new file mode 100644 index 000000000000..ce97a8994cf5 --- /dev/null +++ b/sc/source/ui/sidebar/ScPanelFactory.cxx @@ -0,0 +1,168 @@ +/* + * 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 "ScPanelFactory.hxx" + +#include <AlignmentPropertyPanel.hxx> +#include <CellAppearancePropertyPanel.hxx> +#include <NumberFormatPropertyPanel.hxx> +#include <navipi.hxx> +#include <dwfunctr.hxx> +#include "sc.hrc" + +#include <sfx2/sidebar/SidebarPanelBase.hxx> +#include <sfx2/sfxbasecontroller.hxx> +#include <toolkit/helper/vclunohelper.hxx> +#include <vcl/window.hxx> +#include <rtl/ref.hxx> +#include <comphelper/namedvaluecollection.hxx> + +#include <boost/bind.hpp> + + +using namespace css; +using namespace cssu; +using ::rtl::OUString; + + +namespace sc { namespace sidebar { + +#define A2S(s) ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)) +#define IMPLEMENTATION_NAME "org.apache.openoffice.comp.sc.sidebar.ScPanelFactory" +#define SERVICE_NAME "com.sun.star.ui.UIElementFactory" + + +::rtl::OUString SAL_CALL ScPanelFactory::getImplementationName (void) +{ + return A2S(IMPLEMENTATION_NAME); +} + + +cssu::Reference<cssu::XInterface> SAL_CALL ScPanelFactory::createInstance( + const uno::Reference<lang::XMultiServiceFactory>& ) +{ + ::rtl::Reference<ScPanelFactory> pPanelFactory (new ScPanelFactory()); + cssu::Reference<cssu::XInterface> xService (static_cast<XWeak*>(pPanelFactory.get()), cssu::UNO_QUERY); + return xService; +} + + +cssu::Sequence<OUString> SAL_CALL ScPanelFactory::getSupportedServiceNames (void) +{ + cssu::Sequence<OUString> aServiceNames (1); + aServiceNames[0] = A2S(SERVICE_NAME); + return aServiceNames; + +} + + +ScPanelFactory::ScPanelFactory (void) + : PanelFactoryInterfaceBase(m_aMutex) +{ +} + + +ScPanelFactory::~ScPanelFactory (void) +{ +} + + +Reference<ui::XUIElement> SAL_CALL ScPanelFactory::createUIElement ( + const ::rtl::OUString& rsResourceURL, + const ::cssu::Sequence<css::beans::PropertyValue>& rArguments) + throw( + container::NoSuchElementException, + lang::IllegalArgumentException, + RuntimeException) +{ + Reference<ui::XUIElement> xElement; + + const ::comphelper::NamedValueCollection aArguments (rArguments); + Reference<frame::XFrame> xFrame (aArguments.getOrDefault("Frame", Reference<frame::XFrame>())); + Reference<awt::XWindow> xParentWindow (aArguments.getOrDefault("ParentWindow", Reference<awt::XWindow>())); + const sal_uInt64 nBindingsValue (aArguments.getOrDefault("SfxBindings", sal_uInt64(0))); + SfxBindings* pBindings = reinterpret_cast<SfxBindings*>(nBindingsValue); + + ::Window* pParentWindow = VCLUnoHelper::GetWindow(xParentWindow); + if ( ! xParentWindow.is() || pParentWindow==NULL) + throw RuntimeException( + A2S("PanelFactory::createUIElement called without ParentWindow"), + NULL); + if ( ! xFrame.is()) + throw RuntimeException( + A2S("PanelFactory::createUIElement called without Frame"), + NULL); + if (pBindings == NULL) + throw RuntimeException( + A2S("PanelFactory::createUIElement called without SfxBindings"), + NULL); + +#define DoesResourceEndWith(s) rsResourceURL.endsWithAsciiL(s,strlen(s)) + if (DoesResourceEndWith("/AlignmentPropertyPanel")) + { + AlignmentPropertyPanel* pPanel = AlignmentPropertyPanel::Create( pParentWindow, xFrame, pBindings ); + xElement = sfx2::sidebar::SidebarPanelBase::Create( + rsResourceURL, + xFrame, + pPanel, + ui::LayoutSize(-1,-1,-1)); + } + else if (DoesResourceEndWith("/CellAppearancePropertyPanel")) + { + CellAppearancePropertyPanel* pPanel = CellAppearancePropertyPanel::Create( pParentWindow, xFrame, pBindings ); + xElement = sfx2::sidebar::SidebarPanelBase::Create( + rsResourceURL, + xFrame, + pPanel, + ui::LayoutSize(-1,-1,-1)); + } + else if (DoesResourceEndWith("/NumberFormatPropertyPanel")) + { + NumberFormatPropertyPanel* pPanel = NumberFormatPropertyPanel::Create( pParentWindow, xFrame, pBindings ); + xElement = sfx2::sidebar::SidebarPanelBase::Create( + rsResourceURL, + xFrame, + pPanel, + ui::LayoutSize(-1,-1,-1)); + } + else if (DoesResourceEndWith("/NavigatorPanel")) + { + Window* pPanel = new ScNavigatorDlg(pBindings, NULL, pParentWindow, false); + xElement = sfx2::sidebar::SidebarPanelBase::Create( + rsResourceURL, + xFrame, + pPanel, + ui::LayoutSize(0,-1,-1)); + } + else if (DoesResourceEndWith("/FunctionsPanel")) + { + Window* pPanel = new ScFunctionDockWin(pBindings, NULL, pParentWindow, ScResId(FID_FUNCTION_BOX)); + xElement = sfx2::sidebar::SidebarPanelBase::Create( + rsResourceURL, + xFrame, + pPanel, + ui::LayoutSize(0,-1,-1)); + } +#undef DoesResourceEndWith + + return xElement; +} + +} } // end of namespace sc::sidebar + +// eof |