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 /svx/source/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 'svx/source/sidebar')
86 files changed, 22391 insertions, 0 deletions
diff --git a/svx/source/sidebar/ColorPanel.cxx b/svx/source/sidebar/ColorPanel.cxx new file mode 100644 index 000000000000..92874c03f139 --- /dev/null +++ b/svx/source/sidebar/ColorPanel.cxx @@ -0,0 +1,229 @@ +/* + * 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 "precompiled_svx.hxx" + +#include "ColorPanel.hxx" + +#include <vcl/image.hxx> +#include <vcl/svapp.hxx> + +namespace svx { namespace sidebar { + +ColorPanel::ColorPanel (::Window* pParent) + : ValueSet(pParent), + mnPreferredColumnCount(2) +{ + WinBits aStyle = + WB_ITEMBORDER + | WB_DOUBLEBORDER + | WB_NAMEFIELD + | WB_FLATVALUESET + | WB_TABSTOP + | WB_VSCROLL; + + SetStyle(GetStyle() | aStyle); + SetExtraSpacing(2); + + Fill (); + Show(); +} + + + + +ColorPanel::~ColorPanel (void) +{ +} + + + + +sal_Int32 ColorPanel::GetPreferredHeight (sal_Int32 nWidth) +{ + sal_Int32 nPreferredHeight = 0; + if (GetItemCount()>0) + { + Image aImage = GetItemImage(GetItemId(0)); + Size aItemSize = CalcItemSizePixel (aImage.GetSizePixel()); + if (nWidth>0 && aItemSize.Width()>0) + { + int nColumnCount = nWidth / aItemSize.Width(); + if (nColumnCount <= 0) + nColumnCount = 1; + else if (nColumnCount > 4) + nColumnCount = 4; + int nRowCount = (GetItemCount() + nColumnCount-1) + / nColumnCount; + nPreferredHeight = nRowCount * aItemSize.Height(); + } + } + return nPreferredHeight; +} + + + + +void ColorPanel::Resize (void) +{ + ::Window::Resize(); + Size aWindowSize = GetOutputSizePixel(); + SetPosSizePixel(Point(0,0), aWindowSize); + if (IsVisible() && aWindowSize.Width() > 0) + { + // Calculate the number of rows and columns. + if (GetItemCount() > 0) + { + Image aImage = GetItemImage(GetItemId(0)); + Size aItemSize = CalcItemSizePixel ( + aImage.GetSizePixel()); + int nColumnCount = aWindowSize.Width() / 30; + if (nColumnCount < 1) + nColumnCount = 1; + else if (nColumnCount > 4) + nColumnCount = 4; + + sal_uInt16 nRowCount = (sal_uInt16)CalculateRowCount(aItemSize, nColumnCount); + + SetColCount((sal_uInt16)nColumnCount); + SetLineCount(nRowCount); + } + } + +} + + + + +int ColorPanel::CalculateRowCount (const Size&, int nColumnCount) +{ + int nRowCount = 0; + + if (GetItemCount()>0 && nColumnCount>0) + { + nRowCount = GetOutputSizePixel().Height() / 30; + if (nRowCount < 1) + nRowCount = 1; + } + + return nRowCount; +} + + + + +void ColorPanel::DataChanged (const DataChangedEvent& rEvent) +{ + Fill(); +} + + + + +void ColorPanel::Fill (void) +{ + const StyleSettings& rSettings ( + Application::GetSettings().GetStyleSettings()); + Clear(); + SetItemWidth (30); + SetItemHeight (30); + sal_uInt16 i = 0; + InsertItem (++i, rSettings.GetFaceColor()); + SetItemText (i, String::CreateFromAscii("FaceColor")); + InsertItem (++i, rSettings.GetCheckedColor()); + SetItemText (i, String::CreateFromAscii("CheckedColor")); + InsertItem (++i, rSettings.GetLightColor()); + SetItemText (i, String::CreateFromAscii("LightColor")); + InsertItem (++i, rSettings.GetLightBorderColor()); + SetItemText (i, String::CreateFromAscii("LightBorderColor")); + InsertItem (++i, rSettings.GetShadowColor()); + SetItemText (i, String::CreateFromAscii("ShadowColor")); + InsertItem (++i, rSettings.GetDarkShadowColor()); + SetItemText (i, String::CreateFromAscii("DarkShadowColor")); + InsertItem (++i, rSettings.GetButtonTextColor()); + SetItemText (i, String::CreateFromAscii("ButtonTextColor")); + InsertItem (++i, rSettings.GetRadioCheckTextColor()); + SetItemText (i, String::CreateFromAscii("RadioCheckTextColor")); + InsertItem (++i, rSettings.GetGroupTextColor()); + SetItemText (i, String::CreateFromAscii("GroupTextColor")); + InsertItem (++i, rSettings.GetLabelTextColor()); + SetItemText (i, String::CreateFromAscii("LabelTextColor")); + InsertItem (++i, rSettings.GetInfoTextColor()); + SetItemText (i, String::CreateFromAscii("InfoTextColor")); + InsertItem (++i, rSettings.GetWindowColor()); + SetItemText (i, String::CreateFromAscii("WindowColor")); + InsertItem (++i, rSettings.GetWindowTextColor()); + SetItemText (i, String::CreateFromAscii("WindowTextColor")); + InsertItem (++i, rSettings.GetDialogColor()); + SetItemText (i, String::CreateFromAscii("DialogColor")); + InsertItem (++i, rSettings.GetDialogTextColor()); + SetItemText (i, String::CreateFromAscii("DialogTextColor")); + InsertItem (++i, rSettings.GetWorkspaceColor()); + SetItemText (i, String::CreateFromAscii("WorkspaceColor")); + InsertItem (++i, rSettings.GetFieldColor()); + SetItemText (i, String::CreateFromAscii("FieldColor")); + InsertItem (++i, rSettings.GetFieldTextColor()); + SetItemText (i, String::CreateFromAscii("FieldTextColor")); + InsertItem (++i, rSettings.GetActiveColor()); + SetItemText (i, String::CreateFromAscii("ActiveColor")); + InsertItem (++i, rSettings.GetActiveColor2()); + SetItemText (i, String::CreateFromAscii("ActiveColor2")); + InsertItem (++i, rSettings.GetActiveTextColor()); + SetItemText (i, String::CreateFromAscii("ActiveTextColor")); + InsertItem (++i, rSettings.GetActiveBorderColor()); + SetItemText (i, String::CreateFromAscii("ActiveBorderColor")); + InsertItem (++i, rSettings.GetDeactiveColor()); + SetItemText (i, String::CreateFromAscii("DeactiveColor")); + InsertItem (++i, rSettings.GetDeactiveColor2()); + SetItemText (i, String::CreateFromAscii("DeactiveColor2")); + InsertItem (++i, rSettings.GetDeactiveTextColor()); + SetItemText (i, String::CreateFromAscii("DeactiveTextColor")); + InsertItem (++i, rSettings.GetDeactiveBorderColor()); + SetItemText (i, String::CreateFromAscii("DeactiveBorderColor")); + InsertItem (++i, rSettings.GetHighlightColor()); + SetItemText (i, String::CreateFromAscii("HighlightColor")); + InsertItem (++i, rSettings.GetHighlightTextColor()); + SetItemText (i, String::CreateFromAscii("HighlightTextColor")); + InsertItem (++i, rSettings.GetDisableColor()); + SetItemText (i, String::CreateFromAscii("DisableColor")); + InsertItem (++i, rSettings.GetHelpColor()); + SetItemText (i, String::CreateFromAscii("HelpColor")); + InsertItem (++i, rSettings.GetHelpTextColor()); + SetItemText (i, String::CreateFromAscii("HelpTextColor")); + InsertItem (++i, rSettings.GetMenuColor()); + SetItemText (i, String::CreateFromAscii("MenuColor")); + InsertItem (++i, rSettings.GetMenuBarColor()); + SetItemText (i, String::CreateFromAscii("MenuBarColor")); + InsertItem (++i, rSettings.GetMenuBorderColor()); + SetItemText (i, String::CreateFromAscii("MenuBorderColor")); + InsertItem (++i, rSettings.GetMenuTextColor()); + SetItemText (i, String::CreateFromAscii("MenuTextColor")); + InsertItem (++i, rSettings.GetMenuHighlightColor()); + SetItemText (i, String::CreateFromAscii("MenuHighlightColor")); + InsertItem (++i, rSettings.GetMenuHighlightTextColor()); + SetItemText (i, String::CreateFromAscii("MenuHighlightTextColor")); + InsertItem (++i, rSettings.GetLinkColor()); + SetItemText (i, String::CreateFromAscii("LinkColor")); + InsertItem (++i, rSettings.GetVisitedLinkColor()); + SetItemText (i, String::CreateFromAscii("VisitedLinkColor")); + InsertItem (++i, rSettings.GetHighlightLinkColor()); + SetItemText (i, String::CreateFromAscii("HighlightLinkColor")); + InsertItem (++i, rSettings.GetFontColor()); + SetItemText (i, String::CreateFromAscii("FontColor")); +} + +} } // end of namespace ::svx::sidebar diff --git a/svx/source/sidebar/ColorPanel.hxx b/svx/source/sidebar/ColorPanel.hxx new file mode 100644 index 000000000000..4168dff96999 --- /dev/null +++ b/svx/source/sidebar/ColorPanel.hxx @@ -0,0 +1,60 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SVX_SIDEBAR_COLOR_PANEL_HXX +#define SVX_SIDEBAR_COLOR_PANEL_HXX + +#include <svtools/valueset.hxx> +#include <vcl/window.hxx> + + +namespace svx { namespace sidebar { + + +/** This demo panel shows the colors that are available from the + StyleSettings. +*/ +class ColorPanel + : public ValueSet +{ +public: + ColorPanel (::Window* pParent); + virtual ~ColorPanel (void); + + // From ::Window + virtual void Resize (void); + virtual void DataChanged (const DataChangedEvent& rEvent); + +private: + int mnPreferredColumnCount; + + /** Depending on the given number of columns and the item size + calculate the number of rows that are necessary to display all + items. + */ + int CalculateRowCount (const Size& rItemSize, int nColumnCount); + void Fill (void); + + sal_Int32 GetPreferredHeight (sal_Int32 nWidth); +}; + +} } // end of namespace ::svx::sidebar + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/sidebar/ContextChangeEventMultiplexer.cxx b/svx/source/sidebar/ContextChangeEventMultiplexer.cxx new file mode 100644 index 000000000000..427c37a37d03 --- /dev/null +++ b/svx/source/sidebar/ContextChangeEventMultiplexer.cxx @@ -0,0 +1,86 @@ +/* + * 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 "svx/sidebar/ContextChangeEventMultiplexer.hxx" + +#include <com/sun/star/ui/ContextChangeEventObject.hpp> +#include <com/sun/star/ui/XContextChangeEventMultiplexer.hpp> +#include <com/sun/star/ui/ContextChangeEventMultiplexer.hpp> +#include <com/sun/star/frame/XModuleManager.hpp> +#include <comphelper/processfactory.hxx> +#include <comphelper/componentcontext.hxx> +#include <sfx2/viewsh.hxx> +#include <tools/diagnose_ex.h> + +using namespace css; +using namespace cssu; + + +void ContextChangeEventMultiplexer::NotifyContextChange ( + const cssu::Reference<css::frame::XController>& rxController, + const ::sfx2::sidebar::EnumContext::Context eContext) +{ + if (rxController.is() && rxController->getFrame().is()) + { + const css::ui::ContextChangeEventObject aEvent( + rxController, + GetModuleName(rxController->getFrame()), + ::sfx2::sidebar::EnumContext::GetContextName(eContext)); + + cssu::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer ( + css::ui::ContextChangeEventMultiplexer::get( + ::comphelper::getProcessComponentContext())); + if (xMultiplexer.is()) + xMultiplexer->broadcastContextChangeEvent(aEvent, rxController); + } +} + + + + +void ContextChangeEventMultiplexer::NotifyContextChange ( + SfxViewShell* pViewShell, + const ::sfx2::sidebar::EnumContext::Context eContext) +{ + if (pViewShell != NULL) + NotifyContextChange(pViewShell->GetController(), eContext); +} + + + + +::rtl::OUString ContextChangeEventMultiplexer::GetModuleName ( + const cssu::Reference<css::frame::XFrame>& rxFrame) +{ + try + { + const ::comphelper::ComponentContext aContext (::comphelper::getProcessServiceFactory()); + const Reference<frame::XModuleManager> xModuleManager ( + aContext.createComponent("com.sun.star.frame.ModuleManager" ), + UNO_QUERY_THROW ); + return xModuleManager->identify(rxFrame); + } + catch (const Exception&) + { + // An exception typically means that a context change is notified + // during initialization or destruction of a view. + // Ignore it. + } + return ::sfx2::sidebar::EnumContext::GetApplicationName( + ::sfx2::sidebar::EnumContext::Application_None); +} diff --git a/svx/source/sidebar/EmptyPanel.cxx b/svx/source/sidebar/EmptyPanel.cxx new file mode 100644 index 000000000000..2f8943684e85 --- /dev/null +++ b/svx/source/sidebar/EmptyPanel.cxx @@ -0,0 +1,75 @@ +/* + * 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 "EmptyPanel.hxx" +#include "EmptyPanel.hrc" +#include "area/AreaPropertyPanel.hrc" +#include "svx/dialogs.hrc" +#include "svx/dialmgr.hxx" + + +namespace svx { namespace sidebar { + +namespace +{ + class SidebarResource : public Resource + { + public: + SidebarResource (const ResId& rResId) : Resource(rResId) {} + ~SidebarResource (void) { FreeResource(); } + }; +} + + + + +EmptyPanel::EmptyPanel (::Window* pParent) + : Control(pParent, SVX_RES(RID_SIDEBAR_EMPTY_PANEL)), + maMessageControl(this, SVX_RES(FT_MESSAGE)) +{ + maMessageControl.setPosSizePixel(5,5, 250,15); + maMessageControl.SetStyle(WB_WORDBREAK);// | WB_NOMNEMONICS); + //maMessageControl.GetStyle() + // & ~(WB_NOMULTILINE | WB_PATHELLIPSIS) + // | WB_WORDBREAK | WB_NOMNEMONICS); + FreeResource(); + + SetBackground(Wallpaper()); + + maMessageControl.Show(); + Show(); +} + + + + +EmptyPanel::~EmptyPanel (void) +{ +} + + + + +void EmptyPanel::Resize (void) +{ + const Size aSize (GetSizePixel()); + maMessageControl.SetSizePixel(aSize); +} + + +} } // end of namespace ::svx::sidebar diff --git a/svx/source/sidebar/EmptyPanel.hrc b/svx/source/sidebar/EmptyPanel.hrc new file mode 100644 index 000000000000..26f5defff662 --- /dev/null +++ b/svx/source/sidebar/EmptyPanel.hrc @@ -0,0 +1,25 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include <svx/dialogs.hrc> + +// For RID_SIDEBAR_EMPTY_PANEL + +#define FT_MESSAGE 1 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/sidebar/EmptyPanel.hxx b/svx/source/sidebar/EmptyPanel.hxx new file mode 100644 index 000000000000..96a674bdd994 --- /dev/null +++ b/svx/source/sidebar/EmptyPanel.hxx @@ -0,0 +1,50 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SVX_SIDEBAR_DEBUG_EMPTY_PANEL_HXX +#define SVX_SIDEBAR_DEBUG_EMPTY_PANEL_HXX + +#include <vcl/window.hxx> +#include <vcl/ctrl.hxx> +#include <vcl/fixed.hxx> + + +namespace svx { namespace sidebar { + + +/** Display a panel that tells the user that the current deck is + intentionally empty. +*/ +class EmptyPanel + : public Control +{ +public: + EmptyPanel (::Window* pParent); + virtual ~EmptyPanel (void); + + virtual void Resize (void); + +private: + FixedText maMessageControl; +}; + +} } // end of namespace ::svx::sidebar + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/sidebar/EmptyPanel.src b/svx/source/sidebar/EmptyPanel.src new file mode 100644 index 000000000000..77e375b7cb91 --- /dev/null +++ b/svx/source/sidebar/EmptyPanel.src @@ -0,0 +1,29 @@ +/* + * 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 "EmptyPanel.hrc" +#include <svx/dialogs.hrc> + +Control RID_SIDEBAR_EMPTY_PANEL +{ + FixedText FT_MESSAGE + { + Pos = MAP_APPFONT(2,2); + Size = MAP_APPFONT(100,24); + Text [en-US] = "Properties for the task that you are performing are not available in the sidebar at this time."; + }; +}; diff --git a/svx/source/sidebar/PanelFactory.cxx b/svx/source/sidebar/PanelFactory.cxx new file mode 100644 index 000000000000..60738503ee8a --- /dev/null +++ b/svx/source/sidebar/PanelFactory.cxx @@ -0,0 +1,205 @@ +/* + * 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 "sidebar/PanelFactory.hxx" + +#include "text/TextPropertyPanel.hxx" +#include "paragraph/ParaPropertyPanel.hxx" +#include "area/AreaPropertyPanel.hxx" +#include "graphic/GraphicPropertyPanel.hxx" +#include "line/LinePropertyPanel.hxx" +#include "possize/PosSizePropertyPanel.hxx" +#include "GalleryControl.hxx" +#include "debug/ColorPanel.hxx" +#include "debug/ContextPanel.hxx" +#include "debug/NotYetImplementedPanel.hxx" +#include "EmptyPanel.hxx" +#include <sfx2/sidebar/SidebarPanelBase.hxx> +#include <sfx2/sfxbasecontroller.hxx> +#include <sfx2/templdlg.hxx> +#include <toolkit/helper/vclunohelper.hxx> +#include <vcl/window.hxx> +#include <rtl/ref.hxx> +#include <comphelper/namedvaluecollection.hxx> +#include <com/sun/star/ui/XSidebar.hpp> + +#include <boost/bind.hpp> + + +using namespace css; +using namespace cssu; +using ::rtl::OUString; + + +namespace svx { namespace sidebar { + +#define A2S(s) ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)) +#define IMPLEMENTATION_NAME "org.apache.openoffice.comp.svx.sidebar.PanelFactory" +#define SERVICE_NAME "com.sun.star.ui.UIElementFactory" + + +::rtl::OUString SAL_CALL PanelFactory::getImplementationName (void) +{ + return A2S(IMPLEMENTATION_NAME); +} + + + + +cssu::Reference<cssu::XInterface> SAL_CALL PanelFactory::createInstance ( + const uno::Reference<lang::XMultiServiceFactory>& rxFactory) +{ + (void)rxFactory; + + ::rtl::Reference<PanelFactory> pPanelFactory (new PanelFactory()); + cssu::Reference<cssu::XInterface> xService (static_cast<XWeak*>(pPanelFactory.get()), cssu::UNO_QUERY); + return xService; +} + + + + +cssu::Sequence<OUString> SAL_CALL PanelFactory::getSupportedServiceNames (void) +{ + cssu::Sequence<OUString> aServiceNames (1); + aServiceNames[0] = A2S(SERVICE_NAME); + return aServiceNames; + +} + + + + +PanelFactory::PanelFactory (void) + : PanelFactoryInterfaceBase(m_aMutex) +{ +} + + + + +PanelFactory::~PanelFactory (void) +{ +} + + + + +Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement ( + const ::rtl::OUString& rsResourceURL, + const ::cssu::Sequence<css::beans::PropertyValue>& rArguments) + throw( + container::NoSuchElementException, + lang::IllegalArgumentException, + RuntimeException) +{ + 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>())); + Reference<ui::XSidebar> xSidebar (aArguments.getOrDefault("Sidebar", Reference<ui::XSidebar>())); + 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); + + Window* pControl = NULL; + ui::LayoutSize aLayoutSize (-1,-1,-1); + +#define DoesResourceEndWith(s) rsResourceURL.endsWithAsciiL(s,strlen(s)) + if (DoesResourceEndWith("/TextPropertyPanel")) + { + pControl = TextPropertyPanel::Create(pParentWindow, xFrame, pBindings, xSidebar); + } + else if (DoesResourceEndWith("/ParaPropertyPanel")) + { + pControl = ParaPropertyPanel::Create(pParentWindow, xFrame, pBindings, xSidebar); + } + else if (DoesResourceEndWith("/AreaPropertyPanel")) + { + pControl = AreaPropertyPanel::Create(pParentWindow, xFrame, pBindings); + } + else if (DoesResourceEndWith("/GraphicPropertyPanel")) + { + pControl = GraphicPropertyPanel::Create(pParentWindow, xFrame, pBindings); + } + else if (DoesResourceEndWith("/LinePropertyPanel")) + { + pControl = LinePropertyPanel::Create(pParentWindow, xFrame, pBindings); + } + else if (DoesResourceEndWith("/PosSizePropertyPanel")) + { + pControl = PosSizePropertyPanel::Create(pParentWindow, xFrame, pBindings, xSidebar); + } + else if (DoesResourceEndWith("/GalleryPanel")) + { + pControl = new GalleryControl(pBindings, pParentWindow); + aLayoutSize = ui::LayoutSize(300,-1,400); + } + else if (DoesResourceEndWith("/StyleListPanel")) + { + pControl = new SfxTemplatePanelControl(pBindings, pParentWindow); + aLayoutSize = ui::LayoutSize(0,-1,-1); + } + else if (DoesResourceEndWith("/Debug_ColorPanel")) + { + pControl = new ColorPanel(pParentWindow); + aLayoutSize = ui::LayoutSize(300,-1,400); + } + else if (DoesResourceEndWith("/Debug_ContextPanel")) + { + pControl = new ContextPanel(pParentWindow); + aLayoutSize = ui::LayoutSize(45,45,45); + } + else if (DoesResourceEndWith("/Debug_NotYetImplementedPanel")) + { + pControl = new NotYetImplementedPanel(pParentWindow); + aLayoutSize = ui::LayoutSize(20,25,25); + } + else if (DoesResourceEndWith("/EmptyPanel")) + { + pControl = new EmptyPanel(pParentWindow); + aLayoutSize = ui::LayoutSize(20,-1, 50); + } +#undef DoesResourceEndWith + + if (pControl != NULL) + { + return sfx2::sidebar::SidebarPanelBase::Create( + rsResourceURL, + xFrame, + pControl, + aLayoutSize); + } + else + return Reference<ui::XUIElement>(); +} + +} } // end of namespace svx::sidebar + +// eof diff --git a/svx/source/sidebar/SelectionAnalyzer.cxx b/svx/source/sidebar/SelectionAnalyzer.cxx new file mode 100644 index 000000000000..2f201e98125c --- /dev/null +++ b/svx/source/sidebar/SelectionAnalyzer.cxx @@ -0,0 +1,456 @@ +/* + * 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 "svx/sidebar/SelectionAnalyzer.hxx" +#include "svx/svdmrkv.hxx" +#include "svx/svdobj.hxx" +#include "svx/svdpage.hxx" +#include "svx/fmglob.hxx" +#include "svx/globl3d.hxx" + +using sfx2::sidebar::EnumContext; + + +namespace svx { namespace sidebar { + +EnumContext::Context SelectionAnalyzer::GetContextForSelection_SC (const SdrMarkList& rMarkList) +{ + EnumContext::Context eContext = EnumContext::Context_Unknown; + + switch (rMarkList.GetMarkCount()) + { + case 0: + // Empty selection. Return Context_Unknown to let the caller + // substitute it with the default context. + break; + + case 1: + { + SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); + const sal_uInt32 nInv = pObj->GetObjInventor(); + const sal_uInt16 nObjId = pObj->GetObjIdentifier(); + if (nInv == SdrInventor) + eContext = GetContextForObjectId_SC(nObjId); + else if (nInv == FmFormInventor) + eContext = EnumContext::Context_Form; + break; + } + + default: + { + // Multi selection. + switch (GetInventorTypeFromMark(rMarkList)) + { + case SdrInventor: + { + const sal_uInt16 nObjId (GetObjectTypeFromMark(rMarkList)); + if (nObjId == 0) + eContext = EnumContext::Context_MultiObject; + else + eContext = GetContextForObjectId_SC(nObjId); + break; + } + + case FmFormInventor: + eContext = EnumContext::Context_Form; + break; + + case 0: + eContext = EnumContext::Context_MultiObject; + break; + } + } + } + + return eContext; +} + + + + +EnumContext::Context SelectionAnalyzer::GetContextForSelection_SD ( + const SdrMarkList& rMarkList, + const bool bIsMasterPage, + const bool bIsHandoutPage, + const bool bIsNotesPage) +{ + EnumContext::Context eContext = EnumContext::Context_Unknown; + + // Note that some cases are handled by the caller. They rely on + // sd specific data. + switch (rMarkList.GetMarkCount()) + { + case 0: + if (bIsHandoutPage) + eContext = EnumContext::Context_HandoutPage; + else if (bIsNotesPage) + eContext = EnumContext::Context_NotesPage; + else if (bIsMasterPage) + eContext = EnumContext::Context_MasterPage; + else + eContext = EnumContext::Context_DrawPage; + break; + + case 1: + { + SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); + const sal_uInt32 nInv = pObj->GetObjInventor(); + sal_uInt16 nObjId = pObj->GetObjIdentifier(); + if (nInv == SdrInventor) + { + if (nObjId == OBJ_GRUP) + { + nObjId = GetObjectTypeFromGroup(pObj); + if (nObjId == 0) + nObjId = OBJ_GRUP; + } + eContext = GetContextForObjectId_SD(nObjId, bIsHandoutPage, bIsNotesPage); + } + else if (nInv == E3dInventor) + { + eContext = EnumContext::Context_3DObject; + } + else if (nInv == FmFormInventor) + { + eContext = EnumContext::Context_Form; + } + break; + } + + default: + { + switch (GetInventorTypeFromMark(rMarkList)) + { + case SdrInventor: + { + const sal_uInt16 nObjId = GetObjectTypeFromMark(rMarkList); + if (nObjId == 0) + eContext = EnumContext::Context_MultiObject; + else + eContext = GetContextForObjectId_SD(nObjId, bIsHandoutPage, bIsNotesPage); + break; + } + + case E3dInventor: + eContext = EnumContext::Context_3DObject; + break; + + case FmFormInventor: + eContext = EnumContext::Context_Form; + break; + + case 0: + eContext = EnumContext::Context_MultiObject; + break; + } + break; + } + } + + return eContext; +} + + + + +EnumContext::Context SelectionAnalyzer::GetContextForObjectId_SC (const sal_uInt16 nObjectId) +{ + switch (nObjectId) + { + case OBJ_CAPTION: + case OBJ_TITLETEXT: + case OBJ_OUTLINETEXT: + case OBJ_TEXT: + case OBJ_TEXTEXT: + case OBJ_PATHLINE: + case OBJ_PLIN: + case OBJ_FREELINE: + case OBJ_EDGE: + case OBJ_LINE: + case OBJ_MEASURE: + case OBJ_RECT: + case OBJ_CIRC: + case OBJ_FREEFILL: + case OBJ_PATHFILL: + case OBJ_POLY: + case OBJ_SECT: + case OBJ_CARC: + case OBJ_CCUT: + case OBJ_CUSTOMSHAPE: + case OBJ_GRUP: + return EnumContext::Context_Draw; + + case OBJ_GRAF: + return EnumContext::Context_Graphic; + + case OBJ_OLE2: + return EnumContext::Context_OLE; + + case OBJ_MEDIA: + return EnumContext::Context_Media; + break; + + default: + return EnumContext::Context_Unknown; + } +} + + + + +EnumContext::Context SelectionAnalyzer::GetContextForObjectId_SD ( + const sal_uInt16 nObjectId, + const bool bIsHandoutPage, + const bool bIsNotesPage) +{ + switch (nObjectId) + { + case OBJ_CAPTION: + case OBJ_PATHLINE: + case OBJ_PLIN: + case OBJ_FREELINE: + case OBJ_EDGE: + case OBJ_LINE: + case OBJ_MEASURE: + case OBJ_RECT: + case OBJ_CIRC: + case OBJ_FREEFILL: + case OBJ_PATHFILL: + case OBJ_POLY: + case OBJ_SECT: + case OBJ_CARC: + case OBJ_CCUT: + case OBJ_CUSTOMSHAPE: + case OBJ_GRUP: + return EnumContext::Context_Draw; + + case OBJ_TITLETEXT: + case OBJ_OUTLINETEXT: + case OBJ_TEXT: + case OBJ_TEXTEXT: + return EnumContext::Context_TextObject; + + case OBJ_GRAF: + return EnumContext::Context_Graphic; + + case OBJ_OLE2: + return EnumContext::Context_OLE; + + case OBJ_MEDIA: + return EnumContext::Context_Media; + + case OBJ_TABLE: + return EnumContext::Context_Table; + + case OBJ_PAGE: + if (bIsHandoutPage) + return EnumContext::Context_HandoutPage; + else if (bIsNotesPage) + return EnumContext::Context_NotesPage; + else + return EnumContext::Context_Unknown; + + default: + return EnumContext::Context_Unknown; + } +} + + + + +sal_uInt32 SelectionAnalyzer::GetInventorTypeFromMark (const SdrMarkList& rMarkList) +{ + const sal_uLong nMarkCount (rMarkList.GetMarkCount()); + + if (nMarkCount < 1) + return 0; + + SdrMark* pMark = rMarkList.GetMark(0); + SdrObject* pObj = pMark->GetMarkedSdrObj(); + const sal_uInt32 nFirstInv = pObj->GetObjInventor(); + + for (sal_uLong nIndex=1; nIndex<nMarkCount; ++nIndex) + { + pMark = rMarkList.GetMark(nIndex); + pObj = pMark->GetMarkedSdrObj(); + const sal_uInt32 nInv (pObj->GetObjInventor()); + + if (nInv != nFirstInv) + return 0; + } + + return nFirstInv; +} + + + + +sal_uInt16 SelectionAnalyzer::GetObjectTypeFromGroup (const SdrObject* pObj) +{ + SdrObjList* pObjList = pObj->GetSubList(); + if (pObjList) + { + const sal_uLong nSubObjCount (pObjList->GetObjCount()); + + if (nSubObjCount>0) + { + SdrObject* pSubObj = pObjList->GetObj(0); + sal_uInt16 nResultType = pSubObj->GetObjIdentifier(); + + if (nResultType == OBJ_GRUP) + nResultType = GetObjectTypeFromGroup(pSubObj); + + if (IsShapeType(nResultType)) + nResultType = OBJ_CUSTOMSHAPE; + + if (IsTextObjType(nResultType)) + nResultType = OBJ_TEXT; + + for (sal_uInt16 nIndex=1; nIndex<nSubObjCount; ++nIndex) + { + pSubObj = pObjList->GetObj(nIndex); + sal_uInt16 nType (pSubObj->GetObjIdentifier()); + + if(nType == OBJ_GRUP) + nType = GetObjectTypeFromGroup(pSubObj); + + if (IsShapeType(nType)) + nType = OBJ_CUSTOMSHAPE; + + if ((nType == OBJ_CUSTOMSHAPE) && (nResultType == OBJ_TEXT)) + nType = OBJ_TEXT; + + if (IsTextObjType(nType)) + nType = OBJ_TEXT; + + if ((nType == OBJ_TEXT) && (nResultType == OBJ_CUSTOMSHAPE)) + nResultType = OBJ_TEXT; + + if (nType != nResultType) + return 0; + } + + return nResultType; + } + } + + return 0; +} + + + + +sal_uInt16 SelectionAnalyzer::GetObjectTypeFromMark (const SdrMarkList& rMarkList) +{ + const sal_uLong nMarkCount (rMarkList.GetMarkCount()); + + if (nMarkCount < 1) + return 0; + + SdrMark* pMark = rMarkList.GetMark(0); + SdrObject* pObj = pMark->GetMarkedSdrObj(); + sal_uInt16 nResultType = pObj->GetObjIdentifier(); + + if(nResultType == OBJ_GRUP) + nResultType = GetObjectTypeFromGroup(pObj); + + if (IsShapeType(nResultType)) + nResultType = OBJ_CUSTOMSHAPE; + + if (IsTextObjType(nResultType)) + nResultType = OBJ_TEXT; + + for (sal_uLong nIndex=1; nIndex<nMarkCount; ++nIndex) + { + pMark = rMarkList.GetMark(nIndex); + pObj = pMark->GetMarkedSdrObj(); + sal_uInt16 nType = pObj->GetObjIdentifier(); + + if(nType == OBJ_GRUP) + nType = GetObjectTypeFromGroup(pObj); + + if (IsShapeType(nType)) + nType = OBJ_CUSTOMSHAPE; + + if ((nType == OBJ_CUSTOMSHAPE) && (nResultType == OBJ_TEXT)) + nType = OBJ_TEXT; + + if (IsTextObjType(nType)) + nType = OBJ_TEXT; + + if ((nType == OBJ_TEXT) && (nResultType == OBJ_CUSTOMSHAPE)) + nResultType = OBJ_TEXT; + + if (nType != nResultType) + return 0; + } + + return nResultType; +} + + + + +bool SelectionAnalyzer::IsShapeType (const sal_uInt16 nType) +{ + switch (nType) + { + case OBJ_LINE: + case OBJ_CARC: + case OBJ_PLIN: + case OBJ_PATHLINE: + case OBJ_RECT: + case OBJ_CIRC: + case OBJ_SECT: + case OBJ_CCUT: + case OBJ_PATHFILL: + case OBJ_CUSTOMSHAPE: + case OBJ_CAPTION: + case OBJ_MEASURE: + case OBJ_EDGE: + case OBJ_POLY: + case OBJ_FREELINE: + case OBJ_FREEFILL: + return true; + + default: + return false; + } +} + + + + +bool SelectionAnalyzer::IsTextObjType (const sal_uInt16 nType) +{ + switch(nType) + { + case OBJ_TEXT: + case OBJ_TEXTEXT: + case OBJ_TITLETEXT: + case OBJ_OUTLINETEXT: + return true; + + default: + return false; + } +} + + + +} } // end of namespace ::svx::sidebar diff --git a/svx/source/sidebar/SelectionChangeHandler.cxx b/svx/source/sidebar/SelectionChangeHandler.cxx new file mode 100644 index 000000000000..275812fc35e5 --- /dev/null +++ b/svx/source/sidebar/SelectionChangeHandler.cxx @@ -0,0 +1,115 @@ +/* + * 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 "svx/sidebar/SelectionChangeHandler.hxx" +#include "svx/sidebar/SelectionAnalyzer.hxx" +#include "svx/sidebar/ContextChangeEventMultiplexer.hxx" +#include "svx/svdmrkv.hxx" + +#include <sfx2/sidebar/EnumContext.hxx> +#include <sfx2/shell.hxx> + + +using namespace css; +using namespace cssu; + +using namespace sfx2::sidebar; + +namespace svx { namespace sidebar { + +SelectionChangeHandler::SelectionChangeHandler ( + const boost::function<sfx2::sidebar::EnumContext::Context(void)>& rSelectionChangeCallback, + const Reference<frame::XController>& rxController, + const EnumContext::Context eDefaultContext) + : SelectionChangeHandlerInterfaceBase(m_aMutex), + maSelectionChangeCallback(rSelectionChangeCallback), + mxController(rxController), + meDefaultContext(eDefaultContext), + mbIsConnected(false) +{ +} + + + + +SelectionChangeHandler::~SelectionChangeHandler (void) +{ +} + + + + +void SAL_CALL SelectionChangeHandler::selectionChanged (const lang::EventObject&) + throw (uno::RuntimeException) +{ + if (maSelectionChangeCallback) + { + const EnumContext::Context eContext (maSelectionChangeCallback()); + ContextChangeEventMultiplexer::NotifyContextChange( + mxController, + eContext==EnumContext::Context_Unknown + ? meDefaultContext + : eContext); + } +} + + + + +void SAL_CALL SelectionChangeHandler::disposing (const lang::EventObject&) + throw (uno::RuntimeException) +{ +} + + + + +void SAL_CALL SelectionChangeHandler::disposing (void) + throw (uno::RuntimeException) +{ + if (mbIsConnected) + Disconnect(); +} + + + + +void SelectionChangeHandler::Connect (void) +{ + uno::Reference<view::XSelectionSupplier> xSupplier (mxController, uno::UNO_QUERY); + if (xSupplier.is()) + { + mbIsConnected = true; + xSupplier->addSelectionChangeListener(this); + } +} + + + + +void SelectionChangeHandler::Disconnect (void) +{ + uno::Reference<view::XSelectionSupplier> xSupplier (mxController, uno::UNO_QUERY); + if (xSupplier.is()) + { + mbIsConnected = false; + xSupplier->removeSelectionChangeListener(this); + } +} + + +} } // end of namespace svx::sidebar diff --git a/svx/source/sidebar/area/AreaPropertyPanel.cxx b/svx/source/sidebar/area/AreaPropertyPanel.cxx new file mode 100644 index 000000000000..0e746aa44d63 --- /dev/null +++ b/svx/source/sidebar/area/AreaPropertyPanel.cxx @@ -0,0 +1,1361 @@ +/* + * 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 "svx/sidebar/PopupContainer.hxx" +#include "AreaTransparencyGradientControl.hxx" + +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include <sfx2/sidebar/Theme.hxx> +#include <sfx2/sidebar/ControlFactory.hxx> +#include <AreaPropertyPanel.hxx> +#include <AreaPropertyPanel.hrc> +#include <svx/dialogs.hrc> +#include <svx/dialmgr.hxx> +#include <sfx2/objsh.hxx> +#include <svx/xfltrit.hxx> +#include <svx/xflftrit.hxx> +#include <svx/xtable.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/bindings.hxx> +#include <helpid.hrc> +#include <svtools/valueset.hxx> +#include <unotools/pathoptions.hxx> +#include <svx/svxitems.hrc> +#include <vcl/toolbox.hxx> +#include <svtools/toolbarmenu.hxx> +#include <svx/sidebar/ColorControl.hxx> + +#include <boost/bind.hpp> + +using namespace css; +using namespace cssu; +using ::sfx2::sidebar::Theme; + +#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) + + + + +namespace svx { namespace sidebar { + +const sal_Int32 AreaPropertyPanel::DEFAULT_CENTERX = 50; +const sal_Int32 AreaPropertyPanel::DEFAULT_CENTERY = 50; +const sal_Int32 AreaPropertyPanel::DEFAULT_ANGLE = 0; +const sal_Int32 AreaPropertyPanel::DEFAULT_STARTVALUE = 0; +const sal_Int32 AreaPropertyPanel::DEFAULT_ENDVALUE = 16777215; +const sal_Int32 AreaPropertyPanel::DEFAULT_BORDER = 0; + + +AreaPropertyPanel::AreaPropertyPanel( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings) + : Control(pParent, SVX_RES(RID_SIDEBAR_AREA_PANEL)), + meLastXFS(-1), + maLastColor(Color(COL_DEFAULT_SHAPE_FILLING)), + mnLastPosGradient(0), + mnLastPosHatch(0), + mnLastPosBitmap(0), + mnLastTransSolid(50), + maGradientLinear(), + maGradientAxial(), + maGradientRadial(), + maGradientElliptical(), + maGradientSquare(), + maGradientRect(), + mpColorTextFT(new FixedText(this, SVX_RES(FT_COLOR_LIST))), + mpLbFillType(new SvxFillTypeBox(this)), + mpLbFillAttr(new SvxFillAttrBox(this)), + mpToolBoxColorBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), + mpToolBoxColor(sfx2::sidebar::ControlFactory::CreateToolBox(mpToolBoxColorBackground.get(), SVX_RES(TB_COLOR))), + mpTrspTextFT(new FixedText(this, SVX_RES(FL_TRSP_TEXT))), + mpLBTransType(new ListBox(this, SVX_RES(LB_TRGR_TYPES))), + mpMTRTransparent(new MetricField(this, SVX_RES(MTR_TRANSPARENT))), + mpBTNGradientBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), + mpBTNGradient(sfx2::sidebar::ControlFactory::CreateToolBox(mpBTNGradientBackground.get(), SVX_RES(BTN_GRADIENT))), + mpColorUpdater(new ::svx::ToolboxButtonColorUpdater(SID_ATTR_FILL_COLOR, TBI_COLOR, mpToolBoxColor.get(), TBX_UPDATER_MODE_CHAR_COLOR_NEW)), + mpStyleItem(), + mpColorItem(), + mpFillGradientItem(), + mpHatchItem(), + mpBitmapItem(), + mpColorListItem(), + mpGradientListItem(), + mpHatchListItem(), + mpBitmapListItem(), + maStyleControl(SID_ATTR_FILL_STYLE, *pBindings, *this), + maColorControl(SID_ATTR_FILL_COLOR, *pBindings, *this), + maGradientControl(SID_ATTR_FILL_GRADIENT, *pBindings, *this), + maHatchControl(SID_ATTR_FILL_HATCH, *pBindings, *this), + maBitmapControl(SID_ATTR_FILL_BITMAP, *pBindings, *this), + maColorTableControl(SID_COLOR_TABLE, *pBindings, *this), + maGradientListControl(SID_GRADIENT_LIST, *pBindings, *this), + maHatchListControl(SID_HATCH_LIST, *pBindings, *this), + maBitmapListControl(SID_BITMAP_LIST, *pBindings, *this), + maFillTransparenceController(SID_ATTR_FILL_TRANSPARENCE, *pBindings, *this), + maFillFloatTransparenceController(SID_ATTR_FILL_FLOATTRANSPARENCE, *pBindings, *this), + maImgAxial(SVX_RES(IMG_AXIAL)), + maImgElli(SVX_RES(IMG_ELLI)), + maImgQuad(SVX_RES(IMG_QUAD)), + maImgRadial(SVX_RES(IMG_RADIAL)), + maImgSquare(SVX_RES(IMG_SQUARE)), + maImgLinear(SVX_RES(IMG_LINEAR)), + maImgColor(SVX_RES(IMG_COLOR)), + msHelpFillType(SVX_RES(STR_HELP_TYPE)), + msHelpFillAttr(SVX_RES(STR_HELP_ATTR)), + maTrGrPopup(this, ::boost::bind(&AreaPropertyPanel::CreateTransparencyGradientControl, this, _1)), + maColorPopup(this, ::boost::bind(&AreaPropertyPanel::CreateColorPopupControl, this, _1)), + mpFloatTransparenceItem(), + mpTransparanceItem(), + mxFrame(rxFrame), + mpBindings(pBindings), + mbTBShow(true), + mbColorAvail(true) +{ + Initialize(); + FreeResource(); +} + + + +AreaPropertyPanel::~AreaPropertyPanel() +{ + // Destroy the toolboxes, then their background windows. + mpToolBoxColor.reset(); + mpBTNGradient.reset(); + mpToolBoxColorBackground.reset(); + mpBTNGradientBackground.reset(); +} + + + +void AreaPropertyPanel::Initialize() +{ + mpColorTextFT->SetBackground(Wallpaper()); + mpTrspTextFT->SetBackground(Wallpaper()); + + maGradientLinear.SetXOffset(DEFAULT_CENTERX); + maGradientLinear.SetYOffset(DEFAULT_CENTERY); + maGradientLinear.SetAngle(DEFAULT_ANGLE); + maGradientLinear.SetStartColor(Color(DEFAULT_STARTVALUE)); + maGradientLinear.SetEndColor(Color(DEFAULT_ENDVALUE)); + maGradientLinear.SetBorder(DEFAULT_BORDER); + maGradientLinear.SetGradientStyle(XGRAD_LINEAR); + + maGradientAxial = maGradientLinear; + maGradientAxial.SetGradientStyle(XGRAD_AXIAL); + + maGradientRadial = maGradientLinear; + maGradientRadial.SetGradientStyle(XGRAD_RADIAL); + + maGradientElliptical = maGradientLinear; + maGradientElliptical.SetGradientStyle(XGRAD_ELLIPTICAL); + + maGradientSquare = maGradientLinear; + maGradientSquare.SetGradientStyle(XGRAD_SQUARE); + + maGradientRect = maGradientLinear; + maGradientRect.SetGradientStyle(XGRAD_RECT); + + Size aLogicalFillSize(MBOX_WIDTH,LISTBOX_HEIGHT); + Size aLogicalAttrSize(MBOX_WIDTH + 1,LISTBOX_HEIGHT); + + Point aPoint(SECTIONPAGE_MARGIN_HORIZONTAL,SECTIONPAGE_MARGIN_VERTICAL_TOP + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL); + Point aPoint_Picker(SECTIONPAGE_MARGIN_HORIZONTAL + MBOX_WIDTH + CONTROL_SPACING_HORIZONTAL,SECTIONPAGE_MARGIN_VERTICAL_TOP + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL); + + Size aTypeSize(LogicToPixel(aLogicalFillSize, MAP_APPFONT)); + Size aAttrSize(LogicToPixel(aLogicalAttrSize, MAP_APPFONT)); + + Point aTypePoint(LogicToPixel(aPoint, MAP_APPFONT)); + Point aAttrPoint(LogicToPixel(aPoint_Picker, MAP_APPFONT)); + + mpLbFillType->SetPosSizePixel(aTypePoint,aTypeSize); + mpLbFillAttr->SetPosSizePixel(aAttrPoint,aAttrSize); + + mpLbFillType->SetHelpId(HID_PPROPERTYPANEL_AREA_LB_FILL_TYPES); + mpLbFillAttr->SetHelpId(HID_PPROPERTYPANEL_AREA_LB_FILL_ATTR); + + mpLbFillType->SetQuickHelpText(msHelpFillType); + mpLbFillAttr->SetQuickHelpText(msHelpFillAttr); + + mpLbFillType->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Fill"))); //wj acc + mpLbFillAttr->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Fill"))); //wj acc + + Link aLink = LINK( this, AreaPropertyPanel, SelectFillTypeHdl ); + mpLbFillType->SetSelectHdl( aLink ); + + aLink = LINK( this, AreaPropertyPanel, SelectFillAttrHdl ); + mpLbFillAttr->SetSelectHdl( aLink ); + + //add for new color picker + mpLbFillAttr->Hide(); + mpToolBoxColor->SetItemImage(TBI_COLOR, maImgColor); + Size aTbxSize( mpToolBoxColor->CalcWindowSizePixel() ); + mpToolBoxColor->SetOutputSizePixel( aTbxSize ); + mpToolBoxColor->SetItemBits( TBI_COLOR, mpToolBoxColor->GetItemBits( TBI_COLOR ) | TIB_DROPDOWNONLY ); + mpToolBoxColor->SetBackground(Wallpaper()); + mpToolBoxColor->SetPaintTransparent(true); + mpToolBoxColor->SetQuickHelpText(TBI_COLOR, String(SVX_RES(STR_HELP_COLOR))); //wj acc + //mpToolBoxColor->SetItemText(TBI_COLOR, msHelpFillAttr); + + long aHeightLBStyle = mpLbFillType->GetSizePixel().getHeight(); + long aLBPosY = mpLbFillType->GetPosPixel().getY(); + long aHeightTBAttr = mpToolBoxColor->GetSizePixel().getHeight(); + Point aPointTBAttr = mpToolBoxColor->GetPosPixel(); + aPointTBAttr.setY( aLBPosY + aHeightLBStyle / 2 - aHeightTBAttr / 2); + mpToolBoxColor->SetPosPixel(aPointTBAttr); + + aLink = LINK(this, AreaPropertyPanel, ToolBoxColorDropHdl); + mpToolBoxColor->SetDropdownClickHdl ( aLink ); + mpToolBoxColor->SetSelectHdl ( aLink ); + + //add end + mpLBTransType->SetSelectHdl(LINK(this, AreaPropertyPanel, ChangeTrgrTypeHdl_Impl)); + mpLBTransType->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Transparency"))); //wj acc + + mpMTRTransparent->SetValue( 50 ); + mpMTRTransparent->SetModifyHdl(LINK(this, AreaPropertyPanel, ModifyTransparentHdl_Impl)); + mpMTRTransparent->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Transparency"))); //wj acc + + mpBTNGradient->SetItemBits( TBI_BTX_GRADIENT, mpBTNGradient->GetItemBits( TBI_BTX_GRADIENT ) | TIB_DROPDOWNONLY ); + aLink = LINK( this, AreaPropertyPanel, ClickTrGrHdl_Impl ); + mpBTNGradient->SetDropdownClickHdl( aLink ); + mpBTNGradient->SetSelectHdl( aLink ); + aTbxSize = mpBTNGradient->CalcWindowSizePixel(); + mpBTNGradient->SetOutputSizePixel( aTbxSize ); + mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT,maImgLinear); + mpBTNGradient->SetQuickHelpText(TBI_BTX_GRADIENT, String(SVX_RES(STR_HELP_GRADIENT))); //wj acc + mpBTNGradient->Hide(); + + long aHeightLBTrans = mpLBTransType->GetSizePixel().getHeight(); + Point aPointLB = mpLBTransType->GetPosPixel(); + long aPosY = aPointLB.getY(); + + Point aPointMetric = mpMTRTransparent->GetPosPixel(); + Point aPointTB = mpMTRTransparent->GetPosPixel(); + long aHeightMetric = mpMTRTransparent->GetSizePixel().getHeight(); + long aHeightTool = mpBTNGradient->GetSizePixel().getHeight(); + aPointMetric.setY(aPosY+aHeightLBTrans/2-aHeightMetric/2); + aPointTB.setY(aPosY+aHeightLBTrans/2-aHeightTool/2); + aPointTB.setX(aPointTB.getX()+3); + mpMTRTransparent->SetPosPixel(aPointMetric); + mpBTNGradient->SetPosPixel(aPointTB); + + mpLbFillType->SetAccessibleRelationLabeledBy(mpColorTextFT.get()); + mpLbFillAttr->SetAccessibleRelationLabeledBy(mpLbFillAttr.get()); + mpToolBoxColor->SetAccessibleRelationLabeledBy(mpToolBoxColor.get()); + mpLBTransType->SetAccessibleRelationLabeledBy(mpTrspTextFT.get()); + mpMTRTransparent->SetAccessibleRelationLabeledBy(mpMTRTransparent.get()); + mpBTNGradient->SetAccessibleRelationLabeledBy(mpBTNGradient.get()); + + SetupIcons(); +} + + + +IMPL_LINK( AreaPropertyPanel, SelectFillTypeHdl, ListBox *, pToolBox ) +{ + XFillStyle eXFS = (XFillStyle)mpLbFillType->GetSelectEntryPos(); + + if( (XFillStyle) meLastXFS != eXFS ) + { + mpLbFillAttr->Clear(); + SfxObjectShell* pSh = SfxObjectShell::Current(); + XFillStyleItem aXFillStyleItem( eXFS ); + GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_STYLE, SFX_CALLMODE_RECORD, &aXFillStyleItem, 0L); + + switch( eXFS ) + { + case XFILL_NONE: + { + mpLbFillAttr->Show(); + mpToolBoxColor->Hide(); + mbTBShow = false; + mpLbFillType->Selected(); + mpLbFillAttr->Disable(); + } + break; + + case XFILL_SOLID: + { + mpLbFillAttr->Hide(); + mpToolBoxColor->Show(); + mbTBShow = true; + String aTmpStr; + Color aColor = maLastColor; + XFillColorItem aXFillColorItem( aTmpStr, aColor ); + GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_COLOR, SFX_CALLMODE_RECORD, &aXFillColorItem, 0L); + } + break; + + case XFILL_GRADIENT: + { + mpLbFillAttr->Show(); + mpToolBoxColor->Hide(); + mbTBShow = false; + if ( pSh && pSh->GetItem( SID_GRADIENT_LIST ) ) + { + if(mpLbFillAttr->GetEntryCount() == 0) + { + SvxGradientListItem aItem( *(const SvxGradientListItem*)( + pSh->GetItem( SID_GRADIENT_LIST ) ) ); + mpLbFillAttr->Enable(); + mpLbFillAttr->Clear(); + mpLbFillAttr->Fill( aItem.GetGradientList() ); + } + + mpLbFillAttr->SetDropDownLineCount(std::min(sal_uInt16(20), mpLbFillAttr->GetEntryCount())); + + if ( mnLastPosGradient != LISTBOX_ENTRY_NOTFOUND) + { + SvxGradientListItem aItem( *(const SvxGradientListItem*)( pSh->GetItem( SID_GRADIENT_LIST ) ) ); + if ( mnLastPosGradient < aItem.GetGradientList()->Count() ) + { + XGradient aGradient = aItem.GetGradientList()->GetGradient( mnLastPosGradient )->GetGradient(); + XFillGradientItem aXFillGradientItem( mpLbFillAttr->GetEntry(mnLastPosGradient), aGradient ); + GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_GRADIENT, SFX_CALLMODE_RECORD, &aXFillGradientItem, 0L); + mpLbFillAttr->SelectEntryPos(mnLastPosGradient); //add + } + } + } + else + mpLbFillAttr->Disable(); + } + break; + + case XFILL_HATCH: + { + mpLbFillAttr->Show(); + mpToolBoxColor->Hide(); + mbTBShow = false; + if ( pSh && pSh->GetItem( SID_HATCH_LIST ) ) + { + if(mpLbFillAttr->GetEntryCount() == 0) + { + SvxHatchListItem aItem( *(const SvxHatchListItem*)( + pSh->GetItem( SID_HATCH_LIST ) ) ); + mpLbFillAttr->Enable(); + mpLbFillAttr->Clear(); + mpLbFillAttr->Fill( aItem.GetHatchList() ); + } + + mpLbFillAttr->SetDropDownLineCount(std::min(sal_uInt16(20), mpLbFillAttr->GetEntryCount())); + + if ( mnLastPosHatch != LISTBOX_ENTRY_NOTFOUND ) + { + SvxHatchListItem aItem( *(const SvxHatchListItem*)( pSh->GetItem( SID_HATCH_LIST ) ) ); + if ( mnLastPosHatch < aItem.GetHatchList()->Count() ) + { + XHatch aHatch = aItem.GetHatchList()->GetHatch( mnLastPosHatch )->GetHatch(); + XFillHatchItem aXFillHatchItem( mpLbFillAttr->GetSelectEntry(), aHatch ); + GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_HATCH, SFX_CALLMODE_RECORD, &aXFillHatchItem, 0L); + mpLbFillAttr->SelectEntryPos(mnLastPosHatch); //add + } + } + } + else + mpLbFillAttr->Disable(); + } + break; + + case XFILL_BITMAP: + { + mpLbFillAttr->Show(); + mpToolBoxColor->Hide(); + mbTBShow = false; + if ( pSh && pSh->GetItem( SID_BITMAP_LIST ) ) + { + if(mpLbFillAttr->GetEntryCount() == 0) + { + SvxBitmapListItem aItem( *(const SvxBitmapListItem*)( + pSh->GetItem( SID_BITMAP_LIST ) ) ); + mpLbFillAttr->Enable(); + mpLbFillAttr->Clear(); + mpLbFillAttr->Fill( aItem.GetBitmapList() ); + } + + mpLbFillAttr->SetDropDownLineCount(std::min(sal_uInt16(20), mpLbFillAttr->GetEntryCount())); + + if ( mnLastPosBitmap != LISTBOX_ENTRY_NOTFOUND ) + { + SvxBitmapListItem aItem( *(const SvxBitmapListItem*)( pSh->GetItem( SID_BITMAP_LIST ) ) ); + if ( mnLastPosBitmap < aItem.GetBitmapList()->Count() ) + { + const XBitmapEntry* pXBitmapEntry = aItem.GetBitmapList()->GetBitmap(mnLastPosBitmap); + XFillBitmapItem aXFillBitmapItem( mpLbFillAttr->GetSelectEntry(), pXBitmapEntry->GetGraphicObject() ); + GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_BITMAP, SFX_CALLMODE_RECORD, &aXFillBitmapItem, 0L); + mpLbFillAttr->SelectEntryPos(mnLastPosBitmap); //add + } + } + } + else + mpLbFillAttr->Disable(); + } + break; + } + meLastXFS = (sal_uInt16)eXFS; + if( eXFS != XFILL_NONE ) + { + if ( pToolBox ) + mpLbFillType->Selected(); + } + } + return 0; +} + + + +IMPL_LINK( AreaPropertyPanel, SelectFillAttrHdl, ListBox*, pToolBox ) +{ + XFillStyle eXFS = (XFillStyle)mpLbFillType->GetSelectEntryPos(); + XFillStyleItem aXFillStyleItem( eXFS ); + SfxObjectShell* pSh = SfxObjectShell::Current(); + + if(pToolBox) + { + if( (XFillStyle) meLastXFS != eXFS ) + { + GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_STYLE, SFX_CALLMODE_RECORD, &aXFillStyleItem, 0L); //Added 20090909 + } + + switch( eXFS ) + { + case XFILL_SOLID: + //{ + // //String aTmpStr = mpLbFillAttr->GetSelectEntry(); + // //Color aColor = mpLbFillAttr->GetSelectEntryColor(); + // //if(aColor.GetColor() == 0 && aTmpStr.Equals(String::CreateFromAscii(""))) + // String aTmpStr; + // Color aColor = maLastColor; + // XFillColorItem aXFillColorItem( aTmpStr, aColor ); + // GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_COLOR, SFX_CALLMODE_RECORD, &aXFillColorItem, 0L); + // maLastColor = aColor; + //} + break; + + case XFILL_GRADIENT: + { + sal_uInt16 nPos = mpLbFillAttr->GetSelectEntryPos(); + if( nPos == LISTBOX_ENTRY_NOTFOUND ) + nPos = mnLastPosGradient; + + if ( nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem( SID_GRADIENT_LIST ) ) + { + SvxGradientListItem aItem( *(const SvxGradientListItem*)( pSh->GetItem( SID_GRADIENT_LIST ) ) ); + if ( nPos < aItem.GetGradientList()->Count() ) + { + XGradient aGradient = aItem.GetGradientList()->GetGradient( nPos )->GetGradient(); + XFillGradientItem aXFillGradientItem( mpLbFillAttr->GetSelectEntry(), aGradient ); + GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_GRADIENT, SFX_CALLMODE_RECORD, &aXFillGradientItem, 0L); + } + } + if(nPos != LISTBOX_ENTRY_NOTFOUND) + mnLastPosGradient = nPos; + } + break; + + case XFILL_HATCH: + { + sal_uInt16 nPos = mpLbFillAttr->GetSelectEntryPos(); + if( nPos == LISTBOX_ENTRY_NOTFOUND ) + nPos = mnLastPosHatch; + if ( nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem( SID_HATCH_LIST ) ) + { + SvxHatchListItem aItem( *(const SvxHatchListItem*)( pSh->GetItem( SID_HATCH_LIST ) ) ); + if ( nPos < aItem.GetHatchList()->Count() ) + { + XHatch aHatch = aItem.GetHatchList()->GetHatch( nPos )->GetHatch(); + XFillHatchItem aXFillHatchItem( mpLbFillAttr->GetSelectEntry(), aHatch ); + GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_HATCH, SFX_CALLMODE_RECORD, &aXFillHatchItem, 0L); + } + } + if(nPos != LISTBOX_ENTRY_NOTFOUND) + mnLastPosHatch = nPos; + } + break; + + case XFILL_BITMAP: + { + sal_uInt16 nPos = mpLbFillAttr->GetSelectEntryPos(); + if( nPos == LISTBOX_ENTRY_NOTFOUND ) + nPos = mnLastPosBitmap; + if ( nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem( SID_BITMAP_LIST ) ) + { + SvxBitmapListItem aItem( *(const SvxBitmapListItem*)( pSh->GetItem( SID_BITMAP_LIST ) ) ); + if ( nPos < aItem.GetBitmapList()->Count() ) + { + const XBitmapEntry* pXBitmapEntry = aItem.GetBitmapList()->GetBitmap(nPos); + XFillBitmapItem aXFillBitmapItem( mpLbFillAttr->GetSelectEntry(), pXBitmapEntry->GetGraphicObject() ); + GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_BITMAP, SFX_CALLMODE_RECORD, &aXFillBitmapItem, 0L); + } + } + if(nPos != LISTBOX_ENTRY_NOTFOUND) + mnLastPosBitmap = nPos; + } + break; + + default: + break; + } + } + return 0; +} + + +//add for color picker + +IMPL_LINK(AreaPropertyPanel, ToolBoxColorDropHdl, ToolBox*, pToolBox) +{ + sal_uInt16 nId = pToolBox->GetCurItemId(); + + if(nId == TBI_COLOR) + { + maColorPopup.Show(*pToolBox); + if (mpColorItem) + maColorPopup.SetCurrentColor(mpColorItem->GetColorValue(), mbColorAvail); + else + maColorPopup.SetCurrentColor(COL_WHITE, false); + } + + return 0; +} + + + +void AreaPropertyPanel::SetColor ( + const String& rsColorName, + const Color aColor) +{ + XFillColorItem aXFillColorItem (rsColorName, aColor); + mpBindings->GetDispatcher()->Execute(SID_ATTR_FILL_COLOR, SFX_CALLMODE_RECORD, &aXFillColorItem, 0L); + maLastColor = aColor; +} + + + + +PopupControl* AreaPropertyPanel::CreateTransparencyGradientControl (PopupContainer* pParent) +{ + return new AreaTransparencyGradientControl(pParent, *this); +} + + + + +PopupControl* AreaPropertyPanel::CreateColorPopupControl (PopupContainer* pParent) +{ + return new ColorControl( + pParent, + mpBindings, + SVX_RES(RID_POPUPPANEL_AERAPAGE_COLOR), + SVX_RES(VS_COLOR), + ::boost::bind(&AreaPropertyPanel::GetLastColor, this), + ::boost::bind(&AreaPropertyPanel::SetColor, this, _1,_2), + pParent, + 0); +} + + + + +void AreaPropertyPanel::SetupIcons(void) +{ + if(Theme::GetBoolean(Theme::Bool_UseSymphonyIcons)) + { + // todo + } + else + { + // todo + } +} + + + +AreaPropertyPanel* AreaPropertyPanel::Create ( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings) +{ + if (pParent == NULL) + throw lang::IllegalArgumentException(A2S("no parent Window given to AreaPropertyPanel::Create"), NULL, 0); + if ( ! rxFrame.is()) + throw lang::IllegalArgumentException(A2S("no XFrame given to AreaPropertyPanel::Create"), NULL, 1); + if (pBindings == NULL) + throw lang::IllegalArgumentException(A2S("no SfxBindings given to AreaPropertyPanel::Create"), NULL, 2); + + return new AreaPropertyPanel( + pParent, + rxFrame, + pBindings); +} + + + +void AreaPropertyPanel::DataChanged( + const DataChangedEvent& rEvent) +{ + (void)rEvent; + + SetupIcons(); +} + + + +void AreaPropertyPanel::ImpUpdateTransparencies() +{ + if(mpTransparanceItem.get() || mpFloatTransparenceItem.get()) + { + bool bZeroValue(false); + + if(mpTransparanceItem.get()) + { + const sal_uInt16 nValue(mpTransparanceItem->GetValue()); + + if(!nValue) + { + bZeroValue = true; + } + else if(nValue <= 100) + { + mpLBTransType->Enable(); + mpLBTransType->SelectEntryPos(1); + mpBTNGradient->Hide(); + mpMTRTransparent->Show(); + mpMTRTransparent->Enable(); + mpMTRTransparent->SetValue(nValue); + } + + if(!bZeroValue) + { + maTrGrPopup.Hide(); + } + } + + if(bZeroValue && mpFloatTransparenceItem.get()) + { + if(mpFloatTransparenceItem->IsEnabled()) + { + const XGradient& rGradient = mpFloatTransparenceItem->GetGradientValue(); + sal_uInt16 nEntryPos(0); + Image* pImage = 0; + + mpLBTransType->Enable(); + mpMTRTransparent->Hide(); + mpBTNGradient->Enable(); + mpBTNGradient->Show(); + + switch(rGradient.GetGradientStyle()) + { + case XGRAD_LINEAR: + { + nEntryPos = 2; + pImage = &maImgLinear; + break; + } + case XGRAD_AXIAL: + { + nEntryPos = 3; + pImage = &maImgAxial; + break; + } + case XGRAD_RADIAL: + { + nEntryPos = 4; + pImage = &maImgRadial; + break; + } + case XGRAD_ELLIPTICAL: + { + nEntryPos = 5; + pImage = &maImgElli; + break; + } + case XGRAD_SQUARE: + { + nEntryPos = 6; + pImage = &maImgQuad; + break; + } + case XGRAD_RECT: + { + nEntryPos = 7; + pImage = &maImgSquare; + break; + } + } + + mpLBTransType->SelectEntryPos(nEntryPos); + mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT, *pImage); + bZeroValue = false; + } + else + { + bZeroValue = true; + } + } + + if(bZeroValue) + { + mpLBTransType->Enable(); + mpLBTransType->SelectEntryPos(0); + mpBTNGradient->Hide(); + mpMTRTransparent->Enable(); + mpMTRTransparent->Show(); + mpMTRTransparent->SetValue(0); + } + } + else + { + // no transparency at all + mpLBTransType->SetNoSelection(); + mpMTRTransparent->Disable(); + mpMTRTransparent->Show(); + mpBTNGradient->Disable(); + mpBTNGradient->Hide(); + } +} + + + +void AreaPropertyPanel::NotifyItemUpdate( + sal_uInt16 nSID, + SfxItemState eState, + const SfxPoolItem* pState) +{ + XFillStyle eXFS; + SfxObjectShell* pSh = SfxObjectShell::Current(); + bool bFillTransparenceChanged(false); + + if(SID_ATTR_FILL_TRANSPARENCE == nSID) + { + bFillTransparenceChanged = true; + + if(eState >= SFX_ITEM_AVAILABLE) + { + const SfxUInt16Item* pItem = dynamic_cast< const SfxUInt16Item* >(pState); + + if(pItem && (!mpTransparanceItem || *pItem != *mpTransparanceItem)) + { + mpTransparanceItem.reset((SfxUInt16Item*)pItem->Clone()); + } + else + { + mpTransparanceItem.reset(); + } + } + else + { + mpTransparanceItem.reset(); + } + } + else if(SID_ATTR_FILL_FLOATTRANSPARENCE == nSID) + { + bFillTransparenceChanged = true; + + if(eState >= SFX_ITEM_AVAILABLE) + { + const XFillFloatTransparenceItem* pItem = dynamic_cast< const XFillFloatTransparenceItem* >(pState); + + if(pItem && (!mpFloatTransparenceItem || *pItem != *mpFloatTransparenceItem)) + { + mpFloatTransparenceItem.reset((XFillFloatTransparenceItem*)pItem->Clone()); + } + else + { + mpFloatTransparenceItem.reset(); + } + } + else + { + mpFloatTransparenceItem.reset(); + } + } + + if(bFillTransparenceChanged) + { + // update transparency settings dependent of mpTransparanceItem and mpFloatTransparenceItem + ImpUpdateTransparencies(); + } + + if (nSID == SID_ATTR_FILL_STYLE ) + { + if( eState == SFX_ITEM_DISABLED ) + { + mpLbFillType->Disable(); + mpLbFillType->SetNoSelection(); + mpLbFillAttr->Show(); + mpLbFillAttr->Disable(); + mpLbFillAttr->SetNoSelection(); + mpToolBoxColor->Hide(); + mbTBShow = false; + meLastXFS = -1; + mpStyleItem.reset(); + } + else if( SFX_ITEM_AVAILABLE == eState ) + { + mpStyleItem.reset(pState ? (XFillStyleItem*)pState->Clone() : 0); + mpLbFillType->Enable(); + + eXFS = (XFillStyle)mpStyleItem->GetValue(); + meLastXFS = eXFS; + mpLbFillType->SelectEntryPos( + sal::static_int_cast< sal_uInt16 >( eXFS ) ); + //Added for select invisable + if(eXFS == XFILL_NONE) + { + mpLbFillAttr->SetNoSelection(); + mpLbFillAttr->Disable(); + } + //else + // mpLbFillAttr->Enable(); + Update(); + //SelectFillTypeHdl( NULL ); + } + else + { + mpLbFillType->SetNoSelection(); + mpLbFillAttr->Show(); + mpLbFillAttr->Disable(); + mpLbFillAttr->SetNoSelection(); + mpToolBoxColor->Hide(); + mbTBShow = false; + meLastXFS = -1; //Added + mpStyleItem.reset(); + } + } + else if(nSID == SID_ATTR_FILL_COLOR) + { + if( SFX_ITEM_AVAILABLE == eState) + { + mpColorItem.reset(pState ? (XFillColorItem*)pState->Clone() : 0); + } + if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue() == XFILL_SOLID) + { + mpLbFillAttr->Hide(); + mpToolBoxColor->Show(); + mbTBShow = true; + if( SFX_ITEM_AVAILABLE == eState) + { + mpToolBoxColor->Enable(); + mbColorAvail = true; // + // maLastColor = mpColorItem->GetColorValue(); + Update(); + } + else if(SFX_ITEM_DISABLED == eState ) + { + mpToolBoxColor->Disable(); + mbColorAvail = false; // + mpColorUpdater->Update(COL_WHITE); + } + else + { + mbColorAvail = false; // + mpColorUpdater->Update(COL_WHITE); + } + } + } + else if(nSID == SID_ATTR_FILL_GRADIENT) + { + if( SFX_ITEM_AVAILABLE == eState) + { + mpFillGradientItem.reset(pState ? (XFillGradientItem*)pState->Clone() : 0); + } + if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue() == XFILL_GRADIENT ) + { + mpLbFillAttr->Show(); + mpToolBoxColor->Hide(); + mbTBShow = false; + if( SFX_ITEM_AVAILABLE == eState) + { + mpLbFillAttr->Enable(); + Update(); + } + + else if(SFX_ITEM_DISABLED == eState ) + { + mpLbFillAttr->Disable(); + mpLbFillAttr->SetNoSelection(); + } + else + mpLbFillAttr->SetNoSelection(); + } + } + else if(nSID == SID_ATTR_FILL_HATCH) + { + if( SFX_ITEM_AVAILABLE == eState) + { + mpHatchItem.reset(pState ? (XFillHatchItem*)pState->Clone() : 0); + } + if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue() == XFILL_HATCH ) + { + mpLbFillAttr->Show(); + mpToolBoxColor->Hide(); + mbTBShow = false; + if( SFX_ITEM_AVAILABLE == eState) + { + mpLbFillAttr->Enable(); + Update(); + } + else if(SFX_ITEM_DISABLED == eState ) + { + mpLbFillAttr->Disable(); + mpLbFillAttr->SetNoSelection(); + } + else + mpLbFillAttr->SetNoSelection(); + } + } + else if(nSID == SID_ATTR_FILL_BITMAP) + { + if( SFX_ITEM_AVAILABLE == eState) + { + mpBitmapItem.reset(pState ? (XFillBitmapItem*)pState->Clone() : 0); + } + if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue() == XFILL_BITMAP ) + { + mpLbFillAttr->Show(); + mpToolBoxColor->Hide(); + mbTBShow = false; + if( SFX_ITEM_AVAILABLE == eState) + { + mpLbFillAttr->Enable(); + Update(); + } + else if(SFX_ITEM_DISABLED == eState ) + { + mpLbFillAttr->Disable(); + mpLbFillAttr->SetNoSelection(); + } + else + mpLbFillAttr->SetNoSelection(); + } + } + else if(nSID == SID_COLOR_TABLE) + { + if( SFX_ITEM_AVAILABLE == eState) + { + mpColorListItem.reset(pState ? (SvxColorListItem*)pState->Clone() : 0); + + if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue()== XFILL_SOLID) + { + if ( mpColorItem ) + { + String aString( mpColorItem->GetName() ); + Color aColor = mpColorItem->GetColorValue(); + mpLbFillAttr->Clear(); + SvxColorListItem aItem( *(const SvxColorListItem*)( + pSh->GetItem( SID_COLOR_TABLE ) ) ); + mpLbFillAttr->Enable(); + mpLbFillAttr->Fill( aItem.GetColorList() ); + mpLbFillAttr->SelectEntry( aColor ); + } + else + mpLbFillAttr->SetNoSelection(); + } + } + } + else if(nSID == SID_GRADIENT_LIST) + { + if( SFX_ITEM_AVAILABLE == eState) + { + mpGradientListItem.reset(pState ? (SvxGradientListItem*)pState->Clone() : 0); + + if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue() == XFILL_GRADIENT) + { + if ( mpFillGradientItem ) + { + String aString( mpFillGradientItem->GetName() ); + mpLbFillAttr->Clear(); + SvxGradientListItem aItem( *(const SvxGradientListItem*)( + pSh->GetItem( SID_GRADIENT_LIST ) ) ); + mpLbFillAttr->Enable(); + mpLbFillAttr->Fill( aItem.GetGradientList() ); + mpLbFillAttr->SelectEntry( aString ); + } + else + mpLbFillAttr->SetNoSelection(); + } + } + } + else if(nSID == SID_HATCH_LIST) + { + if( SFX_ITEM_AVAILABLE == eState) + { + mpHatchListItem.reset(pState ? (SvxHatchListItem*)pState->Clone() : 0); + + if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue() == XFILL_HATCH ) + { + if ( mpHatchItem) + { + String aString( mpHatchItem->GetName() ); + mpLbFillAttr->Clear(); + SvxHatchListItem aItem( *(const SvxHatchListItem*)( + pSh->GetItem( SID_HATCH_LIST ) ) ); + mpLbFillAttr->Enable(); + mpLbFillAttr->Fill( aItem.GetHatchList() ); + mpLbFillAttr->SelectEntry( aString ); + } + else + mpLbFillAttr->SetNoSelection(); + } + } + } + else if(nSID == SID_BITMAP_LIST) + { + if( SFX_ITEM_AVAILABLE == eState) + { + mpBitmapListItem.reset(pState ? (SvxBitmapListItem*)pState->Clone() : 0); + + if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue() == XFILL_BITMAP ) + { + if ( mpBitmapItem ) + { + String aString( mpBitmapItem->GetName() ); + mpLbFillAttr->Clear(); + SvxBitmapListItem aItem( *(const SvxBitmapListItem*)( + pSh->GetItem( SID_BITMAP_LIST ) ) ); + mpLbFillAttr->Enable(); + mpLbFillAttr->Fill( aItem.GetBitmapList() ); + mpLbFillAttr->SelectEntry( aString ); + } + else + mpLbFillAttr->SetNoSelection(); + } + } + } +} + + + +SfxBindings* AreaPropertyPanel::GetBindings() +{ + return mpBindings; +} + + + +void AreaPropertyPanel::Update() +{ + if ( mpStyleItem ) + { + XFillStyle eXFS = (XFillStyle)mpStyleItem->GetValue(); + SfxObjectShell* pSh = SfxObjectShell::Current(); + + switch( eXFS ) + { + case XFILL_NONE: + { + mpLbFillAttr->Show(); //wj for new color picker + mpToolBoxColor->Hide(); //wj for new color picker + mbTBShow = false; + } + break; + + case XFILL_SOLID: + { + if ( mpColorItem ) + { + mpLbFillAttr->Hide(); //wj for new color picker + mpToolBoxColor->Show(); //wj for new color picker + mbTBShow = true; + mpColorUpdater->Update(mpColorItem->GetColorValue()); + } + else + mpColorUpdater->Update(COL_WHITE); + } + break; + + case XFILL_GRADIENT: + { + mpLbFillAttr->Show(); //wj for new color picker + mpToolBoxColor->Hide(); //wj for new color picker + mbTBShow = false; + if ( pSh && pSh->GetItem( SID_GRADIENT_LIST ) ) + { + SvxGradientListItem aItem( *(const SvxGradientListItem*)( + pSh->GetItem( SID_GRADIENT_LIST ) ) ); + mpLbFillAttr->Enable(); + mpLbFillAttr->Clear(); + mpLbFillAttr->Fill( aItem.GetGradientList() ); + if ( mpFillGradientItem ) + { + String aString( mpFillGradientItem->GetName() ); + mpLbFillAttr->SelectEntry( aString ); + } + else + mpLbFillAttr->SetNoSelection(); + } + else + mpLbFillAttr->SetNoSelection(); + } + break; + + case XFILL_HATCH: + { + mpLbFillAttr->Show(); //wj for new color picker + mpToolBoxColor->Hide(); //wj for new color picker + mbTBShow = false; + if ( pSh && pSh->GetItem( SID_HATCH_LIST ) ) + { + SvxHatchListItem aItem( *(const SvxHatchListItem*)( + pSh->GetItem( SID_HATCH_LIST ) ) ); + mpLbFillAttr->Enable(); + mpLbFillAttr->Clear(); + mpLbFillAttr->Fill( aItem.GetHatchList() ); + if ( mpHatchItem ) + { + String aString( mpHatchItem->GetName() ); + mpLbFillAttr->SelectEntry( aString ); + } + else + mpLbFillAttr->SetNoSelection(); + } + else + mpLbFillAttr->SetNoSelection(); + } + break; + + case XFILL_BITMAP: + { + mpLbFillAttr->Show(); //wj for new color picker + mpToolBoxColor->Hide(); //wj for new color picker + mbTBShow = false; + //mpLbFillAttr->Fill( mpBitmapListItem->GetBitmapList() ); + if ( pSh && pSh->GetItem( SID_BITMAP_LIST ) ) + { + SvxBitmapListItem aItem( *(const SvxBitmapListItem*)( + pSh->GetItem( SID_BITMAP_LIST ) ) ); + mpLbFillAttr->Enable(); + mpLbFillAttr->Clear(); + mpLbFillAttr->Fill( aItem.GetBitmapList() ); + if ( mpBitmapItem ) + { + String aString( mpBitmapItem->GetName() ); + mpLbFillAttr->SelectEntry( aString ); + } + else + mpLbFillAttr->SetNoSelection(); + } + else + mpLbFillAttr->SetNoSelection(); + } + break; + + default: + OSL_ENSURE(false, "Nicht unterstuetzter Flaechentyp"); + break; + } + } +} + + + +IMPL_LINK( AreaPropertyPanel, ImplPopupModeEndHdl, FloatingWindow*, EMPTYARG ) +{ + return 0; +} + + + +IMPL_LINK( AreaPropertyPanel, ClickTrGrHdl_Impl, ToolBox*, pToolBox ) +{ + maTrGrPopup.Rearrange(mpFloatTransparenceItem.get()); + + OSL_ASSERT(pToolBox->GetCurItemId() == TBI_BTX_GRADIENT); + + maTrGrPopup.Show(*pToolBox); + + return (0L); +} + + + +IMPL_LINK(AreaPropertyPanel, ChangeTrgrTypeHdl_Impl, void *, EMPTYARG) +{ + sal_uInt16 nSelectType = mpLBTransType->GetSelectEntryPos(); + bool bGradient = false; + sal_uInt16 nTrans = 0; + + if (nSelectType == 0) + { + mpBTNGradient->Hide(); + mpMTRTransparent->Show(); + mpMTRTransparent->Enable(); + mpMTRTransparent->SetValue(0); + } + else if (nSelectType == 1) + { + mpBTNGradient->Hide(); + mpMTRTransparent->Show(); + nTrans = mnLastTransSolid; + mpMTRTransparent->SetValue(nTrans); + mpLBTransType->SelectEntryPos(1);// for multi-selected, choose solid no selection + mpMTRTransparent->Enable(); + } + else + { + mpBTNGradient->Show(); + //for beta1 + switch ( nSelectType ) + { + case 2: + mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT, maImgLinear); // high contrast + break; + case 3: + mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT, maImgAxial); + break; + case 4: + mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT, maImgRadial); + break; + case 5: + mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT, maImgElli ); + break; + case 6: + mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT, maImgQuad ); + break; + case 7: + mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT, maImgSquare); + break; + } + //end of new code + mpMTRTransparent->Hide(); + mpBTNGradient->Enable(); + bGradient = true; + } + + XFillTransparenceItem aLinearItem(nTrans); + GetBindings()->GetDispatcher()->Execute( SID_ATTR_FILL_TRANSPARENCE, SFX_CALLMODE_RECORD, &aLinearItem, 0L ); + + if (nSelectType > 1) nSelectType = nSelectType-2; + + XGradient aTmpGradient; + + switch(nSelectType) + { + case XGRAD_LINEAR: + aTmpGradient = maGradientLinear; + break; + case XGRAD_AXIAL: + aTmpGradient = maGradientAxial; + break; + case XGRAD_RADIAL: + aTmpGradient = maGradientRadial; + break; + case XGRAD_ELLIPTICAL: + aTmpGradient = maGradientElliptical; + break; + case XGRAD_SQUARE: + aTmpGradient = maGradientSquare; + break; + case XGRAD_RECT: + aTmpGradient = maGradientRect; + break; + } + SfxItemPool* pPool = NULL; + bool bEnable = false; + if (bGradient) bEnable = true; + XFillFloatTransparenceItem aGradientItem(pPool,aTmpGradient, bEnable ); + + GetBindings()->GetDispatcher()->Execute( SID_ATTR_FILL_FLOATTRANSPARENCE, SFX_CALLMODE_RECORD, &aGradientItem, 0L ); + + return( 0L ); +} + + + +IMPL_LINK(AreaPropertyPanel, ModifyTransparentHdl_Impl, void*, EMPTYARG) +{ + sal_uInt16 nTrans = (sal_uInt16)mpMTRTransparent->GetValue(); + mnLastTransSolid = nTrans; + sal_uInt16 nSelectType = mpLBTransType->GetSelectEntryPos(); + if (nTrans != 0 && nSelectType == 0) + mpLBTransType->SelectEntryPos(1); + XFillTransparenceItem aLinearItem(nTrans); + GetBindings()->GetDispatcher()->Execute( SID_ATTR_FILL_TRANSPARENCE, SFX_CALLMODE_RECORD, &aLinearItem, 0L ); + + return 0L; +} + + +Color AreaPropertyPanel::GetLastColor (void) const +{ + return maLastColor; +} + + + + +XGradient AreaPropertyPanel::GetGradient (const XGradientStyle eStyle) const +{ + switch (eStyle) + { + default: + case XGRAD_LINEAR: + return maGradientLinear; + case XGRAD_AXIAL: + return maGradientAxial; + case XGRAD_RADIAL: + return maGradientRadial; + case XGRAD_ELLIPTICAL: + return maGradientElliptical; + case XGRAD_SQUARE: + return maGradientSquare; + case XGRAD_RECT: + return maGradientRect; + } +} + + + + +void AreaPropertyPanel::SetGradient (const XGradient& rGradient) +{ + switch (rGradient.GetGradientStyle()) + { + case XGRAD_LINEAR: + maGradientLinear = rGradient; + break; + case XGRAD_AXIAL: + maGradientAxial = rGradient; + break; + case XGRAD_RADIAL: + maGradientRadial = rGradient; + break; + case XGRAD_ELLIPTICAL: + maGradientElliptical = rGradient; + break; + case XGRAD_SQUARE: + maGradientSquare = rGradient; + break; + case XGRAD_RECT: + maGradientRect = rGradient; + break; + } +} + + + + +sal_Int32 AreaPropertyPanel::GetSelectedTransparencyTypeIndex (void) const +{ + return mpLBTransType->GetSelectEntryPos(); +} + +} } // end of namespace svx::sidebar + +// eof diff --git a/svx/source/sidebar/area/AreaPropertyPanel.hrc b/svx/source/sidebar/area/AreaPropertyPanel.hrc new file mode 100644 index 000000000000..a11a54faaf94 --- /dev/null +++ b/svx/source/sidebar/area/AreaPropertyPanel.hrc @@ -0,0 +1,82 @@ +/* + * 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_SIDEBAR_AREA_PANEL-------------------------------------------------------------- +#define FT_COLOR_LIST 1 +#define TB_COLOR 2 +#define TBI_COLOR 3 +#define IMG_COLOR 5 + +#define VS_COLOR 1 + +#define TBI_LEFT 1 +#define TBI_RIGHT 1 +#define TBI_BTX_GRADIENT 51 +#define FL_TRSP_TEXT 4 + +#define LB_TRGR_TYPES 6 +#define MTR_TRANSPARENT 7 +#define BTN_GRADIENT 8 + +#define FT_TRGR_CENTER_X 9 +#define MTR_TRGR_CENTER_X 10 +#define FT_TRGR_CENTER_Y 11 +#define MTR_TRGR_CENTER_Y 12 +#define FT_TRGR_ANGLE 13 +#define MTR_TRGR_ANGLE 14 +#define FT_TRGR_START_VALUE 15 +#define MTR_TRGR_START_VALUE 16 +#define FT_TRGR_END_VALUE 17 +#define MTR_TRGR_END_VALUE 18 +#define FT_TRGR_BORDER 19 +#define MTR_TRGR_BORDER 20 +#define STR_HELP_LEFT 24 +#define STR_HELP_RIGHT 25 + +#define BTN_LEFT_SECOND 22 +#define BTN_RIGHT_FIRST 23 + +#define IMG_AXIAL 24 +#define IMG_ELLI 25 +#define IMG_QUAD 26 +#define IMG_RADIAL 27 +#define IMG_SQUARE 28 +#define IMG_LINEAR 29 +#define IMG_ROT_LEFT 30 +#define IMG_ROT_RIGHT 31 +#define STR_HELP_TYPE 32 +#define STR_HELP_ATTR 33 +#define STR_HELP_COLOR 41 +#define STR_HELP_GRADIENT 42 + +#define FIXED_TEXT_HEIGHT 9 +#define FIXED_TEXT_WIDTH 40 +#define MBOX_WIDTH 50 +#define CONTROL_HEIGHT 12 +#define CONTROL_WIDTH 45 +#define LISTBOX_HEIGHT 80 +#define ROTATE_BUTTON_WIDTH 13 +#define ROTATE_BUTTON_SPACING 15 +#define POP_WIDTH 2*POPUPPANEL_MARGIN_HORIZONTAL+2*CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL +#define POP_HEIGHT 2*POPUPPANEL_MARGIN_VERTICAL + 4*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + MBOX_HEIGHT ) + 3*CONTROL_SPACING_VERTICAL +#define POP_HEIGHT2 2*POPUPPANEL_MARGIN_VERTICAL + 3*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + MBOX_HEIGHT ) + 2*CONTROL_SPACING_VERTICAL +#define LEFT_RIGHT_X1 POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL + 1 +#define LEFT_RIGHT_Y1 POPUPPANEL_MARGIN_VERTICAL + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL - 2 +#define LEFT_RIGHT_X2 POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL + ROTATE_BUTTON_SPACING +#define LEFT_RIGHT_Y2 POPUPPANEL_MARGIN_VERTICAL + 2*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL)+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL - 2 + +// eof diff --git a/svx/source/sidebar/area/AreaPropertyPanel.hxx b/svx/source/sidebar/area/AreaPropertyPanel.hxx new file mode 100644 index 000000000000..69617a0cc13a --- /dev/null +++ b/svx/source/sidebar/area/AreaPropertyPanel.hxx @@ -0,0 +1,198 @@ +/* + * 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 SVX_PROPERTYPANEL_AREAPAGE_HXX +#define SVX_PROPERTYPANEL_AREAPAGE_HXX + +#include <svx/sidebar/ColorPopup.hxx> +#include "AreaTransparencyGradientPopup.hxx" +#include <vcl/ctrl.hxx> +#include <sfx2/sidebar/SidebarPanelBase.hxx> +#include <sfx2/sidebar/ControllerItem.hxx> +#include <svx/xgrad.hxx> +#include <svx/itemwin.hxx> +#include <svx/xfillit0.hxx> +#include <svx/xflclit.hxx> +#include <svx/xflgrit.hxx> +#include <svx/xflhtit.hxx> +#include <svx/xbtmpit.hxx> +#include <svx/drawitem.hxx> +#include <vcl/lstbox.hxx> +#include <vcl/field.hxx> +#include <vcl/fixed.hxx> +#include <svl/intitem.hxx> +#include <svx/tbxcolorupdate.hxx> +#include <com/sun/star/ui/XUIElement.hpp> +#include <boost/scoped_ptr.hpp> + + +class XFillFloatTransparenceItem; +namespace svx { class ToolboxButtonColorUpdater; } + + +namespace svx { namespace sidebar { + +class PopupContainer; +class AreaTransparencyGradientControl; + +class AreaPropertyPanel +: public Control, + public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface +{ +public: + static AreaPropertyPanel* Create( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings); + + virtual void DataChanged( + const DataChangedEvent& rEvent); + + virtual void NotifyItemUpdate( + const sal_uInt16 nSId, + const SfxItemState eState, + const SfxPoolItem* pState); + + SfxBindings* GetBindings(); + + const static sal_Int32 DEFAULT_CENTERX; + const static sal_Int32 DEFAULT_CENTERY; + const static sal_Int32 DEFAULT_ANGLE; + const static sal_Int32 DEFAULT_STARTVALUE; + const static sal_Int32 DEFAULT_ENDVALUE; + const static sal_Int32 DEFAULT_BORDER; + + XGradient GetGradient (const XGradientStyle eStyle) const; + void SetGradient (const XGradient& rGradient); + sal_Int32 GetSelectedTransparencyTypeIndex (void) const; + +private: + sal_uInt16 meLastXFS; + Color maLastColor; + + sal_uInt16 mnLastPosGradient; + sal_uInt16 mnLastPosHatch; + sal_uInt16 mnLastPosBitmap; + sal_uInt16 mnLastTransSolid; + + XGradient maGradientLinear; + XGradient maGradientAxial; + XGradient maGradientRadial; + XGradient maGradientElliptical; + XGradient maGradientSquare; + XGradient maGradientRect; + + //ui controls + ::boost::scoped_ptr< FixedText > mpColorTextFT; + ::boost::scoped_ptr< SvxFillTypeBox > mpLbFillType; + ::boost::scoped_ptr< SvxFillAttrBox > mpLbFillAttr; + ::boost::scoped_ptr< Window > mpToolBoxColorBackground; + ::boost::scoped_ptr< ToolBox > mpToolBoxColor; // for new color picker + ::boost::scoped_ptr< FixedText > mpTrspTextFT; + ::boost::scoped_ptr< ListBox > mpLBTransType; + ::boost::scoped_ptr< MetricField > mpMTRTransparent; + ::boost::scoped_ptr< Window > mpBTNGradientBackground; + ::boost::scoped_ptr< ToolBox > mpBTNGradient; + + ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpColorUpdater; + + ::boost::scoped_ptr< XFillStyleItem > mpStyleItem; + ::boost::scoped_ptr< XFillColorItem > mpColorItem; + ::boost::scoped_ptr< XFillGradientItem > mpFillGradientItem; + ::boost::scoped_ptr< XFillHatchItem > mpHatchItem; + ::boost::scoped_ptr< XFillBitmapItem > mpBitmapItem; + ::boost::scoped_ptr< SvxColorListItem > mpColorListItem; + ::boost::scoped_ptr< SvxGradientListItem > mpGradientListItem; + ::boost::scoped_ptr< SvxHatchListItem > mpHatchListItem; + ::boost::scoped_ptr< SvxBitmapListItem > mpBitmapListItem; + + ::sfx2::sidebar::ControllerItem maStyleControl; + ::sfx2::sidebar::ControllerItem maColorControl; + ::sfx2::sidebar::ControllerItem maGradientControl; + ::sfx2::sidebar::ControllerItem maHatchControl; + ::sfx2::sidebar::ControllerItem maBitmapControl; + ::sfx2::sidebar::ControllerItem maColorTableControl; + ::sfx2::sidebar::ControllerItem maGradientListControl; + ::sfx2::sidebar::ControllerItem maHatchListControl; + ::sfx2::sidebar::ControllerItem maBitmapListControl; + ::sfx2::sidebar::ControllerItem maFillTransparenceController; + ::sfx2::sidebar::ControllerItem maFillFloatTransparenceController; + + Image maImgAxial; + Image maImgElli; + Image maImgQuad; + Image maImgRadial; + Image maImgSquare; + Image maImgLinear; + Image maImgColor; + + String msHelpFillType; + String msHelpFillAttr; + + AreaTransparencyGradientPopup maTrGrPopup; + ColorPopup maColorPopup; + + ::boost::scoped_ptr< XFillFloatTransparenceItem > mpFloatTransparenceItem; + ::boost::scoped_ptr< SfxUInt16Item > mpTransparanceItem; + + cssu::Reference<css::frame::XFrame> mxFrame; + SfxBindings* mpBindings; + + /// bitfield + bool mbTBShow : 1; + bool mbColorAvail : 1; + + DECL_LINK(SelectFillTypeHdl, ListBox* ); + DECL_LINK(SelectFillAttrHdl, ListBox* ); + DECL_LINK(ChangeTrgrTypeHdl_Impl, void*); + DECL_LINK(ModifyTransparentHdl_Impl, void*); + DECL_LINK( ImplPopupModeEndHdl, FloatingWindow* ); + + // for transparency gradient + PopupControl* CreateTransparencyGradientControl (PopupContainer* pParent); + DECL_LINK( ClickTrGrHdl_Impl, ToolBox* ); + + // for color picker + PopupControl* CreateColorPopupControl (PopupContainer* pParent); + DECL_LINK(ToolBoxColorDropHdl, ToolBox *); //for new color picker + + // constructor/destuctor + AreaPropertyPanel( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings); + virtual ~AreaPropertyPanel(void); + + void SetupIcons(void); + void Initialize(); + void Update(); + void ImpUpdateTransparencies(); + + Color GetLastColor (void) const; + void SetColor ( + const String& rsColorName, + const Color aColor); +}; + + +} } // end of namespace ::svx::sidebar + + + +#endif // SVX_PROPERTYPANEL_AREAPAGE_HXX + +// eof diff --git a/svx/source/sidebar/area/AreaPropertyPanel.src b/svx/source/sidebar/area/AreaPropertyPanel.src new file mode 100644 index 000000000000..32696ed78b60 --- /dev/null +++ b/svx/source/sidebar/area/AreaPropertyPanel.src @@ -0,0 +1,389 @@ +/* + * 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 "AreaPropertyPanel.hrc" +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include <svx/dialogs.hrc> +#include "helpid.hrc" + +#define TOOLBOX_WIDTH 50 +#define TOOLBOX_HEIGHT 17 + +Control RID_SIDEBAR_AREA_PANEL +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + Size = MAP_APPFONT( PROPERTYPAGE_WIDTH, SECTIONPAGE_MARGIN_VERTICAL_TOP + SECTIONPAGE_MARGIN_VERTICAL_BOT + 2*( FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + CBOX_HEIGHT) + CONTROL_SPACING_VERTICAL ); + HelpID = HID_PROPERTYPANEL_AREA_SECTION ; + Text [ en-US ] = "Area"; + + FixedText FT_COLOR_LIST + { + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL , SECTIONPAGE_MARGIN_VERTICAL_TOP ) ; + Size = MAP_APPFONT ( FIXED_TEXT_WIDTH + 50, FIXED_TEXT_HEIGHT ) ; + Text [ en-US ] = "~Fill:"; + }; + FixedText FL_TRSP_TEXT + { + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL , SECTIONPAGE_MARGIN_VERTICAL_TOP + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL ) ; + Size = MAP_APPFONT ( FIXED_TEXT_WIDTH + 50, FIXED_TEXT_HEIGHT ) ; + Text [ en-US ] = "~Transparency:"; + }; + ToolBox TB_COLOR + { + HelpID = HID_PPROPERTYPANEL_AREA_TBX_COLOR; + SVLook = TRUE ; + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + MBOX_WIDTH + CONTROL_SPACING_HORIZONTAL, SECTIONPAGE_MARGIN_VERTICAL_TOP + FIXED_TEXT_HEIGHT + 1) ; + Size = MAP_APPFONT (TOOLBOX_WIDTH ,TOOLBOX_HEIGHT ) ; + TabStop = TRUE ; + Text = "Color"; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_COLOR ; + HelpID = HID_PPROPERTYPANEL_AREA_TBI_COLOR; + DropDown = TRUE ; + Text = "Color" ; + }; + }; + }; + String STR_HELP_COLOR + { + Text [ en-US ] = "Select the color to apply." ; + }; + String STR_HELP_TYPE + { + Text [en-US] = "Select the fill type to apply."; + }; + String STR_HELP_ATTR + { + Text [en-US] = "Select the effect to apply."; + }; + Image IMG_AXIAL + { + ImageBitmap = Bitmap{File = "symphony/axial.png";}; + }; + Image IMG_ELLI + { + ImageBitmap = Bitmap{File = "symphony/ellipsoid.png";}; + }; + Image IMG_QUAD + { + ImageBitmap = Bitmap{File = "symphony/Quadratic.png";}; + }; + Image IMG_RADIAL + { + ImageBitmap = Bitmap{File = "symphony/radial.png";}; + }; + Image IMG_SQUARE + { + ImageBitmap = Bitmap{File = "symphony/Square.png";}; + }; + Image IMG_LINEAR + { + ImageBitmap = Bitmap{File = "symphony/linear.png";}; + }; + Image IMG_COLOR + { + ImageBitmap = Bitmap{File = "symphony/fill_color.png";}; + }; + + //===================================================================================================================================== + ListBox LB_TRGR_TYPES + { + Border = TRUE ; + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL , SECTIONPAGE_MARGIN_VERTICAL_TOP + 2*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL) + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL ) ; + Size = MAP_APPFONT ( MBOX_WIDTH , LISTBOX_HEIGHT ) ; + QuickHelpText [ en-US ] = "Select the type of transparence to apply." ; + TabStop = TRUE ; + DropDown = TRUE ; + HelpID = HID_PPROPERTYPANEL_AREA_LB_TRGR_TYPES ; + StringList [ en-US ] = + { + < "None" ; Default ; > ; + < "Solid" ; Default ; > ; + < "Linear" ; Default ; > ; + < "Axial" ; Default ; > ; + < "Radial" ; Default ; > ; + < "Ellipsoid" ; Default ; > ; + < "Quadratic" ; Default ; > ; + < "Square" ; Default ; > ; + }; + }; + + MetricField MTR_TRANSPARENT + { + Border = TRUE ; + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + MBOX_WIDTH + CONTROL_SPACING_HORIZONTAL , SECTIONPAGE_MARGIN_VERTICAL_TOP + 2*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL) + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL ) ; + Size = MAP_APPFONT ( MBOX_WIDTH + 1 ,MBOX_HEIGHT ) ; + HelpID = HID_PPROPERTYPANEL_AREA_MTR_TRANSPARENT ; + QuickHelpText [ en-US ] = "Specify 0% for fully opaque through 100% for fully transparent." ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + Last = 100 ; + SpinSize = 5 ; + }; + + ToolBox BTN_GRADIENT + { + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + MBOX_WIDTH + CONTROL_SPACING_HORIZONTAL , SECTIONPAGE_MARGIN_VERTICAL_TOP + 2*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL) + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL ) ; + HelpID = HID_PPROPERTYPANEL_AREA_TBX_GRADIENT ; + SVLook = TRUE ; + Border = FALSE ; + TabStop = TRUE ; + Text = "Gradient"; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_BTX_GRADIENT ; + HelpID = HID_PPROPERTYPANEL_AREA_TBI_GRADIENT ; + ItemBitmap = Bitmap + { + File = "symphony/linear.png" ; + }; + DropDown = TRUE; + Text = "Gradient" ; + }; + }; + }; + String STR_HELP_GRADIENT + { + Text [ en-US ] = "Specify the variation of gradient transparency." ; + }; +}; + +Control RID_POPUPPANEL_AREAPAGE_TRGR +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + +// Size = MAP_APPFONT( POP_WIDTH, POP_HEIGHT ); + + FixedText FT_TRGR_CENTER_X + { + Size = MAP_APPFONT ( CONTROL_WIDTH , FIXED_TEXT_HEIGHT ) ; + Text [ en-US ] = "Center ~X:"; + }; + MetricField MTR_TRGR_CENTER_X + { + Border = TRUE ; + Size = MAP_APPFONT ( CONTROL_WIDTH , MBOX_HEIGHT ) ; + HelpID = HID_PPROPERTYPANEL_AREA_MTR_TRGR_CENTER_X ; + QuickHelpText [ en-US ] = "Specify the horizontal offset percentage from the center for the gradient shading style. 50% is the horizontal center." ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + Last = 100 ; + SpinSize = 5 ; + }; + FixedText FT_TRGR_CENTER_Y + { + Size = MAP_APPFONT ( CONTROL_WIDTH + POPUPPANEL_MARGIN_HORIZONTAL, FIXED_TEXT_HEIGHT ) ;//wj + Text [ en-US ] = "Center ~Y:"; + }; + MetricField MTR_TRGR_CENTER_Y + { + Border = TRUE ; + Size = MAP_APPFONT ( CONTROL_WIDTH , MBOX_HEIGHT ) ; + HelpID = HID_PPROPERTYPANEL_AREA_MTR_TRGR_CENTER_Y ; + QuickHelpText [ en-US ] = "Specify the vertical offset percentage from the center for the gradient shading style. 50% is the vertical center." ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + Last = 100 ; + SpinSize = 5 ; + }; + FixedText FT_TRGR_ANGLE + { + Size = MAP_APPFONT ( CONTROL_WIDTH * 2 + POPUPPANEL_MARGIN_HORIZONTAL + CONTROL_SPACING_HORIZONTAL, FIXED_TEXT_HEIGHT ) ;//wj + Text [ en-US ] = "~Angle:"; + }; + MetricField MTR_TRGR_ANGLE + { + Border = TRUE ; + Size = MAP_APPFONT ( CONTROL_WIDTH , MBOX_HEIGHT ) ; + HelpID = HID_PPROPERTYPANEL_AREA_MTR_TRGR_ANGLE ; + QuickHelpText [ en-US ] = "Specify the angle of rotation for the gradient shading style." ; + TabStop = FALSE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = -9999 ; + Maximum = 9999 ; + Unit = FUNIT_CUSTOM ; + SpinSize = 1 ; + CustomUnitText [ en-US ] = " degrees"; + }; + FixedText FT_TRGR_START_VALUE + { + Size = MAP_APPFONT ( CONTROL_WIDTH , FIXED_TEXT_HEIGHT ) ; + Text [ en-US ] = "~Start value:"; + }; + MetricField MTR_TRGR_START_VALUE + { + Border = TRUE ; + Size = MAP_APPFONT ( CONTROL_WIDTH , MBOX_HEIGHT ) ; + HelpID = HID_PPROPERTYPANEL_AREA_MTR_TRGR_SVALUE ; + QuickHelpText [ en-US ] = "Enter a transparency value for the beginning point of the gradient, where 0% is fully opaque and 100% is fully transparent." ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + Last = 100 ; + SpinSize = 5 ; + }; + FixedText FT_TRGR_END_VALUE + { + Size = MAP_APPFONT (CONTROL_WIDTH + POPUPPANEL_MARGIN_HORIZONTAL, FIXED_TEXT_HEIGHT ) ; //wj + Text [ en-US ] = "~End value:"; + }; + MetricField MTR_TRGR_END_VALUE + { + Border = TRUE ; + Size = MAP_APPFONT ( CONTROL_WIDTH , MBOX_HEIGHT ) ; + HelpID = HID_PPROPERTYPANEL_AREA_MTR_TRGR_EVALUE ; + QuickHelpText [ en-US ] = "Enter a transparency value for the endpoint of the gradient, where 0% is fully opaque and 100% is fully transparent." ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + Last = 100 ; + SpinSize = 5 ; + }; + FixedText FT_TRGR_BORDER + { + Size = MAP_APPFONT ( CONTROL_WIDTH * 2 + POPUPPANEL_MARGIN_HORIZONTAL + CONTROL_SPACING_HORIZONTAL, FIXED_TEXT_HEIGHT ) ; // + Text [ en-US ] = "~Border:"; + }; + MetricField MTR_TRGR_BORDER + { + Border = TRUE ; + Size = MAP_APPFONT ( CONTROL_WIDTH , MBOX_HEIGHT ) ; + HelpID = HID_PPROPERTYPANEL_AREA_MTR_TRGR_BORDER ; + QuickHelpText [ en-US ] = "Specify the border value of gradient transparence." ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + Last = 100 ; + SpinSize = 5 ; + }; + //===================================================================================================================================== + + ToolBox BTN_LEFT_SECOND + { + Border = FALSE ; + HelpID = HID_PPROPERTYPANEL_AREA_BTN_LEFT_SECOND ; + SVLook = TRUE ; + Border = FALSE ; + TabStop = TRUE ; + Text = "Rotate Left"; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_LEFT ; + Text = "Rotate Left" ; + ItemBitmap = Bitmap + { + // File = "symphony/rotate_left.png" ; + }; + }; + }; + }; + ToolBox BTN_RIGHT_FIRST + { + Border = FALSE ; + HelpID = HID_PPROPERTYPANEL_AREA_BTN_RIGHT_FIRST ; + SVLook = TRUE ; + Border = FALSE ; + TabStop = TRUE ; + Text = "Rotate Right"; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_RIGHT ; + Text = "Rotate Right" ; + ItemBitmap = Bitmap + { + // File = "symphony/rotate_right.png" ; + }; + }; + }; + }; + String STR_HELP_LEFT + { + Text [ en-US ] = "Rotate counterclockwise by 45 degrees." ; + }; + String STR_HELP_RIGHT + { + Text [ en-US ] = "Rotate clockwise by 45 degrees." ; + }; + Image IMG_ROT_LEFT + { + ImageBitmap = Bitmap{File = "symphony/rotate_left.png";}; + }; + Image IMG_ROT_RIGHT + { + ImageBitmap = Bitmap{File = "symphony/rotate_right.png";}; + }; +}; +Control RID_POPUPPANEL_AERAPAGE_COLOR +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + Size = MAP_APPFONT( POPUP_COLOR_PICKER_WIDTH , POPUP_COLOR_PICKER_HEIGHT ); + + Control VS_COLOR + { + HelpID = HID_PPROPERTYPANEL_AREA_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 = "Color"; + }; +}; + +// eof diff --git a/svx/source/sidebar/area/AreaTransparencyGradientControl.cxx b/svx/source/sidebar/area/AreaTransparencyGradientControl.cxx new file mode 100644 index 000000000000..92ebdeeba927 --- /dev/null +++ b/svx/source/sidebar/area/AreaTransparencyGradientControl.cxx @@ -0,0 +1,345 @@ +/* + * 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 "AreaTransparencyGradientControl.hxx" +#include "AreaPropertyPanel.hxx" +#include "AreaPropertyPanel.hrc" + +#include <svx/dialogs.hrc> +#include <svx/dialmgr.hxx> +#include <svx/xflftrit.hxx> +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> + +namespace svx { namespace sidebar { + +// positioning helpers +#define APOS1_1 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL), MAP_APPFONT)) +#define APOS2_1 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL), MAP_APPFONT)) +#define APOS1_2 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL), MAP_APPFONT)) +#define APOS2_2 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL), MAP_APPFONT)) +#define APOS1_3 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL), MAP_APPFONT)) +#define APOS1_4 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 2*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL)+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL), MAP_APPFONT)) +#define APOS2_3 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL), MAP_APPFONT)) +#define APOS2_4 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 2*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL)+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL), MAP_APPFONT)) +#define APOS1_5 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 2*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL)), MAP_APPFONT)) +#define APOS1_6 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 3*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL)+2*(MBOX_HEIGHT+CONTROL_SPACING_VERTICAL)), MAP_APPFONT)) +#define APOS2_5 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 2*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL)), MAP_APPFONT)) +#define APOS2_6 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 3*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL)+2*(MBOX_HEIGHT+CONTROL_SPACING_VERTICAL)), MAP_APPFONT)) +#define APOS1_7 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 3*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL)), MAP_APPFONT)) +#define APOS1_8 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 4*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL)+3*(MBOX_HEIGHT+CONTROL_SPACING_VERTICAL)), MAP_APPFONT)) +#define APOS_Left_Right_1 Point(LogicToPixel(Point(LEFT_RIGHT_X1,LEFT_RIGHT_Y1), MAP_APPFONT)) +#define APOS_Left_Right_2 Point(LogicToPixel(Point(LEFT_RIGHT_X2,LEFT_RIGHT_Y1), MAP_APPFONT)) +#define APOS_Left_Right_3 Point(LogicToPixel(Point(LEFT_RIGHT_X1,LEFT_RIGHT_Y2), MAP_APPFONT)) +#define APOS_Left_Right_4 Point(LogicToPixel(Point(LEFT_RIGHT_X2,LEFT_RIGHT_Y2), MAP_APPFONT)) + + + + +AreaTransparencyGradientControl::AreaTransparencyGradientControl ( + Window* pParent, + AreaPropertyPanel& rPanel) + : PopupControl( pParent,SVX_RES(RID_POPUPPANEL_AREAPAGE_TRGR)), + maFtTrgrCenterX(this, SVX_RES(FT_TRGR_CENTER_X)), + maMtrTrgrCenterX(this, SVX_RES(MTR_TRGR_CENTER_X)), + maFtTrgrCenterY(this, SVX_RES(FT_TRGR_CENTER_Y)), + maMtrTrgrCenterY(this, SVX_RES(MTR_TRGR_CENTER_Y)), + maFtTrgrAngle(this, SVX_RES(FT_TRGR_ANGLE)), + maMtrTrgrAngle(this, SVX_RES(MTR_TRGR_ANGLE)), + maBtnLeft45(this, SVX_RES(BTN_LEFT_SECOND)), + maBtnRight45(this, SVX_RES(BTN_RIGHT_FIRST)), + maFtTrgrStartValue(this, SVX_RES(FT_TRGR_START_VALUE)), + maMtrTrgrStartValue(this, SVX_RES(MTR_TRGR_START_VALUE)), + maFtTrgrEndValue(this, SVX_RES(FT_TRGR_END_VALUE)), + maMtrTrgrEndValue(this, SVX_RES(MTR_TRGR_END_VALUE)), + maFtTrgrBorder(this, SVX_RES(FT_TRGR_BORDER)), + maMtrTrgrBorder(this, SVX_RES(MTR_TRGR_BORDER)), + maRotLeft( SVX_RES(IMG_ROT_LEFT)), + maRotRight( SVX_RES(IMG_ROT_RIGHT)), + mrAreaPropertyPanel(rPanel), + mpBindings(NULL) +{ + Link aLink = LINK( this, AreaTransparencyGradientControl, ModifiedTrgrHdl_Impl); + maMtrTrgrCenterX.SetModifyHdl( aLink ); + maMtrTrgrCenterY.SetModifyHdl( aLink ); + maMtrTrgrAngle.SetModifyHdl( aLink ); + maMtrTrgrBorder.SetModifyHdl( aLink ); + maMtrTrgrStartValue.SetModifyHdl( aLink ); + maMtrTrgrEndValue.SetModifyHdl( aLink ); + aLink = LINK( this, AreaTransparencyGradientControl, Left_Click45_Impl); + maBtnLeft45.SetSelectHdl( aLink ); + aLink = LINK( this, AreaTransparencyGradientControl, Right_Click45_Impl); + maBtnRight45.SetSelectHdl( aLink ); + maBtnLeft45.SetItemImage(1,maRotLeft); + Size aTbxSize = maBtnLeft45.CalcWindowSizePixel(); + maBtnLeft45.SetOutputSizePixel( aTbxSize ); + maBtnLeft45.SetQuickHelpText(1, String(SVX_RES(STR_HELP_LEFT))); //acc wj + + maBtnRight45.SetItemImage(1,maRotRight); + aTbxSize = maBtnRight45.CalcWindowSizePixel(); + maBtnRight45.SetOutputSizePixel( aTbxSize ); + maBtnRight45.SetQuickHelpText(1, String(SVX_RES(STR_HELP_RIGHT))); //acc wj + + maBtnLeft45.SetBackground(Wallpaper()); + maBtnLeft45.SetPaintTransparent(true); + maBtnRight45.SetBackground(Wallpaper()); + maBtnRight45.SetPaintTransparent(true); + + FreeResource(); + mpBindings = mrAreaPropertyPanel.GetBindings(); +} + + + + +AreaTransparencyGradientControl::~AreaTransparencyGradientControl (void) +{ +} + + + + +void AreaTransparencyGradientControl::ToGetFocus() +{ + if(maMtrTrgrCenterX.IsVisible()) + maMtrTrgrCenterX.GrabFocus(); + else + maMtrTrgrAngle.GrabFocus(); +} + + + + +void AreaTransparencyGradientControl::Rearrange(XFillFloatTransparenceItem* pGradientItem) +{ + InitStatus(pGradientItem); + const XGradient& rGradient = pGradientItem->GetGradientValue(); + XGradientStyle eXGS(rGradient.GetGradientStyle()); + Size aSize(POP_WIDTH,POP_HEIGHT); + aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) ); + Size aSize2(POP_WIDTH,POP_HEIGHT2); + aSize2 = LogicToPixel( aSize2, MapMode(MAP_APPFONT) ); + long aPosY = 0; + Point aPointAngle; + Size aSizeAngle = maMtrTrgrAngle.GetSizePixel(); + Size aTbxSize = maBtnLeft45.CalcWindowSizePixel(); + + switch(eXGS) + { + case XGRAD_LINEAR: + case XGRAD_AXIAL: + maFtTrgrCenterX.Hide(); + maMtrTrgrCenterX.Hide(); + maFtTrgrCenterY.Hide(); + maMtrTrgrCenterY.Hide(); + maFtTrgrAngle.Show(); + maFtTrgrAngle.SetPosPixel(APOS1_1); + maMtrTrgrAngle.Show(); + maMtrTrgrAngle.SetPosPixel(APOS2_1); + maFtTrgrStartValue.SetPosPixel(APOS1_3); + maMtrTrgrStartValue.SetPosPixel(APOS1_4); + maFtTrgrEndValue.SetPosPixel(APOS2_3); + maMtrTrgrEndValue.SetPosPixel(APOS2_4); + maFtTrgrBorder.SetPosPixel(APOS1_5); + maMtrTrgrBorder.SetPosPixel(APOS1_6); + + maBtnLeft45.Show(); + maBtnRight45.Show(); + + aPointAngle = maMtrTrgrAngle.GetPosPixel(); + aPosY = aPointAngle.getY() + aSizeAngle.getHeight() - aTbxSize.getHeight(); + + maBtnLeft45.SetPosPixel(Point(APOS_Left_Right_1.getX(), aPosY)); + maBtnRight45.SetPosPixel(Point(APOS_Left_Right_2.getX(), aPosY)); + + SetSizePixel(aSize2); + break; + + case XGRAD_RADIAL: + maFtTrgrCenterX.Show(); + maFtTrgrCenterX.SetPosPixel(APOS1_1); + maMtrTrgrCenterX.Show(); + maMtrTrgrCenterX.SetPosPixel(APOS2_1); + maFtTrgrCenterY.Show(); + maFtTrgrCenterY.SetPosPixel(APOS1_2); + maMtrTrgrCenterY.Show(); + maMtrTrgrCenterY.SetPosPixel(APOS2_2); + maFtTrgrAngle.Hide(); + maMtrTrgrAngle.Hide(); + maFtTrgrStartValue.SetPosPixel(APOS1_3); + maMtrTrgrStartValue.SetPosPixel(APOS1_4); + maFtTrgrEndValue.SetPosPixel(APOS2_3); + maMtrTrgrEndValue.SetPosPixel(APOS2_4); + maFtTrgrBorder.SetPosPixel(APOS1_5); + maMtrTrgrBorder.SetPosPixel(APOS1_6); + + maBtnLeft45.Hide(); + maBtnRight45.Hide(); + + SetSizePixel(aSize2); + + break; + + case XGRAD_ELLIPTICAL: + case XGRAD_SQUARE: + case XGRAD_RECT: + maFtTrgrCenterX.Show(); + maFtTrgrCenterX.SetPosPixel(APOS1_1); + maMtrTrgrCenterX.Show(); + maMtrTrgrCenterX.SetPosPixel(APOS2_1); + maFtTrgrCenterY.Show(); + maFtTrgrCenterY.SetPosPixel(APOS1_2); + maMtrTrgrCenterY.Show(); + maMtrTrgrCenterY.SetPosPixel(APOS2_2); + maFtTrgrAngle.Show(); + maFtTrgrAngle.SetPosPixel(APOS1_3); + maMtrTrgrAngle.Show(); + maMtrTrgrAngle.SetPosPixel(APOS1_4); + + maFtTrgrStartValue.SetPosPixel(APOS1_5); + maMtrTrgrStartValue.SetPosPixel(APOS1_6); + maFtTrgrEndValue.SetPosPixel(APOS2_5); + maMtrTrgrEndValue.SetPosPixel(APOS2_6); + maFtTrgrBorder.SetPosPixel(APOS1_7); + maMtrTrgrBorder.SetPosPixel(APOS1_8); + + maBtnLeft45.Show(); + maBtnRight45.Show(); + + aPointAngle = maMtrTrgrAngle.GetPosPixel(); + aPosY = aPointAngle.getY() + aSizeAngle.getHeight() - aTbxSize.getHeight(); + + maBtnLeft45.SetPosPixel(Point(APOS_Left_Right_3.getX(), aPosY)); + maBtnRight45.SetPosPixel(Point(APOS_Left_Right_4.getX(), aPosY)); + + SetSizePixel(aSize); + + break; + } +} + + + + +void AreaTransparencyGradientControl::InitStatus(XFillFloatTransparenceItem* pGradientItem) +{ + const XGradient& rGradient = pGradientItem->GetGradientValue(); + + XGradient aGradient; + + if (rGradient.GetXOffset() == AreaPropertyPanel::DEFAULT_CENTERX + && rGradient.GetYOffset() == AreaPropertyPanel::DEFAULT_CENTERY + && (rGradient.GetAngle() / 10) == AreaPropertyPanel::DEFAULT_ANGLE + && ((sal_uInt16)((((sal_uInt16)rGradient.GetStartColor().GetRed() + 1) * 100) / 255)) + == AreaPropertyPanel::DEFAULT_STARTVALUE + && ((sal_uInt16)((((sal_uInt16)rGradient.GetEndColor().GetRed() + 1) * 100) / 255)) + == AreaPropertyPanel::DEFAULT_ENDVALUE + && rGradient.GetBorder() == AreaPropertyPanel::DEFAULT_BORDER) + { + aGradient = mrAreaPropertyPanel.GetGradient(rGradient.GetGradientStyle()); + } + else + { + aGradient = rGradient; + } + maMtrTrgrCenterX.SetValue(aGradient.GetXOffset()); + maMtrTrgrCenterY.SetValue(aGradient.GetYOffset()); + maMtrTrgrAngle.SetValue(aGradient.GetAngle() / 10); + maMtrTrgrStartValue.SetValue((sal_uInt16)((((sal_uInt16)aGradient.GetStartColor().GetRed() + 1) * 100) / 255)); + maMtrTrgrEndValue.SetValue((sal_uInt16)((((sal_uInt16)aGradient.GetEndColor().GetRed() + 1) * 100) / 255)); + maMtrTrgrBorder.SetValue(aGradient.GetBorder()); +} + + + + +void AreaTransparencyGradientControl::ExecuteValueModify( sal_uInt8 nStartCol, sal_uInt8 nEndCol ) +{ + //Added + sal_Int16 aMtrValue = (sal_Int16)maMtrTrgrAngle.GetValue(); + while(aMtrValue<0) + aMtrValue += 360; + sal_uInt16 nVal = aMtrValue/360; + nVal = aMtrValue - nVal*360; + maMtrTrgrAngle.SetValue(nVal); + //End of new code + XGradient aTmpGradient( + Color(nStartCol, nStartCol, nStartCol), + Color(nEndCol, nEndCol, nEndCol), + (XGradientStyle)(mrAreaPropertyPanel.GetSelectedTransparencyTypeIndex()-2), + (sal_uInt16)maMtrTrgrAngle.GetValue() * 10, + (sal_uInt16)maMtrTrgrCenterX.GetValue(), + (sal_uInt16)maMtrTrgrCenterY.GetValue(), + (sal_uInt16)maMtrTrgrBorder.GetValue(), + 100, 100); + + mrAreaPropertyPanel.SetGradient(aTmpGradient); + + SfxItemPool* pPool = NULL; + bool bEnable = true; + XFillFloatTransparenceItem aGradientItem(pPool,aTmpGradient, bEnable ); + + mpBindings->GetDispatcher()->Execute( SID_ATTR_FILL_FLOATTRANSPARENCE, SFX_CALLMODE_RECORD, &aGradientItem, 0L ); +} + + + + +IMPL_LINK_NOARG(AreaTransparencyGradientControl, ModifiedTrgrHdl_Impl) +{ + sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrStartValue.GetValue() * 255) / 100); + sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrEndValue.GetValue() * 255) / 100); + ExecuteValueModify( nStartCol, nEndCol ); + return( 0L ); +} + + + + +IMPL_LINK_NOARG(AreaTransparencyGradientControl, Left_Click45_Impl) +{ + sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrStartValue.GetValue() * 255) / 100); + sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrEndValue.GetValue() * 255) / 100); + sal_uInt16 aTemp = (sal_uInt16)maMtrTrgrAngle.GetValue(); + if(aTemp>=315) + aTemp -= 360; + aTemp += 45; + maMtrTrgrAngle.SetValue(aTemp); + ExecuteValueModify( nStartCol, nEndCol ); + return( 0L ); +} + + + + +IMPL_LINK_NOARG(AreaTransparencyGradientControl, Right_Click45_Impl) +{ + sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrStartValue.GetValue() * 255) / 100); + sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrEndValue.GetValue() * 255) / 100); + sal_uInt16 aTemp = (sal_uInt16)maMtrTrgrAngle.GetValue(); + if(aTemp<45) + aTemp += 360; + aTemp -= 45; + maMtrTrgrAngle.SetValue(aTemp); + ExecuteValueModify( nStartCol, nEndCol ); + return( 0L ); +} + +} } // end of namespace svx::sidebar + +// eof diff --git a/svx/source/sidebar/area/AreaTransparencyGradientControl.hxx b/svx/source/sidebar/area/AreaTransparencyGradientControl.hxx new file mode 100644 index 000000000000..5d31d44d5b8b --- /dev/null +++ b/svx/source/sidebar/area/AreaTransparencyGradientControl.hxx @@ -0,0 +1,74 @@ +/* + * 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 "svx/sidebar/PopupControl.hxx" + +#include <vcl/fixed.hxx> +#include <vcl/field.hxx> +#include <vcl/toolbox.hxx> +#include <svx/xenum.hxx> + +class XFillFloatTransparenceItem; +class SfxBindings; + +namespace svx { namespace sidebar { + +class AreaPropertyPanel; + +class AreaTransparencyGradientControl : public PopupControl +{ +public: + AreaTransparencyGradientControl ( + Window* pParent, + AreaPropertyPanel& rPanel); + virtual ~AreaTransparencyGradientControl (void); + + void ToGetFocus(); + void Rearrange(XFillFloatTransparenceItem* pGradientItem); + void InitStatus(XFillFloatTransparenceItem* pGradientItem); + void ExecuteValueModify( sal_uInt8 nStartCol, sal_uInt8 nEndCol ); + void SetControlState_Impl(XGradientStyle eXGS); + +private: + FixedText maFtTrgrCenterX; + MetricField maMtrTrgrCenterX; + FixedText maFtTrgrCenterY; + MetricField maMtrTrgrCenterY; + FixedText maFtTrgrAngle; + MetricField maMtrTrgrAngle; + ToolBox maBtnLeft45; + ToolBox maBtnRight45; + FixedText maFtTrgrStartValue; + MetricField maMtrTrgrStartValue; + FixedText maFtTrgrEndValue; + MetricField maMtrTrgrEndValue; + FixedText maFtTrgrBorder; + MetricField maMtrTrgrBorder; + Image maRotLeft; + Image maRotRight; + + AreaPropertyPanel& mrAreaPropertyPanel; + SfxBindings* mpBindings; + DECL_LINK( ModifiedTrgrHdl_Impl, void* ); + DECL_LINK( Left_Click45_Impl, void* ); + DECL_LINK( Right_Click45_Impl, void* ); +}; + + +} } // end of namespace svx::sidebar + +// eof diff --git a/svx/source/sidebar/area/AreaTransparencyGradientPopup.cxx b/svx/source/sidebar/area/AreaTransparencyGradientPopup.cxx new file mode 100644 index 000000000000..4ae8c7edcaae --- /dev/null +++ b/svx/source/sidebar/area/AreaTransparencyGradientPopup.cxx @@ -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 . + */ +#include "AreaTransparencyGradientPopup.hxx" +#include "AreaTransparencyGradientControl.hxx" + + +namespace svx { namespace sidebar { + +AreaTransparencyGradientPopup::AreaTransparencyGradientPopup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator) + : Popup( + pParent, + rControlCreator, + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Transparency and Gradient"))) +{ +} + + + + +AreaTransparencyGradientPopup::~AreaTransparencyGradientPopup (void) +{ +} + + + + +void AreaTransparencyGradientPopup::Rearrange (XFillFloatTransparenceItem* pItem) +{ + ProvideContainerAndControl(); + + AreaTransparencyGradientControl* pControl = dynamic_cast<AreaTransparencyGradientControl*>(mpControl.get()); + if (pControl != NULL) + pControl->Rearrange(pItem); +} + + +} } // end of namespace svx::sidebar + +// eof diff --git a/svx/source/sidebar/area/AreaTransparencyGradientPopup.hxx b/svx/source/sidebar/area/AreaTransparencyGradientPopup.hxx new file mode 100644 index 000000000000..7c11f6b535d6 --- /dev/null +++ b/svx/source/sidebar/area/AreaTransparencyGradientPopup.hxx @@ -0,0 +1,47 @@ +/* + * 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 _SVX_SIDEBAR_TRANSPARENCY_GRADIENT_POPUP_HXX_ +#define _SVX_SIDEBAR_TRANSPARENCY_GRADIENT_POPUP_HXX_ + +#include "svx/sidebar/Popup.hxx" + +#include <boost/function.hpp> + + +class XFillFloatTransparenceItem; + + +namespace svx { namespace sidebar { + +class AreaTransparencyGradientPopup + : public Popup +{ +public : + AreaTransparencyGradientPopup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator); + ~AreaTransparencyGradientPopup (void); + + void Rearrange (XFillFloatTransparenceItem* pItem); +}; + +} } // end of namespace svx::sidebar + +#endif + +// eof diff --git a/svx/source/sidebar/debug/ColorPanel.cxx b/svx/source/sidebar/debug/ColorPanel.cxx new file mode 100644 index 000000000000..57cce2017359 --- /dev/null +++ b/svx/source/sidebar/debug/ColorPanel.cxx @@ -0,0 +1,228 @@ +/* + * 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 "ColorPanel.hxx" + +#include <vcl/image.hxx> +#include <vcl/svapp.hxx> + +namespace svx { namespace sidebar { + +ColorPanel::ColorPanel (::Window* pParent) + : ValueSet(pParent, WB_ITEMBORDER), + mnPreferredColumnCount(2) +{ + WinBits aStyle = + WB_ITEMBORDER + | WB_DOUBLEBORDER + | WB_NAMEFIELD + | WB_FLATVALUESET + | WB_TABSTOP + | WB_VSCROLL; + + SetStyle(GetStyle() | aStyle); + SetExtraSpacing(2); + + Fill (); + Show(); +} + + + + +ColorPanel::~ColorPanel (void) +{ +} + + + + +sal_Int32 ColorPanel::GetPreferredHeight (sal_Int32 nWidth) +{ + sal_Int32 nPreferredHeight = 0; + if (GetItemCount()>0) + { + Image aImage = GetItemImage(GetItemId(0)); + Size aItemSize = CalcItemSizePixel (aImage.GetSizePixel()); + if (nWidth>0 && aItemSize.Width()>0) + { + int nColumnCount = nWidth / aItemSize.Width(); + if (nColumnCount <= 0) + nColumnCount = 1; + else if (nColumnCount > 4) + nColumnCount = 4; + int nRowCount = (GetItemCount() + nColumnCount-1) + / nColumnCount; + nPreferredHeight = nRowCount * aItemSize.Height(); + } + } + return nPreferredHeight; +} + + + + +void ColorPanel::Resize (void) +{ + ::Window::Resize(); + Size aWindowSize = GetOutputSizePixel(); + SetPosSizePixel(Point(0,0), aWindowSize); + if (IsVisible() && aWindowSize.Width() > 0) + { + // Calculate the number of rows and columns. + if (GetItemCount() > 0) + { + Image aImage = GetItemImage(GetItemId(0)); + Size aItemSize = CalcItemSizePixel ( + aImage.GetSizePixel()); + int nColumnCount = aWindowSize.Width() / 30; + if (nColumnCount < 1) + nColumnCount = 1; + else if (nColumnCount > 4) + nColumnCount = 4; + + sal_uInt16 nRowCount = (sal_uInt16)CalculateRowCount(aItemSize, nColumnCount); + + SetColCount((sal_uInt16)nColumnCount); + SetLineCount(nRowCount); + } + } + +} + + + + +int ColorPanel::CalculateRowCount (const Size&, int nColumnCount) +{ + int nRowCount = 0; + + if (GetItemCount()>0 && nColumnCount>0) + { + nRowCount = GetOutputSizePixel().Height() / 30; + if (nRowCount < 1) + nRowCount = 1; + } + + return nRowCount; +} + + + + +void ColorPanel::DataChanged (const DataChangedEvent& /*rEvent*/) +{ + Fill(); +} + + + + +void ColorPanel::Fill (void) +{ + const StyleSettings& rSettings ( + Application::GetSettings().GetStyleSettings()); + Clear(); + SetItemWidth (30); + SetItemHeight (30); + sal_uInt16 i = 0; + InsertItem (++i, rSettings.GetFaceColor()); + SetItemText (i, OUString("FaceColor")); + InsertItem (++i, rSettings.GetCheckedColor()); + SetItemText (i, OUString("CheckedColor")); + InsertItem (++i, rSettings.GetLightColor()); + SetItemText (i, OUString("LightColor")); + InsertItem (++i, rSettings.GetLightBorderColor()); + SetItemText (i, OUString("LightBorderColor")); + InsertItem (++i, rSettings.GetShadowColor()); + SetItemText (i, OUString("ShadowColor")); + InsertItem (++i, rSettings.GetDarkShadowColor()); + SetItemText (i, OUString("DarkShadowColor")); + InsertItem (++i, rSettings.GetButtonTextColor()); + SetItemText (i, OUString("ButtonTextColor")); + InsertItem (++i, rSettings.GetRadioCheckTextColor()); + SetItemText (i, OUString("RadioCheckTextColor")); + InsertItem (++i, rSettings.GetGroupTextColor()); + SetItemText (i, OUString("GroupTextColor")); + InsertItem (++i, rSettings.GetLabelTextColor()); + SetItemText (i, OUString("LabelTextColor")); + InsertItem (++i, rSettings.GetInfoTextColor()); + SetItemText (i, OUString("InfoTextColor")); + InsertItem (++i, rSettings.GetWindowColor()); + SetItemText (i, OUString("WindowColor")); + InsertItem (++i, rSettings.GetWindowTextColor()); + SetItemText (i, OUString("WindowTextColor")); + InsertItem (++i, rSettings.GetDialogColor()); + SetItemText (i, OUString("DialogColor")); + InsertItem (++i, rSettings.GetDialogTextColor()); + SetItemText (i, OUString("DialogTextColor")); + InsertItem (++i, rSettings.GetWorkspaceColor()); + SetItemText (i, OUString("WorkspaceColor")); + InsertItem (++i, rSettings.GetFieldColor()); + SetItemText (i, OUString("FieldColor")); + InsertItem (++i, rSettings.GetFieldTextColor()); + SetItemText (i, OUString("FieldTextColor")); + InsertItem (++i, rSettings.GetActiveColor()); + SetItemText (i, OUString("ActiveColor")); + InsertItem (++i, rSettings.GetActiveColor2()); + SetItemText (i, OUString("ActiveColor2")); + InsertItem (++i, rSettings.GetActiveTextColor()); + SetItemText (i, OUString("ActiveTextColor")); + InsertItem (++i, rSettings.GetActiveBorderColor()); + SetItemText (i, OUString("ActiveBorderColor")); + InsertItem (++i, rSettings.GetDeactiveColor()); + SetItemText (i, OUString("DeactiveColor")); + InsertItem (++i, rSettings.GetDeactiveColor2()); + SetItemText (i, OUString("DeactiveColor2")); + InsertItem (++i, rSettings.GetDeactiveTextColor()); + SetItemText (i, OUString("DeactiveTextColor")); + InsertItem (++i, rSettings.GetDeactiveBorderColor()); + SetItemText (i, OUString("DeactiveBorderColor")); + InsertItem (++i, rSettings.GetHighlightColor()); + SetItemText (i, OUString("HighlightColor")); + InsertItem (++i, rSettings.GetHighlightTextColor()); + SetItemText (i, OUString("HighlightTextColor")); + InsertItem (++i, rSettings.GetDisableColor()); + SetItemText (i, OUString("DisableColor")); + InsertItem (++i, rSettings.GetHelpColor()); + SetItemText (i, OUString("HelpColor")); + InsertItem (++i, rSettings.GetHelpTextColor()); + SetItemText (i, OUString("HelpTextColor")); + InsertItem (++i, rSettings.GetMenuColor()); + SetItemText (i, OUString("MenuColor")); + InsertItem (++i, rSettings.GetMenuBarColor()); + SetItemText (i, OUString("MenuBarColor")); + InsertItem (++i, rSettings.GetMenuBorderColor()); + SetItemText (i, OUString("MenuBorderColor")); + InsertItem (++i, rSettings.GetMenuTextColor()); + SetItemText (i, OUString("MenuTextColor")); + InsertItem (++i, rSettings.GetMenuHighlightColor()); + SetItemText (i, OUString("MenuHighlightColor")); + InsertItem (++i, rSettings.GetMenuHighlightTextColor()); + SetItemText (i, OUString("MenuHighlightTextColor")); + InsertItem (++i, rSettings.GetLinkColor()); + SetItemText (i, OUString("LinkColor")); + InsertItem (++i, rSettings.GetVisitedLinkColor()); + SetItemText (i, OUString("VisitedLinkColor")); + InsertItem (++i, rSettings.GetHighlightLinkColor()); + SetItemText (i, OUString("HighlightLinkColor")); + InsertItem (++i, rSettings.GetFontColor()); + SetItemText (i, OUString("FontColor")); +} + +} } // end of namespace ::svx::sidebar diff --git a/svx/source/sidebar/debug/ColorPanel.hxx b/svx/source/sidebar/debug/ColorPanel.hxx new file mode 100644 index 000000000000..5f7887a7a6e3 --- /dev/null +++ b/svx/source/sidebar/debug/ColorPanel.hxx @@ -0,0 +1,57 @@ +/* + * 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 SVX_SIDEBAR_COLOR_PANEL_HXX +#define SVX_SIDEBAR_COLOR_PANEL_HXX + +#include <svtools/valueset.hxx> +#include <vcl/window.hxx> + + +namespace svx { namespace sidebar { + + +/** This demo panel shows the colors that are available from the + StyleSettings. +*/ +class ColorPanel + : public ValueSet +{ +public: + ColorPanel (::Window* pParent); + virtual ~ColorPanel (void); + + // From ::Window + virtual void Resize (void); + virtual void DataChanged (const DataChangedEvent& rEvent); + +private: + int mnPreferredColumnCount; + + /** Depending on the given number of columns and the item size + calculate the number of rows that are necessary to display all + items. + */ + int CalculateRowCount (const Size& rItemSize, int nColumnCount); + void Fill (void); + + sal_Int32 GetPreferredHeight (sal_Int32 nWidth); +}; + +} } // end of namespace ::svx::sidebar + +#endif diff --git a/svx/source/sidebar/debug/ContextPanel.cxx b/svx/source/sidebar/debug/ContextPanel.cxx new file mode 100644 index 000000000000..0a39a705c0b6 --- /dev/null +++ b/svx/source/sidebar/debug/ContextPanel.cxx @@ -0,0 +1,64 @@ +/* + * 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 "ContextPanel.hxx" + +namespace svx { namespace sidebar { + +ContextPanel::ContextPanel (::Window* pParent) + : Window(pParent, 0), + maApplicationName(this, 0), + maContextName(this, 0) +{ + maApplicationName.setPosSizePixel(5,5, 250,15); + maContextName.setPosSizePixel(5,25, 250,15); + + maApplicationName.Show(); + maContextName.Show(); + Show(); +} + + + + +ContextPanel::~ContextPanel (void) +{ +} + + + + +sal_Int32 ContextPanel::GetPreferredHeight (sal_Int32 /*nWidth*/) +{ + const sal_Int32 nHeight (maContextName.GetPosPixel().Y() + maContextName.GetSizePixel().Height() + 5); + return nHeight; +} + + + + +void ContextPanel::HandleContextChange (const sfx2::sidebar::EnumContext aContext) +{ + maApplicationName.SetText(aContext.GetApplicationName()); + maContextName.SetText(aContext.GetContextName()); +} + + + + +} } // end of namespace ::svx::sidebar diff --git a/svx/source/sidebar/debug/ContextPanel.hxx b/svx/source/sidebar/debug/ContextPanel.hxx new file mode 100644 index 000000000000..7115a352435c --- /dev/null +++ b/svx/source/sidebar/debug/ContextPanel.hxx @@ -0,0 +1,52 @@ +/* + * 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 SVX_SIDEBAR_DEBUG_CONTEXT_PANEL_HXX +#define SVX_SIDEBAR_DEBUG_CONTEXT_PANEL_HXX + +#include <sfx2/sidebar/IContextChangeReceiver.hxx> +#include <vcl/window.hxx> +#include <vcl/fixed.hxx> + + +namespace svx { namespace sidebar { + + +/** Display the current context. +*/ +class ContextPanel + : public Window, + public sfx2::sidebar::IContextChangeReceiver +{ +public: + ContextPanel (::Window* pParent); + virtual ~ContextPanel (void); + + // From Window + sal_Int32 GetPreferredHeight (sal_Int32 nWidth); + + // From IContextChangeReceiverInterface + virtual void HandleContextChange (const ::sfx2::sidebar::EnumContext aContext); + +private: + FixedText maApplicationName; + FixedText maContextName; +}; + +} } // end of namespace ::svx::sidebar + +#endif diff --git a/svx/source/sidebar/debug/NotYetImplementedPanel.cxx b/svx/source/sidebar/debug/NotYetImplementedPanel.cxx new file mode 100644 index 000000000000..2bb5ae9c1df0 --- /dev/null +++ b/svx/source/sidebar/debug/NotYetImplementedPanel.cxx @@ -0,0 +1,44 @@ +/* + * 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 "NotYetImplementedPanel.hxx" + +namespace svx { namespace sidebar { + +NotYetImplementedPanel::NotYetImplementedPanel (::Window* pParent) + : Window(pParent, 0), + maMessageControl(this, 0) +{ + maMessageControl.setPosSizePixel(5,5, 250,15); + maMessageControl.SetText(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("not yet implemented"))); + + maMessageControl.Show(); + Show(); +} + + + + +NotYetImplementedPanel::~NotYetImplementedPanel (void) +{ +} + + + + +} } // end of namespace ::svx::sidebar diff --git a/svx/source/sidebar/debug/NotYetImplementedPanel.hxx b/svx/source/sidebar/debug/NotYetImplementedPanel.hxx new file mode 100644 index 000000000000..575c810a147a --- /dev/null +++ b/svx/source/sidebar/debug/NotYetImplementedPanel.hxx @@ -0,0 +1,43 @@ +/* + * 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 SVX_SIDEBAR_DEBUG_NOT_YET_IMPLEMENTED_PANEL_HXX +#define SVX_SIDEBAR_DEBUG_NOT_YET_IMPLEMENTED_PANEL_HXX + +#include <vcl/window.hxx> +#include <vcl/fixed.hxx> + + +namespace svx { namespace sidebar { + + +/** Display a panel as placeholder for a not-yet-implemented panel. +*/ +class NotYetImplementedPanel + : public Window +{ +public: + NotYetImplementedPanel (::Window* pParent); + virtual ~NotYetImplementedPanel (void); + +private: + FixedText maMessageControl; +}; + +} } // end of namespace ::svx::sidebar + +#endif diff --git a/svx/source/sidebar/gallery/GalleryPanel.hxx b/svx/source/sidebar/gallery/GalleryPanel.hxx new file mode 100644 index 000000000000..8efb8512e650 --- /dev/null +++ b/svx/source/sidebar/gallery/GalleryPanel.hxx @@ -0,0 +1,27 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef SVX_SIDEBAR_GALLERY_PANEL_HXX +#define SVX_SIDEBAR_GALLERY_PANEL_HXX + +class GelleryPanel +{ +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx b/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx new file mode 100644 index 000000000000..1e5103d1a133 --- /dev/null +++ b/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx @@ -0,0 +1,455 @@ +/* + * 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 <GraphicPropertyPanel.hxx> +#include <GraphicPropertyPanel.hrc> +#include <svx/dialogs.hrc> +#include <svx/dialmgr.hxx> +#include <vcl/field.hxx> +#include <vcl/lstbox.hxx> +#include <svl/intitem.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> + +using namespace css; +using namespace cssu; +using ::sfx2::sidebar::Theme; + +#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) + +////////////////////////////////////////////////////////////////////////////// +// namespace open + +namespace svx { namespace sidebar { + +////////////////////////////////////////////////////////////////////////////// + +GraphicPropertyPanel::GraphicPropertyPanel( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings) +: Control( + pParent, + SVX_RES(RID_SIDEBAR_GRAPHIC_PANEL)), + mpFtBrightness(new FixedText(this, SVX_RES(FT_BRIGHTNESS))), + mpMtrBrightness(new MetricField(this, SVX_RES(MTR_BRIGHTNESS))), + mpFtContrast(new FixedText(this, SVX_RES(FT_CONTRAST))), + mpMtrContrast(new MetricField(this, SVX_RES(MTR_CONTRAST))), + mpFtColorMode(new FixedText(this, SVX_RES(FT_COLOR_MODE))), + mpLBColorMode(new ListBox(this, SVX_RES(LB_COLOR_MODE))), + mpFtTrans(new FixedText(this, SVX_RES(FT_TRANSPARENT))), + mpMtrTrans(new MetricField(this, SVX_RES(MTR_TRANSPARENT))), + mpMtrRed(new MetricField(this, SVX_RES(MF_RED))), + mpMtrGreen(new MetricField(this, SVX_RES(MF_GREEN))), + mpMtrBlue(new MetricField(this, SVX_RES(MF_BLUE))), + mpMtrGamma(new MetricField(this, SVX_RES(MF_GAMMA))), + maBrightControl(SID_ATTR_GRAF_LUMINANCE, *pBindings, *this), + maContrastControl(SID_ATTR_GRAF_CONTRAST, *pBindings, *this), + maTransparenceControl(SID_ATTR_GRAF_TRANSPARENCE, *pBindings, *this), + maRedControl(SID_ATTR_GRAF_RED, *pBindings, *this), + maGreenControl(SID_ATTR_GRAF_GREEN, *pBindings, *this), + maBlueControl(SID_ATTR_GRAF_BLUE, *pBindings, *this), + maGammaControl(SID_ATTR_GRAF_GAMMA, *pBindings, *this), + maModeControl(SID_ATTR_GRAF_MODE, *pBindings, *this), + maImgNormal(SVX_RES(IMG_NORMAL)), + maImgBW(SVX_RES(IMG_BW)), + maImgGray(SVX_RES(IMG_GRAY)), + maImgWater(SVX_RES(IMG_WATER)), + maImgRed(this, SVX_RES(IMG_RED)), + maImgGreen(this, SVX_RES(IMG_GREEN)), + maImgBlue(this, SVX_RES(IMG_BLUE)), + maImgGamma(this, SVX_RES(IMG_GAMMA)), + msNormal(SVX_RES(STR_NORMAL)), + msBW(SVX_RES(STR_BW)), + msGray(SVX_RES(STR_GRAY)), + msWater(SVX_RES(STR_WATER)), + mxFrame(rxFrame), + mpBindings(pBindings) +{ + Initialize(); + FreeResource(); +} + +////////////////////////////////////////////////////////////////////////////// + +GraphicPropertyPanel::~GraphicPropertyPanel() +{ +} + +////////////////////////////////////////////////////////////////////////////// + +void GraphicPropertyPanel::Initialize() +{ + mpFtBrightness->SetBackground(Wallpaper()); + mpFtContrast->SetBackground(Wallpaper()); + mpFtColorMode->SetBackground(Wallpaper()); + mpFtTrans->SetBackground(Wallpaper()); + + mpMtrBrightness->SetModifyHdl( LINK( this, GraphicPropertyPanel, ModifyBrightnessHdl ) ); + mpMtrBrightness->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Brightness"))); //wj acc + mpMtrContrast->SetModifyHdl( LINK( this, GraphicPropertyPanel, ModifyContrastHdl ) ); + mpMtrContrast->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Contrast"))); //wj acc + mpMtrTrans->SetModifyHdl( LINK( this, GraphicPropertyPanel, ModifyTransHdl ) ); + mpMtrTrans->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Transparency"))); //wj acc + + mpLBColorMode->InsertEntry( msNormal, maImgNormal ); + mpLBColorMode->InsertEntry( msGray, maImgGray ); + mpLBColorMode->InsertEntry( msBW, maImgBW ); + mpLBColorMode->InsertEntry( msWater, maImgWater ); + mpLBColorMode->SetSelectHdl( LINK( this, GraphicPropertyPanel, ClickColorModeHdl )); + mpLBColorMode->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Color mode"))); //wj acc + + mpMtrRed->SetModifyHdl( LINK( this, GraphicPropertyPanel, RedHdl ) ); + mpMtrGreen->SetModifyHdl( LINK( this, GraphicPropertyPanel, GreenHdl ) ); + mpMtrBlue->SetModifyHdl( LINK( this, GraphicPropertyPanel, BlueHdl ) ); + mpMtrGamma->SetModifyHdl( LINK( this, GraphicPropertyPanel, GammaHdl ) ); + mpMtrRed->SetAccessibleName(mpMtrRed->GetQuickHelpText()); //wj acc + mpMtrGreen->SetAccessibleName(mpMtrGreen->GetQuickHelpText()); //wj acc + mpMtrBlue->SetAccessibleName(mpMtrBlue->GetQuickHelpText()); //wj acc + mpMtrGamma->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Gamma value"))); //wj acc + + mpMtrRed->SetAccessibleRelationLabeledBy(mpMtrRed.get()); + mpMtrGreen->SetAccessibleRelationLabeledBy(mpMtrGreen.get()); + mpMtrBlue->SetAccessibleRelationLabeledBy(mpMtrBlue.get()); + mpMtrGamma->SetAccessibleRelationLabeledBy(mpMtrGamma.get()); + mpMtrBrightness->SetAccessibleRelationLabeledBy(mpFtBrightness.get()); //7874 + mpMtrContrast->SetAccessibleRelationLabeledBy(mpFtContrast.get()); //7874 + mpMtrTrans->SetAccessibleRelationLabeledBy(mpFtTrans.get()); //7874 + mpLBColorMode->SetAccessibleRelationLabeledBy(mpFtColorMode.get()); //7874 +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK( GraphicPropertyPanel, ModifyBrightnessHdl, void *, EMPTYARG ) +{ + sal_Int16 nBright = mpMtrBrightness->GetValue(); + SfxInt16Item aBrightItem( SID_ATTR_GRAF_LUMINANCE, nBright ); + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_GRAF_LUMINANCE, SFX_CALLMODE_RECORD, &aBrightItem, 0L); + return 0L; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK( GraphicPropertyPanel, ModifyContrastHdl, void *, EMPTYARG ) +{ + sal_Int16 nContrast = mpMtrContrast->GetValue(); + SfxInt16Item aContrastItem( SID_ATTR_GRAF_CONTRAST, nContrast ); + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_GRAF_CONTRAST, SFX_CALLMODE_RECORD, &aContrastItem, 0L); + return 0L; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK( GraphicPropertyPanel, ModifyTransHdl, void *, EMPTYARG ) +{ + sal_Int16 nTrans = mpMtrTrans->GetValue(); + SfxInt16Item aTransItem( SID_ATTR_GRAF_TRANSPARENCE, nTrans ); + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_GRAF_TRANSPARENCE, SFX_CALLMODE_RECORD, &aTransItem, 0L); + return 0L; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK_NOARG( GraphicPropertyPanel, ClickColorModeHdl ) +{ + sal_Int16 nTrans = mpLBColorMode->GetSelectEntryPos(); + SfxInt16Item aTransItem( SID_ATTR_GRAF_MODE, nTrans ); + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_GRAF_MODE, SFX_CALLMODE_RECORD, &aTransItem, 0L); + return 0L; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK( GraphicPropertyPanel, RedHdl, void*, EMPTYARG ) +{ + sal_Int16 nRed = mpMtrRed->GetValue(); + SfxInt16Item aRedItem( SID_ATTR_GRAF_RED, nRed ); + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_GRAF_RED, SFX_CALLMODE_RECORD, &aRedItem, 0L); + return 0L; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK( GraphicPropertyPanel, GreenHdl, void*, EMPTYARG ) +{ + sal_Int16 nGreen = mpMtrGreen->GetValue(); + SfxInt16Item aGreenItem( SID_ATTR_GRAF_GREEN, nGreen ); + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_GRAF_GREEN, SFX_CALLMODE_RECORD, &aGreenItem, 0L); + return 0L; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK(GraphicPropertyPanel, BlueHdl, void *, EMPTYARG) +{ + sal_Int16 nBlue = mpMtrBlue->GetValue(); + SfxInt16Item aBlueItem( SID_ATTR_GRAF_BLUE, nBlue ); + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_GRAF_BLUE, SFX_CALLMODE_RECORD, &aBlueItem, 0L); + return 0L; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK(GraphicPropertyPanel, GammaHdl, void *, EMPTYARG) +{ + sal_Int32 nGamma = mpMtrGamma->GetValue(); + SfxInt32Item nGammaItem( SID_ATTR_GRAF_GAMMA, nGamma ); + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_GRAF_GAMMA, SFX_CALLMODE_RECORD, &nGammaItem, 0L); + return 0L; +} + +////////////////////////////////////////////////////////////////////////////// + +void GraphicPropertyPanel::SetupIcons(void) +{ + if(Theme::GetBoolean(Theme::Bool_UseSymphonyIcons)) + { + // todo + } + else + { + // todo + } +} + +////////////////////////////////////////////////////////////////////////////// + +GraphicPropertyPanel* GraphicPropertyPanel::Create ( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings) +{ + if (pParent == NULL) + throw lang::IllegalArgumentException(A2S("no parent Window given to GraphicPropertyPanel::Create"), NULL, 0); + if ( ! rxFrame.is()) + throw lang::IllegalArgumentException(A2S("no XFrame given to GraphicPropertyPanel::Create"), NULL, 1); + if (pBindings == NULL) + throw lang::IllegalArgumentException(A2S("no SfxBindings given to GraphicPropertyPanel::Create"), NULL, 2); + + return new GraphicPropertyPanel( + pParent, + rxFrame, + pBindings); +} + +////////////////////////////////////////////////////////////////////////////// + +void GraphicPropertyPanel::DataChanged( + const DataChangedEvent& rEvent) +{ + (void)rEvent; + + SetupIcons(); +} + +////////////////////////////////////////////////////////////////////////////// + +void GraphicPropertyPanel::NotifyItemUpdate( + sal_uInt16 nSID, + SfxItemState eState, + const SfxPoolItem* pState) +{ + switch( nSID ) + { + case SID_ATTR_GRAF_LUMINANCE: + if( eState >= SFX_ITEM_AVAILABLE) + { + mpMtrBrightness->Enable(); + const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState); + + if(pItem) + { + sal_Int64 nBright = pItem->GetValue(); + mpMtrBrightness->SetValue(nBright); + } + } + else if( eState == SFX_ITEM_DISABLED ) + mpMtrBrightness->Disable(); + else + { + mpMtrBrightness->Enable(); + mpMtrBrightness->SetText( String()); + } + break; + case SID_ATTR_GRAF_CONTRAST: + if( eState >= SFX_ITEM_AVAILABLE) + { + mpMtrContrast->Enable(); + const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState); + + if(pItem) + { + sal_Int64 nContrast = pItem->GetValue(); + mpMtrContrast->SetValue(nContrast); + } + } + else if( eState == SFX_ITEM_DISABLED ) + mpMtrContrast->Disable(); + else + { + mpMtrContrast->Enable(); + mpMtrContrast->SetText( String()); + } + break; + case SID_ATTR_GRAF_TRANSPARENCE: + if( eState >= SFX_ITEM_AVAILABLE) + { + mpMtrTrans->Enable(); + const SfxUInt16Item* pItem = dynamic_cast< const SfxUInt16Item* >(pState); + + if(pItem) + { + sal_Int64 nTrans = pItem->GetValue(); + mpMtrTrans->SetValue(nTrans); + } + } + else if( eState == SFX_ITEM_DISABLED ) + mpMtrTrans->Disable(); + else + { + mpMtrTrans->Enable(); + mpMtrTrans->SetText( String()); + } + break; + case SID_ATTR_GRAF_MODE: + if( eState >= SFX_ITEM_AVAILABLE) + { + mpLBColorMode->Enable(); + const SfxUInt16Item* pItem = dynamic_cast< const SfxUInt16Item* >(pState); + + if(pItem) + { + sal_Int64 nTrans = pItem->GetValue(); + mpLBColorMode->SelectEntryPos(nTrans); + } + } + else if( eState == SFX_ITEM_DISABLED ) + mpLBColorMode->Disable(); + else + { + mpLBColorMode->Enable(); + mpLBColorMode->SetNoSelection(); + } + break; + case SID_ATTR_GRAF_RED: + if( eState >= SFX_ITEM_AVAILABLE) + { + mpMtrRed->Enable(); + const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState); + + if(pItem) + { + sal_Int64 nRed = pItem->GetValue(); + mpMtrRed->SetValue( nRed ); + } + } + else if( eState == SFX_ITEM_DISABLED ) + mpMtrRed->Disable(); + else + { + mpMtrRed->Enable(); + mpMtrRed->SetText( String()); + } + break; + case SID_ATTR_GRAF_GREEN: + if( eState >= SFX_ITEM_AVAILABLE) + { + mpMtrGreen->Enable(); + const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState); + + if(pItem) + { + sal_Int64 nGreen = pItem->GetValue(); + mpMtrGreen->SetValue( nGreen ); + } + } + else if( eState == SFX_ITEM_DISABLED ) + mpMtrGreen->Disable(); + else + { + mpMtrGreen->Enable(); + mpMtrGreen->SetText( String()); + } + break; + case SID_ATTR_GRAF_BLUE: + if( eState >= SFX_ITEM_AVAILABLE) + { + mpMtrBlue->Enable(); + const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState); + + if(pItem) + { + sal_Int64 nBlue = pItem->GetValue(); + mpMtrBlue->SetValue( nBlue ); + } + } + else if( eState == SFX_ITEM_DISABLED ) + mpMtrBlue->Disable(); + else + { + mpMtrBlue->Enable(); + mpMtrBlue->SetText( String()); + } + break; + case SID_ATTR_GRAF_GAMMA: + if( eState >= SFX_ITEM_AVAILABLE) + { + mpMtrGamma->Enable(); + const SfxUInt32Item* pItem = dynamic_cast< const SfxUInt32Item* >(pState); + + if(pItem) + { + sal_Int64 nGamma = pItem->GetValue(); + mpMtrGamma->SetValue( nGamma ); + } + } + else if( eState == SFX_ITEM_DISABLED ) + mpMtrGamma->Disable(); + else + { + mpMtrGamma->Enable(); + mpMtrGamma->SetText( String()); + } + break; + } +} + +////////////////////////////////////////////////////////////////////////////// + +SfxBindings* GraphicPropertyPanel::GetBindings() +{ + return mpBindings; +} + +////////////////////////////////////////////////////////////////////////////// +// namespace close + +}} // end of namespace ::svx::sidebar + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/svx/source/sidebar/graphic/GraphicPropertyPanel.hrc b/svx/source/sidebar/graphic/GraphicPropertyPanel.hrc new file mode 100644 index 000000000000..0ca1f5cee441 --- /dev/null +++ b/svx/source/sidebar/graphic/GraphicPropertyPanel.hrc @@ -0,0 +1,78 @@ +/* + * 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_SIDEBAR_GRAPHIC_PANEL-------------------------------------------------------------- +#define FT_BRIGHTNESS 1 +#define MTR_BRIGHTNESS 2 +#define FT_CONTRAST 3 +#define MTR_CONTRAST 4 +#define FT_TRANSPARENT 5 +#define MTR_TRANSPARENT 6 +#define FT_COLOR_MODE 10 +#define LB_COLOR_MODE 11 +#define MBOX_WIDTH 50 + +#define IMG_NORMAL 13 +#define IMG_BW 14 +#define IMG_GRAY 15 +#define IMG_WATER 16 +#define STR_NORMAL 17 +#define STR_BW 18 +#define STR_GRAY 19 +#define STR_WATER 20 +#define MF_RED 21 +#define MF_GREEN 22 +#define MF_BLUE 23 +#define MF_GAMMA 24 +#define IMG_RED 25 +#define IMG_GREEN 26 +#define IMG_BLUE 27 +#define IMG_GAMMA 28 + +//===========================location================================ + +#define FT_BRIGHTNESS_X SECTIONPAGE_MARGIN_HORIZONTAL +#define FT_BRIGHTNESS_Y SECTIONPAGE_MARGIN_VERTICAL_TOP +#define MTR_BRIGHTNESS_X FT_BRIGHTNESS_X +#define MTR_BRIGHTNESS_Y FT_BRIGHTNESS_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL +#define FT_CONTRAST_X FT_BRIGHTNESS_X + MBOX_WIDTH + CONTROL_SPACING_HORIZONTAL +#define FT_CONTRAST_Y FT_BRIGHTNESS_Y +#define MTR_CONTRAST_X FT_CONTRAST_X +#define MTR_CONTRAST_Y MTR_BRIGHTNESS_Y + +#define FT_COLOR_MODE_X FT_BRIGHTNESS_X +#define FT_COLOR_MODE_Y MTR_BRIGHTNESS_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL +#define LBX_COLOR_MODE_X FT_COLOR_MODE_X +#define LBX_COLOR_MODE_Y FT_COLOR_MODE_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + +#define FT_TRANSPARENT_X FT_CONTRAST_X +#define FT_TRANSPARENT_Y MTR_CONTRAST_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL +#define MTR_TRANS_X FT_TRANSPARENT_X +#define MTR_TRANS_Y FT_TRANSPARENT_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + +#define MF_RED_X SECTIONPAGE_MARGIN_HORIZONTAL +#define MF_RED_Y MTR_TRANS_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL +#define MF_GREEN_X MF_RED_X + MBOX_WIDTH + CONTROL_SPACING_HORIZONTAL +#define MF_GREEN_Y MF_RED_Y +#define MF_BLUE_X MF_RED_X +#define MF_BLUE_Y MF_RED_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL +#define MF_GAMMA_X MF_GREEN_X +#define MF_GAMMA_Y MF_BLUE_Y + +#define PAGE_HEIGHT MF_GAMMA_Y + MBOX_HEIGHT + SECTIONPAGE_MARGIN_VERTICAL_BOT + +// eof diff --git a/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx b/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx new file mode 100644 index 000000000000..c5bd01cd9bf4 --- /dev/null +++ b/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx @@ -0,0 +1,123 @@ +/* + * 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 SVX_PROPERTYPANEL_GRAPHICPAGE_HXX +#define SVX_PROPERTYPANEL_GRAPHICPAGE_HXX + +#include <vcl/ctrl.hxx> +#include <sfx2/sidebar/SidebarPanelBase.hxx> +#include <sfx2/sidebar/ControllerItem.hxx> +#include <vcl/fixed.hxx> +#include <boost/scoped_ptr.hpp> + +class FixedText; +class MetricField; +class ListBox; +class FloatingWindow; + + +namespace svx { namespace sidebar { + +class GraphicPropertyPanel +: public Control, + public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface +{ +public: + static GraphicPropertyPanel* Create( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings); + + virtual void DataChanged( + const DataChangedEvent& rEvent); + + virtual void NotifyItemUpdate( + const sal_uInt16 nSId, + const SfxItemState eState, + const SfxPoolItem* pState); + + SfxBindings* GetBindings(); + +private: + //ui controls + ::boost::scoped_ptr< FixedText > mpFtBrightness; + ::boost::scoped_ptr< MetricField > mpMtrBrightness; + ::boost::scoped_ptr< FixedText > mpFtContrast; + ::boost::scoped_ptr< MetricField > mpMtrContrast; + ::boost::scoped_ptr< FixedText > mpFtColorMode; + ::boost::scoped_ptr< ListBox > mpLBColorMode; + ::boost::scoped_ptr< FixedText > mpFtTrans; + ::boost::scoped_ptr< MetricField > mpMtrTrans; + ::boost::scoped_ptr< MetricField > mpMtrRed; + ::boost::scoped_ptr< MetricField > mpMtrGreen; + ::boost::scoped_ptr< MetricField > mpMtrBlue; + ::boost::scoped_ptr< MetricField > mpMtrGamma; + + ::sfx2::sidebar::ControllerItem maBrightControl; + ::sfx2::sidebar::ControllerItem maContrastControl; + ::sfx2::sidebar::ControllerItem maTransparenceControl; + ::sfx2::sidebar::ControllerItem maRedControl; + ::sfx2::sidebar::ControllerItem maGreenControl; + ::sfx2::sidebar::ControllerItem maBlueControl; + ::sfx2::sidebar::ControllerItem maGammaControl; + ::sfx2::sidebar::ControllerItem maModeControl; + + Image maImgNormal; + Image maImgBW; + Image maImgGray; + Image maImgWater; + + FixedImage maImgRed; + FixedImage maImgGreen; + FixedImage maImgBlue; + FixedImage maImgGamma; + + String msNormal; + String msBW; + String msGray; + String msWater; + + cssu::Reference<css::frame::XFrame> mxFrame; + SfxBindings* mpBindings; + + DECL_LINK( ModifyBrightnessHdl, void * ); + DECL_LINK( ModifyContrastHdl, void * ); + DECL_LINK( ModifyTransHdl, void * ); + DECL_LINK( ClickColorModeHdl, void * ); + DECL_LINK( ImplPopupModeEndHdl, FloatingWindow* ); + DECL_LINK( RedHdl, void*); + DECL_LINK( GreenHdl, void*); + DECL_LINK( BlueHdl, void*); + DECL_LINK( GammaHdl, void*); + + // constructor/destuctor + GraphicPropertyPanel( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings); + virtual ~GraphicPropertyPanel(); + + void SetupIcons(void); + void Initialize(); +}; + + +} } // end of namespace ::svx::sidebar + +#endif + +// eof diff --git a/svx/source/sidebar/graphic/GraphicPropertyPanel.src b/svx/source/sidebar/graphic/GraphicPropertyPanel.src new file mode 100644 index 000000000000..4946b61a656c --- /dev/null +++ b/svx/source/sidebar/graphic/GraphicPropertyPanel.src @@ -0,0 +1,253 @@ +/* + * 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 "GraphicPropertyPanel.hrc" +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include <svx/dialogs.hrc> +#include "helpid.hrc" + +Control RID_SIDEBAR_GRAPHIC_PANEL +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + + Size = MAP_APPFONT( PROPERTYPAGE_WIDTH, PAGE_HEIGHT ); + HelpID = HID_PROPERTYPANEL_GRAPHIC_SECTION ; + Text = "Graphic"; + + FixedText FT_BRIGHTNESS + { + Pos = MAP_APPFONT ( FT_BRIGHTNESS_X, FT_BRIGHTNESS_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH , TEXT_HEIGHT ) ; + Text [ en-US ] = "~Brightness:"; + }; + MetricField MTR_BRIGHTNESS + { + Border = TRUE ; + Pos = MAP_APPFONT ( MTR_BRIGHTNESS_X, MTR_BRIGHTNESS_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH , MBOX_HEIGHT ) ; + HelpID = HID_PROPERTY_PANEL_GRAPHIC_MTR_BRIGHT; + QuickHelpText [ en-US ] = "Specify the luminance of the graphic."; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + Minimum = -100 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + SpinSize = 1 ; + }; + FixedText FT_CONTRAST + { + Pos = MAP_APPFONT ( FT_CONTRAST_X, FT_CONTRAST_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH, TEXT_HEIGHT ) ; + Text [ en-US ] = "~Contrast:"; + }; + MetricField MTR_CONTRAST + { + Border = TRUE ; + Pos = MAP_APPFONT ( MTR_CONTRAST_X, MTR_CONTRAST_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH , MBOX_HEIGHT ) ; + HelpID = HID_PROPERTY_PANEL_GRAPHIC_MTR_CONTRAST; + QuickHelpText [ en-US ] = "Specify the degree of difference between the lightest and darkest parts of the graphic."; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + Minimum = -100 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + SpinSize = 1 ; + }; + FixedText FT_COLOR_MODE + { + Pos = MAP_APPFONT ( FT_COLOR_MODE_X, FT_COLOR_MODE_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH, TEXT_HEIGHT ) ; + Text [ en-US ] = "Color ~mode:"; + }; + ListBox LB_COLOR_MODE + { + Border = TRUE ; + Pos = MAP_APPFONT ( LBX_COLOR_MODE_X , LBX_COLOR_MODE_Y ) ; + Size = MAP_APPFONT ( MBOX_WIDTH , 100 ) ; + HelpID = HID_PROPERTY_PANEL_GRAPHIC_LB_COLORMODE; + QuickHelpText [ en-US ] = "Select the color mode of the graphic."; + TabStop = TRUE ; + DropDown = TRUE ; + }; + FixedText FT_TRANSPARENT + { + Pos = MAP_APPFONT ( FT_TRANSPARENT_X, FT_TRANSPARENT_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH , TEXT_HEIGHT ) ; + Text [ en-US ] = "~Transparency:"; + }; + MetricField MTR_TRANSPARENT + { + Border = TRUE ; + Pos = MAP_APPFONT ( MTR_TRANS_X, MTR_TRANS_Y ) ; + Size = MAP_APPFONT ( MBOX_WIDTH ,MBOX_HEIGHT ) ; + HelpID = HID_PROPERTY_PANEL_GRAPHIC_MTR_TRANSP; + QuickHelpText [ en-US ] = "Specify the percentage of transparency; 0% is fully opaque and 100% is fully transparent."; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + SpinSize = 1 ; + }; + MetricField MF_RED + { + Border = TRUE ; + Pos = MAP_APPFONT ( MF_RED_X + 10, MF_RED_Y ) ; + Size = MAP_APPFONT ( MBOX_WIDTH - 10,MBOX_HEIGHT ) ; + HelpID = HID_PROPERTY_PANEL_GRAPHIC_MTR_RED; + QuickHelpText [ en-US ] = "Red"; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + Minimum = -100 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + SpinSize = 1 ; + }; + MetricField MF_GREEN + { + Border = TRUE ; + Pos = MAP_APPFONT ( MF_GREEN_X + 10, MF_GREEN_Y ) ; + Size = MAP_APPFONT ( MBOX_WIDTH - 10 ,MBOX_HEIGHT ) ; + HelpID = HID_PROPERTY_PANEL_GRAPHIC_MTR_GREEN; + QuickHelpText [ en-US ] = "Green"; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + Minimum = -100 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + SpinSize = 1 ; + }; + MetricField MF_BLUE + { + Border = TRUE ; + Pos = MAP_APPFONT ( MF_BLUE_X + 10, MF_BLUE_Y ) ; + Size = MAP_APPFONT ( MBOX_WIDTH - 10 ,MBOX_HEIGHT ) ; + HelpID = HID_PROPERTY_PANEL_GRAPHIC_MTR_BLUE; + QuickHelpText [ en-US ] = "Blue"; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + Minimum = -100 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + SpinSize = 1 ; + }; + MetricField MF_GAMMA + { + Border = TRUE ; + Pos = MAP_APPFONT ( MF_GAMMA_X + 10, MF_GAMMA_Y ) ; + Size = MAP_APPFONT ( MBOX_WIDTH - 10 ,MBOX_HEIGHT ) ; + HelpID = HID_PROPERTY_PANEL_GRAPHIC_MTR_GAMMA; + QuickHelpText [ en-US ] = "Specify the gamma value that affects the brightness of the midtone values."; + TabStop = TRUE; + Repeat = TRUE; + Spin = TRUE; + Minimum = 10; + Maximum = 1000; + DecimalDigits = 2; + SpinSize = 10; + }; + Image IMG_NORMAL + { + ImageBitmap = Bitmap{File = "symphony/ColorModeNormal_16x16.png";}; + }; + Image IMG_BW + { + ImageBitmap = Bitmap{File = "symphony/ColorModeBlackWhite_16x16.png";}; + }; + Image IMG_GRAY + { + ImageBitmap = Bitmap{File = "symphony/ColorModeGrey_16x16.png";}; + }; + Image IMG_WATER + { + ImageBitmap = Bitmap{File = "symphony/ColorModeWaterMark_16x16.png";}; + }; + FixedImage IMG_RED + { + Pos = MAP_APPFONT( MF_RED_X, MF_RED_Y ); + Size = MAP_APPFONT( 10, 12 ); + Fixed = Image + { + ImageBitmap = Bitmap { File = "symphony/AdjustColorRed_16x16.png"; }; + }; + }; + FixedImage IMG_GREEN + { + Pos = MAP_APPFONT( MF_GREEN_X, MF_GREEN_Y ); + Size = MAP_APPFONT( 10, 12 ); + Fixed = Image + { + ImageBitmap = Bitmap { File = "symphony/AdjustColorGreen_16x16.png"; }; + }; + }; + FixedImage IMG_BLUE + { + Pos = MAP_APPFONT( MF_BLUE_X, MF_BLUE_Y ); + Size = MAP_APPFONT( 10, 12 ); + Fixed = Image + { + ImageBitmap = Bitmap { File = "symphony/AdjustColorBlue_16x16.png"; }; + }; + }; + FixedImage IMG_GAMMA + { + Pos = MAP_APPFONT( MF_GAMMA_X, MF_GAMMA_Y ); + Size = MAP_APPFONT( 10, 12 ); + Fixed = Image + { + ImageBitmap = Bitmap { File = "symphony/AdjustColorGamma_16x16.png"; }; + }; + }; + String STR_NORMAL + { + Text [ en-US ] = "Normal"; + }; + String STR_BW + { + Text [ en-US ] = "Black/White"; + }; + String STR_GRAY + { + Text [ en-US ] = "Grayscale"; + }; + String STR_WATER + { + Text [ en-US ] = "Watermark"; + }; +}; + +// eof diff --git a/svx/source/sidebar/line/LinePropertyPanel.cxx b/svx/source/sidebar/line/LinePropertyPanel.cxx new file mode 100644 index 000000000000..74fdb7afbd83 --- /dev/null +++ b/svx/source/sidebar/line/LinePropertyPanel.cxx @@ -0,0 +1,1143 @@ +/* + * 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 <LinePropertyPanel.hxx> +#include <LinePropertyPanel.hrc> +#include <svx/dialogs.hrc> +#include <svx/dialmgr.hxx> +#include <sfx2/objsh.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <svx/xlnclit.hxx> +#include <svx/xtable.hxx> +#include <svx/xdash.hxx> +#include <svx/drawitem.hxx> +#include <svx/svxitems.hrc> +#include <svtools/valueset.hxx> +#include <unotools/pathoptions.hxx> +#include <unotools/viewoptions.hxx> +#include <comphelper/processfactory.hxx> +#include <i18nlangtag/mslangid.hxx> +#include <svx/xlineit0.hxx> +#include <svx/xlndsit.hxx> +#include <vcl/svapp.hxx> +#include <svx/xlnwtit.hxx> +#include <vcl/lstbox.hxx> +#include <svx/tbxcolorupdate.hxx> +#include <vcl/toolbox.hxx> +#include <svx/xlntrit.hxx> +#include <svx/xlnstit.hxx> +#include <svx/xlnedit.hxx> +#include <svx/xlncapit.hxx> +#include <svx/xlinjoit.hxx> +#include "svx/sidebar/PopupContainer.hxx" +#include "svx/sidebar/PopupControl.hxx" +#include <svx/sidebar/ColorControl.hxx> +#include "LineWidthControl.hxx" +#include <boost/bind.hpp> + +using namespace css; +using namespace cssu; +using ::sfx2::sidebar::Theme; + +#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) + +namespace { + short GetItemId_Impl_line( ValueSet& rValueSet, const Color& rCol ) + { + if(rCol == COL_AUTO) + return 0; + + bool bFound = false; + sal_uInt16 nCount = rValueSet.GetItemCount(); + sal_uInt16 n = 1; + + while ( !bFound && n <= nCount ) + { + Color aValCol = rValueSet.GetItemColor(n); + + bFound = ( aValCol.GetRed() == rCol.GetRed() + && aValCol.GetGreen() == rCol.GetGreen() + && aValCol.GetBlue() == rCol.GetBlue() ); + + if ( !bFound ) + n++; + } + return bFound ? n : -1; + } + + Color GetTransparentColor (void) + { + return COL_TRANSPARENT; + } + + void FillLineEndListBox(ListBox& rListBoxStart, ListBox& rListBoxEnd, const XLineEndList& rList) + { + const sal_uInt32 nCount(rList.Count()); + const String sNone(SVX_RES(RID_SVXSTR_NONE)); + + rListBoxStart.SetUpdateMode(false); + rListBoxEnd.SetUpdateMode(false); + + rListBoxStart.Clear(); + rListBoxEnd.Clear(); + + // add 'none' entries + rListBoxStart.InsertEntry(sNone); + rListBoxEnd.InsertEntry(sNone); + + for(sal_uInt32 i(0); i < nCount; i++) + { + XLineEndEntry* pEntry = rList.GetLineEnd(i); + const Bitmap aBitmap = const_cast< XLineEndList& >(rList).GetUiBitmap(i); + + if(!aBitmap.IsEmpty()) + { + Bitmap aCopyStart(aBitmap); + Bitmap aCopyEnd(aBitmap); + // delete pBitmap; + const Size aBmpSize(aCopyStart.GetSizePixel()); + const Rectangle aCropRectStart(Point(), Size(aBmpSize.Width() / 2, aBmpSize.Height())); + const Rectangle aCropRectEnd(Point(aBmpSize.Width() / 2, 0), Size(aBmpSize.Width() / 2, aBmpSize.Height())); + + aCopyStart.Crop(aCropRectStart); + rListBoxStart.InsertEntry( + pEntry->GetName(), + aCopyStart); + + aCopyEnd.Crop(aCropRectEnd); + rListBoxEnd.InsertEntry( + pEntry->GetName(), + aCopyEnd); + } + else + { + rListBoxStart.InsertEntry(pEntry->GetName()); + rListBoxEnd.InsertEntry(pEntry->GetName()); + } + } + + rListBoxStart.SetUpdateMode(true); + rListBoxEnd.SetUpdateMode(true); + } + + void FillLineStyleListBox(ListBox& rListBox, const XDashList& rList) + { + const sal_uInt32 nCount(rList.Count()); + rListBox.SetUpdateMode(false); + + rListBox.Clear(); + + // entry for 'none' + rListBox.InsertEntry(rList.GetStringForUiNoLine()); + + // entry for solid line + rListBox.InsertEntry(rList.GetStringForUiSolidLine(), rList.GetBitmapForUISolidLine()); + + for(sal_uInt32 i(0); i < nCount; i++) + { + XDashEntry* pEntry = rList.GetDash(i); + const Bitmap aBitmap = const_cast< XDashList& >(rList).GetUiBitmap(i); + + if(!aBitmap.IsEmpty()) + { + rListBox.InsertEntry( + pEntry->GetName(), + aBitmap); + // delete pBitmap; + } + else + { + rListBox.InsertEntry(pEntry->GetName()); + } + } + + rListBox.SetUpdateMode(true); + } +} // end of anonymous namespace + +// namespace open + +namespace svx { namespace sidebar { + +LinePropertyPanel::LinePropertyPanel( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings) +: Control( + pParent, + SVX_RES(RID_SIDEBAR_LINE_PANEL)), + mpFTWidth(new FixedText(this, SVX_RES(FT_WIDTH))), + mpTBWidthBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), + mpTBWidth(sfx2::sidebar::ControlFactory::CreateToolBox(mpTBWidthBackground.get(), SVX_RES(TB_WIDTH))), + mpFTColor(new FixedText(this, SVX_RES(FT_COLOR))), + mpTBColorBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), + mpTBColor(sfx2::sidebar::ControlFactory::CreateToolBox(mpTBColorBackground.get(), SVX_RES(TB_COLOR))), + mpFTStyle(new FixedText(this, SVX_RES(FT_STYLE))), + mpLBStyle(new ListBox(this, SVX_RES(LB_STYLE))), + mpFTTrancparency(new FixedText(this, SVX_RES(FT_TRANSPARENT))), + mpMFTransparent(new MetricField(this, SVX_RES(MF_TRANSPARENT))), + mpFTArrow(new FixedText(this, SVX_RES(FT_ARROW))), + mpLBStart(new ListBox(this, SVX_RES(LB_START))), + mpLBEnd(new ListBox(this, SVX_RES(LB_END))), + mpFTEdgeStyle(new FixedText(this, SVX_RES(FT_EDGESTYLE))), + mpLBEdgeStyle(new ListBox(this, SVX_RES(LB_EDGESTYLE))), + mpFTCapStyle(new FixedText(this, SVX_RES(FT_CAPSTYLE))), + mpLBCapStyle(new ListBox(this, SVX_RES(LB_CAPSTYLE))), + maStyleControl(SID_ATTR_LINE_STYLE, *pBindings, *this), + maDashControl (SID_ATTR_LINE_DASH, *pBindings, *this), + maWidthControl(SID_ATTR_LINE_WIDTH, *pBindings, *this), + maColorControl(SID_ATTR_LINE_COLOR, *pBindings, *this), + maStartControl(SID_ATTR_LINE_START, *pBindings, *this), + maEndControl(SID_ATTR_LINE_END, *pBindings, *this), + maLineEndListControl(SID_LINEEND_LIST, *pBindings, *this), + maLineStyleListControl(SID_DASH_LIST, *pBindings, *this), + maTransControl(SID_ATTR_LINE_TRANSPARENCE, *pBindings, *this), + maEdgeStyle(SID_ATTR_LINE_JOINT, *pBindings, *this), + maCapStyle(SID_ATTR_LINE_CAP, *pBindings, *this), + maColor(COL_BLACK), + mpColorUpdater(new ::svx::ToolboxButtonColorUpdater(SID_ATTR_LINE_COLOR, TBI_COLOR, mpTBColor.get(), TBX_UPDATER_MODE_CHAR_COLOR_NEW)), + mpStyleItem(), + mpDashItem(), + mnTrans(0), + meMapUnit(SFX_MAPUNIT_MM), + mnWidthCoreValue(0), + mpStartItem(0), + mpEndItem(0), + maColorPopup(this, ::boost::bind(&LinePropertyPanel::CreateColorPopupControl, this, _1)), + maLineWidthPopup(this, ::boost::bind(&LinePropertyPanel::CreateLineWidthPopupControl, this, _1)), + maIMGColor(SVX_RES(IMG_COLOR)), + maIMGNone(SVX_RES(IMG_NONE_ICON)), + mpIMGWidthIcon(), + mxFrame(rxFrame), + mpBindings(pBindings), + mbColorAvailable(true), + mbStyleAvailable(false), + mbDashAvailable(false), + mbTransAvailable(true), + mbWidthValuable(true), + mbStartAvailable(true), + mbEndAvailable(true) +{ + Initialize(); + FreeResource(); +} + + + +LinePropertyPanel::~LinePropertyPanel() +{ + // Destroy the toolboxes, then their background windows. + mpTBWidth.reset(); + mpTBColor.reset(); + + mpTBWidthBackground.reset(); + mpTBColorBackground.reset(); +} + + + +void LinePropertyPanel::Initialize() +{ + mpFTWidth->SetBackground(Wallpaper()); + mpFTColor->SetBackground(Wallpaper()); + mpFTStyle->SetBackground(Wallpaper()); + mpFTTrancparency->SetBackground(Wallpaper()); + mpFTArrow->SetBackground(Wallpaper()); + mpFTEdgeStyle->SetBackground(Wallpaper()); + mpFTCapStyle->SetBackground(Wallpaper()); + + mpIMGWidthIcon.reset(new Image[8]); + mpIMGWidthIcon[0] = Image(SVX_RES(IMG_WIDTH1_ICON)); + mpIMGWidthIcon[1] = Image(SVX_RES(IMG_WIDTH2_ICON)); + mpIMGWidthIcon[2] = Image(SVX_RES(IMG_WIDTH3_ICON)); + mpIMGWidthIcon[3] = Image(SVX_RES(IMG_WIDTH4_ICON)); + mpIMGWidthIcon[4] = Image(SVX_RES(IMG_WIDTH5_ICON)); + mpIMGWidthIcon[5] = Image(SVX_RES(IMG_WIDTH6_ICON)); + mpIMGWidthIcon[6] = Image(SVX_RES(IMG_WIDTH7_ICON)); + mpIMGWidthIcon[7] = Image(SVX_RES(IMG_WIDTH8_ICON)); + + meMapUnit = maWidthControl.GetCoreMetric(); + + mpTBColor->SetItemImage(TBI_COLOR, maIMGColor); + Size aTbxSize( mpTBColor->CalcWindowSizePixel() ); + mpTBColor->SetOutputSizePixel( aTbxSize ); + mpTBColor->SetItemBits( TBI_COLOR, mpTBColor->GetItemBits( TBI_COLOR ) | TIB_DROPDOWNONLY ); + mpTBColor->SetQuickHelpText(TBI_COLOR,String(SVX_RES(STR_QH_TB_COLOR))); //Add + mpTBColor->SetBackground(Wallpaper()); + mpTBColor->SetPaintTransparent(true); + Link aLink = LINK(this, LinePropertyPanel, ToolboxColorSelectHdl); + mpTBColor->SetDropdownClickHdl ( aLink ); + mpTBColor->SetSelectHdl ( aLink ); + + FillLineStyleList(); + SelectLineStyle(); + aLink = LINK( this, LinePropertyPanel, ChangeLineStyleHdl ); + mpLBStyle->SetSelectHdl( aLink ); + mpLBStyle->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Style"))); + mpLBStyle->SetDropDownLineCount(std::min(sal_uInt16(20), mpLBStyle->GetEntryCount())); + + mpTBWidth->SetItemImage(TBI_WIDTH, mpIMGWidthIcon[0]); + aTbxSize = mpTBWidth->CalcWindowSizePixel() ; + mpTBWidth->SetOutputSizePixel( aTbxSize ); + mpTBWidth->SetItemBits( TBI_WIDTH, mpTBWidth->GetItemBits( TBI_WIDTH ) | TIB_DROPDOWNONLY ); + mpTBWidth->SetQuickHelpText(TBI_WIDTH,String(SVX_RES(STR_QH_TB_WIDTH))); //Add + mpTBWidth->SetBackground(Wallpaper()); + mpTBWidth->SetPaintTransparent(true); + aLink = LINK(this, LinePropertyPanel, ToolboxWidthSelectHdl); + mpTBWidth->SetDropdownClickHdl ( aLink ); + mpTBWidth->SetSelectHdl ( aLink ); + + FillLineEndList(); + SelectEndStyle(true); + SelectEndStyle(false); + aLink = LINK( this, LinePropertyPanel, ChangeStartHdl ); + mpLBStart->SetSelectHdl( aLink ); + mpLBStart->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Beginning Style"))); //wj acc + mpLBStart->SetDropDownLineCount(std::min(sal_uInt16(20), mpLBStart->GetEntryCount())); + aLink = LINK( this, LinePropertyPanel, ChangeEndHdl ); + mpLBEnd->SetSelectHdl( aLink ); + mpLBEnd->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Ending Style"))); //wj acc + mpLBEnd->SetDropDownLineCount(std::min(sal_uInt16(20), mpLBEnd->GetEntryCount())); + + aLink = LINK(this, LinePropertyPanel, ChangeTransparentHdl); + mpMFTransparent->SetModifyHdl(aLink); + mpMFTransparent->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Transparency"))); //wj acc + + mpTBWidth->SetAccessibleRelationLabeledBy(mpFTWidth.get()); + mpTBColor->SetAccessibleRelationLabeledBy(mpFTColor.get()); + mpLBStyle->SetAccessibleRelationLabeledBy(mpFTStyle.get()); + mpMFTransparent->SetAccessibleRelationLabeledBy(mpFTTrancparency.get()); + mpLBStart->SetAccessibleRelationLabeledBy(mpFTArrow.get()); + mpLBEnd->SetAccessibleRelationLabeledBy(mpLBEnd.get()); + + aLink = LINK( this, LinePropertyPanel, ChangeEdgeStyleHdl ); + mpLBEdgeStyle->SetSelectHdl( aLink ); + mpLBEdgeStyle->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Corner Style"))); + + aLink = LINK( this, LinePropertyPanel, ChangeCapStyleHdl ); + mpLBCapStyle->SetSelectHdl( aLink ); + mpLBCapStyle->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Cap Style"))); +} + + + +void LinePropertyPanel::SetupIcons(void) +{ + if(Theme::GetBoolean(Theme::Bool_UseSymphonyIcons)) + { + // todo + } + else + { + // todo + } +} + + + +LinePropertyPanel* LinePropertyPanel::Create ( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings) +{ + if (pParent == NULL) + throw lang::IllegalArgumentException(A2S("no parent Window given to LinePropertyPanel::Create"), NULL, 0); + if ( ! rxFrame.is()) + throw lang::IllegalArgumentException(A2S("no XFrame given to LinePropertyPanel::Create"), NULL, 1); + if (pBindings == NULL) + throw lang::IllegalArgumentException(A2S("no SfxBindings given to LinePropertyPanel::Create"), NULL, 2); + + return new LinePropertyPanel( + pParent, + rxFrame, + pBindings); +} + + + + +void LinePropertyPanel::DataChanged( + const DataChangedEvent& rEvent) +{ + (void)rEvent; + + SetupIcons(); +} + + + + +void LinePropertyPanel::NotifyItemUpdate( + sal_uInt16 nSID, + SfxItemState eState, + const SfxPoolItem* pState) +{ + switch(nSID) + { + case SID_ATTR_LINE_COLOR: + { + if( eState == SFX_ITEM_DISABLED) + { + mpFTColor->Disable(); + mpTBColor->Disable(); + mbColorAvailable = false; + mpColorUpdater->Update(COL_WHITE); + } + else + { + mpFTColor->Enable(); + mpTBColor->Enable(); + const XLineColorItem* pItem = dynamic_cast< const XLineColorItem* >(pState); + + if(eState >= SFX_ITEM_DEFAULT && pItem) + { + maColor = pItem->GetColorValue(); + mbColorAvailable = true; + mpColorUpdater->Update(maColor); + } + else + { + mbColorAvailable = false; + mpColorUpdater->Update(COL_WHITE); + } + } + break; + } + case SID_ATTR_LINE_DASH: + case SID_ATTR_LINE_STYLE: + { + if( eState == SFX_ITEM_DISABLED) + { + mpFTStyle->Disable(); + mpLBStyle->Disable(); + } + else + { + mpFTStyle->Enable(); + mpLBStyle->Enable(); + if( eState >= SFX_ITEM_DEFAULT ) + { + if(nSID == SID_ATTR_LINE_STYLE) + { + const XLineStyleItem* pItem = dynamic_cast< const XLineStyleItem* >(pState); + + if(pItem) + { + mbStyleAvailable =true; + mpStyleItem.reset(pState ? (XLineStyleItem*)pItem->Clone() : 0); + } + } + else if(nSID == SID_ATTR_LINE_DASH) + { + const XLineDashItem* pItem = dynamic_cast< const XLineDashItem* >(pState); + + if(pItem) + { + mbDashAvailable = true; + mpDashItem.reset(pState ? (XLineDashItem*)pItem->Clone() : 0); + } + } + } + else + { + if(nSID == SID_ATTR_LINE_STYLE) + mbStyleAvailable = false; + else + mbDashAvailable = false; + } + + SelectLineStyle(); + } + break; + } + case SID_ATTR_LINE_TRANSPARENCE: + { + if( eState == SFX_ITEM_DISABLED ) + { + mpFTTrancparency->Disable(); + mpMFTransparent->Disable(); + mpMFTransparent->SetValue(0);//add + mpMFTransparent->SetText(String()); + mbTransAvailable = false; + } + else + { + mpFTTrancparency->Enable(); + mpMFTransparent->Enable(); + mbTransAvailable = true; + const XLineTransparenceItem* pItem = dynamic_cast< const XLineTransparenceItem* >(pState); + + if(eState != SFX_ITEM_DONTCARE && pItem) + { + mnTrans = pItem->GetValue(); + mpMFTransparent->SetValue(mnTrans); + } + else + { + mpMFTransparent->SetValue(0);//add + mpMFTransparent->SetText(String()); + } + } + break; + } + case SID_ATTR_LINE_WIDTH: + { + if(eState == SFX_ITEM_DISABLED) + { + mpTBWidth->Disable(); + mpFTWidth->Disable(); + } + else + { + //enable + mpTBWidth->Enable(); + mpFTWidth->Enable(); + const XLineWidthItem* pItem = dynamic_cast< const XLineWidthItem* >(pState); + + if(eState >= SFX_ITEM_AVAILABLE && pItem) + { + mnWidthCoreValue = pItem->GetValue(); + mbWidthValuable = true; + } + else + { + mbWidthValuable = false; + } + } + SetWidthIcon(); + break; + } + case SID_ATTR_LINE_START: + { + mpFTArrow->Enable(); + mpLBStart->Enable(); + + if(eState != SFX_ITEM_DONTCARE) + { + const XLineStartItem* pItem = dynamic_cast< const XLineStartItem* >(pState); + + if(pItem) + { + mbStartAvailable = true; //add + mpStartItem.reset(pItem ? (XLineStartItem*)pItem->Clone() : 0); + SelectEndStyle(true); + break; + } + } + + mpLBStart->SetNoSelection(); + mbStartAvailable = false; //add + break; + } + case SID_ATTR_LINE_END: + { + mpFTArrow->Enable(); + mpLBEnd->Enable(); + + if(eState != SFX_ITEM_DONTCARE) + { + const XLineEndItem* pItem = dynamic_cast< const XLineEndItem* >(pState); + + if(pItem) + { + mbEndAvailable = true; //add + mpEndItem.reset(pItem ? (XLineEndItem*)pItem->Clone() : 0); + SelectEndStyle(false); + break; + } + } + + mpLBEnd->SetNoSelection(); + mbEndAvailable = false; //add + break; + } + case SID_LINEEND_LIST: + { + FillLineEndList(); + SelectEndStyle(true); + SelectEndStyle(false); + break; + } + case SID_DASH_LIST: + { + FillLineStyleList(); + SelectLineStyle(); + break; + } + case SID_ATTR_LINE_JOINT: + { + if(eState == SFX_ITEM_DISABLED) + { + mpLBEdgeStyle->Disable(); + } + else + { + mpLBEdgeStyle->Enable(); + const XLineJointItem* pItem = dynamic_cast< const XLineJointItem* >(pState); + sal_uInt16 nEntryPos(0); + + if(eState >= SFX_ITEM_AVAILABLE && pItem) + { + switch(pItem->GetValue()) + { + case com::sun::star::drawing::LineJoint_MIDDLE: + case com::sun::star::drawing::LineJoint_ROUND: + { + nEntryPos = 1; + break; + } + case com::sun::star::drawing::LineJoint_NONE: + { + nEntryPos = 2; + break; + } + case com::sun::star::drawing::LineJoint_MITER: + { + nEntryPos = 3; + break; + } + case com::sun::star::drawing::LineJoint_BEVEL: + { + nEntryPos = 4; + break; + } + + default: + break; + } + } + + if(nEntryPos) + { + mpLBEdgeStyle->SelectEntryPos(nEntryPos - 1); + } + else + { + mpLBEdgeStyle->SetNoSelection(); + } + } + break; + } + case SID_ATTR_LINE_CAP: + { + if(eState == SFX_ITEM_DISABLED) + { + mpLBCapStyle->Disable(); + } + else + { + mpLBCapStyle->Enable(); + const XLineCapItem* pItem = dynamic_cast< const XLineCapItem* >(pState); + sal_uInt16 nEntryPos(0); + + if(eState >= SFX_ITEM_AVAILABLE && pItem) + { + switch(pItem->GetValue()) + { + case com::sun::star::drawing::LineCap_BUTT: + { + nEntryPos = 1; + break; + } + case com::sun::star::drawing::LineCap_ROUND: + { + nEntryPos = 2; + break; + } + case com::sun::star::drawing::LineCap_SQUARE: + { + nEntryPos = 3; + break; + } + + default: + break; + } + } + + if(nEntryPos) + { + mpLBCapStyle->SelectEntryPos(nEntryPos - 1); + } + else + { + mpLBCapStyle->SetNoSelection(); + } + } + break; + } + } +} + + + +SfxBindings* LinePropertyPanel::GetBindings() +{ + return mpBindings; +} + + + +IMPL_LINK( LinePropertyPanel, ImplPopupModeEndHdl, FloatingWindow*, EMPTYARG ) +{ + return 0; +} + + + + +IMPL_LINK(LinePropertyPanel, ToolboxColorSelectHdl,ToolBox*, pToolBox) +{ + sal_uInt16 nId = pToolBox->GetCurItemId(); + if(nId == TBI_COLOR) + { + maColorPopup.Show(*pToolBox); + maColorPopup.SetCurrentColor(maColor, mbColorAvailable); + } + return 0; +} + + + + +IMPL_LINK_NOARG(LinePropertyPanel, ChangeLineStyleHdl) +{ + const sal_uInt16 nPos(mpLBStyle->GetSelectEntryPos()); + + if(LISTBOX_ENTRY_NOTFOUND != nPos && nPos != mpLBStyle->GetSavedValue()) + { + if(0 == nPos) + { + // XLINE_NONE + const XLineStyleItem aItem(XLINE_NONE); + + GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_STYLE, SFX_CALLMODE_RECORD, &aItem, 0L); + } + else if(1 == nPos) + { + // XLINE_SOLID + const XLineStyleItem aItem(XLINE_SOLID); + + GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_STYLE, SFX_CALLMODE_RECORD, &aItem, 0L); + } + else if (mxLineStyleList.is() && mxLineStyleList->Count() > (long)(nPos - 2)) + { + // XLINE_DASH + const XLineStyleItem aItemA(XLINE_DASH); + const XLineDashItem aItemB(mpLBStyle->GetSelectEntry(), mxLineStyleList->GetDash(nPos - 2)->GetDash()); + + GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_STYLE, SFX_CALLMODE_RECORD, &aItemA, 0L); + GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_DASH, SFX_CALLMODE_RECORD, &aItemB, 0L); + } + } + + return 0; +} + + + +IMPL_LINK(LinePropertyPanel, ChangeStartHdl, void*, EMPTYARG) +{ + sal_uInt16 nPos = mpLBStart->GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND && nPos != mpLBStart->GetSavedValue() ) + { + XLineStartItem* pItem = NULL; + if( nPos == 0 ) + pItem = new XLineStartItem(); + else if( mxLineEndList.is() && mxLineEndList->Count() > (long) ( nPos - 1 ) ) + pItem = new XLineStartItem( mpLBStart->GetSelectEntry(),mxLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ); + GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINEEND_STYLE, SFX_CALLMODE_RECORD, pItem, 0L); + delete pItem; + } + return 0; +} + + + + +IMPL_LINK(LinePropertyPanel, ChangeEndHdl, void*, EMPTYARG) +{ + sal_uInt16 nPos = mpLBEnd->GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND && nPos != mpLBEnd->GetSavedValue() ) + { + XLineEndItem* pItem = NULL; + if( nPos == 0 ) + pItem = new XLineEndItem(); + else if( mxLineEndList.is() && mxLineEndList->Count() > (long) ( nPos - 1 ) ) + pItem = new XLineEndItem( mpLBEnd->GetSelectEntry(), mxLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ); + GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINEEND_STYLE, SFX_CALLMODE_RECORD, pItem, 0L); + delete pItem; + } + return 0; +} + + + + +IMPL_LINK(LinePropertyPanel, ChangeEdgeStyleHdl, void*, EMPTYARG) +{ + const sal_uInt16 nPos(mpLBEdgeStyle->GetSelectEntryPos()); + + if(LISTBOX_ENTRY_NOTFOUND != nPos && nPos != mpLBEdgeStyle->GetSavedValue()) + { + XLineJointItem* pItem = 0; + + switch(nPos) + { + case 0: // rounded + { + pItem = new XLineJointItem(com::sun::star::drawing::LineJoint_ROUND); + break; + } + case 1: // none + { + pItem = new XLineJointItem(com::sun::star::drawing::LineJoint_NONE); + break; + } + case 2: // mitered + { + pItem = new XLineJointItem(com::sun::star::drawing::LineJoint_MITER); + break; + } + case 3: // beveled + { + pItem = new XLineJointItem(com::sun::star::drawing::LineJoint_BEVEL); + break; + } + } + + GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_JOINT, SFX_CALLMODE_RECORD, pItem, 0L); + delete pItem; + } + return 0; +} + + + + +IMPL_LINK(LinePropertyPanel, ChangeCapStyleHdl, void*, EMPTYARG) +{ + const sal_uInt16 nPos(mpLBCapStyle->GetSelectEntryPos()); + + if(LISTBOX_ENTRY_NOTFOUND != nPos && nPos != mpLBCapStyle->GetSavedValue()) + { + XLineCapItem* pItem = 0; + + switch(nPos) + { + case 0: // flat + { + pItem = new XLineCapItem(com::sun::star::drawing::LineCap_BUTT); + break; + } + case 1: // round + { + pItem = new XLineCapItem(com::sun::star::drawing::LineCap_ROUND); + break; + } + case 2: // square + { + pItem = new XLineCapItem(com::sun::star::drawing::LineCap_SQUARE); + break; + } + } + + GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_CAP, SFX_CALLMODE_RECORD, pItem, 0L); + delete pItem; + } + return 0; +} + + + + +IMPL_LINK(LinePropertyPanel, ToolboxWidthSelectHdl,ToolBox*, pToolBox) +{ + if (pToolBox->GetCurItemId() == TBI_WIDTH) + { + maLineWidthPopup.SetWidthSelect(mnWidthCoreValue, mbWidthValuable, meMapUnit); + maLineWidthPopup.Show(*pToolBox); + } + return 0; +} + + + + +IMPL_LINK( LinePropertyPanel, ChangeTransparentHdl, void *, EMPTYARG ) +{ + sal_uInt16 nVal = (sal_uInt16)mpMFTransparent->GetValue(); + XLineTransparenceItem aItem( nVal ); + + GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_STYLE, SFX_CALLMODE_RECORD, &aItem, 0L); + return( 0L ); +} + + + + +PopupControl* LinePropertyPanel::CreateColorPopupControl (PopupContainer* pParent) +{ + const ResId aResId(SVX_RES(STR_AUTOMATICE)); + + return new ColorControl( + pParent, + mpBindings, + SVX_RES(RID_POPUPPANEL_LINEPAGE_COLOR), + SVX_RES(VS_COLOR), + ::boost::bind(GetTransparentColor), + ::boost::bind(&LinePropertyPanel::SetColor, this, _1, _2), + pParent, + &aResId); +} + + + + +PopupControl* LinePropertyPanel::CreateLineWidthPopupControl (PopupContainer* pParent) +{ + return new LineWidthControl(pParent, *this); +} + + + + +void LinePropertyPanel::EndLineWidthPopupMode (void) +{ + maLineWidthPopup.Hide(); +} + + + + +void LinePropertyPanel::SetWidthIcon(int n) +{ + if(n==0) + mpTBWidth->SetItemImage( TBI_WIDTH, maIMGNone); + else + mpTBWidth->SetItemImage( TBI_WIDTH, mpIMGWidthIcon[n-1]); +} + + + +void LinePropertyPanel::SetWidthIcon() +{ + if(!mbWidthValuable) + { + mpTBWidth->SetItemImage( TBI_WIDTH, maIMGNone); + return; + } + + long nVal = LogicToLogic(mnWidthCoreValue * 10,(MapUnit)meMapUnit , MAP_POINT); + + if(nVal <= 6) + mpTBWidth->SetItemImage( TBI_WIDTH, mpIMGWidthIcon[0]); + else if(nVal > 6 && nVal <= 9) + mpTBWidth->SetItemImage( TBI_WIDTH, mpIMGWidthIcon[1]); + else if(nVal > 9 && nVal <= 12) + mpTBWidth->SetItemImage( TBI_WIDTH, mpIMGWidthIcon[2]); + else if(nVal > 12 && nVal <= 19) + mpTBWidth->SetItemImage( TBI_WIDTH, mpIMGWidthIcon[3]); + else if(nVal > 19 && nVal <= 26) + mpTBWidth->SetItemImage( TBI_WIDTH, mpIMGWidthIcon[4]); + else if(nVal > 26 && nVal <= 37) + mpTBWidth->SetItemImage( TBI_WIDTH, mpIMGWidthIcon[5]); + else if(nVal > 37 && nVal <=52) + mpTBWidth->SetItemImage( TBI_WIDTH, mpIMGWidthIcon[6]); + else if(nVal > 52) + mpTBWidth->SetItemImage( TBI_WIDTH, mpIMGWidthIcon[7]); + +} + + + +void LinePropertyPanel::SetColor ( + const String& rsColorName, + const Color aColor) +{ + XLineColorItem aColorItem(rsColorName, aColor); + mpBindings->GetDispatcher()->Execute(SID_ATTR_LINE_COLOR, SFX_CALLMODE_RECORD, &aColorItem, 0L); + maColor = aColor; +} + + + +void LinePropertyPanel::SetWidth(long nWidth) +{ + mnWidthCoreValue = nWidth; + mbWidthValuable = true; +} + + + +void LinePropertyPanel::FillLineEndList() +{ + SfxObjectShell* pSh = SfxObjectShell::Current(); + if ( pSh && pSh->GetItem( SID_LINEEND_LIST ) ) + { + mpLBStart->Enable(); + SvxLineEndListItem aItem( *(const SvxLineEndListItem*)(pSh->GetItem( SID_LINEEND_LIST ) ) ); + mxLineEndList = aItem.GetLineEndList(); + + if (mxLineEndList.is()) + { + FillLineEndListBox(*mpLBStart, *mpLBEnd, *mxLineEndList); + } + + mpLBStart->SelectEntryPos(0); + mpLBEnd->SelectEntryPos(0); + } + else + { + mpLBStart->Disable(); + mpLBEnd->Disable(); + } +} + + + +void LinePropertyPanel::FillLineStyleList() +{ + SfxObjectShell* pSh = SfxObjectShell::Current(); + if ( pSh && pSh->GetItem( SID_DASH_LIST ) ) + { + mpLBStyle->Enable(); + SvxDashListItem aItem( *(const SvxDashListItem*)(pSh->GetItem( SID_DASH_LIST ) ) ); + mxLineStyleList = aItem.GetDashList(); + + if (mxLineStyleList.is()) + { + FillLineStyleListBox(*mpLBStyle, *mxLineStyleList); + } + + mpLBStyle->SelectEntryPos(0); + } + else + { + mpLBStyle->Disable(); + } +} + + + +void LinePropertyPanel::SelectLineStyle() +{ + if( !mbStyleAvailable || !mbDashAvailable ) + { + mpLBStyle->SetNoSelection(); + return; + } + + const XLineStyle eXLS(mpStyleItem ? (XLineStyle)mpStyleItem->GetValue() : XLINE_NONE); + bool bSelected(false); + + switch(eXLS) + { + case XLINE_NONE: + break; + case XLINE_SOLID: + mpLBStyle->SelectEntryPos(1); + bSelected = true; + break; + default: + if(mpDashItem && mxLineStyleList.is()) + { + const XDash& rDash = mpDashItem->GetDashValue(); + for(sal_Int32 a(0);!bSelected && a < mxLineStyleList->Count(); a++) + { + XDashEntry* pEntry = mxLineStyleList->GetDash(a); + const XDash& rEntry = pEntry->GetDash(); + if(rDash == rEntry) + { + mpLBStyle->SelectEntryPos((sal_uInt16)a + 2); + bSelected = true; + } + } + } + break; + } + + if(!bSelected) + mpLBStyle->SelectEntryPos( 0 ); +} + +void LinePropertyPanel::SelectEndStyle(bool bStart) +{ + sal_Bool bSelected(false); + + if(bStart) + { + //<<add + if( !mbStartAvailable ) + { + mpLBStart->SetNoSelection(); + return; + } + //add end>> + if (mpStartItem && mxLineEndList.is()) + { + const basegfx::B2DPolyPolygon& rItemPolygon = mpStartItem->GetLineStartValue(); + for(sal_Int32 a(0);!bSelected && a < mxLineEndList->Count(); a++) + { + XLineEndEntry* pEntry = mxLineEndList->GetLineEnd(a); + const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd(); + if(rItemPolygon == rEntryPolygon) + { + mpLBStart->SelectEntryPos((sal_uInt16)a + 1); + bSelected = true; + } + } + } + if(!bSelected) + mpLBStart->SelectEntryPos( 0 ); + } + else + { + //<<add + if( !mbEndAvailable ) + { + mpLBEnd->SetNoSelection(); + return; + } + //add end>> + if (mpEndItem && mxLineEndList.is()) + { + const basegfx::B2DPolyPolygon& rItemPolygon = mpEndItem->GetLineEndValue(); + for(sal_Int32 a(0);!bSelected && a < mxLineEndList->Count(); a++) + { + XLineEndEntry* pEntry = mxLineEndList->GetLineEnd(a); + const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd(); + if(rItemPolygon == rEntryPolygon) + { + mpLBEnd->SelectEntryPos((sal_uInt16)a + 1); + bSelected = true; + } + } + } + if(!bSelected) + mpLBEnd->SelectEntryPos( 0 ); + } +} + + +} } // end of namespace svx::sidebar + +// eof diff --git a/svx/source/sidebar/line/LinePropertyPanel.hrc b/svx/source/sidebar/line/LinePropertyPanel.hrc new file mode 100644 index 000000000000..81c9e319bb10 --- /dev/null +++ b/svx/source/sidebar/line/LinePropertyPanel.hrc @@ -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 . + */ +// RID_SIDEBAR_LINE_PANEL-------------------------------------------------------------- +#define CUSTOM_X POPUPPANEL_MARGIN_LARGE + OFFSET_X +#define CUSTOM_Y POPUPPANEL_MARGIN_SMALL + OFFSET_Y + 12 * 9 + POPUPPANEL_MARGIN_SMALL * 2 + TEXT_HEIGHT +#define CUSTOM_W 74 +#define CUSTOM_H POPUPPANEL_MARGIN_LARGE * 2 + TEXT_HEIGHT + 12 + TEXT_CONTROL_SPACING_VERTICAL + +#define FT_COLOR 1 +#define TB_COLOR 2 +#define FT_WIDTH 3 +#define TB_WIDTH 4 +#define FT_STYLE 5 +#define LB_STYLE 6 +#define FT_ARROW 7 +#define FT_TRANSPARENT 8 +#define MF_TRANSPARENT 9 +#define LB_START 10 +#define LB_END 11 +#define TBI_COLOR 12 +#define TBI_WIDTH 13 +#define TBI_STYLE 14 +#define STR_QH_TB_WIDTH 15 +#define STR_QH_TB_COLOR 16 + +#define FT_EDGESTYLE 18 +#define LB_EDGESTYLE 19 +#define FT_CAPSTYLE 20 +#define LB_CAPSTYLE 21 + +#define IMG_COLOR 23 +#define IMG_COLOR_NO 24 +#define IMG_NONE_ICON 36 + +#define IMG_WIDTH1_ICON 41 +#define IMG_WIDTH2_ICON 42 +#define IMG_WIDTH3_ICON 43 +#define IMG_WIDTH4_ICON 44 +#define IMG_WIDTH5_ICON 45 +#define IMG_WIDTH6_ICON 46 +#define IMG_WIDTH7_ICON 47 +#define IMG_WIDTH8_ICON 48 + +//color popup page +#define VS_COLOR 1 +#define STR_AUTOMATICE 2 + +//style popup page +#define VS_STYLE 1 +#define PB_OPTIONS 2 + +#define IMG_LINE1 5 +#define IMG_LINE2 7 +#define IMG_LINE3 9 +#define IMG_LINE4 11 +#define IMG_LINE5 13 +#define IMG_LINE6 15 +#define IMG_LINE7 17 +#define IMG_LINE8 19 +#define IMG_LINE9 21 +#define IMG_LINE10 23 +#define IMG_LINE11 25 + +// #define STR_STYLE_NONE_TIP 30 +#define STR_STYLE_NONE 31 +#define STR_STYLE_LINE1 32 +#define STR_STYLE_LINE2 33 +#define STR_STYLE_LINE3 34 +#define STR_STYLE_LINE4 35 +#define STR_STYLE_LINE5 36 +#define STR_STYLE_LINE6 37 +#define STR_STYLE_LINE7 38 +#define STR_STYLE_LINE8 39 +#define STR_STYLE_LINE9 40 +#define STR_STYLE_LINE10 41 +#define STR_STYLE_LINE11 42 + +//width popup page +#define VS_WIDTH 1 +#define MF_WIDTH 2 +#define FT_CUSTOME 3 +#define FT_LINE_WIDTH 4 +#define IMG_WIDTH_CUSTOM 5 +#define IMG_WIDTH_CUSTOM_GRAY 6 +#define CT_BORDER 7 +#define STR_WIDTH_LAST_CUSTOM 8 +#define STR_PT 9 + +// eof diff --git a/svx/source/sidebar/line/LinePropertyPanel.hxx b/svx/source/sidebar/line/LinePropertyPanel.hxx new file mode 100644 index 000000000000..327c18e54724 --- /dev/null +++ b/svx/source/sidebar/line/LinePropertyPanel.hxx @@ -0,0 +1,194 @@ +/* + * 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 SVX_PROPERTYPANEL_LINEPAGE_HXX +#define SVX_PROPERTYPANEL_LINEPAGE_HXX + +#include <svx/xdash.hxx> +#include <vcl/ctrl.hxx> +#include <sfx2/sidebar/SidebarPanelBase.hxx> +#include <sfx2/sidebar/ControllerItem.hxx> +#include <vcl/fixed.hxx> +#include <vcl/field.hxx> +#include <boost/scoped_ptr.hpp> +#include <boost/scoped_array.hpp> +#include <svx/sidebar/ColorPopup.hxx> +#include <svx/xtable.hxx> +#include "LineWidthPopup.hxx" + + +namespace svx { class ToolboxButtonColorUpdater; } +class SvxLineColorPage; +class SvxLineStylePage; +class SvxLineWidthPage; +class XLineStyleItem; +class XLineDashItem; +class XLineStartItem; +class XLineEndItem; +class XLineEndList; +class XDashList; +class ListBox; +class ToolBox; +class FloatingWindow; + +namespace { + #define SIDEBAR_LINE_WIDTH_GLOBAL_VALUE String("PopupPanel_LineWidth", 20, RTL_TEXTENCODING_ASCII_US) +} //end of anonymous namespace + +namespace svx { namespace sidebar { + +class PopupContainer; +class ColorPopup; +class LineWidthControl; + + +class LinePropertyPanel +: public Control, + public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface +{ +private: + friend class ::SvxLineStylePage; + friend class ::SvxLineWidthPage; + +public: + static LinePropertyPanel* Create( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings); + + virtual void DataChanged( + const DataChangedEvent& rEvent); + + virtual void NotifyItemUpdate( + const sal_uInt16 nSId, + const SfxItemState eState, + const SfxPoolItem* pState); + + SfxBindings* GetBindings(); + + void SetWidth(long nWidth); + void SetWidthIcon(int n); + void SetWidthIcon(); + + void EndLineWidthPopupMode (void); + +private: + //ui controls + ::boost::scoped_ptr< FixedText > mpFTWidth; + ::boost::scoped_ptr< Window > mpTBWidthBackground; + ::boost::scoped_ptr< ToolBox > mpTBWidth; + ::boost::scoped_ptr< FixedText > mpFTColor; + ::boost::scoped_ptr< Window > mpTBColorBackground; + ::boost::scoped_ptr< ToolBox > mpTBColor; + ::boost::scoped_ptr< FixedText > mpFTStyle; + ::boost::scoped_ptr< ListBox > mpLBStyle; + ::boost::scoped_ptr< FixedText > mpFTTrancparency; + ::boost::scoped_ptr< MetricField > mpMFTransparent; + ::boost::scoped_ptr< FixedText > mpFTArrow; + ::boost::scoped_ptr< ListBox > mpLBStart; + ::boost::scoped_ptr< ListBox > mpLBEnd; + ::boost::scoped_ptr< FixedText > mpFTEdgeStyle; + ::boost::scoped_ptr< ListBox > mpLBEdgeStyle; + ::boost::scoped_ptr< FixedText > mpFTCapStyle; + ::boost::scoped_ptr< ListBox > mpLBCapStyle; + + //ControllerItem + ::sfx2::sidebar::ControllerItem maStyleControl; + ::sfx2::sidebar::ControllerItem maDashControl; + ::sfx2::sidebar::ControllerItem maWidthControl; + ::sfx2::sidebar::ControllerItem maColorControl; + ::sfx2::sidebar::ControllerItem maStartControl; + ::sfx2::sidebar::ControllerItem maEndControl; + ::sfx2::sidebar::ControllerItem maLineEndListControl; + ::sfx2::sidebar::ControllerItem maLineStyleListControl; + ::sfx2::sidebar::ControllerItem maTransControl; + ::sfx2::sidebar::ControllerItem maEdgeStyle; + ::sfx2::sidebar::ControllerItem maCapStyle; + + Color maColor; + ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpColorUpdater; + ::boost::scoped_ptr< XLineStyleItem > mpStyleItem; + ::boost::scoped_ptr< XLineDashItem > mpDashItem; + sal_uInt16 mnTrans; + SfxMapUnit meMapUnit; + sal_Int32 mnWidthCoreValue; + XLineEndListRef mxLineEndList; + XDashListRef mxLineStyleList; + ::boost::scoped_ptr< XLineStartItem > mpStartItem; + ::boost::scoped_ptr< XLineEndItem > mpEndItem; + + //popup windows + ColorPopup maColorPopup; + LineWidthPopup maLineWidthPopup; + + // images from ressource + Image maIMGColor; + Image maIMGNone; + + // multi-images + ::boost::scoped_array<Image> mpIMGWidthIcon; + + cssu::Reference< css::frame::XFrame > mxFrame; + SfxBindings* mpBindings; + + /// bitfield + bool mbColorAvailable : 1; + bool mbStyleAvailable : 1; + bool mbDashAvailable : 1; + bool mbTransAvailable : 1; + bool mbWidthValuable : 1; + bool mbStartAvailable : 1; + bool mbEndAvailable : 1; + + void SetupIcons(void); + void Initialize(); + void FillLineEndList(); + void FillLineStyleList(); + void SelectEndStyle(bool bStart); + void SelectLineStyle(); + + DECL_LINK(ImplPopupModeEndHdl, FloatingWindow* ); + DECL_LINK(ImplWidthPopupModeEndHdl, FloatingWindow* ); + DECL_LINK(ToolboxColorSelectHdl, ToolBox*); + DECL_LINK(ChangeLineStyleHdl, void*); + DECL_LINK(ToolboxWidthSelectHdl, ToolBox*); + DECL_LINK(ChangeTransparentHdl , void *); + DECL_LINK(ChangeStartHdl, void *); + DECL_LINK(ChangeEndHdl, void *); + DECL_LINK(ChangeEdgeStyleHdl, void *); + DECL_LINK(ChangeCapStyleHdl, void *); + + // constructor/destuctor + LinePropertyPanel( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings); + virtual ~LinePropertyPanel(void); + + void SetColor( + const String& rsColorName, + const Color aColor); + + PopupControl* CreateColorPopupControl (PopupContainer* pParent); + PopupControl* CreateLineWidthPopupControl (PopupContainer* pParent); +}; + +} } // end of namespace svx::sidebar + +#endif + +// eof diff --git a/svx/source/sidebar/line/LinePropertyPanel.src b/svx/source/sidebar/line/LinePropertyPanel.src new file mode 100644 index 000000000000..049c9ad0df2c --- /dev/null +++ b/svx/source/sidebar/line/LinePropertyPanel.src @@ -0,0 +1,486 @@ +/* + * 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 "LinePropertyPanel.hrc" +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include <svx/dialogs.hrc> +#include "helpid.hrc" + +#define TOOLBOX_WIDTH 50 +#define TOOLBOX_HEIGHT 14 +#define LISTBOX_HEIGHT 99 + +Control RID_SIDEBAR_LINE_PANEL +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + Text = "Line"; + + Size = MAP_APPFONT( + PROPERTYPAGE_WIDTH, + SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT*4 + TEXT_CONTROL_SPACING_VERTICAL*4 + TOOLBOX_HEIGHT*3 + CONTROL_SPACING_VERTICAL*3 + CBOX_HEIGHT + SECTIONPAGE_MARGIN_VERTICAL_BOT ); + HelpID = HID_PROPERTYPANEL_LINE_SECTION ; + + FixedText FT_WIDTH + { + Pos = MAP_APPFONT( SECTIONPAGE_MARGIN_HORIZONTAL , SECTIONPAGE_MARGIN_VERTICAL_TOP ) ; + Size = MAP_APPFONT (TOOLBOX_WIDTH , TEXT_HEIGHT ) ; + Text [ en-US ] = "~Width:" ; + }; + ToolBox TB_WIDTH + { + 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_PPROPERTYPANEL_LINE_TBX_WIDTH ; + Text = "Width"; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_WIDTH ; + DropDown = TRUE ; + Text [ en-US ] = "Width" ; + HelpID = HID_PPROPERTYPANEL_LINE_TBI_WIDTH; + }; + }; + }; + String STR_QH_TB_WIDTH + { + Text [ en-US ] = "Select the width of the line."; + }; + + FixedText FT_COLOR + { + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + TOOLBOX_WIDTH + 3, SECTIONPAGE_MARGIN_VERTICAL_TOP ) ; + Size = MAP_APPFONT (TOOLBOX_WIDTH , TEXT_HEIGHT ) ; + Text [ en-US ] = "~Color:" ; + }; + ToolBox TB_COLOR + { + SVLook = TRUE ; + Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL + TOOLBOX_WIDTH + 4, SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL) ; + Size = MAP_APPFONT (TOOLBOX_WIDTH ,TOOLBOX_HEIGHT ) ; + TabStop = TRUE ; + HelpID = HID_PPROPERTYPANEL_LINE_TBX_COLOR; + Text = "Color"; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_COLOR ; + DropDown = TRUE ; + Text [ en-US ] = "Color" ; + HelpID = HID_PPROPERTYPANEL_LINE_TBI_COLOR; + }; + }; + }; + String STR_QH_TB_COLOR + { + Text [ en-US ] = "Select the color of the line."; + }; + + FixedText FT_STYLE + { + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL , SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + TOOLBOX_HEIGHT + CONTROL_SPACING_VERTICAL) ; + Size = MAP_APPFONT (TOOLBOX_WIDTH , TEXT_HEIGHT ) ; + Text [ en-US ] = "~Style:" ; + }; + ListBox LB_STYLE + { + Border = TRUE ; + HelpID = HID_PPROPERTYPANEL_LINE_TBX_STYLE; + 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 ,LISTBOX_HEIGHT ) ; + TabStop = TRUE ; + DropDown = TRUE ; + DDExtraWidth = TRUE ; + QuickHelpText [ en-US ] = "Select the style of the line."; + }; + + FixedText FT_TRANSPARENT + { + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + TOOLBOX_WIDTH + 3 , SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + TOOLBOX_HEIGHT + CONTROL_SPACING_VERTICAL) ; + Size = MAP_APPFONT (TOOLBOX_WIDTH , TEXT_HEIGHT ) ; + Text [ en-US ] = "~Transparency:" ; + }; + MetricField MF_TRANSPARENT + { + Border = TRUE ; + HelpID = HID_PPROPERTYPANEL_LINE_MTR_TRANCEPARENCE; + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + TOOLBOX_WIDTH + 3 , SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT*2 + TEXT_CONTROL_SPACING_VERTICAL*2 + TOOLBOX_HEIGHT + CONTROL_SPACING_VERTICAL) ; + Size = MAP_APPFONT ( TOOLBOX_WIDTH + 1 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + Last = 100 ; + SpinSize = 5 ; + QuickHelpText [ en-US ] = "Specify the transparency of the line."; + }; + + FixedText FT_ARROW + { + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL, SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT*2 + TEXT_CONTROL_SPACING_VERTICAL*2 + TOOLBOX_HEIGHT*2 + CONTROL_SPACING_VERTICAL*2) ; + Size = MAP_APPFONT (TOOLBOX_WIDTH * 2 + 3 , TEXT_HEIGHT ) ; + Text [ en-US ] = "~Arrow:" ; + }; + ListBox LB_START + { + Border = TRUE ; + HelpID = HID_PPROPERTYPANEL_LINE_LB_START; + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL , SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT*3 + TEXT_CONTROL_SPACING_VERTICAL*3 + TOOLBOX_HEIGHT*2 + CONTROL_SPACING_VERTICAL*2 ) ; + Size = MAP_APPFONT ( TOOLBOX_WIDTH , LISTBOX_HEIGHT ) ; + TabStop = TRUE ; + DropDown = TRUE ; + DDExtraWidth = TRUE ; + QuickHelpText [ en-US ] = "Select the style of the beginning arrowhead."; + }; + ListBox LB_END + { + Border = TRUE ; + HelpID = HID_PPROPERTYPANEL_LINE_LB_END; + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + TOOLBOX_WIDTH + 3 , SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT*3 + TEXT_CONTROL_SPACING_VERTICAL*3 + TOOLBOX_HEIGHT*2 + CONTROL_SPACING_VERTICAL*2 ) ; + Size = MAP_APPFONT ( TOOLBOX_WIDTH + 1, LISTBOX_HEIGHT ) ; + TabStop = TRUE ; + DropDown = TRUE ; + DDExtraWidth = TRUE ; + QuickHelpText [ en-US ] = "Select the style of the ending arrowhead."; + }; + + FixedText FT_EDGESTYLE + { + Pos = MAP_APPFONT ( + SECTIONPAGE_MARGIN_HORIZONTAL, + SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT*3 + TEXT_CONTROL_SPACING_VERTICAL*3 + TOOLBOX_HEIGHT*3 + CONTROL_SPACING_VERTICAL*3) ; + Size = MAP_APPFONT (TOOLBOX_WIDTH * 2 + 3 , TEXT_HEIGHT ) ; + Text [ en-US ] = "~Corner style" ; + }; + ListBox LB_EDGESTYLE + { + HelpID = HID_PPROPERTYPANEL_LINE_LB_EDGESTYLE; + Border = TRUE ; + Pos = MAP_APPFONT ( + SECTIONPAGE_MARGIN_HORIZONTAL , + SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT*4 + TEXT_CONTROL_SPACING_VERTICAL*4 + TOOLBOX_HEIGHT*3 + CONTROL_SPACING_VERTICAL*3 ) ; + Size = MAP_APPFONT ( TOOLBOX_WIDTH , LISTBOX_HEIGHT ) ; + TabStop = TRUE ; + DropDown = TRUE ; + DDExtraWidth = TRUE ; + QuickHelpText [ en-US ] = "Select the style of the edge connections."; + StringList [ en-US ] = + { + < "Rounded" ; Default ; > ; + < "- none -" ; > ; + < "Mitered" ; > ; + < "Beveled" ; > ; + }; + }; + FixedText FT_CAPSTYLE + { + Pos = MAP_APPFONT ( + SECTIONPAGE_MARGIN_HORIZONTAL + TOOLBOX_WIDTH + 3, + SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT*3 + TEXT_CONTROL_SPACING_VERTICAL*3 + TOOLBOX_HEIGHT*3 + CONTROL_SPACING_VERTICAL*3) ; + Size = MAP_APPFONT (TOOLBOX_WIDTH * 2 + 3 , TEXT_HEIGHT ) ; + Text [ en-US ] = "Ca~p style" ; + }; + ListBox LB_CAPSTYLE + { + HelpID = HID_PPROPERTYPANEL_LINE_LB_CAPSTYLE; + Border = TRUE ; + Pos = MAP_APPFONT ( + SECTIONPAGE_MARGIN_HORIZONTAL + TOOLBOX_WIDTH + 3, + SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT*4 + TEXT_CONTROL_SPACING_VERTICAL*4 + TOOLBOX_HEIGHT*3 + CONTROL_SPACING_VERTICAL*3 ) ; + Size = MAP_APPFONT ( TOOLBOX_WIDTH , LISTBOX_HEIGHT ) ; + TabStop = TRUE ; + DropDown = TRUE ; + DDExtraWidth = TRUE ; + QuickHelpText [ en-US ] = "Select the style of the line caps."; + StringList [ en-US ] = + { + < "Flat" ; Default ; > ; // Same string as in Excel + < "Round" ; > ; + < "Square" ; > ; + }; + }; + + Image IMG_COLOR + { + ImageBitmap = Bitmap{File = "symphony/Line_color.png";}; + }; + Image IMG_COLOR_NO + { + ImageBitmap = Bitmap{File = "symphony/no color.png";}; + }; + + Image IMG_NONE_ICON + { + ImageBitmap = Bitmap{File = "symphony/blank.png";}; + }; + + //WIDTH ICON + Image IMG_WIDTH1_ICON + { + ImageBitmap = Bitmap{File = "symphony/width1.png";}; + }; + Image IMG_WIDTH2_ICON + { + ImageBitmap = Bitmap{File = "symphony/width2.png";}; + }; + Image IMG_WIDTH3_ICON + { + ImageBitmap = Bitmap{File = "symphony/width3.png";}; + }; + Image IMG_WIDTH4_ICON + { + ImageBitmap = Bitmap{File = "symphony/width4.png";}; + }; + Image IMG_WIDTH5_ICON + { + ImageBitmap = Bitmap{File = "symphony/width5.png";}; + }; + Image IMG_WIDTH6_ICON + { + ImageBitmap = Bitmap{File = "symphony/width6.png";}; + }; + Image IMG_WIDTH7_ICON + { + ImageBitmap = Bitmap{File = "symphony/width7.png";}; + }; + Image IMG_WIDTH8_ICON + { + ImageBitmap = Bitmap{File = "symphony/width8.png";}; + }; + +}; +Control RID_POPUPPANEL_LINEPAGE_COLOR +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + Size = MAP_APPFONT( POPUP_COLOR_PICKER_WIDTH , POPUP_COLOR_PICKER_HEIGHT ); + + Control VS_COLOR + { + HelpId = HID_PPROPERTYPANEL_LINE_VS_COLOR ; + 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 = "Color"; + }; + String STR_AUTOMATICE + { + Text [ en-US ] = "No Color"; + }; +}; +Control RID_POPUPPANEL_LINEPAGE_STYLE +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + + Size = MAP_APPFONT( + POPUPPANEL_MARGIN_SMALL * 2 + POPUP_BORDER_WIDTH , + 13 + POPUP_BORDER_HEIGHT + POPUPPANEL_MARGIN_SMALL * 2 + POPUPPANEL_MARGIN_LARGE); + + Control VS_STYLE + { + HelpId = HID_PPROPERTYPANEL_LINE_VS_STYLE ; + Hide = TRUE ; + Pos = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL + OFFSET_X , POPUPPANEL_MARGIN_SMALL + OFFSET_Y ); + Size = MAP_APPFONT ( 93 , 13 * 12); + TabStop = TRUE ; + Text = "Style"; + }; + + PushButton PB_OPTIONS + { + HelpId = HID_PPROPERTYPANEL_LINE_BTN_STYLE; + Pos = MAP_APPFONT ( POPUPPANEL_MARGIN_LARGE + OFFSET_X , POPUPPANEL_MARGIN_SMALL * 2 + OFFSET_Y ); + Size = MAP_APPFONT ( 93 , 13 ); + TabStop = TRUE; + Text [ en-US ] = "~More Options..."; + }; + + String STR_STYLE_NONE + { + Text [ en-US ] = "None"; + }; + String STR_STYLE_LINE1 + { + Text [ en-US ] = "Continuous"; + }; + String STR_STYLE_LINE2 + { + Text [ en-US ] = "Ultrafine dashed"; + }; + String STR_STYLE_LINE3 + { + Text [ en-US ] = "Dashed (variable)"; + }; + String STR_STYLE_LINE4 + { + Text [ en-US ] = "Fine dashed (variable)"; + }; + String STR_STYLE_LINE5 + { + Text [ en-US ] = "Fine dashed"; + }; + String STR_STYLE_LINE6 + { + Text [ en-US ] = "Fine dotted"; + }; + String STR_STYLE_LINE7 + { + Text [ en-US ] = "Ultrafine dotted (variable)"; + }; + String STR_STYLE_LINE8 + { + Text [ en-US ] = "3 dashes 3 dots (variable)"; + }; + String STR_STYLE_LINE9 + { + Text [ en-US ] = "2 dots 1 dash"; + }; + String STR_STYLE_LINE10 + { + Text [ en-US ] = "Ultrafine 2 dots 3 dashes"; + }; + String STR_STYLE_LINE11 + { + Text [ en-US ] = "Line with fine dots"; + }; + + Image IMG_LINE1 + { + ImageBitmap = Bitmap{File = "symphony/style_line1.png";}; + }; + Image IMG_LINE2 + { + ImageBitmap = Bitmap{File = "symphony/style_line2.png";}; + }; + Image IMG_LINE3 + { + ImageBitmap = Bitmap{File = "symphony/style_line3.png";}; + }; + Image IMG_LINE4 + { + ImageBitmap = Bitmap{File = "symphony/style_line4.png";}; + }; + Image IMG_LINE5 + { + ImageBitmap = Bitmap{File = "symphony/style_line5.png";}; + }; + Image IMG_LINE6 + { + ImageBitmap = Bitmap{File = "symphony/style_line6.png";}; + }; + Image IMG_LINE7 + { + ImageBitmap = Bitmap{File = "symphony/style_line7.png";}; + }; + Image IMG_LINE8 + { + ImageBitmap = Bitmap{File = "symphony/style_line8.png";}; + }; + Image IMG_LINE9 + { + ImageBitmap = Bitmap{File = "symphony/style_line9.png";}; + }; + Image IMG_LINE10 + { + ImageBitmap = Bitmap{File = "symphony/style_line10.png";}; + }; + Image IMG_LINE11 + { + ImageBitmap = Bitmap{File = "symphony/style_line11.png";}; + }; +}; +Control RID_POPUPPANEL_LINEPAGE_WIDTH +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + + Size = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL * 2 + POPUP_BORDER_WIDTH + 80, POPUPPANEL_MARGIN_SMALL + POPUPPANEL_MARGIN_LARGE + POPUP_BORDER_WIDTH + 12 * 9 + POPUPPANEL_MARGIN_SMALL * 2 + TEXT_HEIGHT + (POPUPPANEL_MARGIN_LARGE * 2 + TEXT_HEIGHT + 12 + TEXT_CONTROL_SPACING_VERTICAL)); + + Control VS_WIDTH + { + HelpId = HID_PPROPERTYPANEL_LINE_VS_WIDTH ; + Hide = TRUE ; + Pos = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL + OFFSET_X , POPUPPANEL_MARGIN_SMALL + OFFSET_Y ); + Size = MAP_APPFONT ( 80 , 12 * 9); + TabStop = TRUE ; + Text = "Width"; + }; + FixedText FT_CUSTOME + { + Pos = MAP_APPFONT ( POPUPPANEL_MARGIN_LARGE + OFFSET_X, POPUPPANEL_MARGIN_SMALL + OFFSET_Y + 12 * 9 + POPUPPANEL_MARGIN_SMALL ) ; + Size = MAP_APPFONT ( 80 , TEXT_HEIGHT ) ; + Text [ en-US ] = "Custom:" ; + }; + FixedText FT_LINE_WIDTH + { + Pos = MAP_APPFONT ( CUSTOM_X + POPUPPANEL_MARGIN_LARGE, CUSTOM_Y + POPUPPANEL_MARGIN_LARGE) ; + Size = MAP_APPFONT ( 74 - POPUPPANEL_MARGIN_LARGE * 2 , TEXT_HEIGHT ) ; + Text [ en-US ] = "Line ~width:" ; + }; + MetricField MF_WIDTH + { + Border = TRUE ; + HelpID = HID_PPROPERTYPANEL_LINE_MTR_WIDTH ; + Pos = MAP_APPFONT ( CUSTOM_X + POPUPPANEL_MARGIN_LARGE , CUSTOM_Y + POPUPPANEL_MARGIN_LARGE + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + Right = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 5000 ; + StrictFormat = TRUE ; + DecimalDigits = 2 ; + Value = 1 ; + Unit = FUNIT_MM ; + Last = 5000 ; + SpinSize = 10 ; + QuickHelpText [ en-US ] = "Specify the width of the line."; + }; + + Image IMG_WIDTH_CUSTOM + { + ImageBitmap = Bitmap{File = "symphony/last_custom_common.png";}; + }; + Image IMG_WIDTH_CUSTOM_GRAY + { + ImageBitmap = Bitmap{File = "symphony/last_custom_common_grey.png";}; + }; + String STR_WIDTH_LAST_CUSTOM + { + Text [ en-US ] = "Last Custom Value"; + }; + String STR_PT + { + Text [ en-US ] = "pt"; + }; +}; + +// eof diff --git a/svx/source/sidebar/line/LineStyleValueSet.cxx b/svx/source/sidebar/line/LineStyleValueSet.cxx new file mode 100644 index 000000000000..41abbc4ee8fd --- /dev/null +++ b/svx/source/sidebar/line/LineStyleValueSet.cxx @@ -0,0 +1,127 @@ +/* + * 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 "LineStyleValueSet.hxx" + +#include <i18nlangtag/mslangid.hxx> + + +namespace svx { namespace sidebar { + +LineStyleValueSet::LineStyleValueSet ( + Window* pParent, + const ResId& rResId) + : ValueSet( pParent, rResId ), + pVDev(NULL), + mbSelectFirst(true) +{ + SetColCount( 1 ); +} + + + + +LineStyleValueSet::~LineStyleValueSet (void) +{ + delete pVDev; +} + + + + +void LineStyleValueSet::SetFirstString(XubString str) +{ + strNone = str; +} + + + + +void LineStyleValueSet::UserDraw( const UserDrawEvent& rUDEvt ) +{ + Rectangle aRect = rUDEvt.GetRect(); + OutputDevice* pDev = rUDEvt.GetDevice(); + sal_uInt16 nItemId = rUDEvt.GetItemId(); + + long nRectHeight = aRect.GetHeight(); + //Point aBLPos = aRect.TopLeft(); + if(nItemId == 1) + { + Color aOldFillColor = pDev->GetFillColor(); + + //draw back + if( mbSelectFirst ) + { + 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); + } + pDev->SetFillColor(aOldFillColor); + + //draw text + Font aOldFont = pDev->GetFont(); + Color aOldColor = pDev->GetLineColor(); + Font aFont(OutputDevice::GetDefaultFont( + DEFAULTFONT_UI_SANS, MsLangId::getSystemLanguage(), DEFAULTFONT_FLAGS_ONLYONE)); + Size aSize = aFont.GetSize(); + aSize.Height() = nRectHeight*3/5; + if( mbSelectFirst ) + aFont.SetColor(COL_WHITE); + else + //aFont.SetColor(COL_BLACK); + aFont.SetColor(GetSettings().GetStyleSettings().GetFieldTextColor()); //high contrast + aFont.SetFillColor(COL_BLUE); + aFont.SetSize( aSize ); + pDev->SetFont(aFont); +// String sText("None", 9, RTL_TEXTENCODING_ASCII_US); + + // Point aStart(aBLPos.X() + 8 , aBLPos.Y() + nRectHeight/6); + Rectangle aStrRect = aRect; + aStrRect.Top() += nRectHeight/6; + aStrRect.Bottom() -= nRectHeight/6; + aStrRect.Left() += 8; + pDev->DrawText(aStrRect, strNone, TEXT_DRAW_ENDELLIPSIS); + + pDev->SetFont(aOldFont); + pDev->SetLineColor(aOldColor); + + + } + Invalidate( aRect ); +} + + + + +void LineStyleValueSet::SetFirstSelect(bool bSel) +{ + mbSelectFirst = bSel; +} + + + +} } // end of namespace svx::sidebar + +// eof diff --git a/svx/source/sidebar/line/LineStyleValueSet.hxx b/svx/source/sidebar/line/LineStyleValueSet.hxx new file mode 100644 index 000000000000..862cf18e5842 --- /dev/null +++ b/svx/source/sidebar/line/LineStyleValueSet.hxx @@ -0,0 +1,47 @@ +/* + * 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 SVX_SIDEBAR_LINE_STYLE_VALUE_SET_HXX +#define SVX_SIDEBAR_LINE_STYLE_VALUE_SET_HXX + +#include <svtools/valueset.hxx> + +namespace svx { namespace sidebar { + +class LineStyleValueSet + : public ValueSet +{ +public: + LineStyleValueSet (Window* pParent, const ResId& rResId); + virtual ~LineStyleValueSet (void); + + void SetFirstSelect(bool bSel); + void SetFirstString(XubString str); + + virtual void UserDraw( const UserDrawEvent& rUDEvt ); + +private: + VirtualDevice* pVDev; + bool mbSelectFirst; + XubString strNone; +}; + +} } // end of namespace svx::sidebar + +#endif + +// eof diff --git a/svx/source/sidebar/line/LineWidthControl.cxx b/svx/source/sidebar/line/LineWidthControl.cxx new file mode 100644 index 000000000000..66c0019f655e --- /dev/null +++ b/svx/source/sidebar/line/LineWidthControl.cxx @@ -0,0 +1,372 @@ +/* + * 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 "LineWidthControl.hxx" +#include "LinePropertyPanel.hrc" +#include "LinePropertyPanel.hxx" + +#include <svx/dialogs.hrc> +#include <svx/dialmgr.hxx> +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include <comphelper/processfactory.hxx> +#include <vcl/svapp.hxx> +#include <unotools/viewoptions.hxx> +#include <svx/xlnwtit.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include "svx/sidebar/PopupContainer.hxx" + + +namespace svx { namespace sidebar { + +LineWidthControl::LineWidthControl ( + Window* pParent, + LinePropertyPanel& rPanel) + : svx::sidebar::PopupControl(pParent,SVX_RES(RID_POPUPPANEL_LINEPAGE_WIDTH)), + mrLinePropertyPanel(rPanel), + mpBindings(NULL), + maVSWidth( this, SVX_RES(VS_WIDTH)), + maFTCus( this, SVX_RES(FT_CUSTOME)), + maFTWidth( this, SVX_RES(FT_LINE_WIDTH)), + maMFWidth( this, SVX_RES(MF_WIDTH)), + meMapUnit(SFX_MAPUNIT_TWIP), + rStr(NULL), + mstrPT(SVX_RES(STR_PT)), + mnCustomWidth(0), + mbCustom(false), + mbColseByEdit(false), + mnTmpCusomWidth(0), + mbVSFocus(true), + maIMGCus(SVX_RES(IMG_WIDTH_CUSTOM)), + maIMGCusGray(SVX_RES(IMG_WIDTH_CUSTOM_GRAY)) +{ + Initialize(); + FreeResource(); + mpBindings = mrLinePropertyPanel.GetBindings(); +} + + + + +LineWidthControl::~LineWidthControl (void) +{ + delete[] rStr; +} + + + + +void LineWidthControl::Paint(const Rectangle& rect) +{ + svx::sidebar::PopupControl::Paint(rect); + + Color aOldLineColor = GetLineColor(); + Color aOldFillColor = GetFillColor(); + + Point aPos( LogicToPixel( Point( CUSTOM_X, CUSTOM_Y), MAP_APPFONT )); + Size aSize( LogicToPixel( Size( CUSTOM_W, CUSTOM_H ), MAP_APPFONT )); + Rectangle aRect( aPos, aSize ); + aRect.Left() -= 1; + aRect.Top() -= 1; + aRect.Right() += 1; + aRect.Bottom() += 1; + + Color aLineColor(189,201,219); + if(!GetSettings().GetStyleSettings().GetHighContrastMode()) + SetLineColor(aLineColor); + else + SetLineColor(GetSettings().GetStyleSettings().GetShadowColor()); + SetFillColor(COL_TRANSPARENT); + DrawRect(aRect); + + SetLineColor(aOldLineColor); + SetFillColor(aOldFillColor); +} + + + + +void LineWidthControl::Initialize() +{ + maVSWidth.SetStyle( maVSWidth.GetStyle()| WB_3DLOOK | WB_NO_DIRECTSELECT );// WB_NAMEFIELD | WB_ITEMBORDER |WB_DOUBLEBORDER | WB_NONEFIELD | + //for high contrast wj + if(GetSettings().GetStyleSettings().GetHighContrastMode()) + { + maVSWidth.SetColor(GetSettings().GetStyleSettings().GetMenuColor()); + // maBorder.SetBackground(GetSettings().GetStyleSettings().GetMenuColor()); + maFTWidth.SetBackground(GetSettings().GetStyleSettings().GetMenuColor()); + } + else + { + maVSWidth.SetColor(COL_WHITE); + // maBorder.SetBackground(Wallpaper(COL_WHITE)); + maFTWidth.SetBackground(Wallpaper(COL_WHITE)); + } + + sal_Int64 nFirst= maMFWidth.Denormalize( maMFWidth.GetFirst( FUNIT_TWIP ) ); + sal_Int64 nLast = maMFWidth.Denormalize( maMFWidth.GetLast( FUNIT_TWIP ) ); + sal_Int64 nMin = maMFWidth.Denormalize( maMFWidth.GetMin( FUNIT_TWIP ) ); + sal_Int64 nMax = maMFWidth.Denormalize( maMFWidth.GetMax( FUNIT_TWIP ) ); + maMFWidth.SetSpinSize( 10 ); + maMFWidth.SetUnit( FUNIT_POINT ); + if( maMFWidth.GetDecimalDigits() > 1 ) + maMFWidth.SetDecimalDigits( 1 ); + maMFWidth.SetFirst( maMFWidth.Normalize( nFirst ), FUNIT_TWIP ); + maMFWidth.SetLast( maMFWidth.Normalize( nLast ), FUNIT_TWIP ); + maMFWidth.SetMin( maMFWidth.Normalize( nMin ), FUNIT_TWIP ); + maMFWidth.SetMax( maMFWidth.Normalize( nMax ), FUNIT_TWIP ); + + rStr = new XubString[9]; + //modify, + rStr[0] = String("05", 2, RTL_TEXTENCODING_ASCII_US); + rStr[1] = String("08", 2, RTL_TEXTENCODING_ASCII_US); + rStr[2] = String("10", 2, RTL_TEXTENCODING_ASCII_US); + rStr[3] = String("15", 2, RTL_TEXTENCODING_ASCII_US); + rStr[4] = String("23", 2, RTL_TEXTENCODING_ASCII_US); + rStr[5] = String("30", 2, RTL_TEXTENCODING_ASCII_US); + rStr[6] = String("45", 2, RTL_TEXTENCODING_ASCII_US); + rStr[7] = String("60", 2, RTL_TEXTENCODING_ASCII_US); + rStr[8] = String( SVX_RES(STR_WIDTH_LAST_CUSTOM) ); + + const LocaleDataWrapper& rLocaleWrapper( Application::GetSettings().GetLocaleDataWrapper() ); + const sal_Unicode cSep = rLocaleWrapper.getNumDecimalSep()[0]; + + for(int i = 0; i <= 7 ; i++) + { + rStr[i] = rStr[i].Insert(cSep, 1);//Modify + rStr[i].Append(mstrPT); + } + //end + + for(sal_uInt16 i = 1 ; i <= 9 ; i++) + { + maVSWidth.InsertItem(i); + maVSWidth.SetItemText(i, rStr[i-1]); + } + maVSWidth.SetUnit(rStr); + maVSWidth.SetItemData(1,(void*)5); + maVSWidth.SetItemData(2,(void*)8); + maVSWidth.SetItemData(3,(void*)10); + maVSWidth.SetItemData(4,(void*)15); + maVSWidth.SetItemData(5,(void*)23); + maVSWidth.SetItemData(6,(void*)30); + maVSWidth.SetItemData(7,(void*)45); + maVSWidth.SetItemData(8,(void*)60); + maVSWidth.SetImage(maIMGCusGray); + + maVSWidth.SetSelItem(0); + Link aLink = LINK( this, LineWidthControl, VSSelectHdl ) ; + maVSWidth.SetSelectHdl(aLink); + aLink = LINK(this, LineWidthControl, MFModifyHdl); + maMFWidth.SetModifyHdl(aLink); + + maVSWidth.StartSelection(); + maVSWidth.Show(); +} + + + + +void LineWidthControl::GetFocus() +{ + if(!mbVSFocus) + maMFWidth.GrabFocus(); + else + maVSWidth.GrabFocus(); +} + + + + +ValueSet& LineWidthControl::GetValueSet() +{ + return maVSWidth; +} + + + + +void LineWidthControl::SetWidthSelect( long lValue, bool bValuable, SfxMapUnit eMapUnit) +{ + mbVSFocus = true; + maVSWidth.SetSelItem(0); + mbColseByEdit = false; + meMapUnit = eMapUnit; + SvtViewOptions aWinOpt( E_WINDOW, SIDEBAR_LINE_WIDTH_GLOBAL_VALUE ); + if ( aWinOpt.Exists() ) + { + ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt.GetUserData(); + ::rtl::OUString aTmp; + if ( aSeq.getLength()) + aSeq[0].Value >>= aTmp; + + String aWinData( aTmp ); + mnCustomWidth = aWinData.ToInt32(); + mbCustom = true; + maVSWidth.SetImage(maIMGCus); + maVSWidth.SetCusEnable(true); + + String aStrTip( OUString::number( (double)mnCustomWidth / 10)); + aStrTip.Append(mstrPT); // + maVSWidth.SetItemText(9, aStrTip); + } + else + { + mbCustom = false; + maVSWidth.SetImage(maIMGCusGray); + maVSWidth.SetCusEnable(false); + //modify + //String aStrTip(String(SVX_RES(STR_WIDTH_LAST_CUSTOM))); + //maVSWidth.SetItemText(9, aStrTip); + maVSWidth.SetItemText(9, rStr[8]); + } + + if(bValuable) + { + sal_Int64 nVal = OutputDevice::LogicToLogic( lValue, (MapUnit)eMapUnit, MAP_100TH_MM ); + nVal = maMFWidth.Normalize( nVal ); + maMFWidth.SetValue( nVal, FUNIT_100TH_MM ); + } + else + { + maMFWidth.SetText( String() ); + } + + MapUnit eOrgUnit = (MapUnit)eMapUnit; + MapUnit ePntUnit( MAP_TWIP ); + lValue = LogicToLogic( lValue , eOrgUnit, ePntUnit ); + + XubString strCurrValue = maMFWidth.GetText(); + sal_uInt16 i = 0; + for(; i < 8; i++) + if(strCurrValue == rStr[i]) + { + maVSWidth.SetSelItem(i+1); + break; + } + if (i>=8) + { + mbVSFocus = false; + maVSWidth.SetSelItem(0); + } + maVSWidth.Format(); + maVSWidth.StartSelection(); +} + + + + +IMPL_LINK(LineWidthControl, VSSelectHdl, void *, pControl) +{ + if(pControl == &maVSWidth) + { + sal_uInt16 iPos = maVSWidth.GetSelectItemId(); + if(iPos >= 1 && iPos <= 8) + { + long nVal = LogicToLogic((long)(unsigned long)maVSWidth.GetItemData( iPos ) , MAP_POINT, (MapUnit)meMapUnit); + nVal = maMFWidth.Denormalize(nVal); + XLineWidthItem aWidthItem( nVal ); + mpBindings->GetDispatcher()->Execute(SID_ATTR_LINE_WIDTH, SFX_CALLMODE_RECORD, &aWidthItem, 0L); + mrLinePropertyPanel.SetWidthIcon(iPos); + mrLinePropertyPanel.SetWidth(nVal); + mbColseByEdit = false; + mnTmpCusomWidth = 0; + } + else if(iPos == 9) + {//last custom + //modified + if(mbCustom) + { + long nVal = LogicToLogic(mnCustomWidth , MAP_POINT, (MapUnit)meMapUnit); + nVal = maMFWidth.Denormalize(nVal); + XLineWidthItem aWidthItem( nVal ); + mpBindings->GetDispatcher()->Execute(SID_ATTR_LINE_WIDTH, SFX_CALLMODE_RECORD, &aWidthItem, 0L); + mrLinePropertyPanel.SetWidth(nVal); + mbColseByEdit = false; + mnTmpCusomWidth = 0; + } + else + { + maVSWidth.SetNoSelection(); //add , set no selection and keep the last select item + maVSWidth.Format(); + Invalidate(); + maVSWidth.StartSelection(); + } + //modify end + } + if((iPos >= 1 && iPos <= 8) || (iPos == 9 && mbCustom)) //add + mrLinePropertyPanel.EndLineWidthPopupMode(); + } + return( 0L ); +} + + + + +IMPL_LINK(LineWidthControl, MFModifyHdl, void *, pControl) +{ + if(pControl == &maMFWidth) + { + if(maVSWidth.GetSelItem()) + { + maVSWidth.SetSelItem(0); + maVSWidth.Format(); + Invalidate(); + maVSWidth.StartSelection(); + } + long nTmp = static_cast<long>(maMFWidth.GetValue()); + long nVal = LogicToLogic( nTmp, MAP_POINT, (MapUnit)meMapUnit ); + sal_Int32 nNewWidth = (short)maMFWidth.Denormalize( nVal ); + XLineWidthItem aWidthItem(nNewWidth); + mpBindings->GetDispatcher()->Execute(SID_ATTR_LINE_WIDTH, SFX_CALLMODE_RECORD, &aWidthItem, 0L); + + mbColseByEdit = true; + mnTmpCusomWidth = nTmp; + /*for(sal_uInt16 i = 0; i < 8; i++) + { + if(nTmp == (sal_Int32)maVSWidth.GetItemData(i)) + { + mbColseByEdit = false; + break; + } + }*/ + + } + return( 0L ); +} + + + + +bool LineWidthControl::IsCloseByEdit() +{ + return mbColseByEdit; +} + + + + +long LineWidthControl::GetTmpCustomWidth() +{ + return mnTmpCusomWidth; +} + + + +} } // end of namespace svx::sidebar + +// eof diff --git a/svx/source/sidebar/line/LineWidthControl.hxx b/svx/source/sidebar/line/LineWidthControl.hxx new file mode 100644 index 000000000000..c31a3de16635 --- /dev/null +++ b/svx/source/sidebar/line/LineWidthControl.hxx @@ -0,0 +1,71 @@ +/* + * 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 "svx/sidebar/PopupControl.hxx" +#include "LineWidthValueSet.hxx" +#include <svl/poolitem.hxx> +#include <vcl/fixed.hxx> +#include <vcl/field.hxx> + +class SfxBindings; + +namespace svx { namespace sidebar { + +class LinePropertyPanel; + +class LineWidthControl + : public svx::sidebar::PopupControl +{ +public: + LineWidthControl (Window* pParent, LinePropertyPanel& rPanel); + virtual ~LineWidthControl (void); + + virtual void GetFocus(); + virtual void Paint(const Rectangle& rect); + + void SetWidthSelect( long lValue, bool bValuable, SfxMapUnit eMapUnit); + ValueSet& GetValueSet(); + bool IsCloseByEdit(); + long GetTmpCustomWidth(); + +private: + LinePropertyPanel& mrLinePropertyPanel; + SfxBindings* mpBindings; + LineWidthValueSet maVSWidth; + FixedText maFTCus; + FixedText maFTWidth; + MetricField maMFWidth; + SfxMapUnit meMapUnit; + XubString* rStr; + XubString mstrPT; // + long mnCustomWidth; + bool mbCustom; + bool mbColseByEdit; + long mnTmpCusomWidth; + bool mbVSFocus; + + Image maIMGCus; + Image maIMGCusGray; + + void Initialize(); + DECL_LINK(VSSelectHdl, void *); + DECL_LINK(MFModifyHdl, void *); +}; + +} } // end of namespace svx::sidebar + +// eof diff --git a/svx/source/sidebar/line/LineWidthPopup.cxx b/svx/source/sidebar/line/LineWidthPopup.cxx new file mode 100644 index 000000000000..49596941147a --- /dev/null +++ b/svx/source/sidebar/line/LineWidthPopup.cxx @@ -0,0 +1,83 @@ +/* + * 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 "LineWidthPopup.hxx" +#include "LineWidthControl.hxx" +#include "LinePropertyPanel.hxx" + +#include <unotools/viewoptions.hxx> + +#include <boost/bind.hpp> + + +namespace svx { namespace sidebar { + +LineWidthPopup::LineWidthPopup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator) + : Popup( + pParent, + rControlCreator, + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width"))) +{ + SetPopupModeEndHandler(::boost::bind(&LineWidthPopup::PopupModeEndCallback, this)); +} + + + + +LineWidthPopup::~LineWidthPopup (void) +{ +} + + + + +void LineWidthPopup::SetWidthSelect (long lValue, bool bValuable, SfxMapUnit eMapUnit) +{ + ProvideContainerAndControl(); + + LineWidthControl* pControl = dynamic_cast<LineWidthControl*>(mpControl.get()); + if (pControl != NULL) + pControl->SetWidthSelect(lValue, bValuable, eMapUnit); +} + + + + +void LineWidthPopup::PopupModeEndCallback (void) +{ + LineWidthControl* pControl = dynamic_cast<LineWidthControl*>(mpControl.get()); + if (pControl != NULL) + { + if (pControl->IsCloseByEdit()) + { + SvtViewOptions aWinOpt( E_WINDOW, SIDEBAR_LINE_WIDTH_GLOBAL_VALUE ); + ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq(1); + aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LineWidth") ); + aSeq[0].Value <<= ::rtl::OUString::number(pControl->GetTmpCustomWidth()); + aWinOpt.SetUserData( aSeq ); + } + } +} + + + +} } // end of namespace svx::sidebar + + +// eof diff --git a/svx/source/sidebar/line/LineWidthPopup.hxx b/svx/source/sidebar/line/LineWidthPopup.hxx new file mode 100644 index 000000000000..d9c3dff748e2 --- /dev/null +++ b/svx/source/sidebar/line/LineWidthPopup.hxx @@ -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 . + */ +#ifndef _SVX_SIDEBAR_LINE_WIDTH_POPUP_HXX_ +#define _SVX_SIDEBAR_LINE_WIDTH_POPUP_HXX_ + +#include "svx/sidebar/Popup.hxx" + +#include <svl/poolitem.hxx> + +#include <boost/function.hpp> + + +namespace svx { namespace sidebar { + +class LineWidthPopup + : public Popup +{ +public : + LineWidthPopup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator); + virtual ~LineWidthPopup (void); + + void SetWidthSelect (long lValue, bool bValuable, SfxMapUnit eMapUnit); + +private: + void PopupModeEndCallback (void); +}; + +} } // end of namespace svx::sidebar + +#endif + +// eof diff --git a/svx/source/sidebar/line/LineWidthValueSet.cxx b/svx/source/sidebar/line/LineWidthValueSet.cxx new file mode 100644 index 000000000000..ffecfb29b926 --- /dev/null +++ b/svx/source/sidebar/line/LineWidthValueSet.cxx @@ -0,0 +1,192 @@ +/* + * 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 "LineWidthValueSet.hxx" + +#include <i18nlangtag/mslangid.hxx> + +namespace svx { namespace sidebar { + + +LineWidthValueSet::LineWidthValueSet ( + Window* pParent, const ResId& rResId) + : ValueSet( pParent, rResId ), + pVDev(NULL), + nSelItem(0), + bCusEnable(false) +{ + strUnit = new XubString[9]; + SetColCount( 1 ); + SetLineCount( 9); +} + + + + +LineWidthValueSet::~LineWidthValueSet (void) +{ + delete pVDev; + delete[] strUnit; +} + + + + +void LineWidthValueSet::SetUnit(XubString* str) +{ + for(int i = 0; i < 9; i++) + { + strUnit[i] = str[i]; + } +} + + + +void LineWidthValueSet::SetSelItem(sal_uInt16 nSel) +{ + nSelItem = nSel; + if(nSel == 0) + { + SelectItem(1); // ,false); // 'false' nut supported by AOO + SetNoSelection(); + } + else + { + SelectItem(nSelItem); + GrabFocus(); + } +} + + + + +sal_uInt16 LineWidthValueSet::GetSelItem() +{ + return nSelItem; +} + + + + +void LineWidthValueSet::SetImage(Image img) +{ + imgCus = img; +} + + + + +void LineWidthValueSet::SetCusEnable(bool bEnable) +{ + bCusEnable = bEnable; +} + + + + +void LineWidthValueSet::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(); + + //const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + //Color aBackColor(0,0,200); + //const Color aTextColor = rStyleSettings.GetFieldTextColor(); + 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 - 10, aBLPos.Y() + ( nRectHeight - nItemId )/2); + if(nItemId == 9) + { + Point aImgStart(aBLPos.X() + 5, aBLPos.Y() + ( nRectHeight - 23 ) / 2); + pDev->DrawImage(aImgStart, imgCus); + // Point aStart(aImgStart.X() + 14 + 20 , aBLPos.Y() + nRectHeight/6); + Rectangle aStrRect = aRect; + aStrRect.Top() += nRectHeight/6; + aStrRect.Bottom() -= nRectHeight/6; + aStrRect.Left() += imgCus.GetSizePixel().Width() + 20; + if(bCusEnable) + aFont.SetColor(GetSettings().GetStyleSettings().GetFieldTextColor()); + else + aFont.SetColor(GetSettings().GetStyleSettings().GetDisableColor()); + + pDev->SetFont(aFont); + pDev->DrawText(aStrRect, strUnit[ nItemId - 1 ], TEXT_DRAW_ENDELLIPSIS); + } + else + { + 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()); + pDev->SetFont(aFont); + Point aStart(aBLPos.X() + nRectWidth * 7 / 9 , aBLPos.Y() + nRectHeight/6); + pDev->DrawText(aStart, strUnit[ nItemId - 1 ]); //can't set TEXT_DRAW_ENDELLIPSIS here ,or the text will disappear + + //draw line + if( nSelItem == nItemId ) + pDev->SetLineColor(COL_WHITE); + else + pDev->SetLineColor(GetSettings().GetStyleSettings().GetFieldTextColor()); + + for(sal_uInt16 i = 1; i <= nItemId; i++) + { + pDev->DrawLine(aLineStart,aLineEnd ); + aLineStart.setY(aLineStart.getY() + 1); + aLineEnd.setY (aLineEnd.getY() + 1); + } + } + + Invalidate( aRect ); + pDev->SetLineColor(aOldColor); + pDev->SetFillColor(aOldFillColor); + pDev->SetFont(aOldFont); +} + + + +} } // end of namespace svx::sidebar + +// eof diff --git a/svx/source/sidebar/line/LineWidthValueSet.hxx b/svx/source/sidebar/line/LineWidthValueSet.hxx new file mode 100644 index 000000000000..1e97af100e25 --- /dev/null +++ b/svx/source/sidebar/line/LineWidthValueSet.hxx @@ -0,0 +1,53 @@ +/* + * 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 SVX_SIDEBAR_LINE_WIDTH_VALUE_SET_HXX +#define SVX_SIDEBAR_LINE_WIDTH_VALUE_SET_HXX + +#include <svtools/valueset.hxx> +#include <vcl/image.hxx> + +namespace svx { namespace sidebar { + +class LineWidthValueSet + : public ValueSet +{ +public: + LineWidthValueSet (Window* pParent, const ResId& rResId); + virtual ~LineWidthValueSet (void); + + 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 ); + +protected: + VirtualDevice* pVDev; + sal_uInt16 nSelItem; + XubString* strUnit; + Image imgCus; + bool bCusEnable; +}; + +} } // end of namespace svx::sidebar + +#endif // SVX_SIDEBAR_LINE_WIDTH_VALUE_SET_HXX + +// eof diff --git a/svx/source/sidebar/nbdtmg.cxx b/svx/source/sidebar/nbdtmg.cxx new file mode 100644 index 000000000000..2acc98dc04d0 --- /dev/null +++ b/svx/source/sidebar/nbdtmg.cxx @@ -0,0 +1,2051 @@ +/* + * 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 <svx/nbdtmg.hxx> +#include <svx/svxids.hrc> +#include <vcl/svapp.hxx> +#include <svl/itemset.hxx> +#include <sfx2/request.hxx> +#include <svl/stritem.hxx> +#include <editeng/unolingu.hxx> +#include <svtools/ctrltool.hxx> +#include <sfx2/objsh.hxx> +#include <editeng/flstitem.hxx> +#include <svl/itempool.hxx> +#include <vcl/outdev.hxx> +#include <svx/gallery.hxx> +#include <editeng/brushitem.hxx> +#include <svx/dialmgr.hxx> +#include <svx/dialogs.hrc> +#include <vcl/graph.hxx> + +#include <unotools/streamwrap.hxx> +#include <unotools/ucbstreamhelper.hxx> +#include <unotools/pathoptions.hxx> +#include <editeng/eeitem.hxx> + +#include <com/sun/star/text/HoriOrientation.hpp> +#include <com/sun/star/text/VertOrientation.hpp> +#include <com/sun/star/text/RelOrientation.hpp> +#include <com/sun/star/style/NumberingType.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/text/XDefaultNumberingProvider.hpp> +#include <com/sun/star/text/XNumberingFormatter.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <comphelper/processfactory.hxx> +#include <com/sun/star/text/XNumberingTypeInfo.hpp> + +using namespace com::sun::star; +using namespace com::sun::star::uno; +using namespace com::sun::star::beans; +using namespace com::sun::star::lang; +using namespace com::sun::star::text; +using namespace com::sun::star::container; +using namespace com::sun::star::style; +using rtl::OUString; + +namespace svx { namespace sidebar { +#define MAX_VALUESET_GRAPHIC 30 + +Font& lcl_GetDefaultBulletFont() +{ + static sal_Bool bInit = 0; + static Font aDefBulletFont( OUString("StarSymbol" ), + String(), Size( 0, 14 ) ); + if(!bInit) + { + aDefBulletFont.SetCharSet( RTL_TEXTENCODING_SYMBOL ); + aDefBulletFont.SetFamily( FAMILY_DONTKNOW ); + aDefBulletFont.SetPitch( PITCH_DONTKNOW ); + aDefBulletFont.SetWeight( WEIGHT_DONTKNOW ); + aDefBulletFont.SetTransparent( sal_True ); + bInit = sal_True; + } + return aDefBulletFont; +} + +static const sal_Unicode aDefaultBulletTypes[] = +{ + 0x2022, + 0x25cf, + 0xe00c, + 0xe00a, + 0x2794, + 0x27a2, + 0x2717, + 0x2714 +}; + +static const sal_Unicode aDefaultRTLBulletTypes[] = +{ + 0x2022, + 0x25cf, + 0xe00c, + 0xe00a, + 0x25c4, + 0x272b, + 0x2717, + 0x2714 +}; + +static const sal_Char sNumberingType[] = "NumberingType"; +static const sal_Char sValue[] = "Value"; +static const sal_Char sParentNumbering[] = "ParentNumbering"; +static const sal_Char sPrefix[] = "Prefix"; +static const sal_Char sSuffix[] = "Suffix"; +static const sal_Char sBulletChar[] = "BulletChar"; +static const sal_Char sBulletFontName[] = "BulletFontName"; + +NumSettings_ImplPtr lcl_CreateNumberingSettingsPtr(const Sequence<PropertyValue>& rLevelProps) +{ + const PropertyValue* pValues = rLevelProps.getConstArray(); + NumSettings_ImplPtr pNew = new NumSettings_Impl; + for(sal_Int32 j = 0; j < rLevelProps.getLength(); j++) + { + if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sNumberingType))) + pValues[j].Value >>= pNew->nNumberType; + else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sPrefix))) + pValues[j].Value >>= pNew->sPrefix; + else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sSuffix))) + pValues[j].Value >>= pNew->sSuffix; + else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sParentNumbering))) + pValues[j].Value >>= pNew->nParentNumbering; + else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sBulletChar))) + pValues[j].Value >>= pNew->sBulletChar; + else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sBulletFontName))) + pValues[j].Value >>= pNew->sBulletFont; + } + const sal_Unicode cLocalPrefix = pNew->sPrefix.getLength() ? pNew->sPrefix.getStr()[0] : 0; + const sal_Unicode cLocalSuffix = pNew->sSuffix.getLength() ? pNew->sSuffix.getStr()[0] : 0; + String aEmptyStr; + if( cLocalPrefix == ' ') pNew->sPrefix=aEmptyStr; + if( cLocalSuffix == ' ') pNew->sSuffix=aEmptyStr; + return pNew; +} + +sal_uInt16 NBOTypeMgrBase:: IsSingleLevel(sal_uInt16 nCurLevel) +{ + sal_uInt16 nLv = (sal_uInt16)0xFFFF; + sal_uInt16 nCount = 0; + sal_uInt16 nMask = 1; + for( sal_uInt16 i = 0; i < SVX_MAX_NUM; i++ ) + { + if(nCurLevel & nMask) + { + nCount++; + nLv=i; + } + nMask <<= 1 ; + } + + if ( nCount == 1) + return nLv; + else + return (sal_uInt16)0xFFFF; +} + +void NBOTypeMgrBase::StoreBulCharFmtName_impl() { + if ( pSet ) + { + SfxAllItemSet aSet(*pSet); + SFX_ITEMSET_ARG(&aSet,pBulletCharFmt,SfxStringItem,SID_BULLET_CHAR_FMT,sal_False); + + if ( pBulletCharFmt ) + { + aNumCharFmtName = String(pBulletCharFmt->GetValue()); + } + } +} +String NBOTypeMgrBase::GetBulCharFmtName() +{ + return aNumCharFmtName; +} +void NBOTypeMgrBase::ImplLoad(String filename) +{ + bIsLoading = true; + SfxMapUnit eOldCoreUnit=eCoreUnit; + eCoreUnit = SFX_MAPUNIT_100TH_MM; + INetURLObject aFile( SvtPathOptions().GetPalettePath() ); + aFile.Append( filename); + SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( aFile.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ ); + if( pIStm ) { + sal_uInt32 nVersion; + sal_Int32 nNumIndex; + *pIStm >> nVersion; + if (nVersion==DEFAULT_NUMBERING_CACHE_FORMAT_VERSION) //first version + { + *pIStm >> nNumIndex; + sal_uInt16 mLevel = 0x1; + while (nNumIndex>=0 && nNumIndex<DEFAULT_NUM_VALUSET_COUNT) { + SvxNumRule aNum(*pIStm); + //bullet color in font properties is not stored correctly. Need set tranparency bits manually + for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++) + { + SvxNumberFormat aFmt(aNum.GetLevel(i)); + if (aFmt.GetBulletFont()) { + Font aFont(*aFmt.GetBulletFont()); + Color c=aFont.GetColor(); + c.SetTransparency(0xFF); + aFont.SetColor(c); + aFmt.SetBulletFont(&aFont); + aNum.SetLevel(i, aFmt); + } + } + RelplaceNumRule(aNum,nNumIndex,mLevel); + *pIStm >> nNumIndex; + } + delete pIStm; + } + } + eCoreUnit = eOldCoreUnit; + bIsLoading = false; +} +void NBOTypeMgrBase::ImplStore(String filename) +{ + if (bIsLoading) return; + SfxMapUnit eOldCoreUnit=eCoreUnit; + eCoreUnit = SFX_MAPUNIT_100TH_MM; + INetURLObject aFile( SvtPathOptions().GetPalettePath() ); + aFile.Append( filename); + SvStream* pOStm = ::utl::UcbStreamHelper::CreateStream( aFile.GetMainURL( INetURLObject::NO_DECODE ), STREAM_WRITE ); + if( pOStm ) { + sal_uInt32 nVersion; + sal_Int32 nNumIndex; + nVersion = DEFAULT_NUMBERING_CACHE_FORMAT_VERSION; + *pOStm << nVersion; + for(sal_Int32 nItem = 0; nItem < DEFAULT_NUM_VALUSET_COUNT; nItem++ ) { + if (IsCustomized(nItem)) { + SvxNumRule aDefNumRule( NUM_BULLET_REL_SIZE|NUM_CONTINUOUS|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE|NUM_SYMBOL_ALIGNMENT,10, sal_False , + SVX_RULETYPE_NUMBERING,SvxNumberFormat::LABEL_ALIGNMENT); + sal_uInt16 mLevel = 0x1; + *pOStm << nItem; + ApplyNumRule(aDefNumRule,nItem,mLevel,false,true); + aDefNumRule.Store(*pOStm); + } + } + nNumIndex = -1; + *pOStm << nNumIndex; //write end flag + delete pOStm; + } + eCoreUnit = eOldCoreUnit; +} + +void NBOTypeMgrBase::StoreMapUnit_impl() { + if ( pSet ) + { + const SfxPoolItem* pItem; + SfxItemState eState = pSet->GetItemState(SID_ATTR_NUMBERING_RULE, sal_False, &pItem); + if(eState == SFX_ITEM_SET) + { + eCoreUnit = pSet->GetPool()->GetMetric(pSet->GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE)); + } else { + //Sym3_2508 sd use different sid for numbering rule + eState = pSet->GetItemState(EE_PARA_NUMBULLET, sal_False, &pItem); + if(eState == SFX_ITEM_SET) + { + eCoreUnit = pSet->GetPool()->GetMetric(pSet->GetPool()->GetWhich(EE_PARA_NUMBULLET)); + } + } + } +} +SfxMapUnit NBOTypeMgrBase::GetMapUnit() +{ + return eCoreUnit; +} +/*************************************************************************************************** +**********************Character Bullet Type lib********************************************************** +****************************************************************************************************/ +BulletsTypeMgr* BulletsTypeMgr::_instance = 0; +BulletsSettings_Impl* BulletsTypeMgr::pActualBullets[] ={0,0,0,0,0,0,0,0}; +sal_Unicode BulletsTypeMgr::aDynamicBulletTypes[]={' ',' ',' ',' ',' ',' ',' ',' '}; +sal_Unicode BulletsTypeMgr::aDynamicRTLBulletTypes[]={' ',' ',' ',' ',' ',' ',' ',' '}; + +BulletsTypeMgr::BulletsTypeMgr(const NBOType aType): + NBOTypeMgrBase(aType) +{ + Init(); +} + +BulletsTypeMgr::BulletsTypeMgr(const NBOType aType,const SfxItemSet* pArg): + NBOTypeMgrBase(aType,pArg) +{ + Init(); +} + +BulletsTypeMgr::BulletsTypeMgr(const BulletsTypeMgr& aTypeMgr): + NBOTypeMgrBase(aTypeMgr) +{ + for (sal_uInt16 i=0;i<DEFAULT_BULLET_TYPES;i++) + { + pActualBullets[i]->bIsCustomized = aTypeMgr.pActualBullets[i]->bIsCustomized; + pActualBullets[i]->cBulletChar = aTypeMgr.pActualBullets[i]->cBulletChar; + pActualBullets[i]->aFont = aTypeMgr.pActualBullets[i]->aFont; + pActualBullets[i]->sDescription = aTypeMgr. pActualBullets[i]->sDescription; + pActualBullets[i]->eType = aTypeMgr. pActualBullets[i]->eType; + } +} +void BulletsTypeMgr::Init() +{ + Font& rActBulletFont = lcl_GetDefaultBulletFont(); + String sName = rActBulletFont.GetName(); + if( Application::GetSettings().GetLayoutRTL() ) + { + for (sal_uInt16 i=0;i<DEFAULT_BULLET_TYPES;i++) + { + pActualBullets[i] = new BulletsSettings_Impl(eNBType::BULLETS); + pActualBullets[i]->cBulletChar = aDefaultRTLBulletTypes[i]; + pActualBullets[i]->aFont = rActBulletFont; + if (i==4 || i==5) + pActualBullets[i]->sDescription = SVX_RESSTR( RID_SVXSTR_BULLET_RTL_DESCRIPTION_4 - 4 + i ); + else + pActualBullets[i]->sDescription = SVX_RESSTR( RID_SVXSTR_BULLET_DESCRIPTION_0 + i ); + } + }else + { + for (sal_uInt16 i=0;i<DEFAULT_BULLET_TYPES;i++) + { + pActualBullets[i] = new BulletsSettings_Impl(eNBType::BULLETS); + pActualBullets[i]->cBulletChar = aDefaultBulletTypes[i]; + pActualBullets[i]->aFont =rActBulletFont; + pActualBullets[i]->sDescription = SVX_RESSTR( RID_SVXSTR_BULLET_DESCRIPTION_0 + i ); + } + } +} +sal_uInt16 BulletsTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex) +{ + if ( mLevel == (sal_uInt16)0xFFFF || mLevel == 0) + return (sal_uInt16)0xFFFF; + //if ( !lcl_IsNumFmtSet(pNR, mLevel) ) return (sal_uInt16)0xFFFF; + + sal_uInt16 nActLv = IsSingleLevel(mLevel); + + if ( nActLv == (sal_uInt16)0xFFFF ) + return (sal_uInt16)0xFFFF; + + SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); + sal_Unicode cChar = aFmt.GetBulletChar(); + //const Font* pFont = aFmt.GetBulletFont(); + //sal_uInt16 nLength = 0; + /*if( Application::GetSettings().GetLayoutRTL() ) + { + nLength = sizeof(aDynamicRTLBulletTypes)/sizeof(sal_Unicode); + for(sal_uInt16 i = 0; i < nLength; i++) + { + if ( cChar == aDynamicRTLBulletTypes[i] || + (cChar == 9830 && 57356 == aDynamicRTLBulletTypes[i]) || + (cChar == 9632 && 57354 == aDynamicRTLBulletTypes[i]) ) + { + return i+1; + } + } + } else + { + nLength = sizeof(aDynamicBulletTypes)/sizeof(sal_Unicode); + for(sal_uInt16 i = 0; i < nLength; i++) + { + if ( cChar == aDynamicBulletTypes[i] || + (cChar == 9830 && 57356 == aDynamicBulletTypes[i]) || + (cChar == 9632 && 57354 == aDynamicBulletTypes[i]) ) + { + return i+1; + } + } + }*/ + //nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl); + for(sal_uInt16 i = nFromIndex; i < DEFAULT_BULLET_TYPES; i++) + { + if ( (cChar == pActualBullets[i]->cBulletChar|| + (cChar == 9830 && 57356 == pActualBullets[i]->cBulletChar) || + (cChar == 9632 && 57354 == pActualBullets[i]->cBulletChar)))// && pFont && (pFont->GetName().CompareTo(pActualBullets[i]->aFont.GetName())==COMPARE_EQUAL)) + { + return i+1; + } + } + + return (sal_uInt16)0xFFFF; +} + +sal_Bool BulletsTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel) +{ + if ( mLevel == (sal_uInt16)0xFFFF || mLevel == 0) + return sal_False; + + if ( GetNBOIndexForNumRule(aNum,mLevel) != (sal_uInt16)0xFFFF ) + return sal_False; + + sal_uInt16 nActLv = IsSingleLevel(mLevel); + + if ( nActLv == (sal_uInt16)0xFFFF ) + return sal_False; + + SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); + sal_Unicode cChar = aFmt.GetBulletChar(); + const Font* pFont = aFmt.GetBulletFont(); + //sal_uInt16 nLength = 0; + /*if( Application::GetSettings().GetLayoutRTL() ) + { + nLength = sizeof(aDynamicRTLBulletTypes)/sizeof(sal_Unicode); + + if ( nIndex >= nLength ) + return sal_False; + + aDynamicRTLBulletTypes[nIndex] = cChar; + } else + { + nLength = sizeof(aDynamicBulletTypes)/sizeof(sal_Unicode); + + if ( nIndex >= nLength ) + return sal_False; + + aDynamicBulletTypes[nIndex] = cChar; + }*/ + //nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl); + if ( nIndex >= DEFAULT_BULLET_TYPES ) + return sal_False; + + pActualBullets[nIndex]->cBulletChar = cChar; + if ( pFont ) + pActualBullets[nIndex]->aFont = *pFont; + pActualBullets[nIndex]->bIsCustomized = sal_True; + + String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION)); + String aReplace = OUString("%LIST_NUM"); + String sNUM = OUString::number( nIndex + 1 ); + aStrFromRES.SearchAndReplace(aReplace,sNUM); + pActualBullets[nIndex]->sDescription = aStrFromRES; + + return sal_True; +} + +sal_Bool BulletsTypeMgr::ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel,sal_Bool /*isDefault*/,sal_Bool isResetSize) +{ + //if ( mLevel == (sal_uInt16)0xFFFF ) + // return sal_False; + + sal_Unicode cChar; + //sal_uInt16 nLength = 0; + /*if( Application::GetSettings().GetLayoutRTL() ) + { + nLength = sizeof(aDynamicRTLBulletTypes)/sizeof(sal_Unicode); + + if ( nIndex >= nLength ) + return sal_False; + + cChar = aDynamicRTLBulletTypes[nIndex]; + }else + { + nLength = sizeof(aDynamicBulletTypes)/sizeof(sal_Unicode); + + if ( nIndex >= nLength ) + return sal_False; + + cChar = aDynamicBulletTypes[nIndex]; + }*/ + //nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl); + if ( nIndex >= DEFAULT_BULLET_TYPES ) + return sal_False; + cChar = pActualBullets[nIndex]->cBulletChar; + //Font& rActBulletFont = lcl_GetDefaultBulletFont(); + Font rActBulletFont = pActualBullets[nIndex]->aFont; + + sal_uInt16 nMask = 1; + String sBulletCharFmtName = GetBulCharFmtName(); + for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++) + { + if(mLevel & nMask) + { + SvxNumberFormat aFmt(aNum.GetLevel(i)); + aFmt.SetNumberingType( SVX_NUM_CHAR_SPECIAL ); + aFmt.SetBulletFont(&rActBulletFont); + aFmt.SetBulletChar(cChar ); + aFmt.SetCharFmtName(sBulletCharFmtName); + if (isResetSize) aFmt.SetBulletRelSize(45); + aNum.SetLevel(i, aFmt); + } + nMask <<= 1; + } + + return sal_True; +} + +String BulletsTypeMgr::GetDescription(sal_uInt16 nIndex,sal_Bool /*isDefault*/) +{ + String sRet; + //sal_uInt16 nLength = 0; + //nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl); + + if ( nIndex >= DEFAULT_BULLET_TYPES ) + return sRet; + else + sRet = pActualBullets[nIndex]->sDescription; + + return sRet; +} +sal_Bool BulletsTypeMgr::IsCustomized(sal_uInt16 nIndex) +{ + sal_Bool bRet = sal_False; + //sal_uInt16 nLength = 0; + //nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl); + + if ( nIndex >= DEFAULT_BULLET_TYPES ) + bRet = sal_False; + else + bRet = pActualBullets[nIndex]->bIsCustomized; + + return bRet; +} + +sal_Unicode BulletsTypeMgr::GetBulChar(sal_uInt16 nIndex) +{ + sal_Unicode cChar; + //sal_uInt16 nLength = 0; + //nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl); + + if ( nIndex >= DEFAULT_BULLET_TYPES ) + cChar = ' '; + else + cChar = pActualBullets[nIndex]->cBulletChar; + + /*if( Application::GetSettings().GetLayoutRTL() ) + { + nLength = sizeof(aDynamicRTLBulletTypes)/sizeof(sal_Unicode); + + if ( nIndex >= nLength ) + cChar = ' '; + else + cChar = aDynamicRTLBulletTypes[nIndex]; + }else + { + nLength = sizeof(aDynamicBulletTypes)/sizeof(sal_Unicode); + + if ( nIndex >= nLength ) + cChar = ' '; + else + cChar = aDynamicBulletTypes[nIndex]; + }*/ + + return cChar; +} +Font BulletsTypeMgr::GetBulCharFont(sal_uInt16 nIndex) +{ + Font aRet; + if ( nIndex >= DEFAULT_BULLET_TYPES ) + aRet = lcl_GetDefaultBulletFont(); + else + aRet = pActualBullets[nIndex]->aFont; + + return aRet; +} +/*************************************************************************************************** +**********************Graphic Bullet Type lib*********************************************************** +****************************************************************************************************/ +GraphyicBulletsTypeMgr* GraphyicBulletsTypeMgr::_instance = 0; +GraphyicBulletsTypeMgr::GraphyicBulletsTypeMgr(const NBOType aType): + NBOTypeMgrBase(aType) +{ + Init(); +} + +GraphyicBulletsTypeMgr::GraphyicBulletsTypeMgr(const NBOType aType,const SfxItemSet* pArg): + NBOTypeMgrBase(aType,pArg) +{ + Init(); +} +GraphyicBulletsTypeMgr::GraphyicBulletsTypeMgr(const GraphyicBulletsTypeMgr& aTypeMgr): + NBOTypeMgrBase(aTypeMgr) +{ + for (sal_uInt16 i=0;i< aTypeMgr.aGrfDataLst.size();++i) + { + GrfBulDataRelation* pEntry = new GrfBulDataRelation(eNBType::GRAPHICBULLETS); + GrfBulDataRelation* pSrcEntry = i < aTypeMgr.aGrfDataLst.size() ? aTypeMgr.aGrfDataLst[i] : NULL; + if ( pEntry && pSrcEntry) + { + pEntry->bIsCustomized = pSrcEntry->bIsCustomized; + pEntry->nTabIndex = pSrcEntry->nTabIndex; + pEntry->nGallaryIndex = pSrcEntry->nGallaryIndex; + pEntry->sGrfName = pSrcEntry->sGrfName; + pEntry->sDescription = pSrcEntry->sDescription; + aGrfDataLst.push_back(pEntry); + } + } +} + +GraphyicBulletsTypeMgr::~GraphyicBulletsTypeMgr() +{ + for (size_t i = 0; i < aGrfDataLst.size(); ++i) + delete aGrfDataLst[i]; +} + +void GraphyicBulletsTypeMgr::Init() +{ + std::vector<String> aGrfNames; + GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, aGrfNames); + for(sal_uInt16 i = 0; i < aGrfNames.size(); i++) + { + String sGrfNm = aGrfNames[i]; + INetURLObject aObj(sGrfNm); + if(aObj.GetProtocol() == INET_PROT_FILE) + sGrfNm = aObj.PathToFileName(); + + GrfBulDataRelation* pEntry = new GrfBulDataRelation(eNBType::GRAPHICBULLETS); + pEntry->nTabIndex = i+1; + pEntry->nGallaryIndex = i; + pEntry->sGrfName = sGrfNm; + + if( i < MAX_VALUESET_GRAPHIC ) + { + pEntry->sDescription = SVX_RESSTR( RID_SVXSTR_GRAPHICS_DESCRIPTIONS + i ); + }else + { + pEntry->sDescription = sGrfNm; + } + + aGrfDataLst.push_back(pEntry); + } +} +sal_uInt16 GraphyicBulletsTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 /*nFromIndex*/) +{ + if ( mLevel == (sal_uInt16)0xFFFF || mLevel == 0) + return (sal_uInt16)0xFFFF; + + sal_uInt16 nActLv = IsSingleLevel(mLevel); + + if ( nActLv == (sal_uInt16)0xFFFF ) + return (sal_uInt16)0xFFFF; + + SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); + const SvxBrushItem* pBrsh = aFmt.GetBrush(); + const Graphic* pGrf = 0; + if ( pBrsh ) + pGrf = pBrsh->GetGraphic(); + + if ( pGrf ) + { + //const String* pGrfName = pBrsh->GetGraphicLink(); + Graphic aGraphic; + for (sal_uInt16 i=0; i < aGrfDataLst.size(); ++i) + { + GrfBulDataRelation* pEntry = aGrfDataLst[i]; + sal_Bool bExist = sal_False; + if ( pEntry) // && pEntry->sGrfName.CompareTo(*pGrfName)==COMPARE_EQUAL ) + bExist = GalleryExplorer::GetGraphicObj(GALLERY_THEME_BULLETS, pEntry->nGallaryIndex,&aGraphic); + if (bExist) { + Bitmap aSum=pGrf->GetBitmap(); + Bitmap aSum1=aGraphic.GetBitmap(); + if (aSum.IsEqual(aSum1)) + return pEntry->nTabIndex; + } + } + } + + return (sal_uInt16)0xFFFF; +} + +sal_Bool GraphyicBulletsTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel) +{ + if ( mLevel == (sal_uInt16)0xFFFF || mLevel > aNum.GetLevelCount() || mLevel == 0) + return sal_False; + + if ( GetNBOIndexForNumRule(aNum,mLevel) != (sal_uInt16)0xFFFF ) + return sal_False; + + if ( nIndex >= aGrfDataLst.size() ) + return sal_False; + + sal_uInt16 nActLv = IsSingleLevel(mLevel); + if ( nActLv == (sal_uInt16)0xFFFF ) + return sal_False; + + SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); + const SvxBrushItem* pBrsh = aFmt.GetBrush(); + const Graphic* pGrf = 0; + if ( pBrsh ) + pGrf = pBrsh->GetGraphic(); + else + return sal_False; + + String sEmpty; + if ( pGrf ) + { + const String* pGrfName = pBrsh->GetGraphicLink(); + //String* pGrfName = (String*)(pBrsh->GetGraphicLink()); + GrfBulDataRelation* pEntry = aGrfDataLst[nIndex]; + if ( pGrfName ) + pEntry->sGrfName = *pGrfName; + //pEntry->sDescription = sEmpty; + pEntry->nGallaryIndex = (sal_uInt16)0xFFFF; + pEntry->bIsCustomized = sal_True; + String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION)); + String aReplace = OUString("%LIST_NUM"); + String sNUM = OUString::number( nIndex + 1 ); + aStrFromRES.SearchAndReplace(aReplace,sNUM); + pEntry->sDescription = aStrFromRES; + }else + { + return sal_False; + } + + return sal_True; +} + +sal_Bool GraphyicBulletsTypeMgr::ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel,sal_Bool /*isDefault*/,sal_Bool /*isResetSize*/) +{ + //if ( mLevel == (sal_uInt16)0xFFFF ) + // return sal_False; + + if ( nIndex >= aGrfDataLst.size() ) + return sal_False; + + String sGrfName; + GrfBulDataRelation* pEntry = aGrfDataLst[nIndex]; + sGrfName= pEntry->sGrfName; + + sal_uInt16 nMask = 1; + String aEmptyStr; + sal_uInt16 nSetNumberingType = SVX_NUM_BITMAP; + String sNumCharFmtName = GetBulCharFmtName(); + for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++) + { + if(mLevel & nMask) + { + SvxNumberFormat aFmt(aNum.GetLevel(i)); + aFmt.SetNumberingType(nSetNumberingType); + aFmt.SetPrefix( aEmptyStr ); + aFmt.SetSuffix( aEmptyStr ); + aFmt.SetCharFmtName( sNumCharFmtName ); + + Graphic aGraphic; + if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, pEntry->nGallaryIndex, &aGraphic)) + { + Size aSize = SvxNumberFormat::GetGraphicSizeMM100(&aGraphic); + sal_Int16 eOrient = text::VertOrientation::LINE_CENTER; + aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)GetMapUnit()); + SvxBrushItem aBrush(aGraphic, GPOS_AREA, SID_ATTR_BRUSH ); + aFmt.SetGraphicBrush( &aBrush, &aSize, &eOrient ); + } + else// if(pGrfName) + aFmt.SetGraphic( sGrfName ); + + aNum.SetLevel(i, aFmt); + } + nMask <<= 1 ; + } + + return sal_True; +} +String GraphyicBulletsTypeMgr::GetDescription(sal_uInt16 nIndex,sal_Bool /*isDefault*/) +{ + String sRet; + sal_uInt16 nLength = 0; + nLength = aGrfDataLst.size(); + + if ( nIndex >= nLength ) + return sRet; + else + { + GrfBulDataRelation* pEntry = aGrfDataLst[nIndex]; + if ( pEntry ) + { + sRet = pEntry->sDescription; + }; + } + return sRet; +} +sal_Bool GraphyicBulletsTypeMgr::IsCustomized(sal_uInt16 nIndex) +{ + sal_Bool bRet = sal_False; + + sal_uInt16 nLength = 0; + nLength = aGrfDataLst.size() ; + + if ( nIndex >= nLength ) + return bRet; + else + { + GrfBulDataRelation* pEntry = aGrfDataLst[nIndex]; + if ( pEntry ) + { + bRet = pEntry->bIsCustomized; + }; + } + + return bRet; +} +String GraphyicBulletsTypeMgr::GetGrfName(sal_uInt16 nIndex) +{ + String sRet; + if ( nIndex < aGrfDataLst.size() ) + { + GrfBulDataRelation* pEntry = aGrfDataLst[nIndex]; + if ( pEntry ) + { + sRet = pEntry->sGrfName; + } + } + + return sRet; +} +/*************************************************************************************************** +**********************Mix Bullets Type lib************************************************************** +****************************************************************************************************/ +MixBulletsTypeMgr* MixBulletsTypeMgr::_instance = 0; +MixBulletsSettings_Impl* MixBulletsTypeMgr::pActualBullets[] ={0,0,0,0,0,0,0,0}; +MixBulletsSettings_Impl* MixBulletsTypeMgr::pDefaultActualBullets[] ={0,0,0,0,0,0,0,0}; + +MixBulletsTypeMgr::MixBulletsTypeMgr(const NBOType aType): + NBOTypeMgrBase(aType) +{ + Init(); + for(sal_Int32 nItem = 0; nItem < DEFAULT_BULLET_TYPES; nItem++ ) + { + pDefaultActualBullets[nItem] = pActualBullets[nItem]; + } + //Initial the first time to store the default value. Then do it again for customized value + Init(); + ImplLoad(OUString("standard.sya")); +} + +MixBulletsTypeMgr::MixBulletsTypeMgr(const NBOType aType,const SfxItemSet* pArg): + NBOTypeMgrBase(aType,pArg) +{ + Init(); + for(sal_Int32 nItem = 0; nItem < DEFAULT_BULLET_TYPES; nItem++ ) + { + pDefaultActualBullets[nItem] = pActualBullets[nItem]; + } + //Initial the first time to store the default value. Then do it again for customized value + Init(); + ImplLoad(OUString("standard.sya")); +} + +MixBulletsTypeMgr::MixBulletsTypeMgr(const MixBulletsTypeMgr& aTypeMgr): + NBOTypeMgrBase(aTypeMgr) +{ + for (sal_uInt16 i=0;i<DEFAULT_BULLET_TYPES;i++) + { + if ( aTypeMgr.pActualBullets[i]->eType == eNBType::BULLETS ) + { + pActualBullets[i]->eType = aTypeMgr.pActualBullets[i]->eType; + pActualBullets[i]->nIndex = aTypeMgr.pActualBullets[i]->nIndex; //index in the tab page display + pActualBullets[i]->nIndexDefault = aTypeMgr.pActualBullets[i]->nIndexDefault; + pActualBullets[i]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ; + ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->cBulletChar = ((BulletsSettings_Impl*)(aTypeMgr.pActualBullets[i]->pBullets))->cBulletChar; + ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->aFont = ((BulletsSettings_Impl*)(aTypeMgr.pActualBullets[i]->pBullets))->aFont; + ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->sDescription = ((BulletsSettings_Impl*)(aTypeMgr.pActualBullets[i]->pBullets))->sDescription; + ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->bIsCustomized = ((BulletsSettings_Impl*)(aTypeMgr.pActualBullets[i]->pBullets))->bIsCustomized; + ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->eType = ((BulletsSettings_Impl*)(aTypeMgr.pActualBullets[i]->pBullets))->eType; + }else if ( aTypeMgr.pActualBullets[i]->eType == eNBType::GRAPHICBULLETS ) + { + pActualBullets[i]->eType = aTypeMgr.pActualBullets[i]->eType; + pActualBullets[i]->nIndex = aTypeMgr.pActualBullets[i]->nIndex; //index in the tab page display + pActualBullets[i]->nIndexDefault = aTypeMgr.pActualBullets[i]->nIndexDefault; + pActualBullets[i]->pBullets = new GrfBulDataRelation(eNBType::GRAPHICBULLETS) ; + ((GrfBulDataRelation*)(pActualBullets[i]->pBullets))->sGrfName = ((GrfBulDataRelation*)(aTypeMgr.pActualBullets[i]->pBullets))->sGrfName; + ((GrfBulDataRelation*)(pActualBullets[i]->pBullets))->sDescription = ((GrfBulDataRelation*)(aTypeMgr.pActualBullets[i]->pBullets))->sDescription; + ((GrfBulDataRelation*)(pActualBullets[i]->pBullets))->bIsCustomized = ((GrfBulDataRelation*)(aTypeMgr.pActualBullets[i]->pBullets))->bIsCustomized; + ((GrfBulDataRelation*)(pActualBullets[i]->pBullets))->eType = ((GrfBulDataRelation*)(aTypeMgr.pActualBullets[i]->pBullets))->eType; + if ( ((GrfBulDataRelation*)(aTypeMgr.pActualBullets[i]->pBullets))->bIsCustomized && ((GrfBulDataRelation*)(aTypeMgr.pActualBullets[i]->pBullets))->pGrfObj != NULL) + { + ((GrfBulDataRelation*)(pActualBullets[i]->pBullets))->pGrfObj = ((GrfBulDataRelation*)(aTypeMgr.pActualBullets[i]->pBullets))->pGrfObj; + } + } + } + ImplLoad(OUString("standard.sya")); +} +void MixBulletsTypeMgr::Init() +{ + BulletsTypeMgr* pBTMgr = BulletsTypeMgr::GetInstance(); + if ( pBTMgr ) + { + //Index 1 + pActualBullets[0] = new MixBulletsSettings_Impl(eNBType::BULLETS); + pActualBullets[0]->eType = eNBType::BULLETS; + pActualBullets[0]->nIndex = 0+1; //index in the tab page display,decrease 1 to the index within arr + pActualBullets[0]->nIndexDefault = 2; //index in the tab page display,decrease 1 to the index within arr + pActualBullets[0]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ; + ((BulletsSettings_Impl*)(pActualBullets[0]->pBullets))->cBulletChar = pBTMgr->GetBulChar(pActualBullets[0]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[0]->pBullets))->aFont = pBTMgr->GetBulCharFont(pActualBullets[0]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[0]->pBullets))->sDescription = pBTMgr->GetDescription(pActualBullets[0]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[0]->pBullets))->bIsCustomized = pBTMgr->IsCustomized(pActualBullets[0]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[0]->pBullets))->eType = eNBType::BULLETS; + + //Index 2 + pActualBullets[1] = new MixBulletsSettings_Impl(eNBType::BULLETS); + pActualBullets[1]->eType = eNBType::BULLETS; + pActualBullets[1]->nIndex = 1+1; //index in the tab page display,decrease 1 to the index within arr + pActualBullets[1]->nIndexDefault = 3; //index in the tab page display,decrease 1 to the index within arr + pActualBullets[1]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ; + ((BulletsSettings_Impl*)(pActualBullets[1]->pBullets))->cBulletChar = pBTMgr->GetBulChar(pActualBullets[1]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[1]->pBullets))->aFont = pBTMgr->GetBulCharFont(pActualBullets[1]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[1]->pBullets))->sDescription = pBTMgr->GetDescription(pActualBullets[1]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[1]->pBullets))->bIsCustomized = pBTMgr->IsCustomized(pActualBullets[1]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[1]->pBullets))->eType = eNBType::BULLETS; + + //Index 3 + pActualBullets[2] = new MixBulletsSettings_Impl(eNBType::BULLETS); + pActualBullets[2]->eType = eNBType::BULLETS; + pActualBullets[2]->nIndex = 2+1; //index in the tab page display,decrease 1 to the index within arr + pActualBullets[2]->nIndexDefault = 4; //index in the tab page display,decrease 1 to the index within arr + pActualBullets[2]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ; + ((BulletsSettings_Impl*)(pActualBullets[2]->pBullets))->cBulletChar = pBTMgr->GetBulChar(pActualBullets[2]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[2]->pBullets))->aFont = pBTMgr->GetBulCharFont(pActualBullets[2]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[2]->pBullets))->sDescription = pBTMgr->GetDescription(pActualBullets[2]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[2]->pBullets))->bIsCustomized = pBTMgr->IsCustomized(pActualBullets[2]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[2]->pBullets))->eType = eNBType::BULLETS; + + //Index 4 + pActualBullets[3] = new MixBulletsSettings_Impl(eNBType::BULLETS); + pActualBullets[3]->eType = eNBType::BULLETS; + pActualBullets[3]->nIndex = 3+1; //index in the tab page display,decrease 1 to the index within arr + pActualBullets[3]->nIndexDefault = 5; //index in the tab page display,decrease 1 to the index within arr + pActualBullets[3]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ; + ((BulletsSettings_Impl*)(pActualBullets[3]->pBullets))->cBulletChar = pBTMgr->GetBulChar(pActualBullets[3]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[3]->pBullets))->aFont = pBTMgr->GetBulCharFont(pActualBullets[3]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[3]->pBullets))->sDescription = pBTMgr->GetDescription(pActualBullets[3]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[3]->pBullets))->bIsCustomized = pBTMgr->IsCustomized(pActualBullets[3]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[3]->pBullets))->eType = eNBType::BULLETS; + + //Index 5 + pActualBullets[4] = new MixBulletsSettings_Impl(eNBType::BULLETS); + pActualBullets[4]->eType = eNBType::BULLETS; + pActualBullets[4]->nIndex = 4+1; //index in the tab page display,decrease 1 to the index within arr + pActualBullets[4]->nIndexDefault = 6; //index in the tab page display,decrease 1 to the index within arr + pActualBullets[4]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ; + ((BulletsSettings_Impl*)(pActualBullets[4]->pBullets))->cBulletChar = pBTMgr->GetBulChar(pActualBullets[4]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[4]->pBullets))->aFont = pBTMgr->GetBulCharFont(pActualBullets[4]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[4]->pBullets))->sDescription = pBTMgr->GetDescription(pActualBullets[4]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[4]->pBullets))->bIsCustomized = pBTMgr->IsCustomized(pActualBullets[4]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[4]->pBullets))->eType = eNBType::BULLETS; + + //Index 6 + pActualBullets[5] = new MixBulletsSettings_Impl(eNBType::BULLETS); + pActualBullets[5]->eType = eNBType::BULLETS; + pActualBullets[5]->nIndex = 5+1; //index in the tab page display,decrease 1 to the index within arr + pActualBullets[5]->nIndexDefault = 8; //index in the tab page display,decrease 1 to the index within arr + pActualBullets[5]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ; + ((BulletsSettings_Impl*)(pActualBullets[5]->pBullets))->cBulletChar = pBTMgr->GetBulChar(pActualBullets[5]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[5]->pBullets))->aFont = pBTMgr->GetBulCharFont(pActualBullets[5]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[5]->pBullets))->sDescription = pBTMgr->GetDescription(pActualBullets[5]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[5]->pBullets))->bIsCustomized = pBTMgr->IsCustomized(pActualBullets[5]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[5]->pBullets))->eType = eNBType::BULLETS; + } + + GraphyicBulletsTypeMgr* mGrfTMgr = GraphyicBulletsTypeMgr::GetInstance(); + if ( mGrfTMgr ) + { + //Index 7 + pActualBullets[6] = new MixBulletsSettings_Impl(eNBType::GRAPHICBULLETS); + pActualBullets[6]->eType = eNBType::GRAPHICBULLETS; + pActualBullets[6]->nIndex = 6+1; //index in the tab page display,decrease 1 to the index within arr + pActualBullets[6]->nIndexDefault = 9; //index in the tab page display,decrease 1 to the index within arr + pActualBullets[6]->pBullets = new GrfBulDataRelation(eNBType::GRAPHICBULLETS) ; + ((GrfBulDataRelation*)(pActualBullets[6]->pBullets))->sGrfName = mGrfTMgr->GetGrfName(pActualBullets[6]->nIndexDefault); + ((GrfBulDataRelation*)(pActualBullets[6]->pBullets))->sDescription = mGrfTMgr->GetDescription(pActualBullets[6]->nIndexDefault); + ((GrfBulDataRelation*)(pActualBullets[6]->pBullets))->bIsCustomized = mGrfTMgr->IsCustomized(pActualBullets[6]->nIndexDefault); + ((GrfBulDataRelation*)(pActualBullets[6]->pBullets))->eType = eNBType::GRAPHICBULLETS; + + //Index 8 + pActualBullets[7] = new MixBulletsSettings_Impl(eNBType::GRAPHICBULLETS); + pActualBullets[7]->eType = eNBType::GRAPHICBULLETS; + pActualBullets[7]->nIndex = 7+1; //index in the tab page display,decrease 1 to the index within arr + pActualBullets[7]->nIndexDefault = 23; //index in the tab page display,decrease 1 to the index within arr + pActualBullets[7]->pBullets = new GrfBulDataRelation(eNBType::GRAPHICBULLETS) ; + ((GrfBulDataRelation*)(pActualBullets[7]->pBullets))->sGrfName = mGrfTMgr->GetGrfName(pActualBullets[7]->nIndexDefault); + ((GrfBulDataRelation*)(pActualBullets[7]->pBullets))->sDescription = mGrfTMgr->GetDescription(pActualBullets[7]->nIndexDefault); + ((GrfBulDataRelation*)(pActualBullets[7]->pBullets))->bIsCustomized = mGrfTMgr->IsCustomized(pActualBullets[7]->nIndexDefault); + ((GrfBulDataRelation*)(pActualBullets[7]->pBullets))->eType = eNBType::GRAPHICBULLETS; + } + +} +sal_uInt16 MixBulletsTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex) +{ + if ( mLevel == (sal_uInt16)0xFFFF || mLevel == 0) + return (sal_uInt16)0xFFFF; + //if ( !lcl_IsNumFmtSet(pNR, mLevel) ) return (sal_uInt16)0xFFFF; + + sal_uInt16 nActLv = IsSingleLevel(mLevel); + + if ( nActLv == (sal_uInt16)0xFFFF ) + return (sal_uInt16)0xFFFF; + + SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); + sal_Int16 eNumType = aFmt.GetNumberingType(); + if( eNumType == SVX_NUM_CHAR_SPECIAL) + { + sal_Unicode cChar = aFmt.GetBulletChar(); + const Font* pFont = aFmt.GetBulletFont(); + String sName = pFont?pFont->GetName():String(); + + for(sal_uInt16 i = nFromIndex; i < DEFAULT_BULLET_TYPES; i++) + { + if ( pActualBullets[i]->eType == eNBType::BULLETS ) + { + String ssName = ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->aFont.GetName(); + if ( (cChar == ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->cBulletChar|| + (cChar == 9830 && 57356 == ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->cBulletChar) || + (cChar == 9632 && 57354 == ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->cBulletChar)))//&& + //(pFont && pFont->GetName().CompareTo(((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->aFont.GetName())==COMPARE_EQUAL) ) + { + return pActualBullets[i]->nIndex; + } + } + } + }else if ( (eNumType&(~LINK_TOKEN)) == SVX_NUM_BITMAP ) + { + const SvxBrushItem* pBrsh = aFmt.GetBrush(); + const Graphic* pGrf = 0; + if ( pBrsh ) + pGrf = pBrsh->GetGraphic(); + + if ( pGrf ) + { + //const String* pGrfName = pBrsh->GetGraphicLink(); + for(sal_uInt16 i = nFromIndex; i < DEFAULT_BULLET_TYPES; i++) + { + if ( pActualBullets[i]->eType == eNBType::GRAPHICBULLETS ) + { + GrfBulDataRelation* pEntry = (GrfBulDataRelation*) (pActualBullets[i]->pBullets); + //sal_Bool bExist = sal_False; + if ( pEntry && pActualBullets[i]->nIndexDefault == (sal_uInt16)0xFFFF && pEntry->pGrfObj) + { + if ( pEntry->pGrfObj->GetBitmap().IsEqual(pGrf->GetBitmap())) + { + return pActualBullets[i]->nIndex; + } + }else { //if ( pEntry && pGrfName && pEntry->sGrfName.CompareTo(*pGrfName)==COMPARE_EQUAL ) + //bExist = GalleryExplorer::GetGraphicObj(GALLERY_THEME_BULLETS, pActualBullets[i]->nIndexDefault-1,pSrGrf); + Graphic aSrGrf; + if (pEntry) + GalleryExplorer::GetGraphicObj(GALLERY_THEME_BULLETS, pActualBullets[i]->nIndexDefault,&aSrGrf); + Bitmap aSum=pGrf->GetBitmap(); + Bitmap aSum1=aSrGrf.GetBitmap(); + if (aSum.IsEqual(aSum1)) + return pActualBullets[i]->nIndex; + } + } + } + } + } + + return (sal_uInt16)0xFFFF; +} + +sal_Bool MixBulletsTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel) +{ + if ( mLevel == (sal_uInt16)0xFFFF || mLevel == 0 || nIndex>=DEFAULT_BULLET_TYPES) + return sal_False; + + //if ( GetNBOIndexForNumRule(aNum,mLevel) != (sal_uInt16)0xFFFF ) + // return sal_False; + + sal_uInt16 nActLv = IsSingleLevel(mLevel); + + if ( nActLv == (sal_uInt16)0xFFFF ) + return sal_False; + + SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); + sal_Int16 eNumType = aFmt.GetNumberingType(); + if( eNumType == SVX_NUM_CHAR_SPECIAL && pActualBullets[nIndex]->eType == eNBType::BULLETS ) + { + sal_Unicode cChar = aFmt.GetBulletChar(); + const Font* pFont = aFmt.GetBulletFont(); + BulletsSettings_Impl* pEntry = (BulletsSettings_Impl*) (pActualBullets[nIndex]->pBullets); + pEntry->cBulletChar = cChar; + pEntry->aFont = pFont?*pFont:lcl_GetDefaultBulletFont(); + pEntry->bIsCustomized = sal_True; + String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION)); + String aReplace = OUString("%LIST_NUM"); + String sNUM = OUString::number( nIndex + 1 ); + aStrFromRES.SearchAndReplace(aReplace,sNUM); + pEntry->sDescription = aStrFromRES; + + }else if ( (eNumType&(~LINK_TOKEN)) == SVX_NUM_BITMAP && pActualBullets[nIndex]->eType == eNBType::GRAPHICBULLETS ) + { + const SvxBrushItem* pBrsh = aFmt.GetBrush(); + const Graphic* pGrf = 0; + if ( pBrsh ) + pGrf = pBrsh->GetGraphic(); + else + return sal_False; + + String sEmpty; + if ( pGrf ) + { + const String* pGrfName = pBrsh->GetGraphicLink(); + GrfBulDataRelation* pEntry = (GrfBulDataRelation*) (pActualBullets[nIndex]->pBullets); + if ( pGrfName ) + pEntry->sGrfName = *pGrfName; + GraphyicBulletsTypeMgr* mGrfTMgr = GraphyicBulletsTypeMgr::GetInstance(); + if ( mGrfTMgr ) + { + //sal_uInt16 nDIndex = mGrfTMgr->GetNBOIndexForNumRule(aNum,mLevel); + //if ( nDIndex != (sal_uInt16)0xFFFF) + //{ + // pActualBullets[nIndex]->nIndexDefault = nDIndex -1; + // sEmpty = mGrfTMgr->GetDescription( nDIndex -1); + //}else + { + pActualBullets[nIndex]->nIndexDefault = (sal_uInt16)0xFFFF; + sEmpty = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION)); + String aReplace = OUString("%LIST_NUM"); + String sNUM = OUString::number( nIndex + 1 ); + sEmpty.SearchAndReplace(aReplace,sNUM); + //pEntry->pGrfObj = pGrf; + pEntry->pGrfObj = new Graphic(*pGrf); + pEntry->aSize = aFmt.GetGraphicSize(); + pEntry->aSize = OutputDevice::LogicToLogic(pEntry->aSize,(MapUnit)GetMapUnit(),MAP_100TH_MM); + sal_uInt16 nDIndex = mGrfTMgr->GetNBOIndexForNumRule(aNum,mLevel); + if (nDIndex!=(sal_uInt16)0xFFFF) pEntry->aSize=Size(0,0); + } + } + pEntry->sDescription = sEmpty; + pEntry->bIsCustomized = sal_True; + }else + { + return sal_False; + } + }else + { + delete pActualBullets[nIndex]->pBullets; + pActualBullets[nIndex]->pBullets = 0; + if ( eNumType == SVX_NUM_CHAR_SPECIAL ) + { + sal_Unicode cChar = aFmt.GetBulletChar(); + const Font* pFont = aFmt.GetBulletFont(); + pActualBullets[nIndex]->eType = eNBType::BULLETS; + pActualBullets[nIndex]->nIndex = nIndex+1; //index in the tab page display,decrease 1 to the index within arr + pActualBullets[nIndex]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ; + ((BulletsSettings_Impl*)(pActualBullets[nIndex]->pBullets))->cBulletChar = cChar; + ((BulletsSettings_Impl*)(pActualBullets[nIndex]->pBullets))->aFont = pFont?*pFont:lcl_GetDefaultBulletFont(); + ((BulletsSettings_Impl*)(pActualBullets[nIndex]->pBullets))->bIsCustomized = sal_True; + ((BulletsSettings_Impl*)(pActualBullets[nIndex]->pBullets))->eType = eNBType::BULLETS; + BulletsTypeMgr* pBTMgr = BulletsTypeMgr::GetInstance(); + if ( pBTMgr ) + { + //sal_uInt16 nDIndex = pBTMgr->GetNBOIndexForNumRule(aNum,mLevel); + //if ( nDIndex != (sal_uInt16)0xFFFF) + //{ + // pActualBullets[nIndex]->nIndexDefault = nDIndex -1; + // ((BulletsSettings_Impl*)(pActualBullets[nIndex]->pBullets))->sDescription = pBTMgr->GetDescription(nDIndex - 1); + //}else + { + pActualBullets[nIndex]->nIndexDefault = (sal_uInt16)0xFFFF; + String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION)); + String aReplace = OUString("%LIST_NUM"); + String sNUM = OUString::number( nIndex + 1 ); + aStrFromRES.SearchAndReplace(aReplace,sNUM); + ((BulletsSettings_Impl*)(pActualBullets[nIndex]->pBullets))->sDescription = aStrFromRES; + } + } + }else if ( (eNumType&(~LINK_TOKEN)) == SVX_NUM_BITMAP ) + { + const SvxBrushItem* pBrsh = aFmt.GetBrush(); + const Graphic* pGrf = 0; + if ( pBrsh ) + pGrf = pBrsh->GetGraphic(); + else + return sal_False; + + String sEmpty; + const String* pGrfName = 0; + if ( pGrf ) + { + pGrfName = pBrsh->GetGraphicLink(); + + pActualBullets[nIndex]->eType = eNBType::GRAPHICBULLETS; + pActualBullets[nIndex]->nIndex = nIndex+1; //index in the tab page display,decrease 1 to the index within arr + pActualBullets[nIndex]->pBullets = new GrfBulDataRelation(eNBType::GRAPHICBULLETS) ; + if (pGrfName) + ((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->sGrfName = *pGrfName; + ((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->bIsCustomized = sal_True; + ((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->eType = eNBType::GRAPHICBULLETS; + GraphyicBulletsTypeMgr* mGrfTMgr = GraphyicBulletsTypeMgr::GetInstance(); + if ( mGrfTMgr ) + { + //sal_uInt16 nDIndex = mGrfTMgr->GetNBOIndexForNumRule(aNum,mLevel); + //if ( nDIndex != (sal_uInt16)0xFFFF) + //{ + // pActualBullets[nIndex]->nIndexDefault = nDIndex - 1; + // ((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->sDescription = mGrfTMgr->GetDescription(nDIndex - 1); + //}else + { + pActualBullets[nIndex]->nIndexDefault = (sal_uInt16)0xFFFF; + String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION)); + String aReplace = OUString("%LIST_NUM"); + String sNUM = OUString::number( nIndex + 1 ); + aStrFromRES.SearchAndReplace(aReplace,sNUM); + ((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->sDescription = aStrFromRES; + //((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->pGrfObj = pGrf; + ((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->pGrfObj = new Graphic(*pGrf); + ((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->pGrfObj = new Graphic(*pGrf); + Size aTmpSize = aFmt.GetGraphicSize(); + aTmpSize = OutputDevice::LogicToLogic(aTmpSize,(MapUnit)GetMapUnit(),MAP_100TH_MM); + sal_uInt16 nDIndex = mGrfTMgr->GetNBOIndexForNumRule(aNum,mLevel); + if (nDIndex!=(sal_uInt16)0xFFFF) aTmpSize=Size(0,0); + ((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->aSize = aTmpSize; + + } + } + } + } + } + SvxNumRule aTmpRule1(aNum); + ApplyNumRule(aTmpRule1,nIndex,mLevel,true); + if (GetNBOIndexForNumRule(aTmpRule1,mLevel,nIndex)==nIndex+1) { + if (pActualBullets[nIndex]->eType == eNBType::BULLETS) { + BulletsSettings_Impl* pEntry = (BulletsSettings_Impl*) (pActualBullets[nIndex]->pBullets); + pEntry->bIsCustomized = false; + pEntry->sDescription = GetDescription(nIndex,true); + } + if (pActualBullets[nIndex]->eType == eNBType::GRAPHICBULLETS) { + GrfBulDataRelation* pEntry = (GrfBulDataRelation*) (pActualBullets[nIndex]->pBullets); + pEntry->bIsCustomized = false; + pEntry->sDescription = GetDescription(nIndex,true); + } + } + ImplStore(OUString("standard.sya")); + return sal_True; +} + +sal_Bool MixBulletsTypeMgr::ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel,sal_Bool isDefault,sal_Bool isResetSize) +{ + //if ( mLevel == (sal_uInt16)0xFFFF || nIndex>=DEFAULT_BULLET_TYPES ) + if ( nIndex>=DEFAULT_BULLET_TYPES ) + return sal_False; + MixBulletsSettings_Impl* pCurrentBullets = pActualBullets[nIndex]; + if (isDefault) pCurrentBullets=pDefaultActualBullets[nIndex]; + + if ( pCurrentBullets->eType == eNBType::BULLETS ) + { + sal_Unicode cChar; + cChar = ((BulletsSettings_Impl*)(pCurrentBullets->pBullets))->cBulletChar; + + //Font& rActBulletFont = lcl_GetDefaultBulletFont(); + Font rActBulletFont = ((BulletsSettings_Impl*)(pCurrentBullets->pBullets))->aFont; + sal_uInt16 nMask = 1; + String sBulletCharFmtName = GetBulCharFmtName(); + for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++) + { + if(mLevel & nMask) + { + SvxNumberFormat aFmt(aNum.GetLevel(i)); + if (SVX_NUM_CHAR_SPECIAL !=aFmt.GetNumberingType()) isResetSize=true; + aFmt.SetNumberingType( SVX_NUM_CHAR_SPECIAL ); + aFmt.SetBulletFont(&rActBulletFont); + aFmt.SetBulletChar(cChar ); + aFmt.SetCharFmtName(sBulletCharFmtName); + String aEmptyStr; + aFmt.SetPrefix( aEmptyStr ); + aFmt.SetSuffix( aEmptyStr ); + if (isResetSize) aFmt.SetBulletRelSize(45); + aNum.SetLevel(i, aFmt); + } + nMask <<= 1; + } + }else if ( pCurrentBullets->eType == eNBType::GRAPHICBULLETS ) + { + String sGrfName; + GrfBulDataRelation* pEntry = (GrfBulDataRelation*) (pCurrentBullets->pBullets); + sGrfName= pEntry->sGrfName; + + sal_uInt16 nMask = 1; + String aEmptyStr; + sal_uInt16 nSetNumberingType = SVX_NUM_BITMAP; + String sNumCharFmtName = GetBulCharFmtName(); + for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++) + { + if(mLevel & nMask) + { + SvxNumberFormat aFmt(aNum.GetLevel(i)); + if (SVX_NUM_BITMAP !=aFmt.GetNumberingType()) isResetSize=true; + aFmt.SetNumberingType(nSetNumberingType); + aFmt.SetPrefix( aEmptyStr ); + aFmt.SetSuffix( aEmptyStr ); + aFmt.SetCharFmtName( sNumCharFmtName ); + if ( pCurrentBullets->nIndexDefault == (sal_uInt16)0xFFFF && pEntry->pGrfObj ) + { + Size aSize = pEntry->aSize; + sal_Int16 eOrient = text::VertOrientation::LINE_CENTER; + if (!isResetSize && aFmt.GetGraphicSize()!=Size(0,0)) aSize=aFmt.GetGraphicSize(); + else { + if (aSize.Width()==0 && aSize.Height()==0) { + aSize = SvxNumberFormat::GetGraphicSizeMM100( pEntry->pGrfObj ); + } + aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)GetMapUnit()); + } + SvxBrushItem aBrush(*(pEntry->pGrfObj), GPOS_AREA, SID_ATTR_BRUSH ); + aFmt.SetGraphicBrush( &aBrush, &aSize, &eOrient ); + }else + { + Graphic aGraphic; + if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, pCurrentBullets->nIndexDefault, &aGraphic)) + { + Size aSize = pEntry->aSize; + sal_Int16 eOrient = text::VertOrientation::LINE_CENTER; + if (!isResetSize && aFmt.GetGraphicSize()!=Size(0,0)) aSize=aFmt.GetGraphicSize(); + else { + if (aSize.Width()==0 && aSize.Height()==0) { + aSize = SvxNumberFormat::GetGraphicSizeMM100(&aGraphic); + } + aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)GetMapUnit()); + } + SvxBrushItem aBrush(aGraphic, GPOS_AREA, SID_ATTR_BRUSH ); + aFmt.SetGraphicBrush( &aBrush, &aSize, &eOrient ); + }else + aFmt.SetGraphic( sGrfName ); + } + + aNum.SetLevel(i, aFmt); + } + nMask <<= 1 ; + } + } + + return sal_True; +} + +String MixBulletsTypeMgr::GetDescription(sal_uInt16 nIndex,sal_Bool isDefault) +{ + String sRet; + //sal_uInt16 nLength = 0; + //nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl); + + if ( nIndex >= DEFAULT_BULLET_TYPES ) + return sRet; + else + sRet = pActualBullets[nIndex]->pBullets->sDescription; + if (isDefault) sRet = pDefaultActualBullets[nIndex]->pBullets->sDescription; + return sRet; +} +sal_Bool MixBulletsTypeMgr::IsCustomized(sal_uInt16 nIndex) +{ + sal_Bool bRet = sal_False; + //sal_uInt16 nLength = 0; + //nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl); + + if ( nIndex >= DEFAULT_BULLET_TYPES ) + bRet = sal_False; + else + bRet = pActualBullets[nIndex]->pBullets->bIsCustomized; + + return bRet; +} +/*************************************************************************************************** +**********************Numbering Type lib************************************************************** +****************************************************************************************************/ +NumberingTypeMgr* NumberingTypeMgr::_instance = 0; + +NumberingTypeMgr::NumberingTypeMgr(const NBOType aType): + NBOTypeMgrBase(aType), + //pNumSettingsArr( new NumSettingsArr_Impl ), + pNumberSettingsArr (new NumberSettingsArr_Impl) +{ + Init(); + pDefaultNumberSettingsArr = pNumberSettingsArr; + pNumberSettingsArr = new NumberSettingsArr_Impl; + //Initial the first time to store the default value. Then do it again for customized value + Init(); + ImplLoad(OUString("standard.syb")); +} + +NumberingTypeMgr::NumberingTypeMgr(const NBOType aType,const SfxItemSet* pArg): + NBOTypeMgrBase(aType,pArg), + //pNumSettingsArr( new NumSettingsArr_Impl ), + pNumberSettingsArr (new NumberSettingsArr_Impl) +{ + Init(); + pDefaultNumberSettingsArr = pNumberSettingsArr; + pNumberSettingsArr = new NumberSettingsArr_Impl; + //Initial the first time to store the default value. Then do it again for customized value + Init(); + ImplLoad(OUString("standard.syb")); +} + +NumberingTypeMgr::NumberingTypeMgr(const NumberingTypeMgr& aTypeMgr): + NBOTypeMgrBase(aTypeMgr), + //pNumSettingsArr( new NumSettingsArr_Impl ), + pNumberSettingsArr (new NumberSettingsArr_Impl) +{ + /* + for(sal_uInt16 i=0;i<aTypeMgr.GetNumCount();i++) + { + NumberSettings_Impl* _pSet = aTypeMgr.GetNumSettingByIndex(i); + if ( _pSet ) + { + pNumberSettingsArr->GetObject(i)->nIndex = _pSet->nIndex; + pNumberSettingsArr->GetObject(i)->nIndexDefault = _pSet->nIndexDefault; + pNumberSettingsArr->GetObject(i)->sDescription = _pSet->sDescription; + pNumberSettingsArr->GetObject(i)->bIsCustomized = _pSet->bIsCustomized; + if ( _pSet->pNumSetting ) + { + pNumberSettingsArr->GetObject(i)->pNumSetting->nNumberType = _pSet->pNumSetting->nNumberType; + pNumberSettingsArr->GetObject(i)->pNumSetting->nParentNumbering = _pSet->pNumSetting->nParentNumbering; + pNumberSettingsArr->GetObject(i)->pNumSetting->sPrefix = _pSet->pNumSetting->sPrefix; + pNumberSettingsArr->GetObject(i)->pNumSetting->sSuffix = _pSet->pNumSetting->sSuffix; + pNumberSettingsArr->GetObject(i)->pNumSetting->sBulletChar = _pSet->pNumSetting->sBulletChar; + pNumberSettingsArr->GetObject(i)->pNumSetting->sBulletFont = _pSet->pNumSetting->sBulletFont; + + pNumberSettingsArr->GetObject(i)->pNumSetting->eLabelFollowedBy = _pSet->pNumSetting->eLabelFollowedBy; + pNumberSettingsArr->GetObject(i)->pNumSetting->nTabValue = _pSet->pNumSetting->nTabValue; + pNumberSettingsArr->GetObject(i)->pNumSetting->eNumAlign = _pSet->pNumSetting->eNumAlign; + pNumberSettingsArr->GetObject(i)->pNumSetting->nNumAlignAt = _pSet->pNumSetting->nNumAlignAt; + pNumberSettingsArr->GetObject(i)->pNumSetting->nNumIndentAt = _pSet->pNumSetting->nNumIndentAt; + } + } + } + */ + ImplLoad(OUString("standard.syb")); +} + +void NumberingTypeMgr::Init() +{ + Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); + Reference < XInterface > xI = xMSF->createInstance( + ::rtl::OUString::createFromAscii( "com.sun.star.text.DefaultNumberingProvider" ) ); + Reference<XDefaultNumberingProvider> xDefNum(xI, UNO_QUERY); + + if(xDefNum.is()) + { + Sequence< Sequence< PropertyValue > > aNumberings; + Locale aLocale(Application::GetSettings().GetLanguageTag().getLocale()); + try + { + aNumberings = xDefNum->getDefaultContinuousNumberingLevels( aLocale ); + + sal_Int32 nLength = aNumberings.getLength() > DEFAULT_NUM_VALUSET_COUNT ? DEFAULT_NUM_VALUSET_COUNT :aNumberings.getLength(); + + const Sequence<PropertyValue>* pValuesArr = aNumberings.getConstArray(); + for(sal_Int32 i = 0; i < nLength; i++) + { + NumSettings_ImplPtr pNew = lcl_CreateNumberingSettingsPtr(pValuesArr[i]); + NumberSettings_Impl* pNumEntry = new NumberSettings_Impl; + pNumEntry->nIndex = i + 1; + pNumEntry->nIndexDefault = i; + pNumEntry->pNumSetting = pNew; + //SetItemText( i + 1, SVX_RESSTR( RID_SVXSTR_SINGLENUM_DESCRIPTIONS + i )); + { + String sText; + //const OUString sValue(C2U("Value")); + Reference<XNumberingFormatter> xFormatter(xDefNum, UNO_QUERY); + if(xFormatter.is() && aNumberings.getLength() > i) + { + + for (sal_uInt16 j=0;j<3;j++) + { + Sequence<PropertyValue> aLevel = aNumberings.getConstArray()[i]; + try + { + aLevel.realloc(aLevel.getLength() + 1); + PropertyValue& rValue = aLevel.getArray()[aLevel.getLength() - 1]; + rValue.Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Value")); + rValue.Value <<= (sal_Int32)(j + 1); + + if (j!=0) + sText += OUString(" "); + + sText+=String(xFormatter->makeNumberingString( aLevel, aLocale )); + } + catch (const Exception&) + { + OSL_ENSURE(false, "Exception in DefaultNumberingProvider::makeNumberingString"); + } + } + } + String aStrFromRES(SVX_RESSTR( RID_SVXSTR_SINGLENUM_DESCRIPTIONS)); + String aReplace = OUString("%NUMBERINGSAMPLE"); + aStrFromRES.SearchAndReplace(aReplace,sText); + pNumEntry->sDescription = aStrFromRES; + } + //End modification + + //pNumEntry->sDescription = SVX_RESSTR( RID_SVXSTR_SINGLENUM_DESCRIPTION_0 + i ); + pNumberSettingsArr->push_back(boost::shared_ptr<NumberSettings_Impl>(pNumEntry)); + } + } + catch(Exception&) + { + } + } +} + +sal_uInt16 NumberingTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex) +{ + if ( mLevel == (sal_uInt16)0xFFFF || mLevel > aNum.GetLevelCount() || mLevel == 0) + return (sal_uInt16)0xFFFF; + + sal_uInt16 nActLv = IsSingleLevel(mLevel); + + if ( nActLv == (sal_uInt16)0xFFFF ) + return (sal_uInt16)0xFFFF; + + SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); + //sal_Unicode cPrefix = rtl::OUString(aFmt.GetPrefix()).getStr()[0]; + //sal_Unicode cSuffix = rtl::OUString(aFmt.GetSuffix()).getStr()[0]; + String sPreFix = aFmt.GetPrefix(); + String sLclSuffix = aFmt.GetSuffix(); + String sEmpty; + sal_Int16 eNumType = aFmt.GetNumberingType(); + + sal_uInt16 nCount = pNumberSettingsArr->size(); + for(sal_uInt16 i = nFromIndex; i < nCount; ++i) + { + NumberSettings_ImplPtr _pSet = (*pNumberSettingsArr)[i].get(); + sal_Int16 eNType = _pSet->pNumSetting->nNumberType; + String sLocalPreFix = _pSet->pNumSetting->sPrefix; + String sLocalSuffix = _pSet->pNumSetting->sSuffix; + if (sPreFix.CompareTo(sLocalPreFix)==COMPARE_EQUAL && + sLclSuffix.CompareTo(sLocalSuffix)==COMPARE_EQUAL && + eNumType == eNType ) + { + return i+1; + } + } + + + return (sal_uInt16)0xFFFF; +} + +sal_Bool NumberingTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel) +{ + //if ( mLevel == (sal_uInt16)0xFFFF || mLevel == 0) + // return sal_False; + + //if ( GetNBOIndexForNumRule(aNum,mLevel) != (sal_uInt16)0xFFFF ) + // return sal_False; + + sal_uInt16 nActLv = IsSingleLevel(mLevel); + + if ( nActLv == (sal_uInt16)0xFFFF ) + return sal_False; + + SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); + //sal_Unicode cPrefix = rtl::OUString(aFmt.GetPrefix()).getStr()[0]; + //sal_Unicode cSuffix = rtl::OUString(aFmt.GetSuffix()).getStr()[0]; + sal_Int16 eNumType = aFmt.GetNumberingType(); + + sal_uInt16 nCount = pNumberSettingsArr->size(); + if ( nIndex >= nCount ) + return sal_False; + + NumberSettings_ImplPtr _pSet = (*pNumberSettingsArr)[nIndex].get(); + + _pSet->pNumSetting->sPrefix = aFmt.GetPrefix(); + _pSet->pNumSetting->sSuffix = aFmt.GetSuffix(); + _pSet->pNumSetting->nNumberType = eNumType; + _pSet->bIsCustomized = sal_True; + + SvxNumRule aTmpRule1(aNum); + SvxNumRule aTmpRule2(aNum); + ApplyNumRule(aTmpRule1,nIndex,mLevel,true); + ApplyNumRule(aTmpRule2,nIndex,mLevel,false); + if (aTmpRule1==aTmpRule2) _pSet->bIsCustomized=false; + if (_pSet->bIsCustomized) { + String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_NUMBERING_DESCRIPTION)); + String aReplace = OUString("%LIST_NUM"); + String sNUM = OUString::number( nIndex + 1 ); + aStrFromRES.SearchAndReplace(aReplace,sNUM); + _pSet->sDescription = aStrFromRES; + } else { + _pSet->sDescription = GetDescription(nIndex,true); + } + ImplStore(OUString("standard.syb")); + return sal_True; +} + +sal_Bool NumberingTypeMgr::ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel,sal_Bool isDefault,sal_Bool isResetSize) +{ + //if ( mLevel == (sal_uInt16)0xFFFF ) + // return sal_False; + + //DBG_ASSERT(pNumSettingsArr->Count() > nIndex, "wrong index"); + if(pNumberSettingsArr->size() <= nIndex) + return sal_False; + NumberSettingsArr_Impl* pCurrentNumberSettingsArr=pNumberSettingsArr; + if (isDefault) pCurrentNumberSettingsArr=pDefaultNumberSettingsArr; + NumberSettings_ImplPtr _pSet = (*pCurrentNumberSettingsArr)[nIndex].get(); + sal_Int16 eNewType = _pSet->pNumSetting->nNumberType; + + sal_uInt16 nMask = 1; + String sNumCharFmtName = GetBulCharFmtName(); + for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++) + { + if(mLevel & nMask) + { + SvxNumberFormat aFmt(aNum.GetLevel(i)); + if (eNewType!=aFmt.GetNumberingType()) isResetSize=true; + aFmt.SetNumberingType(eNewType); + aFmt.SetPrefix(_pSet->pNumSetting->sPrefix); + aFmt.SetSuffix(_pSet->pNumSetting->sSuffix); + + aFmt.SetCharFmtName(sNumCharFmtName); + if (isResetSize) aFmt.SetBulletRelSize(100); + aNum.SetLevel(i, aFmt); + } + nMask <<= 1 ; + } + + return sal_True; +} +String NumberingTypeMgr::GetDescription(sal_uInt16 nIndex,sal_Bool isDefault) +{ + String sRet; + sal_uInt16 nLength = 0; + nLength = pNumberSettingsArr->size(); + + if ( nIndex >= nLength ) + return sRet; + else + sRet = (*pNumberSettingsArr)[nIndex]->sDescription; + if (isDefault) sRet = (*pDefaultNumberSettingsArr)[nIndex]->sDescription; + + return sRet; +} +sal_Bool NumberingTypeMgr::IsCustomized(sal_uInt16 nIndex) +{ + sal_Bool bRet = sal_False; + sal_uInt16 nLength = 0; + nLength = pNumberSettingsArr->size(); + + if ( nIndex >= nLength ) + bRet = sal_False; + else + bRet = (*pNumberSettingsArr)[nIndex]->bIsCustomized; + + return bRet; +} +sal_uInt16 NumberingTypeMgr::GetNumCount() const +{ + sal_uInt16 nRet = 0; + if ( pNumberSettingsArr ) + nRet = pNumberSettingsArr->size(); + + return nRet; +} +NumberSettings_Impl* NumberingTypeMgr::GetNumSettingByIndex(sal_uInt16 nIndex) const +{ + NumberSettings_Impl* pRet = 0; + if ( pNumberSettingsArr && nIndex< pNumberSettingsArr->size() ) + { + pRet = (*pNumberSettingsArr)[nIndex].get(); + } + return pRet; +} +/*************************************************************************************************** +**********************Multi-level /Outline Type lib******************************************************* +****************************************************************************************************/ +OutlineTypeMgr* OutlineTypeMgr::_instance = 0; + +OutlineTypeMgr::OutlineTypeMgr(const NBOType aType): + NBOTypeMgrBase(aType)//, + //pNumSettingsArrs( new NumSettingsArr_Impl[DEFAULT_NUM_VALUSET_COUNT] ) +{ + Init(); + for(sal_Int32 nItem = 0; nItem < DEFAULT_NUM_VALUSET_COUNT; nItem++ ) + { + pDefaultOutlineSettingsArrs[nItem] = pOutlineSettingsArrs[nItem]; + } + //Initial the first time to store the default value. Then do it again for customized value + Init(); + ImplLoad(OUString("standard.syc")); +} + +OutlineTypeMgr::OutlineTypeMgr(const NBOType aType,const SfxItemSet* pArg): + NBOTypeMgrBase(aType,pArg)//, + //pNumSettingsArrs( new NumSettingsArr_Impl[DEFAULT_NUM_VALUSET_COUNT]) +{ + Init(); + for(sal_Int32 nItem = 0; nItem < DEFAULT_NUM_VALUSET_COUNT; nItem++ ) + { + pDefaultOutlineSettingsArrs[nItem] = pOutlineSettingsArrs[nItem]; + } + //Initial the first time to store the default value. Then do it again for customized value + Init(); + ImplLoad(OUString("standard.syc")); +} + +OutlineTypeMgr::OutlineTypeMgr(const OutlineTypeMgr& aTypeMgr): + NBOTypeMgrBase(aTypeMgr)//, + //pNumSettingsArrs( new NumSettingsArr_Impl[DEFAULT_NUM_VALUSET_COUNT]) +{ + Init(); + for(sal_Int32 nItem = 0; nItem < DEFAULT_NUM_VALUSET_COUNT; nItem++ ) + { + pDefaultOutlineSettingsArrs[nItem] = pOutlineSettingsArrs[nItem]; + } + //Initial the first time to store the default value. Then do it again for customized value + Init(); + ImplLoad(OUString("standard.syc")); +} + +void OutlineTypeMgr::Init() +{ + Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); + Reference < XInterface > xI = xMSF->createInstance( + ::rtl::OUString::createFromAscii( "com.sun.star.text.DefaultNumberingProvider" ) ); + Reference<XDefaultNumberingProvider> xDefNum(xI, UNO_QUERY); + + if(xDefNum.is()) + { + Sequence<Reference<XIndexAccess> > aOutlineAccess; + Locale aLocale(Application::GetSettings().GetLanguageTag().getLocale()); + try + { + aOutlineAccess = xDefNum->getDefaultOutlineNumberings( aLocale ); + + SvxNumRule aDefNumRule( NUM_BULLET_REL_SIZE|NUM_CONTINUOUS|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE|NUM_SYMBOL_ALIGNMENT,10, sal_False , + SVX_RULETYPE_NUMBERING,SvxNumberFormat::LABEL_ALIGNMENT); + + for(sal_Int32 nItem = 0; + nItem < aOutlineAccess.getLength() && nItem < DEFAULT_NUM_VALUSET_COUNT; + nItem++ ) + { + pOutlineSettingsArrs[ nItem ] = new OutlineSettings_Impl; + OutlineSettings_Impl* pItemArr = pOutlineSettingsArrs[ nItem ]; + pItemArr->sDescription = SVX_RESSTR( RID_SVXSTR_OUTLINENUM_DESCRIPTION_0 + nItem ); + pItemArr->pNumSettingsArr = new NumSettingsArr_Impl; + Reference<XIndexAccess> xLevel = aOutlineAccess.getConstArray()[nItem]; + for(sal_Int32 nLevel = 0; nLevel < xLevel->getCount() && nLevel < 5; nLevel++) + { + Any aValueAny = xLevel->getByIndex(nLevel); + Sequence<PropertyValue> aLevelProps; + aValueAny >>= aLevelProps; + NumSettings_ImplPtr pNew = lcl_CreateNumberingSettingsPtr(aLevelProps); + SvxNumberFormat aNumFmt( aDefNumRule.GetLevel( nLevel) ); + pNew->eLabelFollowedBy = aNumFmt.GetLabelFollowedBy(); + pNew->nTabValue = aNumFmt.GetListtabPos(); + pNew->eNumAlign = aNumFmt.GetNumAdjust(); + pNew->nNumAlignAt = aNumFmt.GetFirstLineIndent(); + pNew->nNumIndentAt = aNumFmt.GetIndentAt(); + pItemArr->pNumSettingsArr->push_back(boost::shared_ptr<NumSettings_Impl>(pNew)); + } + } + } + catch(Exception&) + { + } + } +} + +sal_uInt16 OutlineTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 /*mLevel*/,sal_uInt16 nFromIndex) +{ + sal_uInt16 nLength = sizeof(pOutlineSettingsArrs)/sizeof(OutlineSettings_Impl*); + for(sal_uInt16 iDex = nFromIndex; iDex < nLength; iDex++) + { + sal_Bool bNotMatch = sal_False; + OutlineSettings_Impl* pItemArr = pOutlineSettingsArrs[iDex]; + sal_uInt16 nCount = pItemArr->pNumSettingsArr->size(); + for (sal_uInt16 iLevel=0;iLevel < nCount;iLevel++) + { + NumSettings_ImplPtr _pSet = (*pItemArr->pNumSettingsArr)[iLevel].get(); + sal_Int16 eNType = _pSet->nNumberType; + + SvxNumberFormat aFmt(aNum.GetLevel(iLevel)); + String sPreFix = aFmt.GetPrefix(); + String sLclSuffix = aFmt.GetSuffix(); + String sEmpty; + sal_Int16 eNumType = aFmt.GetNumberingType(); + if( eNumType == SVX_NUM_CHAR_SPECIAL) + { + sal_Unicode cChar = aFmt.GetBulletChar(); + //const Font* pFont = aFmt.GetBulletFont(); + sal_Unicode ccChar = _pSet->sBulletChar.getStr()[0]; + rtl::OUString sFont = _pSet->sBulletFont; + if ( !((cChar == ccChar) && //pFont && sFont.compareTo(pFont->GetName()) && + _pSet->eLabelFollowedBy == aFmt.GetLabelFollowedBy() && + _pSet->nTabValue == aFmt.GetListtabPos() && + _pSet->eNumAlign == aFmt.GetNumAdjust() && + _pSet->nNumAlignAt == aFmt.GetFirstLineIndent() && + _pSet->nNumIndentAt == aFmt.GetIndentAt())) + { + bNotMatch = sal_True; + break; + } + }else if ((eNumType&(~LINK_TOKEN)) == SVX_NUM_BITMAP ) { + const SvxBrushItem* pBrsh1 = aFmt.GetBrush(); + const SvxBrushItem* pBrsh2 = _pSet->pBrushItem; + sal_Bool bIsMatch = false; + if (pBrsh1==pBrsh2) bIsMatch = true; + if (pBrsh1 && pBrsh2) { + const Graphic* pGrf1 = pBrsh1->GetGraphic();; + const Graphic* pGrf2 = pBrsh2->GetGraphic();; + if (pGrf1==pGrf2) bIsMatch = true; + if (pGrf1 && pGrf2) { + if ( pGrf1->GetBitmap().IsEqual(pGrf2->GetBitmap()) && + _pSet->aSize==aFmt.GetGraphicSize()) + bIsMatch = true; + } + } + if (!bIsMatch) { + bNotMatch = sal_True; + break; + } + } else + { + if (!((sPreFix.CompareTo(_pSet->sPrefix)==COMPARE_EQUAL) && + ( sLclSuffix.CompareTo(_pSet->sSuffix)==COMPARE_EQUAL ) && + eNumType == eNType && + _pSet->eLabelFollowedBy == aFmt.GetLabelFollowedBy() && + _pSet->nTabValue == aFmt.GetListtabPos() && + _pSet->eNumAlign == aFmt.GetNumAdjust() && + _pSet->nNumAlignAt == aFmt.GetFirstLineIndent() && + _pSet->nNumIndentAt == aFmt.GetIndentAt())) + { + bNotMatch = sal_True; + break; + } + } + } + if ( !bNotMatch ) + return iDex+1; + } + + + return (sal_uInt16)0xFFFF; +} + +sal_Bool OutlineTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel) +{ + //if ( mLevel == 0 || mLevel == (sal_uInt16)0xFFFF ) + // return sal_False; + + sal_uInt16 nLength = sizeof(pOutlineSettingsArrs)/sizeof(OutlineSettings_Impl*); + if ( nIndex >= nLength ) + return sal_False; + + OutlineSettings_Impl* pItemArr = pOutlineSettingsArrs[nIndex]; + sal_uInt16 nCount = pItemArr->pNumSettingsArr->size(); + for (sal_uInt16 iLevel=0;iLevel < nCount;iLevel++) + { + SvxNumberFormat aFmt(aNum.GetLevel(iLevel)); + //sal_Unicode cPrefix = rtl::OUString(aFmt.GetPrefix()).getStr()[0]; + //sal_Unicode cSuffix = rtl::OUString(aFmt.GetSuffix()).getStr()[0]; + sal_Int16 eNumType = aFmt.GetNumberingType(); + + NumSettings_ImplPtr _pSet = (*pItemArr->pNumSettingsArr)[iLevel].get(); + + _pSet->eLabelFollowedBy = aFmt.GetLabelFollowedBy(); + _pSet->nTabValue = aFmt.GetListtabPos(); + _pSet->eNumAlign = aFmt.GetNumAdjust(); + _pSet->nNumAlignAt = aFmt.GetFirstLineIndent(); + _pSet->nNumIndentAt = aFmt.GetIndentAt(); + + if( eNumType == SVX_NUM_CHAR_SPECIAL) + { + sal_Unicode cChar = aFmt.GetBulletChar(); + OUString sChar(cChar); + _pSet->sBulletChar = sChar;//OUString(cChar); + if ( aFmt.GetBulletFont() ) + _pSet->sBulletFont = rtl::OUString(aFmt.GetBulletFont()->GetName()); + _pSet->nNumberType = eNumType; + pItemArr->bIsCustomized = sal_True; + }else if ((eNumType&(~LINK_TOKEN)) == SVX_NUM_BITMAP ) { + if (_pSet->pBrushItem) { + delete (_pSet->pBrushItem); + _pSet->pBrushItem=NULL; + } + if (aFmt.GetBrush()) + _pSet->pBrushItem = new SvxBrushItem(*aFmt.GetBrush()); + _pSet->aSize = aFmt.GetGraphicSize(); + _pSet->nNumberType = eNumType; + } else + { + _pSet->sPrefix = aFmt.GetPrefix(); + _pSet->sSuffix = aFmt.GetSuffix(); + _pSet->nNumberType = eNumType; + if ( aFmt.GetBulletFont() ) + _pSet->sBulletFont = rtl::OUString(aFmt.GetBulletFont()->GetName()); + pItemArr->bIsCustomized = sal_True; + } + } + SvxNumRule aTmpRule1(aNum); + SvxNumRule aTmpRule2(aNum); + ApplyNumRule(aTmpRule1,nIndex,mLevel,true); + ApplyNumRule(aTmpRule2,nIndex,mLevel,false); + if (aTmpRule1==aTmpRule2) pItemArr->bIsCustomized=false; + if (pItemArr->bIsCustomized) { + String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_MULTILEVEL_DESCRIPTION)); + String aReplace = OUString("%LIST_NUM"); + String sNUM = OUString::number( nIndex + 1 ); + aStrFromRES.SearchAndReplace(aReplace,sNUM); + pItemArr->sDescription = aStrFromRES; + } else { + pItemArr->sDescription = GetDescription(nIndex,true); + } + ImplStore(OUString("standard.syc")); + return sal_True; +} + +sal_Bool OutlineTypeMgr::ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 /*mLevel*/,sal_Bool isDefault,sal_Bool isResetSize) +{ + //if ( mLevel == (sal_uInt16)0xFFFF ) + // return sal_False; + + DBG_ASSERT(DEFAULT_NUM_VALUSET_COUNT > nIndex, "wrong index"); + if(DEFAULT_NUM_VALUSET_COUNT <= nIndex) + return sal_False; + + const FontList* pList = 0; + + OutlineSettings_Impl* pItemArr = pOutlineSettingsArrs[nIndex]; + if (isDefault) pItemArr=pDefaultOutlineSettingsArrs[nIndex]; + + //Font& rActBulletFont = lcl_GetDefaultBulletFont(); + NumSettingsArr_Impl *pNumSettingsArr=pItemArr->pNumSettingsArr; + + NumSettings_ImplPtr pLevelSettings = 0; + String sBulletCharFmtName = GetBulCharFmtName(); + for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++) + { + if(pNumSettingsArr->size() > i) + pLevelSettings = (*pNumSettingsArr)[i].get(); + + if(!pLevelSettings) + break; + + SvxNumberFormat aFmt(aNum.GetLevel(i)); + //aFmt.SetBulletFont(&pLevelSettings->aFont); + Font& rActBulletFont = lcl_GetDefaultBulletFont(); + if (pLevelSettings->nNumberType !=aFmt.GetNumberingType()) isResetSize=true; + aFmt.SetNumberingType( pLevelSettings->nNumberType ); + sal_uInt16 nUpperLevelOrChar = (sal_uInt16)pLevelSettings->nParentNumbering; + if(aFmt.GetNumberingType() == SVX_NUM_CHAR_SPECIAL) + { + if( pLevelSettings->sBulletFont.getLength() && + pLevelSettings->sBulletFont.compareTo(rActBulletFont.GetName())) + { + //search for the font + if(!pList) + { + SfxObjectShell* pCurDocShell = SfxObjectShell::Current(); + const SvxFontListItem* pFontListItem = (const SvxFontListItem* )pCurDocShell->GetItem( SID_ATTR_CHAR_FONTLIST ); + pList = pFontListItem ? pFontListItem->GetFontList() : 0; + } + if(pList && pList->IsAvailable( pLevelSettings->sBulletFont ) ) + { + FontInfo aInfo = pList->Get(pLevelSettings->sBulletFont,WEIGHT_NORMAL, ITALIC_NONE); + Font aFont(aInfo); + aFmt.SetBulletFont(&aFont); + } + else + { + //if it cannot be found then create a new one + Font aCreateFont( pLevelSettings->sBulletFont,String(), Size( 0, 14 ) ); + aCreateFont.SetCharSet( RTL_TEXTENCODING_DONTKNOW ); + aCreateFont.SetFamily( FAMILY_DONTKNOW ); + aCreateFont.SetPitch( PITCH_DONTKNOW ); + aCreateFont.SetWeight( WEIGHT_DONTKNOW ); + aCreateFont.SetTransparent( sal_True ); + aFmt.SetBulletFont( &aCreateFont ); + } + }else + aFmt.SetBulletFont( &rActBulletFont ); + + sal_Unicode cChar = 0; + if( pLevelSettings->sBulletChar.getLength() ) + cChar = pLevelSettings->sBulletChar.getStr()[0]; + if( Application::GetSettings().GetLayoutRTL() ) + { + if( 0 == i && cChar == BulletsTypeMgr::aDynamicBulletTypes[5] ) + cChar = BulletsTypeMgr::aDynamicRTLBulletTypes[5]; + else if( 1 == i ) + { + const SvxNumberFormat& numberFmt = aNum.GetLevel(0); + if( numberFmt.GetBulletChar() == BulletsTypeMgr::aDynamicRTLBulletTypes[5] ) + cChar = BulletsTypeMgr::aDynamicRTLBulletTypes[4]; + } + } + + aFmt.SetBulletChar(cChar); + aFmt.SetCharFmtName( sBulletCharFmtName ); + if (isResetSize) aFmt.SetBulletRelSize(45); + }else if ((aFmt.GetNumberingType()&(~LINK_TOKEN)) == SVX_NUM_BITMAP ) { + if (pLevelSettings->pBrushItem) { + const Graphic* pGrf = pLevelSettings->pBrushItem->GetGraphic();; + Size aSize = pLevelSettings->aSize; + sal_Int16 eOrient = text::VertOrientation::LINE_CENTER; + if (!isResetSize && aFmt.GetGraphicSize()!=Size(0,0)) aSize=aFmt.GetGraphicSize(); + else { + if (aSize.Width()==0 && aSize.Height()==0 && pGrf) { + aSize = SvxNumberFormat::GetGraphicSizeMM100( pGrf ); + } + } + aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)GetMapUnit()); + aFmt.SetGraphicBrush( pLevelSettings->pBrushItem, &aSize, &eOrient ); + } + } else + { + aFmt.SetIncludeUpperLevels(sal::static_int_cast< sal_uInt8 >(0 != nUpperLevelOrChar ? aNum.GetLevelCount() : 0)); + aFmt.SetCharFmtName(sBulletCharFmtName); + if (isResetSize) aFmt.SetBulletRelSize(100); + } + if(pNumSettingsArr->size() > i) { + aFmt.SetLabelFollowedBy(pLevelSettings->eLabelFollowedBy); + aFmt.SetListtabPos(pLevelSettings->nTabValue); + aFmt.SetNumAdjust(pLevelSettings->eNumAlign); + aFmt.SetFirstLineIndent(pLevelSettings->nNumAlignAt); + aFmt.SetIndentAt(pLevelSettings->nNumIndentAt); + } + aFmt.SetPrefix(pLevelSettings->sPrefix); + aFmt.SetSuffix(pLevelSettings->sSuffix); + aNum.SetLevel(i, aFmt); + } + + return sal_True; +} +String OutlineTypeMgr::GetDescription(sal_uInt16 nIndex,sal_Bool isDefault) +{ + String sRet; + sal_uInt16 nLength = 0; + nLength = sizeof(pOutlineSettingsArrs)/sizeof(OutlineSettings_Impl*); + + if ( nIndex >= nLength ) + return sRet; + else + { + OutlineSettings_Impl* pItemArr = pOutlineSettingsArrs[nIndex]; + if (isDefault) pItemArr = pDefaultOutlineSettingsArrs[nIndex]; + if ( pItemArr ) + { + sRet = pItemArr->sDescription; + }; + } + return sRet; +} +sal_Bool OutlineTypeMgr::IsCustomized(sal_uInt16 nIndex) +{ + sal_Bool bRet = sal_False; + + sal_uInt16 nLength = 0; + nLength = sizeof(pOutlineSettingsArrs)/sizeof(OutlineSettings_Impl*); + + if ( nIndex >= nLength ) + return bRet; + else + { + OutlineSettings_Impl* pItemArr = pOutlineSettingsArrs[nIndex]; + if ( pItemArr ) + { + bRet = pItemArr->bIsCustomized; + }; + } + + return bRet; +} + + +}} diff --git a/svx/source/sidebar/nbdtmgfact.cxx b/svx/source/sidebar/nbdtmgfact.cxx new file mode 100644 index 000000000000..7280d7eceabf --- /dev/null +++ b/svx/source/sidebar/nbdtmgfact.cxx @@ -0,0 +1,48 @@ +/* + * 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 _NBDTMGFACT_HXX +#include <svx/nbdtmgfact.hxx> +#endif +namespace svx { namespace sidebar { +NBOutlineTypeMgrFact::NBOutlineTypeMgrFact() +{ +} + +NBOTypeMgrBase* NBOutlineTypeMgrFact::CreateInstance(const NBOType aType) +{ + //NBOTypeMgrBase* pRet= 0; + if ( aType == eNBOType::BULLETS ) + { + return BulletsTypeMgr::GetInstance(); + }else if ( aType == eNBOType::GRAPHICBULLETS ) + { + return GraphyicBulletsTypeMgr::GetInstance(); + }else if ( aType == eNBOType::MIXBULLETS ) + { + return MixBulletsTypeMgr::GetInstance(); + }else if ( aType == eNBOType::NUMBERING ) + { + return NumberingTypeMgr::GetInstance(); + }else if ( aType == eNBOType::OUTLINE ) + { + return OutlineTypeMgr::GetInstance(); + } + return NULL; +} +}} + diff --git a/svx/source/sidebar/paragraph/ParaBulletsControl.cxx b/svx/source/sidebar/paragraph/ParaBulletsControl.cxx new file mode 100644 index 000000000000..89ae29d66ce0 --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaBulletsControl.cxx @@ -0,0 +1,140 @@ +/* + * 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 "ParaBulletsControl.hxx" +#include "ParaPropertyPanel.hrc" +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include <svx/dialogs.hrc> +#include <svx/dialmgr.hxx> +#include <unotools/viewoptions.hxx> +#include <editeng/kernitem.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/sidebar/Theme.hxx> +#include <svtools/unitconv.hxx> +#include <svx/nbdtmg.hxx> +#include <svx/nbdtmgfact.hxx> + +namespace svx { namespace sidebar { + +ParaBulletsControl::ParaBulletsControl(Window* pParent, svx::sidebar::ParaPropertyPanel& rPanel) + : PopupControl( pParent,SVX_RES(RID_POPUPPANEL_PARAPAGE_BULLETS)) + , maBulletsVS(this,SVX_RES(VS_VALUES)) + , maFISep(this,SVX_RES(IMG_SEPERATOR_BULLET)) + , maMoreButton(this,SVX_RES(CB_BULLET_MORE)) + , mrParaPropertyPanel(rPanel) + , mpBindings(NULL) +{ + FreeResource(); + mpBindings = mrParaPropertyPanel.GetBindings(); + maBulletsVS.SetColCount(3); + maBulletsVS.SetLineCount(3); + maBulletsVS.SetStyle( maBulletsVS.GetStyle() | WB_ITEMBORDER |WB_NO_DIRECTSELECT); + maBulletsVS.SetExtraSpacing(BULLET_IMAGE_SPACING); + if(GetSettings().GetStyleSettings().GetHighContrastMode()) + maBulletsVS.SetBackground(GetSettings().GetStyleSettings().GetMenuColor()); + else + maBulletsVS.SetBackground(Color(244,245,249)); + + maBulletsVS.SetItemWidth(BULLET_IMAGE_WIDTH); + maBulletsVS.SetItemHeight(BULLET_IMAGE_HEIGHT); + maBulletsVS.InsertItem( DEFAULT_NONE ); + for( sal_uInt16 nVSIdx = 1; nVSIdx <= DEFAULT_BULLET_TYPES; ++nVSIdx ) + { + maBulletsVS.InsertItem( nVSIdx ); + } + + maBulletsVS.SetItemText( DEFAULT_NONE, SVX_RESSTR( RID_SVXSTR_NUMBULLET_NONE )); + NBOTypeMgrBase* pBullets = NBOutlineTypeMgrFact::CreateInstance(eNBOType::MIXBULLETS); + if ( pBullets ) + { + for( sal_uInt16 nIndex = 0; nIndex < DEFAULT_BULLET_TYPES; ++nIndex ) + { + maBulletsVS.SetItemText( nIndex + 1, pBullets->GetDescription(nIndex) ); + } + } + + maBulletsVS.Show(); + maBulletsVS.SetSelectHdl(LINK(this, ParaBulletsControl, BulletSelectHdl_Impl)); + + /*maMoreButton.SetDefBkColor(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_DropDownBackground ));//Color(244,245,249)//for high contrast + maMoreButton.SetHoverBkColor(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ) );//Color( 93, 120, 163 ) + maMoreButton.SetHoverTxtColor( sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Color_PanelTitleFont ) );//Color( 255, 255, 255 ) + maMoreButton.SetIcoPosX( 2);*/ + maBulletsVS.SetColor(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); + maBulletsVS.SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); + + maMoreButton.SetClickHdl(LINK(this, ParaBulletsControl, MoreButtonClickHdl_Impl)); + +} + +ParaBulletsControl::~ParaBulletsControl() +{ + +} + +void ParaBulletsControl::UpdateValueSet() +{ + maBulletsVS.StateChanged(STATE_CHANGE_STYLE); + maBulletsVS.StateChanged(STATE_CHANGE_INITSHOW); +} +void ParaBulletsControl::ToGetFocus() +{ + sal_uInt16 nTypeIndex = (sal_uInt16)0xFFFF; + mrParaPropertyPanel.GetBulletTypeIndex(); + if ( nTypeIndex != (sal_uInt16)0xFFFF ) + maBulletsVS.SelectItem( nTypeIndex ); + else + { + maBulletsVS.SelectItem(0); + } + maMoreButton.GrabFocus(); +} + +IMPL_LINK(ParaBulletsControl, BulletSelectHdl_Impl, ValueSet*, EMPTYARG) +{ + sal_uInt16 nIdx = maBulletsVS.GetSelectItemId(); + SfxUInt16Item aItem(FN_SVX_SET_BULLET, nIdx); + if (mpBindings) + mpBindings->GetDispatcher()->Execute( FN_SVX_SET_BULLET, SFX_CALLMODE_RECORD, &aItem, 0L ); + + mrParaPropertyPanel.EndBulletsPopupMode(); + + return 0; +} + +IMPL_LINK(ParaBulletsControl, MoreButtonClickHdl_Impl, void*, EMPTYARG) +{ + if (mpBindings) + mpBindings->GetDispatcher()->Execute( SID_OUTLINE_BULLET, SFX_CALLMODE_ASYNCHRON ); + + mrParaPropertyPanel.EndBulletsPopupMode(); + + return 0; +} + +}} // end of namespace sidebar + + diff --git a/svx/source/sidebar/paragraph/ParaBulletsControl.hxx b/svx/source/sidebar/paragraph/ParaBulletsControl.hxx new file mode 100644 index 000000000000..6b29a605f99b --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaBulletsControl.hxx @@ -0,0 +1,58 @@ +/* + * 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 _SVX_SIDEBAR_BULLETS_CONTROL_HXX_ +#define _SVX_SIDEBAR_BULLETS_CONTROL_HXX_ + +#include "svx/sidebar/PopupControl.hxx" +#include "svx/sidebar/ValueSetWithTextControl.hxx" +#include <sfx2/bindings.hxx> +#include <svtools/ctrlbox.hxx> +#include <svtools/ctrltool.hxx> +#include "ParaPropertyPanel.hxx" +#include <vcl/fixed.hxx> +#include <svl/poolitem.hxx> +#include <editeng/lspcitem.hxx> +#include <sfx2/sidebar/EnumContext.hxx> +#include <vcl/button.hxx> + + +namespace svx { namespace sidebar { + +class ParaBulletsControl:public svx::sidebar::PopupControl +{ +private: + SvxNumValueSet3 maBulletsVS; + FixedImage maFISep; + PushButton maMoreButton; + ParaPropertyPanel& mrParaPropertyPanel; + SfxBindings* mpBindings; + + DECL_LINK(BulletSelectHdl_Impl, ValueSet*); + DECL_LINK(MoreButtonClickHdl_Impl, void*); + +public: + ParaBulletsControl(Window* pParent, svx::sidebar::ParaPropertyPanel& rPanel); + ~ParaBulletsControl(); + void ToGetFocus(); + void UpdateValueSet(); +}; + +}} + +#endif + diff --git a/svx/source/sidebar/paragraph/ParaBulletsPopup.cxx b/svx/source/sidebar/paragraph/ParaBulletsPopup.cxx new file mode 100644 index 000000000000..cd9314827f97 --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaBulletsPopup.cxx @@ -0,0 +1,59 @@ +/* + * 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 "ParaBulletsPopup.hxx" +#include "ParaBulletsControl.hxx" +#include <boost/bind.hpp> +#include <unotools/viewoptions.hxx> + +namespace svx { namespace sidebar { + +ParaBulletsPopup::ParaBulletsPopup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator) + : Popup( + pParent, + rControlCreator, + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Paragraph Bullets"))) +{ +} + + + + +ParaBulletsPopup::~ParaBulletsPopup (void) +{ +} + + + + +void ParaBulletsPopup::UpdateValueSet () +{ + ProvideContainerAndControl(); + + ParaBulletsControl* pControl = dynamic_cast<ParaBulletsControl*>(mpControl.get()); + if (pControl != NULL) + pControl->UpdateValueSet(); +} + + + +} } // end of namespace svx::sidebar + + + diff --git a/svx/source/sidebar/paragraph/ParaBulletsPopup.hxx b/svx/source/sidebar/paragraph/ParaBulletsPopup.hxx new file mode 100644 index 000000000000..c8b645b2bdf1 --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaBulletsPopup.hxx @@ -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 . + */ +#ifndef _SVX_SIDEBAR_BULLETS_POPUP_HXX_ +#define _SVX_SIDEBAR_BULLETS_POPUP_HXX_ + +#include "svx/sidebar/Popup.hxx" + +#include <boost/function.hpp> +#include <svl/poolitem.hxx> +#include <tools/fldunit.hxx> +#include <sfx2/sidebar/EnumContext.hxx> + +namespace svx { namespace sidebar { + +class ParaBulletsPopup + : public Popup +{ +public : + ParaBulletsPopup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator); + ~ParaBulletsPopup (void); + + void UpdateValueSet (); +//private: + //void PopupModeEndCallback (void); +}; + +} } // end of namespace svx::sidebar + +#endif + + + diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx new file mode 100644 index 000000000000..cbb93209e4f2 --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx @@ -0,0 +1,816 @@ +/* + * 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 "ParaLineSpacingControl.hxx" +#include "ParaPropertyPanel.hrc" +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include <svx/dialogs.hrc> +#include <svx/dialmgr.hxx> +#include <unotools/viewoptions.hxx> +#include <editeng/kernitem.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/sidebar/Theme.hxx> +#include <svtools/unitconv.hxx> + +#define _DEFAULT_LINE_SPACING 200 +#define FIX_DIST_DEF 283 +#define LINESPACE_1 100 +#define LINESPACE_15 150 +#define LINESPACE_2 200 +#define LINESPACE_115 115 + +#define LLINESPACE_1 0 +#define LLINESPACE_15 1 +#define LLINESPACE_2 2 +#define LLINESPACE_PROP 3 +#define LLINESPACE_MIN 4 +#define LLINESPACE_DURCH 5 +#define LLINESPACE_FIX 6 + +#define DO_NOT_CUSTOM 0 +#define USE_CUSTOM 1 + +namespace svx { namespace sidebar { + + +ParaLineSpacingControl::ParaLineSpacingControl(Window* pParent, svx::sidebar::ParaPropertyPanel& rPanel) + : PopupControl( pParent,SVX_RES(RID_POPUPPANEL_PARAPAGE_LINESPACING)) + , mbUseLineSPCustom (0) + , mbLineSPDisable (0) + , mrParaPropertyPanel(rPanel) + , mpBindings(NULL) + , nMinFixDist(BEGIN_VALUE) + , pActLineDistFld(&aLineDistAtPercentBox) + , maLineSpacing(ValueSetWithTextControl::IMAGE_TEXT,this, SVX_RES( LINE_SPACING ) ) + , maCustomFT ( this, SVX_RES( FT_CUSTOM ) ) + , maLSpacingFT ( this, SVX_RES( FT_LINE_SPACING ) ) + , aLineDist( this, SVX_RES( LB_LINE_SPACING )) + , maOfFT ( this, SVX_RES( FT_OF ) ) + , aLineDistAtPercentBox ( this, SVX_RES( ED_SBINDE_LINEDISTPERCENT ) ) + , aLineDistAtMetricBox ( this, SVX_RES( ED_SBINDE_LINEDISTPOINT ) ) + , maSpacing1 (SVX_RES(IMG_SPACING1)) + , maSpacing115 (SVX_RES(IMG_SPACING115)) + , maSpacing15 (SVX_RES(IMG_SPACING15)) + , maSpacing2 (SVX_RES(IMG_SPACING2)) + , maLPCustom (SVX_RES(IMG_SPACINGLCUSTOM)) + , maSelSpacing1 (SVX_RES(IMG_SEL_SPACING1)) + , maSelSpacing115 (SVX_RES(IMG_SEL_SPACING115)) + , maSelSpacing15 (SVX_RES(IMG_SEL_SPACING15)) + , maSelSpacing2 (SVX_RES(IMG_SEL_SPACING2)) + , maImgCus (SVX_RES(IMG_CUSTOM)) + , maImgCusGrey (SVX_RES(IMG_CUSTOM_GRAY)) + , maStrCus (SVX_RES(STR_LCVALUE)) + , mpImg(NULL) + , mpImgSel(NULL) + , mpStr(NULL) + , mpStrTip(NULL) + , maLine(SVX_RES(STR_LSPACING)) + , maOf(SVX_RES(STR_LS_OF)) + , maValue( 0 ) + , maPos( 0 ) +{ + initial(); + FreeResource(); + mpBindings = mrParaPropertyPanel.GetBindings(); +// m_eLNSpaceUnit = mrParaPropertyPanel.maLNSpaceControl.GetCoreMetric(); + m_eLNSpaceUnit = SFX_MAPUNIT_100TH_MM; +} +ParaLineSpacingControl::~ParaLineSpacingControl() +{ + delete[] mpImg; + delete[] mpImgSel; + delete[] mpStr; + delete[] mpStrTip; +} + +void ParaLineSpacingControl::initial() +{ + //maLineSpacing.SetStyle( maLineSpacing.GetStyle()| WB_3DLOOK | WB_NO_DIRECTSELECT ); + //maLineSpacing.SetControlBackground(GetSettings().GetStyleSettings().GetMenuColor()); + //maLineSpacing.SetColor(GetSettings().GetStyleSettings().GetMenuColor()); + //maLineSpacing.SetMinFont(); + + maLineSpacing.SetControlBackground(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); + maLineSpacing.SetColor(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); + maLineSpacing.SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); + //maFTSpacing.SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()? + //GetSettings().GetStyleSettings().GetMenuColor(): + //sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); + //maFTBy.SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()? + //GetSettings().GetStyleSettings().GetMenuColor(): + //sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); + + mpImg = new Image[4]; + mpImg[0] = maSpacing1; + mpImg[1] = maSpacing115; + mpImg[2] = maSpacing15; + mpImg[3] = maSpacing2; + + mpImgSel = new Image[4]; + mpImgSel[0] = maSelSpacing1; + mpImgSel[1] = maSelSpacing115; + mpImgSel[2] = maSelSpacing15; + mpImgSel[3] = maSelSpacing2; + + mpStr = new XubString[4]; + mpStr[0] = XubString(SVX_RES(STR_SPACING1)); + mpStr[1] = XubString(SVX_RES(STR_SPACING115)); + mpStr[2] = XubString(SVX_RES(STR_SPACING15)); + mpStr[3] = XubString(SVX_RES(STR_SPACING2)); + + mpStrTip = new XubString[4]; + mpStrTip[0] = XubString(SVX_RES(STR_LS_SINGLE)); + mpStrTip[1] = XubString(SVX_RES(STR_LS_115)); + mpStrTip[2] = XubString(SVX_RES(STR_LS_15)); + mpStrTip[3] = XubString(SVX_RES(STR_LS_DOUBLE)); + for (int i=0;i<4;i++) + maLineSpacing.AddItem(mpImg[i], &mpImgSel[i],mpStr[i],&mpStrTip[i]); + + maLineSpacing.AddItem( maImgCus, 0, maStrCus, 0 ); + + SetAllNoSel(); + Link aLink = LINK(this, ParaLineSpacingControl,VSSelHdl ); + maLineSpacing.SetSelectHdl(aLink); + maLineSpacing.StartSelection(); + maLineSpacing.Show(); + + aLink = LINK( this, ParaLineSpacingControl, LineSPDistHdl_Impl ); + aLineDist.SetSelectHdl(aLink); + aLineDist.SelectEntryPos( LLINESPACE_1 ) ; + aLink = LINK( this, ParaLineSpacingControl, LineSPDistAtHdl_Impl ); + aLineDistAtPercentBox.SetModifyHdl( aLink ); + aLineDistAtMetricBox.SetModifyHdl( aLink ); +} +void ParaLineSpacingControl::ToGetFocus(bool bType) +{ + if(!bType) + aLineDist.GrabFocus(); + else + maLineSpacing.GrabFocus(); //wj +} + +void ParaLineSpacingControl::PopupModeEndCallback() +{ + if( mbUseLineSPCustom ) + { + //maLinePos = mpLineSPPage->maPos; + //maLineValue = mpLineSPPage->maValue; + + SvtViewOptions aWinOpt( E_WINDOW, LSP_POS_GLOBAL_VALUE ); + ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq(1); + aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("maLinePos") ); + aSeq[0].Value <<= ::rtl::OUString::number(maPos); + aWinOpt.SetUserData( aSeq ); + + SvtViewOptions aWinOpt2( E_WINDOW, LSP_LV_GLOBAL_VALUE ); + aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("maLineValue") ); + aSeq[0].Value <<= ::rtl::OUString::number(maValue); + aWinOpt2.SetUserData( aSeq ); + } +} + +void ParaLineSpacingControl::Rearrange(SfxItemState currSPState,FieldUnit currMetricUnit,SvxLineSpacingItem* currSPItem,const ::sfx2::sidebar::EnumContext currentContext) +{ + SvtViewOptions aWinOpt( E_WINDOW, LSP_POS_GLOBAL_VALUE ); + if ( aWinOpt.Exists() ) + { + ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt.GetUserData(); + ::rtl::OUString aTmp; + if ( aSeq.getLength()) + aSeq[0].Value >>= aTmp; + + String aWinData( aTmp ); + maPos = (sal_uInt16)aWinData.ToInt32(); + } + + SvtViewOptions aWinOpt2( E_WINDOW, LSP_LV_GLOBAL_VALUE ); + if ( aWinOpt2.Exists() ) + { + ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt2.GetUserData(); + ::rtl::OUString aTmp; + if ( aSeq.getLength()) + aSeq[0].Value >>= aTmp; + + String aWinData( aTmp ); + maValue = (sal_uInt16)aWinData.ToInt32(); + } + String sHelpText; + switch(maPos) + { + case LLINESPACE_1: + sHelpText += mpStrTip[0]; + break; + case LLINESPACE_15: + sHelpText += mpStrTip[2]; + break; + case LLINESPACE_2: + sHelpText += mpStrTip[3]; + break; + case LLINESPACE_PROP: + sHelpText +=maLine; + sHelpText.Append(String("Proportion: ", 12, RTL_TEXTENCODING_ASCII_US)); + sHelpText += maOf; + sHelpText.Append( OUString::number( maValue )); + break; + case LLINESPACE_MIN: + sHelpText += maLine; + sHelpText.Append(String("At Least: ", 10, RTL_TEXTENCODING_ASCII_US)); + sHelpText += maOf; + sHelpText.Append( OUString::number( maValue )); + break; + case LLINESPACE_DURCH: + sHelpText += maLine; + sHelpText.Append(String("Leading: ", 9, RTL_TEXTENCODING_ASCII_US)); + sHelpText += maOf; + sHelpText.Append( OUString::number( maValue )); + break; + case LLINESPACE_FIX: + sHelpText += maLine; + sHelpText.Append(String("Fixed: ", 7, RTL_TEXTENCODING_ASCII_US)); + sHelpText += maOf; + sHelpText.Append( OUString::number( maValue )); + break; + } + if( !aWinOpt.Exists() && !aWinOpt2.Exists() ) + mbLineSPDisable = sal_True; + else + mbLineSPDisable = sal_False; + + if( mbLineSPDisable ) + maLineSpacing.ReplaceItemImages(5, maImgCusGrey,0); + else + { + maLineSpacing.ReplaceItemImages(5, maImgCus,0); + maLineSpacing.SetItemText(5,sHelpText); + } + + SfxItemState eState = currSPState; + + SetFieldUnit( aLineDistAtMetricBox, currMetricUnit ); + +// mpLineSPPage->SetAllNoSel(); + aLineDist.Enable(); + pActLineDistFld->Enable(); + pActLineDistFld->SetText( String() ); + //bool bValueSetFocus = sal_False; //wj + + if( eState >= SFX_ITEM_AVAILABLE ) + { + // SfxMapUnit eUnit = maLNSpaceControl.GetCoreMetric(); + SfxMapUnit eUnit = SFX_MAPUNIT_100TH_MM; + m_eLNSpaceUnit = eUnit; + + switch( currSPItem->GetLineSpaceRule() ) + { + case SVX_LINE_SPACE_AUTO: + { + SvxInterLineSpace eInter = currSPItem->GetInterLineSpaceRule(); + + switch( eInter ) + { + case SVX_INTER_LINE_SPACE_OFF: + { + aLineDist.SelectEntryPos( LLINESPACE_1 ); + pActLineDistFld->Disable(); + pActLineDistFld->SetText( String() ); + mbUseLineSPCustom = DO_NOT_CUSTOM; + if ( LINESPACE_1 == currSPItem->GetPropLineSpace() ) + { + maLineSpacing.SelectItem(1); + //bValueSetFocus = sal_True; //wj + } + } + break; + + case SVX_INTER_LINE_SPACE_PROP: + { + if ( LINESPACE_1 == currSPItem->GetPropLineSpace() ) + { + aLineDist.SelectEntryPos( LLINESPACE_1 ); + pActLineDistFld->Disable(); + pActLineDistFld->SetText( String() ); + mbUseLineSPCustom = DO_NOT_CUSTOM; + maLineSpacing.SelectItem(1); + //bValueSetFocus = sal_True; //wj + break; + } + if ( LINESPACE_15 == currSPItem->GetPropLineSpace() ) + { + aLineDist.SelectEntryPos( LLINESPACE_15 ); + pActLineDistFld->Disable(); + pActLineDistFld->SetText( String() ); + + mbUseLineSPCustom = DO_NOT_CUSTOM; + maLineSpacing.SelectItem(3); + //bValueSetFocus = sal_True; //wj + break; + } + if ( LINESPACE_2 == currSPItem->GetPropLineSpace() ) + { + aLineDist.SelectEntryPos( LLINESPACE_2 ); + pActLineDistFld->Disable(); + pActLineDistFld->SetText( String() ); + + mbUseLineSPCustom = DO_NOT_CUSTOM; + maLineSpacing.SelectItem(4); + //bValueSetFocus = sal_True; //wj + break; + } + + aLineDist.SelectEntryPos( LLINESPACE_PROP ); + if(pActLineDistFld != &(aLineDistAtPercentBox)) + { + pActLineDistFld->Disable(); + pActLineDistFld->Hide(); + pActLineDistFld = &(aLineDistAtPercentBox); + } + else + { + pActLineDistFld = &(aLineDistAtMetricBox); + pActLineDistFld->Disable(); + pActLineDistFld->Hide(); + pActLineDistFld = &(aLineDistAtPercentBox); + } + pActLineDistFld->Enable(); + pActLineDistFld->Show(); + aLineDistAtPercentBox. + SetValue( aLineDistAtPercentBox.Normalize( + currSPItem->GetPropLineSpace() ) ); + + if( currSPItem->GetPropLineSpace() == LINESPACE_115 ) + { + mbUseLineSPCustom = DO_NOT_CUSTOM; + maLineSpacing.SelectItem(2); + //bValueSetFocus = sal_True; //wj + } + else + { + mbUseLineSPCustom = USE_CUSTOM; + maLineSpacing.SetNoSelection(); + maLineSpacing.SelectItem(0); + } + } + break; + + case SVX_INTER_LINE_SPACE_FIX: + { + if(pActLineDistFld != &(aLineDistAtMetricBox)) + { + pActLineDistFld->Disable(); + pActLineDistFld->Hide(); + pActLineDistFld = &(aLineDistAtMetricBox); + } + else + { + pActLineDistFld = &(aLineDistAtPercentBox); + pActLineDistFld->Disable(); + pActLineDistFld->Hide(); + pActLineDistFld = &(aLineDistAtMetricBox); + } + pActLineDistFld->Enable(); + pActLineDistFld->Show(); + maLineSpacing.SetNoSelection(); + maLineSpacing.SelectItem(0); + + SetMetricValue( aLineDistAtMetricBox, + currSPItem->GetInterLineSpace(), eUnit ); + aLineDist.SelectEntryPos( LLINESPACE_DURCH ); + + mbUseLineSPCustom = USE_CUSTOM; + } + break; + default: + break; + } + } + break; + case SVX_LINE_SPACE_FIX: + { + if(pActLineDistFld != &(aLineDistAtMetricBox)) + { + pActLineDistFld->Disable(); + pActLineDistFld->Hide(); + pActLineDistFld = &(aLineDistAtMetricBox); + } + else + { + pActLineDistFld = &(aLineDistAtPercentBox); + pActLineDistFld->Disable(); + pActLineDistFld->Hide(); + pActLineDistFld = &(aLineDistAtMetricBox); + } + pActLineDistFld->Enable(); + pActLineDistFld->Show(); + maLineSpacing.SetNoSelection(); + maLineSpacing.SelectItem(0); + + SetMetricValue(aLineDistAtMetricBox, currSPItem->GetLineHeight(), eUnit); + aLineDist.SelectEntryPos( LLINESPACE_FIX ); + + mbUseLineSPCustom = USE_CUSTOM; + } + break; + + case SVX_LINE_SPACE_MIN: + { + if(pActLineDistFld != &(aLineDistAtMetricBox)) + { + pActLineDistFld->Disable(); + pActLineDistFld->Hide(); + pActLineDistFld = &(aLineDistAtMetricBox); + } + else + { + pActLineDistFld = &(aLineDistAtPercentBox); + pActLineDistFld->Disable(); + pActLineDistFld->Hide(); + pActLineDistFld = &(aLineDistAtMetricBox); + } + pActLineDistFld->Enable(); + pActLineDistFld->Show(); + maLineSpacing.SetNoSelection(); + maLineSpacing.SelectItem(0); + + SetMetricValue(aLineDistAtMetricBox, currSPItem->GetLineHeight(), eUnit); + aLineDist.SelectEntryPos( LLINESPACE_MIN ); + mbUseLineSPCustom = USE_CUSTOM; + } + break; + default: + break; + } + } + else if( eState == SFX_ITEM_DISABLED ) + { + aLineDist.Disable(); + pActLineDistFld->Enable(sal_False); + pActLineDistFld->SetText( String() ); + maLineSpacing.SetNoSelection(); + maLineSpacing.SelectItem(0); + + mbUseLineSPCustom = DO_NOT_CUSTOM; + } + else + { + pActLineDistFld->Enable(sal_False); + pActLineDistFld->SetText( String() ); + aLineDist.SetNoSelection(); + maLineSpacing.SetNoSelection(); + maLineSpacing.SelectItem(0); + mbUseLineSPCustom = DO_NOT_CUSTOM; + } + + aLineDist.SaveValue(); + + /*sal_uInt16 nID = pBox->GetCurItemId(); + pBox->SetItemDown(nID, sal_True); + + Size aFloatSz = GetOutputSizePixel(); + + GetLineSPFloatWin()->SetSizePixel( aFloatSz ); + + Point aPos=maLineSPTbx->GetPosPixel(); + aPos.setX(aPos.getX()); + aPos = OutputToScreenPixel( aPos ); + Size aSize = maLineSPTbx->GetSizePixel(); + Rectangle aRect( aPos, aSize ); + + GetLineSPFloatWin()->StartPopupMode( aRect, FLOATWIN_POPUPMODE_DOWN | FLOATWIN_POPUPMODE_NOFOCUSCLOSE); + GetLineSPFloatWin()->SetPopupModeFlags(GetLineSPFloatWin()->GetPopupModeFlags() | FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE ); + + pLineSPPage->ToGetFocus(bValueSetFocus); + */ + sal_uInt16 uCount = aLineDist.GetEntryCount(); + if( uCount == LLINESPACE_FIX + 1 ) + { + switch (currentContext.GetCombinedContext()) + { + case CombinedEnumContext(Application_Impress, Context_Table): + case CombinedEnumContext(Application_Draw, Context_Table): + case CombinedEnumContext(Application_Writer, Context_DrawText): + case CombinedEnumContext(Application_Calc, Context_DrawText): + case CombinedEnumContext(Application_Draw, Context_DrawText): + case CombinedEnumContext(Application_Impress, Context_DrawText): + case CombinedEnumContext(Application_Writer, Context_Annotation): + case CombinedEnumContext(Application_Draw, Context_Draw): + case CombinedEnumContext(Application_Draw, Context_TextObject): + case CombinedEnumContext(Application_Draw, Context_Graphic): + case CombinedEnumContext(Application_Impress, Context_Draw): + case CombinedEnumContext(Application_Impress, Context_TextObject): + case CombinedEnumContext(Application_Impress, Context_Graphic): + { + aLineDist.RemoveEntry(LLINESPACE_FIX); + } + } + } + else if( uCount == LLINESPACE_FIX) + { + switch (currentContext.GetCombinedContext()) + { + case CombinedEnumContext(Application_Writer, Context_Default): + case CombinedEnumContext(Application_Writer, Context_Text): + case CombinedEnumContext(Application_Writer, Context_Table): + { + aLineDist.InsertEntry(OUString("Fixed"), LLINESPACE_FIX); + } + } + } + maLineSpacing.Format(); + maLineSpacing.StartSelection(); +} + +void ParaLineSpacingControl::SetAllNoSel() +{ + maLineSpacing.SelectItem(1); + maLineSpacing.SetNoSelection(); +} + +IMPL_LINK( ParaLineSpacingControl, LineSPDistHdl_Impl, ListBox*, pBox ) +{ + maLineSpacing.SetNoSelection(); + maLineSpacing.SelectItem(0); + maLineSpacing.Format(); + maLineSpacing.StartSelection(); + + switch( pBox->GetSelectEntryPos() ) + { + case LLINESPACE_1: + case LLINESPACE_15: + case LLINESPACE_2: + pActLineDistFld->Enable(sal_False); + pActLineDistFld->SetText( String() ); + break; + + case LLINESPACE_DURCH: + aLineDistAtPercentBox.Hide(); + pActLineDistFld = &aLineDistAtMetricBox; + aLineDistAtMetricBox.SetMin(0); + + + if ( aLineDistAtMetricBox.GetText().isEmpty() ) + aLineDistAtMetricBox.SetValue( + aLineDistAtMetricBox.Normalize( 0 ) ); + aLineDistAtPercentBox.Hide(); + pActLineDistFld->Show(); + pActLineDistFld->Enable(); + break; + + case LLINESPACE_MIN: + aLineDistAtPercentBox.Hide(); + pActLineDistFld = &aLineDistAtMetricBox; + aLineDistAtMetricBox.SetMin(0); + + if ( aLineDistAtMetricBox.GetText().isEmpty() ) + aLineDistAtMetricBox.SetValue( + aLineDistAtMetricBox.Normalize( 0 ), FUNIT_TWIP ); + aLineDistAtPercentBox.Hide(); + pActLineDistFld->Show(); + pActLineDistFld->Enable(); + break; + + case LLINESPACE_PROP: + aLineDistAtMetricBox.Hide(); + pActLineDistFld = &aLineDistAtPercentBox; + + if ( aLineDistAtPercentBox.GetText().isEmpty() ) + aLineDistAtPercentBox.SetValue( + aLineDistAtPercentBox.Normalize( 100 ), FUNIT_TWIP ); + aLineDistAtMetricBox.Hide(); + pActLineDistFld->Show(); + pActLineDistFld->Enable(); + break; + case LLINESPACE_FIX: + { + aLineDistAtPercentBox.Hide(); + pActLineDistFld = &aLineDistAtMetricBox; + sal_Int64 nTemp = aLineDistAtMetricBox.GetValue(); + aLineDistAtMetricBox.SetMin(aLineDistAtMetricBox.Normalize(nMinFixDist), FUNIT_TWIP); + + if ( aLineDistAtMetricBox.GetValue() != nTemp ) + SetMetricValue( aLineDistAtMetricBox, + FIX_DIST_DEF, SFX_MAPUNIT_TWIP ); + aLineDistAtPercentBox.Hide(); + pActLineDistFld->Show(); + pActLineDistFld->Enable(); + } + break; + } + ExecuteLineSpace(); + return 0; +} + +IMPL_LINK_NOARG( ParaLineSpacingControl, LineSPDistAtHdl_Impl ) +{ + ExecuteLineSpace(); + return (0L); +} + +void ParaLineSpacingControl::ExecuteLineSpace() +{ + aLineDist.SaveValue(); + maLineSpacing.SetNoSelection(); + + SvxLineSpacingItem aSpacing(_DEFAULT_LINE_SPACING, SID_ATTR_PARA_LINESPACE); + sal_uInt16 nPos = aLineDist.GetSelectEntryPos(); + + switch ( nPos ) + { + case LLINESPACE_1: + case LLINESPACE_15: + case LLINESPACE_2: + { + SetLineSpace( aSpacing, nPos ); + maPos = nPos; + } + break; + + case LLINESPACE_PROP: + { + SetLineSpace( aSpacing, nPos, + aLineDistAtPercentBox.Denormalize( + (long)aLineDistAtPercentBox.GetValue() ) ); + maPos = nPos; + maValue =aLineDistAtPercentBox.GetValue(); + } + break; + + case LLINESPACE_MIN: + case LLINESPACE_DURCH: + case LLINESPACE_FIX: + { + SetLineSpace( aSpacing, nPos, + GetCoreValue( aLineDistAtMetricBox, m_eLNSpaceUnit ) ); + maPos = nPos; + maValue = GetCoreValue( aLineDistAtMetricBox, m_eLNSpaceUnit ); + } + break; + + default: + OSL_ENSURE(false, "error!!"); + break; + } + + mpBindings->GetDispatcher()->Execute( + SID_ATTR_PARA_LINESPACE, SFX_CALLMODE_RECORD, &aSpacing, 0L); + + mbUseLineSPCustom = USE_CUSTOM; +} + +void ParaLineSpacingControl::SetLineSpace( SvxLineSpacingItem& rLineSpace, + int eSpace, long lValue ) +{ + switch ( eSpace ) + { + case LLINESPACE_1: + rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO; + rLineSpace.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF; + break; + + case LLINESPACE_15: + rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO; + rLineSpace.SetPropLineSpace( LINESPACE_15 ); + break; + + case LLINESPACE_2: + rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO; + rLineSpace.SetPropLineSpace( LINESPACE_2 ); + break; + + case LLINESPACE_PROP: + rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO; + rLineSpace.SetPropLineSpace( (sal_uInt8)lValue ); + break; + + case LLINESPACE_MIN: + rLineSpace.SetLineHeight( (sal_uInt16)lValue ); + rLineSpace.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF; + break; + + case LLINESPACE_DURCH: + rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO; + rLineSpace.SetInterLineSpace( (sal_uInt16)lValue ); + break; + + case LLINESPACE_FIX: + rLineSpace.SetLineHeight((sal_uInt16)lValue); + rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_FIX; + rLineSpace.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF; + break; + } +} + +IMPL_LINK(ParaLineSpacingControl, VSSelHdl, void *, pControl) +{ + maLineSpacing.SetNoSelection(); + bool bClosePop = true; + if(pControl == &maLineSpacing) + { + sal_uInt16 iPos = maLineSpacing.GetSelectItemId(); + switch ( iPos ) + { + case 1: + ExecuteLineSpacing( 0, 0 ); + break; + case 2: + ExecuteLineSpacing( 0, 3 ); + break; + case 3: + ExecuteLineSpacing( 0, 1 ); + break; + case 4: + ExecuteLineSpacing( 0, 2 ); + break; + case 5: + { + if(!(mbLineSPDisable)) + { + //maPos = mrParaPropertyPanel.maLinePos; + aLineDist.SelectEntryPos( maPos ) ; + aLineDist.SaveValue(); + //maValue = mrParaPropertyPanel.maLineValue; + + SvxLineSpacingItem aSpacing(_DEFAULT_LINE_SPACING, SID_ATTR_PARA_LINESPACE); + switch(maPos) + { + case LLINESPACE_1: + case LLINESPACE_15: + case LLINESPACE_2: + SetLineSpace( aSpacing, maPos ); + break; + + case LLINESPACE_PROP: + SetLineSpace( aSpacing, maPos, + aLineDistAtPercentBox.Denormalize( (long)maValue ) ); + break; + + case LLINESPACE_MIN: + case LLINESPACE_DURCH: + case LLINESPACE_FIX: + SetLineSpace( aSpacing, maPos, (long)maValue ); + break; + } + + mpBindings->GetDispatcher()->Execute( + SID_ATTR_PARA_LINESPACE, SFX_CALLMODE_RECORD, &aSpacing, 0L); + + ExecuteLineSpacing( USE_CUSTOM, 0 ); + } + else + bClosePop = sal_False; + } + break; + } + } + if(bClosePop) + mrParaPropertyPanel.EndSpacingPopupMode(); + return 0; +} + +void ParaLineSpacingControl::ExecuteLineSpacing( sal_uInt16 aIsCustom, sal_uInt16 aEntry ) +{ + if( !aIsCustom ) + { + aLineDist.SelectEntryPos( aEntry ) ; + aLineDist.SaveValue(); + SvxLineSpacingItem aSpacing(_DEFAULT_LINE_SPACING, SID_ATTR_PARA_LINESPACE); + sal_uInt16 nPos = aEntry; + if( aEntry == LLINESPACE_PROP ) + SetLineSpace( aSpacing, nPos, aLineDistAtPercentBox.Denormalize( (long)115 ) ); + else + SetLineSpace( aSpacing, nPos ); + + mpBindings->GetDispatcher()->Execute( + SID_ATTR_PARA_LINESPACE, SFX_CALLMODE_RECORD, &aSpacing, 0L); + } + + if( !aIsCustom ) + { + mbUseLineSPCustom = DO_NOT_CUSTOM; + mrParaPropertyPanel.EndSpacingPopupMode(); + } + maLineSpacing.SetNoSelection(); +} + +}} // end of namespace sidebar + diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx b/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx new file mode 100644 index 000000000000..ed3f643fb406 --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx @@ -0,0 +1,113 @@ +/* + * 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 _SVX_SIDEBAR_LINE_SPACING_CONTROL_HXX_ +#define _SVX_SIDEBAR_LINE_SPACING_CONTROL_HXX_ + +#include "svx/sidebar/PopupControl.hxx" +#include "svx/sidebar/ValueSetWithTextControl.hxx" +#include <sfx2/bindings.hxx> +#include <svtools/ctrlbox.hxx> +#include <svtools/ctrltool.hxx> +#include "ParaPropertyPanel.hxx" +#include <vcl/fixed.hxx> +#include <svl/poolitem.hxx> +#include <editeng/lspcitem.hxx> +#include <sfx2/sidebar/EnumContext.hxx> + + +namespace svx { namespace sidebar { + +#define LSP_POS_GLOBAL_VALUE String("Line_Spacing_Pos", 16, RTL_TEXTENCODING_ASCII_US) +#define LSP_LV_GLOBAL_VALUE String("Line_Spacing_Lv", 15, RTL_TEXTENCODING_ASCII_US) +#define BEGIN_VALUE 28 +class ParaLineSpacingControl:public svx::sidebar::PopupControl +{ +public: + ParaLineSpacingControl(Window* pParent, svx::sidebar::ParaPropertyPanel& rPanel); + ~ParaLineSpacingControl(); + void ToGetFocus(bool bType); + void Rearrange(SfxItemState currSPState,FieldUnit currMetricUnit,SvxLineSpacingItem* currSPItem,const ::sfx2::sidebar::EnumContext currentContext); + //virtual void Paint(const Rectangle& rect); + + //add + short GetLastCustomState(); + long GetLastCustomValue(); + //add end + + void ExecuteLineSpace(); + void SetLineSpace( SvxLineSpacingItem& rLineSpace, + int eSpace, long lValue = 0 ); + + void ExecuteLineSpacing( sal_uInt16 aIsCustom, sal_uInt16 aEntry ); + void SetAllNoSel(); + void PopupModeEndCallback(); + +private: + bool mbUseLineSPCustom; + bool mbLineSPDisable; + SfxMapUnit m_eLNSpaceUnit; + ParaPropertyPanel& mrParaPropertyPanel; + SfxBindings* mpBindings; + + long nMinFixDist; + Edit* pActLineDistFld; + + ValueSetWithTextControl maLineSpacing; + + FixedText maCustomFT; + FixedText maLSpacingFT; + ListBox aLineDist; + + FixedText maOfFT; + MetricField aLineDistAtPercentBox; + MetricField aLineDistAtMetricBox; + + Image maSpacing1; + Image maSpacing115; + Image maSpacing15; + Image maSpacing2; + Image maLPCustom; + + Image maSelSpacing1; + Image maSelSpacing115; + Image maSelSpacing15; + Image maSelSpacing2; + Image maSelSelHanging; + Image maImgCus; + Image maImgCusGrey; + XubString maStrCus; + + Image* mpImg; + Image* mpImgSel; + XubString* mpStr; + XubString* mpStrTip; + String maLine; + String maOf; + + sal_Int64 maValue; + sal_uInt16 maPos; +private: + void initial(); + DECL_LINK(LineSPDistHdl_Impl, ListBox*); + DECL_LINK(LineSPDistAtHdl_Impl, void*); + DECL_LINK(VSSelHdl, void*); +}; +}} + +#endif + diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx b/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx new file mode 100644 index 000000000000..20f942359bda --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx @@ -0,0 +1,78 @@ +/* + * 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 "ParaLineSpacingPopup.hxx" +#include "ParaLineSpacingControl.hxx" +#include <boost/bind.hpp> +#include <unotools/viewoptions.hxx> + +namespace svx { namespace sidebar { + +ParaLineSpacingPopup::ParaLineSpacingPopup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator) + : Popup( + pParent, + rControlCreator, + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Paragraph Line Spacing"))) +{ + SetPopupModeEndHandler(::boost::bind(&ParaLineSpacingPopup::PopupModeEndCallback, this)); +} + + + + +ParaLineSpacingPopup::~ParaLineSpacingPopup (void) +{ +} + + + + +void ParaLineSpacingPopup::Rearrange (SfxItemState currSPState,FieldUnit currMetricUnit,SvxLineSpacingItem* currSPItem,const ::sfx2::sidebar::EnumContext currentContext) +{ + ProvideContainerAndControl(); + + ParaLineSpacingControl* pControl = dynamic_cast<ParaLineSpacingControl*>(mpControl.get()); + if (pControl != NULL) + pControl->Rearrange(currSPState,currMetricUnit, currSPItem,currentContext); +} + +void ParaLineSpacingPopup::PopupModeEndCallback (void) +{ + ProvideContainerAndControl(); + ParaLineSpacingControl* pControl = dynamic_cast<ParaLineSpacingControl*>(mpControl.get()); + if (pControl == NULL) + return; + + pControl->PopupModeEndCallback(); + + /*if( pControl->GetLastCustomState() == SPACING_CLOSE_BY_CUS_EDIT) + { + SvtViewOptions aWinOpt( E_WINDOW, SIDEBAR_SPACING_GLOBAL_VALUE ); + ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq(1); + aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Spacing") ); + aSeq[0].Value <<= ::rtl::OUString( String::CreateFromInt32( pControl->GetLastCustomValue() )); + aWinOpt.SetUserData( aSeq ); + + }*/ +} + + +} } // end of namespace svx::sidebar + + diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingPopup.hxx b/svx/source/sidebar/paragraph/ParaLineSpacingPopup.hxx new file mode 100644 index 000000000000..b040ac393b70 --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaLineSpacingPopup.hxx @@ -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 . + */ +#ifndef _SVX_SIDEBAR_LINE_SPACING_POPUP_HXX_ +#define _SVX_SIDEBAR_LINE_SPACING_POPUP_HXX_ + +#include "svx/sidebar/Popup.hxx" + +#include <boost/function.hpp> +#include <svl/poolitem.hxx> +#include <tools/fldunit.hxx> +#include <editeng/lspcitem.hxx> +#include <sfx2/sidebar/EnumContext.hxx> + +namespace svx { namespace sidebar { + +class ParaLineSpacingPopup + : public Popup +{ +public : + ParaLineSpacingPopup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator); + ~ParaLineSpacingPopup (void); + + void Rearrange (SfxItemState currSPState,FieldUnit currMetricUnit,SvxLineSpacingItem* currSPItem ,const ::sfx2::sidebar::EnumContext currentContext); +private: + void PopupModeEndCallback (void); +}; + +} } // end of namespace svx::sidebar + +#endif + + diff --git a/svx/source/sidebar/paragraph/ParaNumberingControl.cxx b/svx/source/sidebar/paragraph/ParaNumberingControl.cxx new file mode 100644 index 000000000000..266cb7a49a82 --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaNumberingControl.cxx @@ -0,0 +1,165 @@ +/* + * 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 "ParaNumberingControl.hxx" +#include "ParaPropertyPanel.hrc" +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include <svx/dialogs.hrc> +#include <svx/dialmgr.hxx> +#include <unotools/viewoptions.hxx> +#include <editeng/kernitem.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/sidebar/Theme.hxx> +#include <svtools/unitconv.hxx> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/text/XDefaultNumberingProvider.hpp> +#include <com/sun/star/text/XNumberingFormatter.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <comphelper/processfactory.hxx> +#include <svx/nbdtmg.hxx> +#include <svx/nbdtmgfact.hxx> +#include <editeng/unolingu.hxx> +using namespace com::sun::star; +using namespace com::sun::star::uno; +using namespace com::sun::star::beans; +using namespace com::sun::star::lang; +using namespace com::sun::star::text; + +namespace svx { namespace sidebar { + +Reference<XDefaultNumberingProvider> lcl_GetNumberingProvider() +{ + Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); + Reference < XInterface > xI = xMSF->createInstance( + ::rtl::OUString::createFromAscii( "com.sun.star.text.DefaultNumberingProvider" ) ); + Reference<XDefaultNumberingProvider> xRet(xI, UNO_QUERY); +// DBG_ASSERT(xRet.is(), "service missing: \"com.sun.star.text.DefaultNumberingProvider\"") + + return xRet; +} + +ParaNumberingControl::ParaNumberingControl(Window* pParent, svx::sidebar::ParaPropertyPanel& rPanel): + PopupControl( pParent,SVX_RES(RID_POPUPPANEL_PARAPAGE_NUMBERING)), + maNumberVS(this,SVX_RES(VS_NUMBERING)), + maFISep(this,SVX_RES(IMG_SEPERATOR_NUMBERING)), + maMoreButton(this,SVX_RES(CB_NUMBERING_MORE) ), + mrParaPropertyPanel(rPanel), + mpBindings(NULL) +{ + FreeResource(); + mpBindings = mrParaPropertyPanel.GetBindings(); + + maNumberVS.SetStyle(maNumberVS.GetStyle() | WB_NO_DIRECTSELECT); + maNumberVS.SetExtraSpacing(NUM_IMAGE_SPACING); + //add by wj for sym2_7246 high contrast + if(GetSettings().GetStyleSettings().GetHighContrastMode()) + maNumberVS.SetBackground(GetSettings().GetStyleSettings().GetMenuColor()); + else + maNumberVS.SetBackground(Color(244,245,249)); + + maNumberVS.SetItemWidth(NUM_IMAGE_WIDTH); + maNumberVS.SetItemHeight(NUM_IMAGE_HEIGHT); + + Reference<XDefaultNumberingProvider> xDefNum = lcl_GetNumberingProvider(); + if(xDefNum.is()) + { + Sequence< Sequence< PropertyValue > > aNumberings; + Locale aLocale = GetSettings().GetLanguageTag().getLocale(); + try + { + aNumberings = + xDefNum->getDefaultContinuousNumberingLevels( aLocale ); + } + catch(Exception&) + { + } + Reference<XNumberingFormatter> xFormat(xDefNum, UNO_QUERY); + maNumberVS.SetNumberingSettings(aNumberings, xFormat, aLocale); + } + + maNumberVS.Show(); + maNumberVS.SetSelectHdl(LINK(this, ParaNumberingControl, NumSelectHdl_Impl)); + + /*maMoreButton.SetDefBkColor(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_DropDownBackground ));//Color(244,245,249)//for high contrast + maMoreButton.SetHoverBkColor(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ) );//Color( 93, 120, 163 ) + maMoreButton.SetHoverTxtColor( sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Color_PanelTitleFont ) );//Color( 255, 255, 255 ) + maMoreButton.SetIcoPosX( 2);*/ + maNumberVS.SetColor(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); + maNumberVS.SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); + + maMoreButton.SetClickHdl(LINK(this, ParaNumberingControl, MoreButtonClickHdl_Impl)); + +} + +ParaNumberingControl::~ParaNumberingControl() +{ +} + + +IMPL_LINK(ParaNumberingControl, NumSelectHdl_Impl, ValueSet*, EMPTYARG) +{ + sal_uInt16 nIdx = maNumberVS.GetSelectItemId(); + SfxUInt16Item aItem(FN_SVX_SET_NUMBER, nIdx); + if (mpBindings) + mpBindings->GetDispatcher()->Execute( FN_SVX_SET_NUMBER, SFX_CALLMODE_RECORD, &aItem, 0L ); + + mrParaPropertyPanel.EndNumberingPopupMode(); + + return 0; +} + +IMPL_LINK(ParaNumberingControl, MoreButtonClickHdl_Impl, void*, EMPTYARG) +{ + if (mpBindings) + mpBindings->GetDispatcher()->Execute( SID_OUTLINE_BULLET, SFX_CALLMODE_ASYNCHRON ); + + mrParaPropertyPanel.EndNumberingPopupMode(); + + return 0; +} + +void ParaNumberingControl::UpdateValueSet() +{ + maNumberVS.StateChanged(STATE_CHANGE_STYLE); + maNumberVS.StateChanged(STATE_CHANGE_INITSHOW); +} + +void ParaNumberingControl::ToGetFocus() +{ + sal_uInt16 nTypeIndex = mrParaPropertyPanel.GetNumTypeIndex(); + if ( nTypeIndex != (sal_uInt16)0xFFFF ) + maNumberVS.SelectItem( nTypeIndex ); + else + { + maNumberVS.SelectItem(0); + } + maMoreButton.GrabFocus(); +} + +}} // end of namespace sidebar + + + diff --git a/svx/source/sidebar/paragraph/ParaNumberingControl.hxx b/svx/source/sidebar/paragraph/ParaNumberingControl.hxx new file mode 100644 index 000000000000..89392bf67662 --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaNumberingControl.hxx @@ -0,0 +1,62 @@ +/* + * 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 _SVX_SIDEBAR_NUMBERING_CONTROL_HXX_ +#define _SVX_SIDEBAR_NUMBERING_CONTROL_HXX_ + + +#include "svx/sidebar/PopupControl.hxx" +#include "svx/sidebar/ValueSetWithTextControl.hxx" +#include <sfx2/bindings.hxx> +#include <svtools/ctrlbox.hxx> +#include <svtools/ctrltool.hxx> +#include "ParaPropertyPanel.hxx" +#include <vcl/fixed.hxx> +#include <svl/poolitem.hxx> +#include <editeng/lspcitem.hxx> +#include <sfx2/sidebar/EnumContext.hxx> +#include <vcl/button.hxx> + + +namespace svx { namespace sidebar { + + +class ParaNumberingControl:public svx::sidebar::PopupControl +{ +private: + SvxNumValueSet2 maNumberVS; + FixedImage maFISep; + PushButton maMoreButton; + ParaPropertyPanel& mrParaPropertyPanel; + SfxBindings* mpBindings; + + DECL_LINK(NumSelectHdl_Impl, ValueSet*); + DECL_LINK(MoreButtonClickHdl_Impl, void*); + +public: + ParaNumberingControl(Window* pParent, svx::sidebar::ParaPropertyPanel& rPanel); + ~ParaNumberingControl(); + void ToGetFocus(); + void UpdateValueSet(); + +}; + + +}} + +#endif + diff --git a/svx/source/sidebar/paragraph/ParaNumberingPopup.cxx b/svx/source/sidebar/paragraph/ParaNumberingPopup.cxx new file mode 100644 index 000000000000..de4bc5c5e9a5 --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaNumberingPopup.cxx @@ -0,0 +1,60 @@ +/* + * 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 "ParaNumberingPopup.hxx" +#include "ParaNumberingControl.hxx" +#include <boost/bind.hpp> +#include <unotools/viewoptions.hxx> + +namespace svx { namespace sidebar { + +ParaNumberingPopup::ParaNumberingPopup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator) + : Popup( + pParent, + rControlCreator, + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Paragraph Numbering"))) +{ +} + + + + +ParaNumberingPopup::~ParaNumberingPopup (void) +{ +} + + + + +void ParaNumberingPopup::UpdateValueSet () +{ + ProvideContainerAndControl(); + + ParaNumberingControl* pControl = dynamic_cast<ParaNumberingControl*>(mpControl.get()); + if (pControl != NULL) + pControl->UpdateValueSet(); +} + + + +} } // end of namespace svx::sidebar + + + + diff --git a/svx/source/sidebar/paragraph/ParaNumberingPopup.hxx b/svx/source/sidebar/paragraph/ParaNumberingPopup.hxx new file mode 100644 index 000000000000..b682ba66a7e5 --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaNumberingPopup.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 _SVX_SIDEBAR_NUMBERING_POPUP_HXX_ +#define _SVX_SIDEBAR_NUMBERING_POPUP_HXX_ + +#include "svx/sidebar/Popup.hxx" + +#include <boost/function.hpp> +#include <svl/poolitem.hxx> +#include <tools/fldunit.hxx> +#include <sfx2/sidebar/EnumContext.hxx> + +namespace svx { namespace sidebar { + +class ParaNumberingPopup + : public Popup +{ +public : + ParaNumberingPopup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator); + ~ParaNumberingPopup (void); + + void UpdateValueSet (); +//private: + //void PopupModeEndCallback (void); +}; + +} } // end of namespace svx::sidebar + +#endif + + + + diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx new file mode 100644 index 000000000000..ff268382ae45 --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx @@ -0,0 +1,1674 @@ +/* + * 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 <svx/sidebar/ColorControl.hxx> + +#include "ParaPropertyPanel.hxx" +#include "ParaPropertyPanel.hrc" + +#include "ParaLineSpacingPopup.hxx" +#include "ParaLineSpacingControl.hxx" +#include "ParaBulletsPopup.hxx" +#include "ParaBulletsControl.hxx" +#include "ParaNumberingPopup.hxx" +#include "ParaNumberingControl.hxx" +#include <sfx2/sidebar/Theme.hxx> +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include <sfx2/sidebar/ControlFactory.hxx> +#include <svx/sidebar/PopupContainer.hxx> +#include <sfx2/dispatch.hxx> +#include <editeng/colritem.hxx> +#include <editeng/brushitem.hxx> +#include <editeng/lrspitem.hxx> +#include <editeng/ulspitem.hxx> +#include <vcl/toolbox.hxx> +#include <vcl/fixed.hxx> +#include <vcl/svapp.hxx> +#include <svx/svxids.hrc> +#include <svl/intitem.hxx> +#include "svx/dialmgr.hxx" +#include <sfx2/objsh.hxx> +#include <svtools/unitconv.hxx> +#include <boost/bind.hpp> +using namespace css; +using namespace cssu; +using ::sfx2::sidebar::Theme; +using ::sfx2::sidebar::ControlFactory; + +#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) + + +namespace svx {namespace sidebar { +#define DEFAULT_VALUE 0 +#define TOOLBOX_ITEM1 1 +#define TOOLBOX_ITEM2 2 +#define TOOLBOX_ITEM3 3 +#define TOOLBOX_ITEM4 4 + +#define MAX_DURCH 5670 + +#define INDENT_INCREMENT 1 +#define INDENT_DECREMENT 2 +#define INDENT_STEP 706 +#define UL_STEP 58 +#define UL_INCREMENT 1 +#define UL_DECREMENT 2 + +#define MAX_SW 1709400 +#define MAX_SC_SD 116220200 +#define NEGA_MAXVALUE -10000000 + +#define POS_FT_PARA_SPACE Point(LogicToPixel(Point(FT_PARA_SPACE_X,FT_PARA_SPACE_Y), MAP_APPFONT)) +#define POS_FT_PARA_SPACE2 Point(LogicToPixel(Point(FT_PARA_SPACE_X,FT_PARA_SPACE_Y2), MAP_APPFONT)) +#define POS_TBX_PARA_SPACE_INC_DEC Point(LogicToPixel(Point(TBX_PARA_SPACE_INC_DEC_X,TBX_PARA_SPACE_INC_DEC_Y), MAP_APPFONT)) +#define POS_TBX_PARA_SPACE_INC_DEC2 Point(LogicToPixel(Point(TBX_PARA_SPACE_INC_DEC_X,TBX_PARA_SPACE_INC_DEC_Y2), MAP_APPFONT)) +#define POS_FT_PARA_INDENT Point(LogicToPixel(Point(FT_PARA_INDENT_X,FT_PARA_INDENT_Y), MAP_APPFONT)) +#define POS_FT_PARA_INDENT2 Point(LogicToPixel(Point(FT_PARA_INDENT_X,FT_PARA_INDENT_Y2), MAP_APPFONT)) +#define POS_TBX_PARA_INDENT_INC_DEC Point(LogicToPixel(Point(TBX_PARA_INDENT_INC_DEC_X,TBX_PARA_INDENT_INC_DEC_Y), MAP_APPFONT)) +#define POS_TBX_PARA_INDENT_INC_DEC2 Point(LogicToPixel(Point(TBX_PARA_INDENT_INC_DEC_X,TBX_PARA_INDENT_INC_DEC_Y2), MAP_APPFONT)) +#define POS_MBX_TOP_DIST Point(LogicToPixel(Point(MBX_TOP_DIST_X,MBX_TOP_DIST_Y), MAP_APPFONT)) +#define POS_MBX_TOP_DIST2 Point(LogicToPixel(Point(MBX_TOP_DIST_X,MBX_TOP_DIST_Y2), MAP_APPFONT)) +#define POS_MBX_BOT_DIST Point(LogicToPixel(Point(MBX_BOT_DIST_X,MBX_BOT_DIST_Y), MAP_APPFONT)) +#define POS_MBX_BOT_DIST2 Point(LogicToPixel(Point(MBX_BOT_DIST_X,MBX_BOT_DIST_Y2), MAP_APPFONT)) +#define POS_MBX_LEFT_DIST Point(LogicToPixel(Point(MBX_LEFT_DIST_X,MBX_LEFT_DIST_Y), MAP_APPFONT)) +#define POS_MBX_LEFT_DIST2 Point(LogicToPixel(Point(MBX_LEFT_DIST_X,MBX_LEFT_DIST_Y2), MAP_APPFONT)) +#define POS_MBX_RIGHT_DIST Point(LogicToPixel(Point(MBX_RIGHT_DIST_X,MBX_RIGHT_DIST_Y), MAP_APPFONT)) +#define POS_MBX_RIGHT_DIST2 Point(LogicToPixel(Point(MBX_RIGHT_DIST_X,MBX_RIGHT_DIST_Y2), MAP_APPFONT)) +#define POS_MBX_FLINE_DIST Point(LogicToPixel(Point(MBX_FLINE_DIST_X,MBX_FLINE_DIST_Y), MAP_APPFONT)) +#define POS_MBX_FLINE_DIST2 Point(LogicToPixel(Point(MBX_FLINE_DIST_X,MBX_FLINE_DIST_Y2), MAP_APPFONT)) +#define POS_IMG_SPACE1 Point(LogicToPixel(Point(IMG_SPACE_X,IMG_SPACE1_Y), MAP_APPFONT)) +#define POS_IMG_SPACE12 Point(LogicToPixel(Point(IMG_SPACE_X,IMG_SPACE1_Y2), MAP_APPFONT)) +#define POS_IMG_SPACE2 Point(LogicToPixel(Point(IMG_SPACE_X,IMG_SPACE2_Y), MAP_APPFONT)) +#define POS_IMG_SPACE22 Point(LogicToPixel(Point(IMG_SPACE_X,IMG_SPACE2_Y2), MAP_APPFONT)) +#define POS_IMG_INDENT1 Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT1_Y), MAP_APPFONT)) +#define POS_IMG_INDENT12 Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT1_Y2), MAP_APPFONT)) +#define POS_IMG_INDENT2 Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT2_Y), MAP_APPFONT)) +#define POS_IMG_INDENT22 Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT2_Y2), MAP_APPFONT)) +#define POS_IMG_INDENT3 Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT3_Y), MAP_APPFONT)) +#define POS_IMG_INDENT32 Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT3_Y2), MAP_APPFONT)) +#define TBX_LINE_SPACE Point(LogicToPixel(Point(TBX_LINE_SPACE_X,TBX_LINE_SPACE_Y), MAP_APPFONT)) +#define TBX_LINE_SPACE2 Point(LogicToPixel(Point(TBX_LINE_SPACE_X,TBX_LINE_SPACE_Y2), MAP_APPFONT)) + +ParaPropertyPanel* ParaPropertyPanel::Create ( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings, + const cssu::Reference<css::ui::XSidebar>& rxSidebar) +{ + if (pParent == NULL) + throw lang::IllegalArgumentException(A2S("no parent Window given to ParaPropertyPanel::Create"), NULL, 0); + if ( ! rxFrame.is()) + throw lang::IllegalArgumentException(A2S("no XFrame given to ParaPropertyPanel::Create"), NULL, 1); + if (pBindings == NULL) + throw lang::IllegalArgumentException(A2S("no SfxBindings given to ParaPropertyPanel::Create"), NULL, 2); + + return new ParaPropertyPanel( + pParent, + rxFrame, + pBindings, + rxSidebar); +} + +void ParaPropertyPanel::HandleContextChange ( + const ::sfx2::sidebar::EnumContext aContext) +{ + if (maContext == aContext) + { + // Nothing to do. + return; + } + + maContext = aContext; + switch (maContext.GetCombinedContext_DI()) + { + case CombinedEnumContext(Application_Calc, Context_DrawText): + maTBxVertAlign->Show(); + maTBxVertAlignBackground->Show(); + maTBxBackColor->Hide(); + maTBxBackColorBackground->Hide(); + maTBxNumBullet->Hide(); + maTBxNumBulletBackground->Hide(); + ReSize(false); + maTbxIndent_IncDec->Show(); + maTbxIndent_IncDecBackground->Show(); + maTbxProDemote->Hide(); + maTbxProDemoteBackground->Hide(); + break; + + case CombinedEnumContext(Application_DrawImpress, Context_Draw): + case CombinedEnumContext(Application_DrawImpress, Context_TextObject): + case CombinedEnumContext(Application_DrawImpress, Context_Graphic): + maTBxVertAlign->Hide(); + maTBxVertAlignBackground->Hide(); + maTBxBackColor->Hide(); + maTBxBackColorBackground->Hide(); + maTBxNumBullet->Show(); + maTBxNumBulletBackground->Show(); + ReSize(true); + maTbxIndent_IncDec->Hide(); + maTbxIndent_IncDecBackground->Hide(); + maTbxProDemote->Show(); + maTbxProDemoteBackground->Show(); + break; + + case CombinedEnumContext(Application_DrawImpress, Context_DrawText): + maTBxVertAlign->Show(); + maTBxVertAlignBackground->Show(); + maTBxBackColor->Hide(); + maTBxBackColorBackground->Hide(); + maTBxNumBullet->Show(); + maTBxNumBulletBackground->Show(); + ReSize(true); + maTbxIndent_IncDec->Hide(); + maTbxIndent_IncDecBackground->Hide(); + maTbxProDemote->Show(); + maTbxProDemoteBackground->Show(); + break; + + case CombinedEnumContext(Application_DrawImpress, Context_Table): + maTBxVertAlign->Show(); + maTBxVertAlignBackground->Show(); + maTBxBackColor->Hide(); + maTBxBackColorBackground->Hide(); + maTBxNumBullet->Show(); + maTBxNumBulletBackground->Show(); + ReSize(true); + maTbxIndent_IncDec->Hide(); + maTbxIndent_IncDecBackground->Hide(); + maTbxProDemote->Show(); + maTbxProDemoteBackground->Show(); + break; + + case CombinedEnumContext(Application_WriterAndWeb, Context_Default): + case CombinedEnumContext(Application_WriterAndWeb, Context_Text): + maTBxVertAlign->Hide(); + maTBxVertAlignBackground->Hide(); + maTBxBackColor->Show(); + maTBxBackColorBackground->Show(); + maTBxNumBullet->Show(); + + maTBxNumBulletBackground->Show(); + ReSize(true); + maTbxIndent_IncDec->Show(); + maTbxIndent_IncDecBackground->Show(); + maTbxProDemote->Hide(); + maTbxProDemoteBackground->Hide(); + break; + + case CombinedEnumContext(Application_WriterAndWeb, Context_Table): + maTBxVertAlign->Show(); + maTBxVertAlignBackground->Show(); + maTBxBackColor->Show(); + maTBxBackColorBackground->Show(); + maTBxNumBullet->Show(); + maTBxNumBulletBackground->Show(); + ReSize(true); + maTbxIndent_IncDec->Show(); + maTbxIndent_IncDecBackground->Show(); + maTbxProDemote->Hide(); + maTbxProDemoteBackground->Hide(); + break; + + case CombinedEnumContext(Application_WriterAndWeb, Context_DrawText): + maTBxVertAlign->Show(); + maTBxVertAlignBackground->Show(); + maTBxBackColor->Hide(); + maTBxBackColorBackground->Hide(); + maTBxNumBullet->Hide(); + maTBxNumBulletBackground->Hide(); + ReSize(false); + maTbxIndent_IncDec->Show(); + maTbxIndent_IncDecBackground->Show(); + maTbxProDemote->Hide(); + maTbxProDemoteBackground->Hide(); + break; + + case CombinedEnumContext(Application_WriterAndWeb, Context_Annotation): + maTBxVertAlign->Hide(); + maTBxVertAlignBackground->Hide(); + maTBxBackColor->Hide(); + maTBxBackColorBackground->Hide(); + maTBxNumBullet->Hide(); + maTBxNumBulletBackground->Hide(); + ReSize(false); + maTbxIndent_IncDec->Show(); + maTbxIndent_IncDecBackground->Show(); + maTbxProDemote->Hide(); + maTbxProDemoteBackground->Hide(); + break; + + case CombinedEnumContext(Application_Calc, Context_EditCell): + case CombinedEnumContext(Application_Calc, Context_Cell): + case CombinedEnumContext(Application_Calc, Context_Pivot): + case CombinedEnumContext(Application_DrawImpress, Context_Text): + case CombinedEnumContext(Application_DrawImpress, Context_OutlineText): + /*{ + mpToolBoxScriptSw->Hide(); + mpToolBoxScript->Show(); + mpToolBoxSpacing->Show(); + mpToolBoxHighlight->Hide(); + + Size aSize(PROPERTYPAGE_WIDTH,TEXT_SECTIONPAGE_HEIGHT); + aSize = LogicToPixel( aSize,MapMode(MAP_APPFONT) ); + aSize.setWidth(GetOutputSizePixel().Width()); + SetSizePixel(aSize); + }*/ + break; + + default: + break; + } +} + +SfxBindings* ParaPropertyPanel::GetBindings() +{ + return mpBindings; +} + +void ParaPropertyPanel::SetupIcons (void) +{ + if (Theme::GetBoolean(Theme::Bool_UseSymphonyIcons)) + { + } + else + { + } +} + +void ParaPropertyPanel::DataChanged (const DataChangedEvent& rEvent) +{ + (void)rEvent; + + SetupIcons(); +} + +ParaPropertyPanel::~ParaPropertyPanel() +{ + delete mpLnSPItem; +} + +void ParaPropertyPanel::ReSize(bool bSize) +{ + if(bSize) + { + //Paragraph spacing + maFTUL->SetPosPixel(POS_FT_PARA_SPACE); + maTbxUL_IncDec->SetPosPixel(POS_TBX_PARA_SPACE_INC_DEC); + maTopDist->SetPosPixel(POS_MBX_TOP_DIST); + maBottomDist->SetPosPixel(POS_MBX_BOT_DIST); + //Indent + maFTIndent->SetPosPixel(POS_FT_PARA_INDENT); + maTbxIndent_IncDec->SetPosPixel(POS_TBX_PARA_INDENT_INC_DEC); + maTbxProDemote->SetPosPixel(POS_TBX_PARA_INDENT_INC_DEC); + maLeftIndent->SetPosPixel(POS_MBX_LEFT_DIST); + maRightIndent->SetPosPixel(POS_MBX_RIGHT_DIST); + maFLineIndent->SetPosPixel(POS_MBX_FLINE_DIST); + //Line spacing + maLineSPTbx->SetPosPixel(TBX_LINE_SPACE); + //image + maFISpace1.SetPosPixel(POS_IMG_SPACE1); + maFISpace2.SetPosPixel(POS_IMG_SPACE2); + maFIndent1.SetPosPixel(POS_IMG_INDENT1); + maFIndent2.SetPosPixel(POS_IMG_INDENT2); + maFIndent3.SetPosPixel(POS_IMG_INDENT3); + Size aSize(GetOutputSizePixel().Width(),PARA_SECTIONPAGE_HEIGHT); + aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) ); + aSize.setWidth(GetOutputSizePixel().Width()); + SetSizePixel(aSize); + } + else + { + //Paragraph spacing + maFTUL->SetPosPixel(POS_FT_PARA_SPACE2); + maTbxUL_IncDec->SetPosPixel(POS_TBX_PARA_SPACE_INC_DEC2); + maTopDist->SetPosPixel(POS_MBX_TOP_DIST2); + maBottomDist->SetPosPixel(POS_MBX_BOT_DIST2); + //Indent + maFTIndent->SetPosPixel(POS_FT_PARA_INDENT2); + maTbxIndent_IncDec->SetPosPixel(POS_TBX_PARA_INDENT_INC_DEC2); + maTbxProDemote->SetPosPixel(POS_TBX_PARA_INDENT_INC_DEC2); + maLeftIndent->SetPosPixel(POS_MBX_LEFT_DIST2); + maRightIndent->SetPosPixel(POS_MBX_RIGHT_DIST2); + maFLineIndent->SetPosPixel(POS_MBX_FLINE_DIST2); + //Line spacing + maLineSPTbx->SetPosPixel(TBX_LINE_SPACE2); + //image + maFISpace1.SetPosPixel(POS_IMG_SPACE12); + maFISpace2.SetPosPixel(POS_IMG_SPACE22); + maFIndent1.SetPosPixel(POS_IMG_INDENT12); + maFIndent2.SetPosPixel(POS_IMG_INDENT22); + maFIndent3.SetPosPixel(POS_IMG_INDENT32); + Size aSize(GetOutputSizePixel().Width(),PARA_SECTIONPAGE_HEIGHT_2); + aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) ); + aSize.setWidth(GetOutputSizePixel().Width()); + SetSizePixel(aSize); + } + + if (mxSidebar.is()) + mxSidebar->requestLayout(); +} + +void ParaPropertyPanel::EndSpacingPopupMode (void) +{ + maLineSpacePopup.Hide(); +} + +void ParaPropertyPanel::EndBulletsPopupMode (void) +{ + //maUnderlinePopup.Hide(); +} + +void ParaPropertyPanel::EndNumberingPopupMode (void) +{ + //maUnderlinePopup.Hide(); +} + + +void ParaPropertyPanel::InitToolBoxAlign() +{ + maAlignToolBox->SetItemImage(TOOLBOX_ITEM1,maLeftPara); + maAlignToolBox->SetItemImage(TOOLBOX_ITEM2,maCentPara); + maAlignToolBox->SetItemImage(TOOLBOX_ITEM3,maRightPara); + maAlignToolBox->SetItemImage(TOOLBOX_ITEM4,maJusPara); + Link aLink = LINK( this, ParaPropertyPanel, AlignStyleModifyHdl_Impl ); + maAlignToolBox->SetSelectHdl( aLink ); + Size aTbxSize (maAlignToolBox->CalcWindowSizePixel()); + maAlignToolBox->SetOutputSizePixel( aTbxSize ); +} + +void ParaPropertyPanel::InitToolBoxVertAlign() +{ + InitImageList(maTBxVertAlign, maVertImageList, maVertImageListH); + maTBxVertAlign->SetSelectHdl(LINK(this,ParaPropertyPanel,VertTbxSelectHandler)); + Size aTbxSize (maTBxVertAlign->CalcWindowSizePixel()); + maTBxVertAlign->SetOutputSizePixel( aTbxSize ); +} + + +void ParaPropertyPanel::InitToolBoxIndent() +{ + Link aLink = LINK( this, ParaPropertyPanel, ModifyIndentHdl_Impl ); + maLeftIndent->SetModifyHdl( aLink ); + maRightIndent->SetModifyHdl( aLink ); + maFLineIndent->SetModifyHdl( aLink ); + + if( Application::GetSettings().GetLayoutRTL()) + { + maTbxIndent_IncDec->SetItemImage(TOOLBOX_ITEM1,maIndInc_BD); + maTbxIndent_IncDec->SetItemImage(TOOLBOX_ITEM2,maIndDec_BD); + } + else + { + maTbxIndent_IncDec->SetItemImage(TOOLBOX_ITEM1,maIndInc); + maTbxIndent_IncDec->SetItemImage(TOOLBOX_ITEM2,maIndDec); + } + maTbxIndent_IncDec->SetItemImage(TOOLBOX_ITEM3,maIndHang); + aLink = LINK( this, ParaPropertyPanel, ClickIndent_IncDec_Hdl_Impl ); + maTbxIndent_IncDec->SetSelectHdl(aLink); + m_eLRSpaceUnit = maLRSpaceControl.GetCoreMetric(); + Size aTbxSize = maTbxIndent_IncDec->CalcWindowSizePixel(); + maTbxIndent_IncDec->SetOutputSizePixel( aTbxSize ); + + if( Application::GetSettings().GetLayoutRTL()) + { + maTbxProDemote->SetItemImage(TOOLBOX_ITEM1,maIndInc_BD); + maTbxProDemote->SetItemImage(TOOLBOX_ITEM2,maIndDec_BD); + } + else + { + maTbxProDemote->SetItemImage(TOOLBOX_ITEM1,maIndInc); + maTbxProDemote->SetItemImage(TOOLBOX_ITEM2,maIndDec); + } + maTbxProDemote->SetItemImage(TOOLBOX_ITEM3,maIndHang); + aLink = LINK( this, ParaPropertyPanel, ClickProDemote_Hdl_Impl ); + maTbxProDemote->SetSelectHdl(aLink); + m_eLRSpaceUnit = maLRSpaceControl.GetCoreMetric(); + aTbxSize = maTbxProDemote->CalcWindowSizePixel(); + maTbxProDemote->SetOutputSizePixel( aTbxSize ); +} + +void ParaPropertyPanel::InitToolBoxBGColor() +{ + mpColorUpdater.reset(new ::svx::ToolboxButtonColorUpdater(SID_BACKGROUND_COLOR, TBI_BACK_COLOR, maTBxBackColor.get(), TBX_UPDATER_MODE_CHAR_COLOR_NEW )); + + maTBxBackColor->SetItemImage(TBI_BACK_COLOR, GetDisplayBackground().GetColor().IsDark()? maImgBackColorHigh : maImgBackColor); + maTBxBackColor->SetItemBits( TBI_BACK_COLOR, maTBxBackColor->GetItemBits( TBI_BACK_COLOR ) | TIB_DROPDOWNONLY ); + + Link aLink = LINK(this, ParaPropertyPanel, ToolBoxBackColorDDHandler); + maTBxBackColor->SetDropdownClickHdl ( aLink ); + maTBxBackColor->SetSelectHdl ( aLink ); + Size aTbxSize (maTBxBackColor->CalcWindowSizePixel()); + maTBxBackColor->SetOutputSizePixel( aTbxSize ); +} + +void ParaPropertyPanel::InitToolBoxBulletsNumbering() +{ + if( Application::GetSettings().GetLayoutRTL()) + { + maTBxNumBullet->SetItemImage( IID_BULLET, maNumBImageListRTL.GetImage( IID_BULLET ) ); + maTBxNumBullet->SetItemImage( IID_NUMBER, maNumBImageListRTL.GetImage( IID_NUMBER ) ); + } + else + InitImageList(maTBxNumBullet, maNumBImageList, maNumBImageListH); + + maTBxNumBullet->SetDropdownClickHdl(LINK(this,ParaPropertyPanel,NumBTbxDDHandler)); + maTBxNumBullet->SetSelectHdl(LINK(this,ParaPropertyPanel,NumBTbxSelectHandler)); + Size aTbxSize (maTBxNumBullet->CalcWindowSizePixel()); + maTBxNumBullet->SetOutputSizePixel( aTbxSize ); +} +void ParaPropertyPanel::InitToolBoxSpacing() +{ + Link aLink = LINK( this, ParaPropertyPanel, ULSpaceHdl_Impl ); + maTopDist->SetModifyHdl(aLink); + maBottomDist->SetModifyHdl( aLink ); + + maTbxUL_IncDec->SetItemImage(TOOLBOX_ITEM1,maParInc); + maTbxUL_IncDec->SetItemImage(TOOLBOX_ITEM2,maParDec); + aLink = LINK( this, ParaPropertyPanel, ClickUL_IncDec_Hdl_Impl ); + maTbxUL_IncDec->SetSelectHdl(aLink); + m_eULSpaceUnit = maULSpaceControl.GetCoreMetric(); + Size aTbxSize = maTbxUL_IncDec->CalcWindowSizePixel(); + maTbxUL_IncDec->SetOutputSizePixel( aTbxSize ); +} +void ParaPropertyPanel::InitToolBoxLineSpacing() +{ + Link aLink = LINK( this, ParaPropertyPanel, ClickLineSPDropDownHdl_Impl ); + maLineSPTbx->SetDropdownClickHdl( aLink ); + maLineSPTbx->SetSelectHdl( aLink ); //support keyinput "ENTER" + maLineSPTbx->SetItemBits( TOOLBOX_ITEM1, maLineSPTbx->GetItemBits( TOOLBOX_ITEM1 ) | TIB_DROPDOWNONLY ); + maLineSPTbx->SetItemImage(TOOLBOX_ITEM1,maSpace3); + Size aTbxSize = maLineSPTbx->CalcWindowSizePixel(); + maLineSPTbx->SetOutputSizePixel( aTbxSize ); +} + +void ParaPropertyPanel::initial() +{ + maFTUL->SetBackground(Wallpaper()); + maFTIndent->SetBackground(Wallpaper()); + maFISpace1.SetBackground(Wallpaper()); + maFISpace2.SetBackground(Wallpaper()); + maFIndent1.SetBackground(Wallpaper()); + maFIndent2.SetBackground(Wallpaper()); + maFIndent3.SetBackground(Wallpaper()); + + maFISpace1.SetImage(maSpace1); + maFISpace2.SetImage(maSpace2); + maFIndent1.SetImage(maIndent3); + maFIndent2.SetImage(maIndent2); + maFIndent3.SetImage(maIndent1); + + GetBindings()->Invalidate(SID_ATTR_PARA_ADJUST_LEFT,sal_True,sal_False); + GetBindings()->Invalidate(SID_ATTR_PARA_ADJUST_CENTER,sal_True,sal_False); + GetBindings()->Invalidate(SID_ATTR_PARA_ADJUST_RIGHT,sal_True,sal_False); + GetBindings()->Invalidate(SID_ATTR_PARA_ADJUST_BLOCK,sal_True,sal_False); + + //toolbox + SetupIcons(); + InitToolBoxAlign(); + InitToolBoxVertAlign(); + InitToolBoxIndent(); + InitToolBoxBGColor(); + InitToolBoxBulletsNumbering(); + InitToolBoxSpacing(); + InitToolBoxLineSpacing(); + +#ifdef HAS_IA2 + maAlignToolBox->SetAccRelationLabeledBy(&maAlignToolBox); + maTBxVertAlign->SetMpSubEditAccLableBy(&maTBxVertAlign); + maTBxNumBullet->SetAccRelationLabeledBy(&maTBxNumBullet); + maTBxBackColor->SetMpSubEditAccLableBy(&maTBxBackColor); + maFTUL->SetAccRelationLabeledBy(&maFTUL); + maTbxUL_IncDec->SetAccRelationLabeledBy(&maTbxUL_IncDec); + maTopDist->SetAccRelationLabeledBy(&maTopDist); + maBottomDist->SetAccRelationLabeledBy(&maBottomDist); + maLineSPTbx->SetAccRelationLabeledBy(&maLineSPTbx); + maFTIndent->SetAccRelationLabeledBy(&maFTIndent); + maTbxIndent_IncDec->SetAccRelationLabeledBy(&maTbxIndent_IncDec); + maTbxProDemote->SetAccRelationLabeledBy(&maTbxProDemote); + maLeftIndent->SetAccRelationLabeledBy(&maLeftIndent); + maRightIndent->SetAccRelationLabeledBy(&maRightIndent); + maFLineIndent->SetAccRelationLabeledBy(&maFLineIndent); + mpColorUpdater->SetAccRelationLabeledBy(&mpColorUpdater); +#endif +} + +void ParaPropertyPanel::InitImageList(::boost::scoped_ptr<ToolBox>& rTbx, ImageList& rImglst, ImageList& rImgHlst) +{ + sal_Bool bHighContrast = GetDisplayBackground().GetColor().IsDark(); + + ImageList& rImgLst = bHighContrast ? rImgHlst : rImglst; + + sal_uInt16 nCount = rTbx->GetItemCount(); + for (sal_uInt16 i = 0; i < nCount; i++) + { + sal_uInt16 nId = rTbx->GetItemId(i); + rTbx->SetItemImage( nId, rImgLst.GetImage( nId ) ); + } +} + +//===========================for Numbering & Bullet================================================ + + + +IMPL_LINK(ParaPropertyPanel, NumBTbxDDHandler, ToolBox*, pToolBox) +{ + sal_uInt16 nId = pToolBox->GetCurItemId(); + + EndTracking(); + pToolBox->SetItemDown( nId, sal_True ); + + if (nId == 1) + { + maBulletsPopup.UpdateValueSet(); + maBulletsPopup.Show(*pToolBox); + } + else if (nId == 2) + { + maNumberingPopup.UpdateValueSet(); + maNumberingPopup.Show(*pToolBox); + } + pToolBox->SetItemDown( nId, sal_False ); + return 0; +} + +IMPL_LINK(ParaPropertyPanel, NumBTbxSelectHandler, ToolBox*, pToolBox) +{ + sal_uInt16 nId = pToolBox->GetCurItemId(); + sal_uInt16 nSID = SID_TABLE_VERT_NONE; + + EndTracking(); + if (nId == 1) + { + nSID = FN_NUM_BULLET_ON; + } + else if ( nId == 2) + { + nSID = FN_NUM_NUMBERING_ON; + } + SfxBoolItem aBoolItem(nSID, sal_True); + GetBindings()->GetDispatcher()->Execute(nSID, SFX_CALLMODE_RECORD, &aBoolItem, 0L); + + return 0; +} + + +//================================for Vertical Alignment======================================== + + + +IMPL_LINK(ParaPropertyPanel, VertTbxSelectHandler, ToolBox*, pToolBox) +{ + sal_uInt16 nId = pToolBox->GetCurItemId(); + sal_uInt16 nSID = SID_TABLE_VERT_NONE; + EndTracking(); + if (nId == 1) + { + nSID = SID_TABLE_VERT_NONE; + maTBxVertAlign->SetItemState(1, STATE_CHECK); + maTBxVertAlign->SetItemState(2, STATE_NOCHECK); + maTBxVertAlign->SetItemState(3, STATE_NOCHECK); + } + else if (nId == 2) + { + nSID = SID_TABLE_VERT_CENTER; + maTBxVertAlign->SetItemState(1, STATE_NOCHECK); + maTBxVertAlign->SetItemState(2, STATE_CHECK); + maTBxVertAlign->SetItemState(3, STATE_NOCHECK); + } + else if (nId == 3) + { + nSID = SID_TABLE_VERT_BOTTOM; + maTBxVertAlign->SetItemState(1, STATE_NOCHECK); + maTBxVertAlign->SetItemState(2, STATE_NOCHECK); + maTBxVertAlign->SetItemState(3, STATE_CHECK); + } + SfxBoolItem aBoolItem(nSID, sal_True); + GetBindings()->GetDispatcher()->Execute(nSID, SFX_CALLMODE_RECORD, &aBoolItem, 0L); + + return 0; +} + +void ParaPropertyPanel::VertStateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState) +{ + if (eState < SFX_ITEM_DONTCARE) + { + maTBxVertAlign->SetItemState(1, STATE_NOCHECK); + maTBxVertAlign->SetItemState(2, STATE_NOCHECK); + maTBxVertAlign->SetItemState(3, STATE_NOCHECK); + maTBxVertAlign->EnableItem(1, sal_False); + maTBxVertAlign->EnableItem(2, sal_False); + maTBxVertAlign->EnableItem(3, sal_False); + } + else + { + maTBxVertAlign->EnableItem(1, sal_True); + maTBxVertAlign->EnableItem(2, sal_True); + maTBxVertAlign->EnableItem(3, sal_True); + if ( (eState >= SFX_ITEM_DEFAULT) && (pState->ISA(SfxBoolItem))) + { + const SfxBoolItem* pItem= (const SfxBoolItem*)pState; + sal_Bool aBool = (sal_Bool)pItem->GetValue(); + + if (aBool) + { + if (nSID == SID_TABLE_VERT_NONE) + { + maTBxVertAlign->SetItemState(1, STATE_CHECK); + maTBxVertAlign->SetItemState(2, STATE_NOCHECK); + maTBxVertAlign->SetItemState(3, STATE_NOCHECK); + } + else if (nSID == SID_TABLE_VERT_CENTER) + { + maTBxVertAlign->SetItemState(1, STATE_NOCHECK); + maTBxVertAlign->SetItemState(2, STATE_CHECK); + maTBxVertAlign->SetItemState(3, STATE_NOCHECK); + } + else if (nSID == SID_TABLE_VERT_BOTTOM) + { + maTBxVertAlign->SetItemState(1, STATE_NOCHECK); + maTBxVertAlign->SetItemState(2, STATE_NOCHECK); + maTBxVertAlign->SetItemState(3, STATE_CHECK); + } + } + else + { + if (nSID == SID_TABLE_VERT_NONE) + { + maTBxVertAlign->SetItemState(1, STATE_NOCHECK); + } + else if (nSID == SID_TABLE_VERT_CENTER) + { + maTBxVertAlign->SetItemState(2, STATE_NOCHECK); + } + else if (nSID == SID_TABLE_VERT_BOTTOM) + { + maTBxVertAlign->SetItemState(3, STATE_NOCHECK); + } + } + } + else + { + maTBxVertAlign->SetItemState(1, STATE_NOCHECK); + maTBxVertAlign->SetItemState(2, STATE_NOCHECK); + maTBxVertAlign->SetItemState(3, STATE_NOCHECK); + } + } +} +//==================================for Background color===================== + +IMPL_LINK(ParaPropertyPanel, ToolBoxBackColorDDHandler,ToolBox*, pToolBox) +{ + sal_uInt16 nId = pToolBox->GetCurItemId(); + OSL_ASSERT(nId == TBI_BACK_COLOR); + if(nId == TBI_BACK_COLOR) + { + pToolBox->SetItemDown( nId, true ); + maBGColorPopup.Show(*pToolBox); + maBGColorPopup.SetCurrentColor(maColor, mbColorAvailable); + } + return 0; +} + +IMPL_LINK( ParaPropertyPanel, ImplPopupModeEndHdl, FloatingWindow*, EMPTYARG ) +{ + return 0; +} + +void ParaPropertyPanel::ShowMenu (void) +{ + if (mpBindings != NULL) + { + SfxDispatcher* pDispatcher = mpBindings->GetDispatcher(); + if (pDispatcher != NULL) + pDispatcher->Execute(SID_PARA_DLG, SFX_CALLMODE_ASYNCHRON); + } +} + +void ParaPropertyPanel::ParaBKGStateChanged(sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* pState) +{ + if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxColorItem)) + { + const SvxColorItem* pItem = (const SvxColorItem*)pState; + maColor = pItem->GetValue(); + mbColorAvailable = sal_True; + mpColorUpdater->Update(maColor); + } + else + { + mbColorAvailable = sal_False; + maColor.SetColor(COL_AUTO); + mpColorUpdater->Update(maColor); + } +} + +Color ParaPropertyPanel::GetBGColor (void) const +{ + return maColor; +} + +void ParaPropertyPanel::SetBGColor ( + const String& /*rsColorName*/, + const Color aColor) +{ + SvxColorItem aColorItem(aColor, SID_BACKGROUND_COLOR); + mpBindings->GetDispatcher()->Execute(SID_BACKGROUND_COLOR, SFX_CALLMODE_RECORD, &aColorItem, 0L); + maColor = aColor; +} + +//==================================for Paragraph Alignment===================== +IMPL_LINK( ParaPropertyPanel, AlignStyleModifyHdl_Impl, ToolBox*, pBox ) +{ + switch (pBox->GetCurItemId()) + { + case BT_SUBSTLEFT: + { + pBox->SetItemState(BT_SUBSTLEFT,STATE_CHECK); + pBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK); + pBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK); + pBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK); + SfxBoolItem aBoolItem( SID_ATTR_PARA_ADJUST_LEFT, sal_True ); + GetBindings()->GetDispatcher()->Execute(SID_ATTR_PARA_ADJUST_LEFT, SFX_CALLMODE_RECORD, &aBoolItem, 0L); + } + break; + case BT_SUBSTCENTER: + { + pBox->SetItemState(BT_SUBSTCENTER,STATE_CHECK); + pBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK); + pBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK); + pBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK); + SfxBoolItem aBoolItem( SID_ATTR_PARA_ADJUST_CENTER, sal_True ); + GetBindings()->GetDispatcher()->Execute(SID_ATTR_PARA_ADJUST_CENTER, SFX_CALLMODE_RECORD, &aBoolItem, 0L); + } + break; + case BT_SUBSTRIGHT: + { + pBox->SetItemState(BT_SUBSTRIGHT,STATE_CHECK); + pBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK); + pBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK); + pBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK); + SfxBoolItem aBoolItem( SID_ATTR_PARA_ADJUST_RIGHT, sal_True ); + GetBindings()->GetDispatcher()->Execute(SID_ATTR_PARA_ADJUST_RIGHT, SFX_CALLMODE_RECORD, &aBoolItem, 0L); + } + break; + case BT_SUBSTJUSTIFY: + { + pBox->SetItemState(BT_SUBSTJUSTIFY,STATE_CHECK); + pBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK); + pBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK); + pBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK); + SfxBoolItem aBoolItem( SID_ATTR_PARA_ADJUST_BLOCK, sal_True ); + GetBindings()->GetDispatcher()->Execute(SID_ATTR_PARA_ADJUST_BLOCK, SFX_CALLMODE_RECORD, &aBoolItem, 0L); + } + break; + } + + return 0; +} +//==================================for Paragraph Indent===================== +IMPL_LINK_NOARG( ParaPropertyPanel, ModifyIndentHdl_Impl) +{ + SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE ); + aMargin.SetTxtLeft( (const long)GetCoreValue( *maLeftIndent.get(), m_eLRSpaceUnit ) ); + aMargin.SetRight( (const long)GetCoreValue( *maRightIndent.get(), m_eLRSpaceUnit ) ); + aMargin.SetTxtFirstLineOfst( (const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ) ); + + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L); + return 0; +} + +IMPL_LINK(ParaPropertyPanel, ClickIndent_IncDec_Hdl_Impl, ToolBox *, pControl) +{ + switch (pControl->GetCurItemId()) + { + case INDENT_INCREMENT: + { + switch (maContext.GetCombinedContext()) + { + case CombinedEnumContext(Application_Writer, Context_Default): + case CombinedEnumContext(Application_Writer, Context_Text): + case CombinedEnumContext(Application_Writer, Context_Table): + { + SfxBoolItem aMargin( SID_INC_INDENT, sal_True ); + GetBindings()->GetDispatcher()->Execute( + SID_INC_INDENT, SFX_CALLMODE_RECORD, &aMargin, 0L); + } + break; + default: + { + SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE ); + + maTxtLeft += INDENT_STEP; + sal_Int64 nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); + nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit ); + aMargin.SetTxtLeft( (const long)nVal ); + aMargin.SetRight( (const long)GetCoreValue( *maRightIndent.get(), m_eLRSpaceUnit ) ); + aMargin.SetTxtFirstLineOfst( (const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ) ); + + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L); + } + } + } + break; + case INDENT_DECREMENT: + { + switch (maContext.GetCombinedContext()) + { + case CombinedEnumContext(Application_Writer, Context_Default): + case CombinedEnumContext(Application_Writer, Context_Text): + case CombinedEnumContext(Application_Writer, Context_Table): + { + SfxBoolItem aMargin( SID_DEC_INDENT, sal_True ); + GetBindings()->GetDispatcher()->Execute( + SID_DEC_INDENT, SFX_CALLMODE_RECORD, &aMargin, 0L); + } + break; + default: + { + if((maTxtLeft - INDENT_STEP) < 0) + maTxtLeft = DEFAULT_VALUE; + else + maTxtLeft -= INDENT_STEP; + + SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE ); + + sal_Int64 nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); + nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit ); + + aMargin.SetTxtLeft( (const long)nVal ); + aMargin.SetRight( (const long)GetCoreValue( *maRightIndent.get(), m_eLRSpaceUnit ) ); + aMargin.SetTxtFirstLineOfst( (const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ) ); + + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L); + } + } + } + break; + case ID_HANGING_INDENT: + { + SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE ); + aMargin.SetTxtLeft( (const long)GetCoreValue( *maLeftIndent.get(), m_eLRSpaceUnit ) + (const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ) ); + aMargin.SetRight( (const long)GetCoreValue( *maRightIndent.get(), m_eLRSpaceUnit ) ); + aMargin.SetTxtFirstLineOfst( ((const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ))*(-1) ); + + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L); + } + break; + } + return( 0L ); +} + +IMPL_LINK(ParaPropertyPanel, ClickProDemote_Hdl_Impl, ToolBox *, pControl) +{ + switch (pControl->GetCurItemId()) + { + case BT_TBX_INDENT_PROMOTE: + { + SvxLRSpaceItem aMargin( SID_ATTR_PARA_RIGHT ); + + maTxtLeft += INDENT_STEP; + sal_Int64 nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); + nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit ); + aMargin.SetTxtLeft( (const long)nVal ); + aMargin.SetRight( (const long)GetCoreValue( *maRightIndent.get(), m_eLRSpaceUnit ) ); + aMargin.SetTxtFirstLineOfst( (const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ) ); + + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_PARA_RIGHT, SFX_CALLMODE_RECORD, &aMargin, 0L); + } + break; + case BT_TBX_INDENT_DEMOTE: + { + if((maTxtLeft - INDENT_STEP) < 0) + maTxtLeft = DEFAULT_VALUE; + else + maTxtLeft -= INDENT_STEP; + + SvxLRSpaceItem aMargin( SID_ATTR_PARA_LEFT ); + + sal_Int64 nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); + nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit ); + + aMargin.SetTxtLeft( (const long)nVal ); + aMargin.SetRight( (const long)GetCoreValue( *maRightIndent.get(), m_eLRSpaceUnit ) ); + aMargin.SetTxtFirstLineOfst( (const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ) ); + + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_PARA_LEFT, SFX_CALLMODE_RECORD, &aMargin, 0L); + } + break; + case SD_HANGING_INDENT: + { + SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE ); + aMargin.SetTxtLeft( (const long)GetCoreValue( *maLeftIndent.get(), m_eLRSpaceUnit ) + (const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ) ); + aMargin.SetRight( (const long)GetCoreValue( *maRightIndent.get(), m_eLRSpaceUnit ) ); + aMargin.SetTxtFirstLineOfst( ((const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ))*(-1) ); + + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L); + } + break; + } + return( 0L ); +} +//==================================for Paragraph Line Spacing===================== + +IMPL_LINK( ParaPropertyPanel, ClickLineSPDropDownHdl_Impl, ToolBox*, pBox ) +{ + + const sal_uInt16 nId = pBox->GetCurItemId(); + OSL_ASSERT(nId == TOOLBOX_ITEM1); + if(nId == TOOLBOX_ITEM1) + { + pBox->SetItemDown( nId, true ); + maLineSpacePopup.Rearrange(meLnSpState,m_eMetricUnit,mpLnSPItem,maContext); + maLineSpacePopup.Show(*pBox); + + } + return (0L); +} + +//==================================for Paragraph Spacing===================== +IMPL_LINK_NOARG( ParaPropertyPanel, ULSpaceHdl_Impl) +{ + SvxULSpaceItem aMargin( SID_ATTR_PARA_ULSPACE ); + aMargin.SetUpper( (sal_uInt16)GetCoreValue( *maTopDist.get(), m_eULSpaceUnit ) ); + aMargin.SetLower( (sal_uInt16)GetCoreValue( *maBottomDist.get(), m_eULSpaceUnit ) ); + + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_PARA_ULSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L); + return 0L; +} + +IMPL_LINK(ParaPropertyPanel, ClickUL_IncDec_Hdl_Impl, ToolBox *, pControl) +{ + switch (pControl->GetCurItemId()) + { + case UL_INCREMENT: + { + SvxULSpaceItem aMargin( SID_ATTR_PARA_ULSPACE ); + + maUpper += UL_STEP; + sal_Int64 nVal = OutputDevice::LogicToLogic( maUpper, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); + nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit ); + aMargin.SetUpper( (const sal_uInt16)nVal ); + + maLower += UL_STEP; + nVal = OutputDevice::LogicToLogic( maLower, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); + nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit ); + aMargin.SetLower( (const sal_uInt16)nVal ); + + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_PARA_ULSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L); + } + break; + case UL_DECREMENT: + { + SvxULSpaceItem aMargin( SID_ATTR_PARA_ULSPACE ); + + if( maUpper >= UL_STEP ) + { + maUpper -= UL_STEP; + sal_Int64 nVal = OutputDevice::LogicToLogic( maUpper, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); + nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit ); + aMargin.SetUpper( (const sal_uInt16)nVal ); + } + else + aMargin.SetUpper( DEFAULT_VALUE ); + if( maLower >= UL_STEP ) + { + maLower -= UL_STEP; + sal_Int64 nVal = OutputDevice::LogicToLogic( maLower, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); + nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit ); + aMargin.SetLower( (const sal_uInt16)nVal ); + } + else + aMargin.SetLower( DEFAULT_VALUE ); + + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_PARA_ULSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L); + } + break; + } + return( 0L ); +} + +//==================================for Paragraph State change===================== +void ParaPropertyPanel::NotifyItemUpdate( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) +{ + if( nSID == SID_ATTR_METRIC ) + { + m_eMetricUnit = GetCurrentUnit(eState,pState); + if( m_eMetricUnit!=m_last_eMetricUnit ) + { + SetFieldUnit( *maLeftIndent.get(), m_eMetricUnit ); + SetFieldUnit( *maRightIndent.get(), m_eMetricUnit ); + SetFieldUnit( *maFLineIndent.get(), m_eMetricUnit ); + SetFieldUnit( *maTopDist.get(), m_eMetricUnit ); + SetFieldUnit( *maBottomDist.get(), m_eMetricUnit ); + } + m_last_eMetricUnit = m_eMetricUnit; + } + + if( nSID == SID_ATTR_PARA_LRSPACE ) + StateChangedIndentImpl( nSID, eState, pState ); + + if( nSID == SID_ATTR_PARA_LINESPACE ) + StateChangedLnSPImpl( nSID, eState, pState ); + + if( nSID == SID_ATTR_PARA_ULSPACE) + StateChangedULImpl( nSID, eState, pState ); + + if (nSID==SID_ATTR_PARA_ADJUST_LEFT || nSID==SID_ATTR_PARA_ADJUST_CENTER || nSID==SID_ATTR_PARA_ADJUST_RIGHT || nSID==SID_ATTR_PARA_ADJUST_BLOCK) + StateChangedAlignmentImpl( nSID, eState, pState ); + + if (nSID==SID_OUTLINE_LEFT || nSID==SID_OUTLINE_RIGHT) + StateChangeOutLineImpl( nSID, eState, pState ); + + if (nSID==SID_INC_INDENT || nSID==SID_DEC_INDENT) + StateChangeIncDecImpl( nSID, eState, pState ); + // Add toggle state for numbering and bullet icons + if (nSID==FN_NUM_NUMBERING_ON || nSID==FN_NUM_BULLET_ON) + StateChangeBulletNumImpl( nSID, eState, pState ); + + //Get the num rule index data of the current selection + if ( nSID == FN_BUL_NUM_RULE_INDEX ||nSID == FN_NUM_NUM_RULE_INDEX) + StateChangeBulletNumRuleImpl( nSID, eState, pState ); + + if ((nSID == SID_TABLE_VERT_NONE)||(nSID == SID_TABLE_VERT_CENTER)||(nSID == SID_TABLE_VERT_BOTTOM)) + { + VertStateChanged( nSID, eState, pState); + } + else if (nSID == SID_BACKGROUND_COLOR) + { + ParaBKGStateChanged(nSID, eState, pState); + } +} + +void ParaPropertyPanel::StateChangedAlignmentImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) +{ + if( eState >= SFX_ITEM_AVAILABLE ) + { + const SfxBoolItem* pItem = (const SfxBoolItem*)pState; + bool IsChecked = (bool)pItem->GetValue(); + switch (nSID) + { + case SID_ATTR_PARA_ADJUST_LEFT: + { + if(IsChecked) + { + maAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_CHECK); + maAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK); + maAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK); + maAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK); + } + else + maAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK); + } + break; + case SID_ATTR_PARA_ADJUST_CENTER: + { + if(IsChecked) + { + maAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_CHECK); + maAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK); + maAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK); + maAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK); + } + else + maAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK); + } + break; + case SID_ATTR_PARA_ADJUST_RIGHT: + { + if(IsChecked) + { + maAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_CHECK); + maAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK); + maAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK); + maAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK); + } + else + maAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK); + } + break; + case SID_ATTR_PARA_ADJUST_BLOCK: + { + if(IsChecked) + { + maAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_CHECK); + maAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK); + maAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK); + maAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK); + } + else + maAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK); + } + break; + } + } + else if( eState == SFX_ITEM_DISABLED ) + { + } + else if ( eState == SFX_ITEM_DONTCARE ) + { + switch (nSID) + { + case SID_ATTR_PARA_ADJUST_LEFT: + maAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK); + break; + case SID_ATTR_PARA_ADJUST_CENTER: + maAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK); + break; + case SID_ATTR_PARA_ADJUST_RIGHT: + maAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK); + break; + case SID_ATTR_PARA_ADJUST_BLOCK: + maAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK); + break; + } + } +} + +void ParaPropertyPanel::StateChangedIndentImpl( sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* pState ) +{ + switch (maContext.GetCombinedContext()) + { + + case CombinedEnumContext(Application_Writer, Context_DrawText): + case CombinedEnumContext(Application_Calc, Context_DrawText): + case CombinedEnumContext(Application_Writer, Context_Annotation): + { + maLeftIndent->SetMin( DEFAULT_VALUE ); + maRightIndent->SetMin( DEFAULT_VALUE ); + maFLineIndent->SetMin( DEFAULT_VALUE ); + maTbxIndent_IncDec->Show(); + maTbxProDemote->Hide(); + } + break; + case CombinedEnumContext(Application_Draw, Context_DrawText): + case CombinedEnumContext(Application_Impress, Context_DrawText): + case CombinedEnumContext(Application_Draw, Context_Draw): + case CombinedEnumContext(Application_Draw, Context_TextObject): + case CombinedEnumContext(Application_Draw, Context_Graphic): + case CombinedEnumContext(Application_Impress, Context_Draw): + case CombinedEnumContext(Application_Impress, Context_TextObject): + case CombinedEnumContext(Application_Impress, Context_Graphic): + case CombinedEnumContext(Application_Impress, Context_Table): + case CombinedEnumContext(Application_Draw, Context_Table): + { + maLeftIndent->SetMin( DEFAULT_VALUE ); + maRightIndent->SetMin( DEFAULT_VALUE ); + maFLineIndent->SetMin( DEFAULT_VALUE ); + maTbxIndent_IncDec->Hide(); + maTbxProDemote->Show(); + } + break; + case CombinedEnumContext(Application_Writer, Context_Default): + case CombinedEnumContext(Application_Writer, Context_Text): + case CombinedEnumContext(Application_Writer, Context_Table): + { + maLeftIndent->SetMin( NEGA_MAXVALUE, FUNIT_100TH_MM ); + maRightIndent->SetMin( NEGA_MAXVALUE, FUNIT_100TH_MM ); + maFLineIndent->SetMin( NEGA_MAXVALUE, FUNIT_100TH_MM ); + maTbxIndent_IncDec->Show(); + maTbxProDemote->Hide(); + } + break; + } + + if( pState && eState >= SFX_ITEM_AVAILABLE ) + { + SvxLRSpaceItem* pSpace = ( SvxLRSpaceItem*)pState; + maTxtLeft = pSpace->GetTxtLeft(); + maTxtLeft = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)m_eLRSpaceUnit, MAP_100TH_MM ); + maTxtLeft = OutputDevice::LogicToLogic( maTxtLeft, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) ); + + long aTxtRight = pSpace->GetRight(); + aTxtRight = OutputDevice::LogicToLogic( aTxtRight, (MapUnit)m_eLRSpaceUnit, MAP_100TH_MM ); + aTxtRight = OutputDevice::LogicToLogic( aTxtRight, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) ); + + long aTxtFirstLineOfst = pSpace->GetTxtFirstLineOfst(); + aTxtFirstLineOfst = OutputDevice::LogicToLogic( aTxtFirstLineOfst, (MapUnit)m_eLRSpaceUnit, MAP_100TH_MM ); + aTxtFirstLineOfst = OutputDevice::LogicToLogic( aTxtFirstLineOfst, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) ); + + long nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); + nVal = (long)maLeftIndent->Normalize( (long)nVal ); + maLeftIndent->SetValue( nVal, FUNIT_100TH_MM ); + + if(maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text) && + maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) && + maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Table)) + { + maFLineIndent->SetMin( nVal*(-1), FUNIT_100TH_MM ); + } + + long nrVal = OutputDevice::LogicToLogic( aTxtRight, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); + nrVal = (long)maRightIndent->Normalize( (long)nrVal ); + maRightIndent->SetValue( nrVal, FUNIT_100TH_MM ); + + long nfVal = OutputDevice::LogicToLogic( aTxtFirstLineOfst, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); + nfVal = (long)maFLineIndent->Normalize( (long)nfVal ); + maFLineIndent->SetValue( nfVal, FUNIT_100TH_MM ); + + switch (maContext.GetCombinedContext()) + { + case CombinedEnumContext(Application_Writer, Context_DrawText): + case CombinedEnumContext(Application_Writer, Context_Text): + case CombinedEnumContext(Application_Writer, Context_Default): + case CombinedEnumContext(Application_Writer, Context_Table): + case CombinedEnumContext(Application_Writer, Context_Annotation): + { + maLeftIndent->SetMax( MAX_SW - nrVal, FUNIT_100TH_MM ); + maRightIndent->SetMax( MAX_SW - nVal, FUNIT_100TH_MM ); + maFLineIndent->SetMax( MAX_SW - nVal - nrVal, FUNIT_100TH_MM ); + } + break; + case CombinedEnumContext(Application_Draw, Context_DrawText): + case CombinedEnumContext(Application_Draw, Context_Draw): + case CombinedEnumContext(Application_Draw, Context_Table): + case CombinedEnumContext(Application_Draw, Context_TextObject): + case CombinedEnumContext(Application_Draw, Context_Graphic): + case CombinedEnumContext(Application_Impress, Context_TextObject): + case CombinedEnumContext(Application_Impress, Context_DrawText): + case CombinedEnumContext(Application_Impress, Context_Table): + case CombinedEnumContext(Application_Impress, Context_Draw): + case CombinedEnumContext(Application_Impress, Context_Graphic): + { + maLeftIndent->SetMax( MAX_SC_SD - nrVal, FUNIT_100TH_MM ); + maRightIndent->SetMax( MAX_SC_SD - nVal, FUNIT_100TH_MM ); + maFLineIndent->SetMax( MAX_SC_SD - nVal - nrVal, FUNIT_100TH_MM ); + } + } + + maTbxIndent_IncDec->Enable(); + maTbxIndent_IncDec->EnableItem(ID_HANGING_INDENT, sal_True); + if(maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text) + && maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) + && maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Table)) + { + maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_INC, sal_True); + maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_DEC, sal_True); + } + +// maTbxProDemote->Enable(); +// if( !mbOutLineRight && !mbOutLineLeft ) +// maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_True); + maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_True); + } + else if( eState == SFX_ITEM_DISABLED ) + { + maLeftIndent-> Disable(); + maRightIndent->Disable(); + maFLineIndent->Disable(); + maTbxIndent_IncDec->Disable(); + if( maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text) && + maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) && + maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Table) ) + maTbxIndent_IncDec->Disable(); + else + maTbxIndent_IncDec->EnableItem(ID_HANGING_INDENT, sal_False); + +// maTbxProDemote->Disable(); + maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_False); + } + else + { + maLeftIndent->SetEmptyFieldValue(); + maRightIndent->SetEmptyFieldValue(); + maFLineIndent->SetEmptyFieldValue(); + if( maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text) && + maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) && + maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Table) ) + maTbxIndent_IncDec->Disable(); + else + maTbxIndent_IncDec->EnableItem(ID_HANGING_INDENT, sal_False); +// maTbxProDemote->Disable(); + maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_False); + } +} + +void ParaPropertyPanel::StateChangedLnSPImpl( sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* pState ) +{ + meLnSpState = eState; + + if( pState && eState >= SFX_ITEM_AVAILABLE ) + { + if(mpLnSPItem) + delete mpLnSPItem; + mpLnSPItem = ( SvxLineSpacingItem *)pState->Clone(); + } +} + +void ParaPropertyPanel::StateChangedULImpl( sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* pState ) +{ + maTopDist->SetMax( maTopDist->Normalize( MAX_DURCH ), MapToFieldUnit(m_eULSpaceUnit) ); + maBottomDist->SetMax( maBottomDist->Normalize( MAX_DURCH ), MapToFieldUnit(m_eULSpaceUnit) ); + + if( pState && eState >= SFX_ITEM_AVAILABLE ) + { + SvxULSpaceItem* pOldItem = (SvxULSpaceItem*)pState; + + maUpper = pOldItem->GetUpper(); + maUpper = OutputDevice::LogicToLogic( maUpper, (MapUnit)m_eULSpaceUnit, MAP_100TH_MM ); + maUpper = OutputDevice::LogicToLogic( maUpper, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) ); + + maLower = pOldItem->GetLower(); + maLower = OutputDevice::LogicToLogic( maLower, (MapUnit)m_eULSpaceUnit, MAP_100TH_MM ); + maLower = OutputDevice::LogicToLogic( maLower, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) ); + + sal_Int64 nVal = OutputDevice::LogicToLogic( maUpper, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); + nVal = maTopDist->Normalize( nVal ); + maTopDist->SetValue( nVal, FUNIT_100TH_MM ); + + nVal = OutputDevice::LogicToLogic( maLower, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); + nVal = maBottomDist->Normalize( nVal ); + maBottomDist->SetValue( nVal, FUNIT_100TH_MM ); + maTbxUL_IncDec->Enable(); + } + else if(eState == SFX_ITEM_DISABLED ) + { + maTopDist->Disable(); + maBottomDist->Disable(); + maTbxUL_IncDec->Disable(); + } + else + { + maTopDist->SetEmptyFieldValue(); + maBottomDist->SetEmptyFieldValue(); + maTbxUL_IncDec->Disable(); + } +} + +void ParaPropertyPanel::StateChangeOutLineImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) +{ + if (nSID==SID_OUTLINE_LEFT) + { + if( pState && eState == SFX_ITEM_UNKNOWN ) + mbOutLineLeft = 1; + else + mbOutLineLeft = 0; + } + if (nSID==SID_OUTLINE_RIGHT) + { + if( pState && eState == SFX_ITEM_UNKNOWN ) + mbOutLineRight = 1; + else + mbOutLineRight = 0; + } + if(mbOutLineLeft) + maTbxProDemote->EnableItem(BT_TBX_INDENT_DEMOTE, sal_True); + else + maTbxProDemote->EnableItem(BT_TBX_INDENT_DEMOTE, sal_False); + + if(mbOutLineRight) + maTbxProDemote->EnableItem(BT_TBX_INDENT_PROMOTE, sal_True); + else + maTbxProDemote->EnableItem(BT_TBX_INDENT_PROMOTE, sal_False); + +// if( !mbOutLineRight && !mbOutLineLeft ) +// { +// maTbxProDemote->EnableItem(BT_TBX_INDENT_PROMOTE, sal_True); +// maTbxProDemote->EnableItem(BT_TBX_INDENT_DEMOTE, sal_True); +// maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_True); +// } +// else +// maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_False); +} + +void ParaPropertyPanel::StateChangeIncDecImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) +{ + if (nSID==SID_INC_INDENT) + { + if( pState && eState == SFX_ITEM_UNKNOWN ) + maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_INC, sal_True); + else + if( maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text) && + maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) && + maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Table) ) + maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_INC, sal_False); + } + if (nSID==SID_DEC_INDENT) + { + if( pState && eState == SFX_ITEM_UNKNOWN ) + maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_DEC, sal_True); + else + if( maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text) && + maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) && + maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Table) ) + maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_DEC, sal_False); + } +} +// Add toggle state for numbering and bullet icons +void ParaPropertyPanel::StateChangeBulletNumImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) +{ + if (nSID==FN_NUM_NUMBERING_ON) + { + if ( (eState >= SFX_ITEM_DEFAULT) && (pState->ISA(SfxBoolItem))) + { + const SfxBoolItem* pItem= (const SfxBoolItem*)pState; + sal_Bool aBool = (sal_Bool)pItem->GetValue(); + if (aBool) { + maTBxNumBullet->SetItemState(IID_NUMBER, STATE_CHECK); + } else { + maTBxNumBullet->SetItemState(IID_NUMBER, STATE_NOCHECK); + } + } + } + if (nSID==FN_NUM_BULLET_ON) + { + if ( (eState >= SFX_ITEM_DEFAULT) && (pState->ISA(SfxBoolItem))) + { + const SfxBoolItem* pItem= (const SfxBoolItem*)pState; + sal_Bool aBool = (sal_Bool)pItem->GetValue(); + if (aBool) { + maTBxNumBullet->SetItemState(IID_BULLET, STATE_CHECK); + } else { + maTBxNumBullet->SetItemState(IID_BULLET, STATE_NOCHECK); + } + } + } +} +//Modified for Numbering&Bullets Dialog UX Enh(Story 992) by chengjh,2011.7.5 +//Handing the transferred the num rule index data of the current selection +void ParaPropertyPanel::StateChangeBulletNumRuleImpl( sal_uInt16 nSID, SfxItemState /*eState*/, const SfxPoolItem* pState ) +{ + + const SfxUInt16Item* pIt = (const SfxUInt16Item*)pState; + sal_uInt16 nValue = (sal_uInt16)0xFFFF; + if ( pIt ) + nValue = pIt->GetValue(); + + if ( nSID == FN_BUL_NUM_RULE_INDEX ) + { + mnBulletTypeIndex = nValue; + }else if ( nSID == FN_NUM_NUM_RULE_INDEX ) + { + mnNumTypeIndex = nValue; + } +} +//End +FieldUnit ParaPropertyPanel::GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState ) +{ + FieldUnit eUnit = FUNIT_NONE; + + if ( pState && eState >= SFX_ITEM_DEFAULT ) + eUnit = (FieldUnit)( (const SfxUInt16Item*)pState )->GetValue(); + else + { + SfxViewFrame* pFrame = SfxViewFrame::Current(); + SfxObjectShell* pSh = NULL; + if ( pFrame ) + pSh = pFrame->GetObjectShell(); + if ( pSh ) //the object shell is not always available during reload + { + SfxModule* pModule = pSh->GetModule(); + if ( pModule ) + { + const SfxPoolItem* pItem = pModule->GetItem( SID_ATTR_METRIC ); + if ( pItem ) + eUnit = (FieldUnit)( (SfxUInt16Item*)pItem )->GetValue(); + } + else + { + DBG_ERRORFILE( "GetModuleFieldUnit(): no module found" ); + } + } + } + + return eUnit; +} +//new FixedText(this, SVX_RES(FT_COLOR)) + +PopupControl* ParaPropertyPanel::CreateLineSpacingControl (PopupContainer* pParent) +{ + return new ParaLineSpacingControl(pParent, *this); +} + +PopupControl* ParaPropertyPanel::CreateBulletsPopupControl (PopupContainer* pParent) +{ + return new ParaBulletsControl(pParent, *this); +} + +PopupControl* ParaPropertyPanel::CreateNumberingPopupControl (PopupContainer* pParent) +{ + return new ParaNumberingControl(pParent, *this); +} + +PopupControl* ParaPropertyPanel::CreateBGColorPopupControl (PopupContainer* pParent) +{ + return new ColorControl( + pParent, + mpBindings, + SVX_RES(RID_POPUPPANEL_TEXTPAGE_FONT_COLOR), + SVX_RES(VS_FONT_COLOR), + ::boost::bind(&ParaPropertyPanel::GetBGColor, this), + ::boost::bind(&ParaPropertyPanel::SetBGColor, this, _1,_2), + pParent, + 0); +} + + +ParaPropertyPanel::ParaPropertyPanel(Window* pParent, + const cssu::Reference<css::frame::XFrame>& /*rxFrame*/, + SfxBindings* pBindings, + const cssu::Reference<css::ui::XSidebar>& rxSidebar) + : Control(pParent, SVX_RES(RID_SIDEBAR_PARA_PANEL)), + maAlignToolBoxBackground(ControlFactory::CreateToolBoxBackground(this)), + maAlignToolBox (ControlFactory::CreateToolBox(maAlignToolBoxBackground.get(),SVX_RES(TBX_HORIZONTALALIGNMENT))), + maTBxVertAlignBackground(ControlFactory::CreateToolBoxBackground(this)), + maTBxVertAlign (ControlFactory::CreateToolBox(maTBxVertAlignBackground.get(),SVX_RES(TBX_VERT_ALIGN))), + maTBxNumBulletBackground(ControlFactory::CreateToolBoxBackground(this)), + maTBxNumBullet (ControlFactory::CreateToolBox(maTBxNumBulletBackground.get(),SVX_RES(TBX_NUM_BULLET))), + maTBxBackColorBackground(ControlFactory::CreateToolBoxBackground(this)), + maTBxBackColor (ControlFactory::CreateToolBox(maTBxBackColorBackground.get(),SVX_RES(TBX_BACK_COLOR))), + maFTUL (new FixedText(this, SVX_RES(FT_SPACING))), + maTbxUL_IncDecBackground(ControlFactory::CreateToolBoxBackground(this)), + maTbxUL_IncDec (ControlFactory::CreateToolBox(maTbxUL_IncDecBackground.get(),SVX_RES(TBX_UL_INC_DEC))), + maTopDist (new SvxRelativeField(this, SVX_RES(MF_ABOVE_PARASPACING))), + maBottomDist (new SvxRelativeField(this, SVX_RES(MF_BELOW_PARASPACING))), + maLineSPTbxBackground(ControlFactory::CreateToolBoxBackground(this)), + maLineSPTbx (ControlFactory::CreateToolBox(maLineSPTbxBackground.get(),SVX_RES(TBX_LINESP))), + maFTIndent (new FixedText(this, SVX_RES(FT_INDENT))), + maTbxIndent_IncDecBackground(ControlFactory::CreateToolBoxBackground(this)), + maTbxIndent_IncDec (ControlFactory::CreateToolBox(maTbxIndent_IncDecBackground.get(),SVX_RES(TBX_INDENT_INC_DEC))), + maTbxProDemoteBackground(ControlFactory::CreateToolBoxBackground(this)), + maTbxProDemote (ControlFactory::CreateToolBox(maTbxProDemoteBackground.get(),SVX_RES(TBX_INDENT_PRO_DEMOTE))), + maLeftIndent (new SvxRelativeField(this, SVX_RES(MF_BEFORE_INDENT))), + maRightIndent (new SvxRelativeField(this, SVX_RES(MF_AFTER_INDENT))), + maFLineIndent (new SvxRelativeField(this, SVX_RES(MF_FL_INDENT))), + mpColorUpdater (), + maFISpace1 ( this, SVX_RES( FI_SPACE1)), + maFISpace2 ( this, SVX_RES( FI_SPACE2)), + maFIndent1 ( this, SVX_RES( FI_INDENT1)), + maFIndent2 ( this, SVX_RES( FI_INDENT2)), + maFIndent3 ( this, SVX_RES( FI_INDENT3)), + maSpace1 (SVX_RES(IMG_SPACE1)), + maSpace2 (SVX_RES(IMG_SPACE2)), + maSpace3 (SVX_RES(IMG_SPACE3)), + maIndent1 (SVX_RES(IMG_INDENT1)), + maIndent2 (SVX_RES(IMG_INDENT2)), + maIndent3 (SVX_RES(IMG_INDENT3)), + maLeftPara (SVX_RES(IMG_LEFT_PARA)), + maCentPara (SVX_RES(IMG_CENTER_PARA)), + maRightPara (SVX_RES(IMG_RIGHT_PARA)), + maJusPara (SVX_RES(IMG_JUSTIFY_PARA)), + maIndInc (SVX_RES(IMG_INDENT_INC)), + maIndDec (SVX_RES(IMG_INDENT_DEC)), + maIndInc_BD (SVX_RES(IMG_INDENT_INC_BD)), + maIndDec_BD (SVX_RES(IMG_INDENT_DEC_BD)), + maIndHang (SVX_RES(IMG_INDENT_HANG)), + maParInc (SVX_RES(IMG_PARA_INC)), + maParDec (SVX_RES(IMG_PARA_DEC)), + maVertImageList (SVX_RES(IL_VERT_ALIGN)), + maVertImageListH (SVX_RES(IL_VERT_ALIGN)), + maNumBImageList (SVX_RES(IL_NUM_BULLET)), + maNumBImageListH (SVX_RES(ILH_NUM_BULLET)), + maNumBImageListRTL (SVX_RES(IL_NUM_BULLET_RTL)), + maImgBackColorHigh (SVX_RES(IMG_BACK_COLOR_H)), + maImgBackColor (SVX_RES(IMG_BACK_COLOR)), + maTxtLeft (0), + mpLnSPItem (NULL), + meLnSpState (SFX_ITEM_DONTCARE), + mbOutLineLeft (false), + mbOutLineRight (false), + maUpper (0), + maLower (0), + mnBulletTypeIndex ((sal_uInt16)0xFFFF), + mnNumTypeIndex ((sal_uInt16)0xFFFF), + maColor (COL_AUTO), + mbColorAvailable (true), + //, m_eMetricUnit (FUNIT_INCH) +//, m_last_eMetricUnit (FUNIT_INCH) + m_eLRSpaceUnit(), + m_eULSpaceUnit(), + maLeftAlignControl (SID_ATTR_PARA_ADJUST_LEFT, *pBindings,*this), + maCenterAlignControl (SID_ATTR_PARA_ADJUST_CENTER, *pBindings,*this), + maRightAlignControl (SID_ATTR_PARA_ADJUST_RIGHT, *pBindings,*this), + maJustifyAlignControl (SID_ATTR_PARA_ADJUST_BLOCK, *pBindings,*this), + maLRSpaceControl (SID_ATTR_PARA_LRSPACE,*pBindings,*this), + maLNSpaceControl (SID_ATTR_PARA_LINESPACE, *pBindings,*this), + maULSpaceControl (SID_ATTR_PARA_ULSPACE, *pBindings,*this), + maOutLineLeftControl (SID_OUTLINE_LEFT, *pBindings,*this), + maOutLineRightControl (SID_OUTLINE_RIGHT, *pBindings,*this), + maDecIndentControl (SID_DEC_INDENT, *pBindings,*this), + maIncIndentControl (SID_INC_INDENT, *pBindings,*this), + maVertTop (SID_TABLE_VERT_NONE, *pBindings,*this), + maVertCenter (SID_TABLE_VERT_CENTER, *pBindings,*this), + maVertBottom (SID_TABLE_VERT_BOTTOM,*pBindings,*this), + maBulletOnOff (FN_NUM_BULLET_ON, *pBindings,*this), + maNumberOnOff (FN_NUM_NUMBERING_ON, *pBindings,*this), + maBackColorControl (SID_BACKGROUND_COLOR, *pBindings,*this), + m_aMetricCtl (SID_ATTR_METRIC, *pBindings,*this), + maBulletNumRuleIndex (FN_BUL_NUM_RULE_INDEX, *pBindings,*this), + maNumNumRuleIndex (FN_NUM_NUM_RULE_INDEX, *pBindings,*this), + maContext(), + mpBindings(pBindings), + maLineSpacePopup(this, ::boost::bind(&ParaPropertyPanel::CreateLineSpacingControl, this, _1)), + maBulletsPopup(this, ::boost::bind(&ParaPropertyPanel::CreateBulletsPopupControl, this, _1)), + maNumberingPopup(this, ::boost::bind(&ParaPropertyPanel::CreateNumberingPopupControl, this, _1)), + maBGColorPopup(this, ::boost::bind(&ParaPropertyPanel::CreateBGColorPopupControl, this, _1)), + mxSidebar(rxSidebar) +{ + initial(); + FreeResource(); +} + +} } // end of namespace svx::sidebar diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.hrc b/svx/source/sidebar/paragraph/ParaPropertyPanel.hrc new file mode 100644 index 000000000000..317ce5ed4cb3 --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.hrc @@ -0,0 +1,372 @@ +/* + * 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 "svx/dialogs.hrc" + +#define BT_SUBSTLEFT 1 +#define BT_SUBSTCENTER 2 +#define BT_SUBSTRIGHT 3 +#define BT_SUBSTJUSTIFY 4 +#define BT_BTX_LINESP 1 +#define BT_TBX_INDENT_INC 1 +#define BT_TBX_INDENT_DEC 2 +#define BT_TBX_UL_INC 1 +#define BT_TBX_UL_DEC 2 +#define ID_HANGING_INDENT 3 +#define BT_TBX_INDENT_PROMOTE 1 +#define BT_TBX_INDENT_DEMOTE 2 +#define SD_HANGING_INDENT 3 +#define MF_BEFORE_INDENT 2 +#define MF_AFTER_INDENT 4 +#define MF_FL_INDENT 6 +#define TBX_HORIZONTALALIGNMENT 5 +#define IMG_LEFT_PARA 7 +#define IMG_CENTER_PARA 8 +#define IMG_RIGHT_PARA 9 +#define IMG_JUSTIFY_PARA 10 +#define IMG_INDENT_INC 11 +#define IMG_INDENT_DEC 12 +#define IMG_PARA_INC 13 +#define IMG_PARA_DEC 14 +#define IMG_INDENT_HANG 15 +#define FT_INDENT 16 +#define TBX_INDENT_INC_DEC 17 +#define FI_SPACE1 18 +#define FI_SPACE2 19 +#define FI_INDENT1 20 +#define FI_INDENT2 21 +#define FI_INDENT3 22 +#define IMG_SPACE3 23 +#define TBX_LINESP 25 +#define IMG_SPACE1 26 +#define IMG_INDENT1 27 +#define IMG_INDENT2 28 +#define IMG_SPACE2 29 +#define IMG_INDENT3 30 +#define FT_SPACING 31 +#define TBX_UL_INC_DEC 33 +#define MF_ABOVE_PARASPACING 32 +#define MF_BELOW_PARASPACING 34 +#define TBX_INDENT_PRO_DEMOTE 35 +#define TBX_VERT_ALIGN 40 +#define IL_VERT_ALIGN 41 +#define ILH_VERT_ALIGN 42 +#define TBX_NUM_BULLET 44 +#define IL_NUM_BULLET 45 +#define ILH_NUM_BULLET 46 +#define FT_BACK_COLOR 47 +#define TBX_BACK_COLOR 48 +#define TBI_BACK_COLOR 49 +#define IMG_BACK_COLOR 50 +#define IMG_BACK_COLOR_H 51 +#define IL_NUM_BULLET_RTL 52 //sym2_7380 +#define TBI_VERT_ALIGN_TOP 60 +#define TBI_VERT_ALIGN_CENTER 61 +#define TBI_VERT_ALIGN_BOT 62 +#define TBI_NUMBERING 63 +#define TBI_BULLET 64 +#define TBI_HOR_ALIGN_LEFT 65 +#define TBI_HOR_ALIGN_CENTER 66 +#define TBI_HOR_ALIGN_RIGHT 67 +#define TBI_HOR_ALIGN_JUSTIFY 68 +#define TBI_INDENT_INC 69 +#define TBI_INDENT_DEC 70 +#define TBI_UL_INC 71 +#define TBI_UL_DEC 72 +#define IMG_INDENT_INC_BD 73 +#define IMG_INDENT_DEC_BD 74 + +//for vertical alignment +#define IID_VERT_TOP 1 +#define IID_VERT_CENTER 2 +#define IID_VERT_BOTTOM 3 + +//for numbering and bullett +#define IID_BULLET 1 +#define IID_NUMBER 2 +//============================== popup bullet and numbering & back color ========================= +#define VS_VALUES 1 +#define IL_BULLET_BITMAPS 2 +#define CB_BULLET_MORE 4 +#define BMP_BULLET_MORE 5 +#define IMG_SEPERATOR_BULLET 7 + +#define VS_NUMBERING 10 +#define CB_NUMBERING_MORE 12 +#define BMP_NUMERING_MORE 13 +#define IMG_SEPERATOR_NUMBERING 15 +#define VS_FONT_COLOR 1 +#define STR_NOFILL 2 + +//============================== line space popup page ============================== + +#define LB_LINE_SPACING 1 +#define ED_SBINDE_LINEDISTPERCENT 2 +#define ED_SBINDE_LINEDISTPOINT 3 + +#define FT_CUSTOM 14 +#define FT_LINE_SPACING 15 +#define FT_OF 16 +#define IMG_SPACING1 18 +#define IMG_SPACING115 19 +#define IMG_SPACING15 20 +#define IMG_SPACING2 21 +#define IMG_SPACINGLCUSTOM 22 +#define IMG_SEL_SPACING1 23 +#define IMG_SEL_SPACING115 24 +#define IMG_SEL_SPACING15 25 +#define IMG_SEL_SPACING2 26 +#define IMG_LPCUSTOMNOBORDER 27 +#define FI_CUSTOM_NOBORDER_LSPACE 28 +#define LINE_SPACING 29 +#define STR_SPACING1 30 +#define STR_SPACING115 31 +#define STR_SPACING15 32 +#define STR_SPACING2 33 +#define IMG_CUSTOM 34 +#define IMG_CUSTOM_GRAY 35 +#define STR_LCVALUE 36 +#define STR_LS_SINGLE 37 +#define STR_LS_115 38 +#define STR_LS_15 39 +#define STR_LS_DOUBLE 40 +#define STR_LSPACING 41 +#define STR_LS_OF 42 + +//============================== Help ID ============================== +#define HID_TBX_HORIZONTALALIGNMENT "HID_TBX_HORIZONTALALIGNMENT" +#define HID_TBI_HOR_ALIGN_LEFT "HID_TBI_HOR_ALIGN_LEFT" +#define HID_TBI_HOR_ALIGN_CENTER "HID_TBI_HOR_ALIGN_CENTER" +#define HID_TBI_HOR_ALIGN_RIGHT "HID_TBI_HOR_ALIGN_RIGHT" +#define HID_TBI_HOR_ALIGN_JUSTIFY "HID_TBI_HOR_ALIGN_JUSTIFY" + +#define HID_TBX_VERT_ALIGN "HID_TBX_VERT_ALIGN" +#define HID_TBI_VERT_ALIGN_TOP "HID_TBI_VERT_ALIGN_TOP" +#define HID_TBI_VERT_ALIGN_CENTER "HID_TBI_VERT_ALIGN_CENTER" +#define HID_TBI_VERT_ALIGN_BOT "HID_TBI_VERT_ALIGN_BOT" + +#define HID_TBX_INDENT "HID_TBX_INDENT" +#define HID_TBI_INDENT "HID_TBI_INDENT" +//#define HID_TBX_LINESP 705263129 +//#define HID_TBI_LINESP 705262617 +#define HID_TBX_GRSPACE "HID_TBX_GRSPACE" +#define HID_TBI_GRSPACE "HID_TBI_GRSPACE" +#define HID_TBX_BACK_COLOR "HID_TBX_BACK_COLOR" +#define HID_TBI_BACK_COLOR "HID_TBI_BACK_COLOR" + +//#define HID_TBX_INDENT_INC_DEC 705263121 +//#define HID_TBI_INDENT_DEC 705262662 +//#define HID_TBI_INDENT_INC 705262661 +//#define HID_TBX_UL_INC_DEC 705263137 +//#define HID_TBI_UL_INC 705262663 +//#define HID_TBI_UL_DEC 705262664 + +//#define HID_TBX_NUM_BULLET 705263148 +//#define HID_TBI_NUMBERING 705262655 +//#define HID_TBI_BULLET 705262656 + +#define HID_POPUP_BULLET_CB_BULLET_MORE "HID_POPUP_BULLET_CB_BULLET_MORE" +#define HID_POPUP_BULLET_VS_VALUES "HID_POPUP_BULLET_VS_VALUES" +#define HID_POPUP_NUM_CB_NUMBERING_MORE "HID_POPUP_NUM_CB_NUMBERING_MORE" +#define HID_POPUP_NUM_VS_NUMBERING "HID_POPUP_NUM_VS_NUMBERING" + +#define HID_POPUP_INDENT_ED_INDENT_LEFTINDENT "HID_POPUP_INDENT_ED_INDENT_LEFTINDENT" +#define HID_POPUP_INDENT_ED_INDENT_RIGHTINDENT "HID_POPUP_INDENT_ED_INDENT_RIGHTINDENT" +#define HID_POPUP_INDENT_ED_INDENT_FLINDENT "HID_POPUP_INDENT_ED_INDENT_FLINDENT" +#define HID_POPUP_INDENT_TBX_INDENT_NONE "HID_POPUP_INDENT_TBX_INDENT_NONE" +#define HID_POPUP_INDENT_TBI_INDENT_NONE "HID_POPUP_INDENT_TBI_INDENT_NONE" +#define HID_POPUP_INDENT_TBX_INDENT_BEFORE1 "HID_POPUP_INDENT_TBX_INDENT_BEFORE1" +#define HID_POPUP_INDENT_TBI_INDENT_BEFORE1 "HID_POPUP_INDENT_TBI_INDENT_BEFORE1" +#define HID_POPUP_INDENT_TBX_INDENT_BEFORE2 "HID_POPUP_INDENT_TBX_INDENT_BEFORE2" +#define HID_POPUP_INDENT_TBI_INDENT_BEFORE2 "HID_POPUP_INDENT_TBI_INDENT_BEFORE2" +#define HID_POPUP_INDENT_TBX_INDENT_FLINE "HID_POPUP_INDENT_TBX_INDENT_FLINE" +#define HID_POPUP_INDENT_TBI_INDENT_FLINE "HID_POPUP_INDENT_TBI_INDENT_FLINE" +#define HID_POPUP_INDENT_TBX_INDENT_HANGING "HID_POPUP_INDENT_TBX_INDENT_HANGING" +#define HID_POPUP_INDENT_TBI_INDENT_HANGING "HID_POPUP_INDENT_TBI_INDENT_HANGING" +#define HID_POPUP_INDENT_TBX_INDENT_LCUSTOM "HID_POPUP_INDENT_TBX_INDENT_LCUSTOM" +#define HID_POPUP_INDENT_TBI_INDENT_LCUSTOM "HID_POPUP_INDENT_TBI_INDENT_LCUSTOM" + +#define HID_POPUP_LS_LB_LINE_SPACING "HID_POPUP_LS_LB_LINE_SPACING" +#define HID_POPUP_LS_ED_SBINDE_LINEDISTPERCENT "HID_POPUP_LS_ED_SBINDE_LINEDISTPERCENT" +#define HID_POPUP_LS_ED_SBINDE_LINEDISTPOINT "HID_POPUP_LS_ED_SBINDE_LINEDISTPOINT" +#define HID_POPUP_LS_TBX_LINESP_1 "HID_POPUP_LS_TBX_LINESP_1" +#define HID_POPUP_LS_TBI_LINESP_1 "HID_POPUP_LS_TBI_LINESP_1" +#define HID_POPUP_LS_TBX_LINESP_15 "HID_POPUP_LS_TBX_LINESP_15" +#define HID_POPUP_LS_TBI_LINESP_15 "HID_POPUP_LS_TBI_LINESP_15" +#define HID_POPUP_LS_TBX_LINESP_2 "HID_POPUP_LS_TBX_LINESP_2" +#define HID_POPUP_LS_TBI_LINESP_2 "HID_POPUP_LS_TBI_LINESP_2" +#define HID_POPUP_LS_TBX_LINESP_115 "HID_POPUP_LS_TBX_LINESP_115" +#define HID_POPUP_LS_TBI_LINESP_115 "HID_POPUP_LS_TBI_LINESP_115" +#define HID_POPUP_LS_TBX_LINESP_LCUSTOM "HID_POPUP_LS_TBX_LINESP_LCUSTOM" +#define HID_POPUP_LS_TBI_LINESP_LCUSTOM "HID_POPUP_LS_TBI_LINESP_LCUSTOM" + +#define HID_POPUP_PS_ED_SBINDE_TOPDIST "HID_POPUP_PS_ED_SBINDE_TOPDIST" +#define HID_POPUP_PS_ED_SBINDE_BOTTOMDIST "HID_POPUP_PS_ED_SBINDE_BOTTOMDIST" +#define HID_POPUP_PS_TBX_NORMAL "HID_POPUP_PS_TBX_NORMAL" +#define HID_POPUP_PS_TBI_NORMAL "HID_POPUP_PS_TBI_NORMAL" +#define HID_POPUP_PS_TBX_NARROW "HID_POPUP_PS_TBX_NARROW" +#define HID_POPUP_PS_TBI_NARROW "HID_POPUP_PS_TBI_NARROW" +#define HID_POPUP_PS_TBX_WIDE "HID_POPUP_PS_TBX_WIDE" +#define HID_POPUP_PS_TBI_WIDE "HID_POPUP_PS_TBI_WIDE" +#define HID_POPUP_PS_TBX_LASTCUSTOM "HID_POPUP_PS_TBX_LASTCUSTOM" +#define HID_POPUP_PS_TBI_LASTCUSTOM "HID_POPUP_PS_TBI_LASTCUSTOM" + +//============================== Property ============================== +#define _FIXED_TEXT_HEIGHT 9 +#define _FIXED_TEXT_WIDTH 40 +#define CONTROL_HEIGHT 15 +#define CONTROL_WIDTH 45 +#define ALIGNMENT_TBX_HEIGHT 17 +#define ALIGNMENT_TBX_WIDTH 13 +#define LISTBOX_HEIGHT 80 +#define IMAGE_SIZE 16 +#define POPUP_TOOLBOX_SIZE 32 +#define TOOLBOX_HEIGHT 22 +#define TOOLBOX_WIDTH 23 +#define TEXT_SPACING_VERTICAL 2 +#define BUTTON_SPACING 18 +//#define TOOLBOX_ITEM_HEIGHT 17 +#define VS_SPACING_WIDTH 78 + +//==============================Section page position============================== + +#define TBX_HORI_ALIGN_X SECTIONPAGE_MARGIN_HORIZONTAL + TBX_OUT_BORDER_OFFSET_X/2 +#define TBX_HORI_ALIGN_Y SECTIONPAGE_MARGIN_VERTICAL_TOP + +#define TBX_VERT_ALIGN_X TBX_HORI_ALIGN_X + TBX_OUT_BORDER_OFFSET_X*2 + TOOLBOX_ITEM_WIDTH * 4 + CONTROL_SPACING_HORIZONTAL +#define TBX_VERT_ALIGN_Y TBX_HORI_ALIGN_Y + +#define TBX_NUM_BULLET_X TBX_HORI_ALIGN_X +#define TBX_NUM_BULLET_Y TBX_HORI_ALIGN_Y + TOOLBOX_ITEM_HEIGHT + CONTROL_SPACING_VERTICAL - 1 + +#define TBX_BACK_COLOR_X TBX_HORI_ALIGN_X + TBX_OUT_BORDER_OFFSET_X*2 + TOOLBOX_ITEM_WIDTH * 3 + CONTROL_SPACING_HORIZONTAL +#define TBX_BACK_COLOR_Y TBX_NUM_BULLET_Y + +#define FT_PARA_SPACE_X SECTIONPAGE_MARGIN_HORIZONTAL +#define FT_PARA_SPACE_Y TBX_NUM_BULLET_Y + TOOLBOX_ITEM_HEIGHT + CONTROL_SPACING_VERTICAL - 3 +#define FT_PARA_SPACE_Y2 TBX_HORI_ALIGN_Y + TOOLBOX_ITEM_HEIGHT + CONTROL_SPACING_VERTICAL - 2 + +#define TBX_PARA_SPACE_INC_DEC_X TBX_HORI_ALIGN_X +#define TBX_PARA_SPACE_INC_DEC_Y FT_PARA_SPACE_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL +#define TBX_PARA_SPACE_INC_DEC_Y2 FT_PARA_SPACE_Y2 + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + +#define FT_PARA_INDENT_X TBX_VERT_ALIGN_X +#define FT_PARA_INDENT_Y FT_PARA_SPACE_Y +#define FT_PARA_INDENT_Y2 FT_PARA_SPACE_Y2 + +#define TBX_PARA_INDENT_INC_DEC_X TBX_VERT_ALIGN_X +#define TBX_PARA_INDENT_INC_DEC_Y TBX_PARA_SPACE_INC_DEC_Y +#define TBX_PARA_INDENT_INC_DEC_Y2 TBX_PARA_SPACE_INC_DEC_Y2 + +#define MBX_TOP_DIST_X FT_PARA_SPACE_X + TOOLBOX_ITEM_WIDTH +#define MBX_TOP_DIST_Y TBX_PARA_SPACE_INC_DEC_Y + TOOLBOX_ITEM_WIDTH + CONTROL_SPACING_VERTICAL + 4*TBX_OUT_BORDER_OFFSET_Y - 1 +#define MBX_TOP_DIST_Y2 TBX_PARA_SPACE_INC_DEC_Y2 + TOOLBOX_ITEM_WIDTH + CONTROL_SPACING_VERTICAL + 4*TBX_OUT_BORDER_OFFSET_Y - 1 +#define MBX_BOT_DIST_X MBX_TOP_DIST_X +#define MBX_BOT_DIST_Y MBX_TOP_DIST_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL +#define MBX_BOT_DIST_Y2 MBX_TOP_DIST_Y2 + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL + +#define IMG_SPACE_X FT_PARA_SPACE_X - 3 +#define IMG_SPACE1_Y MBX_TOP_DIST_Y - 1 +#define IMG_SPACE2_Y MBX_BOT_DIST_Y - 1 +#define IMG_SPACE1_Y2 MBX_TOP_DIST_Y2 - 1 +#define IMG_SPACE2_Y2 MBX_BOT_DIST_Y2 - 1 + +#define MBX_LEFT_DIST_X FT_PARA_INDENT_X + TOOLBOX_ITEM_WIDTH +#define MBX_LEFT_DIST_Y MBX_TOP_DIST_Y +#define MBX_LEFT_DIST_Y2 MBX_TOP_DIST_Y2 +#define MBX_RIGHT_DIST_X MBX_LEFT_DIST_X +#define MBX_RIGHT_DIST_Y MBX_BOT_DIST_Y +#define MBX_RIGHT_DIST_Y2 MBX_BOT_DIST_Y2 +#define MBX_FLINE_DIST_X MBX_LEFT_DIST_X +#define MBX_FLINE_DIST_Y MBX_RIGHT_DIST_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL +#define MBX_FLINE_DIST_Y2 MBX_RIGHT_DIST_Y2 + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL + +#define IMG_INDENT_X FT_PARA_INDENT_X - 4 +#define IMG_INDENT1_Y MBX_LEFT_DIST_Y - 1 +#define IMG_INDENT2_Y MBX_RIGHT_DIST_Y - 1 +#define IMG_INDENT3_Y MBX_FLINE_DIST_Y - 1 +#define IMG_INDENT1_Y2 MBX_LEFT_DIST_Y2 - 1 +#define IMG_INDENT2_Y2 MBX_RIGHT_DIST_Y2- 1 +#define IMG_INDENT3_Y2 MBX_FLINE_DIST_Y2- 1 + +#define TBX_LINE_SPACE_X TBX_HORI_ALIGN_X +#define TBX_LINE_SPACE_Y MBX_FLINE_DIST_Y +#define TBX_LINE_SPACE_Y2 MBX_FLINE_DIST_Y2 + +#define PARA_SECTIONPAGE_HEIGHT MBX_FLINE_DIST_Y + TOOLBOX_ITEM_HEIGHT + SECTIONPAGE_MARGIN_VERTICAL_BOT +#define PARA_SECTIONPAGE_HEIGHT_2 MBX_FLINE_DIST_Y2 + TOOLBOX_ITEM_HEIGHT + SECTIONPAGE_MARGIN_VERTICAL_BOT + +#define LINE_X_WHITE FT_PARA_INDENT_X - 5 +#define LINE_TOP_Y FT_PARA_INDENT_Y + 1 +#define LINE_TOP_Y2 FT_PARA_INDENT_Y2 + 1 +#define LINE_BOT_Y TBX_LINE_SPACE_Y + TOOLBOX_ITEM_HEIGHT - 1 +#define LINE_BOT_Y2 TBX_LINE_SPACE_Y2 + TOOLBOX_ITEM_HEIGHT - 1 + +//==============================numbering and bullet============================== +#define NB_MARGIN_VERTICAL POPUPPANEL_MARGIN_VERTICAL +#define NB_MARGIN_HORIZONTAL POPUPPANEL_MARGIN_HORIZONTAL +#define SPACING_VERTICAL_S3 8 +//#define SPACING_VERTICAL_S1 12 +#define POPUPPANEL_MARGIN_NB 4 + +#define NB_IMAGE_WIDTH 25 +#define NB_IMAGE_HEIGHT 25 +#define NB_IMAGE_SPACING 5 + +#define BULLET_IMAGE_WIDTH NB_IMAGE_WIDTH +#define BULLET_IMAGE_HEIGHT NB_IMAGE_HEIGHT +#define BULLET_IMAGE_SPACING NB_IMAGE_SPACING + +#define NUM_IMAGE_WIDTH 25 +#define NUM_IMAGE_HEIGHT 35 +#define NUM_IMAGE_SPACING NB_IMAGE_SPACING + +#define FIXED_TEXT_HEIGHT 13 +#define FIXED_TEXT_WIDTH 80 +#define CUST_MORE_BUTTON_HEIGHT 15 + +#define VS_WIDTH_BULLET BULLET_IMAGE_WIDTH*3+BULLET_IMAGE_SPACING*2 +#define VS_HEIGHT_BULLET BULLET_IMAGE_HEIGHT*4+BULLET_IMAGE_SPACING*3 +#define VS_WIDTH_NUM NUM_IMAGE_WIDTH*3+NB_IMAGE_SPACING*2 +#define VS_HEIGHT_NUM NUM_IMAGE_HEIGHT*3+NB_IMAGE_SPACING*2 + +#define POPUP_WIDTH_BULLET VS_WIDTH_BULLET + POPUPPANEL_MARGIN_NB * 2 +#define POPUP_HEIGHT_BULLET VS_HEIGHT_BULLET + POPUPPANEL_MARGIN_NB * 3 + CUST_MORE_BUTTON_HEIGHT +#define POPUP_WIDTH_NUM VS_WIDTH_NUM + POPUPPANEL_MARGIN_NB * 2 +#define POPUP_HEIGHT_NUM VS_HEIGHT_NUM + POPUPPANEL_MARGIN_NB * 3 + CUST_MORE_BUTTON_HEIGHT + +#define CUST_MORE_BUTTON_X 1 +#define CUST_MORE_BUTTON_IMG_OFF_X 2 //NB_MARGIN_HORIZONTAL - CUST_MORE_BUTTON_X + OFFSET_X + +//==============================Line Spacing popup page======================= + +#define POPUP_PAGE_HEIGHT POP_BORDER_Y + BD_HEIGHT + POPUPPANEL_MARGIN_NB + OFFSET_Y +#define POP_FT_CUSTOM_X POPUPPANEL_MARGIN_NB + OFFSET_X +#define POP_FT_CUSTOM_Y POPUPPANEL_MARGIN_SMALL * 2 + 17 * 5 +#define POP_BORDER_X POPUPPANEL_MARGIN_NB + OFFSET_X + 1 +#define POP_BORDER_Y POPUPPANEL_MARGIN_SMALL * 3 + 17 * 5 + TEXT_HEIGHT +#define BD_WIDTH VS_SPACING_WIDTH - 6 +#define BD_HEIGHT TEXT_HEIGHT*2 + CONTROL_HEIGHT*2 + CONTROL_SPACING_VERTICAL*3 + TEXT_CONTROL_SPACING_VERTICAL*2 - 4 + +#define FT_1_X POP_BORDER_X + POPUPPANEL_MARGIN_LARGE +#define FT_1_Y POP_BORDER_Y + CONTROL_SPACING_VERTICAL +#define EDIT_1_X FT_1_X +#define EDIT_1_Y FT_1_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL +#define FT_2_X FT_1_X +#define FT_2_Y EDIT_1_Y + CONTROL_HEIGHT + CONTROL_SPACING_VERTICAL - 3 +#define EDIT_2_X FT_1_X +#define EDIT_2_Y FT_2_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx new file mode 100644 index 000000000000..16db5dbfae00 --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx @@ -0,0 +1,286 @@ +/* + * 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 SVX_SIDEBAR_PARA_PROPERTY_PANEL_HXX +#define SVX_SIDEBAR_PARA_PROPERTY_PANEL_HXX + +#include <vcl/ctrl.hxx> +#include <sfx2/sidebar/ControllerItem.hxx> +#include <sfx2/sidebar/IContextChangeReceiver.hxx> +#include <editeng/lspcitem.hxx> +#include <svtools/ctrlbox.hxx> +#include <svx/tbxcolorupdate.hxx> +#include <svx/relfld.hxx> +#include <editeng/svxenum.hxx> +#include <editeng/fhgtitem.hxx> + +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/ui/XSidebar.hpp> + +#include <boost/scoped_ptr.hpp> + +#include <svx/sidebar/ColorPopup.hxx> +#include <vcl/vclenum.hxx> +#include <vcl/fixed.hxx> +#include <svl/poolitem.hxx> +#include <tools/fldunit.hxx> + +#include "ParaBulletsPopup.hxx" +#include "ParaNumberingPopup.hxx" +#include "ParaLineSpacingPopup.hxx" + +class FloatingWindow; +class ToolBox; + +namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; + + +namespace svx { namespace sidebar { + +class PopupControl; +class PopupContainer; + +class ParaPropertyPanel + : public Control, + public ::sfx2::sidebar::IContextChangeReceiver, + public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface +{ +public: + static ParaPropertyPanel* Create ( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings, + const cssu::Reference<css::ui::XSidebar>& rxSidebar); + + virtual void DataChanged (const DataChangedEvent& rEvent); + SfxBindings* GetBindings(); + + virtual void HandleContextChange ( + const ::sfx2::sidebar::EnumContext aContext); + + virtual void NotifyItemUpdate( + const sal_uInt16 nSId, + const SfxItemState eState, + const SfxPoolItem* pState); + + void ShowMenu (void); + sal_uInt16 GetBulletTypeIndex(){ return mnBulletTypeIndex; } + void SetBulletTypeIndex(sal_uInt16 nInd){ mnBulletTypeIndex = nInd; } + sal_uInt16 GetNumTypeIndex(){ return mnNumTypeIndex; } + void SetNumTypeIndex(sal_uInt16 nInd){ mnNumTypeIndex = nInd; } + FieldUnit GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState ); + + void EndSpacingPopupMode (void); + void EndBulletsPopupMode (void); + void EndNumberingPopupMode (void); + +private: + /********************************************************** + ** + ** UI controls + ** + ***********************************************************/ + //Alignment + ::boost::scoped_ptr<Window> maAlignToolBoxBackground; + ::boost::scoped_ptr<ToolBox> maAlignToolBox; + ::boost::scoped_ptr<Window> maTBxVertAlignBackground; + ::boost::scoped_ptr<ToolBox> maTBxVertAlign; + //NumBullet&Backcolor + ::boost::scoped_ptr<Window> maTBxNumBulletBackground; + ::boost::scoped_ptr<ToolBox> maTBxNumBullet; + ::boost::scoped_ptr<Window> maTBxBackColorBackground; + ::boost::scoped_ptr<ToolBox> maTBxBackColor; + //Paragraph spacing + ::boost::scoped_ptr<FixedText> maFTUL; + ::boost::scoped_ptr<Window> maTbxUL_IncDecBackground; + ::boost::scoped_ptr<ToolBox> maTbxUL_IncDec; + ::boost::scoped_ptr<SvxRelativeField> maTopDist; + ::boost::scoped_ptr<SvxRelativeField> maBottomDist; + //Line spacing + ::boost::scoped_ptr<Window> maLineSPTbxBackground; + ::boost::scoped_ptr<ToolBox> maLineSPTbx; + //Indent + ::boost::scoped_ptr<FixedText> maFTIndent; + ::boost::scoped_ptr<Window> maTbxIndent_IncDecBackground; + ::boost::scoped_ptr<ToolBox> maTbxIndent_IncDec; + ::boost::scoped_ptr<Window> maTbxProDemoteBackground; + ::boost::scoped_ptr<ToolBox> maTbxProDemote; + ::boost::scoped_ptr<SvxRelativeField> maLeftIndent; + ::boost::scoped_ptr<SvxRelativeField> maRightIndent; + ::boost::scoped_ptr<SvxRelativeField> maFLineIndent; + ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpColorUpdater; + + /********************************************************** + ** + ** Resources + ** + ***********************************************************/ + FixedImage maFISpace1; + FixedImage maFISpace2; + FixedImage maFIndent1; + FixedImage maFIndent2; + FixedImage maFIndent3; + + Image maSpace1; + Image maSpace2; + Image maSpace3; + Image maIndent1; + Image maIndent2; + Image maIndent3; + + Image maLeftPara; + Image maCentPara; + Image maRightPara; + Image maJusPara; + + Image maIndInc; + Image maIndDec; + Image maIndInc_BD; + Image maIndDec_BD; + Image maIndHang; + Image maParInc; + Image maParDec; + + ImageList maVertImageList; + ImageList maVertImageListH; + ImageList maNumBImageList; + ImageList maNumBImageListH; + ImageList maNumBImageListRTL; + Image maImgBackColorHigh; + Image maImgBackColor; + + /**************************************************************** + ** + ** Data Member + ** + *****************************************************************/ + long maTxtLeft; + //Line spacing + SvxLineSpacingItem *mpLnSPItem; + SfxItemState meLnSpState; + bool mbOutLineLeft; + bool mbOutLineRight; + long maUpper; + long maLower; + + sal_uInt16 mnBulletTypeIndex; + sal_uInt16 mnNumTypeIndex; + Color maColor; + bool mbColorAvailable; + FieldUnit m_eMetricUnit; + FieldUnit m_last_eMetricUnit; + SfxMapUnit m_eLRSpaceUnit; + SfxMapUnit m_eULSpaceUnit; + /**************************************************************** + ** + ** Controll Items + ** + *****************************************************************/ + + ::sfx2::sidebar::ControllerItem maLeftAlignControl; + ::sfx2::sidebar::ControllerItem maCenterAlignControl; + ::sfx2::sidebar::ControllerItem maRightAlignControl; + ::sfx2::sidebar::ControllerItem maJustifyAlignControl; + ::sfx2::sidebar::ControllerItem maLRSpaceControl; + ::sfx2::sidebar::ControllerItem maLNSpaceControl; + ::sfx2::sidebar::ControllerItem maULSpaceControl; + ::sfx2::sidebar::ControllerItem maOutLineLeftControl; + ::sfx2::sidebar::ControllerItem maOutLineRightControl; + ::sfx2::sidebar::ControllerItem maDecIndentControl; + ::sfx2::sidebar::ControllerItem maIncIndentControl; + ::sfx2::sidebar::ControllerItem maVertTop; + ::sfx2::sidebar::ControllerItem maVertCenter; + ::sfx2::sidebar::ControllerItem maVertBottom; + ::sfx2::sidebar::ControllerItem maBulletOnOff; + ::sfx2::sidebar::ControllerItem maNumberOnOff; + ::sfx2::sidebar::ControllerItem maBackColorControl; + ::sfx2::sidebar::ControllerItem m_aMetricCtl; + ::sfx2::sidebar::ControllerItem maBulletNumRuleIndex; + ::sfx2::sidebar::ControllerItem maNumNumRuleIndex; + + ::sfx2::sidebar::EnumContext maContext; + SfxBindings* mpBindings; + ParaLineSpacingPopup maLineSpacePopup; + ParaBulletsPopup maBulletsPopup; + ParaNumberingPopup maNumberingPopup; + ColorPopup maBGColorPopup; + cssu::Reference<css::ui::XSidebar> mxSidebar; + + + ParaPropertyPanel ( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings, + const cssu::Reference<css::ui::XSidebar>& rxSidebar); + virtual ~ParaPropertyPanel (void); + + void InitImageList(::boost::scoped_ptr<ToolBox>& rTbx, ImageList& rImglst, ImageList& rImgHlst); + + DECL_LINK(AlignStyleModifyHdl_Impl, ToolBox*); + DECL_LINK(VertTbxSelectHandler, ToolBox*); + DECL_LINK(NumBTbxSelectHandler, ToolBox*); + DECL_LINK(ModifyIndentHdl_Impl, void*); + DECL_LINK(ClickIndent_IncDec_Hdl_Impl, ToolBox*); + DECL_LINK(ClickProDemote_Hdl_Impl, ToolBox*); + DECL_LINK(ULSpaceHdl_Impl, void*); + DECL_LINK(ClickUL_IncDec_Hdl_Impl, ToolBox*); + DECL_LINK(ImplPopupModeEndHdl, FloatingWindow* ); + + void VertStateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState); + void ParaBKGStateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState); + void StateChangedAlignmentImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ); + void StateChangedIndentImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ); + void StateChangedLnSPImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ); + void StateChangedULImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ); + void StateChangeOutLineImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ); + void StateChangeIncDecImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ); + // Add toggle state for numbering and bullet icons + void StateChangeBulletNumImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ); + //Modified for Numbering&Bullets Dialog UX Enh + //Handing the transferred the num rule index data of the current selection + void StateChangeBulletNumRuleImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ); + + void initial(); + void ReSize(bool bSize); + + + PopupControl* CreateLineSpacingControl (PopupContainer* pParent); + PopupControl* CreateBulletsPopupControl (PopupContainer* pParent); + PopupControl* CreateNumberingPopupControl (PopupContainer* pParent); + PopupControl* CreateBGColorPopupControl (PopupContainer* pParent); + DECL_LINK(ClickLineSPDropDownHdl_Impl, ToolBox*); + DECL_LINK(NumBTbxDDHandler, ToolBox*); + DECL_LINK(ToolBoxBackColorDDHandler, ToolBox *); + + void SetupIcons (void); + void InitToolBoxAlign(); + void InitToolBoxVertAlign(); + void InitToolBoxIndent(); + void InitToolBoxBGColor(); + void InitToolBoxBulletsNumbering(); + void InitToolBoxSpacing(); + void InitToolBoxLineSpacing(); + + Color GetBGColor (void) const; + void SetBGColor (const String& rsColorName, const Color aColor); +}; + +} } // end of namespace ::svx::sidebar + +#endif + diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.src b/svx/source/sidebar/paragraph/ParaPropertyPanel.src new file mode 100644 index 000000000000..cd82977ee9c6 --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.src @@ -0,0 +1,970 @@ +/* + * 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 "ParaPropertyPanel.hrc" +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include "helpid.hrc" + +#define MASKCOLOR MaskColor = Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; }; + +#define SVX_PROPERTYPANEL_PARA_VERT_IDLIST \ + IdList = \ + { \ + IID_VERT_TOP ; \ + IID_VERT_CENTER ; \ + IID_VERT_BOTTOM ; \ + }; \ + IdCount = { 3 ; }; + +#define SVX_PROPERTYPANEL_PARA_NUMBULLET_IDLIST \ + IdList = \ + { \ + IID_BULLET ; \ + IID_NUMBER ; \ + }; \ + IdCount = { 2 ; }; + +//add by wj for sym2_7380 +#define SVX_PROPERTYPANEL_PARA_NUMBULLET_IDLIST_RTL \ + IdList = \ + { \ + IID_BULLET ; \ + IID_NUMBER ; \ + }; \ + IdCount = { 2 ; }; + +Control RID_SIDEBAR_PARA_PANEL +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + Size = MAP_APPFONT( PROPERTYPAGE_WIDTH, PARA_SECTIONPAGE_HEIGHT ); + HelpID = HID_PROPERTYPANEL_PARA_SECTION ; + Text = "Paragraph"; + + ToolBox TBX_HORIZONTALALIGNMENT + { + Pos = MAP_APPFONT ( TBX_HORI_ALIGN_X , TBX_HORI_ALIGN_Y ); + Size = MAP_APPFONT ( ALIGNMENT_TBX_WIDTH*4 ,ALIGNMENT_TBX_HEIGHT); + SVLook = TRUE ; + Border = FALSE ; + HelpID = HID_PPROPERTYPANEL_PARA_TBX_HALIGN; + Text = "Horizontal Alignment"; + ItemList = + { + ToolBoxItem + { + Identifier = BT_SUBSTLEFT ; + HelpID = HID_PPROPERTYPANEL_PARA_TBI_HALIGN_LEFT; + Text [ en-US ] = "Align Left" ; + ItemBitmap = Bitmap + { + File = "symphony/AlignTextLeft_16x16.png"; + }; + }; + ToolBoxItem + { + Identifier = BT_SUBSTCENTER ; + HelpID = HID_PPROPERTYPANEL_PARA_TBI_HALIGN_CENTER; + Text [ en-US ] = "Align Center" ; + ItemBitmap = Bitmap + { + File = "symphony/AlignTextCenter_16x16.png"; + }; + }; + ToolBoxItem + { + Identifier = BT_SUBSTRIGHT ; + HelpID = HID_PPROPERTYPANEL_PARA_TBI_HALIGN_RIGHT; + Text [ en-US ] = "Align Right" ; + ItemBitmap = Bitmap + { + File = "symphony/AlignTextRight_16x16.png"; + }; + }; + ToolBoxItem + { + Identifier = BT_SUBSTJUSTIFY ; + HelpID = HID_PPROPERTYPANEL_PARA_TBI_HALIGN_JUSTIFY; + Text [ en-US ] = "Align Justified" ; + ItemBitmap = Bitmap + { + File = "symphony/AlignTextJustified_16x16.png"; + }; + }; + }; + }; + ToolBox TBX_VERT_ALIGN + { + HelpID = HID_PPROPERTYPANEL_PARA_TBX_VALIGN; + SVLook = TRUE ; + Border = FALSE ; + Pos = MAP_APPFONT ( TBX_VERT_ALIGN_X, TBX_VERT_ALIGN_Y ) ; + Size = MAP_APPFONT ( TOOLBOX_ITEM_WIDTH * 3 , TOOLBOX_ITEM_HEIGHT) ; + TabStop = TRUE ; + Text = "Vertical Alignment"; + ItemList = + { + ToolBoxItem + { + Identifier = IID_VERT_TOP ; + HelpID = HID_PPROPERTYPANEL_PARA_TBI_VALIGN_TOP; + Text [ en-US ] = "Align Top" ; + }; + + ToolBoxItem + { + Identifier = IID_VERT_CENTER ; + HelpID = HID_PPROPERTYPANEL_PARA_TBI_VALIGN_CENTER; + Text [ en-US ] = "Align Center Vertically" ; + }; + + ToolBoxItem + { + Identifier = IID_VERT_BOTTOM ; + HelpID = HID_PPROPERTYPANEL_PARA_TBI_VALIGN_BOT; + Text [ en-US ] = "Align Bottom" ; + }; + }; + }; + + ToolBox TBX_NUM_BULLET + { + HelpID = HID_PPROPERTYPANEL_PARA_TBX_NUM_BULLET; + Border = FALSE ; + Pos = MAP_APPFONT ( TBX_NUM_BULLET_X , TBX_NUM_BULLET_Y ) ; + Size = MAP_APPFONT ( TOOLBOX_ITEM_DD_WIDTH * 2 , TOOLBOX_ITEM_HEIGHT) ; + TabStop = TRUE ; + Text = "Bullets and Numbering"; + ItemList = + { + ToolBoxItem + { + Identifier = IID_BULLET ; + HelpID = HID_PPROPERTYPANEL_PARA_TBI_BULLET ; + Text [ en-US ] = "Bullets" ; + DropDown = TRUE ; + }; + ToolBoxItem + { + Identifier = IID_NUMBER ; + HelpID = HID_PPROPERTYPANEL_PARA_TBI_NUM ; + Text [ en-US ] = "Numbering" ; + DropDown = TRUE ; + }; + }; + }; + ToolBox TBX_BACK_COLOR + { + SVLook = TRUE ; + Pos = MAP_APPFONT (TBX_BACK_COLOR_X, TBX_BACK_COLOR_Y) ; + Size = MAP_APPFONT (TOOLBOX_WIDTH,TOOLBOX_HEIGHT ) ; + TabStop = TRUE ; + HelpID = HID_PPROPERTYPANEL_PARA_TBX_BACK_COLOR; + Text = "Paragraph Background Color" ; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_BACK_COLOR ; + HelpID = HID_PPROPERTYPANEL_PARA_TBI_BACK_COLOR; + DropDown = TRUE ; + Text [ en-US ] = "Paragraph Background Color" ; + }; + }; + }; + FixedText FT_SPACING + { + Pos = MAP_APPFONT ( FT_PARA_SPACE_X, FT_PARA_SPACE_Y ); + Size = MAP_APPFONT ( FT_PARA_INDENT_X - 7 - FT_PARA_SPACE_X, _FIXED_TEXT_HEIGHT) ; + Text [ en-US ] = "~Spacing:"; + }; + ToolBox TBX_UL_INC_DEC + { + Pos = MAP_APPFONT ( TBX_PARA_SPACE_INC_DEC_X,TBX_PARA_SPACE_INC_DEC_Y ); + Size = MAP_APPFONT (ALIGNMENT_TBX_WIDTH*2,ALIGNMENT_TBX_HEIGHT); + SVLook = TRUE ; + Border = FALSE ; + HelpID = HID_PPROPERTYPANEL_PARA_TBX_INC_DEC ; + Text = "Spacing"; + ItemList = + { + ToolBoxItem + { + Identifier = BT_TBX_UL_INC ; + HelpID = HID_PPROPERTYPANEL_PARA_TBI_INC ; + Text [ en-US ] = "Increase Spacing" ; + ItemBitmap = Bitmap + { + File = "symphony/IncreaseSpace_16x16.png"; + }; + }; + ToolBoxItem + { + Identifier = BT_TBX_UL_DEC ; + HelpID = HID_PPROPERTYPANEL_PARA_TBI_DEC ; + Text [ en-US ] = "Decrease Spacing" ; + ItemBitmap = Bitmap + { + File = "symphony/DecreaseSpace_16x16.png"; + }; + }; + }; + }; + MetricField MF_ABOVE_PARASPACING + { + HelpID = HID_POPUP_PS_ED_SBINDE_TOPDIST ; + Border = TRUE; + Pos = MAP_APPFONT ( MBX_TOP_DIST_X, MBX_TOP_DIST_Y ); + Size = MAP_APPFONT ( CONTROL_WIDTH -10 ,MBOX_HEIGHT ) ; + QuickHelpText [ en-US ] = "Above Paragraph Spacing"; + TabStop = TRUE; + Repeat = TRUE; + Spin = TRUE; + Maximum = 999; + Unit = FUNIT_INCH; + Last = 999; + SpinSize = 1; + + }; + MetricField MF_BELOW_PARASPACING + { + Border = TRUE; + Pos = MAP_APPFONT ( MBX_BOT_DIST_X, MBX_BOT_DIST_Y ); + Size = MAP_APPFONT ( CONTROL_WIDTH -10,MBOX_HEIGHT ) ; + QuickHelpText [ en-US ] = "Below Paragraph Spacing"; + HelpID = HID_POPUP_PS_ED_SBINDE_BOTTOMDIST ; + Repeat = TRUE; + Spin = TRUE; + Maximum = 999; + Unit = FUNIT_INCH; + Last = 999; + SpinSize = 1; + }; + FixedText FT_INDENT + { + Pos = MAP_APPFONT ( FT_PARA_INDENT_X, FT_PARA_INDENT_Y ); + Size = MAP_APPFONT ( _FIXED_TEXT_WIDTH + 50, _FIXED_TEXT_HEIGHT) ; + Text [ en-US ] = "~Indent:"; + }; + ToolBox TBX_INDENT_INC_DEC + { + Pos = MAP_APPFONT ( TBX_PARA_INDENT_INC_DEC_X, TBX_PARA_INDENT_INC_DEC_Y ); + Size = MAP_APPFONT (ALIGNMENT_TBX_WIDTH*2,ALIGNMENT_TBX_HEIGHT); + SVLook = TRUE ; + Border = FALSE ; + HelpID = HID_PPROPERTYPANEL_PARA_TBX_INDENT_INC_DEC ; + Text = "Indent"; + ItemList = + { + ToolBoxItem + { + Identifier = BT_TBX_INDENT_INC ; + HelpID = HID_PPROPERTYPANEL_PARA_TBI_INDENT_INC ; + Text [ en-US ] = "Increase Indent" ; + ItemBitmap = Bitmap + { + File = "symphony/Indent_16x16.png"; + }; + }; + ToolBoxItem + { + Identifier = BT_TBX_INDENT_DEC ; + HelpID = HID_PPROPERTYPANEL_PARA_TBI_INDENT_DEC ; + Text [ en-US ] = "Decrease Indent" ; + ItemBitmap = Bitmap + { + File = "symphony/Outdent_16x16.png"; + }; + }; + ToolBoxItem + { + Identifier = ID_HANGING_INDENT ; + Text [ en-US ] = "Switch to Hanging Indent" ; + HelpID = HID_PPROPERTYPANEL_PARA_TBI_INDENT_HANG ; + ItemBitmap = Bitmap + { + File = "symphony/Indent_Hanging.png"; + }; + }; + }; + }; + ToolBox TBX_INDENT_PRO_DEMOTE + { + Pos = MAP_APPFONT ( TBX_PARA_INDENT_INC_DEC_X, TBX_PARA_INDENT_INC_DEC_Y ); + Size = MAP_APPFONT (ALIGNMENT_TBX_WIDTH*2,ALIGNMENT_TBX_HEIGHT); + SVLook = TRUE ; + Border = FALSE ; + HelpID = HID_PPROPERTYPANEL_PARA_TBX_INDENTP_INC_DEC ; + Text = "Indent"; + ItemList = + { + ToolBoxItem + { + Identifier = BT_TBX_INDENT_PROMOTE ; + HelpID = HID_PPROPERTYPANEL_PARA_TBI_INDENTP_INC ; + Text [ en-US ] = "Increase Indent" ; + ItemBitmap = Bitmap + { + File = "symphony/Indent_16x16.png"; + }; + }; + ToolBoxItem + { + Identifier = BT_TBX_INDENT_DEMOTE ; + HelpID = HID_PPROPERTYPANEL_PARA_TBI_INDENTP_DEC ; + Text [ en-US ] = "Decrease Indent" ; + ItemBitmap = Bitmap + { + File = "symphony/Outdent_16x16.png"; + }; + }; + ToolBoxItem + { + Identifier = SD_HANGING_INDENT ; + Text [ en-US ] = "Switch to Hanging Indent" ; + HelpID = HID_PPROPERTYPANEL_PARA_TBI_INDENTP_HANG ; + ItemBitmap = Bitmap + { + File = "symphony/Indent_Hanging.png"; + }; + }; + }; + }; + MetricField MF_BEFORE_INDENT + { + Border = TRUE ; + Pos = MAP_APPFONT ( MBX_LEFT_DIST_X, MBX_LEFT_DIST_Y ); + Size = MAP_APPFONT ( CONTROL_WIDTH - 10,MBOX_HEIGHT ) ; + QuickHelpText [ en-US ] = "Before Text Indent"; + HelpID = HID_POPUP_INDENT_ED_INDENT_LEFTINDENT ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 9999 ; + StrictFormat = TRUE ; + Unit = FUNIT_INCH; + Last = 9999 ; + SpinSize = 2 ; + }; + MetricField MF_AFTER_INDENT + { + Border = TRUE ; + Pos = MAP_APPFONT ( MBX_RIGHT_DIST_X, MBX_RIGHT_DIST_Y ); + Size = MAP_APPFONT ( CONTROL_WIDTH -10 ,MBOX_HEIGHT ) ; + QuickHelpText [ en-US ] = "After Text Indent"; + HelpID = HID_POPUP_INDENT_ED_INDENT_RIGHTINDENT ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 9999 ; + StrictFormat = TRUE ; + Unit = FUNIT_INCH; + Last = 9999 ; + SpinSize = 2 ; + }; + MetricField MF_FL_INDENT + { + Border = TRUE ; + Pos = MAP_APPFONT ( MBX_FLINE_DIST_X, MBX_FLINE_DIST_Y ); + Size = MAP_APPFONT ( CONTROL_WIDTH -10 ,MBOX_HEIGHT ) ; + QuickHelpText [ en-US ] = "First Line Indent"; + HelpID = HID_POPUP_INDENT_ED_INDENT_FLINDENT ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = -9999; + Maximum = 9999 ; + DecimalDigits = 2; + Unit = FUNIT_INCH; + First = -9999; + Last = 9999 ; + SpinSize = 2 ; + }; + ToolBox TBX_LINESP + { + Pos = MAP_APPFONT ( TBX_LINE_SPACE_X, TBX_LINE_SPACE_Y); + SVLook = TRUE ; + Border = FALSE ; + Size = MAP_APPFONT (TOOLBOX_WIDTH, TOOLBOX_HEIGHT); + HelpID = HID_PPROPERTYPANEL_PARA_TBX_LINESP ; + Text = "Line Spacing" ; + ItemList = + { + ToolBoxItem + { + Identifier = BT_BTX_LINESP ; + HelpID = HID_PPROPERTYPANEL_PARA_TBI_LINESP ; + Text [ en-US ] = "Line Spacing" ; + ItemBitmap = Bitmap + { + File = "symphony/lpsmall-spacing-1.png" ; + }; + DropDown = TRUE; + }; + }; + }; + FixedImage FI_INDENT1 + { + Pos = MAP_APPFONT( IMG_SPACE_X, IMG_SPACE1_Y ); + Size = MAP_APPFONT( IMAGE_SIZE, IMAGE_SIZE ); + }; + FixedImage FI_INDENT2 + { + Pos = MAP_APPFONT( IMG_SPACE_X, IMG_SPACE2_Y ); + Size = MAP_APPFONT( IMAGE_SIZE, IMAGE_SIZE ); + }; + FixedImage FI_INDENT3 + { + Pos = MAP_APPFONT( IMG_INDENT_X, IMG_INDENT1_Y ); + Size = MAP_APPFONT( IMAGE_SIZE, IMAGE_SIZE ); + }; + FixedImage FI_SPACE1 + { + Pos = MAP_APPFONT( IMG_INDENT_X, IMG_INDENT2_Y ); + Size = MAP_APPFONT( IMAGE_SIZE, IMAGE_SIZE ); + }; + FixedImage FI_SPACE2 + { + Pos = MAP_APPFONT( IMG_INDENT_X, IMG_INDENT3_Y ); + Size = MAP_APPFONT( IMAGE_SIZE, IMAGE_SIZE ); + }; + + ImageList IL_VERT_ALIGN + { + Prefix = "symphony/para_vert"; + MaskColor = STD_MASKCOLOR ; + SVX_PROPERTYPANEL_PARA_VERT_IDLIST + }; + ImageList ILH_VERT_ALIGN + { + Prefix = "symphony/para_verth"; + MaskColor = STD_MASKCOLOR ; + SVX_PROPERTYPANEL_PARA_VERT_IDLIST + }; + + ImageList IL_NUM_BULLET + { + Prefix = "symphony/para_numbullet"; + MaskColor = STD_MASKCOLOR ; + SVX_PROPERTYPANEL_PARA_NUMBULLET_IDLIST + }; + ImageList ILH_NUM_BULLET + { + Prefix = "symphony/para_numbulleth"; + MaskColor = STD_MASKCOLOR ; + SVX_PROPERTYPANEL_PARA_NUMBULLET_IDLIST + }; + //for sym2_7380 + ImageList IL_NUM_BULLET_RTL + { + Prefix = "symphony/para_numbullet_rtl"; + MaskColor = STD_MASKCOLOR ; + SVX_PROPERTYPANEL_PARA_NUMBULLET_IDLIST_RTL + }; + //end + Image IMG_BACK_COLOR + { + ImageBitmap = Bitmap{File = "symphony/sc_backgroundcolor.bmp";}; + }; + Image IMG_BACK_COLOR_H + { + ImageBitmap = Bitmap{File = "symphony/sch_backgroundcolor.bmp";}; + }; + Image IMG_SPACE1 + { + ImageBitmap = Bitmap{File = "symphony/spacing1.png";}; + }; + Image IMG_SPACE2 + { + ImageBitmap = Bitmap{File = "symphony/spacing2.png";}; + }; + Image IMG_SPACE3 + { + ImageBitmap = Bitmap{File = "symphony/spacing3.png";}; + }; + Image IMG_INDENT1 + { + ImageBitmap = Bitmap{File = "symphony/Indent2.png";}; + }; + Image IMG_INDENT2 + { + ImageBitmap = Bitmap{File = "symphony/Indent3.png";}; + }; + Image IMG_INDENT3 + { + ImageBitmap = Bitmap{File = "symphony/Indent4.png";}; + }; + Image IMG_LEFT_PARA + { + ImageBitmap = Bitmap{File = "symphony/AlignTextLeft_16x16.png";}; + }; + Image IMG_CENTER_PARA + { + ImageBitmap = Bitmap{File = "symphony/AlignTextCenter_16x16.png";}; + }; + Image IMG_RIGHT_PARA + { + ImageBitmap = Bitmap{File = "symphony/AlignTextRight_16x16.png";}; + }; + Image IMG_JUSTIFY_PARA + { + ImageBitmap = Bitmap{File = "symphony/AlignTextJustified_16x16.png";}; + }; + Image IMG_INDENT_INC + { + ImageBitmap = Bitmap{File = "symphony/Indent_16x16.png";}; + }; + Image IMG_INDENT_DEC + { + ImageBitmap = Bitmap{File = "symphony/Outdent_16x16.png";}; + }; + Image IMG_INDENT_INC_BD + { + ImageBitmap = Bitmap{File = "symphony/rte_Indent_16x16.png";}; + }; + Image IMG_INDENT_DEC_BD + { + ImageBitmap = Bitmap{File = "symphony/rte_Outdent_16x16.png";}; + }; + Image IMG_INDENT_HANG + { + ImageBitmap = Bitmap{File = "symphony/Indent_Hanging.png";}; + }; + Image IMG_PARA_INC + { + ImageBitmap = Bitmap{File = "symphony/IncreaseSpace_16x16.png";}; + }; + Image IMG_PARA_DEC + { + ImageBitmap = Bitmap{File = "symphony/DecreaseSpace_16x16.png";}; + }; +}; + +//===========================================Back color page============================== +/* +Control RID_POPUPPANEL_PARAPAGE_BACK_COLOR +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + + Size = MAP_APPFONT( POPUP_COLOR_PICKER_WIDTH + POPUP_BORDER_WIDTH , POPUP_COLOR_PICKER_HEIGHT +POPUP_BORDER_HEIGHT ); + + Control VS_FONT_COLOR + { + HelpID = HID_PPROPERTYPANEL_PARA_BACK_COLOR_VS ; + Hide = TRUE ; + Pos = MAP_APPFONT ( OFFSET_X , OFFSET_Y ); + Size = MAP_APPFONT ( POPUP_COLOR_PICKER_WIDTH , POPUP_COLOR_PICKER_HEIGHT ); + TabStop = TRUE ; + Text = "Color Picker"; + }; + + String STR_NOFILL + { + Text [ en-US ] = "No Color"; + }; + +};*/ + +//===========================================Bullet popup page============================== +Control RID_POPUPPANEL_PARAPAGE_BULLETS +{ + DialogControl = TRUE; + OutputSize = TRUE; + Border = FALSE; + + Size = MAP_APPFONT ( POPUP_WIDTH_BULLET , POPUP_HEIGHT_BULLET) ; + Control VS_VALUES + { + Pos = MAP_APPFONT ( POPUPPANEL_MARGIN_NB , POPUPPANEL_MARGIN_NB ) ; + Size = MAP_APPFONT ( VS_WIDTH_BULLET , VS_HEIGHT_BULLET) ; + HelpID = HID_POPUP_BULLET_VS_VALUES ; + TabStop = TRUE ; + Text = "Bullet"; + }; + PushButton CB_BULLET_MORE + { + Pos = MAP_APPFONT (CUST_MORE_BUTTON_X + POPUPPANEL_MARGIN_NB, VS_HEIGHT_BULLET + POPUPPANEL_MARGIN_NB * 2 ) ; + Size = MAP_APPFONT (POPUP_WIDTH_BULLET - 2*CUST_MORE_BUTTON_X - POPUPPANEL_MARGIN_NB*2, CUST_MORE_BUTTON_HEIGHT ) ; + HelpID = HID_POPUP_BULLET_CB_BULLET_MORE ; + TabStop = TRUE ; + Text [ en-US ] = "~More Options"; + }; + Bitmap BMP_BULLET_MORE + { + File = "symphony/__morebutton.bmp"; + }; +}; + +String RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS_0 +{ + Text [en-US] = "large square bullets"; +}; + +String RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS_1 +{ + Text [en-US] = "graphic bullets"; +}; + +String RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS_2 +{ + Text [en-US] = "graphic bullets"; +}; + +String RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS_3 +{ + Text [en-US] = "graphic bullets"; +}; + +String RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS_4 +{ + Text [en-US] = "graphic bullets"; +}; + +//===========================================Numbering popup page============================== +Control RID_POPUPPANEL_PARAPAGE_NUMBERING +{ + SVLook = TRUE ; + DialogControl = TRUE; + OutputSize = TRUE; + Border = FALSE; + + Size = MAP_APPFONT ( POPUP_WIDTH_NUM , POPUP_HEIGHT_NUM) ; + Control VS_NUMBERING + { + Pos = MAP_APPFONT ( POPUPPANEL_MARGIN_NB, POPUPPANEL_MARGIN_NB ) ; + Size = MAP_APPFONT ( VS_WIDTH_NUM , VS_HEIGHT_NUM) ; + HelpID = HID_POPUP_NUM_VS_NUMBERING ; + TabStop = TRUE ; + Text = "Numbering"; + }; + PushButton CB_NUMBERING_MORE + { + Pos = MAP_APPFONT (CUST_MORE_BUTTON_X + POPUPPANEL_MARGIN_NB, VS_HEIGHT_NUM + POPUPPANEL_MARGIN_NB * 2 ) ; + Size = MAP_APPFONT (POPUP_WIDTH_NUM - 2*CUST_MORE_BUTTON_X - POPUPPANEL_MARGIN_NB*2, CUST_MORE_BUTTON_HEIGHT ) ; + HelpID = HID_POPUP_NUM_CB_NUMBERING_MORE ; + TabStop = TRUE ; + Text [ en-US ] = "~More Options"; + }; + Bitmap BMP_NUMERING_MORE + { + File = "symphony/__morebutton.bmp"; + }; +}; + +//===========================================Line Space popup page============================== +Control RID_POPUPPANEL_PARAPAGE_LINESPACING +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + + Size = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL * 2 + POPUP_BORDER_WIDTH + VS_SPACING_WIDTH, POPUP_PAGE_HEIGHT ); + + Control LINE_SPACING + { + Pos = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL + OFFSET_X , POPUPPANEL_MARGIN_SMALL + OFFSET_Y ); + Size = MAP_APPFONT ( VS_SPACING_WIDTH , 17 * 5); + TabStop = TRUE ; + Text = "Line Spacing"; + }; + + FixedText FT_CUSTOM + { + Pos = MAP_APPFONT ( POP_FT_CUSTOM_X, POP_FT_CUSTOM_Y ); + Size = MAP_APPFONT ( _FIXED_TEXT_WIDTH + 50 , _FIXED_TEXT_HEIGHT) ; + Text [ en-US ] = "Custom:"; + }; + FixedText FT_LINE_SPACING + { + Pos = MAP_APPFONT ( FT_1_X, FT_1_Y ); + Size = MAP_APPFONT ( _FIXED_TEXT_WIDTH + 10, _FIXED_TEXT_HEIGHT) ; + Text [ en-US ] = "~Line Spacing:"; + }; + + FixedText FT_OF + { + Pos = MAP_APPFONT ( FT_2_X, FT_2_Y ); + Size = MAP_APPFONT ( _FIXED_TEXT_WIDTH , _FIXED_TEXT_HEIGHT) ; + Text [ en-US ] = "~Of:"; + }; + + ListBox LB_LINE_SPACING + { + Border = TRUE ; + Pos = MAP_APPFONT ( EDIT_1_X, EDIT_1_Y ); + Size = MAP_APPFONT ( BD_WIDTH - POPUPPANEL_MARGIN_LARGE * 2,LISTBOX_HEIGHT ) ; + TabStop = TRUE ; + DropDown = TRUE ; + HelpID = HID_POPUP_LS_LB_LINE_SPACING ; + StringList [ en-US ] = + { + < "Single" ; Default ; > ; + < "1.5 Lines" ; Default ; > ; + < "Double" ; Default ; > ; + < "Proportional" ; Default ; > ; + < "At least" ; Default ; > ; + < "Leading" ; Default ; > ; + < "Fixed" ; Default ; > ; + }; + }; + MetricField ED_SBINDE_LINEDISTPERCENT + { + Disable = TRUE; + Border = TRUE; + Pos = MAP_APPFONT ( EDIT_2_X, EDIT_2_Y ); + Size = MAP_APPFONT ( BD_WIDTH - POPUPPANEL_MARGIN_LARGE * 2,MBOX_HEIGHT ) ; + HelpID = HID_POPUP_LS_ED_SBINDE_LINEDISTPERCENT ; + Repeat = TRUE; + Spin = TRUE; + Minimum = 50; + Maximum = 200; + Value = 100; + StrictFormat = TRUE; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%"; + First = 50; + Last = 200; + SpinSize = 1; + }; + MetricField ED_SBINDE_LINEDISTPOINT + { + Disable = TRUE; + Border = TRUE; + Pos = MAP_APPFONT ( EDIT_2_X, EDIT_2_Y ); + Size = MAP_APPFONT ( BD_WIDTH - POPUPPANEL_MARGIN_LARGE * 2, MBOX_HEIGHT ) ; + HelpID = HID_POPUP_LS_ED_SBINDE_LINEDISTPOINT ; + Repeat = TRUE; + Spin = TRUE; + Maximum = 9999; + DecimalDigits = 2; + StrictFormat = TRUE ; + Unit = FUNIT_INCH; + Last = 9999; + SpinSize = 2; + }; + Image IMG_SPACING1 + { + ImageBitmap = Bitmap{File = "symphony/lpspacing-1.png";}; + }; + Image IMG_SPACING115 + { + ImageBitmap = Bitmap{File = "symphony/lpspacing-1_15.png";}; + }; + Image IMG_SPACING15 + { + ImageBitmap = Bitmap{File = "symphony/lpspacing-1_5.png";}; + }; + Image IMG_SPACING2 + { + ImageBitmap = Bitmap{File = "symphony/lpspacing-2.png";}; + }; + Image IMG_SEL_SPACING1 + { + ImageBitmap = Bitmap{File = "symphony/lpselected-spacing-1.png";}; + }; + Image IMG_SEL_SPACING115 + { + ImageBitmap = Bitmap{File = "symphony/lpselected-spacing-1_15.png";}; + }; + Image IMG_SEL_SPACING15 + { + ImageBitmap = Bitmap{File = "symphony/lpselected-spacing-1_5.png";}; + }; + Image IMG_SEL_SPACING2 + { + ImageBitmap = Bitmap{File = "symphony/lpselected-spacing-2.png";}; + }; + Image IMG_CUSTOM + { + ImageBitmap = Bitmap{File = "symphony/last_custom_common.png";}; + }; + Image IMG_CUSTOM_GRAY + { + ImageBitmap = Bitmap{File = "symphony/last_custom_common_grey.png";}; + }; + String STR_LS_SINGLE + { + Text [ en-US ] = "Line spacing: Single"; + }; + String STR_LS_115 + { + Text [ en-US ] = "Line spacing: 1.15 Lines"; + }; + String STR_LS_15 + { + Text [ en-US ] = "Line spacing: 1.5 Lines"; + }; + String STR_LS_DOUBLE + { + Text [ en-US ] = "Line spacing: Double"; + }; + String STR_LSPACING + { + Text [ en-US ] = "Line spacing:"; + }; + String STR_LS_OF + { + Text [ en-US ] = "of:"; + }; + String STR_SPACING1 + { + Text [ en-US ] = "Spacing: 1"; + }; + String STR_SPACING115 + { + Text [ en-US ] = "Spacing: 1.15"; + }; + String STR_SPACING15 + { + Text [ en-US ] = "Spacing: 1.5"; + }; + String STR_SPACING2 + { + Text [ en-US ] = "Spacing: 2"; + }; + String STR_LCVALUE + { + Text [ en-US ] = "Last Custom Value"; + }; + +}; + +String RID_SVXSTR_NUMBULLET_NONE +{ + Text [en-US] = "None"; +}; + +String RID_SVXSTR_GRAPHICS_DESCRIPTION_0 +{ + Text [en-US] = "Dark Red Circle"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_1 +{ + Text [en-US] = "Blue Ball"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_2 +{ + Text [en-US] = "Green Ball"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_3 +{ + Text [en-US] = "Black Square"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_4 +{ + Text [en-US] = "Orange"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_5 +{ + Text [en-US] = "Purple Square"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_6 +{ + Text [en-US] = "Diamond Blue"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_7 +{ + Text [en-US] = "Light Blue Diamond"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_8 +{ + Text [en-US] = "Red Diamond"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_9 +{ + Text [en-US] = "Yellow Star"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_10 +{ + Text [en-US] = "Blue Star"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_11 +{ + Text [en-US] = "Blue Triangle"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_12 +{ + Text [en-US] = "Dark Green Triangle"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_13 +{ + Text [en-US] = "Red Arrow"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_14 +{ + Text [en-US] = "Blue Arrow"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_15 +{ + Text [en-US] = "Blue Box"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_16 +{ + Text [en-US] = "Red Box"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_17 +{ + Text [en-US] = "Light Blue Asterisk"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_18 +{ + Text [en-US] = "Red Leaves"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_19 +{ + Text [en-US] = "Blue Target"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_20 +{ + Text [en-US] = "Blue Arrow"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_21 +{ + Text [en-US] = "Dark Blue Arrow"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_22 +{ + Text [en-US] = "Brown Arrow"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_23 +{ + Text [en-US] = "Red Flag"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_24 +{ + Text [en-US] = "Green Flag"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_25 +{ + Text [en-US] = "Red X"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_26 +{ + Text [en-US] = "Black X"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_27 +{ + Text [en-US] = "Green Checkmark"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_28 +{ + Text [en-US] = "Blue Checkmark"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_29 +{ + Text [en-US] = "Dark Red Square"; +}; diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx new file mode 100644 index 000000000000..032537352e67 --- /dev/null +++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx @@ -0,0 +1,1222 @@ +/* + * 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 "PosSizePropertyPanel.hxx" +#include "PosSizePropertyPanel.hrc" +#include <svx/sidebar/SidebarDialControl.hxx> +#include <svx/dialogs.hrc> +#include <svx/dialmgr.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/viewsh.hxx> +#include <sfx2/objsh.hxx> +#include <svx/dlgutil.hxx> +#include <unotools/viewoptions.hxx> +#include <vcl/virdev.hxx> +#include <vcl/svapp.hxx> +#include <vcl/field.hxx> +#include <vcl/fixed.hxx> +#include <vcl/toolbox.hxx> +#include <svx/svdview.hxx> +#include <svl/aeitem.hxx> + +using namespace css; +using namespace cssu; +using ::sfx2::sidebar::Theme; + +#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) +#define USERITEM_NAME rtl::OUString::createFromAscii("FitItem") + + +namespace svx { namespace sidebar { + + + +PosSizePropertyPanel::PosSizePropertyPanel( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings, + const cssu::Reference<css::ui::XSidebar>& rxSidebar) +: Control( + pParent, + SVX_RES(RID_SIDEBAR_POSSIZE_PANEL)), + mpFtPosX(new FixedText(this, SVX_RES(FT_SBSHAPE_HORIZONTAL))), + mpMtrPosX(new MetricField(this, SVX_RES(MF_SBSHAPE_HORIZONTAL))), + mpFtPosY(new FixedText(this, SVX_RES(FT_SBSHAPE_VERTICAL))), + mpMtrPosY(new MetricField(this, SVX_RES(MF_SBSHAPE_VERTICAL))), + mpFtWidth(new FixedText(this, SVX_RES(FT_WIDTH))), + mpMtrWidth(new MetricField(this, SVX_RES(MTR_FLD_WIDTH))), + mpFtHeight(new FixedText(this, SVX_RES(FT_HEIGHT))), + mpMtrHeight(new MetricField(this, SVX_RES(MTR_FLD_HEIGHT))), + mpCbxScale(new CheckBox(this, SVX_RES(CBX_SCALE))), + mpFtAngle(new FixedText(this, SVX_RES(FT_ANGLE))), + mpMtrAngle(new MetricBox(this, SVX_RES(MTR_FLD_ANGLE))), + mpDial(new SidebarDialControl(this, SVX_RES(DIAL_CONTROL))), + mpFtFlip(new FixedText(this, SVX_RES(FT_FLIP))), + mpFlipTbxBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), + mpFlipTbx(sfx2::sidebar::ControlFactory::CreateToolBox(mpFlipTbxBackground.get(), SVX_RES(TBX_FLIP))), + maRect(), + mpView(0), + mlOldWidth(1), + mlOldHeight(1), + meRP(RP_LT), + maAnchorPos(), + mlRotX(0), + mlRotY(0), + maUIScale(), + mePoolUnit(), + meDlgUnit(), + maTransfPosXControl(SID_ATTR_TRANSFORM_POS_X, *pBindings, *this), + maTransfPosYControl(SID_ATTR_TRANSFORM_POS_Y, *pBindings, *this), + maTransfWidthControl(SID_ATTR_TRANSFORM_WIDTH, *pBindings, *this), + maTransfHeightControl(SID_ATTR_TRANSFORM_HEIGHT, *pBindings, *this), + maSvxAngleControl( SID_ATTR_TRANSFORM_ANGLE, *pBindings, *this), + maRotXControl(SID_ATTR_TRANSFORM_ROT_X, *pBindings, *this), + maRotYControl(SID_ATTR_TRANSFORM_ROT_Y, *pBindings, *this), + maProPosControl(SID_ATTR_TRANSFORM_PROTECT_POS, *pBindings, *this), + maProSizeControl(SID_ATTR_TRANSFORM_PROTECT_SIZE, *pBindings, *this), + maAutoWidthControl(SID_ATTR_TRANSFORM_AUTOWIDTH, *pBindings, *this), + maAutoHeightControl(SID_ATTR_TRANSFORM_AUTOHEIGHT, *pBindings, *this), + m_aMetricCtl(SID_ATTR_METRIC, *pBindings, *this), + maImgFlipHori(SVX_RES(IMG_HORI_FLIP)), + maImgFlipVert(SVX_RES(IMG_VERT_FLIP)), + mxFrame(rxFrame), + maContext(), + mpBindings(pBindings), + mbMtrPosXMirror(false), + mbSizeProtected(false), + mbPositionProtected(false), + mbAutoWidth(false), + mbAutoHeight(false), + mbAdjustEnabled(false), + mbIsFlip(false), + mbInDestructor(false), + mxSidebar(rxSidebar) +{ + Initialize(); + FreeResource(); + + mpBindings->Update( SID_ATTR_TRANSFORM_WIDTH ); + mpBindings->Update( SID_ATTR_TRANSFORM_HEIGHT ); + mpBindings->Update( SID_ATTR_TRANSFORM_PROTECT_SIZE ); + mpBindings->Update( SID_ATTR_METRIC ); +} + + + +PosSizePropertyPanel::~PosSizePropertyPanel() +{ + mbInDestructor = true; + + // Destroy the background windows of the toolboxes. + mpFlipTbx.reset(); + mpFlipTbxBackground.reset(); +} + + + +void PosSizePropertyPanel::ShowMenu (void) +{ + if (mpBindings != NULL) + { + SfxDispatcher* pDispatcher = mpBindings->GetDispatcher(); + if (pDispatcher != NULL) + pDispatcher->Execute(SID_ATTR_TRANSFORM, SFX_CALLMODE_ASYNCHRON); + } +} + + + +void PosSizePropertyPanel::Initialize() +{ + mpFtPosX->SetBackground(Wallpaper()); + mpFtPosY->SetBackground(Wallpaper()); + mpFtWidth->SetBackground(Wallpaper()); + mpFtHeight->SetBackground(Wallpaper()); + mpFtAngle->SetBackground(Wallpaper()); + mpFtFlip->SetBackground(Wallpaper()); + + //Position : Horizontal / Vertical + mpMtrPosX->SetModifyHdl( LINK( this, PosSizePropertyPanel, ChangePosXHdl ) ); + mpMtrPosY->SetModifyHdl( LINK( this, PosSizePropertyPanel, ChangePosYHdl ) ); + mpMtrPosX->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Horizontal"))); //wj acc + mpMtrPosY->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Vertical"))); //wj acc + + //Size : Width / Height + mpMtrWidth->SetModifyHdl( LINK( this, PosSizePropertyPanel, ChangeWidthHdl ) ); + mpMtrHeight->SetModifyHdl( LINK( this, PosSizePropertyPanel, ChangeHeightHdl ) ); + mpMtrWidth->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width"))); //wj acc + mpMtrHeight->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Height"))); //wj acc + + //Size : Keep ratio + mpCbxScale->SetClickHdl( LINK( this, PosSizePropertyPanel, ClickAutoHdl ) ); + + //rotation: + mpMtrAngle->SetModifyHdl(LINK( this, PosSizePropertyPanel, AngleModifiedHdl)); + mpMtrAngle->EnableAutocomplete( false ); + mpMtrAngle->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Rotation"))); //wj acc + + //rotation control + mpDial->SetModifyHdl(LINK( this, PosSizePropertyPanel, RotationHdl)); + + //flip: + mpFlipTbx->SetSelectHdl( LINK( this, PosSizePropertyPanel, FlipHdl) ); + mpFlipTbx->SetItemImage(FLIP_HORIZONTAL,maImgFlipHori); + mpFlipTbx->SetItemImage(FLIP_VERTICAL,maImgFlipVert); + mpFlipTbx->SetQuickHelpText(FLIP_HORIZONTAL,String(SVX_RES(STR_QH_HORI_FLIP))); //Add + mpFlipTbx->SetQuickHelpText(FLIP_VERTICAL,String(SVX_RES(STR_QH_VERT_FLIP))); //Add + + mpMtrPosX->SetAccessibleRelationLabeledBy(mpFtPosX.get()); + mpMtrPosY->SetAccessibleRelationLabeledBy(mpFtPosY.get()); + mpMtrWidth->SetAccessibleRelationLabeledBy(mpFtWidth.get()); + mpMtrHeight->SetAccessibleRelationLabeledBy(mpFtHeight.get()); + mpMtrAngle->SetAccessibleRelationLabeledBy(mpFtAngle.get()); +#ifdef HAS_IA2 + mpMtrAngle->SetMpSubEditAccLableBy(mpFtAngle.get()); +#endif + mpFlipTbx->SetAccessibleRelationLabeledBy(mpFtFlip.get()); + + mpMtrAngle->InsertValue(0, FUNIT_CUSTOM); + mpMtrAngle->InsertValue(4500, FUNIT_CUSTOM); + mpMtrAngle->InsertValue(9000, FUNIT_CUSTOM); + mpMtrAngle->InsertValue(13500, FUNIT_CUSTOM); + mpMtrAngle->InsertValue(18000, FUNIT_CUSTOM); + mpMtrAngle->InsertValue(22500, FUNIT_CUSTOM); + mpMtrAngle->InsertValue(27000, FUNIT_CUSTOM); + mpMtrAngle->InsertValue(31500, FUNIT_CUSTOM); + mpMtrAngle->SetDropDownLineCount(mpMtrAngle->GetEntryCount()); + + SfxViewShell* pCurSh = SfxViewShell::Current(); + if ( pCurSh ) + mpView = pCurSh->GetDrawView(); + else + mpView = NULL; + + if ( mpView != NULL ) + { + maUIScale = mpView->GetModel()->GetUIScale(); + + const SdrMarkList& rMarkList = mpView->GetMarkedObjectList(); + if(1 == rMarkList.GetMarkCount()) + { + const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); + const SdrObjKind eKind((SdrObjKind)pObj->GetObjIdentifier()); + + if((pObj->GetObjInventor() == SdrInventor) && (OBJ_TEXT == eKind || OBJ_TITLETEXT == eKind || OBJ_OUTLINETEXT == eKind) && ((SdrTextObj*)pObj)->HasText()) + { + mbAdjustEnabled = true; + } + } + } + + mePoolUnit = maTransfWidthControl.GetCoreMetric(); + meDlgUnit = GetModuleFieldUnit(); + SetFieldUnit( *mpMtrPosX, meDlgUnit, true ); + SetFieldUnit( *mpMtrPosY, meDlgUnit, true ); + SetFieldUnit( *mpMtrWidth, meDlgUnit, true ); + SetFieldUnit( *mpMtrHeight, meDlgUnit, true ); +} + + + +void PosSizePropertyPanel::SetupIcons(void) +{ + if(Theme::GetBoolean(Theme::Bool_UseSymphonyIcons)) + { + // todo + } + else + { + // todo + } +} + + + +PosSizePropertyPanel* PosSizePropertyPanel::Create ( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings, + const cssu::Reference<css::ui::XSidebar>& rxSidebar) +{ + if (pParent == NULL) + throw lang::IllegalArgumentException(A2S("no parent Window given to PosSizePropertyPanel::Create"), NULL, 0); + if ( ! rxFrame.is()) + throw lang::IllegalArgumentException(A2S("no XFrame given to PosSizePropertyPanel::Create"), NULL, 1); + if (pBindings == NULL) + throw lang::IllegalArgumentException(A2S("no SfxBindings given to PosSizePropertyPanel::Create"), NULL, 2); + + return new PosSizePropertyPanel( + pParent, + rxFrame, + pBindings, + rxSidebar); +} + + + +void PosSizePropertyPanel::DataChanged( + const DataChangedEvent& rEvent) +{ + (void)rEvent; + + SetupIcons(); +} + + + +void PosSizePropertyPanel::HandleContextChange( + const ::sfx2::sidebar::EnumContext aContext) +{ + if(maContext == aContext) + { + // Nothing to do. + return; + } + + maContext = aContext; + + sal_Int32 nLayoutMode (0); + switch (maContext.GetCombinedContext_DI()) + { + case CombinedEnumContext(Application_WriterAndWeb, Context_Draw): + nLayoutMode = 0; + break; + + case CombinedEnumContext(Application_WriterAndWeb, Context_Graphic): + case CombinedEnumContext(Application_WriterAndWeb, Context_Media): + case CombinedEnumContext(Application_WriterAndWeb, Context_Frame): + case CombinedEnumContext(Application_WriterAndWeb, Context_OLE): + case CombinedEnumContext(Application_WriterAndWeb, Context_Form): + nLayoutMode = 1; + break; + + case CombinedEnumContext(Application_Calc, Context_Draw): + case CombinedEnumContext(Application_Calc, Context_Graphic): + case CombinedEnumContext(Application_DrawImpress, Context_Draw): + case CombinedEnumContext(Application_DrawImpress, Context_TextObject): + case CombinedEnumContext(Application_DrawImpress, Context_Graphic): + nLayoutMode = 2; + break; + + case CombinedEnumContext(Application_Calc, Context_Chart): + case CombinedEnumContext(Application_Calc, Context_Form): + case CombinedEnumContext(Application_Calc, Context_Media): + case CombinedEnumContext(Application_Calc, Context_OLE): + case CombinedEnumContext(Application_Calc, Context_MultiObject): + case CombinedEnumContext(Application_DrawImpress, Context_Media): + case CombinedEnumContext(Application_DrawImpress, Context_Form): + case CombinedEnumContext(Application_DrawImpress, Context_OLE): + case CombinedEnumContext(Application_DrawImpress, Context_3DObject): + case CombinedEnumContext(Application_DrawImpress, Context_MultiObject): + nLayoutMode = 3; + break; + } + switch (nLayoutMode) + { + case 0: + { + mpMtrWidth->SetMin( 2 ); + mpMtrHeight->SetMin( 2 ); + mpFtPosX->Hide(); + mpMtrPosX->Hide(); + mpFtPosY->Hide(); + mpMtrPosY->Hide(); + + //rotation + mpFtAngle->Show(); + mpMtrAngle->Show(); + mpDial->Show(); + + //flip + mpFtFlip->Show(); + mpFlipTbx->Show(); + Size aTbxSize = mpFlipTbx->CalcWindowSizePixel(); + mpFlipTbx->SetOutputSizePixel( aTbxSize ); + mbIsFlip = true; + + mpFtWidth->SetPosPixel(Point(LogicToPixel(Point(FT_POSITION_X_X,FT_POSITION_X_Y), MAP_APPFONT))); + mpMtrWidth->SetPosPixel(Point(LogicToPixel(Point(MF_POSITION_X_X,MF_POSITION_X_Y), MAP_APPFONT))); + mpFtHeight->SetPosPixel(Point(LogicToPixel(Point(FT_POSITION_Y_X,FT_POSITION_Y_Y), MAP_APPFONT))); + mpMtrHeight->SetPosPixel(Point(LogicToPixel(Point(MF_POSITION_Y_X,MF_POSITION_Y_Y), MAP_APPFONT))); + mpCbxScale->SetPosPixel(Point(LogicToPixel(Point(FT_WIDTH_X,FT_WIDTH_Y), MAP_APPFONT))); + + mpFtAngle->SetPosPixel(Point(LogicToPixel(Point(FT_ANGLE_X,FT_ANGLE_Y), MAP_APPFONT))); + mpMtrAngle->SetPosPixel(Point(LogicToPixel(Point(MF_ANGLE_X2,MF_ANGLE_Y2), MAP_APPFONT))); + mpFlipTbx->SetPosPixel(Point(LogicToPixel(Point(FLIP_HORI_X2,FLIP_HORI_Y2), MAP_APPFONT))); + mpDial->SetPosPixel(Point(LogicToPixel(Point(ROTATE_CONTROL_X2,ROTATE_CONTROL_Y2), MAP_APPFONT))); + mpFtFlip->SetPosPixel(Point(LogicToPixel(Point(FT_FLIP_X2,FT_FLIP_Y2), MAP_APPFONT))); + + Size aSize(GetOutputSizePixel().Width(),PS_SECTIONPAGE_HEIGHT2); + aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) ); + SetSizePixel(aSize); + if (mxSidebar.is()) + mxSidebar->requestLayout(); + } + break; + + case 1: + { + mpMtrWidth->SetMin( 2 ); + mpMtrHeight->SetMin( 2 ); + mpFtPosX->Hide(); + mpMtrPosX->Hide(); + mpFtPosY->Hide(); + mpMtrPosY->Hide(); + + //rotation + mpFtAngle->Hide(); + mpMtrAngle->Hide(); + mpDial->Hide(); + + //flip + mpFlipTbx->Hide(); + mpFtFlip->Hide(); + mbIsFlip = false; + + mpFtWidth->SetPosPixel(Point(LogicToPixel(Point(FT_POSITION_X_X,FT_POSITION_X_Y), MAP_APPFONT))); + mpMtrWidth->SetPosPixel(Point(LogicToPixel(Point(MF_POSITION_X_X,MF_POSITION_X_Y), MAP_APPFONT))); + mpFtHeight->SetPosPixel(Point(LogicToPixel(Point(FT_POSITION_Y_X,FT_POSITION_Y_Y), MAP_APPFONT))); + mpMtrHeight->SetPosPixel(Point(LogicToPixel(Point(MF_POSITION_Y_X,MF_POSITION_Y_Y), MAP_APPFONT))); + mpCbxScale->SetPosPixel(Point(LogicToPixel(Point(FT_WIDTH_X,FT_WIDTH_Y), MAP_APPFONT))); + + Size aSize(GetOutputSizePixel().Width(),PS_SECTIONPAGE_HEIGHT3); + aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) ); + SetSizePixel(aSize); + if (mxSidebar.is()) + mxSidebar->requestLayout(); + } + break; + + case 2: + { + mpMtrWidth->SetMin( 1 ); + mpMtrHeight->SetMin( 1 ); + mpFtPosX->Show(); + mpMtrPosX->Show(); + mpFtPosY->Show(); + mpMtrPosY->Show(); + + //rotation + mpFtAngle->Show(); + mpMtrAngle->Show(); + mpDial->Show(); + + //flip + mpFlipTbx->Show(); + mpFtFlip->Show(); + Size aTbxSize = mpFlipTbx->CalcWindowSizePixel(); + mpFlipTbx->SetOutputSizePixel( aTbxSize ); + mbIsFlip = true; + + Size aSize(GetOutputSizePixel().Width(),PS_SECTIONPAGE_HEIGHT); + aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) ); + SetSizePixel(aSize); + if (mxSidebar.is()) + mxSidebar->requestLayout(); + } + break; + + case 3: + { + mpMtrWidth->SetMin( 1 ); + mpMtrHeight->SetMin( 1 ); + mpFtPosX->Show(); + mpMtrPosX->Show(); + mpFtPosY->Show(); + mpMtrPosY->Show(); + + //rotation + mpFtAngle->Hide(); + mpMtrAngle->Hide(); + mpDial->Hide(); + + //flip + mpFlipTbx->Hide(); + mpFtFlip->Hide(); + mbIsFlip = false; + + Size aSize(GetOutputSizePixel().Width(),PS_SECTIONPAGE_HEIGHT4); + aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) ); + SetSizePixel(aSize); + if (mxSidebar.is()) + mxSidebar->requestLayout(); + } + break; + } + + //Added for windows classic theme + mpFlipTbx->SetBackground(Wallpaper()); + mpFlipTbx->SetPaintTransparent(true); +} + + + +IMPL_LINK( PosSizePropertyPanel, ChangeWidthHdl, void*, /*pBox*/ ) +{ + if( mpCbxScale->IsChecked() && + mpCbxScale->IsEnabled() ) + { + long nHeight = (long) ( ((double) mlOldHeight * (double) mpMtrWidth->GetValue()) / (double) mlOldWidth ); + if( nHeight <= mpMtrHeight->GetMax( FUNIT_NONE ) ) + { + mpMtrHeight->SetUserValue( nHeight, FUNIT_NONE ); + } + else + { + nHeight = (long)mpMtrHeight->GetMax( FUNIT_NONE ); + mpMtrHeight->SetUserValue( nHeight ); + const long nWidth = (long) ( ((double) mlOldWidth * (double) nHeight) / (double) mlOldHeight ); + mpMtrWidth->SetUserValue( nWidth, FUNIT_NONE ); + } + } + executeSize(); + return 0; +} + + + +IMPL_LINK( PosSizePropertyPanel, ChangeHeightHdl, void *, EMPTYARG ) +{ + if( mpCbxScale->IsChecked() && + mpCbxScale->IsEnabled() ) + { + long nWidth = (long) ( ((double)mlOldWidth * (double)mpMtrHeight->GetValue()) / (double)mlOldHeight ); + if( nWidth <= mpMtrWidth->GetMax( FUNIT_NONE ) ) + { + mpMtrWidth->SetUserValue( nWidth, FUNIT_NONE ); + } + else + { + nWidth = (long)mpMtrWidth->GetMax( FUNIT_NONE ); + mpMtrWidth->SetUserValue( nWidth ); + const long nHeight = (long) ( ((double)mlOldHeight * (double)nWidth) / (double)mlOldWidth ); + mpMtrHeight->SetUserValue( nHeight, FUNIT_NONE ); + } + } + executeSize(); + return 0; +} + + + +IMPL_LINK( PosSizePropertyPanel, ChangePosXHdl, void *, EMPTYARG ) +{ + executePosX(); + return 0; +} + + + +IMPL_LINK( PosSizePropertyPanel, ChangePosYHdl, void *, EMPTYARG ) +{ + executePosY(); + return 0; +} + + + +IMPL_LINK( PosSizePropertyPanel, ClickAutoHdl, void *, EMPTYARG ) +{ + if ( mpCbxScale->IsChecked() ) + { + mlOldWidth = std::max( GetCoreValue( *mpMtrWidth, mePoolUnit ), 1L ); + mlOldHeight = std::max( GetCoreValue( *mpMtrHeight, mePoolUnit ), 1L ); + } + + // mpCbxScale must synchronized with that on Position and Size tabpage on Shape Properties dialog + SvtViewOptions aPageOpt( E_TABPAGE, OUString::number( RID_SVXPAGE_POSITION_SIZE ) ); + aPageOpt.SetUserItem( USERITEM_NAME, ::com::sun::star::uno::makeAny( ::rtl::OUString::number( mpCbxScale->IsChecked() ) ) ); + + return 0; +} + + + +IMPL_LINK( PosSizePropertyPanel, AngleModifiedHdl, void *, EMPTYARG ) +{ + OUString sTmp = mpMtrAngle->GetText(); + bool bNegative = 0; + sal_Unicode nChar = sTmp[0]; + + if( nChar == '-' ) + { + bNegative = 1; + nChar = sTmp[1]; + } + + if( (nChar < '0') || (nChar > '9') ) + return 0; + double dTmp = sTmp.toDouble(); + if(bNegative) + { + while(dTmp<0) + dTmp += 360; + } + sal_Int64 nTmp = dTmp*100; + + SfxInt32Item aAngleItem( SID_ATTR_TRANSFORM_ANGLE,(sal_uInt32) nTmp); + SfxInt32Item aRotXItem( SID_ATTR_TRANSFORM_ROT_X,(sal_uInt32) mlRotX); + SfxInt32Item aRotYItem( SID_ATTR_TRANSFORM_ROT_Y,(sal_uInt32) mlRotY); + + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_TRANSFORM, SFX_CALLMODE_RECORD, &aAngleItem, &aRotXItem, &aRotYItem, 0L ); + + return 0; +} + + + +IMPL_LINK( PosSizePropertyPanel, RotationHdl, void *, EMPTYARG ) +{ + sal_Int32 nTmp = mpDial->GetRotation(); + + SfxInt32Item aAngleItem( SID_ATTR_TRANSFORM_ANGLE,(sal_uInt32) nTmp); + SfxInt32Item aRotXItem( SID_ATTR_TRANSFORM_ROT_X,(sal_uInt32) mlRotX); + SfxInt32Item aRotYItem( SID_ATTR_TRANSFORM_ROT_Y,(sal_uInt32) mlRotY); + + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_TRANSFORM, SFX_CALLMODE_RECORD, &aAngleItem, &aRotXItem, &aRotYItem, 0L ); + + return 0; +} + + + +IMPL_LINK( PosSizePropertyPanel, FlipHdl, ToolBox*, pBox ) +{ + switch (pBox->GetCurItemId()) + { + case FLIP_HORIZONTAL: + { + SfxVoidItem aHoriItem (SID_FLIP_HORIZONTAL); + GetBindings()->GetDispatcher()->Execute( + SID_FLIP_HORIZONTAL, SFX_CALLMODE_RECORD, &aHoriItem, 0L ); + } + break; + case FLIP_VERTICAL: + { + SfxVoidItem aVertItem (SID_FLIP_VERTICAL ); + GetBindings()->GetDispatcher()->Execute( + SID_FLIP_VERTICAL, SFX_CALLMODE_RECORD, &aVertItem, 0L ); + } + break; + } + return 0; +} + + + +void PosSizePropertyPanel::NotifyItemUpdate( + sal_uInt16 nSID, + SfxItemState eState, + const SfxPoolItem* pState) +{ + mpFtAngle->Enable(); + mpMtrAngle->Enable(); + mpDial->Enable(); + mpFtFlip->Enable(); + mpFlipTbx->Enable(); + + const SfxUInt32Item* pWidthItem; + const SfxUInt32Item* pHeightItem; + + SfxViewShell* pCurSh = SfxViewShell::Current(); + if ( pCurSh ) + mpView = pCurSh->GetDrawView(); + else + mpView = NULL; + + if ( mpView == NULL ) + return; + + const SdrMarkList& rMarkList = mpView->GetMarkedObjectList(); + + if(1 == rMarkList.GetMarkCount()) + { + const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); + const SdrObjKind eKind((SdrObjKind)pObj->GetObjIdentifier()); + + if((pObj->GetObjInventor() == SdrInventor) && (OBJ_TEXT == eKind || OBJ_TITLETEXT == eKind || OBJ_OUTLINETEXT == eKind) && ((SdrTextObj*)pObj)->HasText()) + mbAdjustEnabled = true; + else + mbAdjustEnabled = false; + } + else + mbAdjustEnabled = false; + + switch (nSID) + { + case SID_ATTR_TRANSFORM_WIDTH: + if ( SFX_ITEM_AVAILABLE == eState ) + { + pWidthItem = dynamic_cast< const SfxUInt32Item* >(pState); + + if(pWidthItem) + { + long mlOldWidth1 = pWidthItem->GetValue(); + + mlOldWidth1 = Fraction( mlOldWidth1 ) / maUIScale; + SetMetricValue( *mpMtrWidth, mlOldWidth1, mePoolUnit ); + mlOldWidth = mlOldWidth1; + break; + } + } + + mpMtrWidth->SetText( String()); + break; + + case SID_ATTR_TRANSFORM_HEIGHT: + if ( SFX_ITEM_AVAILABLE == eState ) + { + pHeightItem = dynamic_cast< const SfxUInt32Item* >(pState); + + if(pHeightItem) + { + long mlOldHeight1 = pHeightItem->GetValue(); + + mlOldHeight1 = Fraction( mlOldHeight1 ) / maUIScale; + SetMetricValue( *mpMtrHeight, mlOldHeight1, mePoolUnit ); + mlOldHeight = mlOldHeight1; + break; + } + } + + mpMtrHeight->SetText( String()); + break; + + case SID_ATTR_TRANSFORM_POS_X: + if(SFX_ITEM_AVAILABLE == eState) + { + const SfxInt32Item* pItem = dynamic_cast< const SfxInt32Item* >(pState); + + if(pItem) + { + long nTmp = pItem->GetValue(); + nTmp = Fraction( nTmp ) / maUIScale; + SetMetricValue( *mpMtrPosX, nTmp, mePoolUnit ); + break; + } + } + + mpMtrPosX->SetText( String()); + break; + + case SID_ATTR_TRANSFORM_POS_Y: + if(SFX_ITEM_AVAILABLE == eState) + { + const SfxInt32Item* pItem = dynamic_cast< const SfxInt32Item* >(pState); + + if(pItem) + { + long nTmp = pItem->GetValue(); + nTmp = Fraction( nTmp ) / maUIScale; + SetMetricValue( *mpMtrPosY, nTmp, mePoolUnit ); + break; + } + } + + mpMtrPosY->SetText( String()); + break; + + case SID_ATTR_TRANSFORM_ROT_X: + if (SFX_ITEM_AVAILABLE == eState) + { + const SfxInt32Item* pItem = dynamic_cast< const SfxInt32Item* >(pState); + + if(pItem) + { + mlRotX = pItem->GetValue(); + mlRotX = Fraction( mlRotX ) / maUIScale; + } + } + break; + + case SID_ATTR_TRANSFORM_ROT_Y: + if (SFX_ITEM_AVAILABLE == eState) + { + const SfxInt32Item* pItem = dynamic_cast< const SfxInt32Item* >(pState); + + if(pItem) + { + mlRotY = pItem->GetValue(); + mlRotY = Fraction( mlRotY ) / maUIScale; + } + } + break; + + case SID_ATTR_TRANSFORM_PROTECT_POS: + if(SFX_ITEM_AVAILABLE == eState) + { + const SfxBoolItem* pItem = dynamic_cast< const SfxBoolItem* >(pState); + + if(pItem) + { + // record the state of position protect + mbPositionProtected = pItem->GetValue(); + break; + } + } + + mbPositionProtected = false; + break; + + case SID_ATTR_TRANSFORM_PROTECT_SIZE: + if(SFX_ITEM_AVAILABLE == eState) + { + const SfxBoolItem* pItem = dynamic_cast< const SfxBoolItem* >(pState); + + if(pItem) + { + // record the state of size protect + mbSizeProtected = pItem->GetValue(); + break; + } + } + + mbSizeProtected = false; + break; + + case SID_ATTR_TRANSFORM_AUTOWIDTH: + if(SFX_ITEM_AVAILABLE == eState) + { + const SfxBoolItem* pItem = dynamic_cast< const SfxBoolItem* >(pState); + + if(pItem) + { + mbAutoWidth = pItem->GetValue(); + } + } + break; + + case SID_ATTR_TRANSFORM_AUTOHEIGHT: + if(SFX_ITEM_AVAILABLE == eState) + { + const SfxBoolItem* pItem = dynamic_cast< const SfxBoolItem* >(pState); + + if(pItem) + { + mbAutoHeight = pItem->GetValue(); + } + } + break; + + case SID_ATTR_TRANSFORM_ANGLE: + if (eState >= SFX_ITEM_AVAILABLE) + { + const SfxInt32Item* pItem = dynamic_cast< const SfxInt32Item* >(pState); + + if(pItem) + { + long nTmp = pItem->GetValue(); + + mpMtrAngle->SetValue( nTmp ); + mpDial->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 315000: + mpMtrAngle->SelectEntryPos(7); + } + + break; + } + } + + mpMtrAngle->SetText( String() ); + mpDial->SetRotation( 0 ); + break; + + case SID_ATTR_METRIC: + MetricState( eState, pState ); + break; + + default: + break; + } + + const sal_Int32 nCombinedContext(maContext.GetCombinedContext_DI()); + + switch (rMarkList.GetMarkCount()) + { + case 0: + break; + + case 1: + { + const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); + const SdrObjKind eKind((SdrObjKind)pObj->GetObjIdentifier()); + + if(((nCombinedContext == CombinedEnumContext(Application_DrawImpress, Context_Draw) + || nCombinedContext == CombinedEnumContext(Application_DrawImpress, Context_TextObject) + ) && OBJ_EDGE == eKind) + || OBJ_CAPTION == eKind) + { + mpFtAngle->Disable(); + mpMtrAngle->Disable(); + mpDial->Disable(); + mpFlipTbx->Disable(); + mpFtFlip->Disable(); + } + break; + } + + default: + { + sal_uInt16 nMarkObj = 0; + bool isNoEdge = true; + while(rMarkList.GetMark(nMarkObj)) + { + const SdrObject* pObj = rMarkList.GetMark(nMarkObj)->GetMarkedSdrObj(); + const SdrObjKind eKind((SdrObjKind)pObj->GetObjIdentifier()); + + if(((nCombinedContext == CombinedEnumContext(Application_DrawImpress, Context_Draw) + || nCombinedContext == CombinedEnumContext(Application_DrawImpress, Context_TextObject) + ) && OBJ_EDGE == eKind) + || OBJ_CAPTION == eKind) + { + isNoEdge = false; + break; + } + nMarkObj++; + } + if(!isNoEdge) + { + mpFtAngle->Disable(); + mpMtrAngle->Disable(); + mpDial->Disable(); + mpFlipTbx->Disable(); + mpFtFlip->Disable(); + } + break; + } + } + + if(nCombinedContext == CombinedEnumContext(Application_DrawImpress, Context_TextObject)) + { + mpFlipTbx->Disable(); + mpFtFlip->Disable(); + } + + DisableControls(); + + // mpCbxScale must synchronized with that on Position and Size tabpage on Shape Properties dialog + SvtViewOptions aPageOpt( E_TABPAGE, OUString::number( RID_SVXPAGE_POSITION_SIZE ) ); + String sUserData; + ::com::sun::star::uno::Any aUserItem = aPageOpt.GetUserItem( USERITEM_NAME ); + ::rtl::OUString aTemp; + if ( aUserItem >>= aTemp ) + sUserData = String( aTemp ); + mpCbxScale->Check( (bool)sUserData.ToInt32() ); +} + + + +SfxBindings* PosSizePropertyPanel::GetBindings() +{ + return mpBindings; +} + + + +void PosSizePropertyPanel::executeSize() +{ + if ( mpMtrWidth->IsValueModified() || mpMtrHeight->IsValueModified()) + { + Fraction aUIScale = mpView->GetModel()->GetUIScale(); + + // get Width + double nWidth = (double)mpMtrWidth->GetValue( meDlgUnit ); + nWidth = MetricField::ConvertDoubleValue( nWidth, mpMtrWidth->GetBaseValue(), mpMtrWidth->GetDecimalDigits(), meDlgUnit, FUNIT_100TH_MM ); + long lWidth = (long)(nWidth * (double)aUIScale); + lWidth = OutputDevice::LogicToLogic( lWidth, MAP_100TH_MM, (MapUnit)mePoolUnit ); + lWidth = (long)mpMtrWidth->Denormalize( lWidth ); + + // get Height + double nHeight = (double)mpMtrHeight->GetValue( meDlgUnit ); + nHeight = MetricField::ConvertDoubleValue( nHeight, mpMtrHeight->GetBaseValue(), mpMtrHeight->GetDecimalDigits(), meDlgUnit, FUNIT_100TH_MM ); + long lHeight = (long)(nHeight * (double)aUIScale); + lHeight = OutputDevice::LogicToLogic( lHeight, MAP_100TH_MM, (MapUnit)mePoolUnit ); + lHeight = (long)mpMtrWidth->Denormalize( lHeight ); + + // put Width & Height to itemset + SfxUInt32Item aWidthItem( SID_ATTR_TRANSFORM_WIDTH, (sal_uInt32) lWidth); + SfxUInt32Item aHeightItem( SID_ATTR_TRANSFORM_HEIGHT, (sal_uInt32) lHeight); + SfxAllEnumItem aPointItem (SID_ATTR_TRANSFORM_SIZE_POINT, (sal_uInt16)meRP); + const sal_Int32 nCombinedContext(maContext.GetCombinedContext()); + + if( nCombinedContext == CombinedEnumContext(Application_Writer, Context_Graphic) // mnContextId == PROPERTY_CONTEXT_SW_GRAPHIC + || nCombinedContext == CombinedEnumContext(Application_Writer, Context_OLE) //mnContextId == PROPERTY_CONTEXT_SW_OLE + ) + // if( mnContextId == PROPERTY_CONTEXT_SW_GRAPHIC || mnContextId == PROPERTY_CONTEXT_SW_OLE ) + { + GetBindings()->GetDispatcher()->Execute(SID_ATTR_TRANSFORM, SFX_CALLMODE_RECORD, &aWidthItem, &aHeightItem, &aPointItem, 0L ); + } + else + { + if ( (mpMtrWidth->IsValueModified()) && (mpMtrHeight->IsValueModified())) + GetBindings()->GetDispatcher()->Execute(SID_ATTR_TRANSFORM, SFX_CALLMODE_RECORD, &aWidthItem, &aHeightItem, &aPointItem, 0L ); + else if( mpMtrWidth->IsValueModified()) + GetBindings()->GetDispatcher()->Execute(SID_ATTR_TRANSFORM, SFX_CALLMODE_RECORD, &aWidthItem, &aPointItem, 0L ); + else if ( mpMtrHeight->IsValueModified()) + GetBindings()->GetDispatcher()->Execute(SID_ATTR_TRANSFORM, SFX_CALLMODE_RECORD, &aHeightItem, &aPointItem, 0L ); + } + } +} + + + +void PosSizePropertyPanel::executePosX() +{ + if ( mpMtrPosX->IsValueModified()) + { + long lX = GetCoreValue( *mpMtrPosX, mePoolUnit ); + if( mbMtrPosXMirror ) + lX = -lX; + long lY = GetCoreValue( *mpMtrPosY, mePoolUnit ); + + Size aPageSize; + Rectangle aRect; + maRect = mpView->GetAllMarkedRect(); + aRect = mpView->GetAllMarkedRect(); + + Fraction aUIScale = mpView->GetModel()->GetUIScale(); + lX += maAnchorPos.X(); + lX = Fraction( lX ) * aUIScale; + lY += maAnchorPos.Y(); + lY = Fraction( lY ) * aUIScale; + + SfxInt32Item aPosXItem( SID_ATTR_TRANSFORM_POS_X,(sal_uInt32) lX); + SfxInt32Item aPosYItem( SID_ATTR_TRANSFORM_POS_Y,(sal_uInt32) lY); + + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_TRANSFORM, SFX_CALLMODE_RECORD, &aPosXItem, 0L ); + } +} + + + +void PosSizePropertyPanel::executePosY() +{ + if ( mpMtrPosY->IsValueModified() ) + { + long lX = GetCoreValue( *mpMtrPosX, mePoolUnit ); + long lY = GetCoreValue( *mpMtrPosY, mePoolUnit ); + + Size aPageSize; + Rectangle aRect; + maRect = mpView->GetAllMarkedRect(); + aRect = mpView->GetAllMarkedRect(); + + Fraction aUIScale = mpView->GetModel()->GetUIScale(); + lX += maAnchorPos.X(); + lX = Fraction( lX ) * aUIScale; + lY += maAnchorPos.Y(); + lY = Fraction( lY ) * aUIScale; + + SfxInt32Item aPosXItem( SID_ATTR_TRANSFORM_POS_X,(sal_uInt32) lX); + SfxInt32Item aPosYItem( SID_ATTR_TRANSFORM_POS_Y,(sal_uInt32) lY); + + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_TRANSFORM, SFX_CALLMODE_RECORD, &aPosYItem, 0L ); + } +} + + + +void PosSizePropertyPanel::MetricState( SfxItemState eState, const SfxPoolItem* pState ) +{ + bool bPosXBlank = false; + bool bPosYBlank = false; + bool bWidthBlank = false; + bool bHeightBlank = false; + meDlgUnit = GetCurrentUnit(eState,pState); + + if (mpMtrPosX->GetText().isEmpty()) + bPosXBlank = true; + SetFieldUnit( *mpMtrPosX, meDlgUnit, true ); + if(bPosXBlank) + mpMtrPosX->SetText(String()); + + if (mpMtrPosY->GetText().isEmpty()) + bPosYBlank = true; + SetFieldUnit( *mpMtrPosY, meDlgUnit, true ); + if(bPosYBlank) + mpMtrPosY->SetText(String()); + + if (mpMtrWidth->GetText().isEmpty()) + bWidthBlank = true; + SetFieldUnit( *mpMtrWidth, meDlgUnit, true ); + if(bWidthBlank) + mpMtrWidth->SetText(String()); + + if (mpMtrHeight->GetText().isEmpty()) + bHeightBlank = true; + SetFieldUnit( *mpMtrHeight, meDlgUnit, true ); + if(bHeightBlank) + mpMtrHeight->SetText(String()); +} + + + +FieldUnit PosSizePropertyPanel::GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState ) +{ + FieldUnit eUnit = FUNIT_NONE; + + if ( pState && eState >= SFX_ITEM_DEFAULT ) + { + eUnit = (FieldUnit)( (const SfxUInt16Item*)pState )->GetValue(); + } + else + { + SfxViewFrame* pFrame = SfxViewFrame::Current(); + SfxObjectShell* pSh = NULL; + if ( pFrame ) + pSh = pFrame->GetObjectShell(); + if ( pSh ) + { + SfxModule* pModule = pSh->GetModule(); + if ( pModule ) + { + const SfxPoolItem* pItem = pModule->GetItem( SID_ATTR_METRIC ); + if ( pItem ) + eUnit = (FieldUnit)( (SfxUInt16Item*)pItem )->GetValue(); + } + else + { + DBG_ERRORFILE( "GetModuleFieldUnit(): no module found" ); + } + } + } + + return eUnit; +} + + + +void PosSizePropertyPanel::DisableControls() +{ + if( mbPositionProtected ) + { + // the position is protected("Position protect" option in modal dialog is checked), + // disable all the Position controls in sidebar + mpFtPosX->Disable(); + mpMtrPosX->Disable(); + mpFtPosY->Disable(); + mpMtrPosY->Disable(); + mpFtAngle->Disable(); + mpMtrAngle->Disable(); + mpDial->Disable(); + mpFtFlip->Disable(); + mpFlipTbx->Disable(); + + mpFtWidth->Disable(); + mpMtrWidth->Disable(); + mpFtHeight->Disable(); + mpMtrHeight->Disable(); + mpCbxScale->Disable(); + } + else + { + mpFtPosX->Enable(); + mpMtrPosX->Enable(); + mpFtPosY->Enable(); + mpMtrPosY->Enable(); + + //mpFtAngle->Enable(); + //mpMtrAngle->Enable(); + //mpDial->Enable(); + //mpFtFlip->Enable(); + //mpFlipTbx->Enable(); + + if( mbSizeProtected ) + { + mpFtWidth->Disable(); + mpMtrWidth->Disable(); + mpFtHeight->Disable(); + mpMtrHeight->Disable(); + mpCbxScale->Disable(); + } + else + { + if( mbAdjustEnabled ) + { + if( mbAutoWidth ) + { + mpFtWidth->Disable(); + mpMtrWidth->Disable(); + mpCbxScale->Disable(); + } + else + { + mpFtWidth->Enable(); + mpMtrWidth->Enable(); + } + if( mbAutoHeight ) + { + mpFtHeight->Disable(); + mpMtrHeight->Disable(); + mpCbxScale->Disable(); + } + else + { + mpFtHeight->Enable(); + mpMtrHeight->Enable(); + } + if( !mbAutoWidth && !mbAutoHeight ) + mpCbxScale->Enable(); + } + else + { + mpFtWidth->Enable(); + mpMtrWidth->Enable(); + mpFtHeight->Enable(); + mpMtrHeight->Enable(); + mpCbxScale->Enable(); + } + } + } +} + + +} } // end of namespace svx::sidebar + +// eof diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.hrc b/svx/source/sidebar/possize/PosSizePropertyPanel.hrc new file mode 100644 index 000000000000..8a4cabad21a3 --- /dev/null +++ b/svx/source/sidebar/possize/PosSizePropertyPanel.hrc @@ -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 . + */ +// RID_SIDEBAR_POSSIZE_PANEL-------------------------------------------------------------- +#define FT_WIDTH 1 +#define MTR_FLD_WIDTH 2 +#define FT_HEIGHT 3 +#define MTR_FLD_HEIGHT 4 +#define CBX_SCALE 5 +#define FT_SBSHAPE_HORIZONTAL 7 +#define MF_SBSHAPE_HORIZONTAL 8 +#define FT_SBSHAPE_VERTICAL 9 +#define MF_SBSHAPE_VERTICAL 10 +#define FT_SBSHAPE_POSREFERENCE 11 +#define CTL_SBSHAPE_POSREFERENCE 12 +#define FT_ANGLE 13 +#define MTR_FLD_ANGLE 14 +#define TBX_FLIP 15 +#define DIAL_CONTROL 17 +#define FLIP_HORIZONTAL 18 +#define FLIP_VERTICAL 19 +#define IMG_HORI_FLIP 20 +#define IMG_VERT_FLIP 21 +#define FT_FLIP 22 +#define STR_QH_HORI_FLIP 23 +#define STR_QH_VERT_FLIP 24 + +#define MBOX_WIDTH 50 +#define TEXT_WIDTH 40 +#define FLIP_BUTTON_SIZE 13 +#define ALIGNMENT_TBX_HEIGHT 17 +#define ALIGNMENT_TBX_WIDTH 13 + +#define FT_POSITION_X_X SECTIONPAGE_MARGIN_HORIZONTAL +#define FT_POSITION_X_Y SECTIONPAGE_MARGIN_VERTICAL_TOP +#define MF_POSITION_X_X FT_POSITION_X_X +#define MF_POSITION_X_Y FT_POSITION_X_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL +#define FT_POSITION_Y_X FT_POSITION_X_X + MBOX_WIDTH + CONTROL_SPACING_HORIZONTAL +#define FT_POSITION_Y_Y FT_POSITION_X_Y +#define MF_POSITION_Y_X FT_POSITION_Y_X +#define MF_POSITION_Y_Y MF_POSITION_X_Y + +#define FT_WIDTH_X SECTIONPAGE_MARGIN_HORIZONTAL +#define FT_WIDTH_Y MF_POSITION_X_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL +#define FLD_WIDTH_X FT_WIDTH_X +#define FLD_WIDTH_Y FT_WIDTH_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL +#define FT_HEIGHT_X FT_WIDTH_X + MBOX_WIDTH + CONTROL_SPACING_HORIZONTAL +#define FT_HEIGHT_Y FT_WIDTH_Y +#define FLD_HEIGHT_X FT_HEIGHT_X +#define FLD_HEIGHT_Y FLD_WIDTH_Y +#define CBX_X FT_WIDTH_X +#define CBX_Y FLD_WIDTH_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL +///////////////////// +#define FT_ROTATION_X FT_WIDTH_X +#define FT_ROTATION_Y CBX_Y + CONTROL_SPACING_VERTICAL + TEXT_HEIGHT + +#define MF_ROTATION_X FT_ROTATION_X + 40 + CONTROL_SPACING_HORIZONTAL +#define MF_ROTATION_Y FT_ROTATION_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + +#define ROTATE_CONTROL_X FT_ROTATION_X +#define ROTATE_CONTROL_Y MF_ROTATION_Y + 4 + +#define FT_FLIP_X MF_ROTATION_X +#define FT_FLIP_Y MF_ROTATION_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL + 5 + +#define BTN_FLIP_HORI_X PROPERTYPAGE_WIDTH - SECTIONPAGE_MARGIN_HORIZONTAL - TOOLBOX_ITEM_WIDTH * 2 - 1 // wj for 7926 +#define BTN_FLIP_HORI_Y FT_FLIP_Y - 5 +//////////////////////////////// + +#define FT_ANGLE_X FLD_WIDTH_X +#define FT_ANGLE_Y FLD_WIDTH_Y + 4 + +#define MF_ANGLE_X2 MF_ROTATION_X +#define MF_ANGLE_Y2 FT_ANGLE_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + +#define ROTATE_CONTROL_X2 FT_ANGLE_X +#define ROTATE_CONTROL_Y2 MF_ANGLE_Y2 + 4 + +#define FT_FLIP_X2 MF_ANGLE_X2 +#define FT_FLIP_Y2 MF_ANGLE_Y2 + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL + 5 + +#define FLIP_HORI_X2 PROPERTYPAGE_WIDTH - SECTIONPAGE_MARGIN_HORIZONTAL - TOOLBOX_ITEM_WIDTH * 2 //FT_FLIP_X2 + 22 +#define FLIP_HORI_Y2 FT_FLIP_Y2 - 5 + +#define PS_SECTIONPAGE_HEIGHT BTN_FLIP_HORI_Y + ALIGNMENT_TBX_HEIGHT + SECTIONPAGE_MARGIN_VERTICAL_BOT + 2 +#define PS_SECTIONPAGE_HEIGHT2 FLIP_HORI_Y2 + ALIGNMENT_TBX_HEIGHT + SECTIONPAGE_MARGIN_VERTICAL_BOT + 2 +#define PS_SECTIONPAGE_HEIGHT3 FT_WIDTH_Y + TEXT_HEIGHT + SECTIONPAGE_MARGIN_VERTICAL_BOT +#define PS_SECTIONPAGE_HEIGHT4 CBX_Y + CBOX_HEIGHT + SECTIONPAGE_MARGIN_VERTICAL_BOT + +// eof diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.hxx b/svx/source/sidebar/possize/PosSizePropertyPanel.hxx new file mode 100644 index 000000000000..bbdff17e41c3 --- /dev/null +++ b/svx/source/sidebar/possize/PosSizePropertyPanel.hxx @@ -0,0 +1,178 @@ +/* + * 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 SVX_PROPERTYPANEL_POSIZEPAGE_HXX +#define SVX_PROPERTYPANEL_POSIZEPAGE_HXX + +#include <vcl/ctrl.hxx> +#include <sfx2/sidebar/SidebarPanelBase.hxx> +#include <sfx2/sidebar/ControllerItem.hxx> +#include <sfx2/sidebar/IContextChangeReceiver.hxx> +#include <boost/scoped_ptr.hpp> +#include <svx/rectenum.hxx> +#include <svl/poolitem.hxx> +#include <tools/fldunit.hxx> +#include <com/sun/star/ui/XSidebar.hpp> + +class DialControl; +class SdrView; +class FixedText; +class MetricField; +class CheckBox; +class MetricBox; + + +namespace svx { namespace sidebar { + +class SidebarDialControl; + +class PosSizePropertyPanel +: public Control, + public ::sfx2::sidebar::IContextChangeReceiver, + public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface +{ +public: + static PosSizePropertyPanel* Create( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings, + const cssu::Reference<css::ui::XSidebar>& rxSidebar); + + 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(); + void ShowMenu (void); + +private: + //Position + ::boost::scoped_ptr< FixedText > mpFtPosX; + ::boost::scoped_ptr< MetricField > mpMtrPosX; + ::boost::scoped_ptr< FixedText > mpFtPosY; + ::boost::scoped_ptr< MetricField > mpMtrPosY; + + // size + ::boost::scoped_ptr< FixedText > mpFtWidth; + ::boost::scoped_ptr< MetricField > mpMtrWidth; + ::boost::scoped_ptr< FixedText > mpFtHeight; + ::boost::scoped_ptr< MetricField > mpMtrHeight; + ::boost::scoped_ptr< CheckBox > mpCbxScale; + + //rotation + ::boost::scoped_ptr< FixedText > mpFtAngle; + ::boost::scoped_ptr< MetricBox > mpMtrAngle; + + //rotation control + ::boost::scoped_ptr<SidebarDialControl> mpDial; + + //flip + ::boost::scoped_ptr< FixedText > mpFtFlip; + ::boost::scoped_ptr< Window > mpFlipTbxBackground; + ::boost::scoped_ptr< ToolBox > mpFlipTbx; + + // Internal variables + Rectangle maRect; + const SdrView* mpView; + sal_uInt32 mlOldWidth; + sal_uInt32 mlOldHeight; + RECT_POINT meRP; + Point maAnchorPos; //anchor position + long mlRotX; + long mlRotY; + Fraction maUIScale; + SfxMapUnit mePoolUnit; + FieldUnit meDlgUnit; + + // Controller Items + ::sfx2::sidebar::ControllerItem maTransfPosXControl; + ::sfx2::sidebar::ControllerItem maTransfPosYControl; + ::sfx2::sidebar::ControllerItem maTransfWidthControl; + ::sfx2::sidebar::ControllerItem maTransfHeightControl; + + ::sfx2::sidebar::ControllerItem maSvxAngleControl; + ::sfx2::sidebar::ControllerItem maRotXControl; + ::sfx2::sidebar::ControllerItem maRotYControl; + ::sfx2::sidebar::ControllerItem maProPosControl; + ::sfx2::sidebar::ControllerItem maProSizeControl; + ::sfx2::sidebar::ControllerItem maAutoWidthControl; + ::sfx2::sidebar::ControllerItem maAutoHeightControl; + ::sfx2::sidebar::ControllerItem m_aMetricCtl; + + // images from ressource + Image maImgFlipHori; + Image maImgFlipVert; + + cssu::Reference< css::frame::XFrame > mxFrame; + ::sfx2::sidebar::EnumContext maContext; + SfxBindings* mpBindings; + + /// bitfield + bool mbMtrPosXMirror : 1; + bool mbSizeProtected : 1; + bool mbPositionProtected : 1; + bool mbAutoWidth : 1; + bool mbAutoHeight : 1; + bool mbAdjustEnabled : 1; + bool mbIsFlip : 1; + bool mbInDestructor : 1; + + cssu::Reference<css::ui::XSidebar> mxSidebar; + + DECL_LINK( ChangePosXHdl, void * ); + DECL_LINK( ChangePosYHdl, void * ); + DECL_LINK( ChangeWidthHdl, void * ); + DECL_LINK( ChangeHeightHdl, void * ); + DECL_LINK( ClickAutoHdl, void * ); + DECL_LINK( AngleModifiedHdl, void * ); + DECL_LINK( RotationHdl, void * ); + DECL_LINK( FlipHdl, ToolBox * ); + + void SetupIcons(void); + void Initialize(); + void executePosX(); + void executePosY(); + void executeSize(); + + // constructor/destuctor + PosSizePropertyPanel( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings, + const cssu::Reference<css::ui::XSidebar>& rxSidebar); + virtual ~PosSizePropertyPanel(); + + void MetricState( SfxItemState eState, const SfxPoolItem* pState ); + FieldUnit GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState ); + void DisableControls(); +}; + + +} } // end of namespace svx::sidebar + + + +#endif // SVX_PROPERTYPANEL_POSIZEPAGE_HXX + +// eof diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.src b/svx/source/sidebar/possize/PosSizePropertyPanel.src new file mode 100644 index 000000000000..fd5996f51ce9 --- /dev/null +++ b/svx/source/sidebar/possize/PosSizePropertyPanel.src @@ -0,0 +1,223 @@ +/* + * 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 "PosSizePropertyPanel.hrc" +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include <svx/dialogs.hrc> +#include "helpid.hrc" + +#define TOOLBOX_HEIGHT 14 + +Control RID_SIDEBAR_POSSIZE_PANEL +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + + Size = MAP_APPFONT( + PROPERTYPAGE_WIDTH, + BTN_FLIP_HORI_Y + TOOLBOX_HEIGHT + SECTIONPAGE_MARGIN_VERTICAL_BOT); + HelpID = HID_PROPERTYPANEL_POSIZE_SECTION ; + Text = "Position and Size"; + + FixedText FT_WIDTH + { + Pos = MAP_APPFONT ( FT_WIDTH_X, FT_WIDTH_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH , TEXT_HEIGHT) ; + Text [ en-US ] = "~Width:"; + }; + MetricField MTR_FLD_WIDTH + { + Border = TRUE ; + Pos = MAP_APPFONT ( FLD_WIDTH_X, FLD_WIDTH_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH, MBOX_HEIGHT ) ; + QuickHelpText [ en-US ] = "Enter a width for the selected object."; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 9999 ; + StrictFormat = TRUE ; + Unit = FUNIT_INCH; + Last = 9999 ; + SpinSize = 2 ; + HelpID = HID_PROPERTY_PANEL_POSIZE_MTR_FLD_WIDTH; + }; + FixedText FT_HEIGHT + { + Pos = MAP_APPFONT ( FT_HEIGHT_X, FT_HEIGHT_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH , TEXT_HEIGHT) ; + Text [ en-US ] = "H~eight:"; + }; + MetricField MTR_FLD_HEIGHT + { + Border = TRUE ; + Pos = MAP_APPFONT ( FLD_HEIGHT_X, FLD_HEIGHT_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH + 1, MBOX_HEIGHT ) ; + QuickHelpText [ en-US ] = "Enter a height for the selected object."; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 9999 ; + StrictFormat = TRUE ; + Unit = FUNIT_INCH; + Last = 9999 ; + SpinSize = 2 ; + HelpID = HID_PROPERTY_PANEL_POSIZE_MTR_FLD_HEIGHT; + }; + CheckBox CBX_SCALE + { + Pos = MAP_APPFONT ( CBX_X , CBX_Y ) ; + Size = MAP_APPFONT ( MBOX_WIDTH + 30 , CBOX_HEIGHT ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Keep ratio" ; + QuickHelpText [ en-US ] = "Maintain proportions when you resize the selected object."; + HelpID = HID_PROPERTY_PANEL_POSIZE_CBX_SCALE; + }; + //------------ Position ------------ + FixedText FT_SBSHAPE_HORIZONTAL + { + Pos = MAP_APPFONT ( FT_POSITION_X_X, FT_POSITION_X_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH , TEXT_HEIGHT) ; + Text [ en-US ] = "~Horizontal:"; + }; + MetricField MF_SBSHAPE_HORIZONTAL + { + Border = TRUE; + Pos = MAP_APPFONT ( MF_POSITION_X_X , MF_POSITION_X_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH, MBOX_HEIGHT ) ; + QuickHelpText [ en-US ] = "Enter the value for the horizontal position."; + TabStop = TRUE; + Repeat = TRUE; + Spin = TRUE; + Minimum = -120000; + Maximum = 240000; + StrictFormat = TRUE; + DecimalDigits = 2; + Unit = FUNIT_MM; + SpinSize = 10; + HelpID = HID_PROPERTY_PANEL_POSIZE_MF_HORIZONTAL; + }; + FixedText FT_SBSHAPE_VERTICAL + { + Pos = MAP_APPFONT ( FT_POSITION_Y_X , FT_POSITION_Y_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH , TEXT_HEIGHT) ; + Text [ en-US ] = "~Vertical:"; + }; + MetricField MF_SBSHAPE_VERTICAL + { + Border = TRUE; + Pos = MAP_APPFONT ( MF_POSITION_Y_X , MF_POSITION_Y_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH, MBOX_HEIGHT ) ; + QuickHelpText [ en-US ] = "Enter the value for the vertical position."; + TabStop = TRUE; + Repeat = TRUE; + Spin = TRUE; + Minimum = -120000; + Maximum = 240000; + StrictFormat = TRUE; + DecimalDigits = 2; + Unit = FUNIT_MM; + SpinSize = 10; + HelpID = HID_PROPERTY_PANEL_POSIZE_MF_VERTICAL; + }; + FixedText FT_ANGLE + { + Pos = MAP_APPFONT ( FT_ROTATION_X , FT_ROTATION_Y ); + Size = MAP_APPFONT ( TEXT_WIDTH + 50, TEXT_HEIGHT) ; + Text [ en-US ] = "~Rotation:"; + }; + + MetricBox MTR_FLD_ANGLE + { + Border = TRUE ; + Pos = MAP_APPFONT ( MF_ROTATION_X , MF_ROTATION_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH + 10, MBOX_HEIGHT ) ; + QuickHelpText [ en-US ] = "Select the angle for rotation."; + Unit = FUNIT_CUSTOM ; + CustomUnitText [ en-US ] = " degrees"; + DecimalDigits = 2; + Minimum = -18000; // set minmun value or it will be 0 as default + TabStop = TRUE ; + DropDown = TRUE ; + HelpID = HID_PROPERTY_PANEL_POSIZE_MTR_FLD_ANGLE; + }; + + FixedText FT_FLIP + { + Pos = MAP_APPFONT ( FT_FLIP_X , FT_FLIP_Y ); + Size = MAP_APPFONT ( PROPERTYPAGE_WIDTH - SECTIONPAGE_MARGIN_HORIZONTAL*2 - 40 - CONTROL_SPACING_HORIZONTAL - TOOLBOX_ITEM_WIDTH * 2 , TEXT_HEIGHT) ;//20 wj + Text [ en-US ] = "~Flip:"; + }; + + ToolBox TBX_FLIP + { + Pos = MAP_APPFONT ( BTN_FLIP_HORI_X , BTN_FLIP_HORI_Y ); + Size = MAP_APPFONT ( TOOLBOX_ITEM_WIDTH * 2, TOOLBOX_HEIGHT); + SVLook = TRUE ; + Border = FALSE ; + HelpID = HID_PROPERTY_PANEL_POSIZE_TBX_FLIP; + Text = "Flip"; + ItemList = + { + ToolBoxItem + { + Identifier = FLIP_VERTICAL ; + Text [ en-US ] = "Flip Vertically" ; + HelpID = HID_PROPERTY_PANEL_POSIZE_FLIP_VERTICAL; + ItemBitmap = Bitmap + { + File = "symphony/FlipVertically_16x16.png"; + }; + }; + ToolBoxItem + { + Identifier = FLIP_HORIZONTAL ; + Text [ en-US ] = "Flip Horizontally" ; + HelpID = HID_PROPERTY_PANEL_POSIZE_FLIP_HORIZONTAL; + ItemBitmap = Bitmap + { + File = "symphony/FlipHorizontally_16x16.png"; + }; + }; + }; + }; + + String STR_QH_HORI_FLIP + { + Text [ en-US ] = "Flip the selected object horizontally."; + }; + String STR_QH_VERT_FLIP + { + Text [ en-US ] = "Flip the selected object vertically."; + }; + + Image IMG_HORI_FLIP + { + ImageBitmap = Bitmap{File = "symphony/FlipHorizontally_16x16.png";}; + }; + Image IMG_VERT_FLIP + { + ImageBitmap = Bitmap{File = "symphony/FlipVertically_16x16.png";}; + }; + + Control DIAL_CONTROL + { + Pos = MAP_APPFONT ( ROTATE_CONTROL_X , ROTATE_CONTROL_Y ); + Size = MAP_PIXEL( 50, 50 ); + HelpID = HID_PROPERTY_PANEL_POSIZE_DIAL_CONTROL; + }; +}; + +// eof diff --git a/svx/source/sidebar/possize/SidebarDialControl.cxx b/svx/source/sidebar/possize/SidebarDialControl.cxx new file mode 100644 index 000000000000..374c9051375a --- /dev/null +++ b/svx/source/sidebar/possize/SidebarDialControl.cxx @@ -0,0 +1,82 @@ +/* + * 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 <svx/sidebar/SidebarDialControl.hxx> +#include "SidebarDialControlBmp.hxx" + +#include <vcl/svapp.hxx> + +namespace svx { namespace sidebar { + +SidebarDialControl::SidebarDialControl ( + Window* pParent, + const ResId& rResId) + : svx::DialControl(pParent, rResId) +{ + mpImpl->mpBmpEnabled.reset(new SidebarDialControlBmp(*this)); + mpImpl->mpBmpDisabled.reset(new SidebarDialControlBmp(*this)); + mpImpl->mpBmpBuffered.reset(new SidebarDialControlBmp(*this)); + Init(GetOutputSizePixel()); +} + + + + +SidebarDialControl::~SidebarDialControl (void) +{ +} + + + + +void SidebarDialControl::MouseButtonDown( const MouseEvent& rMEvt ) +{ + if( rMEvt.IsLeft() ) + { + GrabFocus(); + CaptureMouse(); + mpImpl->mnOldAngle = mpImpl->mnAngle; + HandleMouseEvent( rMEvt.GetPosPixel(), true ); + } +} + + + + +void SidebarDialControl::HandleMouseEvent( const Point& rPos, bool bInitial ) +{ + long nX = rPos.X() - mpImpl->mnCenterX; + long nY = mpImpl->mnCenterY - rPos.Y(); + double fH = sqrt( static_cast< double >( nX ) * nX + static_cast< double >( nY ) * nY ); + if( fH != 0.0 ) + { + double fAngle = acos( nX / fH ); + sal_Int32 nAngle = static_cast< sal_Int32 >( fAngle / F_PI180 * 100.0 ); + if( nY < 0 ) + nAngle = 36000 - nAngle; + if( bInitial ) // round to entire 15 degrees + nAngle = ((nAngle + 750) / 1500) * 1500; + + if (Application::GetSettings().GetLayoutRTL()) + nAngle = 18000 - nAngle; + SetRotation( nAngle, true ); + } +} + +} } // end of namespace svx::sidebar + +// eof diff --git a/svx/source/sidebar/possize/SidebarDialControlBmp.cxx b/svx/source/sidebar/possize/SidebarDialControlBmp.cxx new file mode 100644 index 000000000000..f702632250a2 --- /dev/null +++ b/svx/source/sidebar/possize/SidebarDialControlBmp.cxx @@ -0,0 +1,87 @@ +/* + * 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 "SidebarDialControlBmp.hxx" + +#include <sfx2/sidebar/Theme.hxx> + +#include <vcl/svapp.hxx> + +#include "PosSizePropertyPanel.hrc" +#include <svx/dialogs.hrc> +#include <svx/dialmgr.hxx> +#include <svx/svdstr.hrc> + +namespace svx { namespace sidebar { + +SidebarDialControlBmp::SidebarDialControlBmp (Window& rParent) + : DialControlBmp(rParent) +{ +} + + + + +SidebarDialControlBmp::~SidebarDialControlBmp (void) +{ +} + + + + +void SidebarDialControlBmp::DrawElements ( + const String& /*rText*/, + sal_Int32 nAngle) +{ + if (Application::GetSettings().GetLayoutRTL()) + nAngle = 18000 - nAngle; + double fAngle = nAngle * F_PI180 / 100.0; + double fSin = sin( fAngle ); + double fCos = cos( fAngle ); + DrawText( maRect, String(), mbEnabled ? 0 : TEXT_DRAW_DISABLE ); + const sal_Int32 nDx (fCos * (maRect.GetWidth()-4) / 2); + const sal_Int32 nDy (-fSin * (maRect.GetHeight()-4) / 2); + Point pt1( maRect.Center() ); + Point pt2( pt1.X() + nDx, pt1.Y() + nDy); + if ( ! sfx2::sidebar::Theme::IsHighContrastMode()) + SetLineColor( Color( 60, 93, 138 ) ); + else + SetLineColor(COL_BLACK);//Application::GetSettings().GetStyleSettings().GetFieldTextColor() + DrawLine( pt1, pt2 ); +} + + + + +void SidebarDialControlBmp::DrawBackground() +{ + SetLineColor(); + SetFillColor(sfx2::sidebar::Theme::GetColor(sfx2::sidebar::Theme::Paint_PanelBackground)); + DrawRect(maRect); + + const BitmapEx aBitmapEx(SVX_RES(IMG_DIALCONTROL)); + // Size aImageSize(aBitmapEx.GetSizePixel()); + // aImageSize.Width() -= 1; + // aImageSize.Height() -= 1; + SetAntialiasing(ANTIALIASING_ENABLE_B2DDRAW | ANTIALIASING_PIXELSNAPHAIRLINE); + DrawBitmapEx(maRect.TopLeft(), /*aImageSize,*/ aBitmapEx); +} + + +} } // end of namespace svx::sidebar + +// eof diff --git a/svx/source/sidebar/possize/SidebarDialControlBmp.hxx b/svx/source/sidebar/possize/SidebarDialControlBmp.hxx new file mode 100644 index 000000000000..d1cb6be9db26 --- /dev/null +++ b/svx/source/sidebar/possize/SidebarDialControlBmp.hxx @@ -0,0 +1,43 @@ +/* + * 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 SVX_SIDEBAR_POSSIZE_DIAL_CONTROL_BMP_HXX +#define SVX_SIDEBAR_POSSIZE_DIAL_CONTROL_BMP_HXX + +#include <svx/dialcontrol.hxx> + +namespace svx { namespace sidebar { + + +class SidebarDialControlBmp + : public svx::DialControlBmp +{ +public: + explicit SidebarDialControlBmp( Window& rParent); + virtual ~SidebarDialControlBmp (void); + + virtual void DrawElements( const String& rText, sal_Int32 nAngle ); + virtual void DrawBackground(); + +private: +}; + +} } // end of namespace svx::sidebar + +#endif + +// eof diff --git a/svx/source/sidebar/text/SvxSBFontNameBox.cxx b/svx/source/sidebar/text/SvxSBFontNameBox.cxx new file mode 100644 index 000000000000..c60ece605b4e --- /dev/null +++ b/svx/source/sidebar/text/SvxSBFontNameBox.cxx @@ -0,0 +1,171 @@ +/* + * 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 "SvxSBFontNameBox.hxx" + +#include <unotools/fontoptions.hxx> +#include <sfx2/objsh.hxx> +#include <sfx2/dispatch.hxx> +#include <editeng/flstitem.hxx> +#include <editeng/editids.hrc> +#include <editeng/fontitem.hxx> + + +const static sal_uInt16 MAX_MRU_FONTNAME_ENTRIES = 5; + + +namespace svx { namespace sidebar { + +namespace { + bool GetDocFontList_Impl( const FontList** ppFontList, SvxSBFontNameBox* pBox ) + { + bool bChanged = false; + const SfxObjectShell* pDocSh = SfxObjectShell::Current(); + SvxFontListItem* pFontListItem = NULL; + + if ( pDocSh ) + pFontListItem = + (SvxFontListItem*)pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST ); + + if ( pFontListItem ) + { + const FontList* pNewFontList = pFontListItem->GetFontList(); + DBG_ASSERT( pNewFontList, "Doc-FontList not available!" ); + + if ( !*ppFontList ) + { + *ppFontList = pNewFontList; + bChanged = true; + } + else + { + bChanged = ( *ppFontList != pNewFontList ); + if( !bChanged && pBox!=NULL ) + bChanged = ( pBox->GetListCount() != pNewFontList->GetFontNameCount() ); + //HACK(vergleich ist unvollstaendig) + if ( bChanged ) + *ppFontList = pNewFontList; + } + + if ( pBox ) + pBox->Enable(); + } + else if ( pBox ) + pBox->Disable(); + + // in die FontBox ggf. auch die neue Liste f"ullen + if ( pBox && bChanged ) + { + if ( *ppFontList ) + pBox->Fill( *ppFontList ); + else + pBox->Clear(); + } + return bChanged; + } +} + + + + +SvxSBFontNameBox::SvxSBFontNameBox( Window* pParent, const ResId& rResId ) : + FontNameBox ( pParent, rResId ) +, pFontList ( NULL ) +, nFtCount ( 0 ) +, bInput(false) +, pBindings(NULL) +{ + EnableControls_Impl(); +// StartListening( *SFX_APP() ); +} + +void SvxSBFontNameBox::EnableControls_Impl() +{ + SvtFontOptions aFontOpt; + bool bEnable = aFontOpt.IsFontHistoryEnabled(); + sal_uInt16 nEntries = bEnable ? MAX_MRU_FONTNAME_ENTRIES : 0; + if ( GetMaxMRUCount() != nEntries ) + { + // refill in the next GetFocus-Handler + pFontList = NULL; + Clear(); + SetMaxMRUCount( nEntries ); + } + + bEnable = aFontOpt.IsFontWYSIWYGEnabled(); + EnableWYSIWYG( bEnable ); +} + +void SvxSBFontNameBox::FillList() +{ + Selection aOldSel = GetSelection(); + GetDocFontList_Impl( &pFontList, this ); + aCurText = GetText(); + SetSelection( aOldSel ); +} + +long SvxSBFontNameBox::PreNotify( NotifyEvent& rNEvt ) +{ + const sal_uInt16 nType (rNEvt.GetType()); + + if ( EVENT_MOUSEBUTTONDOWN == nType || EVENT_GETFOCUS == nType ) + FillList(); + return FontNameBox::PreNotify( rNEvt ); +} +//<<modify +long SvxSBFontNameBox::Notify( NotifyEvent& rNEvt) //SfxBroadcaster& rBC, const SfxHint& rHint +{ + //SfxItemSetHint* pHint = PTR_CAST(SfxItemSetHint, &rHint); + //if ( pHint ) + // EnableControls_Impl(); + bool bHandle = 0; + if ( rNEvt.GetType() == EVENT_KEYINPUT ) + { + const sal_uInt16 nCode (rNEvt.GetKeyEvent()->GetKeyCode().GetCode()); + + if( nCode == KEY_RETURN) + { + bHandle = 1; + Select(); + } + } + + return bHandle ? bHandle : FontNameBox::Notify( rNEvt ); +} +void SvxSBFontNameBox::Select() +{ + FontNameBox::Select(); + + if ( !IsTravelSelect() ) + { + FillList(); + FontInfo aInfo( pFontList->Get( GetText(),WEIGHT_NORMAL, ITALIC_NORMAL ) );//meWeight, meItalic + + SvxFontItem aFontItem( aInfo.GetFamily(), aInfo.GetName(), aInfo.GetStyleName(), + aInfo.GetPitch(), aInfo.GetCharSet(), SID_ATTR_CHAR_FONT ); + + pBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONT, SFX_CALLMODE_RECORD, &aFontItem, 0L ); + pBindings->Invalidate(SID_ATTR_CHAR_FONT,true,false); + } +} +void SvxSBFontNameBox::SetBindings(SfxBindings* pB) +{ + pBindings = pB; +} + +} } // end of namespace svx::sidebar diff --git a/svx/source/sidebar/text/SvxSBFontNameBox.hxx b/svx/source/sidebar/text/SvxSBFontNameBox.hxx new file mode 100644 index 000000000000..65fcc109fb8e --- /dev/null +++ b/svx/source/sidebar/text/SvxSBFontNameBox.hxx @@ -0,0 +1,76 @@ +/* + * 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 SVX_SIDEBAR_SB_FONT_NAME_BOX_HXX +#define SVX_SIDEBAR_SB_FONT_NAME_BOX_HXX + +#include <sfx2/bindings.hxx> +#include <svtools/ctrlbox.hxx> +#include <svtools/ctrltool.hxx> + +/* +#include <sfx2/sectionpage.hxx> +#include <svx/svxdllapi.h> +#include <vcl/fixed.hxx> + +#include <vcl/button.hxx> +#include <svl/lstner.hxx> +#include <vcl/toolbox.hxx> + +#include <svx/tbxcolorupdate.hxx> +#include <svx/svxenum.hxx> +#include <svx/fhgtitem.hxx> + +#define FONT_COLOR 1 +#define BACK_COLOR 2 +*/ +namespace svx +{ + class ToolboxButtonColorUpdater; +} + +namespace svx { namespace sidebar { + +class SvxSBFontNameBox : public FontNameBox//, public SfxListener +{ +private: + const FontList* pFontList; + Font aCurFont; + String aCurText; + sal_uInt16 nFtCount; + bool bInput; + void EnableControls_Impl(); + SfxBindings* pBindings;// +protected: + virtual void Select(); + +public: + SvxSBFontNameBox( Window* pParent, const ResId& rResId ); + void FillList(); + sal_uInt16 GetListCount() { return nFtCount; } + void Clear() { FontNameBox::Clear(); nFtCount = 0; } + void Fill( const FontList* pList ) + { FontNameBox::Fill( pList ); + nFtCount = pList->GetFontNameCount(); } + void SetBindings(SfxBindings* pBinding);// + virtual long PreNotify( NotifyEvent& rNEvt ); + virtual long Notify( NotifyEvent& rNEvt );// +}; + +} } // end of namespace svx::sidebar + +#endif diff --git a/svx/source/sidebar/text/TextCharacterSpacingControl.cxx b/svx/source/sidebar/text/TextCharacterSpacingControl.cxx new file mode 100644 index 000000000000..59fdfdc0a5d1 --- /dev/null +++ b/svx/source/sidebar/text/TextCharacterSpacingControl.cxx @@ -0,0 +1,463 @@ +/* + * 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 "TextCharacterSpacingControl.hxx" +#include "TextPropertyPanel.hrc" +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include <svx/dialogs.hrc> +#include <svx/dialmgr.hxx> +#include <unotools/viewoptions.hxx> +#include <editeng/kernitem.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/sidebar/Theme.hxx> + +namespace svx { namespace sidebar { +TextCharacterSpacingControl::TextCharacterSpacingControl(Window* pParent, svx::sidebar::TextPropertyPanel& rPanel) +: PopupControl( pParent,SVX_RES(RID_POPUPPANEL_TEXTPAGE_SPACING)) +, mrTextPropertyPanel(rPanel) +, mpBindings(NULL) +, maVSSpacing (ValueSetWithTextControl::IMAGE_TEXT,this, SVX_RES(VS_SPACING)) +, maLastCus (this, SVX_RES(FT_LASTCUSTOM)) +//, maBorder (this, SVX_RES(CT_BORDER)) +, maFTSpacing (this, SVX_RES(FT_SPACING)) +, maLBKerning (this, SVX_RES(LB_KERNING)) +, maFTBy (this, SVX_RES(FT_BY)) +, maEditKerning (this, SVX_RES(ED_KERNING)) + +, mpImg (NULL) +, mpImgSel (NULL) +, mpStr (NULL) +, mpStrTip (NULL) + +, maImgCus (SVX_RES(IMG_CUSTOM)) +, maImgCusGrey (SVX_RES(IMG_CUSTOM_GRAY)) +, maStrCus (SVX_RES(STR_CUSTOM)) +, maStrCusE (SVX_RES(STR_CUSTOM_E_TIP)) //add +, maStrCusC (SVX_RES(STR_CUSTOM_C_TIP)) //add +, maStrCusN (SVX_RES(STR_NORMAL_TIP)) //add +, maStrUnit (SVX_RES(STR_PT)) //add + +, mnCustomKern(0) +, mnLastCus ( SPACING_NOCUSTOM ) +, mbCusEnable(false) +, mbVS(true) +{ + initial(); + FreeResource(); + mpBindings = mrTextPropertyPanel.GetBindings(); + Link aLink = LINK(this, TextCharacterSpacingControl, KerningSelectHdl); + maLBKerning.SetSelectHdl(aLink); + aLink =LINK(this, TextCharacterSpacingControl, KerningModifyHdl); + maEditKerning.SetModifyHdl(aLink); + +} +TextCharacterSpacingControl::~TextCharacterSpacingControl() +{ + delete[] mpImg; + delete[] mpImgSel; + delete[] mpStr; + delete[] mpStrTip; +} + +void TextCharacterSpacingControl::initial() +{ + maVSSpacing.SetStyle( maVSSpacing.GetStyle()| WB_3DLOOK | WB_NO_DIRECTSELECT ); + { + maVSSpacing.SetControlBackground(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); + maVSSpacing.SetColor(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); + maVSSpacing.SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); + maFTSpacing.SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); + maFTBy.SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); + } + mpImg = new Image[5]; + mpImg[0] = Image(SVX_RES(IMG_VERY_TIGHT)); + mpImg[1] = Image(SVX_RES(IMG_TIGHT)); + mpImg[2] = Image(SVX_RES(IMG_NORMAL)); + mpImg[3] = Image(SVX_RES(IMG_LOOSE)); + mpImg[4] = Image(SVX_RES(IMG_VERY_LOOSE)); + + mpImgSel = new Image[5]; + mpImgSel[0] = Image(SVX_RES(IMG_VERY_TIGHT_S)); + mpImgSel[1] = Image(SVX_RES(IMG_TIGHT_S)); + mpImgSel[2] = Image(SVX_RES(IMG_NORMAL_S)); + mpImgSel[3] = Image(SVX_RES(IMG_LOOSE_S)); + mpImgSel[4] = Image(SVX_RES(IMG_VERY_LOOSE_S)); + + mpStr = new XubString[5]; + mpStr[0] = XubString(SVX_RES(STR_VERY_TIGHT)); + mpStr[1] = XubString(SVX_RES(STR_TIGHT)); + mpStr[2] = XubString(SVX_RES(STR_NORMAL)); + mpStr[3] = XubString(SVX_RES(STR_LOOSE)); + mpStr[4] = XubString(SVX_RES(STR_VERY_LOOSE)); + + + mpStrTip = new XubString[5]; + mpStrTip[0] = XubString(SVX_RES(STR_VERY_TIGHT_TIP)); + mpStrTip[1] = XubString(SVX_RES(STR_TIGHT_TIP)); + mpStrTip[2] = XubString(SVX_RES(STR_NORMAL_TIP)); + mpStrTip[3] = XubString(SVX_RES(STR_LOOSE_TIP)); + mpStrTip[4] = XubString(SVX_RES(STR_VERY_LOOSE_TIP)); + + for (int i=0;i<5;i++) + maVSSpacing.AddItem(mpImg[i], &mpImgSel[i],mpStr[i],&mpStrTip[i]); + + maVSSpacing.AddItem( maImgCus, 0, maStrCus, 0 ); + + maVSSpacing.SetNoSelection(); + Link aLink = LINK(this, TextCharacterSpacingControl,VSSelHdl ); + maVSSpacing.SetSelectHdl(aLink); + maVSSpacing.StartSelection(); + maVSSpacing.Show(); +} +void TextCharacterSpacingControl::ToGetFocus() +{ + if(!mbVS) + maLBKerning.GrabFocus(); + else + maVSSpacing.GrabFocus(); +} + +void TextCharacterSpacingControl::Rearrange(bool bLBAvailable,bool bAvailable, long nKerning) +{ + mbVS = true; + maVSSpacing.SetNoSelection(); + SvtViewOptions aWinOpt( E_WINDOW, SIDEBAR_SPACING_GLOBAL_VALUE ); + if ( aWinOpt.Exists() ) + { + ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt.GetUserData(); + ::rtl::OUString aTmp; + if ( aSeq.getLength()) + aSeq[0].Value >>= aTmp; + + String aWinData( aTmp ); + mnCustomKern = aWinData.ToInt32(); + mnLastCus = SPACING_CLOSE_BY_CUS_EDIT; + mbCusEnable = true; + } + else + { + mnLastCus = SPACING_NOCUSTOM; + mbCusEnable = false; + } + + if( !mnLastCus ) + { + maVSSpacing.ReplaceItemImages(6, maImgCusGrey,0); + } + else + { + //set custom tips + maVSSpacing.ReplaceItemImages(6, maImgCus,0); + if(mnCustomKern > 0) + { + String aStrTip( maStrCusE); //LAST CUSTOM no tip defect //add + aStrTip.Append( OUString::number( (double)mnCustomKern / 10)); + aStrTip.Append(maStrUnit); // modify + maVSSpacing.SetItemText(6,aStrTip); + } + else if(mnCustomKern < 0) + { + String aStrTip(maStrCusC) ; //LAST CUSTOM no tip defect //add + aStrTip.Append( OUString::number( (double)-mnCustomKern / 10)); + aStrTip.Append(maStrUnit); // modify + maVSSpacing.SetItemText( 6, aStrTip ); + } + else + { + String aStrTip(maStrCusN) ; //LAST CUSTOM no tip defect //add + maVSSpacing.SetItemText( 6, aStrTip ); + } + + } + + if(bLBAvailable && bAvailable) + { + maLBKerning.Enable(); + maFTSpacing.Enable(); + + SfxMapUnit eUnit = mrTextPropertyPanel.GetSpaceController().GetCoreMetric(); + MapUnit eOrgUnit = (MapUnit)eUnit; + MapUnit ePntUnit( MAP_POINT ); + long nBig = maEditKerning.Normalize(nKerning); + nKerning = LogicToLogic( nBig, eOrgUnit, ePntUnit ); + + if ( nKerning > 0 ) + { + maFTBy.Enable(); + maEditKerning.Enable(); + maEditKerning.SetMax( 9999 ); + maEditKerning.SetLast( 9999 ); + maEditKerning.SetValue( nKerning ); + maLBKerning.SelectEntryPos( SIDEBAR_SPACE_EXPAND ); + if(nKerning == 30) + { + maVSSpacing.SelectItem(4); + } + else if(nKerning == 60) + { + maVSSpacing.SelectItem(5); + } + else + { + maVSSpacing.SetNoSelection(); + maVSSpacing.SelectItem(0); + mbVS = false; + } + } + else if ( nKerning < 0 ) + { + maFTBy.Enable(); + maEditKerning.Enable(); + maEditKerning.SetValue( -nKerning ); + maLBKerning.SelectEntryPos( SIDEBAR_SPACE_CONDENSED ); + long nMax = mrTextPropertyPanel.GetSelFontSize()/6; + maEditKerning.SetMax( maEditKerning.Normalize( nMax ), FUNIT_POINT ); + maEditKerning.SetLast( maEditKerning.GetMax( maEditKerning.GetUnit() ) ); + if( nKerning == -30 ) + { + maVSSpacing.SelectItem(1); + } + else if( nKerning == -15 ) + { + maVSSpacing.SelectItem(2); + } + else + { + maVSSpacing.SetNoSelection(); + maVSSpacing.SelectItem(0); + mbVS = false; + } + } + else + { + maVSSpacing.SelectItem(3); + maLBKerning.SelectEntryPos( SIDEBAR_SPACE_NORMAL ); + maFTBy.Disable(); + maEditKerning.Disable(); + maEditKerning.SetValue( 0 ); + maEditKerning.SetMax( 9999 ); + maEditKerning.SetLast( 9999 ); + } + } + else if(bLBAvailable && !bAvailable) + { + //modified + maVSSpacing.SetNoSelection(); + maVSSpacing.SelectItem(0); + mbVS = false; + maLBKerning.Enable(); + maFTSpacing.Enable(); + maLBKerning.SetNoSelection(); + maEditKerning.SetText(String()); + maEditKerning.Disable(); + maFTBy.Disable(); + } + else + { + maVSSpacing.SetNoSelection(); + maVSSpacing.SelectItem(0); + mbVS = false; + maEditKerning.SetText(String()); + maLBKerning.SetNoSelection(); + maLBKerning.Disable(); + maFTSpacing.Disable(); + maEditKerning.Disable(); + maFTBy.Disable(); + } + GetFocus(); + maVSSpacing.Format(); + maVSSpacing.StartSelection(); +} +IMPL_LINK(TextCharacterSpacingControl, VSSelHdl, void *, pControl) +{ + mnLastCus = SPACING_CLOSE_BY_CLICK_ICON; + + if(pControl == &maVSSpacing) + { + sal_uInt16 iPos = maVSSpacing.GetSelectItemId(); + short nKern = 0; + SfxMapUnit eUnit = mrTextPropertyPanel.GetSpaceController().GetCoreMetric(); + long nVal = 0; + if(iPos == 1) + { + nVal = LogicToLogic(30, MAP_POINT, (MapUnit)eUnit); + nKern = (short)maEditKerning.Denormalize(nVal); + SvxKerningItem aKernItem(-nKern, SID_ATTR_CHAR_KERNING); + mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SFX_CALLMODE_RECORD, &aKernItem, 0L); + mrTextPropertyPanel.SetSpacing(-nKern); + mnLastCus = SPACING_CLOSE_BY_CLICK_ICON; + } + else if(iPos == 2) + { + nVal = LogicToLogic(15, MAP_POINT, (MapUnit)eUnit); + nKern = (short)maEditKerning.Denormalize(nVal); + SvxKerningItem aKernItem(-nKern, SID_ATTR_CHAR_KERNING); + mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SFX_CALLMODE_RECORD, &aKernItem, 0L); + mrTextPropertyPanel.SetSpacing(-nKern); + mnLastCus = SPACING_CLOSE_BY_CLICK_ICON; + } + else if(iPos == 3) + { + SvxKerningItem aKernItem(0, SID_ATTR_CHAR_KERNING); + mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SFX_CALLMODE_RECORD, &aKernItem, 0L); + mrTextPropertyPanel.SetSpacing(0); + mnLastCus = SPACING_CLOSE_BY_CLICK_ICON; + } + else if(iPos == 4) + { + nVal = LogicToLogic(30, MAP_POINT, (MapUnit)eUnit); + nKern = (short)maEditKerning.Denormalize(nVal); + SvxKerningItem aKernItem(nKern, SID_ATTR_CHAR_KERNING); + mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SFX_CALLMODE_RECORD, &aKernItem, 0L); + mrTextPropertyPanel.SetSpacing(nKern); + mnLastCus = SPACING_CLOSE_BY_CLICK_ICON; + } + else if(iPos == 5) + { + nVal = LogicToLogic(60, MAP_POINT, (MapUnit)eUnit); + nKern = (short)maEditKerning.Denormalize(nVal); + SvxKerningItem aKernItem(nKern, SID_ATTR_CHAR_KERNING); + mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SFX_CALLMODE_RECORD, &aKernItem, 0L); + mrTextPropertyPanel.SetSpacing(nKern); + mnLastCus = SPACING_CLOSE_BY_CLICK_ICON; + } + else if(iPos == 6) + { + //modified + if(mbCusEnable) + { + nVal = LogicToLogic(mnCustomKern, MAP_POINT, (MapUnit)eUnit); + nKern = (short)maEditKerning.Denormalize(nVal); + SvxKerningItem aKernItem(nKern , SID_ATTR_CHAR_KERNING); + mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SFX_CALLMODE_RECORD, &aKernItem, 0L); + mrTextPropertyPanel.SetSpacing(nKern); + mnLastCus = SPACING_CLOSE_BY_CLICK_ICON; + } + else + { + maVSSpacing.SetNoSelection(); //add , set no selection and keep the last select item + maVSSpacing.Format(); + Invalidate(); + maVSSpacing.StartSelection(); + } + //modify end + } + + if(iPos < 6 || (iPos == 6 && mbCusEnable)) //add + mrTextPropertyPanel.EndSpacingPopupMode(); + } + + + + return 0; +} + +IMPL_LINK(TextCharacterSpacingControl, KerningSelectHdl, ListBox*, EMPTYARG) +{ + if ( maLBKerning.GetSelectEntryPos() > 0 ) + { + maFTBy.Enable(); + maEditKerning.Enable(); + } + else + { + maEditKerning.SetValue( 0 ); + maFTBy.Disable(); + maEditKerning.Disable(); + } + + if ( maVSSpacing.GetSelectItemId() > 0 ) + { + maVSSpacing.SetNoSelection(); + maVSSpacing.SelectItem(0); + maVSSpacing.Format(); + Invalidate(); + maVSSpacing.StartSelection(); + } + KerningModifyHdl( NULL ); + return 0; +} +IMPL_LINK(TextCharacterSpacingControl, KerningModifyHdl, MetricField*, EMPTYARG) +{ + if ( maVSSpacing.GetSelectItemId() > 0 ) + { + maVSSpacing.SetNoSelection(); + maVSSpacing.SelectItem(0); + maVSSpacing.Format(); + Invalidate(); + maVSSpacing.StartSelection(); + } + sal_uInt16 nPos = maLBKerning.GetSelectEntryPos(); + short nKern = 0; + SfxMapUnit eUnit = mrTextPropertyPanel.GetSpaceController().GetCoreMetric(); + mnLastCus = SPACING_CLOSE_BY_CUS_EDIT; + if ( nPos == SIDEBAR_SPACE_EXPAND || nPos == SIDEBAR_SPACE_CONDENSED ) + { + long nTmp = static_cast<long>(maEditKerning.GetValue()); + if ( nPos == SIDEBAR_SPACE_CONDENSED ) + { + long nMax = mrTextPropertyPanel.GetSelFontSize()/6; + maEditKerning.SetMax( maEditKerning.Normalize( nMax ), FUNIT_TWIP ); + maEditKerning.SetLast( maEditKerning.GetMax( maEditKerning.GetUnit() ) ); + if(nTmp > maEditKerning.GetMax()) + nTmp = maEditKerning.GetMax(); + mnCustomKern = -nTmp; + long nVal = LogicToLogic( nTmp, MAP_POINT, (MapUnit)eUnit ); + nKern = (short)maEditKerning.Denormalize( nVal ); + nKern *= - 1; + } + else + { + maEditKerning.SetMax( 9999 ); + maEditKerning.SetLast( 9999 ); + if(nTmp > maEditKerning.GetMax(FUNIT_TWIP)) + nTmp = maEditKerning.GetMax(FUNIT_TWIP); + mnCustomKern = nTmp; + long nVal = LogicToLogic( nTmp, MAP_POINT, (MapUnit)eUnit ); + nKern = (short)maEditKerning.Denormalize( nVal ); + } + } + else + { + mnCustomKern = 0; + } + SvxKerningItem aKernItem(nKern, SID_ATTR_CHAR_KERNING); + mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SFX_CALLMODE_RECORD, &aKernItem, 0L); + mrTextPropertyPanel.SetSpacing(nKern); + return 0; +} +short TextCharacterSpacingControl::GetLastCustomState() +{ + return mnLastCus; +} +long TextCharacterSpacingControl::GetLastCustomValue() +{ + return mnCustomKern; +} + +}} // end of namespace sidebar diff --git a/svx/source/sidebar/text/TextCharacterSpacingControl.hxx b/svx/source/sidebar/text/TextCharacterSpacingControl.hxx new file mode 100644 index 000000000000..89c07031da94 --- /dev/null +++ b/svx/source/sidebar/text/TextCharacterSpacingControl.hxx @@ -0,0 +1,93 @@ +/* + * 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 _SVX_SIDEBAR_CHARACTER_SPACING_CONTROL_HXX_ +#define _SVX_SIDEBAR_CHARACTER_SPACING_CONTROL_HXX_ + +#include "svx/sidebar/PopupControl.hxx" +#include "svx/sidebar/ValueSetWithTextControl.hxx" +#include <sfx2/bindings.hxx> +#include <svtools/ctrlbox.hxx> +#include <svtools/ctrltool.hxx> +#include "TextPropertyPanel.hxx" +#include <vcl/fixed.hxx> + + +namespace svx { namespace sidebar { +#define SPACING_NOCUSTOM 0 +#define SPACING_CLOSE_BY_CLICK_ICON -1 +#define SPACING_CLOSE_BY_CUS_EDIT 1 + +#define SIDEBAR_SPACING_GLOBAL_VALUE String("PopupPanal_Spacing", 18, RTL_TEXTENCODING_ASCII_US) + +#define SIDEBAR_SPACE_NORMAL 0 +#define SIDEBAR_SPACE_EXPAND 1 +#define SIDEBAR_SPACE_CONDENSED 2 +class TextCharacterSpacingControl:public svx::sidebar::PopupControl +{ +public: + TextCharacterSpacingControl(Window* pParent, svx::sidebar::TextPropertyPanel& rPanel); + ~TextCharacterSpacingControl(); + void ToGetFocus(); + void Rearrange(bool bLBAvailable,bool bAvailable, long nKerning); + //virtual void Paint(const Rectangle& rect); + + //add + short GetLastCustomState(); + long GetLastCustomValue(); + //add end + +private: + svx::sidebar::TextPropertyPanel& mrTextPropertyPanel; + SfxBindings* mpBindings; + + ValueSetWithTextControl maVSSpacing; + + FixedText maLastCus; +// Control maBorder; + + FixedText maFTSpacing; + ListBox maLBKerning; + FixedText maFTBy; + MetricField maEditKerning; + + Image* mpImg; + Image* mpImgSel; + XubString* mpStr; + XubString* mpStrTip; + + Image maImgCus; + Image maImgCusGrey; + XubString maStrCus; + XubString maStrCusE; //add + XubString maStrCusC; //add + XubString maStrCusN; //add + XubString maStrUnit; //add + + long mnCustomKern; + short mnLastCus; + bool mbCusEnable; + bool mbVS; + + void initial(); + DECL_LINK(VSSelHdl, void*); + DECL_LINK(KerningSelectHdl, ListBox*); + DECL_LINK(KerningModifyHdl, MetricField*); +}; +}} + +#endif diff --git a/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx b/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx new file mode 100644 index 000000000000..56d8e8882f73 --- /dev/null +++ b/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx @@ -0,0 +1,75 @@ +/* + * 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 "TextCharacterSpacingPopup.hxx" +#include "TextCharacterSpacingControl.hxx" +#include <boost/bind.hpp> +#include <unotools/viewoptions.hxx> + +namespace svx { namespace sidebar { + +TextCharacterSpacingPopup::TextCharacterSpacingPopup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator) + : Popup( + pParent, + rControlCreator, + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Character Spacing"))) +{ + SetPopupModeEndHandler(::boost::bind(&TextCharacterSpacingPopup::PopupModeEndCallback, this)); +} + + + + +TextCharacterSpacingPopup::~TextCharacterSpacingPopup (void) +{ +} + + + + +void TextCharacterSpacingPopup::Rearrange (bool bLBAvailable,bool bAvailable, long nKerning) +{ + ProvideContainerAndControl(); + + TextCharacterSpacingControl* pControl = dynamic_cast<TextCharacterSpacingControl*>(mpControl.get()); + if (pControl != NULL) + pControl->Rearrange(bLBAvailable,bAvailable,nKerning); +} + +void TextCharacterSpacingPopup::PopupModeEndCallback (void) +{ + ProvideContainerAndControl(); + TextCharacterSpacingControl* pControl = dynamic_cast<TextCharacterSpacingControl*>(mpControl.get()); + if (pControl == NULL) + return; + + if( pControl->GetLastCustomState() == SPACING_CLOSE_BY_CUS_EDIT) + { + SvtViewOptions aWinOpt( E_WINDOW, SIDEBAR_SPACING_GLOBAL_VALUE ); + ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq(1); + aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Spacing") ); + aSeq[0].Value <<= ::rtl::OUString::number(pControl->GetLastCustomValue()); + aWinOpt.SetUserData( aSeq ); + + } +} + + +} } // end of namespace svx::sidebar + diff --git a/svx/source/sidebar/text/TextCharacterSpacingPopup.hxx b/svx/source/sidebar/text/TextCharacterSpacingPopup.hxx new file mode 100644 index 000000000000..5aa78dc7a6c8 --- /dev/null +++ b/svx/source/sidebar/text/TextCharacterSpacingPopup.hxx @@ -0,0 +1,44 @@ +/* + * 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 _SVX_SIDEBAR_CHARACTER_SPACING_POPUP_HXX_ +#define _SVX_SIDEBAR_CHARACTER_SPACING_POPUP_HXX_ + +#include "svx/sidebar/Popup.hxx" + +#include <boost/function.hpp> + +namespace svx { namespace sidebar { + +class TextCharacterSpacingPopup + : public Popup +{ +public : + TextCharacterSpacingPopup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator); + ~TextCharacterSpacingPopup (void); + + void Rearrange (bool bLBAvailable,bool bAvailable, long nKerning); +private: + void PopupModeEndCallback (void); +}; + +} } // end of namespace svx::sidebar + +#endif + diff --git a/svx/source/sidebar/text/TextPropertyPanel.cxx b/svx/source/sidebar/text/TextPropertyPanel.cxx new file mode 100644 index 000000000000..c0d0f3782fa8 --- /dev/null +++ b/svx/source/sidebar/text/TextPropertyPanel.cxx @@ -0,0 +1,1572 @@ +/* + * 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 "TextPropertyPanel.hrc" +#include "TextPropertyPanel.hxx" +#include "SvxSBFontNameBox.hxx" + +#include "svx/dialmgr.hxx" + +#include <editeng/brushitem.hxx> +#include <editeng/colritem.hxx> +#include <editeng/crossedoutitem.hxx> +#include <editeng/escapementitem.hxx> +#include <editeng/flstitem.hxx> +#include <editeng/fontitem.hxx> +#include <editeng/kernitem.hxx> +#include <editeng/postitem.hxx> +#include <editeng/shdditem.hxx> +#include <editeng/udlnitem.hxx> +#include <editeng/wghtitem.hxx> +#include <rtl/ref.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/objsh.hxx> +#include <sfx2/viewsh.hxx> +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include <sfx2/sidebar/ControlFactory.hxx> +#include <sfx2/sidebar/Theme.hxx> +#include "sfx2/imagemgr.hxx" +#include <svtools/ctrltool.hxx> +#include <svtools/unitconv.hxx> + +#include <vcl/gradient.hxx> +#include <vcl/svapp.hxx> +#include <vcl/toolbox.hxx> +#include "TextCharacterSpacingControl.hxx" +#include "TextCharacterSpacingPopup.hxx" +#include "TextUnderlineControl.hxx" +#include "TextUnderlinePopup.hxx" +#include <svx/sidebar/ColorControl.hxx> +#include <svx/sidebar/PopupContainer.hxx> + + +#include <boost/bind.hpp> + +using namespace css; +using namespace cssu; +using ::sfx2::sidebar::Theme; +using ::sfx2::sidebar::ControlFactory; + +#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) + +namespace svx { namespace sidebar { + +#undef HAS_IA2 + + +#define TEXT_SECTIONPAGE_HEIGHT_S SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + ( TOOLBOX_ITEM_HEIGHT + 2 ) + CONTROL_SPACING_VERTICAL * 1 + SECTIONPAGE_MARGIN_VERTICAL_BOT +#define TEXT_SECTIONPAGE_HEIGHT SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + ( TOOLBOX_ITEM_HEIGHT + 2 ) * 2 + CONTROL_SPACING_VERTICAL * 2 + SECTIONPAGE_MARGIN_VERTICAL_BOT + +// + +//end +PopupControl* TextPropertyPanel::CreateCharacterSpacingControl (PopupContainer* pParent) +{ + return new TextCharacterSpacingControl(pParent, *this); +} + +PopupControl* TextPropertyPanel::CreateUnderlinePopupControl (PopupContainer* pParent) +{ + return new TextUnderlineControl(pParent, *this); +} + +PopupControl* TextPropertyPanel::CreateFontColorPopupControl (PopupContainer* pParent) +{ + return new ColorControl( + pParent, + mpBindings, + SVX_RES(RID_POPUPPANEL_TEXTPAGE_FONT_COLOR), + SVX_RES(VS_FONT_COLOR), + ::boost::bind(&TextPropertyPanel::GetFontColor, this), + ::boost::bind(&TextPropertyPanel::SetFontColor, this, _1,_2), + pParent, + 0); +} + +PopupControl* TextPropertyPanel::CreateBrushColorPopupControl (PopupContainer* pParent) +{ + return new ColorControl( + pParent, + mpBindings, + SVX_RES(RID_POPUPPANEL_TEXTPAGE_FONT_COLOR), + SVX_RES(VS_FONT_COLOR), + ::boost::bind(&TextPropertyPanel::GetBrushColor, this), + ::boost::bind(&TextPropertyPanel::SetBrushColor, this, _1,_2), + pParent, + 0); +} + +long TextPropertyPanel::GetSelFontSize() +{ + long nH = 240; + SfxMapUnit eUnit = maSpacingControl.GetCoreMetric(); + if (mpHeightItem) + nH = LogicToLogic( mpHeightItem->GetHeight(), (MapUnit)eUnit, MAP_TWIP ); + return nH; +} + + +TextPropertyPanel* TextPropertyPanel::Create ( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings, + const cssu::Reference<css::ui::XSidebar>& rxSidebar) +{ + if (pParent == NULL) + throw lang::IllegalArgumentException(A2S("no parent Window given to TextPropertyPanel::Create"), NULL, 0); + if ( ! rxFrame.is()) + throw lang::IllegalArgumentException(A2S("no XFrame given to TextPropertyPanel::Create"), NULL, 1); + if (pBindings == NULL) + throw lang::IllegalArgumentException(A2S("no SfxBindings given to TextPropertyPanel::Create"), NULL, 2); + + return new TextPropertyPanel( + pParent, + rxFrame, + pBindings, + rxSidebar); +} + + +::sfx2::sidebar::ControllerItem& TextPropertyPanel::GetSpaceController() +{ + return maSpacingControl; +} + +TextPropertyPanel::TextPropertyPanel ( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings, + const cssu::Reference<css::ui::XSidebar>& rxSidebar) + : Control(pParent, SVX_RES(RID_SIDEBAR_TEXT_PANEL)), + mpFontNameBox (new SvxSBFontNameBox(this, SVX_RES(CB_SBFONT_FONT))), + maFontSizeBox (this, SVX_RES(MB_SBFONT_FONTSIZE)), + mpToolBoxIncDecBackground(ControlFactory::CreateToolBoxBackground(this)), + mpToolBoxIncDec(ControlFactory::CreateToolBox( + mpToolBoxIncDecBackground.get(), + SVX_RES(TB_INCREASE_DECREASE))), + mpToolBoxFontBackground(ControlFactory::CreateToolBoxBackground(this)), + mpToolBoxFont(ControlFactory::CreateToolBox( + mpToolBoxFontBackground.get(), + SVX_RES(TB_FONT))), + mpToolBoxFontColorBackground(ControlFactory::CreateToolBoxBackground(this)), + mpToolBoxFontColor(ControlFactory::CreateToolBox( + mpToolBoxFontColorBackground.get(), + SVX_RES(TB_FONTCOLOR))), + mpToolBoxScriptBackground(ControlFactory::CreateToolBoxBackground(this)), + mpToolBoxScript(ControlFactory::CreateToolBox( + mpToolBoxScriptBackground.get(), + SVX_RES(TB_SCRIPT))), + mpToolBoxScriptSwBackground(ControlFactory::CreateToolBoxBackground(this)), + mpToolBoxScriptSw(ControlFactory::CreateToolBox( + mpToolBoxScriptSwBackground.get(), + SVX_RES(TB_SCRIPT_SW))), + mpToolBoxSpacingBackground(ControlFactory::CreateToolBoxBackground(this)), + mpToolBoxSpacing(ControlFactory::CreateToolBox( + mpToolBoxSpacingBackground.get(), + SVX_RES(TB_SPACING))), + mpToolBoxHighlightBackground(ControlFactory::CreateToolBoxBackground(this)), + mpToolBoxHighlight(ControlFactory::CreateToolBox( + mpToolBoxHighlightBackground.get(), + SVX_RES(TB_HIGHLIGHT))), + + mpFontColorUpdater(), + mpHighlightUpdater(), + + maFontNameControl (SID_ATTR_CHAR_FONT, *pBindings, *this), + maFontSizeControl (SID_ATTR_CHAR_FONTHEIGHT, *pBindings, *this), + maWeightControl (SID_ATTR_CHAR_WEIGHT, *pBindings, *this), + maItalicControl (SID_ATTR_CHAR_POSTURE, *pBindings, *this), + maUnderlineControl (SID_ATTR_CHAR_UNDERLINE, *pBindings, *this), + maStrikeControl (SID_ATTR_CHAR_STRIKEOUT, *pBindings, *this), + maShadowControl (SID_ATTR_CHAR_SHADOWED, *pBindings, *this), + maFontColorControl (SID_ATTR_CHAR_COLOR, *pBindings, *this), + maScriptControlSw (SID_ATTR_CHAR_ESCAPEMENT, *pBindings, *this), //for sw + maSuperScriptControl (SID_SET_SUPER_SCRIPT, *pBindings, *this), + maSubScriptControl (SID_SET_SUB_SCRIPT, *pBindings, *this), + maSpacingControl (SID_ATTR_CHAR_KERNING, *pBindings, *this), + maHighlightControl (SID_ATTR_BRUSH_CHAR, *pBindings, *this), + maSDFontGrow (SID_GROW_FONT_SIZE, *pBindings, *this), + maSDFontShrink (SID_SHRINK_FONT_SIZE, *pBindings, *this), + + maImgIncrease (SVX_RES( IMG_INCREASE)), + maImgDecrease (SVX_RES( IMG_DECREASE)), + maImgBold (SVX_RES( IMG_BOLD )), + maImgItalic (SVX_RES( IMG_ITALIC )), + maImgUnderline (SVX_RES( IMG_UNDERLINE )), + maImgStrike (SVX_RES( IMG_STRIKEOUT )), + maImgShadow (SVX_RES( IMG_SHADOWED )), + maImgFontColor (SVX_RES( IMG_FONTCOLOR)), + maImgSupScript (SVX_RES( IMG_SUPSCRIPT)), + maImgSubScript (SVX_RES( IMG_SUBSCRIPT)), + maImgHighlight (SVX_RES( IMG_HIGHLIGHT)), + + maImgNormalIcon (SVX_RES( IMG_SPACING_D)), + + mpFontList (NULL), + mbMustDelete (false), + mbFocusOnFontSizeCtrl(false), + + maCharSpacePopup(this, ::boost::bind(&TextPropertyPanel::CreateCharacterSpacingControl, this, _1)), + maUnderlinePopup(this, ::boost::bind(&TextPropertyPanel::CreateUnderlinePopupControl, this, _1)), + maFontColorPopup(this, ::boost::bind(&TextPropertyPanel::CreateFontColorPopupControl, this, _1)), + maBrushColorPopup(this, ::boost::bind(&TextPropertyPanel::CreateBrushColorPopupControl, this, _1)), + + + mxFrame(rxFrame), + maContext(), + mpBindings(pBindings), + mxSidebar(rxSidebar) +{ + Initialize(); + FreeResource(); +} + + + + +TextPropertyPanel::~TextPropertyPanel (void) +{ + if(mbMustDelete) + delete mpFontList; + + // Destroy the toolbox windows. + mpToolBoxIncDec.reset(); + mpToolBoxFont.reset(); + mpToolBoxFontColor.reset(); + mpToolBoxScript.reset(); + mpToolBoxScriptSw.reset(); + mpToolBoxSpacing.reset(); + mpToolBoxHighlight.reset(); + + // Destroy the background windows of the toolboxes. + mpToolBoxIncDecBackground.reset(); + mpToolBoxFontBackground.reset(); + mpToolBoxFontColorBackground.reset(); + mpToolBoxScriptBackground.reset(); + mpToolBoxScriptSwBackground.reset(); + mpToolBoxSpacingBackground.reset(); + mpToolBoxHighlightBackground.reset(); +} + + + + +Image TextPropertyPanel::GetIcon (const ::rtl::OUString& rsURL) +{ + return GetImage(mxFrame, rsURL, sal_False); +} + + +void TextPropertyPanel::SetSpacing(long nKern) +{ + mlKerning = nKern; +} + + +void TextPropertyPanel::HandleContextChange ( + const ::sfx2::sidebar::EnumContext aContext) +{ + if (maContext == aContext) + { + // Nothing to do. + return; + } + + maContext = aContext; + switch (maContext.GetCombinedContext_DI()) + { + case CombinedEnumContext(Application_Calc, Context_Cell): + case CombinedEnumContext(Application_Calc, Context_Pivot): + { + mpToolBoxScript->Hide(); + mpToolBoxScriptSw->Hide(); + mpToolBoxSpacing->Hide(); + mpToolBoxHighlight->Hide(); + + Size aSize(PROPERTYPAGE_WIDTH,TEXT_SECTIONPAGE_HEIGHT_S); + aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) ); + aSize.setWidth(GetOutputSizePixel().Width()); + SetSizePixel(aSize); + if (mxSidebar.is()) + mxSidebar->requestLayout(); + break; + } + + case CombinedEnumContext(Application_WriterAndWeb, Context_Text): + case CombinedEnumContext(Application_WriterAndWeb, Context_Table): + { + mpToolBoxScriptSw->Show(); + mpToolBoxScript->Hide(); + mpToolBoxHighlight->Show(); + mpToolBoxSpacing->Show(); + + Size aSize(PROPERTYPAGE_WIDTH, TEXT_SECTIONPAGE_HEIGHT); + aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) ); + aSize.setWidth(GetOutputSizePixel().Width()); + SetSizePixel(aSize); + if (mxSidebar.is()) + mxSidebar->requestLayout(); + break; + } + + case CombinedEnumContext(Application_Writer, Context_DrawText): + case CombinedEnumContext(Application_Writer, Context_Annotation): + { + mpToolBoxScriptSw->Show(); + mpToolBoxScript->Hide(); + mpToolBoxSpacing->Show(); + mpToolBoxHighlight->Hide(); + + Size aSize(PROPERTYPAGE_WIDTH,TEXT_SECTIONPAGE_HEIGHT); + aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) ); + aSize.setWidth(GetOutputSizePixel().Width()); + SetSizePixel(aSize); + if (mxSidebar.is()) + mxSidebar->requestLayout(); + break; + } + + case CombinedEnumContext(Application_Calc, Context_EditCell): + case CombinedEnumContext(Application_Calc, Context_DrawText): + case CombinedEnumContext(Application_DrawImpress, Context_DrawText): + case CombinedEnumContext(Application_DrawImpress, Context_Text): + case CombinedEnumContext(Application_DrawImpress, Context_Table): + case CombinedEnumContext(Application_DrawImpress, Context_OutlineText): + case CombinedEnumContext(Application_DrawImpress, Context_Draw): + case CombinedEnumContext(Application_DrawImpress, Context_TextObject): + case CombinedEnumContext(Application_DrawImpress, Context_Graphic): + { + mpToolBoxScriptSw->Hide(); + mpToolBoxScript->Show(); + mpToolBoxSpacing->Show(); + mpToolBoxHighlight->Hide(); + + Size aSize(PROPERTYPAGE_WIDTH,TEXT_SECTIONPAGE_HEIGHT); + aSize = LogicToPixel( aSize,MapMode(MAP_APPFONT) ); + aSize.setWidth(GetOutputSizePixel().Width()); + SetSizePixel(aSize); + if (mxSidebar.is()) + mxSidebar->requestLayout(); + break; + } + + default: + break; + } +} + +SfxBindings* TextPropertyPanel::GetBindings() +{ + return mpBindings; +} + + +void TextPropertyPanel::DataChanged (const DataChangedEvent& rEvent) +{ + (void)rEvent; + + SetupIcons(); +} + + + +void TextPropertyPanel::Initialize (void) +{ + //<<modify fill font list + SfxObjectShell* pDocSh = SfxObjectShell::Current(); + const SfxPoolItem* pItem = NULL; + + if (pDocSh != NULL) + pItem = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST ); + if (pItem != NULL) + mpFontList = ( (SvxFontListItem*)pItem )->GetFontList(); + else + { + mpFontList = new FontList( Application::GetDefaultDevice() ); + mbMustDelete = 1; + } + + mpFontNameBox->SetAccessibleName(mpFontNameBox->GetQuickHelpText()); + const FontInfo aFontInfo (mpFontList->Get( OUString( "" ), OUString( "" ))); + maFontSizeBox.Fill(&aFontInfo,mpFontList); + maFontSizeBox.SetAccessibleName(maFontSizeBox.GetQuickHelpText()); + + //toolbox + SetupIcons(); + InitToolBoxIncDec(); + InitToolBoxFont(); + InitToolBoxFontColor(); + InitToolBoxScript(); + InitToolBoxSpacing(); + InitToolBoxHighlight(); + +#ifdef HAS_IA2 + mpFontNameBox->SetAccRelationLabeledBy(&mpFontNameBox); + mpFontNameBox->SetMpSubEditAccLableBy(&mpFontNameBox); + maFontSizeBox.SetAccRelationLabeledBy(&maFontSizeBox); + maFontSizeBox.SetMpSubEditAccLableBy(&maFontSizeBox); + mpToolBoxFont.SetAccRelationLabeledBy(&mpToolBoxFont); + mpToolBoxIncDec.SetAccRelationLabeledBy(&mpToolBoxIncDec); + mpToolBoxFontColor.SetAccRelationLabeledBy(&mpToolBoxFontColor); + mpToolBoxScript.SetAccRelationLabeledBy(&mpToolBoxScript); + mpToolBoxScriptSw.SetAccRelationLabeledBy(&mpToolBoxScriptSw); + mpToolBoxSpacing.SetAccRelationLabeledBy(&mpToolBoxSpacing); + mpToolBoxHighlight.SetAccRelationLabeledBy(&mpToolBoxHighlight); +#endif + + //init state + mpHeightItem = NULL; + meWeight = WEIGHT_NORMAL; + meItalic = ITALIC_NONE; + mbShadow = false; + meStrike = STRIKEOUT_NONE; + mbPostureAvailable = true; + mbWeightAvailable = true; + meUnderline = UNDERLINE_NONE; + meUnderlineColor = COL_AUTO; // + maColor = COL_BLACK; + mbColorAvailable = true; + maBackColor = COL_AUTO; + mbBackColorAvailable = true; + meColorType = FONT_COLOR; + meEscape = SVX_ESCAPEMENT_OFF; + mbSuper = false; + mbSub = false; + mbKernAvailable = true; + mbKernLBAvailable = true; + mlKerning = 0; + mpFontColorUpdater.reset(new ToolboxButtonColorUpdater( + SID_ATTR_CHAR_COLOR, + TBI_FONTCOLOR, + mpToolBoxFontColor.get(), + TBX_UPDATER_MODE_CHAR_COLOR_NEW)); + mpHighlightUpdater.reset(new ToolboxButtonColorUpdater( + SID_ATTR_BRUSH_CHAR, + TBI_HIGHLIGHT, + mpToolBoxHighlight.get(), + TBX_UPDATER_MODE_CHAR_COLOR_NEW)); + + //set handler + mpFontNameBox->SetBindings(mpBindings); + //add + Link aLink = LINK(this, TextPropertyPanel, FontSelHdl); + mpFontNameBox->SetSelectHdl(aLink); + //add end + + aLink = LINK(this, TextPropertyPanel, FontSizeModifyHdl); + maFontSizeBox.SetModifyHdl(aLink); + //add + aLink = LINK(this, TextPropertyPanel, FontSizeSelHdl); + maFontSizeBox.SetSelectHdl(aLink); + //add end + aLink = LINK(this, TextPropertyPanel, FontSizeLoseFocus); + maFontSizeBox.SetLoseFocusHdl(aLink); + + // add + long aSizeBoxHeight = maFontSizeBox.GetSizePixel().getHeight();; + Point aPosFontSize = maFontSizeBox.GetPosPixel(); + long aPosY = aPosFontSize.getY(); + Point pTBIncDec = mpToolBoxIncDec->GetPosPixel(); + long aIncDecHeight = mpToolBoxIncDec->GetSizePixel().getHeight(); + pTBIncDec.setY(aPosY+aSizeBoxHeight/2-aIncDecHeight/2); + mpToolBoxIncDec->SetPosPixel(pTBIncDec); + //end +} + +void TextPropertyPanel::EndSpacingPopupMode (void) +{ + maCharSpacePopup.Hide(); +} + +void TextPropertyPanel::EndUnderlinePopupMode (void) +{ + maUnderlinePopup.Hide(); +} + + +void TextPropertyPanel::InitToolBoxFont() +{ + mpToolBoxFont->SetQuickHelpText(TBI_BOLD,String(SVX_RES(STR_QH_BOLD))); //Add + mpToolBoxFont->SetQuickHelpText(TBI_ITALIC,String(SVX_RES(STR_QH_ITALIC))); //Add + mpToolBoxFont->SetQuickHelpText(TBI_UNDERLINE,String(SVX_RES(STR_QH_UNDERLINE))); //Add + mpToolBoxFont->SetBackground(Wallpaper()); + mpToolBoxFont->SetPaintTransparent(true); + + Size aTbxSize( mpToolBoxFont->CalcWindowSizePixel() ); + mpToolBoxFont->SetOutputSizePixel( aTbxSize ); + + Link aLink = LINK(this, TextPropertyPanel, ToolboxFontSelectHandler); + mpToolBoxFont->SetSelectHdl ( aLink ); + aLink = LINK(this, TextPropertyPanel, ToolBoxUnderlineClickHdl); + mpToolBoxFont->SetDropdownClickHdl(aLink); +} + + + + +void TextPropertyPanel::InitToolBoxIncDec() +{ + Size aTbxSize( mpToolBoxIncDec->CalcWindowSizePixel() ); + mpToolBoxIncDec->SetOutputSizePixel( aTbxSize ); + + Link aLink = LINK(this, TextPropertyPanel, ToolboxIncDecSelectHdl); + mpToolBoxIncDec->SetSelectHdl ( aLink ); +} + + + + +void TextPropertyPanel::InitToolBoxFontColor() +{ + Size aTbxSize( mpToolBoxFontColor->CalcWindowSizePixel() ); + mpToolBoxFontColor->SetOutputSizePixel( aTbxSize ); + mpToolBoxFontColor->SetItemBits( TBI_FONTCOLOR, mpToolBoxFontColor->GetItemBits( TBI_FONTCOLOR ) | TIB_DROPDOWNONLY ); + + Link aLink = LINK(this, TextPropertyPanel, ToolBoxFontColorDropHdl); + mpToolBoxFontColor->SetDropdownClickHdl ( aLink ); + mpToolBoxFontColor->SetSelectHdl ( aLink ); + +} +void TextPropertyPanel::InitToolBoxScript() +{ + Size aTbxSize( mpToolBoxScriptSw->CalcWindowSizePixel() ); + mpToolBoxScriptSw->SetOutputSizePixel( aTbxSize ); + + Link aLink = LINK(this, TextPropertyPanel, ToolBoxSwScriptSelectHdl); + mpToolBoxScriptSw->SetSelectHdl ( aLink ); + + aTbxSize = mpToolBoxScript->CalcWindowSizePixel() ; + mpToolBoxScript->SetOutputSizePixel( aTbxSize ); + + aLink = LINK(this, TextPropertyPanel, ToolBoxScriptSelectHdl); + mpToolBoxScript->SetSelectHdl ( aLink ); +} +void TextPropertyPanel::InitToolBoxSpacing() +{ + Size aTbxSize( mpToolBoxSpacing->CalcWindowSizePixel() ); + mpToolBoxSpacing->SetOutputSizePixel( aTbxSize ); + mpToolBoxSpacing->SetItemBits( TBI_SPACING, mpToolBoxSpacing->GetItemBits( TBI_SPACING ) | TIB_DROPDOWNONLY ); + + Link aLink = LINK(this, TextPropertyPanel, SpacingClickHdl); + mpToolBoxSpacing->SetDropdownClickHdl ( aLink ); + mpToolBoxSpacing->SetSelectHdl( aLink ); +} +void TextPropertyPanel::InitToolBoxHighlight() +{ + Size aTbxSize( mpToolBoxHighlight->CalcWindowSizePixel() ); + mpToolBoxHighlight->SetOutputSizePixel( aTbxSize ); + mpToolBoxHighlight->SetItemBits( TBI_HIGHLIGHT, mpToolBoxHighlight->GetItemBits( TBI_HIGHLIGHT ) | TIB_DROPDOWNONLY ); + + Link aLink = LINK(this, TextPropertyPanel, ToolBoxHighlightDropHdl); + mpToolBoxHighlight->SetDropdownClickHdl ( aLink ); + mpToolBoxHighlight->SetSelectHdl( aLink ); +} + + + + +void TextPropertyPanel::SetupIcons (void) +{ + if (Theme::GetBoolean(Theme::Bool_UseSymphonyIcons)) + { + mpToolBoxIncDec->SetItemImage(TBI_INCREASE, maImgIncrease); + mpToolBoxIncDec->SetItemImage(TBI_DECREASE, maImgDecrease); + mpToolBoxFont->SetItemImage(TBI_BOLD, maImgBold); + mpToolBoxFont->SetItemImage(TBI_ITALIC, maImgItalic); + mpToolBoxFont->SetItemImage(TBI_UNDERLINE, maImgUnderline); + mpToolBoxFont->SetItemImage(TBI_STRIKEOUT, maImgStrike); + mpToolBoxFont->SetItemImage(TBI_SHADOWED, maImgShadow); + + mpToolBoxFontColor->SetItemImage(TBI_FONTCOLOR, maImgFontColor); + //for sw + mpToolBoxScriptSw->SetItemImage(TBI_SUPER_SW, maImgSupScript); + mpToolBoxScriptSw->SetItemImage(TBI_SUB_SW, maImgSubScript); + //for sc and sd + mpToolBoxScript->SetItemImage(TBI_SUPER, maImgSupScript); + mpToolBoxScript->SetItemImage(TBI_SUB, maImgSubScript); + mpToolBoxSpacing->SetItemImage(TBI_SPACING, maImgNormalIcon); + mpToolBoxHighlight->SetItemImage(TBI_HIGHLIGHT, maImgHighlight); + } + else + { + mpToolBoxIncDec->SetItemImage(TBI_INCREASE, GetIcon(A2S(".uno:Grow"))); + mpToolBoxIncDec->SetItemImage(TBI_DECREASE, GetIcon(A2S(".uno:Shrink"))); + mpToolBoxFont->SetItemImage(TBI_BOLD, GetIcon(A2S(".uno:Bold"))); + mpToolBoxFont->SetItemImage(TBI_ITALIC, GetIcon(A2S(".uno:Italic"))); + mpToolBoxFont->SetItemImage(TBI_UNDERLINE, GetIcon(A2S(".uno:Underline"))); + mpToolBoxFont->SetItemImage(TBI_STRIKEOUT, GetIcon(A2S(".uno:Strikeout"))); + mpToolBoxFont->SetItemImage(TBI_SHADOWED, GetIcon(A2S(".uno:Shadowed"))); + + mpToolBoxFontColor->SetItemImage(TBI_FONTCOLOR, GetIcon(A2S(".uno:FontColor"))); + //for sw + mpToolBoxScriptSw->SetItemImage(TBI_SUPER_SW, GetIcon(A2S(".uno:SuperScript"))); + mpToolBoxScriptSw->SetItemImage(TBI_SUB_SW, GetIcon(A2S(".uno:SubScript"))); + //for sc and sd + mpToolBoxScript->SetItemImage(TBI_SUPER, GetIcon(A2S(".uno:SuperScript"))); + mpToolBoxScript->SetItemImage(TBI_SUB, GetIcon(A2S(".uno:SubScript"))); + mpToolBoxSpacing->SetItemImage(TBI_SPACING, GetIcon(A2S(".uno:FontworkCharacterSpacingFloater"))); + mpToolBoxHighlight->SetItemImage(TBI_HIGHLIGHT, GetIcon(A2S(".uno:BackColor"))); + } +} + + + + +IMPL_LINK( TextPropertyPanel, FontSelHdl, FontNameBox*, pBox ) +{ + if ( !pBox->IsTravelSelect() ) + { + if( SfxViewShell::Current() ) + { + Window* pShellWnd = SfxViewShell::Current()->GetWindow(); + + if ( pShellWnd ) + pShellWnd->GrabFocus(); + } + } + return 0; +} +//add end +IMPL_LINK( TextPropertyPanel, FontSizeModifyHdl, FontSizeBox*, pSizeBox ) +{ + if (pSizeBox == &maFontSizeBox) + { + long nSize = pSizeBox->GetValue(); + mbFocusOnFontSizeCtrl = true; + + float fSize = (float)nSize / 10; + SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric(); + SvxFontHeightItem aItem( CalcToUnit( fSize, eUnit ), 100, SID_ATTR_CHAR_FONTHEIGHT ) ; + + mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L ); + mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false); + } + return 0; +} +//add +IMPL_LINK( TextPropertyPanel, FontSizeSelHdl, FontSizeBox*, pSizeBox ) +{ + if ( !pSizeBox->IsTravelSelect() ) + { + if( SfxViewShell::Current() ) + { + Window* pShellWnd = SfxViewShell::Current()->GetWindow(); + + if ( pShellWnd ) + pShellWnd->GrabFocus(); + } + } + + return 0; +} +//add end +IMPL_LINK(TextPropertyPanel, FontSizeLoseFocus, FontSizeBox*, pSizeBox) +{ + if(pSizeBox == &maFontSizeBox) + { + mbFocusOnFontSizeCtrl = false; + } + return 0; +} + +IMPL_LINK(TextPropertyPanel, ToolboxFontSelectHandler, ToolBox*, pToolBox) +{ + const sal_uInt16 nId = pToolBox->GetCurItemId(); + + //Bold + if(nId == TBI_BOLD) + { + EndTracking(); + if(meWeight != WEIGHT_BOLD) + meWeight = WEIGHT_BOLD; + else + meWeight = WEIGHT_NORMAL; + SvxWeightItem aWeightItem(meWeight, SID_ATTR_CHAR_WEIGHT); + mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_WEIGHT, SFX_CALLMODE_RECORD, &aWeightItem, 0L); + UpdateFontBold(); + } + //Italic + else if(nId == TBI_ITALIC) + { + EndTracking(); + if(meItalic != ITALIC_NORMAL) + meItalic = ITALIC_NORMAL; + else + meItalic = ITALIC_NONE; + SvxPostureItem aPostureItem(meItalic, SID_ATTR_CHAR_POSTURE); + mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_POSTURE, SFX_CALLMODE_RECORD, &aPostureItem, 0L); + UpdateFontItalic(); + } + //underline + else if(nId == TBI_UNDERLINE) + { + EndTracking(); + //add , keep underline's color + if(meUnderline == UNDERLINE_NONE) + { + //AF: meUnderline = GetDefaultUnderline(); + meUnderline = UNDERLINE_SINGLE; + //<<modify + //SvxTextLineItem aLineItem(meUnderline, SID_ATTR_CHAR_UNDERLINE); + SvxUnderlineItem aLineItem(meUnderline, SID_ATTR_CHAR_UNDERLINE); + //modify end>> + aLineItem.SetColor(meUnderlineColor); + mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_UNDERLINE, SFX_CALLMODE_RECORD, &aLineItem, 0L); + } + else + { + meUnderline = UNDERLINE_NONE; + //<<modify + //SvxTextLineItem aLineItem(meUnderline, SID_ATTR_CHAR_UNDERLINE); + SvxUnderlineItem aLineItem(meUnderline, SID_ATTR_CHAR_UNDERLINE); + //modify end>> + mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_UNDERLINE, SFX_CALLMODE_RECORD, &aLineItem, 0L); + } + UpdateFontUnderline(); + //add end + } + //strike out + else if(nId == TBI_STRIKEOUT) + { + EndTracking(); + if(meStrike != STRIKEOUT_NONE && meStrike != STRIKEOUT_DONTKNOW) + meStrike = STRIKEOUT_NONE; + else + meStrike = STRIKEOUT_SINGLE; + SvxCrossedOutItem aStrikeItem(meStrike,SID_ATTR_CHAR_STRIKEOUT); + mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_STRIKEOUT, SFX_CALLMODE_RECORD, &aStrikeItem, 0L); + UpdateFontStrikeOut(); + } + //shadowed + else if(nId == TBI_SHADOWED) + { + EndTracking(); + mbShadow = !mbShadow; + SvxShadowedItem aShadowItem(mbShadow, SID_ATTR_CHAR_SHADOWED); + mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_SHADOWED, SFX_CALLMODE_RECORD, &aShadowItem, 0L); + UpdateFontShadowed(); + } + return 0; +} + + + + +IMPL_LINK(TextPropertyPanel, ToolboxIncDecSelectHdl, ToolBox*, pToolBox) +{ + const sal_uInt16 nId = pToolBox->GetCurItemId(); + + // font size +/- enhancement in sd + switch (maContext.GetCombinedContext()) + { + case CombinedEnumContext(Application_Draw, Context_DrawText): + case CombinedEnumContext(Application_Draw, Context_Text): + case CombinedEnumContext(Application_Draw, Context_Table): + case CombinedEnumContext(Application_Draw, Context_OutlineText): + case CombinedEnumContext(Application_Draw, Context_Draw): + case CombinedEnumContext(Application_Draw, Context_TextObject): + case CombinedEnumContext(Application_Draw, Context_Graphic): + case CombinedEnumContext(Application_Impress, Context_DrawText): + case CombinedEnumContext(Application_Impress, Context_Text): + case CombinedEnumContext(Application_Impress, Context_Table): + case CombinedEnumContext(Application_Impress, Context_OutlineText): + case CombinedEnumContext(Application_Impress, Context_Draw): + case CombinedEnumContext(Application_Impress, Context_TextObject): + case CombinedEnumContext(Application_Impress, Context_Graphic): + if(nId == TBI_INCREASE) + { + EndTracking(); + SfxVoidItem aItem(SID_GROW_FONT_SIZE); + mpBindings->GetDispatcher()->Execute( SID_GROW_FONT_SIZE, SFX_CALLMODE_RECORD, &aItem, 0L ); + } + else if(nId == TBI_DECREASE) + { + EndTracking(); + SfxVoidItem aItem(SID_SHRINK_FONT_SIZE); + mpBindings->GetDispatcher()->Execute( SID_SHRINK_FONT_SIZE, SFX_CALLMODE_RECORD, &aItem, 0L ); + } + break; + + default: + if(nId == TBI_INCREASE) + { + EndTracking(); + mbFocusOnFontSizeCtrl = false; + sal_Int64 iValue = maFontSizeBox.GetValue(); + int iPos = maFontSizeBox.GetValuePos(iValue, FUNIT_NONE); + long nSize = iValue; + if(iPos != LISTBOX_ENTRY_NOTFOUND) + nSize = maFontSizeBox.GetValue(iPos+1 , FUNIT_NONE); + else if(iValue >= 100 && iValue < 105) + nSize = 105; + else if(iValue >= 105 && iValue < 110) + nSize = 110; + else if(iValue < 960) + { + nSize = (nSize / 10) * 10 + 10; + while(maFontSizeBox.GetValuePos(nSize, FUNIT_NONE) == LISTBOX_ENTRY_NOTFOUND) + nSize += 10; + } + else + { + nSize = iValue; + } + + float fSize = (float)nSize / 10; + + SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric(); + SvxFontHeightItem aItem( CalcToUnit( fSize, eUnit ), 100, SID_ATTR_CHAR_FONTHEIGHT ) ; + + mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L ); + mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false); + //add , update ASAP + maFontSizeBox.SetValue( nSize ); + if(nSize >= 960) + { + mpToolBoxIncDec->EnableItem(TBI_INCREASE,false); + mpToolBoxIncDec->EnableItem(TBI_DECREASE,true); + } + else if(nSize <= 60) + { + mpToolBoxIncDec->EnableItem(TBI_INCREASE,true); + mpToolBoxIncDec->EnableItem(TBI_DECREASE,false); + } + else + { + mpToolBoxIncDec->EnableItem(TBI_INCREASE,true); + mpToolBoxIncDec->EnableItem(TBI_DECREASE,true); + } + //add end + } + else if(nId == TBI_DECREASE) + { + EndTracking(); + mbFocusOnFontSizeCtrl = false; + sal_Int64 iValue = maFontSizeBox.GetValue(); + int iPos = maFontSizeBox.GetValuePos(iValue, FUNIT_NONE); + long nSize = iValue; + if(iPos != LISTBOX_ENTRY_NOTFOUND) + nSize = maFontSizeBox.GetValue(iPos-1 , FUNIT_NONE); + else if(iValue > 100 && iValue <= 105) + nSize = 100; + else if(iValue > 105 && iValue <= 110) + nSize = 105; + else if(iValue > 960) + { + nSize = 960; + } + else if(iValue > 60) + { + nSize = (nSize / 10) * 10 ; + while(maFontSizeBox.GetValuePos(nSize, FUNIT_NONE) == LISTBOX_ENTRY_NOTFOUND) + nSize -= 10; + } + else + { + nSize = iValue; + } + + float fSize = (float)nSize / 10; + + SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric(); + SvxFontHeightItem aItem( CalcToUnit( fSize, eUnit ), 100, SID_ATTR_CHAR_FONTHEIGHT ) ; + + mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L ); + mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false); + //add + maFontSizeBox.SetValue( nSize ); + if(nSize >= 960) + { + mpToolBoxIncDec->EnableItem(TBI_INCREASE,false); + mpToolBoxIncDec->EnableItem(TBI_DECREASE,true); + } + else if(nSize <= 60) + { + mpToolBoxIncDec->EnableItem(TBI_INCREASE,true); + mpToolBoxIncDec->EnableItem(TBI_DECREASE,false); + } + else + { + mpToolBoxIncDec->EnableItem(TBI_INCREASE,true); + mpToolBoxIncDec->EnableItem(TBI_DECREASE,true); + } + //add end + } + } + return 0; +} + + + +IMPL_LINK(TextPropertyPanel, ToolBoxUnderlineClickHdl, ToolBox*, pToolBox) +{ + const sal_uInt16 nId = pToolBox->GetCurItemId(); + OSL_ASSERT(nId == TBI_UNDERLINE); + if(nId == TBI_UNDERLINE) + { + pToolBox->SetItemDown( nId, true ); + maUnderlinePopup.Rearrange(meUnderline); + maUnderlinePopup.Show(*pToolBox); + + } + return 0L; +} + + + + +IMPL_LINK(TextPropertyPanel, ToolBoxFontColorDropHdl,ToolBox*, pToolBox) +{ + const sal_uInt16 nId = pToolBox->GetCurItemId(); + if(nId == TBI_FONTCOLOR) + { + meColorType = FONT_COLOR; + + pToolBox->SetItemDown( nId, true ); + + maFontColorPopup.Show(*pToolBox); + maFontColorPopup.SetCurrentColor(maColor, mbColorAvailable); + } + return 0; +} + + + + +IMPL_LINK(TextPropertyPanel, ToolBoxSwScriptSelectHdl, ToolBox*, pToolBox) +{ + const sal_uInt16 nId = pToolBox->GetCurItemId(); + if( nId == TBI_SUPER_SW ) + { + if(meEscape != SVX_ESCAPEMENT_SUPERSCRIPT) + { + meEscape = SVX_ESCAPEMENT_SUPERSCRIPT; + SvxEscapementItem aSupItem(DFLT_ESC_SUPER, DFLT_ESC_PROP, SID_ATTR_CHAR_ESCAPEMENT); + mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aSupItem, 0L ); + } + else + { + meEscape = SVX_ESCAPEMENT_OFF; + SvxEscapementItem aNoneItem(0, 100, SID_ATTR_CHAR_ESCAPEMENT); + mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aNoneItem, 0L ); + } + } + else if(TBI_SUB_SW == nId) + { + if(meEscape != SVX_ESCAPEMENT_SUBSCRIPT) + { + meEscape = (SvxEscapement)SVX_ESCAPEMENT_SUBSCRIPT; + SvxEscapementItem aSubItem(DFLT_ESC_SUB, DFLT_ESC_PROP, SID_ATTR_CHAR_ESCAPEMENT); + mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aSubItem, 0L ); + } + else + { + meEscape = SVX_ESCAPEMENT_OFF; + SvxEscapementItem aNoneItem(0, 100, SID_ATTR_CHAR_ESCAPEMENT); + mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aNoneItem, 0L ); + } + } + UpdateFontScript(); + + return 0; +} + + + + +IMPL_LINK(TextPropertyPanel, ToolBoxScriptSelectHdl, ToolBox*, pToolBox) +{ + const sal_uInt16 nId = pToolBox->GetCurItemId(); + if( nId == TBI_SUPER ) + { + mbSuper = !mbSuper; + SfxBoolItem aSupItem(SID_SET_SUPER_SCRIPT, mbSuper); + mpBindings->GetDispatcher()->Execute( SID_SET_SUPER_SCRIPT, SFX_CALLMODE_RECORD, &aSupItem, 0L ); + } + else if(TBI_SUB == nId) + { + + mbSub = !mbSub; + SfxBoolItem aSubItem(SID_SET_SUB_SCRIPT, mbSub ); + mpBindings->GetDispatcher()->Execute( SID_SET_SUB_SCRIPT, SFX_CALLMODE_RECORD, &aSubItem, 0L ); + } + UpdateFontScript(); + return 0; +} + + + + +IMPL_LINK(TextPropertyPanel, ToolBoxHighlightDropHdl, ToolBox*, pToolBox) +{ + const sal_uInt16 nId = pToolBox->GetCurItemId(); + if(nId == TBI_HIGHLIGHT) + { + meColorType = BACK_COLOR; + + pToolBox->SetItemDown( nId, true ); + maBrushColorPopup.Show(*pToolBox); + maBrushColorPopup.SetCurrentColor(maBackColor, mbBackColorAvailable); + + } + return 0; +} + + + +IMPL_LINK(TextPropertyPanel, SpacingClickHdl, ToolBox*, pToolBox) +{ + const sal_uInt16 nId = pToolBox->GetCurItemId(); + OSL_ASSERT(nId == TBI_SPACING); + if(nId == TBI_SPACING) + { + pToolBox->SetItemDown( nId, true ); + maCharSpacePopup.Rearrange(mbKernLBAvailable,mbKernAvailable,mlKerning); + maCharSpacePopup.Show(*pToolBox); + + } + return 0L; +} + + + + +IMPL_LINK( TextPropertyPanel, ImplPopupModeEndHdl, FloatingWindow*, EMPTYARG ) +{ + return 0; +} + + + + + + + + +void TextPropertyPanel::NotifyItemUpdate ( + const sal_uInt16 nSID, + const SfxItemState eState, + const SfxPoolItem* pState) +{ + switch(nSID) + { + case SID_ATTR_CHAR_FONT: + if ( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxFontItem) ) + { + mpFontNameBox->Enable(); + const SvxFontItem* pFontItem = (const SvxFontItem*)pState; + mpFontNameBox->SetText( pFontItem->GetFamilyName() ); + } + else + { + mpFontNameBox->SetText( String() ); + if (SFX_ITEM_DISABLED == eState) + { + mpFontNameBox->Disable(); + } + } + break; + case SID_ATTR_CHAR_FONTHEIGHT: + if ( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxFontHeightItem) ) + { + mpHeightItem = (SvxFontHeightItem*)pState;//const SvxFontHeightItem* + SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric(); + long iValue = (long)CalcToPoint( mpHeightItem->GetHeight(), eUnit, 10 ); + mpToolBoxIncDec->Enable(); + + // font size +/- enhancement in sd + switch(maContext.GetCombinedContext()) + { + case CombinedEnumContext(Application_Draw, Context_DrawText): + case CombinedEnumContext(Application_Draw, Context_Text): + case CombinedEnumContext(Application_Draw, Context_Table): + case CombinedEnumContext(Application_Draw, Context_OutlineText): + case CombinedEnumContext(Application_Draw, Context_Draw): + case CombinedEnumContext(Application_Draw, Context_TextObject): + case CombinedEnumContext(Application_Draw, Context_Graphic): + case CombinedEnumContext(Application_Impress, Context_DrawText): + case CombinedEnumContext(Application_Impress, Context_Text): + case CombinedEnumContext(Application_Impress, Context_Table): + case CombinedEnumContext(Application_Impress, Context_OutlineText): + case CombinedEnumContext(Application_Impress, Context_Draw): + case CombinedEnumContext(Application_Impress, Context_TextObject): + case CombinedEnumContext(Application_Impress, Context_Graphic): + break; + + default: + if(iValue > 60 && iValue < 960 ) + { + mpToolBoxIncDec->EnableItem(TBI_INCREASE,true); + mpToolBoxIncDec->EnableItem(TBI_DECREASE,true); + } + else if (iValue <= 60) + { + mpToolBoxIncDec->EnableItem(TBI_INCREASE,true); + mpToolBoxIncDec->EnableItem(TBI_DECREASE,false); + } + else if (iValue >= 960) + { + mpToolBoxIncDec->EnableItem(TBI_INCREASE,false); + mpToolBoxIncDec->EnableItem(TBI_DECREASE,true); + } + } + mpToolBoxIncDec->SetItemState(TBI_INCREASE, STATE_NOCHECK); + mpToolBoxIncDec->SetItemState(TBI_DECREASE, STATE_NOCHECK); + + if( mbFocusOnFontSizeCtrl ) + return; + + maFontSizeBox.Enable( ); + maFontSizeBox.SetValue( iValue ); + maFontSizeBox.LoseFocus(); + } + else + { + mpHeightItem = NULL; + maFontSizeBox.SetText( String() ); + //increase decrease diabled when multi-seletion have different font size + + // font size +/- enhancement in sd + switch(maContext.GetCombinedContext()) + { + case CombinedEnumContext(Application_Draw, Context_DrawText): + case CombinedEnumContext(Application_Draw, Context_Text): + case CombinedEnumContext(Application_Draw, Context_Table): + case CombinedEnumContext(Application_Draw, Context_OutlineText): + case CombinedEnumContext(Application_Draw, Context_Draw): + case CombinedEnumContext(Application_Draw, Context_TextObject): + case CombinedEnumContext(Application_Draw, Context_Graphic): + case CombinedEnumContext(Application_Impress, Context_DrawText): + case CombinedEnumContext(Application_Impress, Context_Text): + case CombinedEnumContext(Application_Impress, Context_Table): + case CombinedEnumContext(Application_Impress, Context_OutlineText): + case CombinedEnumContext(Application_Impress, Context_Draw): + case CombinedEnumContext(Application_Impress, Context_TextObject): + case CombinedEnumContext(Application_Impress, Context_Graphic): + break; + + default: + mpToolBoxIncDec->Disable(); + } + if ( eState <= SFX_ITEM_READONLY ) + { + maFontSizeBox.Disable( ); + } + } + break; + case SID_ATTR_CHAR_WEIGHT: + mbWeightAvailable = (eState >= SFX_ITEM_DONTCARE); + if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxWeightItem)) + { + const SvxWeightItem* pItem = (const SvxWeightItem*)pState; + meWeight = (FontWeight)pItem->GetValue(); + TextStyleChanged(); + } + else + { + meWeight = WEIGHT_NORMAL; + TextStyleChanged(); + } + break; + case SID_ATTR_CHAR_POSTURE: + mbPostureAvailable = (eState >= SFX_ITEM_DONTCARE); + if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxPostureItem)) + { + const SvxPostureItem* pItem = (const SvxPostureItem*)pState; + meItalic = (FontItalic)pItem->GetValue(); + TextStyleChanged(); + } + else + { + meItalic = ITALIC_NONE; + TextStyleChanged(); + } + break; + case SID_ATTR_CHAR_UNDERLINE: + if( eState >= SFX_ITEM_DEFAULT) //SvxUnderlineItem + { + //<<delete + //if(pState->ISA(SvxTextLineItem)) + //{ + // const SvxTextLineItem* pItem = (const SvxTextLineItem*)pState; + // meUnderline = (FontUnderline)pItem->GetValue(); + // //add , need to record the underline's color, if not the color will turn to auto + // meUnderlineColor = pItem->GetColor(); + // //add end + //} + //else + //delete end>> + if(pState->ISA(SvxUnderlineItem)) + { + const SvxUnderlineItem* pItem = (const SvxUnderlineItem*)pState; + meUnderline = (FontUnderline)pItem->GetValue(); + //add + meUnderlineColor = pItem->GetColor(); + //add end + } + TextStyleChanged(); + } + else + { + meUnderline = UNDERLINE_NONE; + TextStyleChanged(); + } + break; + case SID_ATTR_CHAR_SHADOWED: + if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxShadowedItem)) + { + const SvxShadowedItem* pItem = (const SvxShadowedItem*)pState; + mbShadow = pItem->GetValue(); + TextStyleChanged(); + } + else + { + mbShadow = false; + TextStyleChanged(); + } + break; + case SID_ATTR_CHAR_STRIKEOUT: + if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxCrossedOutItem)) + { + const SvxCrossedOutItem* pItem = (const SvxCrossedOutItem*)pState; + meStrike = (FontStrikeout)pItem->GetValue(); + + TextStyleChanged(); + } + else + { + meStrike = STRIKEOUT_NONE; + TextStyleChanged(); + } + break; + case SID_ATTR_CHAR_COLOR: + if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxColorItem)) + { + const SvxColorItem* pItem = (const SvxColorItem*)pState; + maColor = pItem->GetValue(); + mbColorAvailable = true; + if (mpFontColorUpdater) + mpFontColorUpdater->Update(maColor); + } + else + { + mbColorAvailable = false; + maColor.SetColor(COL_AUTO); + if (mpFontColorUpdater) + mpFontColorUpdater->Update(maColor); + } + break; + case SID_ATTR_BRUSH_CHAR: + if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxBrushItem)) + { + const SvxBrushItem* pItem = (const SvxBrushItem*)pState; + maBackColor = pItem->GetColor(); + mbBackColorAvailable = true; + if (mpHighlightUpdater) + mpHighlightUpdater->Update(maBackColor); + } + else + { + mbBackColorAvailable = false; + maBackColor.SetColor(COL_AUTO); + if (mpHighlightUpdater) + mpHighlightUpdater->Update(maBackColor); + } + break; + case SID_ATTR_CHAR_ESCAPEMENT: + if( eState == SFX_ITEM_AVAILABLE) + { + if( pState->ISA(SvxEscapementItem)) + { + const SvxEscapementItem* pItem = (const SvxEscapementItem *)pState; + short nEsc = pItem->GetEsc(); + if(nEsc == 0) + meEscape = SVX_ESCAPEMENT_OFF; + else if(nEsc > 0) + meEscape = SVX_ESCAPEMENT_SUPERSCRIPT; + else + meEscape = SVX_ESCAPEMENT_SUBSCRIPT; + } + else + { + meEscape = SVX_ESCAPEMENT_OFF; + } + TextStyleChanged(); + } + else if(eState == SFX_ITEM_DISABLED) + { + mpToolBoxScriptSw->EnableItem(TBI_SUPER,false); + mpToolBoxScriptSw->EnableItem(TBI_SUB,false); + } + else + { + meEscape = SVX_ESCAPEMENT_OFF; + TextStyleChanged(); + } + break; + case SID_SET_SUB_SCRIPT: + if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SfxBoolItem)) + { + const SfxBoolItem* pItem = (const SfxBoolItem*)pState; + mbSub = pItem->GetValue(); + TextStyleChanged(); + } + else + { + mbSub = false; + TextStyleChanged(); + } + break; + case SID_SET_SUPER_SCRIPT: + if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SfxBoolItem)) + { + const SfxBoolItem* pItem = (const SfxBoolItem*)pState; + mbSuper = pItem->GetValue(); + TextStyleChanged(); + } + else + { + mbSuper = false; + TextStyleChanged(); + } + break; + case SID_ATTR_CHAR_KERNING: + if ( SFX_ITEM_AVAILABLE == eState ) + { + mbKernLBAvailable = true; + + if(pState->ISA(SvxKerningItem)) + { + const SvxKerningItem* pKerningItem = (const SvxKerningItem*)pState; + mlKerning = (long)pKerningItem->GetValue(); + mbKernAvailable = true; + } + else + { + mlKerning = 0; + mbKernAvailable =false; + } + } + else if (SFX_ITEM_DISABLED == eState) + { + mbKernLBAvailable = false; + mbKernAvailable = false; + mlKerning = 0; + } + else + { + mbKernLBAvailable = true; + mbKernAvailable = false; + mlKerning = 0; + } + break; + + // font size +/- enhancement in sd + case SID_SHRINK_FONT_SIZE: + case SID_GROW_FONT_SIZE: + switch(maContext.GetCombinedContext()) + { + case CombinedEnumContext(Application_Draw, Context_DrawText): + case CombinedEnumContext(Application_Draw, Context_Text): + case CombinedEnumContext(Application_Draw, Context_Table): + case CombinedEnumContext(Application_Draw, Context_OutlineText): + case CombinedEnumContext(Application_Draw, Context_Draw): + case CombinedEnumContext(Application_Draw, Context_TextObject): + case CombinedEnumContext(Application_Draw, Context_Graphic): + case CombinedEnumContext(Application_Impress, Context_DrawText): + case CombinedEnumContext(Application_Impress, Context_Text): + case CombinedEnumContext(Application_Impress, Context_Table): + case CombinedEnumContext(Application_Impress, Context_OutlineText): + case CombinedEnumContext(Application_Impress, Context_Draw): + case CombinedEnumContext(Application_Impress, Context_TextObject): + case CombinedEnumContext(Application_Impress, Context_Graphic): + if(eState == SFX_ITEM_DISABLED) + { + mpToolBoxIncDec->Disable(); + } + else + { + mpToolBoxIncDec->Enable(); + } + break; + } + break; + } +} + + + + +void TextPropertyPanel::TextStyleChanged() +{ + if( !mbWeightAvailable ) + mpToolBoxFont->EnableItem(TBI_BOLD,false); + else + mpToolBoxFont->EnableItem(TBI_BOLD,true); + + if(!mbPostureAvailable ) + mpToolBoxFont->EnableItem(TBI_ITALIC,false); + else + mpToolBoxFont->EnableItem(TBI_ITALIC,true); + + UpdateFontBold(); + UpdateFontItalic(); + UpdateFontUnderline(); + UpdateFontStrikeOut(); + UpdateFontShadowed(); + UpdateFontScript(); +} + + + + +void TextPropertyPanel::UpdateFontBold() +{ + if( meWeight == WEIGHT_BOLD ) + { + mpToolBoxFont->SetItemState(TBI_BOLD, STATE_CHECK); + } + else + { + mpToolBoxFont->SetItemState(TBI_BOLD, STATE_NOCHECK); + } +} +void TextPropertyPanel::UpdateFontItalic() +{ + if(meItalic == ITALIC_NORMAL) + { + mpToolBoxFont->SetItemState(TBI_ITALIC, STATE_CHECK); + } + else + { + mpToolBoxFont->SetItemState(TBI_ITALIC, STATE_NOCHECK); + } +} +void TextPropertyPanel::UpdateFontUnderline() +{ + if(meUnderline == UNDERLINE_NONE) + { + mpToolBoxFont->SetItemState(TBI_UNDERLINE, STATE_NOCHECK); + } + else + { + mpToolBoxFont->SetItemState(TBI_UNDERLINE, STATE_CHECK); + } +} +void TextPropertyPanel::UpdateFontStrikeOut() +{ + if(meStrike != STRIKEOUT_NONE && meStrike != STRIKEOUT_DONTKNOW) + { + mpToolBoxFont->SetItemState(TBI_STRIKEOUT, STATE_CHECK); + } + else + { + mpToolBoxFont->SetItemState(TBI_STRIKEOUT, STATE_NOCHECK); + } +} +void TextPropertyPanel::UpdateFontShadowed() +{ + if(mbShadow) + { + mpToolBoxFont->SetItemState(TBI_SHADOWED, STATE_CHECK); + } + else + { + mpToolBoxFont->SetItemState(TBI_SHADOWED, STATE_NOCHECK); + } +} +void TextPropertyPanel::UpdateFontScript() +{ + //script for sw + mpToolBoxScriptSw->EnableItem(TBI_SUPER,true); + mpToolBoxScriptSw->EnableItem(TBI_SUB,true); + if(meEscape == SVX_ESCAPEMENT_SUPERSCRIPT) + { + mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_CHECK); + mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_NOCHECK); + } + else if(meEscape == SVX_ESCAPEMENT_SUBSCRIPT) + { + mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_NOCHECK); + mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_CHECK); + } + else + { + mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_NOCHECK); + mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_NOCHECK); + } + + //script for sc sd + mpToolBoxScript->EnableItem(TBI_SUPER,true); + mpToolBoxScript->EnableItem(TBI_SUB,true); + if(mbSuper) + { + mpToolBoxScript->SetItemState(TBI_SUPER, STATE_CHECK); + mpToolBoxScript->SetItemState(TBI_SUB, STATE_NOCHECK); + } + else if(mbSub) + { + mpToolBoxScript->SetItemState(TBI_SUPER, STATE_NOCHECK); + mpToolBoxScript->SetItemState(TBI_SUB, STATE_CHECK); + } + else + { + mpToolBoxScript->SetItemState(TBI_SUPER, STATE_NOCHECK); + mpToolBoxScript->SetItemState(TBI_SUB, STATE_NOCHECK); + } +} + +Color TextPropertyPanel::GetFontColor (void) const +{ + return maColor; +} + +void TextPropertyPanel::SetFontColor ( + const String& /*rsColorName*/, + const Color aColor) +{ + SvxColorItem aColorItem(aColor, SID_ATTR_CHAR_COLOR); + mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_COLOR, SFX_CALLMODE_RECORD, &aColorItem, 0L); + maColor = aColor; +} + +Color TextPropertyPanel::GetBrushColor (void) const +{ + return maBackColor; +} + +void TextPropertyPanel::SetBrushColor ( + const String& /*rsColorName*/, + const Color aColor) +{ + SvxBrushItem aBrushItem(aColor, SID_ATTR_BRUSH_CHAR); + mpBindings->GetDispatcher()->Execute(SID_ATTR_BRUSH_CHAR, SFX_CALLMODE_RECORD, &aBrushItem, 0L); + maBackColor = aColor; +} + +Color& TextPropertyPanel::GetUnderlineColor() +{ + return meUnderlineColor; +} + +void TextPropertyPanel::SetUnderline(FontUnderline eUnderline) +{ + meUnderline = eUnderline; +} + +} } // end of namespace svx::sidebar diff --git a/svx/source/sidebar/text/TextPropertyPanel.hrc b/svx/source/sidebar/text/TextPropertyPanel.hrc new file mode 100644 index 000000000000..bfa0c821644b --- /dev/null +++ b/svx/source/sidebar/text/TextPropertyPanel.hrc @@ -0,0 +1,199 @@ +/* + * 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 "svx/dialogs.hrc" + +#define VS_SPACING_WIDTH 80 +#define CUSTOM_HEIGHT CBOX_HEIGHT + MBOX_HEIGHT + POPUPPANEL_MARGIN_LARGE * 3 + POPUPPANEL_MARGIN_SMALL * 2 + TEXT_HEIGHT * 2 +#define CUSTOM_WIDTH VS_SPACING_WIDTH - 8 +#define CUSTOM_X POPUPPANEL_MARGIN_LARGE + OFFSET_X + 1 +#define CUSTOM_Y OFFSET_Y + POPUPPANEL_MARGIN_SMALL * 3 + 15 * 6 + TEXT_HEIGHT +#define VS_UNDERLINE_WIDTH 57 +#define VS_UNDERLINE_HEIGHT 12 * 10 +//#define FT_TEST 1 +#define CB_SBFONT_FONT 2 +#define MB_SBFONT_FONTSIZE 3 +#define TB_FONT 4 +#define TB_INCREASE_DECREASE 5 +#define TB_FONTCOLOR 6 +#define TB_SCRIPT_SW 7 +#define TB_HIGHLIGHT 8 +#define TB_SPACING 9 +#define TB_SCRIPT 10 + + +#define IMG_INCREASE 11 +#define IMG_DECREASE 13 +#define IMG_BOLD 15 +#define IMG_ITALIC 17 +#define IMG_UNDERLINE 19 +#define IMG_STRIKEOUT 21 +#define IMG_SHADOWED 23 +#define IMG_FONTCOLOR 25 +#define IMG_SUPSCRIPT 27 +#define IMG_SUBSCRIPT 29 +//#define IMG_SPACING 31 +#define IMG_HIGHLIGHT 33 + +#define TBI_FONTCOLOR 50 +#define TBI_BOLD 51 +#define TBI_ITALIC 52 +#define TBI_UNDERLINE 53 +#define TBI_STRIKEOUT 54 +#define TBI_SHADOWED 55 +#define TBI_INCREASE 56 +#define TBI_DECREASE 57 +#define TBI_HIGHLIGHT 58 +#define TBI_SUPER 59 +#define TBI_SUB 60 +#define TBI_SUPER_SW 61 +#define TBI_SUB_SW 62 +#define TBI_SPACING 63 + +#define IMG_SPACING_D 71 + +//popup window underline +#define VS_UNDERLINE 1 +#define PB_OPTIONS 2 +#define BMP_UNDERLINE_MORE 3 + +#define IMG_SINGLE 10 +#define IMG_DOUBLE 11 +#define IMG_BOLD2 12 +#define IMG_DOT 13 +#define IMG_DOT_BOLD 14 +#define IMG_DASH 15 +#define IMG_DASH_LONG 16 +#define IMG_DASH_DOT 17 +#define IMG_DASH_DOT_DOT 18 +#define IMG_WAVE 19 + +#define STR_SINGLE 20 +#define STR_DOUBLE 21 +#define STR_BOLD 22 +#define STR_DOT 23 +#define STR_DOT_BOLD 24 +#define STR_DASH 25 +#define STR_DASH_LONG 26 +#define STR_DASH_DOT 27 +#define STR_DASH_DOT_DOT 28 +#define STR_WAVE 29 + +#define IMG_SINGLE_SEL 40 +#define IMG_DOUBLE_SEL 41 +#define IMG_BOLD2_SEL 42 +#define IMG_DOT_SEL 43 +#define IMG_DOT_BOLD_SEL 44 +#define IMG_DASH_SEL 45 +#define IMG_DASH_LONG_SEL 46 +#define IMG_DASH_DOT_SEL 47 +#define IMG_DASH_DOT_DOT_SEL 48 +#define IMG_WAVE_SEL 49 + +//popup window font color +#define VS_FONT_COLOR 1 +#define STR_AUTOMATICE 2 + +//POPUP WINDOW OF SPACING +#define VS_SPACING 1 + +#define CT_BORDER 7 +#define LB_KERNING 8 +#define ED_KERNING 9 + +#define FT_SPACING 18 +#define FT_BY 19 +#define FT_LASTCUSTOM 20 + +#define IMG_NORMAL 31 +#define IMG_VERY_TIGHT 32 +#define IMG_TIGHT 33 +#define IMG_LOOSE 34 +#define IMG_VERY_LOOSE 35 +#define IMG_CUSTOM 36 +#define IMG_CUSTOM_GRAY 37 + +#define IMG_NORMAL_S 51 +#define IMG_VERY_TIGHT_S 52 +#define IMG_TIGHT_S 53 +#define IMG_LOOSE_S 54 +#define IMG_VERY_LOOSE_S 55 + +#define STR_VERY_TIGHT 61 +#define STR_TIGHT 62 +#define STR_NORMAL 63 +#define STR_LOOSE 64 +#define STR_VERY_LOOSE 65 +#define STR_CUSTOM 66 + +#define STR_VERY_TIGHT_TIP 67 +#define STR_TIGHT_TIP 68 +#define STR_NORMAL_TIP 69 +#define STR_LOOSE_TIP 70 +#define STR_VERY_LOOSE_TIP 71 + +#define STR_CUSTOM_C_TIP 72 +#define STR_CUSTOM_E_TIP 73 +#define STR_PT 74 +#define STR_QH_BOLD 75 +#define STR_QH_ITALIC 76 +#define STR_QH_UNDERLINE 77 + +//help ids +#define HID_COMBO_FONT_NAME "SVX_HID_COMBO_FONT_NAME" +#define HID_METRIC_FONT_SIZE "SVX_HID_METRIC_FONT_SIZE" +#define HID_TB_INCREASE_DECREASE "SVX_HID_TB_INCREASE_DECREASE" +#define HID_TBI_INCREASE "SVX_HID_TBI_INCREASE" +#define HID_TBI_DECREASE "SVX_HID_TBI_DECREASE" +#define HID_TB_FONT "SVX_HID_TB_FONT" +#define HID_TBI_FONT_BOLD "SVX_HID_TBI_FONT_BOLD" +#define HID_TBI_FONT_ITALIC "SVX_HID_TBI_FONT_ITALIC" +#define HID_TBI_FONT_UNDERLINE "SVX_HID_TBI_FONT_UNDERLINE" +#define HID_TBI_FONT_STRIKEOUT "SVX_HID_TBI_FONT_STRIKEOUT" +#define HID_TBI_FONT_SHADOWED "SVX_HID_TBI_FONT_SHADOWED" +#define HID_TB_COLOR "SVX_HID_TB_COLOR" +#define HID_TBI_COLOR "SVX_HID_TBI_COLOR" +#define HID_TB_SCRIPT "SVX_HID_TB_SCRIPT" +#define HID_TBI_SCRIPT_SUPER "SVX_HID_TBI_SCRIPT_SUPER" +#define HID_TBI_SCRIPT_SUB "SVX_HID_TBI_SCRIPT_SUB" +#define HID_TB_SCRIPT_SW "SVX_HID_TB_SCRIPT_SW" +#define HID_TBI_SCRIPT_SW_SUPER "SVX_HID_TBI_SCRIPT_SW_SUPER" +#define HID_TBI_SCRIPT_SW_SUB "SVX_HID_TBI_SCRIPT_SW_SUB" +#define HID_TB_SPACING "SVX_HID_TB_SPACING" +#define HID_TBI_SPACING "SVX_HID_TBI_SPACING" +#define HID_TB_HIGHLIGHT "SVX_HID_TB_HIGHLIGHT" +#define HID_TBI_HIGHLIGHT "SVX_HID_TBI_HIGHLIGHT" + +#define HID_UNDERLINE_VS "SVX_HID_UNDERLINE_VS" +#define HID_UNDERLINE_BTN "SVX_HID_UNDERLINE_BTN" + +#define HID_COLOR_VS "SVX_HID_COLOR_VS" + +#define HID_SPACING_TB_VERY_LOOSE "SVX_HID_SPACING_TB_VERY_LOOSE" +#define HID_SPACING_TBI_VERY_LOOSE "SVX_HID_SPACING_TBI_VERY_LOOSE" +#define HID_SPACING_TB_LOOSE "SVX_HID_SPACING_TB_LOOSE" +#define HID_SPACING_TBI_LOOSE "SVX_HID_SPACING_TBI_LOOSE" +#define HID_SPACING_TB_NORMAL "SVX_HID_SPACING_TB_NORMAL" +#define HID_SPACING_TBI_NORMAL "SVX_HID_SPACING_TBI_NORMAL" +#define HID_SPACING_TB_TIGHT "SVX_HID_SPACING_TB_TIGHT" +#define HID_SPACING_TBI_TIGHT "SVX_HID_SPACING_TBI_TIGHT" +#define HID_SPACING_TB_VERY_TIGHT "SVX_HID_SPACING_TB_VERY_TIGHT" +#define HID_SPACING_TBI_VERY_TIGHT "SVX_HID_SPACING_TBI_VERY_TIGHT" +#define HID_SPACING_TB_CUSTOM "SVX_HID_SPACING_TB_CUSTOM" +#define HID_SPACING_TBI_CUSTOM "SVX_HID_SPACING_TBI_CUSTOM" +#define HID_SPACING_CB_KERN "SVX_HID_SPACING_CB_KERN" +#define HID_SPACING_MB_KERN "SVX_HID_SPACING_MB_KERN" diff --git a/svx/source/sidebar/text/TextPropertyPanel.hxx b/svx/source/sidebar/text/TextPropertyPanel.hxx new file mode 100644 index 000000000000..546eb72b6157 --- /dev/null +++ b/svx/source/sidebar/text/TextPropertyPanel.hxx @@ -0,0 +1,230 @@ +/* + * 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 SVX_SIDEBAR_TEXT_PROPERTY_PAGE_HXX +#define SVX_SIDEBAR_TEXT_PROPERTY_PAGE_HXX + +#include <vcl/ctrl.hxx> +#include <sfx2/sidebar/SidebarPanelBase.hxx> +#include <sfx2/sidebar/ControllerItem.hxx> +#include <sfx2/sidebar/IContextChangeReceiver.hxx> + +#include <svtools/ctrlbox.hxx> +#include <svx/tbxcolorupdate.hxx> +#include <editeng/svxenum.hxx> +#include <editeng/fhgtitem.hxx> + +//#include <com/sun/star/ui/XUIElement.hpp> +#include <com/sun/star/ui/XSidebar.hpp> + +#include <boost/scoped_ptr.hpp> +#include "TextCharacterSpacingPopup.hxx" +#include "TextUnderlinePopup.hxx" +#include <svx/sidebar/ColorPopup.hxx> +#include <vcl/vclenum.hxx> + +class FloatingWindow; +class ToolBox; + +namespace svx { namespace sidebar { + +class SvxSBFontNameBox; +class PopupControl; +class PopupContainer; + +class TextPropertyPanel + : public Control, + public ::sfx2::sidebar::IContextChangeReceiver, + public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface +{ +public: + static TextPropertyPanel* Create ( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings, + const cssu::Reference<css::ui::XSidebar>& rxSidebar); + + virtual void DataChanged (const DataChangedEvent& rEvent); + SfxBindings* GetBindings(); + ::sfx2::sidebar::ControllerItem& GetSpaceController(); + long GetSelFontSize(); + void SetSpacing(long nKern); + void EndSpacingPopupMode (void); + void EndUnderlinePopupMode (void); + Color GetFontColor (void) const; + void SetFontColor (const String& rsColorName,const Color aColor); + Color GetBrushColor (void) const; + void SetBrushColor (const String& rsColorName,const Color aColor); + void SetUnderline(FontUnderline eUnderline); + Color& GetUnderlineColor(); + void SetDefaultUnderline(FontUnderline eUnderline); + + + enum ColorType + { + FONT_COLOR = 1, + BACK_COLOR = 2 + }; + + virtual void HandleContextChange ( + const ::sfx2::sidebar::EnumContext aContext); + + virtual void NotifyItemUpdate( + const sal_uInt16 nSId, + const SfxItemState eState, + const SfxPoolItem* pState); + +private: + //ui controls + ::boost::scoped_ptr<SvxSBFontNameBox> mpFontNameBox; + FontSizeBox maFontSizeBox; + ::boost::scoped_ptr<Window> mpToolBoxIncDecBackground; + ::boost::scoped_ptr<ToolBox> mpToolBoxIncDec; + ::boost::scoped_ptr<Window> mpToolBoxFontBackground; + ::boost::scoped_ptr<ToolBox> mpToolBoxFont; + ::boost::scoped_ptr<Window> mpToolBoxFontColorBackground; + ::boost::scoped_ptr<ToolBox> mpToolBoxFontColor; + ::boost::scoped_ptr<Window> mpToolBoxScriptBackground; + ::boost::scoped_ptr<ToolBox> mpToolBoxScript; + ::boost::scoped_ptr<Window> mpToolBoxScriptSwBackground; + ::boost::scoped_ptr<ToolBox> mpToolBoxScriptSw; + ::boost::scoped_ptr<Window> mpToolBoxSpacingBackground; + ::boost::scoped_ptr<ToolBox> mpToolBoxSpacing; + ::boost::scoped_ptr<Window> mpToolBoxHighlightBackground; + ::boost::scoped_ptr<ToolBox> mpToolBoxHighlight; + ::boost::scoped_ptr<ToolboxButtonColorUpdater> mpFontColorUpdater; + ::boost::scoped_ptr<ToolboxButtonColorUpdater> mpHighlightUpdater; + + //control items + ::sfx2::sidebar::ControllerItem maFontNameControl; + ::sfx2::sidebar::ControllerItem maFontSizeControl; + ::sfx2::sidebar::ControllerItem maWeightControl; + ::sfx2::sidebar::ControllerItem maItalicControl; + ::sfx2::sidebar::ControllerItem maUnderlineControl; + ::sfx2::sidebar::ControllerItem maStrikeControl; + ::sfx2::sidebar::ControllerItem maShadowControl; + ::sfx2::sidebar::ControllerItem maFontColorControl; + ::sfx2::sidebar::ControllerItem maScriptControlSw; + ::sfx2::sidebar::ControllerItem maSuperScriptControl; + ::sfx2::sidebar::ControllerItem maSubScriptControl; + ::sfx2::sidebar::ControllerItem maSpacingControl; + ::sfx2::sidebar::ControllerItem maHighlightControl; + ::sfx2::sidebar::ControllerItem maSDFontGrow; + ::sfx2::sidebar::ControllerItem maSDFontShrink; + + //Images + Image maImgIncrease; + Image maImgDecrease; + Image maImgBold; + Image maImgItalic; + Image maImgUnderline; + Image maImgStrike; + Image maImgShadow; + Image maImgFontColor; + Image maImgSupScript; + Image maImgSubScript; + Image maImgHighlight; + + Image maImgNormalIcon; + + FontWeight meWeight; + FontItalic meItalic; + FontUnderline meUnderline; + Color meUnderlineColor; // + bool mbShadow; + FontStrikeout meStrike; + bool mbWeightAvailable; + bool mbPostureAvailable; + Color maColor; + bool mbColorAvailable; + Color maBackColor; + bool mbBackColorAvailable; + ColorType meColorType; + SvxEscapement meEscape; //for sw + bool mbSuper; + bool mbSub; + bool mbKernAvailable; + bool mbKernLBAvailable; + long mlKerning; + SvxFontHeightItem* mpHeightItem; + + const FontList* mpFontList; + bool mbMustDelete; + bool mbFocusOnFontSizeCtrl; + TextCharacterSpacingPopup maCharSpacePopup; + TextUnderlinePopup maUnderlinePopup; + ColorPopup maFontColorPopup; + ColorPopup maBrushColorPopup; + + cssu::Reference<css::frame::XFrame> mxFrame; + ::sfx2::sidebar::EnumContext maContext; + SfxBindings* mpBindings; + cssu::Reference<css::ui::XSidebar> mxSidebar; + + TextPropertyPanel ( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings, + const cssu::Reference<css::ui::XSidebar>& rxSidebar); + virtual ~TextPropertyPanel (void); + + + PopupControl* CreateCharacterSpacingControl (PopupContainer* pParent); + PopupControl* CreateFontColorPopupControl (PopupContainer* pParent); + PopupControl* CreateBrushColorPopupControl (PopupContainer* pParent); + PopupControl* CreateUnderlinePopupControl (PopupContainer* pParent); + DECL_LINK(SpacingClickHdl, ToolBox*); + DECL_LINK(ToolBoxFontColorDropHdl, ToolBox *); //for new color picker + DECL_LINK(ToolBoxHighlightDropHdl, ToolBox *); + DECL_LINK(ToolBoxUnderlineClickHdl, ToolBox* ); + + void Initialize (void); + void SetupIcons (void); + void InitToolBoxFont(); + void InitToolBoxIncDec(); + void InitToolBoxFontColor(); + void InitToolBoxScript(); + void InitToolBoxHighlight(); + void InitToolBoxSpacing(); + + void UpdateFontBold(); + void UpdateFontItalic(); + void UpdateFontUnderline(); + void UpdateFontStrikeOut(); + void UpdateFontShadowed(); + void UpdateFontScript(); + + DECL_LINK(FontSelHdl, FontNameBox *); + DECL_LINK(FontSizeModifyHdl, FontSizeBox *); + DECL_LINK(FontSizeSelHdl, FontSizeBox *); + DECL_LINK(FontSizeLoseFocus, FontSizeBox *); + DECL_LINK(ToolboxFontSelectHandler, ToolBox *); + DECL_LINK(ToolboxIncDecSelectHdl, ToolBox *); + DECL_LINK(ImplPopupModeEndHdl, FloatingWindow* ); + DECL_LINK(ToolBoxSwScriptSelectHdl, ToolBox *); + DECL_LINK(ToolBoxScriptSelectHdl, ToolBox *); + + + + void TextStyleChanged(); + + Image GetIcon (const ::rtl::OUString& rsURL); +}; + +} } // end of namespace ::svx::sidebar + +#endif diff --git a/svx/source/sidebar/text/TextPropertyPanel.src b/svx/source/sidebar/text/TextPropertyPanel.src new file mode 100644 index 000000000000..6ced5c7b10ac --- /dev/null +++ b/svx/source/sidebar/text/TextPropertyPanel.src @@ -0,0 +1,702 @@ +/* + * 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 "TextPropertyPanel.hrc" +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include "helpid.hrc" + +#define CONTROL_HEIGHT_FONT_NAME 250 +#define CONTROL_HEIGHT_FONT_SIZE 180 +#define FONTNAME_WIDTH TOOLBOX_ITEM_WIDTH * 2 + TOOLBOX_ITEM_DD_WIDTH +#define FONTSIZE_WIDTH TOOLBOX_ITEM_WIDTH * 2 + +#define TB_SPACE 18 +#define TB_SPACE_V 4 +#define TEXT_WIDTH TOOLBOX_42_42_ITEM_DD_WIDTH + TB_SPACE - 3 + +#define FT_TB_SPACE 1 +#define BK_IMG 20 + +Control RID_SIDEBAR_TEXT_PANEL +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + + Size = MAP_APPFONT( PROPERTYPAGE_WIDTH, SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + TOOLBOX_ITEM_HEIGHT * 2 + CONTROL_SPACING_VERTICAL * 2 + SECTIONPAGE_MARGIN_VERTICAL_BOT ); + HelpID = HID_PROPERTYPANEL_TEXT_SECTION ; + Text = "Text"; + + ComboBox CB_SBFONT_FONT + { + Border = TRUE; + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL , SECTIONPAGE_MARGIN_VERTICAL_TOP ); + Size = MAP_APPFONT ( FONTNAME_WIDTH , CONTROL_HEIGHT_FONT_NAME ); + TabStop = TRUE; + DropDown = TRUE; + HelpID = HID_COMBO_FONT_NAME ; + QuickHelpText [ en-US ] = "Font"; + }; + MetricBox MB_SBFONT_FONTSIZE + { + Border = TRUE; + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + FONTNAME_WIDTH + 2, SECTIONPAGE_MARGIN_VERTICAL_TOP); + Size = MAP_APPFONT ( FONTSIZE_WIDTH - 1, CONTROL_HEIGHT_FONT_SIZE ); + TabStop = TRUE; + DropDown = TRUE; + HelpID = HID_METRIC_FONT_SIZE; + QuickHelpText [ en-US ] = "Font Size"; + }; + + ToolBox TB_INCREASE_DECREASE + { + SVLook = TRUE ; + Pos = MAP_APPFONT ( PROPERTYPAGE_WIDTH - SECTIONPAGE_MARGIN_HORIZONTAL - TOOLBOX_ITEM_WIDTH * 2, SECTIONPAGE_MARGIN_VERTICAL_TOP) ; + Size = MAP_APPFONT ( TOOLBOX_ITEM_WIDTH * 2 ,TOOLBOX_ITEM_HEIGHT ) ; + TabStop = TRUE ; +// HelpID = HID_TB_INCREASE_DECREASE; + HelpID = HID_PPROPERTYPANEL_TEXT_TBX_FONTSIZE_INDE; + Text = "Font Size Adjusting" ; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_INCREASE; + Text [ en-US ] = "Increase Font Size" ; +// HelpID = HID_TBI_INCREASE; + HelpID = HID_PPROPERTYPANEL_TEXT_TBI_INCREASE; + }; + ToolBoxItem + { + Identifier = TBI_DECREASE; + Text [ en-US ] = "Decrease Font Size" ; +// HelpID = HID_TBI_DECREASE; + HelpID = HID_PPROPERTYPANEL_TEXT_TBI_DECREASE; + }; + }; + }; + ToolBox TB_FONT + { + SVLook = TRUE ; + Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL + 1, SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL + 1) ; + Size = MAP_APPFONT ( TOOLBOX_ITEM_WIDTH * 4 + TOOLBOX_ITEM_DD_WIDTH, TOOLBOX_ITEM_HEIGHT ) ; + TabStop = TRUE ; +// HelpID = HID_TB_FONT; + HelpID = HID_PPROPERTYPANEL_TEXT_TBX_FONT; + Text = "Font Effects" ; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_BOLD; + Text [ en-US ] = "Bold" ; +// HelpID = HID_TBI_FONT_BOLD; + HelpID = HID_PPROPERTYPANEL_TEXT_TBI_BOLD; + }; + ToolBoxItem + { + Identifier = TBI_ITALIC; + Text [ en-US ] = "Italic" ; +// HelpID = HID_TBI_FONT_ITALIC; + HelpID = HID_PPROPERTYPANEL_TEXT_TBI_ITALIC; + }; + ToolBoxItem + { + Identifier = TBI_UNDERLINE; + DropDown = TRUE ; + Text [ en-US ] = "Underline" ; +// HelpID = HID_TBI_FONT_UNDERLINE; + HelpID = HID_PPROPERTYPANEL_TEXT_TBI_UNDERLINE; + }; + ToolBoxItem + { + Identifier = TBI_STRIKEOUT; + Text [ en-US ] = "Strikethrough" ; +// HelpID = HID_TBI_FONT_STRIKEOUT; + HelpID = HID_PPROPERTYPANEL_TEXT_TBI_STRIKEOUT; + }; + ToolBoxItem + { + Identifier = TBI_SHADOWED; + Text [ en-US ] = "Shadow" ; +// HelpID = HID_TBI_FONT_SHADOWED; + HelpID = HID_PPROPERTYPANEL_TEXT_TBI_SHADOWED; + }; + }; + }; + + String STR_QH_BOLD + { + Text [ en-US ] = "Bold (Ctrl+B)"; + }; + String STR_QH_ITALIC + { + Text [ en-US ] = "Italic (Ctrl+I)"; + }; + String STR_QH_UNDERLINE + { + Text [ en-US ] = "Underline (Ctrl+U)"; + }; + + + ToolBox TB_FONTCOLOR + { +// HelpID = HID_TB_COLOR; + HelpID = HID_PPROPERTYPANEL_TEXT_TBX_FONT_COLOR; + SVLook = TRUE ; + Pos = MAP_APPFONT (PROPERTYPAGE_WIDTH - SECTIONPAGE_MARGIN_HORIZONTAL - TOOLBOX_ITEM_WIDTH * 2, SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL + 1) ; + Size = MAP_APPFONT (TOOLBOX_ITEM_DD_WIDTH ,TOOLBOX_ITEM_HEIGHT ) ; + TabStop = TRUE ; + Text = "Font Color" ; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_FONTCOLOR ; +// HelpID = HID_TBI_COLOR; + HelpID = HID_PPROPERTYPANEL_TEXT_TBI_FONT_COLOR; + DropDown = TRUE ; + Text [ en-US ] = "Font Color" ; + }; + }; + }; + + ToolBox TB_HIGHLIGHT + { + SVLook = TRUE ; + Pos = MAP_APPFONT (PROPERTYPAGE_WIDTH - SECTIONPAGE_MARGIN_HORIZONTAL - TOOLBOX_ITEM_WIDTH * 2 , SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + (TOOLBOX_ITEM_HEIGHT + 2) + CONTROL_SPACING_VERTICAL * 2 + 1) ; + Size = MAP_APPFONT (TOOLBOX_ITEM_DD_WIDTH ,TOOLBOX_ITEM_HEIGHT ) ; + TabStop = TRUE ; +// HelpID = HID_TB_HIGHLIGHT; + HelpID = HID_PPROPERTYPANEL_TEXT_TBX_HIGHLIGHT_COLOR; + Text = "Highlight Color" ; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_HIGHLIGHT ; +// HelpID = HID_TBI_HIGHLIGHT; + HelpID = HID_PPROPERTYPANEL_TEXT_TBI_HIGHLIGHT_COLOR; + DropDown = TRUE ; + Text [ en-US ] = "Highlight Color" ; + }; + }; + }; + + ToolBox TB_SCRIPT_SW + { + SVLook = TRUE ; + Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL + 1 , SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL * 2 + (TOOLBOX_ITEM_HEIGHT + 2) + 1) ; + Size = MAP_APPFONT (TOOLBOX_ITEM_WIDTH * 2 ,TOOLBOX_ITEM_HEIGHT ) ; + TabStop = TRUE ; +// HelpID = HID_TB_SCRIPT_SW; + HelpID = HID_PPROPERTYPANEL_TEXT_TBX_SCRIPT_SW; + Text = "Font Position" ; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_SUPER_SW; + Text [ en-US ] = "Superscript" ; +// HelpID = HID_TBI_SCRIPT_SW_SUPER; + HelpID = HID_PPROPERTYPANEL_TEXT_TBI_SUPER_SW; + }; + ToolBoxItem + { + Identifier = TBI_SUB_SW; + Text [ en-US ] = "Subscript" ; +// HelpID = HID_TBI_SCRIPT_SW_SUB; + HelpID = HID_PPROPERTYPANEL_TEXT_TBI_SUB_SW; + }; + }; + }; + ToolBox TB_SCRIPT + { + SVLook = TRUE ; + Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL + 1 , SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL * 2 + (TOOLBOX_ITEM_HEIGHT + 2) + 1) ; + Size = MAP_APPFONT (TOOLBOX_ITEM_WIDTH * 2 ,TOOLBOX_ITEM_HEIGHT ) ; + TabStop = TRUE ; +// HelpID = HID_TB_SCRIPT; + HelpID = HID_PPROPERTYPANEL_TEXT_TBX_SCRIPT; + Text = "Font Position" ; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_SUPER; + Text [ en-US ] = "Superscript" ; +// HelpID = HID_TBI_SCRIPT_SUPER; + HelpID = HID_PPROPERTYPANEL_TEXT_TBI_SUPER; + }; + ToolBoxItem + { + Identifier = TBI_SUB; + Text [ en-US ] = "Subscript" ; +// HelpID = HID_TBI_SCRIPT_SUB; + HelpID = HID_PPROPERTYPANEL_TEXT_TBI_SUB; + }; + }; + }; + + ToolBox TB_SPACING + { + SVLook = TRUE ; + Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL + 1 + TOOLBOX_ITEM_WIDTH * 2 + 4 , SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL * 2 + (TOOLBOX_ITEM_HEIGHT + 2) + 1) ; + Size = MAP_APPFONT (TOOLBOX_24_16_ITEM_DD_WIDTH, TOOLBOX_24_16_ITEM_HEIGHT ) ; + TabStop = TRUE ; + HelpID = HID_TB_SPACING; + Text = "Character Spacing" ; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_SPACING; + DropDown = TRUE ; + Text [ en-US ] = "Character Spacing" ; + HelpID = HID_TBI_SPACING; + }; + }; + }; + + Image IMG_INCREASE + { + ImageBitmap = Bitmap{File = "symphony/enlarge font.png";}; + // MaskColor = IMAGE_MASK_COLOR; + }; + Image IMG_DECREASE + { + ImageBitmap = Bitmap{File = "symphony/decrease font.png";}; + }; + Image IMG_BOLD + { + ImageBitmap = Bitmap{File = "symphony/sc_bold.png";};//sc_bold.bmp + }; + Image IMG_ITALIC + { + ImageBitmap = Bitmap{File = "symphony/sc_italic.png";};//sc_italic.bmp + }; + Image IMG_UNDERLINE + { + ImageBitmap = Bitmap{File = "symphony/sc_underline.png";};//sc_underline.png + }; + Image IMG_STRIKEOUT + { + ImageBitmap = Bitmap{File = "symphony/sc_strikeout.png";};//sc_strikeout.png + }; + Image IMG_SHADOWED + { + ImageBitmap = Bitmap{File = "symphony/sc_shadowed.png";};//sc_shadowed.png + }; + Image IMG_FONTCOLOR + { + ImageBitmap = Bitmap{File = "symphony/sc_color.png";}; + }; + Image IMG_SUPSCRIPT + { + ImageBitmap = Bitmap{File = "symphony/sc_superscript.png";}; + }; + Image IMG_SUBSCRIPT + { + ImageBitmap = Bitmap{File = "symphony/sc_subscript.png";}; + }; +// Image IMG_SPACING +// { +// ImageBitmap = Bitmap{File = "symphony/icon_normal.png";}; +// }; + Image IMG_HIGHLIGHT + { + ImageBitmap = Bitmap{File = "symphony/Highlight.png";};//sc_backcolor + }; + + //small icon for spacing + Image IMG_SPACING_D + { + ImageBitmap = Bitmap{File = "symphony/icon_normal.png";}; + }; +}; + +Control RID_POPUPPANEL_TEXTPAGE_UNDERLINE +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + + Size = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL * 2 + POPUP_BORDER_WIDTH + VS_UNDERLINE_WIDTH, 13+ VS_UNDERLINE_HEIGHT + POPUP_BORDER_HEIGHT + POPUPPANEL_MARGIN_SMALL * 2 + POPUPPANEL_MARGIN_LARGE); + Control VS_UNDERLINE + { +// HelpID = HID_UNDERLINE_VS ; + HelpID = HID_PPROPERTYPANEL_TEXT_UNDERLINE_VS; + Hide = TRUE ; + Pos = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL + OFFSET_X , POPUPPANEL_MARGIN_SMALL + OFFSET_Y ); + Size = MAP_APPFONT ( VS_UNDERLINE_WIDTH ,VS_UNDERLINE_HEIGHT); + TabStop = TRUE ; + Text = "Underline"; + }; + + PushButton PB_OPTIONS + { + HelpID = HID_UNDERLINE_BTN; + Pos = MAP_APPFONT ( POPUPPANEL_MARGIN_SMALL + OFFSET_X , POPUPPANEL_MARGIN_SMALL * 2 + OFFSET_Y + VS_UNDERLINE_HEIGHT ); + Size = MAP_APPFONT ( VS_UNDERLINE_WIDTH, 13 ); + TabStop = TRUE; + Text [ en-US ] = "~More Options..."; + }; + + + Image IMG_SINGLE + { + ImageBitmap = Bitmap{File = "symphony/line1.bmp";}; + }; + Image IMG_DOUBLE + { + ImageBitmap = Bitmap{File = "symphony/line2.bmp";}; + }; + Image IMG_BOLD2 + { + ImageBitmap = Bitmap{File = "symphony/line3.bmp";}; + }; + Image IMG_DOT + { + ImageBitmap = Bitmap{File = "symphony/line4.bmp";}; + }; + Image IMG_DOT_BOLD + { + ImageBitmap = Bitmap{File = "symphony/line5.bmp";}; + }; + Image IMG_DASH + { + ImageBitmap = Bitmap{File = "symphony/line6.bmp";}; + }; + Image IMG_DASH_LONG + { + ImageBitmap = Bitmap{File = "symphony/line7.bmp";}; + }; + Image IMG_DASH_DOT + { + ImageBitmap = Bitmap{File = "symphony/line8.bmp";}; + }; + Image IMG_DASH_DOT_DOT + { + ImageBitmap = Bitmap{File = "symphony/line9.bmp";}; + }; + Image IMG_WAVE + { + ImageBitmap = Bitmap{File = "symphony/line10.bmp";}; + }; + + //image when selected + Image IMG_SINGLE_SEL + { + ImageBitmap = Bitmap{File = "symphony/selected-line1.bmp";}; + }; + Image IMG_DOUBLE_SEL + { + ImageBitmap = Bitmap{File = "symphony/selected-line2.bmp";}; + }; + Image IMG_BOLD2_SEL + { + ImageBitmap = Bitmap{File = "symphony/selected-line3.bmp";}; + }; + Image IMG_DOT_SEL + { + ImageBitmap = Bitmap{File = "symphony/selected-line4.bmp";}; + }; + Image IMG_DOT_BOLD_SEL + { + ImageBitmap = Bitmap{File = "symphony/selected-line5.bmp";}; + }; + Image IMG_DASH_SEL + { + ImageBitmap = Bitmap{File = "symphony/selected-line6.bmp";}; + }; + Image IMG_DASH_LONG_SEL + { + ImageBitmap = Bitmap{File = "symphony/selected-line7.bmp";}; + }; + Image IMG_DASH_DOT_SEL + { + ImageBitmap = Bitmap{File = "symphony/selected-line8.bmp";}; + }; + Image IMG_DASH_DOT_DOT_SEL + { + ImageBitmap = Bitmap{File = "symphony/selected-line9.bmp";}; + }; + Image IMG_WAVE_SEL + { + ImageBitmap = Bitmap{File = "symphony/selected-line10.bmp";}; + }; + +// //more button bmps +// Bitmap BMP_UNDERLINE_MORE +// { +// File = "symphony/morebutton.bmp"; +// }; + + //tips + String STR_SINGLE + { + Text [ en-US ] = "Single"; + }; + String STR_DOUBLE + { + Text [ en-US ] = "Double"; + }; + String STR_BOLD + { + Text [ en-US ] = "Bold"; + }; + String STR_DOT + { + Text [ en-US ] = "Dotted"; + }; + String STR_DOT_BOLD + { + Text [ en-US ] = "Dotted (Bold)"; + }; + String STR_DASH + { + Text [ en-US ] = "Dash"; + }; + String STR_DASH_LONG + { + Text [ en-US ] = "Long Dash"; + }; + String STR_DASH_DOT + { + Text [ en-US ] = "Dot Dash"; + }; + String STR_DASH_DOT_DOT + { + Text [ en-US ] = "Dot Dot Dash"; + }; + String STR_WAVE + { + Text [ en-US ] = "Wave"; + }; + +}; + + +Control RID_POPUPPANEL_TEXTPAGE_FONT_COLOR +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + Size = MAP_APPFONT( POPUP_COLOR_PICKER_WIDTH , POPUP_COLOR_PICKER_HEIGHT ); + + Control VS_FONT_COLOR + { +// HelpID = HID_COLOR_VS ; + HelpID = HID_PPROPERTYPANEL_TEXT_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 = "Color Picker"; + }; + String STR_AUTOMATICE + { + Text [ en-US ] = "Automatic"; + }; + +}; + +Control RID_POPUPPANEL_TEXTPAGE_SPACING +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + + Size = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL * 2 + POPUP_BORDER_WIDTH + VS_SPACING_WIDTH , POPUPPANEL_MARGIN_SMALL * 3 + 15 * 6 + CUSTOM_HEIGHT + TEXT_HEIGHT + POPUPPANEL_MARGIN_LARGE + POPUP_BORDER_WIDTH + 1); + + Control VS_SPACING + { + HelpId = HID_PPROPERTYPANEL_TEXT_SPACING_VS ; + Hide = TRUE ; + Pos = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL + OFFSET_X , POPUPPANEL_MARGIN_SMALL + OFFSET_Y ); + Size = MAP_APPFONT ( VS_SPACING_WIDTH , 15 * 6); + TabStop = TRUE ; + Text = "Character Spacing"; + }; + + FixedText FT_LASTCUSTOM + { + Pos = MAP_APPFONT ( POPUPPANEL_MARGIN_LARGE + OFFSET_X ,POPUPPANEL_MARGIN_SMALL + OFFSET_Y + POPUPPANEL_MARGIN_SMALL + 15 * 6) ; + Size = MAP_APPFONT ( CUSTOM_WIDTH , TEXT_HEIGHT ); + Left = TRUE ; + Text [ en-US ] = "Custom:" ; + }; + //custom area +// Control CT_BORDER +// { +// Pos = MAP_APPFONT ( POPUPPANEL_MARGIN_LARGE + OFFSET_X + 1 , OFFSET_Y + POPUPPANEL_MARGIN_SMALL * 3 + 15 * 6 + TEXT_HEIGHT) ; +// Size = MAP_APPFONT (CUSTOM_WIDTH , CUSTOM_HEIGHT ) ;// TOOLBOX_42_42_ITEM_DD_WIDTH * 2 + TB_SPACE * 2 - 5 + TEXT_WIDTH - 2 +// DialogControl = TRUE; +// }; + FixedText FT_SPACING + { + Pos = MAP_APPFONT ( CUSTOM_X + POPUPPANEL_MARGIN_LARGE, CUSTOM_Y + POPUPPANEL_MARGIN_LARGE); + Size = MAP_APPFONT ( CUSTOM_WIDTH - POPUPPANEL_MARGIN_LARGE * 2 , TEXT_HEIGHT ); + Left = TRUE ; + Text [ en-US ] = "~Character spacing: " ; + }; + ListBox LB_KERNING + { + Border = TRUE; + Pos = MAP_APPFONT ( CUSTOM_X + POPUPPANEL_MARGIN_LARGE, CUSTOM_Y + POPUPPANEL_MARGIN_LARGE + TEXT_HEIGHT + POPUPPANEL_MARGIN_SMALL);//20 + Size = MAP_APPFONT ( CUSTOM_WIDTH - POPUPPANEL_MARGIN_LARGE * 2 , 80 ) ; + TabStop = TRUE; + DropDown = TRUE ; + HelpID = HID_SPACING_CB_KERN; + StringList [ en-US ] = + { + < "Default" ; Default ; > ; + < "Expanded" ; Default ; > ; + < "Condensed" ; Default ; > ; + }; + }; + FixedText FT_BY + { + Pos = MAP_APPFONT ( CUSTOM_X + POPUPPANEL_MARGIN_LARGE, CUSTOM_Y + POPUPPANEL_MARGIN_LARGE * 2 + TEXT_HEIGHT + POPUPPANEL_MARGIN_SMALL + CBOX_HEIGHT ); + Size = MAP_APPFONT ( CUSTOM_WIDTH - POPUPPANEL_MARGIN_LARGE * 2 , TEXT_HEIGHT ); + Left = TRUE ; + Text [ en-US ] = "Change ~by: " ; + }; + MetricField ED_KERNING + { + HelpID = HID_SPACING_MB_KERN; + Border = TRUE; + Pos = MAP_APPFONT ( CUSTOM_X + POPUPPANEL_MARGIN_LARGE, CUSTOM_Y + POPUPPANEL_MARGIN_LARGE * 2 + TEXT_HEIGHT * 2 + POPUPPANEL_MARGIN_SMALL * 2 + CBOX_HEIGHT);//60 + Size = MAP_APPFONT ( CUSTOM_WIDTH - POPUPPANEL_MARGIN_LARGE * 2 , MBOX_HEIGHT ); + TabStop = TRUE; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 9999 ; + DecimalDigits = 1 ; + Unit = FUNIT_POINT ; + SpinSize = 10 ; + }; + + Image IMG_NORMAL + { + ImageBitmap = Bitmap{File = "symphony/spacing_normal.bmp" ;};//"spacing_normal.bmp" + }; + Image IMG_VERY_TIGHT + { + ImageBitmap = Bitmap{File = "symphony/spacing_very tight.bmp";}; + }; + Image IMG_TIGHT + { + ImageBitmap = Bitmap{File = "symphony/spacing_tight.bmp";}; + }; + Image IMG_LOOSE + { + ImageBitmap = Bitmap{File = "symphony/spacing_loose.bmp";}; + }; + Image IMG_VERY_LOOSE + { + ImageBitmap = Bitmap{File = "symphony/spacing_very loose.bmp";}; + }; + + Image IMG_NORMAL_S + { + ImageBitmap = Bitmap{File = "symphony/spacing_normal_s.bmp";}; + }; + Image IMG_VERY_TIGHT_S + { + ImageBitmap = Bitmap{File = "symphony/spacing_very tight_s.bmp";}; + }; + Image IMG_TIGHT_S + { + ImageBitmap = Bitmap{File = "symphony/spacing_tight_s.bmp";}; + }; + Image IMG_LOOSE_S + { + ImageBitmap = Bitmap{File = "symphony/spacing_loose_s.bmp";}; + }; + Image IMG_VERY_LOOSE_S + { + ImageBitmap = Bitmap{File = "symphony/spacing_very loose_s.bmp";}; + }; + + Image IMG_CUSTOM + { + ImageBitmap = Bitmap{File = "symphony/last_custom_common.png";}; + }; + Image IMG_CUSTOM_GRAY + { + ImageBitmap = Bitmap{File = "symphony/last_custom_common_grey.png";}; + }; + + String STR_VERY_TIGHT + { + Text [ en-US ] = "Very Tight"; + }; + String STR_TIGHT + { + Text [ en-US ] = "Tight"; + }; + String STR_NORMAL + { + Text [ en-US ] = "Normal"; + }; + String STR_LOOSE + { + Text [ en-US ] = "Loose"; + }; + String STR_VERY_LOOSE + { + Text [ en-US ] = "Very Loose"; + }; + String STR_CUSTOM + { + Text [ en-US ] = "Last Custom Value"; + }; + + String STR_VERY_TIGHT_TIP + { + Text [ en-US ] = " Spacing: Condensed By: 3pt"; + }; + String STR_TIGHT_TIP + { + Text [ en-US ] = " Spacing: Condensed By: 1.5pt"; + }; + String STR_NORMAL_TIP + { + Text [ en-US ] = " Spacing: Normal"; + }; + String STR_LOOSE_TIP + { + Text [ en-US ] = " Spacing: Expanded By: 3pt"; + }; + String STR_VERY_LOOSE_TIP + { + Text [ en-US ] = " Spacing: Expanded By: 6pt"; + }; + String STR_CUSTOM_C_TIP + { + Text [ en-US ] = " Spacing: Condensed By: "; + }; + String STR_CUSTOM_E_TIP + { + Text [ en-US ] = " Spacing: Expanded By: "; + }; + String STR_PT + { + Text[ en-US ] = "pt"; + }; +}; diff --git a/svx/source/sidebar/text/TextUnderlineControl.cxx b/svx/source/sidebar/text/TextUnderlineControl.cxx new file mode 100644 index 000000000000..17e0c4b96a91 --- /dev/null +++ b/svx/source/sidebar/text/TextUnderlineControl.cxx @@ -0,0 +1,264 @@ +/* + * 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 "TextUnderlineControl.hxx" +#include "TextPropertyPanel.hrc" +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include <svx/dialogs.hrc> +#include <svx/dialmgr.hxx> +#include <unotools/viewoptions.hxx> +#include <editeng/kernitem.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/sidebar/Theme.hxx> +#include <editeng/udlnitem.hxx> + +namespace svx { namespace sidebar { + +TextUnderlineControl::TextUnderlineControl(Window* pParent, svx::sidebar::TextPropertyPanel& rPanel) +: svx::sidebar::PopupControl( pParent,SVX_RES(RID_POPUPPANEL_TEXTPAGE_UNDERLINE)) +, mrTextPropertyPanel(rPanel) +, mpBindings(NULL) +, maVSUnderline( this, SVX_RES(VS_UNDERLINE)) +, maPBOptions (this, SVX_RES(PB_OPTIONS) ) + +, maIMGSingle (SVX_RES(IMG_SINGLE)) +, maIMGDouble (SVX_RES(IMG_DOUBLE)) +, maIMGBold (SVX_RES(IMG_BOLD2)) +, maIMGDot (SVX_RES(IMG_DOT)) +, maIMGDotBold (SVX_RES(IMG_DOT_BOLD)) +, maIMGDash (SVX_RES(IMG_DASH)) +, maIMGDashLong (SVX_RES(IMG_DASH_LONG)) +, maIMGDashDot (SVX_RES(IMG_DASH_DOT)) +, maIMGDashDotDot (SVX_RES(IMG_DASH_DOT_DOT)) +, maIMGWave (SVX_RES(IMG_WAVE)) + +, maIMGSingleSel (SVX_RES(IMG_SINGLE_SEL)) +, maIMGDoubleSel (SVX_RES(IMG_DOUBLE_SEL)) +, maIMGBoldSel (SVX_RES(IMG_BOLD2_SEL)) +, maIMGDotSel (SVX_RES(IMG_DOT_SEL)) +, maIMGDotBoldSel (SVX_RES(IMG_DOT_BOLD_SEL)) +, maIMGDashSel (SVX_RES(IMG_DASH_SEL)) +, maIMGDashLongSel (SVX_RES(IMG_DASH_LONG_SEL)) +, maIMGDashDotSel (SVX_RES(IMG_DASH_DOT_SEL)) +, maIMGDashDotDotSel (SVX_RES(IMG_DASH_DOT_DOT_SEL)) +, maIMGWaveSel (SVX_RES(IMG_WAVE_SEL)) + +{ + initial(); + FreeResource(); + mpBindings = mrTextPropertyPanel.GetBindings(); +} + +void TextUnderlineControl::initial() +{ + /*maPBOptions.SetDefBkColor(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_DropDownBackground ));//Color(244,245,249)//for high contrast + maPBOptions.SetHoverBkColor(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ) );//Color( 93, 120, 163 ) + maPBOptions.SetHoverTxtColor( sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Color_PanelTitleFont ) );//Color( 255, 255, 255 ) + maPBOptions.SetIcoPosX( 2);*/ + maVSUnderline.SetColor(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); + maVSUnderline.SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); + + Link aLink = LINK( this, TextUnderlineControl, PBClickHdl ) ; + maPBOptions.SetClickHdl(aLink); + + maVSUnderline.SetStyle( maVSUnderline.GetStyle()| WB_3DLOOK | WB_NO_DIRECTSELECT );// WB_NAMEFIELD | WB_ITEMBORDER |WB_DOUBLEBORDER | WB_NONEFIELD | + + maVSUnderline.InsertItem(1, maIMGSingle ,String(SVX_RES(STR_SINGLE))); + maVSUnderline.SetItemData(1, (void*)(sal_uInt64)UNDERLINE_SINGLE); + + maVSUnderline.InsertItem(2, maIMGDouble ,String(SVX_RES(STR_DOUBLE))); + maVSUnderline.SetItemData(2, (void*)(sal_uInt64)UNDERLINE_DOUBLE); + + maVSUnderline.InsertItem(3, maIMGBold, String(SVX_RES(STR_BOLD))); + maVSUnderline.SetItemData(3,(void*)(sal_uInt64)UNDERLINE_BOLD); + + maVSUnderline.InsertItem(4, maIMGDot, String(SVX_RES(STR_DOT))); + maVSUnderline.SetItemData(4,(void*)(sal_uInt64)UNDERLINE_DOTTED); + + maVSUnderline.InsertItem(5, maIMGDotBold, String(SVX_RES(STR_DOT_BOLD))); + maVSUnderline.SetItemData(5,(void*)(sal_uInt64)UNDERLINE_BOLDDOTTED); + + maVSUnderline.InsertItem(6, maIMGDash, String(SVX_RES(STR_DASH))); + maVSUnderline.SetItemData(6,(void*)(sal_uInt64)UNDERLINE_DASH); + + maVSUnderline.InsertItem(7, maIMGDashLong,String(SVX_RES(STR_DASH_LONG))); + maVSUnderline.SetItemData(7,(void*)(sal_uInt64)UNDERLINE_LONGDASH); + + maVSUnderline.InsertItem(8, maIMGDashDot, String(SVX_RES(STR_DASH_DOT))); + maVSUnderline.SetItemData(8,(void*)(sal_uInt64)UNDERLINE_DASHDOT); + + maVSUnderline.InsertItem(9, maIMGDashDotDot, String(SVX_RES(STR_DASH_DOT_DOT))); + maVSUnderline.SetItemData(9,(void*)(sal_uInt64)UNDERLINE_DASHDOTDOT); + + maVSUnderline.InsertItem(10, maIMGWave, String(SVX_RES(STR_WAVE))); + maVSUnderline.SetItemData(10,(void*)(sal_uInt64)UNDERLINE_WAVE); + + maVSUnderline.SetColCount( 1 ); + aLink = LINK( this, TextUnderlineControl, VSSelectHdl ) ; + maVSUnderline.SetSelectHdl(aLink); + + maVSUnderline.StartSelection(); + maVSUnderline.Show(); +} + +void TextUnderlineControl::GetFocus() +{ + maVSUnderline.GrabFocus(); +} +void TextUnderlineControl::Rearrange(FontUnderline eLine) +{ + // high contrast + maVSUnderline.SetItemImage(1, maIMGSingle); + maVSUnderline.SetItemImage(2, maIMGDouble ); + maVSUnderline.SetItemImage(3, maIMGBold); + maVSUnderline.SetItemImage(4, maIMGDot); + maVSUnderline.SetItemImage(5, maIMGDotBold); + maVSUnderline.SetItemImage(6, maIMGDash); + maVSUnderline.SetItemImage(7, maIMGDashLong); + maVSUnderline.SetItemImage(8, maIMGDashDot); + maVSUnderline.SetItemImage(9, maIMGDashDotDot); + maVSUnderline.SetItemImage(10, maIMGWave); +// maVSUnderline.SelectItem(0); //delete +// maVSUnderline.SetNoSelection(); + + switch(eLine) + { + case UNDERLINE_SINGLE: + maVSUnderline.SetItemImage(1, maIMGSingleSel); + maVSUnderline.SelectItem(1); //add + maVSUnderline.GrabFocus(); + break; + case UNDERLINE_DOUBLE: + maVSUnderline.SetItemImage(2, maIMGDoubleSel); + maVSUnderline.SelectItem(2); //add + maVSUnderline.GrabFocus(); + break; + case UNDERLINE_BOLD: + maVSUnderline.SetItemImage(3, maIMGBoldSel); + maVSUnderline.SelectItem(3); //add + maVSUnderline.GrabFocus(); + break; + case UNDERLINE_DOTTED: + maVSUnderline.SetItemImage(4, maIMGDotSel); + maVSUnderline.SelectItem(4); //add + maVSUnderline.GrabFocus(); + break; + case UNDERLINE_BOLDDOTTED: + maVSUnderline.SetItemImage(5, maIMGDotBoldSel); + maVSUnderline.SelectItem(5); //add + maVSUnderline.GrabFocus(); + break; + case UNDERLINE_DASH: + maVSUnderline.SetItemImage(6, maIMGDashSel); + maVSUnderline.SelectItem(6); //add + maVSUnderline.GrabFocus(); + break; + case UNDERLINE_LONGDASH: + maVSUnderline.SetItemImage(7, maIMGDashLongSel); + maVSUnderline.SelectItem(7); //add + maVSUnderline.GrabFocus(); + break; + case UNDERLINE_DASHDOT: + maVSUnderline.SetItemImage(8, maIMGDashDotSel); + maVSUnderline.SelectItem(8); //add + maVSUnderline.GrabFocus(); + break; + case UNDERLINE_DASHDOTDOT: + maVSUnderline.SetItemImage(9, maIMGDashDotDotSel); + maVSUnderline.SelectItem(9); //add + maVSUnderline.GrabFocus(); + break; + case UNDERLINE_WAVE: + maVSUnderline.SetItemImage(10, maIMGWaveSel); + maVSUnderline.SelectItem(10); //add + maVSUnderline.GrabFocus(); + break; + case UNDERLINE_NONE: + default: + maVSUnderline.SelectItem(1); + maVSUnderline.SetNoSelection();//add + maPBOptions.GrabFocus(); + } + maVSUnderline.StartSelection(); + //removed + //if(mpPage->meContextType == PROPERTY_CONTEXT_SC_CELL) + // maPBOptions.Disable(); + //else + // maPBOptions.Enable(); + //removed end +} +ValueSet& TextUnderlineControl::GetValueSet() +{ + return maVSUnderline; +} +Control& TextUnderlineControl::GetPB() +{ + return maPBOptions; +} +IMPL_LINK(TextUnderlineControl, VSSelectHdl, void *, pControl) +{ + if(pControl == &maVSUnderline) + { + sal_uInt16 iPos = maVSUnderline.GetSelectItemId(); + FontUnderline eUnderline = (FontUnderline)(sal_uInt64)maVSUnderline.GetItemData( iPos ); + + //<<modified + //SvxTextLineItem aLineItem(eUnderline, SID_ATTR_CHAR_UNDERLINE); + SvxUnderlineItem aLineItem(eUnderline, SID_ATTR_CHAR_UNDERLINE); + //modify end>> + + //<<add , this line of code will keep the new underline use pre-color + aLineItem.SetColor(mrTextPropertyPanel.GetUnderlineColor()); + //add end>> + mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_UNDERLINE, SFX_CALLMODE_RECORD, &aLineItem, 0L); + + //add , for the popup page not update immediately + mrTextPropertyPanel.SetUnderline(eUnderline); + //add end + //mrTextPropertyPanel.SetDefaultUnderline(eUnderline); + + mrTextPropertyPanel.EndUnderlinePopupMode(); + } + return( 0L ); +} + +IMPL_LINK(TextUnderlineControl, PBClickHdl, PushButton *, pPBtn) +{ + if(pPBtn == &maPBOptions) + { + if (mpBindings) + { + SfxDispatcher* pDisp = mpBindings->GetDispatcher(); + pDisp->Execute( SID_CHAR_DLG_EFFECT, SFX_CALLMODE_ASYNCHRON ); + } + //add + mrTextPropertyPanel.EndUnderlinePopupMode(); + //add end + } + return 0; +} + +}} diff --git a/svx/source/sidebar/text/TextUnderlineControl.hxx b/svx/source/sidebar/text/TextUnderlineControl.hxx new file mode 100644 index 000000000000..82bb9bec28d5 --- /dev/null +++ b/svx/source/sidebar/text/TextUnderlineControl.hxx @@ -0,0 +1,79 @@ +/* + * 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 _SVX_SIDEBAR_UNDERLINE_CONTROL_HXX_ +#define _SVX_SIDEBAR_UNDERLINE_CONTROL_HXX_ + +#include "svx/sidebar/PopupControl.hxx" +#include <sfx2/bindings.hxx> +#include <svtools/ctrlbox.hxx> +#include <svtools/ctrltool.hxx> +#include "TextPropertyPanel.hxx" +#include <vcl/fixed.hxx> +#include <vcl/button.hxx> + +#include <vcl/vclenum.hxx> +#include <svtools/valueset.hxx> + +namespace svx{ namespace sidebar { + +class TextUnderlineControl:public svx::sidebar::PopupControl +{ +public: + TextUnderlineControl(Window* pParent, svx::sidebar::TextPropertyPanel& rPanel); + void GetFocus(); + void Rearrange(FontUnderline eLine); + ValueSet& GetValueSet(); + Control& GetPB(); +private: + svx::sidebar::TextPropertyPanel& mrTextPropertyPanel; + SfxBindings* mpBindings; + ValueSet maVSUnderline; + PushButton maPBOptions; + + Image maIMGSingle; + Image maIMGDouble; + Image maIMGBold; + Image maIMGDot; + Image maIMGDotBold; + Image maIMGDash; + Image maIMGDashLong; + Image maIMGDashDot; + Image maIMGDashDotDot; + Image maIMGWave; + + Image maIMGSingleSel; + Image maIMGDoubleSel; + Image maIMGBoldSel; + Image maIMGDotSel; + Image maIMGDotBoldSel; + Image maIMGDashSel; + Image maIMGDashLongSel; + Image maIMGDashDotSel; + Image maIMGDashDotDotSel; + Image maIMGWaveSel; + + void initial(); + + DECL_LINK( PBClickHdl, PushButton *); + DECL_LINK(VSSelectHdl, void *); +}; +}} + + +#endif + diff --git a/svx/source/sidebar/text/TextUnderlinePopup.cxx b/svx/source/sidebar/text/TextUnderlinePopup.cxx new file mode 100644 index 000000000000..76fc10a1d29a --- /dev/null +++ b/svx/source/sidebar/text/TextUnderlinePopup.cxx @@ -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 . + */ +#include "TextUnderlinePopup.hxx" +#include "TextUnderlineControl.hxx" + + +namespace svx { namespace sidebar { + +TextUnderlinePopup::TextUnderlinePopup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator) + : Popup( + pParent, + rControlCreator, + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Character Spacing"))) +{ +} + + + + +TextUnderlinePopup::~TextUnderlinePopup (void) +{ +} + + + + +void TextUnderlinePopup::Rearrange (FontUnderline eLine) +{ + ProvideContainerAndControl(); + + TextUnderlineControl* pControl = dynamic_cast<TextUnderlineControl*>(mpControl.get()); + if (pControl != NULL) + pControl->Rearrange(eLine); +} + + +} } // end of namespace svx::sidebar + + diff --git a/svx/source/sidebar/text/TextUnderlinePopup.hxx b/svx/source/sidebar/text/TextUnderlinePopup.hxx new file mode 100644 index 000000000000..966c6cef8947 --- /dev/null +++ b/svx/source/sidebar/text/TextUnderlinePopup.hxx @@ -0,0 +1,43 @@ +/* + * 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 _SVX_SIDEBAR_UNDERLINE_POPUP_HXX_ +#define _SVX_SIDEBAR_UNDERLINE_POPUP_HXX_ + +#include "svx/sidebar/Popup.hxx" + +#include <boost/function.hpp> +#include <vcl/vclenum.hxx> +namespace svx { namespace sidebar { + +class TextUnderlinePopup + : public Popup +{ +public : + TextUnderlinePopup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator); + ~TextUnderlinePopup (void); + + void Rearrange (FontUnderline eLine); +}; + +} } // end of namespace svx::sidebar + +#endif + + diff --git a/svx/source/sidebar/tools/ColorControl.cxx b/svx/source/sidebar/tools/ColorControl.cxx new file mode 100644 index 000000000000..85d3f3539fcf --- /dev/null +++ b/svx/source/sidebar/tools/ColorControl.cxx @@ -0,0 +1,223 @@ +/* + * 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 <svx/sidebar/ColorControl.hxx> +#include "svx/svxids.hrc" +#include "svx/drawitem.hxx" +#include "svx/xtable.hxx" +#include "svx/dialmgr.hxx" +#include "svx/xflclit.hxx" +#include <tools/resid.hxx> +#include <sfx2/sidebar/Theme.hxx> +#include <sfx2/objsh.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <vcl/floatwin.hxx> +#include <unotools/pathoptions.hxx> +#include <editeng/editrids.hrc> + +using ::sfx2::sidebar::Theme; + +namespace svx { namespace sidebar { + +namespace { + short GetItemId_Imp( ValueSet& rValueSet, const Color& rCol ) + { + if(rCol == COL_AUTO) + return 0; + + bool bFound = false; + sal_uInt16 nCount = rValueSet.GetItemCount(); + sal_uInt16 n = 1; + + while ( !bFound && n <= nCount ) + { + Color aValCol = rValueSet.GetItemColor(n); + + bFound = ( aValCol.GetRed() == rCol.GetRed() + && aValCol.GetGreen() == rCol.GetGreen() + && aValCol.GetBlue() == rCol.GetBlue() ); + + if ( !bFound ) + n++; + } + return bFound ? n : -1; + } + class JustReleaseDeleter {public: + void operator() (XColorList*) const {/* release but don't delete pointer */} + }; + XColorListRef GetColorTable (void) + { + SfxObjectShell* pDocSh = SfxObjectShell::Current(); + DBG_ASSERT(pDocSh!=NULL, "DocShell not found!"); + if (pDocSh != NULL) + { + const SfxPoolItem* pItem = pDocSh->GetItem(SID_COLOR_TABLE); + if (pItem != NULL) + { + XColorListRef xTable = ((SvxColorListItem*)pItem)->GetColorList(); + if (xTable.is()) + return xTable; + } + } + + return XColorList::GetStdColorList(); + } +} // end of anonymous namespace + + + + +ColorControl::ColorControl ( + Window* pParent, + SfxBindings* pBindings, + const ResId& rControlResId, + const ResId& rValueSetResId, + const ::boost::function<Color(void)>& rNoColorGetter, + const ::boost::function<void(String&,Color)>& rColorSetter, + FloatingWindow* pFloatingWindow, + const ResId* pNoColorStringResId) // const sal_uInt32 nNoColorStringResId) + : PopupControl(pParent, rControlResId), + mpBindings(pBindings), + maVSColor(this, rValueSetResId), + mpFloatingWindow(pFloatingWindow), + msNoColorString( + pNoColorStringResId + ? String(*pNoColorStringResId) + : String()), + maNoColorGetter(rNoColorGetter), + maColorSetter(rColorSetter) +{ + FreeResource(); +} + + + +ColorControl::~ColorControl (void) +{ +} + + + + +void ColorControl::FillColors (void) +{ + XColorListRef xColorTable (GetColorTable()); + + if (xColorTable.is()) + { + const long nColorCount (xColorTable->Count()); + if (nColorCount <= 0) + return; + const sal_Int32 nColumnCount (ceil(sqrt(double(nColorCount)))); + const sal_Int32 nRowCount (ceil(double(nColorCount)/nColumnCount)); + maVSColor.SetColCount(nColumnCount); + maVSColor.SetLineCount(nRowCount); + const sal_Int32 nItemSize (15*12 / ::std::max<sal_Int32>(nColumnCount, nRowCount)); + maVSColor.CalcWindowSizePixel(Size(nItemSize,nItemSize)); + Link aLink = LINK(this, ColorControl, VSSelectHdl); + maVSColor.SetSelectHdl(aLink); + maVSColor.SetStyle( + (maVSColor.GetStyle() + | WB_TABSTOP | WB_ITEMBORDER | WB_NAMEFIELD// | WB_FLATVALUESET + | WB_NO_DIRECTSELECT | WB_MENUSTYLEVALUESET | WB_NO_DIRECTSELECT) + & ~WB_VSCROLL); + + if (msNoColorString.Len() > 0) + { + maVSColor.SetStyle(maVSColor.GetStyle() | WB_NONEFIELD); + maVSColor.SetText(msNoColorString); + } + + // Now, after all calls to SetStyle, we can change the + // background color. + maVSColor.SetBackground(Theme::GetWallpaper(Theme::Paint_DropDownBackground)); + + maVSColor.Clear(); + XColorEntry* pEntry = NULL; + for (sal_Int32 nIndex=0; nIndex<nColorCount; ++nIndex) + { + pEntry = xColorTable->GetColor(nIndex); + maVSColor.InsertItem(nIndex+1, pEntry->GetColor(), pEntry->GetName() ); + } + } + + maVSColor.Show(); +} + + + + +void ColorControl::GetFocus (void) +{ + maVSColor.GrabFocus(); +} + + + + +void ColorControl::SetCurColorSelect (Color aCol, bool bAvailable) +{ + FillColors(); + short nCol = GetItemId_Imp( maVSColor, aCol ); + if(! bAvailable) + { + maVSColor.SetNoSelection(); + return; + } + + //if not found + if( nCol == -1) + { + maVSColor.SetNoSelection(); + } + else + { + maVSColor.SelectItem( nCol ); + } +} + + + + +IMPL_LINK(ColorControl, VSSelectHdl, void *, pControl) +{ + if(pControl == &maVSColor) + { + sal_uInt16 iPos = maVSColor.GetSelectItemId(); + Color aColor = maVSColor.GetItemColor( iPos ); + String aTmpStr = maVSColor.GetItemText( iPos ); + + // react when the WB_NONEFIELD created entry is selected + if (aColor.GetColor() == 0 && aTmpStr.Len() == 0) + { + if (maNoColorGetter) + aColor = maNoColorGetter(); + } + if (maColorSetter) + maColorSetter(aTmpStr, aColor); + + if (mpFloatingWindow!=NULL && mpFloatingWindow->IsInPopupMode()) + mpFloatingWindow->EndPopupMode(); + } + + return 0; +} + + +} } // end of namespace svx::sidebar diff --git a/svx/source/sidebar/tools/ColorPopup.cxx b/svx/source/sidebar/tools/ColorPopup.cxx new file mode 100644 index 000000000000..ed51592e6b9b --- /dev/null +++ b/svx/source/sidebar/tools/ColorPopup.cxx @@ -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 . + */ +#include <svx/sidebar/ColorPopup.hxx> +#include <svx/sidebar/ColorControl.hxx> + + +namespace svx { namespace sidebar { + +ColorPopup::ColorPopup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator) + : Popup( + pParent, + rControlCreator, + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Color"))) +{ +} + + + + +ColorPopup::~ColorPopup (void) +{ +} + + + + +void ColorPopup::SetCurrentColor ( + const Color aCurrentColor, + const bool bIsColorAvailable) +{ + ProvideContainerAndControl(); + + ColorControl* pColorControl = dynamic_cast<ColorControl*>(mpControl.get()); + if (pColorControl != NULL) + pColorControl->SetCurColorSelect(aCurrentColor, bIsColorAvailable); +} + + +} } // end of namespace svx::sidebar diff --git a/svx/source/sidebar/tools/Popup.cxx b/svx/source/sidebar/tools/Popup.cxx new file mode 100644 index 000000000000..70c1e8665c5a --- /dev/null +++ b/svx/source/sidebar/tools/Popup.cxx @@ -0,0 +1,144 @@ +/* + * 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 "svx/sidebar/Popup.hxx" +#include "svx/sidebar/PopupContainer.hxx" +#include "svx/sidebar/PopupControl.hxx" + +#include <vcl/toolbox.hxx> + + +namespace svx { namespace sidebar { + +Popup::Popup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator, + const ::rtl::OUString& rsAccessibleName) + : mpControl(), + mpParent(pParent), + maControlCreator(rControlCreator), + maPopupModeEndCallback(), + msAccessibleName(rsAccessibleName), + mpContainer() +{ + OSL_ASSERT(mpParent!=NULL); + OSL_ASSERT(maControlCreator); +} + + + + +Popup::~Popup (void) +{ + mpControl.reset(); + mpContainer.reset(); +} + + + + +void Popup::Show (ToolBox& rToolBox) +{ + rToolBox.SetItemDown(rToolBox.GetCurItemId(), true); + + ProvideContainerAndControl(); + if ( ! (mpContainer && mpControl)) + { + OSL_ASSERT(mpContainer); + OSL_ASSERT(mpControl); + return; + } + + if ( !mpContainer->IsInPopupMode() ) + { + mpContainer->SetSizePixel(mpControl->GetOutputSizePixel()); + + const Point aPos (mpParent->OutputToScreenPixel(rToolBox.GetPosPixel())); + const Size aSize (rToolBox.GetSizePixel()); + const Rectangle aRect (aPos, aSize); + + mpContainer->StartPopupMode( + aRect, + FLOATWIN_POPUPMODE_NOFOCUSCLOSE|FLOATWIN_POPUPMODE_DOWN); + mpContainer->SetPopupModeFlags( + mpContainer->GetPopupModeFlags() + | FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE); + + mpControl->GetFocus(); + } +} + + + + +void Popup::Hide (void) +{ + if (mpContainer) + if (mpContainer->IsInPopupMode()) + mpContainer->EndPopupMode(); +} + + + + +void Popup::SetPopupModeEndHandler (const ::boost::function<void(void)>& rCallback) +{ + maPopupModeEndCallback = rCallback; + if (mpContainer) + mpContainer->SetPopupModeEndHdl(LINK(this, Popup, PopupModeEndHandler)); +} + + + + +void Popup::ProvideContainerAndControl (void) +{ + if ( ! (mpContainer && mpControl) + && mpParent!=NULL + && maControlCreator) + { + CreateContainerAndControl(); + } +} + + + + +void Popup::CreateContainerAndControl (void) +{ + mpContainer.reset(new PopupContainer(mpParent)); + mpContainer->SetAccessibleName(msAccessibleName); + if (maPopupModeEndCallback) + mpContainer->SetPopupModeEndHdl(LINK(this, Popup, PopupModeEndHandler)); + mpContainer->SetBorderStyle(mpContainer->GetBorderStyle() | WINDOW_BORDER_MENU); + + mpControl.reset(maControlCreator(mpContainer.get())); +} + + + + +IMPL_LINK(Popup, PopupModeEndHandler, void*, EMPTYARG) +{ + if (maPopupModeEndCallback) + maPopupModeEndCallback(); + return 0; +} + + + +} } // end of namespace svx::sidebar diff --git a/svx/source/sidebar/tools/PopupContainer.cxx b/svx/source/sidebar/tools/PopupContainer.cxx new file mode 100644 index 000000000000..3ff8ad425355 --- /dev/null +++ b/svx/source/sidebar/tools/PopupContainer.cxx @@ -0,0 +1,53 @@ +/* + * 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 "svx/sidebar/PopupContainer.hxx" +#include <sfx2/sidebar/Theme.hxx> +#include <vcl/gradient.hxx> + +namespace svx { namespace sidebar { + +PopupContainer::PopupContainer (Window* pParent) + : FloatingWindow(pParent, WB_SYSTEMWINDOW | WB_3DLOOK) // | WB_POPUP_FOCUSWIN) +{ +} + + + + +PopupContainer::~PopupContainer (void) +{ +} + + + + +long PopupContainer::Notify (NotifyEvent& rEvent) +{ + if (rEvent.GetType() == EVENT_LOSEFOCUS) + { + if ( ! HasChildPathFocus(true)) + { + EndPopupMode(); + } + } + + return FloatingWindow::Notify(rEvent); +} + + +} } // end of namespace svx::sidebar diff --git a/svx/source/sidebar/tools/PopupControl.cxx b/svx/source/sidebar/tools/PopupControl.cxx new file mode 100644 index 000000000000..a65245d587ad --- /dev/null +++ b/svx/source/sidebar/tools/PopupControl.cxx @@ -0,0 +1,58 @@ +/* + * 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 "svx/sidebar/PopupControl.hxx" +#include <sfx2/sidebar/Theme.hxx> +#include <vcl/gradient.hxx> + +using ::sfx2::sidebar::Theme; + +namespace svx { namespace sidebar { + +PopupControl::PopupControl ( + Window* pParent, + const ResId& rResId) + : Control( pParent,rResId) +{ + EnableChildTransparentMode(true); + SetControlBackground(); + + SetBackground(Theme::GetWallpaper(Theme::Paint_DropDownBackground)); +} + + + + +PopupControl::~PopupControl (void) +{ +} + + + + +void PopupControl::Paint (const Rectangle& rBox) +{ + Control::Paint(rBox); + + // The background is taken care of by setting the background color + // in the constructor. Here we just paint the border. + SetFillColor(); + SetLineColor(Theme::GetColor(Theme::Color_DropDownBorder)); + DrawRect(Rectangle(Point(0,0), GetOutputSizePixel())); +} + +} } // end of namespace svx::sidebar diff --git a/svx/source/sidebar/tools/ValueSetWithTextControl.cxx b/svx/source/sidebar/tools/ValueSetWithTextControl.cxx new file mode 100644 index 000000000000..8be260602851 --- /dev/null +++ b/svx/source/sidebar/tools/ValueSetWithTextControl.cxx @@ -0,0 +1,524 @@ +/* + * 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 "svx/sidebar/ValueSetWithTextControl.hxx" +#include <svx/dialogs.hrc> +#include <svx/dialmgr.hxx> +#include <sfx2/sidebar/Theme.hxx> + +#include <limits.h> +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/uno/Sequence.h> +#include <com/sun/star/lang/Locale.hpp> +#include <com/sun/star/style/NumberingType.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/text/XDefaultNumberingProvider.hpp> +#include <com/sun/star/text/XNumberingFormatter.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <comphelper/processfactory.hxx> +#include <com/sun/star/text/XNumberingTypeInfo.hpp> +#include <i18nlangtag/mslangid.hxx> +#include <svtools/valueset.hxx> +#include <editeng/brushitem.hxx> +#include <vcl/graph.hxx> +#include <svx/nbdtmg.hxx> +#include <svx/nbdtmgfact.hxx> + +using namespace com::sun::star::uno; +using namespace com::sun::star::beans; +using namespace com::sun::star::lang; +using namespace com::sun::star::i18n; +using namespace com::sun::star::text; +using namespace com::sun::star::container; +using namespace com::sun::star::style; +using rtl::OUString; + +#define C2U(cChar) OUString::createFromAscii(cChar) + +namespace svx { namespace sidebar { +static const sal_Char cValue[] = "Value"; + +static Font& lcl_GetDefaultBulletFont() +{ + static sal_Bool bInit = 0; + static Font aDefBulletFont( OUString( "StarSymbol" ), + OUString(), Size( 0, 14 ) ); + if(!bInit) + { + aDefBulletFont.SetCharSet( RTL_TEXTENCODING_SYMBOL ); + aDefBulletFont.SetFamily( FAMILY_DONTKNOW ); + aDefBulletFont.SetPitch( PITCH_DONTKNOW ); + aDefBulletFont.SetWeight( WEIGHT_DONTKNOW ); + aDefBulletFont.SetTransparent( sal_True ); + bInit = sal_True; + } + return aDefBulletFont; +} + +ValueSetWithTextControl::ValueSetWithTextControl( + const tControlType eControlType, + Window* pParent, + const ResId& rResId) + : ValueSet( pParent, rResId ) + , meControlType( eControlType ) + , maItems() +{ + SetColCount( 1 ); +} + + +ValueSetWithTextControl::~ValueSetWithTextControl(void) +{ +} + + +void ValueSetWithTextControl::AddItem( + const Image& rItemImage, + const Image* pSelectedItemImage, + const XubString& rItemText, + const XubString* pItemHelpText ) +{ + if ( meControlType != IMAGE_TEXT ) + { + return; + } + + ValueSetWithTextItem aItem; + aItem.maItemImage = rItemImage; + aItem.maSelectedItemImage = (pSelectedItemImage != 0) + ? *pSelectedItemImage + : rItemImage; + aItem.maItemText = rItemText; + + maItems.push_back( aItem ); + + InsertItem( maItems.size() ); + SetItemText( maItems.size(), + (pItemHelpText != 0) ? *pItemHelpText : rItemText ); +} + + +void ValueSetWithTextControl::AddItem( + const XubString& rItemText, + const XubString& rItemText2, + const XubString* pItemHelpText ) +{ + if ( meControlType != TEXT_TEXT ) + { + return; + } + + ValueSetWithTextItem aItem; + aItem.maItemText = rItemText; + aItem.maItemText2 = rItemText2; + + maItems.push_back( aItem ); + + InsertItem( maItems.size() ); + SetItemText( maItems.size(), + (pItemHelpText != 0) ? *pItemHelpText : rItemText ); +} + + +void ValueSetWithTextControl::ReplaceItemImages( + const sal_uInt16 nItemId, + const Image& rItemImage, + const Image* pSelectedItemImage ) +{ + if ( meControlType != IMAGE_TEXT ) + { + return; + } + + if ( nItemId == 0 || + nItemId > maItems.size() ) + { + return; + } + + maItems[nItemId-1].maItemImage = rItemImage; + maItems[nItemId-1].maSelectedItemImage = (pSelectedItemImage != 0) + ? *pSelectedItemImage + : rItemImage; +} + + +void ValueSetWithTextControl::UserDraw( const UserDrawEvent& rUDEvt ) +{ + const Rectangle aRect = rUDEvt.GetRect(); + OutputDevice* pDev = rUDEvt.GetDevice(); + pDev->Push( PUSH_ALL ); + const sal_uInt16 nItemId = rUDEvt.GetItemId(); + + const long nRectHeight = aRect.GetHeight(); + const Point aBLPos = aRect.TopLeft(); + + Font aFont(OutputDevice::GetDefaultFont(DEFAULTFONT_UI_SANS, MsLangId::getSystemLanguage(), DEFAULTFONT_FLAGS_ONLYONE)); + { + Size aSize = aFont.GetSize(); + aSize.Height() = (nRectHeight*4)/9; + aFont.SetSize( aSize ); + } + + { + //draw backgroud + if ( GetSelectItemId() == nItemId ) + { + Rectangle aBackRect = aRect; + aBackRect.Top() += 3; + aBackRect.Bottom() -= 2; + pDev->SetFillColor( sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Color_Highlight ) ); + pDev->DrawRect(aBackRect); + } + else + { + pDev->SetFillColor( COL_TRANSPARENT ); + pDev->DrawRect(aRect); + } + + //draw image + text resp. text + text + Image* pImage = 0; + if ( GetSelectItemId() == nItemId ) + { + aFont.SetColor( sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Color_HighlightText ) ); + pImage = &maItems[nItemId-1].maSelectedItemImage; + } + else + { + aFont.SetColor( GetSettings().GetStyleSettings().GetFieldTextColor() ); + pImage = &maItems[nItemId-1].maItemImage; + } + + Rectangle aStrRect = aRect; + aStrRect.Top() += nRectHeight/4; + aStrRect.Bottom() -= nRectHeight/4; + + switch ( meControlType ) + { + case IMAGE_TEXT: + { + Point aImgStart( + aBLPos.X() + 4, + aBLPos.Y() + ( ( nRectHeight - pImage->GetSizePixel().Height() ) / 2 ) ); + pDev->DrawImage( aImgStart, *pImage ); + + aStrRect.Left() += pImage->GetSizePixel().Width() + 12; + pDev->SetFont(aFont); + pDev->DrawText(aStrRect, maItems[nItemId-1].maItemText, TEXT_DRAW_ENDELLIPSIS); + } + break; + case TEXT_TEXT: + { + const long nRectWidth = aRect.GetWidth(); + aStrRect.Left() += 8; + aStrRect.Right() -= (nRectWidth*2)/3; + pDev->SetFont(aFont); + pDev->DrawText(aStrRect, maItems[nItemId-1].maItemText, TEXT_DRAW_ENDELLIPSIS); + aStrRect.Left() += nRectWidth/3; + aStrRect.Right() += (nRectWidth*2)/3; + pDev->DrawText(aStrRect, maItems[nItemId-1].maItemText2, TEXT_DRAW_ENDELLIPSIS); + } + break; + } + } + + Invalidate( aRect ); + pDev->Pop(); +} + +SvxNumValueSet2::SvxNumValueSet2( Window* pParent, const ResId& rResId) : + ValueSet( pParent, rResId ), + aLineColor ( COL_LIGHTGRAY ), + pVDev ( NULL ) +{ + SetColCount( 3 ); + SetLineCount( 3 ); + SetStyle( GetStyle() | WB_ITEMBORDER ); +} + + SvxNumValueSet2::~SvxNumValueSet2() +{ + delete pVDev; +} + +void SvxNumValueSet2::SetNumberingSettings( + const Sequence<Sequence<PropertyValue> >& aNum, + Reference<XNumberingFormatter>& xFormat, + const Locale& rLocale ) +{ + aNumSettings = aNum; + xFormatter = xFormat; + aLocale = rLocale; + if(aNum.getLength() > 9) + SetStyle( GetStyle()|WB_VSCROLL); + InsertItem( DEFAULT_NONE, DEFAULT_NONE - 1 ); + SetItemText( DEFAULT_NONE, SVX_RESSTR( RID_SVXSTR_NUMBULLET_NONE )); + + for ( sal_Int32 i = 0; i < aNum.getLength(); i++ ) + { + InsertItem( i + 1); + if( i < 8 ) + { + NBOTypeMgrBase* pNumbering = NBOutlineTypeMgrFact::CreateInstance(eNBOType::NUMBERING); + if ( pNumbering ) + { + SetItemText( i + 1, pNumbering->GetDescription(i)); + } + } + } +} + +void SvxNumValueSet2::UserDraw( const UserDrawEvent& rUDEvt ) +{ + const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + const Color aBackColor = rStyleSettings.GetFieldColor(); + const Color aTextColor = rStyleSettings.GetFieldTextColor(); + + OutputDevice* pDev = rUDEvt.GetDevice(); + Rectangle aRect = rUDEvt.GetRect(); + sal_uInt32 nItemId = rUDEvt.GetItemId(); + long nRectWidth = aRect.GetWidth(); + long nRectHeight = aRect.GetHeight(); + Size aRectSize(nRectWidth, aRect.GetHeight()); + Point aBLPos = aRect.TopLeft(); + Font aOldFont = pDev->GetFont(); + Color aOldColor = pDev->GetLineColor(); + pDev->SetLineColor(aBackColor); + Font aFont(OutputDevice::GetDefaultFont( + DEFAULTFONT_UI_SANS, MsLangId::getSystemLanguage(), DEFAULTFONT_FLAGS_ONLYONE)); + + Size aSize = aFont.GetSize(); + aSize.Height() = nRectHeight/5; + aFont.SetColor(aTextColor); + aFont.SetFillColor(aBackColor); + aFont.SetSize( aSize ); + pDev->SetFont(aFont); + pDev->SetLineColor(aTextColor); + if(!pVDev) + { + // Die Linien werden nur einmalig in das VirtualDevice gepainted + // nur die Gliederungspage bekommt es aktuell + pVDev = new VirtualDevice(*pDev); + pVDev->SetMapMode(pDev->GetMapMode()); + pVDev->EnableRTL( IsRTLEnabled() ); + pVDev->SetOutputSize( aRectSize ); + aOrgRect = aRect; + + pVDev->SetLineColor( aBackColor ); + pVDev->SetFillColor( aBackColor ); + pVDev->DrawRect(aOrgRect); + + if(aBackColor == aLineColor) + aLineColor.Invert(); + if(GetSettings().GetStyleSettings().GetHighContrastMode()) + pVDev->SetLineColor(aTextColor); + else + pVDev->SetLineColor(aLineColor); + // Linien nur einmalig Zeichnen + Point aStart(aBLPos.X() + nRectWidth *30 / 100,0); + Point aEnd(aBLPos.X() + nRectWidth * 9 / 10,0); + for( sal_uInt32 i = 11; i < 100; i += 33) + { + aStart.Y() = aEnd.Y() = aBLPos.Y() + nRectHeight * i / 100; + pVDev->DrawLine(aStart, aEnd); + aStart.Y() = aEnd.Y() = aBLPos.Y() + nRectHeight * (i + 11) / 100; + pVDev->DrawLine(aStart, aEnd); + } + } + if ( nItemId != DEFAULT_NONE) + pDev->DrawOutDev( aRect.TopLeft(), aRectSize, + aOrgRect.TopLeft(), aRectSize, + *pVDev ); + const OUString sValue(C2U(cValue)); + + Point aStart(aBLPos.X() + nRectWidth / 9,0); + if ( nItemId == DEFAULT_NONE) + { + String sText(SVX_RESSTR( RID_SVXSTR_NUMBULLET_NONE)); + Font aLclFont = pDev->GetFont(); + Size aLclSize = aLclFont.GetSize(); + aLclSize.Height() = nRectHeight/4; + aLclFont.SetSize( aLclSize ); + pDev->SetFont(aLclFont); + long nTextWidth = pDev->GetTextWidth(sText); + long nTextHeight = pDev->GetTextHeight(); + //GVT refine + while (nTextWidth>nRectWidth && aLclSize.Height()>4) { + aLclSize.Height() = aLclSize.Height()*0.9; + aLclFont.SetSize( aLclSize ); + pDev->SetFont(aLclFont); + nTextWidth = pDev->GetTextWidth(sText); + } + Point aSStart(aBLPos.X()+(nRectWidth-nTextWidth)/2, aBLPos.Y() +(nRectHeight-nTextHeight)/2); + pDev->DrawText(aSStart, sText); + pDev->SetFont(aOldFont); + } + else + { + NBOTypeMgrBase* pNumbering = NBOutlineTypeMgrFact::CreateInstance(eNBOType::NUMBERING); + if ( pNumbering && nItemId <= DEFAULT_BULLET_TYPES ) + { + for( sal_uInt32 i = 0; i < 3; i++ ) + { + sal_uInt32 nY = 11 + i * 33; + aStart.Y() = aBLPos.Y() + nRectHeight * nY / 100; + String sText; + sal_uInt16 nLvl = 0; + SvxNumRule aTempRule( 0, 10, false ); + pNumbering->ApplyNumRule(aTempRule,nItemId -1,1<<nLvl); + SvxNumberFormat aNumFmt(aTempRule.GetLevel(nLvl)); + sText=aNumFmt.GetNumStr(i+1); + sText.Insert( aNumFmt.GetPrefix(), 0 ); + sText += aNumFmt.GetSuffix(); + aStart.X() = aBLPos.X() + 2; + aStart.Y() -= pDev->GetTextHeight()/2; + pDev->DrawText(aStart, sText); + } + } + pDev->SetFont(aOldFont); + pDev->SetLineColor(aOldColor); + } + //End +} + +//=============================================================================================== + +static const long aOffsetX[] = +{ + -1,//1, + 3,//4, + 4,//5, + -3,//0, + -1,//0, + 3 +}; + +SvxNumValueSet3::SvxNumValueSet3( Window* pParent, const ResId& rResId) : + ValueSet( pParent, rResId ) +{ + SetColCount( 3 ); + SetLineCount( 4 ); + SetStyle( GetStyle() | WB_ITEMBORDER ); +} + + SvxNumValueSet3::~SvxNumValueSet3() +{ +} + +void SvxNumValueSet3::UserDraw( const UserDrawEvent& rUDEvt ) +{ + Rectangle aRect = rUDEvt.GetRect(); + OutputDevice* pDev = rUDEvt.GetDevice(); + sal_uInt32 nItemId = rUDEvt.GetItemId(); + + long nRectHeight = aRect.GetHeight(); + long nRectWidth = aRect.GetWidth(); + Point aBLPos = aRect.TopLeft(); + NBOTypeMgrBase* pBullets = NBOutlineTypeMgrFact::CreateInstance(eNBOType::MIXBULLETS); + if ( pBullets ) + { + if ( nItemId <= DEFAULT_BULLET_TYPES ) { + sal_uInt16 nLvl = 0; + SvxNumRule aTempRule( 0, 10, false ); + pBullets->ApplyNumRule(aTempRule,nItemId -1,1<<nLvl); + SvxNumberFormat aFmt(aTempRule.GetLevel(nLvl)); + sal_Int16 eNumType = aFmt.GetNumberingType(); + if( eNumType == SVX_NUM_CHAR_SPECIAL) + { + sal_Unicode cChar = aFmt.GetBulletChar(); + //End + const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + const Color aBackColor = rStyleSettings.GetFieldColor(); + const Color aTextColor = rStyleSettings.GetFieldTextColor(); + + Font aOldFont = pDev->GetFont(); + Font aFont( lcl_GetDefaultBulletFont() ); + + Size aSize = aFont.GetSize(); + aSize.Height() = nRectHeight*3/6; + aFont.SetColor(aTextColor); + aFont.SetFillColor(aBackColor); + aFont.SetSize( aSize ); + pDev->SetFont(aFont); + pDev->SetFillColor( aBackColor ); //wj + + String sText; + sText = cChar; + Font aOldBulletFont = pDev->GetFont(); + Font aBulletFnt(aFmt.GetBulletFont() ? *aFmt.GetBulletFont() : aOldBulletFont); + Size aBulSize = aOldBulletFont.GetSize(); + aBulletFnt.SetSize(aBulSize); + pDev->SetFont(aBulletFnt); + long nTextWidth = pDev->GetTextWidth(sText); + long nTextHeight = pDev->GetTextHeight(); + Point aStart(aBLPos.X()+(nRectWidth-nTextWidth)/2, aBLPos.Y() +(nRectHeight-nTextHeight)/2); + pDev->DrawText(aStart, sText); + pDev->SetFont(aOldFont); + }else if ( eNumType == SVX_NUM_BITMAP ) + { + const SvxBrushItem* pBrushItem = aFmt.GetBrush(); + if(pBrushItem) + { + const Graphic* pGrf = pBrushItem->GetGraphic(); + if(pGrf) + { + Size aSize(nRectHeight*6/20, nRectHeight*6/20); + Point aStart(aBLPos.X() + nRectWidth*7/20, aBLPos.Y() + nRectHeight*7/20); + + pGrf->Draw( pDev, aStart, aSize ); + } + } + } + }else if ( nItemId == DEFAULT_NONE) + { + const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + const Color aBackColor = rStyleSettings.GetFieldColor(); + const Color aTextColor = rStyleSettings.GetFieldTextColor(); + + Font aOldFont = pDev->GetFont(); + Font aFont(OutputDevice::GetDefaultFont(DEFAULTFONT_UI_SANS, MsLangId::getSystemLanguage(), DEFAULTFONT_FLAGS_ONLYONE)); + Size aSize = aFont.GetSize(); + //aSize.Height() = nRectHeight/5; + aSize.Height() = nRectHeight/4; + aFont.SetColor(aTextColor); + aFont.SetFillColor(aBackColor); + aFont.SetSize( aSize ); + pDev->SetFont(aFont); + pDev->SetFillColor( aBackColor ); + + String sText(SVX_RESSTR( RID_SVXSTR_NUMBULLET_NONE)); + + long nTextWidth = pDev->GetTextWidth(sText); + long nTextHeight = pDev->GetTextHeight(); + //GVT refine + while (nTextWidth>nRectWidth && aSize.Height()>4) { + aSize.Height() = aSize.Height()*0.9; + aFont.SetSize( aSize ); + pDev->SetFont(aFont); + nTextWidth = pDev->GetTextWidth(sText); + } + Point aStart(aBLPos.X()+(nRectWidth-nTextWidth)/2, aBLPos.Y() +(nRectHeight-nTextHeight)/2); + pDev->DrawText(aStart, sText); + + pDev->SetFont(aOldFont); + } + } + +} + +} } // end of namespace svx::sidebar |