diff options
author | Oliver-Rainer Wittmann <orw@apache.org> | 2013-04-10 08:20:16 +0000 |
---|---|---|
committer | Oliver-Rainer Wittmann <orw@apache.org> | 2013-04-10 08:20:16 +0000 |
commit | 0a0a9b32aa5bf1ce2554ad37cbba3c7a105db2b5 (patch) | |
tree | f5c258d25d3719c8f719a944043b5220377e9f9c /svx | |
parent | bcfee75544246db6788715d98efd6d33c12f933d (diff) |
121420: merge sidebar feature from branch into trunk
Notes
merged as: d50ce284c9674c45acd40d017cc44c260da722a2
Diffstat (limited to 'svx')
192 files changed, 27553 insertions, 1970 deletions
diff --git a/svx/AllLangResTarget_svx.mk b/svx/AllLangResTarget_svx.mk index 11bd8424b0eb..e51f4210d306 100644 --- a/svx/AllLangResTarget_svx.mk +++ b/svx/AllLangResTarget_svx.mk @@ -77,6 +77,13 @@ $(eval $(call gb_SrsTarget_add_files,svx/res,\ svx/source/items/svxerr.src \ svx/source/items/svxitems.src \ svx/source/mnuctrls/mnuctrls.src \ + svx/source/sidebar/EmptyPanel.src \ + svx/source/sidebar/area/AreaPropertyPanel.src \ + svx/source/sidebar/graphic/GraphicPropertyPanel.src \ + svx/source/sidebar/line/LinePropertyPanel.src \ + svx/source/sidebar/possize/PosSizePropertyPanel.src \ + svx/source/sidebar/text/TextPropertyPanel.src \ + svx/source/sidebar/paragraph/ParaPropertyPanel.src \ svx/source/stbctrls/stbctrls.src \ svx/source/svdraw/svdstr.src \ svx/source/table/table.src \ @@ -85,7 +92,6 @@ $(eval $(call gb_SrsTarget_add_files,svx/res,\ svx/source/tbxctrls/fontworkgallery.src \ svx/source/tbxctrls/grafctrl.src \ svx/source/tbxctrls/lboxctrl.src \ - svx/source/tbxctrls/linectrl.src \ svx/source/tbxctrls/tbcontrl.src \ svx/source/tbxctrls/tbunosearchcontrollers.src \ svx/source/toolbars/extrusionbar.src \ diff --git a/svx/Library_svx.mk b/svx/Library_svx.mk index 6319a7713350..c6f7acb54b77 100644 --- a/svx/Library_svx.mk +++ b/svx/Library_svx.mk @@ -169,6 +169,47 @@ $(eval $(call gb_Library_add_exception_objects,svx,\ svx/source/mnuctrls/fntctl \ svx/source/mnuctrls/fntszctl \ svx/source/mnuctrls/SmartTagCtl \ + svx/source/sidebar/ContextChangeEventMultiplexer \ + svx/source/sidebar/EmptyPanel \ + svx/source/sidebar/nbdtmg \ + svx/source/sidebar/nbdtmgfact \ + svx/source/sidebar/PanelFactory \ + svx/source/sidebar/SelectionAnalyzer \ + svx/source/sidebar/SelectionChangeHandler \ + svx/source/sidebar/debug/ColorPanel \ + svx/source/sidebar/debug/ContextPanel \ + svx/source/sidebar/debug/NotYetImplementedPanel \ + svx/source/sidebar/text/SvxSBFontNameBox \ + svx/source/sidebar/text/TextCharacterSpacingControl \ + svx/source/sidebar/text/TextCharacterSpacingPopup \ + svx/source/sidebar/text/TextUnderlineControl \ + svx/source/sidebar/text/TextUnderlinePopup \ + svx/source/sidebar/text/TextPropertyPanel \ + svx/source/sidebar/paragraph/ParaNumberingControl \ + svx/source/sidebar/paragraph/ParaNumberingPopup \ + svx/source/sidebar/paragraph/ParaBulletsControl \ + svx/source/sidebar/paragraph/ParaBulletsPopup \ + svx/source/sidebar/paragraph/ParaLineSpacingControl \ + svx/source/sidebar/paragraph/ParaLineSpacingPopup \ + svx/source/sidebar/paragraph/ParaPropertyPanel \ + svx/source/sidebar/area/AreaPropertyPanel \ + svx/source/sidebar/area/AreaTransparencyGradientControl \ + svx/source/sidebar/area/AreaTransparencyGradientPopup \ + svx/source/sidebar/graphic/GraphicPropertyPanel \ + svx/source/sidebar/line/LinePropertyPanel \ + svx/source/sidebar/line/LineStyleValueSet \ + svx/source/sidebar/line/LineWidthControl \ + svx/source/sidebar/line/LineWidthValueSet \ + svx/source/sidebar/line/LineWidthPopup \ + svx/source/sidebar/possize/PosSizePropertyPanel \ + svx/source/sidebar/possize/SidebarDialControl \ + svx/source/sidebar/possize/SidebarDialControlBmp \ + svx/source/sidebar/tools/ColorControl \ + svx/source/sidebar/tools/ColorPopup \ + svx/source/sidebar/tools/PopupControl \ + svx/source/sidebar/tools/PopupContainer \ + svx/source/sidebar/tools/Popup \ + svx/source/sidebar/tools/ValueSetWithTextControl \ svx/source/stbctrls/pszctrl \ svx/source/stbctrls/insctrl \ svx/source/stbctrls/selctrl \ diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk index fba496cabf51..27e3f96191b5 100644 --- a/svx/Library_svxcore.mk +++ b/svx/Library_svxcore.mk @@ -177,6 +177,8 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\ svx/source/gallery2/galmisc \ svx/source/gallery2/galobj \ svx/source/gallery2/galtheme \ + svx/source/gallery2/GalleryControl \ + svx/source/gallery2/GallerySplitter \ svx/source/items/chrtitem \ svx/source/items/clipfmtitem \ svx/source/items/customshapeitem \ @@ -424,6 +426,7 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\ svx/source/xoutdev/xtabgrdt \ svx/source/xoutdev/xtabhtch \ svx/source/xoutdev/xtable \ + svx/source/xoutdev/XPropertyEntry \ svx/source/xoutdev/xtablend \ )) diff --git a/svx/Package_inc.mk b/svx/Package_inc.mk index 440e78259e1a..ba1115a14725 100644 --- a/svx/Package_inc.mk +++ b/svx/Package_inc.mk @@ -173,6 +173,7 @@ $(eval $(call gb_Package_add_file,svx_inc,inc/svx/unomaster.hxx,svx/unomaster.hx $(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdedtv.hxx,svx/svdedtv.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/xlinjoit.hxx,svx/xlinjoit.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/xlncapit.hxx,svx/xlncapit.hxx)) +$(eval $(call gb_Package_add_file,svx_inc,inc/svx/AffineMatrixItem.hxx,svx/AffineMatrixItem.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxmbritm.hxx,svx/sxmbritm.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/AccessibleGraphicShape.hxx,svx/AccessibleGraphicShape.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/xlnstit.hxx,svx/xlnstit.hxx)) @@ -221,6 +222,7 @@ $(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/properties/e3dcompoundprop $(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/properties/e3dsceneproperties.hxx,svx/sdr/properties/e3dsceneproperties.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/properties/measureproperties.hxx,svx/sdr/properties/measureproperties.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/table/tabledesign.hxx,svx/sdr/table/tabledesign.hxx)) +$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/table/tablecontroller.hxx,svx/sdr/table/tablecontroller.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/primitive2d/primitiveFactory2d.hxx,svx/sdr/primitive2d/primitiveFactory2d.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx,svx/sdr/primitive2d/sdrpathprimitive2d.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx,svx/sdr/primitive2d/sdrtextprimitive2d.hxx)) @@ -410,6 +412,7 @@ $(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdobj.hxx,svx/svdobj.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxmtaitm.hxx,svx/sxmtaitm.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/clipboardctl.hxx,svx/clipboardctl.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/xtable.hxx,svx/xtable.hxx)) +$(eval $(call gb_Package_add_file,svx_inc,inc/svx/XPropertyEntry.hxx,svx/XPropertyEntry.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdgcoitm.hxx,svx/sdgcoitm.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdovirt.hxx,svx/svdovirt.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/fmshell.hxx,svx/fmshell.hxx)) @@ -553,4 +556,15 @@ $(eval $(call gb_Package_add_file,svx_inc,inc/svx/colrctrl.hxx,svx/colrctrl.hxx) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/fmdpage.hxx,svx/fmdpage.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxmtpitm.hxx,svx/sxmtpitm.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/globlmn.hrc,globlmn_tmpl.hrc)) - +$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sidebar/ColorControl.hxx,svx/sidebar/ColorControl.hxx)) +$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sidebar/ColorPopup.hxx,svx/sidebar/ColorPopup.hxx)) +$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sidebar/ContextChangeEventMultiplexer.hxx,svx/sidebar/ContextChangeEventMultiplexer.hxx)) +$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sidebar/Popup.hxx,svx/sidebar/Popup.hxx)) +$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sidebar/SidebarDialControl.hxx,svx/sidebar/SidebarDialControl.hxx)) +$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sidebar/PopupContainer.hxx,svx/sidebar/PopupContainer.hxx)) +$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sidebar/PopupControl.hxx,svx/sidebar/PopupControl.hxx)) +$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sidebar/SelectionAnalyzer.hxx,svx/sidebar/SelectionAnalyzer.hxx)) +$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sidebar/SelectionChangeHandler.hxx,svx/sidebar/SelectionChangeHandler.hxx)) +$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sidebar/ValueSetWithTextControl.hxx,svx/sidebar/ValueSetWithTextControl.hxx)) +$(eval $(call gb_Package_add_file,svx_inc,inc/svx/nbdtmgfact.hxx,svx/nbdtmgfact.hxx)) +$(eval $(call gb_Package_add_file,svx_inc,inc/svx/nbdtmg.hxx,svx/nbdtmg.hxx)) diff --git a/svx/inc/GalleryControl.hxx b/svx/inc/GalleryControl.hxx new file mode 100644 index 000000000000..9bc820bbbff9 --- /dev/null +++ b/svx/inc/GalleryControl.hxx @@ -0,0 +1,80 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#ifndef SVX_SIDEBAR_GALLERY_CONTROL_HXX +#define SVX_SIDEBAR_GALLERY_CONTROL_HXX + +#include <vcl/window.hxx> +#include <vcl/graph.hxx> +#include <tools/urlobj.hxx> +#include "svx/svxdllapi.h" + +#include <boost/scoped_ptr.hpp> + +class SfxBindings; + +class Gallery; +class GallerySplitter; +class GalleryBrowser1; +class GalleryBrowser2; +class FmFormModel; + +namespace svx { namespace sidebar { + + +class SVX_DLLPUBLIC GalleryControl : public Window +{ +public: + GalleryControl ( + SfxBindings* pBindings, + Window* pParentWindow); + virtual ~GalleryControl (void); + + sal_Bool KeyInput( const KeyEvent& rKEvt, Window* pWindow); + +private: + Gallery* mpGallery; + ::boost::scoped_ptr<GallerySplitter> mpSplitter; + ::boost::scoped_ptr<GalleryBrowser1> mpBrowser1; + ::boost::scoped_ptr<GalleryBrowser2> mpBrowser2; + Size maLastSize; + bool mbIsInitialResize; + + void InitSettings (void); + + virtual void Resize (void); + virtual void GetFocus (void); + + DECL_LINK(SplitHdl, void*); + +protected: + void ThemeSelectionHasChanged (void); + + INetURLObject GetURL (void) const; + String GetFilterName (void) const; + Graphic GetGraphic (void) const; + sal_Bool GetVCDrawModel (FmFormModel& rModel) const; + sal_Bool IsLinkage (void) const; +}; + +} } // end of namespace svx::sidebar + +#endif diff --git a/svx/inc/galbrws2.hxx b/svx/inc/galbrws2.hxx index e1c6844afee0..27e49c551a75 100644 --- a/svx/inc/galbrws2.hxx +++ b/svx/inc/galbrws2.hxx @@ -95,9 +95,12 @@ class GalleryPreview; class Menu; class SgaObject; +namespace svx { namespace sidebar { class GalleryControl; } } + class GalleryBrowser2 : public Control, public SfxListener { friend class GalleryBrowser; + friend class svx::sidebar::GalleryControl; using Control::Notify; using Window::KeyInput; @@ -148,7 +151,7 @@ public: public: - GalleryBrowser2( GalleryBrowser* pParent, const ResId& rResId, Gallery* pGallery ); + GalleryBrowser2( Window* pParent, const ResId& rResId, Gallery* pGallery ); ~GalleryBrowser2(); void SelectTheme( const String& rThemeName ); diff --git a/svx/inc/helpid.hrc b/svx/inc/helpid.hrc index 947341a86bfa..5c6056d25b0e 100644 --- a/svx/inc/helpid.hrc +++ b/svx/inc/helpid.hrc @@ -275,5 +275,127 @@ #define HID_SVX_TP_DESKTOP "SVX_HID_SVX_TP_DESKTOP" #define HID_CT_THES_ALTERNATIVES "SVX_HID_CT_THES_ALTERNATIVES" +#define HID_PROPERTYPANEL_SECTIONPAGE_BEGIN "SVX_HID_PROPERTYPANEL_SECTIONPAGE_BEGIN" +#define HID_PROPERTYPANEL_TEXT_SECTION "SVX_HID_PROPERTYPANEL_TEXT_SECTION" +#define HID_PROPERTYPANEL_PARA_SECTION "SVX_HID_PROPERTYPANEL_PARA_SECTION" +#define HID_PROPERTYPANEL_AREA_SECTION "SVX_HID_PROPERTYPANEL_AREA_SECTION" +#define HID_PROPERTYPANEL_LINE_SECTION "SVX_HID_PROPERTYPANEL_LINE_SECTION" +#define HID_PPROPERTYPANEL_AREA_LB_TRGR_TYPES "SVX_HID_PPROPERTYPANEL_AREA_LB_TRGR_TYPES" +#define HID_PPROPERTYPANEL_AREA_MTR_TRANSPARENT "SVX_HID_PPROPERTYPANEL_AREA_MTR_TRANSPARENT" +#define HID_PPROPERTYPANEL_AREA_LB_FILL_TYPES "SVX_HID_PPROPERTYPANEL_AREA_LB_FILL_TYPES" +#define HID_PPROPERTYPANEL_AREA_LB_FILL_ATTR "SVX_HID_PPROPERTYPANEL_AREA_LB_FILL_ATTR" +#define HID_PPROPERTYPANEL_AREA_MTR_TRGR_CENTER_X "SVX_HID_PPROPERTYPANEL_AREA_MTR_TRGR_CENTER_X" +#define HID_PPROPERTYPANEL_AREA_MTR_TRGR_CENTER_Y "SVX_HID_PPROPERTYPANEL_AREA_MTR_TRGR_CENTER_Y" +#define HID_PPROPERTYPANEL_AREA_MTR_TRGR_ANGLE "SVX_HID_PPROPERTYPANEL_AREA_MTR_TRGR_ANGLE" +#define HID_PPROPERTYPANEL_AREA_MTR_TRGR_SVALUE "SVX_HID_PPROPERTYPANEL_AREA_MTR_TRGR_SVALUE" +#define HID_PPROPERTYPANEL_AREA_MTR_TRGR_EVALUE "SVX_HID_PPROPERTYPANEL_AREA_MTR_TRGR_EVALUE" +#define HID_PPROPERTYPANEL_AREA_MTR_TRGR_BORDER "SVX_HID_PPROPERTYPANEL_AREA_MTR_TRGR_BORDER" +#define HID_PPROPERTYPANEL_AREA_BTN_LEFT_SECOND "SVX_HID_PPROPERTYPANEL_AREA_BTN_LEFT_SECOND" +#define HID_PPROPERTYPANEL_AREA_BTN_RIGHT_FIRST "SVX_HID_PPROPERTYPANEL_AREA_BTN_RIGHT_FIRST" +#define HID_PPROPERTYPANEL_TEXT_TBX_FONT "SVX_HID_PPROPERTYPANEL_TEXT_TBX_FONT" +#define HID_PPROPERTYPANEL_TEXT_TBI_BOLD "SVX_HID_PPROPERTYPANEL_TEXT_TBI_BOLD" +#define HID_PPROPERTYPANEL_TEXT_TBI_ITALIC "SVX_HID_PPROPERTYPANEL_TEXT_TBI_ITALIC" +#define HID_PPROPERTYPANEL_TEXT_TBI_UNDERLINE "SVX_HID_PPROPERTYPANEL_TEXT_TBI_UNDERLINE" +#define HID_PPROPERTYPANEL_TEXT_TBI_STRIKEOUT "SVX_HID_PPROPERTYPANEL_TEXT_TBI_STRIKEOUT" +#define HID_PPROPERTYPANEL_TEXT_TBI_SHADOWED "SVX_HID_PPROPERTYPANEL_TEXT_TBI_SHADOWED" +#define HID_PPROPERTYPANEL_TEXT_TBX_FONTSIZE_INDE "SVX_HID_PPROPERTYPANEL_TEXT_TBX_FONTSIZE_INDE" +#define HID_PPROPERTYPANEL_TEXT_TBI_INCREASE "SVX_HID_PPROPERTYPANEL_TEXT_TBI_INCREASE" +#define HID_PPROPERTYPANEL_TEXT_TBI_DECREASE "SVX_HID_PPROPERTYPANEL_TEXT_TBI_DECREASE" +#define HID_PPROPERTYPANEL_TEXT_TBX_FONT_COLOR "SVX_HID_PPROPERTYPANEL_TEXT_TBX_FONT_COLOR" +#define HID_PPROPERTYPANEL_TEXT_TBI_FONT_COLOR "SVX_HID_PPROPERTYPANEL_TEXT_TBI_FONT_COLOR" +#define HID_PPROPERTYPANEL_TEXT_TBX_HIGHLIGHT_COLOR "SVX_HID_PPROPERTYPANEL_TEXT_TBX_HIGHLIGHT_COLOR" +#define HID_PPROPERTYPANEL_TEXT_TBI_HIGHLIGHT_COLOR "SVX_HID_PPROPERTYPANEL_TEXT_TBI_HIGHLIGHT_COLOR" +#define HID_PPROPERTYPANEL_TEXT_TBX_SCRIPT_SW "SVX_HID_PPROPERTYPANEL_TEXT_TBX_SCRIPT_SW" +#define HID_PPROPERTYPANEL_TEXT_TBI_SUPER_SW "SVX_HID_PPROPERTYPANEL_TEXT_TBI_SUPER_SW" +#define HID_PPROPERTYPANEL_TEXT_TBI_SUB_SW "SVX_HID_PPROPERTYPANEL_TEXT_TBI_SUB_SW" +#define HID_PPROPERTYPANEL_TEXT_TBX_SCRIPT "SVX_HID_PPROPERTYPANEL_TEXT_TBX_SCRIPT" +#define HID_PPROPERTYPANEL_TEXT_TBI_SUPER "SVX_HID_PPROPERTYPANEL_TEXT_TBI_SUPER" +#define HID_PPROPERTYPANEL_TEXT_TBI_SUB "SVX_HID_PPROPERTYPANEL_TEXT_TBI_SUB" +#define HID_PPROPERTYPANEL_TEXT_UNDERLINE_VS "SVX_HID_PPROPERTYPANEL_TEXT_UNDERLINE_VS" +#define HID_PPROPERTYPANEL_TEXT_COLOR_VS "SVX_HID_PPROPERTYPANEL_TEXT_COLOR_VS" +#define HID_PPROPERTYPANEL_PARA_TBX_HALIGN "SVX_HID_PPROPERTYPANEL_PARA_TBX_HALIGN" +#define HID_PPROPERTYPANEL_PARA_TBI_HALIGN_LEFT "SVX_HID_PPROPERTYPANEL_PARA_TBI_HALIGN_LEFT" +#define HID_PPROPERTYPANEL_PARA_TBI_HALIGN_CENTER "SVX_HID_PPROPERTYPANEL_PARA_TBI_HALIGN_CENTER" +#define HID_PPROPERTYPANEL_PARA_TBI_HALIGN_RIGHT "SVX_HID_PPROPERTYPANEL_PARA_TBI_HALIGN_RIGHT" +#define HID_PPROPERTYPANEL_PARA_TBI_HALIGN_JUSTIFY "SVX_HID_PPROPERTYPANEL_PARA_TBI_HALIGN_JUSTIFY" +#define HID_PPROPERTYPANEL_PARA_TBX_VALIGN "SVX_HID_PPROPERTYPANEL_PARA_TBX_VALIGN" +#define HID_PPROPERTYPANEL_PARA_TBI_VALIGN_TOP "SVX_HID_PPROPERTYPANEL_PARA_TBI_VALIGN_TOP" +#define HID_PPROPERTYPANEL_PARA_TBI_VALIGN_CENTER "SVX_HID_PPROPERTYPANEL_PARA_TBI_VALIGN_CENTER" +#define HID_PPROPERTYPANEL_PARA_TBI_VALIGN_BOT "SVX_HID_PPROPERTYPANEL_PARA_TBI_VALIGN_BOT" +#define HID_PPROPERTYPANEL_PARA_TBX_BACK_COLOR "SVX_HID_PPROPERTYPANEL_PARA_TBX_BACK_COLOR" +#define HID_PPROPERTYPANEL_PARA_TBI_BACK_COLOR "SVX_HID_PPROPERTYPANEL_PARA_TBI_BACK_COLOR" +#define HID_PPROPERTYPANEL_PARA_BACK_COLOR_VS "SVX_HID_PPROPERTYPANEL_PARA_BACK_COLOR_VS" +#define HID_PPROPERTYPANEL_LINE_TBX_WIDTH "SVX_HID_PPROPERTYPANEL_LINE_TBX_WIDTH" +#define HID_PPROPERTYPANEL_LINE_TBI_WIDTH "SVX_HID_PPROPERTYPANEL_LINE_TBI_WIDTH" +#define HID_PPROPERTYPANEL_LINE_TBX_COLOR "SVX_HID_PPROPERTYPANEL_LINE_TBX_COLOR" +#define HID_PPROPERTYPANEL_LINE_TBI_COLOR "SVX_HID_PPROPERTYPANEL_LINE_TBI_COLOR" +#define HID_PPROPERTYPANEL_LINE_TBX_STYLE "SVX_HID_PPROPERTYPANEL_LINE_TBX_STYLE" +#define HID_PPROPERTYPANEL_LINE_TBI_STYLE "SVX_HID_PPROPERTYPANEL_LINE_TBI_STYLE" +#define HID_PPROPERTYPANEL_LINE_MTR_TRANCEPARENCE "SVX_HID_PPROPERTYPANEL_LINE_MTR_TRANCEPARENCE" +#define HID_PPROPERTYPANEL_LINE_LB_START "SVX_HID_PPROPERTYPANEL_LINE_LB_START" +#define HID_PPROPERTYPANEL_LINE_LB_END "SVX_HID_PPROPERTYPANEL_LINE_LB_END" +#define HID_PPROPERTYPANEL_LINE_VS_WIDTH "SVX_HID_PPROPERTYPANEL_LINE_VS_WIDTH" +#define HID_PPROPERTYPANEL_LINE_MTR_WIDTH "SVX_HID_PPROPERTYPANEL_LINE_MTR_WIDTH" +#define HID_PPROPERTYPANEL_LINE_VS_COLOR "SVX_HID_PPROPERTYPANEL_LINE_VS_COLOR" +#define HID_PPROPERTYPANEL_LINE_VS_STYLE "SVX_HID_PPROPERTYPANEL_LINE_VS_STYLE" +#define HID_PPROPERTYPANEL_LINE_BTN_STYLE "SVX_HID_PPROPERTYPANEL_LINE_BTN_STYLE" +#define HID_PPROPERTYPANEL_TEXT_SPACING_VS "SVX_HID_PPROPERTYPANEL_TEXT_SPACING_VS" +#define HID_PPROPERTYPANEL_LINE_LB_EDGESTYLE "SVX_HID_PPROPERTYPANEL_LINE_LB_EDGESTYLE" +#define HID_PPROPERTYPANEL_LINE_LB_CAPSTYLE "SVX_HID_PPROPERTYPANEL_LINE_LB_CAPSTYLE" +//add for position and size +#define HID_PROPERTY_PANEL_POSIZE_MTR_FLD_WIDTH "SVX_HID_PROPERTY_PANEL_POSIZE_MTR_FLD_WIDTH" +#define HID_PROPERTY_PANEL_POSIZE_MTR_FLD_HEIGHT "SVX_HID_PROPERTY_PANEL_POSIZE_MTR_FLD_HEIGHT" +#define HID_PROPERTY_PANEL_POSIZE_CBX_SCALE "SVX_HID_PROPERTY_PANEL_POSIZE_CBX_SCALE" +#define HID_PROPERTY_PANEL_POSIZE_MF_HORIZONTAL "SVX_HID_PROPERTY_PANEL_POSIZE_MF_HORIZONTAL" +#define HID_PROPERTY_PANEL_POSIZE_MF_VERTICAL "SVX_HID_PROPERTY_PANEL_POSIZE_MF_VERTICAL" +#define HID_PROPERTY_PANEL_POSIZE_MTR_FLD_ANGLE "SVX_HID_PROPERTY_PANEL_POSIZE_MTR_FLD_ANGLE" +#define HID_PROPERTY_PANEL_POSIZE_TBX_FLIP "SVX_HID_PROPERTY_PANEL_POSIZE_TBX_FLIP" +#define HID_PROPERTY_PANEL_POSIZE_FLIP_VERTICAL "SVX_HID_PROPERTY_PANEL_POSIZE_FLIP_VERTICAL" +#define HID_PROPERTY_PANEL_POSIZE_FLIP_HORIZONTAL "SVX_HID_PROPERTY_PANEL_POSIZE_FLIP_HORIZONTAL" +#define HID_PROPERTY_PANEL_POSIZE_DIAL_CONTROL "SVX_HID_PROPERTY_PANEL_POSIZE_DIAL_CONTROL" +//end +//add for graphic +#define HID_PROPERTY_PANEL_GRAPHIC_MTR_BRIGHT "SVX_HID_PROPERTY_PANEL_GRAPHIC_MTR_BRIGHT" +#define HID_PROPERTY_PANEL_GRAPHIC_MTR_CONTRAST "SVX_HID_PROPERTY_PANEL_GRAPHIC_MTR_CONTRAST" +#define HID_PROPERTY_PANEL_GRAPHIC_LB_COLORMODE "SVX_HID_PROPERTY_PANEL_GRAPHIC_LB_COLORMODE" +#define HID_PROPERTY_PANEL_GRAPHIC_MTR_TRANSP "SVX_HID_PROPERTY_PANEL_GRAPHIC_MTR_TRANSP" +#define HID_PROPERTY_PANEL_GRAPHIC_MTR_RED "SVX_HID_PROPERTY_PANEL_GRAPHIC_MTR_RED" +#define HID_PROPERTY_PANEL_GRAPHIC_MTR_GREEN "SVX_HID_PROPERTY_PANEL_GRAPHIC_MTR_GREEN" +#define HID_PROPERTY_PANEL_GRAPHIC_MTR_BLUE "SVX_HID_PROPERTY_PANEL_GRAPHIC_MTR_BLUE" +#define HID_PROPERTY_PANEL_GRAPHIC_MTR_GAMMA "SVX_HID_PROPERTY_PANEL_GRAPHIC_MTR_GAMMA" +//end + +#define HID_PROPERTYPANEL_POSIZE_SECTION "SVX_HID_PROPERTYPANEL_POSIZE_SECTION" +#define HID_PROPERTYPANEL_GRAPHIC_SECTION "SVX_HID_PROPERTYPANEL_GRAPHIC_SECTION" + + +#define HID_PPROPERTYPANEL_PARA_TBX_NUM_BULLET "SVX_HID_PPROPERTYPANEL_PARA_TBX_NUM_BULLET" +#define HID_PPROPERTYPANEL_PARA_TBI_NUM "SVX_HID_PPROPERTYPANEL_PARA_TBI_NUM" +#define HID_PPROPERTYPANEL_PARA_TBI_BULLET "SVX_HID_PPROPERTYPANEL_PARA_TBI_BULLET" +#define HID_PPROPERTYPANEL_PARA_TBX_INC_DEC "SVX_HID_PPROPERTYPANEL_PARA_TBX_INC_DEC" +#define HID_PPROPERTYPANEL_PARA_TBI_INC "SVX_HID_PPROPERTYPANEL_PARA_TBI_INC" +#define HID_PPROPERTYPANEL_PARA_TBI_DEC "SVX_HID_PPROPERTYPANEL_PARA_TBI_DEC" +#define HID_PPROPERTYPANEL_PARA_TBX_INDENT_INC_DEC "SVX_HID_PPROPERTYPANEL_PARA_TBX_INDENT_INC_DEC" +#define HID_PPROPERTYPANEL_PARA_TBI_INDENT_INC "SVX_HID_PPROPERTYPANEL_PARA_TBI_INDENT_INC" +#define HID_PPROPERTYPANEL_PARA_TBI_INDENT_DEC "SVX_HID_PPROPERTYPANEL_PARA_TBI_INDENT_DEC" +#define HID_PPROPERTYPANEL_PARA_TBI_INDENT_HANG "SVX_HID_PPROPERTYPANEL_PARA_TBI_INDENT_HANG" +#define HID_PPROPERTYPANEL_PARA_TBX_INDENTP_INC_DEC "SVX_HID_PPROPERTYPANEL_PARA_TBX_INDENTP_INC_DEC" +#define HID_PPROPERTYPANEL_PARA_TBI_INDENTP_INC "SVX_HID_PPROPERTYPANEL_PARA_TBI_INDENTP_INC" +#define HID_PPROPERTYPANEL_PARA_TBI_INDENTP_DEC "SVX_HID_PPROPERTYPANEL_PARA_TBI_INDENTP_DEC" +#define HID_PPROPERTYPANEL_PARA_TBI_INDENTP_HANG "SVX_HID_PPROPERTYPANEL_PARA_TBI_INDENTP_HANG" +#define HID_PPROPERTYPANEL_PARA_TBX_LINESP "SVX_HID_PPROPERTYPANEL_PARA_TBX_LINESP" +#define HID_PPROPERTYPANEL_PARA_TBI_LINESP "SVX_HID_PPROPERTYPANEL_PARA_TBI_LINESP" +#define HID_PPROPERTYPANEL_AREA_TBX_COLOR "SVX_HID_PPROPERTYPANEL_AREA_TBX_COLOR" +#define HID_PPROPERTYPANEL_AREA_TBI_COLOR "SVX_HID_PPROPERTYPANEL_AREA_TBI_COLOR" +#define HID_PPROPERTYPANEL_AREA_COLOR_VS "SVX_HID_PPROPERTYPANEL_AREA_COLOR_VS" +//add end + +#define HID_PPROPERTYPANEL_AREA_TBX_GRADIENT "SVX_HID_PPROPERTYPANEL_AREA_TBX_GRADIENT" +#define HID_PPROPERTYPANEL_AREA_TBI_GRADIENT "SVX_HID_PPROPERTYPANEL_AREA_TBI_GRADIENT" +#define HID_PROPERTYPANEL_SECTIONPAGE_END "SVX_HID_PROPERTYPANEL_SECTIONPAGE_END" + +#define HID_PPROPERTYPANEL_AREA_LB_FILL_TYPES "SVX_HID_PPROPERTYPANEL_AREA_LB_FILL_TYPES" +#define HID_PPROPERTYPANEL_AREA_LB_FILL_ATTR "SVX_HID_PPROPERTYPANEL_AREA_LB_FILL_ATTR" + #endif diff --git a/svx/inc/sidebar/PanelFactory.hxx b/svx/inc/sidebar/PanelFactory.hxx new file mode 100644 index 000000000000..a23c0a46b5a8 --- /dev/null +++ b/svx/inc/sidebar/PanelFactory.hxx @@ -0,0 +1,74 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#ifndef SVX_SIDEBAR_PANEL_FACTORY_HXX +#define SVX_SIDEBAR_PANEL_FACTORY_HXX + +#include <cppuhelper/compbase1.hxx> +#include <cppuhelper/basemutex.hxx> + +#include <com/sun/star/ui/XUIElementFactory.hpp> + +#include <boost/noncopyable.hpp> + + +namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; + + +namespace svx { namespace sidebar { + +namespace +{ + typedef ::cppu::WeakComponentImplHelper1 < + css::ui::XUIElementFactory + > PanelFactoryInterfaceBase; +} + + +class PanelFactory + : private ::boost::noncopyable, + private ::cppu::BaseMutex, + public PanelFactoryInterfaceBase +{ +public: + static ::rtl::OUString SAL_CALL getImplementationName (void); + static cssu::Reference<cssu::XInterface> SAL_CALL createInstance ( + const cssu::Reference<css::lang::XMultiServiceFactory>& rxFactory); + static cssu::Sequence<rtl::OUString> SAL_CALL getSupportedServiceNames (void); + + PanelFactory (void); + virtual ~PanelFactory (void); + + // XUIElementFactory + cssu::Reference<css::ui::XUIElement> SAL_CALL createUIElement ( + const ::rtl::OUString& rsResourceURL, + const ::cssu::Sequence<css::beans::PropertyValue>& rArguments) + throw( + css::container::NoSuchElementException, + css::lang::IllegalArgumentException, + cssu::RuntimeException); +}; + + +} } // end of namespace svx::sidebar + +#endif diff --git a/svx/inc/svx/AffineMatrixItem.hxx b/svx/inc/svx/AffineMatrixItem.hxx new file mode 100755 index 000000000000..0ad7623ab9d7 --- /dev/null +++ b/svx/inc/svx/AffineMatrixItem.hxx @@ -0,0 +1,58 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#ifndef _SVX_AFFINEMATRIXITEM_HXX +#define _SVX_AFFINEMATRIXITEM_HXX + +#include <svx/svxdllapi.h> +#include <svl/poolitem.hxx> +#include <com/sun/star/geometry/AffineMatrix2D.hpp> + +//--------------------- +// class AffineMatrixItem +//--------------------- + +class SVX_DLLPUBLIC AffineMatrixItem : public SfxPoolItem +{ +private: + com::sun::star::geometry::AffineMatrix2D maMatrix; + +public: + TYPEINFO(); + AffineMatrixItem(const com::sun::star::geometry::AffineMatrix2D* pMatrix = 0); + AffineMatrixItem(SvStream& rIn); + AffineMatrixItem(const AffineMatrixItem&); + virtual ~AffineMatrixItem(); + + virtual int operator==(const SfxPoolItem&) const; + virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const; + virtual SfxPoolItem* Create( SvStream& rIn, sal_uInt16 nVer ) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; + + virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + + const com::sun::star::geometry::AffineMatrix2D& GetAffineMatrix2D() const; +}; + +#endif // _SVX_AFFINEMATRIXITEM_HXX + +// eof diff --git a/svx/inc/svx/XPropertyEntry.hxx b/svx/inc/svx/XPropertyEntry.hxx new file mode 100755 index 000000000000..c91183b42668 --- /dev/null +++ b/svx/inc/svx/XPropertyEntry.hxx @@ -0,0 +1,51 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#ifndef _XPROPERTYENTRY_HXX +#define _XPROPERTYENTRY_HXX + +#include <svx/svxdllapi.h> +#include <tools/string.hxx> +#include <vcl/bitmap.hxx> + +// --------------------- +// class XPropertyEntry + +class SVX_DLLPUBLIC XPropertyEntry +{ +private: + String maName; + Bitmap maUiBitmap; + +protected: + XPropertyEntry(const String& rName); + XPropertyEntry(const XPropertyEntry& rOther); + +public: + virtual ~XPropertyEntry(); + + void SetName(const String& rName) { maName = rName; } + const String& GetName() const { return maName; } + void SetUiBitmap(const Bitmap& rUiBitmap) { maUiBitmap = rUiBitmap; } + const Bitmap& GetUiBitmap() const { return maUiBitmap; } +}; + +#endif // _XPROPERTYENTRY_HXX diff --git a/svx/inc/svx/XPropertyTable.hxx b/svx/inc/svx/XPropertyTable.hxx index efe01418bdaf..73253e324b72 100644 --- a/svx/inc/svx/XPropertyTable.hxx +++ b/svx/inc/svx/XPropertyTable.hxx @@ -28,7 +28,7 @@ #include "svx/svxdllapi.h" #include <svx/xtable.hxx> -SVX_DLLPUBLIC ::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SvxUnoXColorTable_createInstance( XPropertyTable* pTable ) throw(); +SVX_DLLPUBLIC ::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SvxUnoXColorTable_createInstance( XPropertyList* pTable ) throw(); SVX_DLLPUBLIC ::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SvxUnoXLineEndTable_createInstance( XPropertyList* pList ) throw(); SVX_DLLPUBLIC ::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SvxUnoXDashTable_createInstance( XPropertyList* pList ) throw(); SVX_DLLPUBLIC ::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SvxUnoXHatchTable_createInstance( XPropertyList* pList ) throw(); diff --git a/svx/inc/svx/bmpmask.hxx b/svx/inc/svx/bmpmask.hxx index 3604f23a9085..c3e110a49314 100644 --- a/svx/inc/svx/bmpmask.hxx +++ b/svx/inc/svx/bmpmask.hxx @@ -119,7 +119,7 @@ class SVX_DLLPUBLIC SvxBmpMask : public SfxDockingWindow CheckBox aCbxTrans; ColorLB aLbColorTrans; - const XColorTable* pColTab; + const XColorList* pColTab; Color aPipetteColor; SvxBmpMaskSelectItem aSelItem; @@ -161,7 +161,7 @@ public: void PipetteClicked(); sal_Bool NeedsColorTable() const; - void SetColorTable( const XColorTable* pColorTable ); + void SetColorTable( const XColorList* pColorTable ); void SetExecState( sal_Bool bEnable ); diff --git a/svx/inc/svx/colrctrl.hxx b/svx/inc/svx/colrctrl.hxx index d9ab7ff5b1fc..3519d1060da4 100644 --- a/svx/inc/svx/colrctrl.hxx +++ b/svx/inc/svx/colrctrl.hxx @@ -30,7 +30,7 @@ #include <svl/lstner.hxx> #include "svx/svxdllapi.h" -class XColorTable; +class XColorList; class SvData; /************************************************************************* @@ -95,7 +95,7 @@ class SvxColorDockingWindow : public SfxDockingWindow, public SfxListener friend class SvxColorChildWindow; private: - XColorTable* pColorTable; + XColorList* pColorTable; SvxColorValueSet aColorSet; sal_uInt16 nLeftSlot; sal_uInt16 nRightSlot; diff --git a/svx/inc/svx/dialcontrol.hxx b/svx/inc/svx/dialcontrol.hxx index 8234abe797af..2e80ad289666 100644 --- a/svx/inc/svx/dialcontrol.hxx +++ b/svx/inc/svx/dialcontrol.hxx @@ -29,13 +29,42 @@ #include <sfx2/itemconnect.hxx> #include "svx/svxdllapi.h" +#include <boost/scoped_ptr.hpp> + class NumericField; namespace svx { // ============================================================================ -struct DialControl_Impl; +class DialControlBmp : public VirtualDevice +{ +public: + explicit DialControlBmp( Window& rParent ); + + void InitBitmap( const Size& rSize, const Font& rFont ); + void CopyBackground( const DialControlBmp& rSrc ); + void DrawBackground( const Size& rSize, bool bEnabled ); + virtual void DrawBackground(); + virtual void DrawElements( const String& rText, sal_Int32 nAngle ); + +protected: + Rectangle maRect; + bool mbEnabled; + +private: + const Color& GetBackgroundColor() const; + const Color& GetTextColor() const; + const Color& GetScaleLineColor() const; + const Color& GetButtonLineColor() const; + const Color& GetButtonFillColor( bool bMain ) const; + + void Init( const Size& rSize ); + + Window& mrParent; + long mnCenterX; + long mnCenterY; +}; /** This control allows to input a rotation angle, visualized by a dial. @@ -90,20 +119,42 @@ public: /** Returns the current modify handler. */ const Link& GetModifyHdl() const; -private: +protected: + struct DialControl_Impl + { + ::boost::scoped_ptr<DialControlBmp> mpBmpEnabled; + ::boost::scoped_ptr<DialControlBmp> mpBmpDisabled; + ::boost::scoped_ptr<DialControlBmp> mpBmpBuffered; + Link maModifyHdl; + NumericField* mpLinkField; + Size maWinSize; + Font maWinFont; + sal_Int32 mnAngle; + sal_Int32 mnOldAngle; + long mnCenterX; + long mnCenterY; + bool mbNoRot; + + explicit DialControl_Impl( Window& rParent ); + void Init( const Size& rWinSize, const Font& rWinFont ); + }; + std::auto_ptr< DialControl_Impl > mpImpl; + + virtual void HandleMouseEvent( const Point& rPos, bool bInitial ); + virtual void HandleEscapeEvent(); + + void SetRotation( sal_Int32 nAngle, bool bBroadcast ); + void Init( const Size& rWinSize, const Font& rWinFont ); void Init( const Size& rWinSize ); + +private: void InvalidateControl(); - void ImplSetRotation( sal_Int32 nAngle, bool bBroadcast ); void ImplSetFieldLink( const Link& rLink ); - void HandleMouseEvent( const Point& rPos, bool bInitial ); - void HandleEscapeEvent(); DECL_LINK( LinkedFieldModifyHdl, NumericField* ); - - std::auto_ptr< DialControl_Impl > mpImpl; }; // ============================================================================ diff --git a/svx/inc/svx/dialogs.hrc b/svx/inc/svx/dialogs.hrc index a1e1835d0c0d..d95bc5515a45 100644 --- a/svx/inc/svx/dialogs.hrc +++ b/svx/inc/svx/dialogs.hrc @@ -30,8 +30,8 @@ // Resource-Id's ------------------------------------------------------------ -// Bitte FIRSTFREE pflegen!!! (gilt nicht f"ur Strings) -#define RID_SVX_FIRSTFREE 305 +// !!! IMPORTANT: consider and update FIRSTFREE when introducing new RIDs !!! (not for RIDs for Strings - they have there own) +#define RID_SVX_FIRSTFREE 323 // some strings also used in CUI #define RID_SVXERRCTX (RID_SVX_START + 351) @@ -56,7 +56,6 @@ #define RID_SVXSTR_GALLERY_PREVIEW (RID_SVX_START + 255) //-----IAccessibility2 Implementation 2009 - // factory IDs of tabpages implemented in CUI #define RID_SVXPAGE_CHAR_TWOLINES (RID_SVX_START + 242) #define RID_SVXPAGE_EXT_PARAGRAPH (RID_SVX_START + 7) @@ -353,7 +352,33 @@ #define RID_SVXDLG_TEXTCONTROL_CHARATTR (RID_SVX_START + 286) #define RID_SVXDLG_TEXTCONTROL_PARAATTR (RID_SVX_START + 287) -// !!! please update RID_SVX_FIRSTFREE !!! see line 46 +#define RID_SIDEBAR_TEXT_PANEL (RID_SVX_START + 305) +#define RID_POPUPPANEL_TEXTPAGE_UNDERLINE (RID_SVX_START + 306) +#define RID_POPUPPANEL_TEXTPAGE_FONT_COLOR (RID_SVX_START + 307) +#define RID_POPUPPANEL_TEXTPAGE_SPACING (RID_SVX_START + 308) + +#define RID_SIDEBAR_AREA_PANEL (RID_SVX_START + 309) +#define RID_POPUPPANEL_AERAPAGE_COLOR (RID_SVX_START + 310) +#define RID_POPUPPANEL_AREAPAGE_TRGR (RID_SVX_START + 311) + +#define RID_SIDEBAR_LINE_PANEL (RID_SVX_START + 312) +#define RID_POPUPPANEL_LINEPAGE_COLOR (RID_SVX_START + 313) +#define RID_POPUPPANEL_LINEPAGE_STYLE (RID_SVX_START + 314) +#define RID_POPUPPANEL_LINEPAGE_WIDTH (RID_SVX_START + 315) + +#define RID_SIDEBAR_POSSIZE_PANEL (RID_SVX_START + 316) +#define RID_SIDEBAR_GRAPHIC_PANEL (RID_SVX_START + 317) +#define RID_SIDEBAR_EMPTY_PANEL (RID_SVX_START + 318) + +#define RID_SIDEBAR_PARA_PANEL (RID_SVX_START + 319) +#define RID_POPUPPANEL_PARAPAGE_LINESPACING (RID_SVX_START + 320) +#define RID_POPUPPANEL_PARAPAGE_BULLETS (RID_SVX_START + 321) +#define RID_POPUPPANEL_PARAPAGE_NUMBERING (RID_SVX_START + 322) + +// !!! IMPORTANT: consider and update RID_SVX_FIRSTFREE when introducing new RIDs !!! (see above) + + + // Strings ------------------------------------------------------------------ @@ -597,7 +622,7 @@ #define RID_SVXSTR_LINECAP_ROUND (RID_SVX_START + 587 ) #define RID_SVXSTR_LINECAP_SQUARE (RID_SVX_START + 588 ) -// string resources for XLineJoint item +// string resources for com::sun::star::drawing::LineJoint item #define RID_SVXSTR_LINEJOINT_NONE RID_SVXSTR_NONE #define RID_SVXSTR_LINEJOINT_MIDDLE (RID_SVX_START + 589 ) #define RID_SVXSTR_LINEJOINT_BEVEL (RID_SVX_START + 590 ) @@ -919,14 +944,67 @@ #define RID_SVXSTR_OUTLINENUM_DESCRIPTION_5 (RID_SVXSTR_OUTLINENUM_DESCRIPTIONS + 5)//? #define RID_SVXSTR_OUTLINENUM_DESCRIPTION_6 (RID_SVXSTR_OUTLINENUM_DESCRIPTIONS + 6)//? #define RID_SVXSTR_OUTLINENUM_DESCRIPTION_7 (RID_SVXSTR_OUTLINENUM_DESCRIPTIONS + 7)//? - -#define RID_SVXSTR_FINDBAR_FIND (RID_SVX_START + 1190) - -#define RID_SVXSTR_NEXTFREE (RID_SVX_START + 1191) +#define RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS (RID_SVX_START + 1172) +#define RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS_0 (RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS + 0) +#define RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS_1 (RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS + 1) +#define RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS_2 (RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS + 2) +#define RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS_3 (RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS + 3) +#define RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS_4 (RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS + 4) //IAccessibility2 Implementation 2009----- #define RID_SVXSTR_TEXTCOLOR (RID_SVX_START + 1178) //-----IAccessibility2 Implementation 2009 + +#define RID_SVXSTR_FINDBAR_FIND (RID_SVX_START + 1190) + +#define RID_SVXSTR_NUMBULLET_NONE (RID_SVX_START + 1191) +#define RID_SVXSTR_NUMBULLET_CURRENT_LIST_DESCRIPTION (RID_SVX_START + 1192) +#define RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION (RID_SVX_START + 1193) +#define RID_SVXSTR_NUMBULLET_CUSTOM_NUMBERING_DESCRIPTION (RID_SVX_START + 1194) +#define RID_SVXSTR_NUMBULLET_CUSTOM_MULTILEVEL_DESCRIPTION (RID_SVX_START + 1195) +#define RID_SVXSTR_NUMBULLET_CUSTOMIZED_WATERMARK (RID_SVX_START + 1196) +#define RID_SVXSTR_BULLET_RTL_DESCRIPTION_4 (RID_SVX_START + 1197) +#define RID_SVXSTR_BULLET_RTL_DESCRIPTION_5 (RID_SVX_START + 1198) +#define RID_SVXSTR_OUTLINENUM_RTL_DESCRIPTION_7 (RID_SVX_START + 1199) + +#define RID_SVXSTR_GRAPHICS_DESCRIPTIONS (RID_SVX_START + 1200) +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_0 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 0) // 1200 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_1 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 1) // 1201 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_2 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 2) // 1202 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_3 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 3) // 1203 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_4 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 4) // 1204 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_5 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 5) // 1205 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_6 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 6) // 1206 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_7 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 7) // 1207 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_8 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 8) // 1208 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_9 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 9) // 1209 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_10 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 10) // 1210 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_11 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 11) // 1211 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_12 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 12) // 1212 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_13 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 13) // 1213 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_14 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 14) // 1214 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_15 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 15) // 1215 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_16 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 16) // 1216 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_17 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 17) // 1217 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_18 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 18) // 1218 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_19 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 19) // 1219 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_20 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 20) // 1220 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_21 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 21) // 1221 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_22 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 22) // 1222 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_23 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 23) // 1223 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_24 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 24) // 1224 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_25 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 25) // 1225 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_26 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 26) // 1226 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_27 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 27) // 1227 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_28 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 28) // 1228 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_29 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 29) // 1229 + +// !!! IMPORTANT: consider and update RID_SVXSTR_NEXTFREE when introducing new RIDs for Strings !!! +#define RID_SVXSTR_NEXTFREE (RID_SVX_START + 1230) + + + + // ---------------------------------------------------------------------------- // if we have _a_lot_ time, we should group the resource ids by type, instead // of grouping them by semantics. The reason is that resource ids have to be diff --git a/svx/inc/svx/dlgctrl.hxx b/svx/inc/svx/dlgctrl.hxx index f7593c252813..c15a948ef166 100644 --- a/svx/inc/svx/dlgctrl.hxx +++ b/svx/inc/svx/dlgctrl.hxx @@ -34,7 +34,7 @@ class XBitmapEntry; class XBitmapList; class XColorEntry; -class XColorTable; +class XColorList; class XDash; class XDashEntry; class XDashList; @@ -259,7 +259,7 @@ public: ColorLB( Window* pParent, ResId Id ) : ColorListBox( pParent, Id ) {} ColorLB( Window* pParent, WinBits aWB ) : ColorListBox( pParent, aWB ) {} - virtual void Fill( const XColorTable* pTab ); + virtual void Fill( const XColorList* pTab ); void Append( XColorEntry* pEntry, Bitmap* pBmp = NULL ); void Modify( XColorEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp = NULL ); @@ -327,8 +327,8 @@ public: virtual void Fill(const XBitmapList* pList); virtual void UserDraw(const UserDrawEvent& rUDEvt); - void Append(XBitmapEntry* pEntry, BitmapEx* pBmpEx = 0); - void Modify(XBitmapEntry* pEntry, sal_uInt16 nPos, BitmapEx* pBmpEx = 0); + void Append(const Size& rSize, const XBitmapEntry& rEntry, BitmapEx* pBmpEx = 0); + void Modify(const Size& rSize, const XBitmapEntry& rEntry, sal_uInt16 nPos, BitmapEx* pBmpEx = 0); void SelectEntryByList(const XBitmapList* pList, const String& rStr); private: @@ -338,7 +338,7 @@ private: XBitmapList* mpList; bool mbUserDraw; - SVX_DLLPRIVATE void SetVirtualDevice(); + SVX_DLLPRIVATE void SetVirtualDevice(const Size& rSize); }; /************************************************************************* @@ -352,13 +352,13 @@ private: VirtualDevice maVD; BitmapEx maBitmapEx; - void SetVirtualDevice(); + void SetVirtualDevice(const Size& rSize); public: FillAttrLB( Window* pParent, ResId Id ); FillAttrLB( Window* pParent, WinBits aWB ); - virtual void Fill( const XColorTable* pTab ); + virtual void Fill( const XColorList* pTab ); virtual void Fill( const XHatchList* pList ); virtual void Fill( const XGradientList* pList ); virtual void Fill( const XBitmapList* pList ); @@ -395,11 +395,11 @@ public: virtual void Fill( const XDashList* pList ); - void Append( XDashEntry* pEntry, Bitmap* pBmp = NULL ); - void Modify( XDashEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp = NULL ); + void Append( XDashEntry* pEntry, const Bitmap* pBmp = NULL ); + void Modify( XDashEntry* pEntry, sal_uInt16 nPos, const Bitmap* pBmp = NULL ); void SelectEntryByList( const XDashList* pList, const String& rStr, const XDash& rDash, sal_uInt16 nDist = 0 ); - void FillStyles(); + // void FillStyles(); }; /************************************************************************* @@ -411,14 +411,15 @@ class SVX_DLLPUBLIC LineEndLB : public ListBox { public: - LineEndLB( Window* pParent, ResId Id ) : ListBox( pParent, Id ) {} - LineEndLB( Window* pParent, WinBits aWB ) : ListBox( pParent, aWB ) {} + LineEndLB( Window* pParent, ResId Id ); + LineEndLB( Window* pParent, WinBits aWB ); + virtual ~LineEndLB (void); virtual void Fill( const XLineEndList* pList, sal_Bool bStart = sal_True ); - void Append( XLineEndEntry* pEntry, Bitmap* pBmp = NULL, + void Append( XLineEndEntry* pEntry, const Bitmap* pBmp = NULL, sal_Bool bStart = sal_True ); - void Modify( XLineEndEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp = NULL, + void Modify( XLineEndEntry* pEntry, sal_uInt16 nPos, const Bitmap* pBmp = NULL, sal_Bool bStart = sal_True ); }; diff --git a/svx/inc/svx/dlgutil.hxx b/svx/inc/svx/dlgutil.hxx index e42efd6b398b..0edab504b2dd 100644 --- a/svx/inc/svx/dlgutil.hxx +++ b/svx/inc/svx/dlgutil.hxx @@ -34,7 +34,8 @@ // Functions ------------------------------------------------------------- class SfxItemSet; -SVX_DLLPUBLIC FieldUnit GetModuleFieldUnit( const SfxItemSet& ); +SVX_DLLPUBLIC FieldUnit GetModuleFieldUnit(const SfxItemSet&); +SVX_DLLPUBLIC FieldUnit GetModuleFieldUnit(); #define OUTPUT_DRAWMODE_COLOR (DRAWMODE_DEFAULT) #define OUTPUT_DRAWMODE_CONTRAST (DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT) diff --git a/svx/inc/svx/drawitem.hxx b/svx/inc/svx/drawitem.hxx index c0de777b2657..a5a683801956 100644 --- a/svx/inc/svx/drawitem.hxx +++ b/svx/inc/svx/drawitem.hxx @@ -34,16 +34,16 @@ // SvxColorTableItem //================================================================== -class XColorTable; +class XColorList; class SVX_DLLPUBLIC SvxColorTableItem: public SfxPoolItem { - XColorTable* pColorTable; + XColorList* pColorTable; public: TYPEINFO(); SvxColorTableItem(); - SvxColorTableItem( XColorTable* pTable, + SvxColorTableItem( XColorList* pTable, sal_uInt16 nWhich ); SvxColorTableItem( const SvxColorTableItem& ); @@ -57,8 +57,8 @@ public: virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ); - XColorTable* GetColorTable() const { return pColorTable; } - void SetColorTable( XColorTable* pTable ) { + XColorList* GetColorTable() const { return pColorTable; } + void SetColorTable( XColorList* pTable ) { pColorTable = pTable; } }; diff --git a/svx/inc/svx/fontwork.hxx b/svx/inc/svx/fontwork.hxx index 9a97b2472c71..323297dcfc66 100644 --- a/svx/inc/svx/fontwork.hxx +++ b/svx/inc/svx/fontwork.hxx @@ -132,7 +132,7 @@ class SVX_DLLPUBLIC SvxFontWorkDialog : public SfxDockingWindow ImageList maImageList; ImageList maImageListH; - const XColorTable* pColorTable; + const XColorList* pColorTable; #ifdef _SVX_FONTWORK_CXX friend class SvxFontWorkChildWindow; @@ -175,7 +175,7 @@ class SVX_DLLPUBLIC SvxFontWorkDialog : public SfxDockingWindow const ResId& rResId ); ~SvxFontWorkDialog(); - void SetColorTable(const XColorTable* pTable); + void SetColorTable(const XColorList* pTable); void SetActive(sal_Bool bActivate = sal_True); }; diff --git a/svx/inc/svx/galbrws.hxx b/svx/inc/svx/galbrws.hxx index b7ad3ccec64c..834c5659ed84 100644 --- a/svx/inc/svx/galbrws.hxx +++ b/svx/inc/svx/galbrws.hxx @@ -19,8 +19,6 @@ * *************************************************************/ - - #ifndef _SVX_GALBRWS_HXX_ #define _SVX_GALBRWS_HXX_ @@ -64,7 +62,7 @@ class GalleryBrowser2; class GallerySplitter; class Gallery; -class GalleryBrowser : public SfxDockingWindow +class SVX_DLLPUBLIC GalleryBrowser : public SfxDockingWindow { friend class GalleryBrowser1; friend class GalleryBrowser2; @@ -72,19 +70,16 @@ class GalleryBrowser : public SfxDockingWindow using Window::KeyInput; private: - Size maLastSize; GallerySplitter* mpSplitter; GalleryBrowser1* mpBrowser1; GalleryBrowser2* mpBrowser2; Gallery* mpGallery; - long mnDummy1; - long mnDummy2; - long mnDummy3; + /// bitfield void InitSettings(); - virtual sal_Bool Close(); + virtual sal_Bool Close(); virtual void Resize(); virtual void GetFocus(); diff --git a/svx/inc/svx/nbdtmg.hxx b/svx/inc/svx/nbdtmg.hxx new file mode 100755 index 000000000000..047fcb508644 --- /dev/null +++ b/svx/inc/svx/nbdtmg.hxx @@ -0,0 +1,390 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#ifndef _NBDTMG_HXX +#define _NBDTMG_HXX +#include "svx/svxdllapi.h" + +#ifndef _SVX_NUMITEM_HXX +#include <editeng/numitem.hxx> +#endif +#define _SVSTDARR_USHORTS +#include <svl/svstdarr.hxx> +#include <svl/svarray.hxx> +#ifndef _LIST_HXX +#include <tools/list.hxx> +#endif +#ifndef _SV_FONT_HXX +#include <vcl/font.hxx> +#endif + +namespace svx { namespace sidebar { + +#define DEFAULT_BULLET_TYPES 8 +#define DEFAULT_NONE 10 +#define DEFAULT_NUM_TYPE_MEMBER 5 +#define DEFAULT_NUM_VALUSET_COUNT 8 +#define DEFAULT_NUMBERING_CACHE_FORMAT_VERSION 0x10 + +typedef sal_uInt16 NBOType; +namespace eNBOType +{ + const NBOType BULLETS = 0x01; + const NBOType GRAPHICBULLETS = 0x02; + const NBOType NUMBERING = 0x03; + const NBOType OUTLINE = 0x04; + const NBOType MIXBULLETS = 0x05; +} + +typedef sal_uInt16 NBType; +namespace eNBType +{ + const NBOType BULLETS = 0x01; + const NBOType GRAPHICBULLETS = 0x02; +} + +class SVX_DLLPUBLIC NumSettings_Impl +{ + public: + short nNumberType; + short nParentNumbering; + SvxNumberFormat::SvxNumLabelFollowedBy eLabelFollowedBy; + long nTabValue; + SvxAdjust eNumAlign; + long nNumAlignAt; + long nNumIndentAt; + rtl::OUString sPrefix; + rtl::OUString sSuffix; + rtl::OUString sBulletChar; + rtl::OUString sBulletFont; + SvxBrushItem *pBrushItem; + Size aSize; + + public: + NumSettings_Impl() : + nNumberType(0), + pBrushItem(0), + aSize(0,0), + nParentNumbering(0) + {} + ~NumSettings_Impl(){} +}; +/* +typedef NumSettings_Impl* NumSettings_ImplPtr; +SV_DECL_PTRARR_DEL(NumSettingsArr_Impl,NumSettings_ImplPtr,8,4) +SV_IMPL_PTRARR( NumSettingsArr_Impl, NumSettings_ImplPtr )*/ + +class NumSettingsArr_Impl; + +class SVX_DLLPUBLIC BulletsSettings +{ + public: + sal_Bool bIsCustomized; + rtl::OUString sDescription; + NBType eType; + public: + BulletsSettings(NBType eTy) : + bIsCustomized(sal_False), + eType(eTy) + {} + virtual ~BulletsSettings(){} +}; + +class SVX_DLLPUBLIC BulletsSettings_Impl:public BulletsSettings +{ + public: + sal_Unicode cBulletChar; + //rtl::OUString sBulletFont; + Font aFont; + + public: + BulletsSettings_Impl(NBType eTy) : + BulletsSettings(eTy) + {} + virtual ~BulletsSettings_Impl(){} +}; + +class SVX_DLLPUBLIC GrfBulDataRelation: public BulletsSettings +{ + public: + String sGrfName; + sal_uInt16 nTabIndex; + sal_uInt16 nGallaryIndex; + const Graphic* pGrfObj; + Size aSize; + GrfBulDataRelation(NBType eTy): + BulletsSettings(eTy), + nTabIndex((sal_uInt16)0xFFFF), + nGallaryIndex((sal_uInt16)0xFFFF), + aSize(0,0), + pGrfObj(0) + {} + virtual ~GrfBulDataRelation(){} +}; + +class SVX_DLLPUBLIC MixBulletsSettings_Impl +{ + public: + NBType eType; + sal_uInt16 nIndex; //index in the tab page display + sal_uInt16 nIndexDefault; + BulletsSettings* pBullets; + public: + MixBulletsSettings_Impl(NBType eTy) : + eType(eTy), + nIndex((sal_uInt16)0xFFFF), + nIndexDefault((sal_uInt16)0xFFFF), + pBullets(0) + {} + ~MixBulletsSettings_Impl(){} +}; + +class SVX_DLLPUBLIC NumberSettings_Impl +{ + public: + sal_Bool bIsCustomized; + rtl::OUString sDescription; + sal_uInt16 nIndex; //index in the tab page display + sal_uInt16 nIndexDefault; + NumSettings_Impl *pNumSetting; + public: + NumberSettings_Impl() : + bIsCustomized(sal_False), + nIndex((sal_uInt16)0xFFFF), + nIndexDefault((sal_uInt16)0xFFFF), + pNumSetting(NULL) + {} + ~NumberSettings_Impl(){} +}; + +class NumberSettingsArr_Impl; + +class SVX_DLLPUBLIC OutlineSettings_Impl +{ + public: + sal_Bool bIsCustomized; + rtl::OUString sDescription; + NumSettingsArr_Impl *pNumSettingsArr; + public: + OutlineSettings_Impl() : + bIsCustomized(sal_False), + pNumSettingsArr(NULL) + {} + ~OutlineSettings_Impl(){ + } +}; + +class SVX_DLLPUBLIC NBOTypeMgrBase +{ + public: + NBOType eType; + private: + const SfxItemSet* pSet; + SfxMapUnit eCoreUnit; + //Sym3_2508 store the attributes passed from pSet + String aNumCharFmtName; + void StoreBulCharFmtName_impl(); + void StoreMapUnit_impl(); + + public: + NBOTypeMgrBase(const NBOType aType):eType(aType),pSet(0),eCoreUnit(SFX_MAPUNIT_TWIP),aNumCharFmtName(String()){} + NBOTypeMgrBase(const NBOType aType,const SfxItemSet* pArg):eType(aType),pSet(pArg),eCoreUnit(SFX_MAPUNIT_TWIP),aNumCharFmtName(String()){} + NBOTypeMgrBase(const NBOTypeMgrBase& aTypeMgr){eType = aTypeMgr.eType;pSet = aTypeMgr.pSet;eCoreUnit = aTypeMgr.eCoreUnit;aNumCharFmtName = aTypeMgr.aNumCharFmtName; } + virtual ~NBOTypeMgrBase() {} + virtual void Init()=0; + virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex=0)=0; + virtual sal_Bool RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF)=0; + virtual sal_Bool ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF, sal_Bool isDefault=false,sal_Bool isResetSize=false)=0; + virtual String GetDescription(sal_uInt16 nIndex,sal_Bool isDefault=false)=0; + virtual sal_Bool IsCustomized(sal_uInt16 nIndex)=0; + sal_uInt16 IsSingleLevel(sal_uInt16 nCurLevel); + const SfxItemSet* GetItems() { return pSet;} + //Sym3_2508 store the attributes passed from pSet + void SetItems(const SfxItemSet* pArg) { pSet = pArg;StoreBulCharFmtName_impl();StoreMapUnit_impl();} + protected: + String GetBulCharFmtName(); + SfxMapUnit GetMapUnit(); + protected: + sal_Bool bIsLoading; + void ImplLoad(String filename); + void ImplStore(String filename); + +}; + + +class SVX_DLLPUBLIC BulletsTypeMgr: public NBOTypeMgrBase +{ + friend class OutlineTypeMgr; + friend class NumberingTypeMgr; + public: + static sal_Unicode aDynamicBulletTypes[DEFAULT_BULLET_TYPES]; + static sal_Unicode aDynamicRTLBulletTypes[DEFAULT_BULLET_TYPES]; + static BulletsSettings_Impl* pActualBullets[DEFAULT_BULLET_TYPES]; + static BulletsTypeMgr* _instance; + public: + BulletsTypeMgr(const NBOType aType); + BulletsTypeMgr(const NBOType aType,const SfxItemSet* pArg); + BulletsTypeMgr(const BulletsTypeMgr& aTypeMgr); + virtual ~BulletsTypeMgr() {} + virtual void Init(); + virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex=0); + virtual sal_Bool RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF); + virtual sal_Bool ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF,sal_Bool isDefault=false,sal_Bool isResetSize=false); + virtual String GetDescription(sal_uInt16 nIndex,sal_Bool isDefault=false); + virtual sal_Bool IsCustomized(sal_uInt16 nIndex); + sal_Unicode GetBulChar(sal_uInt16 nIndex); + Font GetBulCharFont(sal_uInt16 nIndex); + static BulletsTypeMgr* GetInstance() + { + if ( _instance == 0 ) + { + _instance = new BulletsTypeMgr(eNBOType::BULLETS); + } + + return _instance; + } + +}; + +class SVX_DLLPUBLIC GraphyicBulletsTypeMgr: public NBOTypeMgrBase +{ + friend class OutlineTypeMgr; + friend class NumberingTypeMgr; + public: + List aGrfDataLst; + static GraphyicBulletsTypeMgr* _instance; + public: + GraphyicBulletsTypeMgr(const NBOType aType); + GraphyicBulletsTypeMgr(const NBOType aType,const SfxItemSet* pArg); + GraphyicBulletsTypeMgr(const GraphyicBulletsTypeMgr& aTypeMgr); + virtual ~GraphyicBulletsTypeMgr() {} + virtual void Init(); + virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex=0); + virtual sal_Bool RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF); + virtual sal_Bool ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF,sal_Bool isDefault=false,sal_Bool isResetSize=false); + virtual String GetDescription(sal_uInt16 nIndex,sal_Bool isDefault=false); + virtual sal_Bool IsCustomized(sal_uInt16 nIndex); + String GetGrfName(sal_uInt16 nIndex); + static GraphyicBulletsTypeMgr* GetInstance() + { + if ( _instance == 0 ) + { + _instance = new GraphyicBulletsTypeMgr(eNBOType::BULLETS); + } + + return _instance; + } + +}; + +class SVX_DLLPUBLIC MixBulletsTypeMgr: public NBOTypeMgrBase +{ + friend class OutlineTypeMgr; + friend class NumberingTypeMgr; + public: + static MixBulletsSettings_Impl* pActualBullets[DEFAULT_BULLET_TYPES]; + static MixBulletsSettings_Impl* pDefaultActualBullets[DEFAULT_BULLET_TYPES]; + static MixBulletsTypeMgr* _instance; + public: + MixBulletsTypeMgr(const NBOType aType); + MixBulletsTypeMgr(const NBOType aType,const SfxItemSet* pArg); + MixBulletsTypeMgr(const MixBulletsTypeMgr& aTypeMgr); + virtual ~MixBulletsTypeMgr() {} + virtual void Init(); + virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex=0); + virtual sal_Bool RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF); + virtual sal_Bool ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF,sal_Bool isDefault=false,sal_Bool isResetSize=false); + virtual String GetDescription(sal_uInt16 nIndex,sal_Bool isDefault=false); + virtual sal_Bool IsCustomized(sal_uInt16 nIndex); + static MixBulletsTypeMgr* GetInstance() + { + if ( _instance == 0 ) + { + _instance = new MixBulletsTypeMgr(eNBOType::MIXBULLETS); + } + + return _instance; + } + +}; + +class SVX_DLLPUBLIC NumberingTypeMgr: public NBOTypeMgrBase +{ + public: + //NumSettingsArr_Impl* pNumSettingsArr; + NumberSettingsArr_Impl* pNumberSettingsArr; + NumberSettingsArr_Impl* pDefaultNumberSettingsArr; + static NumberingTypeMgr* _instance; + public: + NumberingTypeMgr(const NBOType aType); + NumberingTypeMgr(const NBOType aType,const SfxItemSet* pArg); + NumberingTypeMgr(const NumberingTypeMgr& aTypeMgr); + virtual ~NumberingTypeMgr() {} + virtual void Init(); + virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex=0); + virtual sal_Bool RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF); + virtual sal_Bool ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF,sal_Bool isDefault=false,sal_Bool isResetSize=false); + virtual String GetDescription(sal_uInt16 nIndex,sal_Bool isDefault=false); + virtual sal_Bool IsCustomized(sal_uInt16 nIndex); + sal_uInt16 GetNumCount() const; + NumberSettings_Impl* GetNumSettingByIndex(sal_uInt16 nIndex) const; + static NumberingTypeMgr* GetInstance() + { + if ( _instance == 0 ) + { + _instance = new NumberingTypeMgr(eNBOType::NUMBERING); + } + + return _instance; + } +}; + +class SVX_DLLPUBLIC OutlineTypeMgr: public NBOTypeMgrBase +{ + public: + //NumSettingsArr_Impl* pNumSettingsArrs[DEFAULT_NUM_VALUSET_COUNT]; + OutlineSettings_Impl* pOutlineSettingsArrs[DEFAULT_NUM_VALUSET_COUNT]; + OutlineSettings_Impl* pDefaultOutlineSettingsArrs[DEFAULT_NUM_VALUSET_COUNT]; + static OutlineTypeMgr* _instance; + public: + OutlineTypeMgr(const NBOType aType); + OutlineTypeMgr(const NBOType aType,const SfxItemSet* pArg); + OutlineTypeMgr(const OutlineTypeMgr& aTypeMgr); + virtual ~OutlineTypeMgr() {} + virtual void Init(); + virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex=0); + virtual sal_Bool RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF); + virtual sal_Bool ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF,sal_Bool isDefault=false,sal_Bool isResetSize=false); + virtual String GetDescription(sal_uInt16 nIndex,sal_Bool isDefault=false); + virtual sal_Bool IsCustomized(sal_uInt16 nIndex); + static OutlineTypeMgr* GetInstance() + { + if ( _instance == 0 ) + { + _instance = new OutlineTypeMgr(eNBOType::OUTLINE); + } + + return _instance; + } +}; +}} +#endif + diff --git a/svx/inc/svx/nbdtmgfact.hxx b/svx/inc/svx/nbdtmgfact.hxx new file mode 100755 index 000000000000..7aedc5116e8b --- /dev/null +++ b/svx/inc/svx/nbdtmgfact.hxx @@ -0,0 +1,37 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#ifndef _NBDTMGFACT_HXX +#define _NBDTMGFACT_HXX +#ifndef _NBDTMG_HXX +#include "nbdtmg.hxx" +#endif +namespace svx { namespace sidebar { +class SVX_DLLPUBLIC NBOutlineTypeMgrFact +{ +public: + static NBOTypeMgrBase* CreateInstance(const NBOType aType); + NBOutlineTypeMgrFact(); + virtual ~NBOutlineTypeMgrFact() {} +}; +}} +#endif + diff --git a/svx/source/table/tablecontroller.hxx b/svx/inc/svx/sdr/table/tablecontroller.hxx index d8fd1d9c831b..f6494ed6027e 100644..100755 --- a/svx/source/table/tablecontroller.hxx +++ b/svx/inc/svx/sdr/table/tablecontroller.hxx @@ -32,7 +32,7 @@ #include <svx/selectioncontroller.hxx> #include <svx/svdotable.hxx> #include <svx/svdview.hxx> -#include <tablemodel.hxx> +//#include <tablemodel.hxx> class SdrObjEditView; class SdrObject; @@ -40,6 +40,8 @@ class SfxItemSet; namespace sdr { namespace table { +class TableModel; + const sal_Int16 SELTYPE_NONE = 0; const sal_Int16 SELTYPE_MOUSE = 1; const sal_Int16 SELTYPE_KEYS = 2; @@ -142,7 +144,8 @@ private: DECL_LINK( UpdateHdl, void * ); - TableModelRef mxTable; + //TableModelRef mxTable; + rtl::Reference< TableModel > mxTable; CellPos maCursorFirstPos; CellPos maCursorLastPos; diff --git a/svx/inc/svx/sidebar/ColorControl.hxx b/svx/inc/svx/sidebar/ColorControl.hxx new file mode 100644 index 000000000000..de84aab91723 --- /dev/null +++ b/svx/inc/svx/sidebar/ColorControl.hxx @@ -0,0 +1,86 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "svx/sidebar/PopupControl.hxx" + +#include <svtools/valueset.hxx> +#include <boost/function.hpp> + +class Window; +class SfxBindings; +class RedId; +class FloatingWindow; + + +namespace svx { namespace sidebar { + +/** The ColorControl uses a ValueSet control for displaying all named + colors in a matrix. +*/ +class SVX_DLLPUBLIC ColorControl + : public PopupControl +{ +public: + /** Create a new ColorControl object. + @param rControlResId + The resource id for the whole color control. + @param rNoColorGetter + A functor for getting the color which will be returned when the + WB_NONEFIELD is used and got selected + @param rColorSetter + A functor for setting the color that is selected by the + user. + @param pNoColorStringResId + Resource id of an optional string for the "no color" + string. When a value is given then a + field/button is created above the color matrix for + selecting "no color" ie. transparent. + When zero is given then no such field is created. + */ + 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); + virtual ~ColorControl (void); + + void GetFocus (void); + void SetCurColorSelect ( + const Color aCol, + const bool bAvl); + +private: + SfxBindings* mpBindings; + ValueSet maVSColor; + FloatingWindow* mpFloatingWindow; + const String msNoColorString; + ::boost::function<Color(void)> maNoColorGetter; + ::boost::function<void(String&,Color)> maColorSetter; + + void FillColors (void); + DECL_LINK(VSSelectHdl, void *); +}; + +} } // end of namespace svx::sidebar diff --git a/svx/inc/svx/sidebar/ColorPopup.hxx b/svx/inc/svx/sidebar/ColorPopup.hxx new file mode 100644 index 000000000000..f4c9ef4fa971 --- /dev/null +++ b/svx/inc/svx/sidebar/ColorPopup.hxx @@ -0,0 +1,55 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#ifndef _SVX_SIDEBAR_COLOR_POPUP_HXX_ +#define _SVX_SIDEBAR_COLOR_POPUP_HXX_ + +#include "svx/sidebar/Popup.hxx" + +#include <tools/color.hxx> + + +namespace svx { namespace sidebar { + +/** Popup control that displays all named colors in a matrix. + The number of rows and columns of the matrix are computed from + the number of named colors so that both have roughly the same + value. + + The ColorPopup uses ColorControl as control for its content. +*/ +class SVX_DLLPUBLIC ColorPopup + : public Popup +{ +public : + ColorPopup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator); + virtual ~ColorPopup (void); + + void SetCurrentColor ( + const Color aCurrentColor, + const bool bIsColorAvailable); +}; + +} } // end of namespace svx::sidebar + +#endif diff --git a/svx/inc/svx/sidebar/ContextChangeEventMultiplexer.hxx b/svx/inc/svx/sidebar/ContextChangeEventMultiplexer.hxx new file mode 100644 index 000000000000..1d661d8f0a58 --- /dev/null +++ b/svx/inc/svx/sidebar/ContextChangeEventMultiplexer.hxx @@ -0,0 +1,69 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#ifndef _SVX_SIDEBAR_CONTEXT_CHANGE_EVENT_MULTIPLEXER_HXX_ +#define _SVX_SIDEBAR_CONTEXT_CHANGE_EVENT_MULTIPLEXER_HXX_ + +#include "svx/svxdllapi.h" +#include <sfx2/sidebar/EnumContext.hxx> +#include <com/sun/star/frame/XController.hpp> +#include <com/sun/star/frame/XFrame.hpp> + +namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; + +class SfxViewShell; + +/** Convenience frontend for com::sun::star::ui::ContextChangeEventMultiplexer +*/ +class SVX_DLLPUBLIC ContextChangeEventMultiplexer +{ +public: + /** Notify the activation of a context. + @param rxController + This controller is used to determine the module (ie + application like Writer or Calc). + @param eContext + The activated context. + */ + static void NotifyContextChange ( + const cssu::Reference<css::frame::XController>& rxController, + const ::sfx2::sidebar::EnumContext::Context eContext); + + /** Notify the activation of a context. + @param pViewShell + This view shell is used to determine the module (ie + application like Writer or Calc). When <NULL/> then no + notification is made. + @param eContext + The activated context. + */ + static void NotifyContextChange ( + SfxViewShell* pViewShell, + const ::sfx2::sidebar::EnumContext::Context eContext); + +private: + static ::rtl::OUString GetModuleName ( + const cssu::Reference<css::frame::XFrame>& rxFrame); +}; + +#endif + diff --git a/svx/inc/svx/sidebar/Popup.hxx b/svx/inc/svx/sidebar/Popup.hxx new file mode 100644 index 000000000000..00d48af259e0 --- /dev/null +++ b/svx/inc/svx/sidebar/Popup.hxx @@ -0,0 +1,107 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#ifndef _SVX_SIDEBAR_POPUP_HXX_ +#define _SVX_SIDEBAR_POPUP_HXX_ + +#include "svx/svxdllapi.h" +#include <rtl/ustring.hxx> +#include <tools/link.hxx> + +#include <boost/function.hpp> +#include <boost/scoped_ptr.hpp> + +class Window; +class ToolBox; + +namespace svx { namespace sidebar { + +class PopupContainer; +class PopupControl; + +/** A wrapper around a PopupContainer and a PopupControl object. + Usually used as drop down for a toolbox. Use Show() to start + drop down mode and Hide() to end it. +*/ +class SVX_DLLPUBLIC Popup +{ +public : + /** Create a Popup wrapper object. + @param pParent + Parent window of the PopupContainer, which in turn is the + parent of the PopupControl. + @param rControlCreator + A functor that is called to create the PopupControl object + (usually an instance of a class derived from + PopupControl). + */ + Popup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator, + const ::rtl::OUString& rsAccessibleName); + virtual ~Popup (void); + + /** Show the popup. + @rToolBox + The tool box is used to determine the position at which + the popup is displayed. + */ + void Show (ToolBox& rToolBox); + + /** Hide the popup. + This method is called automatically when eg. the user clicks + outside the popup or when the ESC-key is pressed. The + application can call Hide() when the popup should be closed + for other, non-standard reasons. + */ + void Hide (void); + + /** If you want to be informed when the popup closes then add a + callback that is called after that. + */ + void SetPopupModeEndHandler (const ::boost::function<void(void)>& rCallback); + +protected: + ::boost::scoped_ptr<PopupControl> mpControl; + + /** Make sure that both PopupContainer and PopupControl objects + exist. Calls the maControlCreator functor if necessary. + */ + void ProvideContainerAndControl (void); + + /** A derived specialisation class can override this method to do + additional work. + */ + virtual void CreateContainerAndControl (void); + +private: + Window* mpParent; + ::boost::function<PopupControl*(PopupContainer*)> maControlCreator; + ::boost::function<void(void)> maPopupModeEndCallback; + const ::rtl::OUString msAccessibleName; + ::boost::scoped_ptr<PopupContainer> mpContainer; + + DECL_LINK(PopupModeEndHandler, void*); +}; + +} } // end of namespace svx::sidebar + +#endif diff --git a/svx/inc/svx/sidebar/PopupContainer.hxx b/svx/inc/svx/sidebar/PopupContainer.hxx new file mode 100644 index 000000000000..99c94236fd0f --- /dev/null +++ b/svx/inc/svx/sidebar/PopupContainer.hxx @@ -0,0 +1,48 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#ifndef _SVX_SIDEBAR_POPUP_CONTAINER_HXX_ +#define _SVX_SIDEBAR_POPUP_CONTAINER_HXX_ + +#include "svx/svxdllapi.h" +#include <vcl/floatwin.hxx> + +namespace svx { namespace sidebar { + +/** Simple base class for popup container windows used by sidebar + related drop downs. + It initializes the underlying floating window with the right + flags and closes the drop down when appropriate. +*/ +class SVX_DLLPUBLIC PopupContainer + : public FloatingWindow +{ +public: + PopupContainer (Window* pParent); + virtual ~PopupContainer (void); + + virtual long Notify (NotifyEvent& rNEvt); +}; + + +} } // end of namespace svx::sidebar + +#endif diff --git a/svx/inc/svx/sidebar/PopupControl.hxx b/svx/inc/svx/sidebar/PopupControl.hxx new file mode 100644 index 000000000000..449c7c13364c --- /dev/null +++ b/svx/inc/svx/sidebar/PopupControl.hxx @@ -0,0 +1,51 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#ifndef _SVX_SIDEBAR_POPUP_CONTROL_HXX_ +#define _SVX_SIDEBAR_POPUP_CONTROL_HXX_ + +#include "svx/svxdllapi.h" +#include <vcl/ctrl.hxx> + +namespace svx { namespace sidebar { + +/** Base class for sidebar related popup controls. + A PopupControl is typically a child of a PopupContainer and + provides the actual content of a popup. + This base class takes care of painting the proper background and + border for sidebar popups. + Specialize by derivation. +*/ +class SVX_DLLPUBLIC PopupControl + : public Control +{ +public : + PopupControl ( + Window* pParent, + const ResId& rResId); + virtual ~PopupControl (void); + + virtual void Paint (const Rectangle& rect); +}; + +} } // end of namespace svx::sidebar + +#endif diff --git a/svx/inc/svx/sidebar/SelectionAnalyzer.hxx b/svx/inc/svx/sidebar/SelectionAnalyzer.hxx new file mode 100644 index 000000000000..3f4fa14af8ef --- /dev/null +++ b/svx/inc/svx/sidebar/SelectionAnalyzer.hxx @@ -0,0 +1,66 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#ifndef _SVX_SIDEBAR_SELECTION_ANALYZER_HXX_ +#define _SVX_SIDEBAR_SELECTION_ANALYZER_HXX_ + +#include <sfx2/sidebar/EnumContext.hxx> +#include "svx/svxdllapi.h" + +class SdrMarkList; +class SdrObject; + + +namespace svx { namespace sidebar { + +class SVX_DLLPUBLIC SelectionAnalyzer +{ +public : + static sfx2::sidebar::EnumContext::Context GetContextForSelection_SC ( + const SdrMarkList& rMarkList); + static sfx2::sidebar::EnumContext::Context GetContextForSelection_SD ( + const SdrMarkList& rMarkList, + const bool bIsMasterPage, + const bool bIsHandoutPage, + const bool bIsNotesPage); + +private: + static sfx2::sidebar::EnumContext::Context GetContextForObjectId_SC ( + const sal_uInt16 nObjectId); + static sfx2::sidebar::EnumContext::Context GetContextForObjectId_SD ( + const sal_uInt16 nObjectId, + const bool bIsHandoutPage, + const bool bIsNotesPage); + static sal_uInt32 GetInventorTypeFromMark ( + const SdrMarkList& rMarkList); + static sal_uInt16 GetObjectTypeFromMark ( + const SdrMarkList& rMarkList); + static sal_uInt16 GetObjectTypeFromGroup ( + const SdrObject* pObj); + static bool IsShapeType ( + const sal_uInt16 nType); + static bool IsTextObjType ( + const sal_uInt16 nType); +}; + +} } // end of namespace svx::sidebar + +#endif diff --git a/svx/inc/svx/sidebar/SelectionChangeHandler.hxx b/svx/inc/svx/sidebar/SelectionChangeHandler.hxx new file mode 100644 index 000000000000..1815414e4f9b --- /dev/null +++ b/svx/inc/svx/sidebar/SelectionChangeHandler.hxx @@ -0,0 +1,89 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#ifndef _SVX_SIDEBAR_SELECTION_CHANGE_HANDLER_HXX_ +#define _SVX_SIDEBAR_SELECTION_CHANGE_HANDLER_HXX_ + +#include "svx/svxdllapi.h" +#include <sfx2/sidebar/EnumContext.hxx> +#include <com/sun/star/frame/XController.hpp> +#include <com/sun/star/view/XSelectionSupplier.hpp> +#include <com/sun/star/view/XSelectionChangeListener.hpp> + +#include <cppuhelper/compbase1.hxx> +#include <cppuhelper/basemutex.hxx> + +#include <boost/noncopyable.hpp> +#include <boost/function.hpp> + +namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; + + +class SdrMarkView; + + +namespace svx { namespace sidebar { + +namespace { + typedef ::cppu::WeakComponentImplHelper1 < + css::view::XSelectionChangeListener + > SelectionChangeHandlerInterfaceBase; +} + + +class SVX_DLLPUBLIC SelectionChangeHandler + : private ::boost::noncopyable, + private ::cppu::BaseMutex, + public SelectionChangeHandlerInterfaceBase +{ +public: + SelectionChangeHandler ( + const boost::function<sfx2::sidebar::EnumContext::Context(void)>& rSelectionChangeCallback, + const cssu::Reference<css::frame::XController>& rxController, + const sfx2::sidebar::EnumContext::Context eDefaultContext); + virtual ~SelectionChangeHandler (void); + + virtual void SAL_CALL selectionChanged (const css::lang::EventObject& rEvent) + throw (cssu::RuntimeException); + + virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent) + throw (cssu::RuntimeException); + + virtual void SAL_CALL disposing (void) + throw (cssu::RuntimeException); + + void Connect (void); + void Disconnect (void); + +private: + const boost::function<sfx2::sidebar::EnumContext::Context(void)> maSelectionChangeCallback; + cssu::Reference<css::frame::XController> mxController; + const sfx2::sidebar::EnumContext::Context meDefaultContext; + bool mbIsConnected; +}; + + +} } // end of namespace svx::sidebar + + +#endif + diff --git a/svx/inc/svx/sidebar/SidebarDialControl.hxx b/svx/inc/svx/sidebar/SidebarDialControl.hxx new file mode 100644 index 000000000000..49d6d5f1ee1b --- /dev/null +++ b/svx/inc/svx/sidebar/SidebarDialControl.hxx @@ -0,0 +1,45 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#ifndef SVX_SIDEBAR_DIAL_CONTROL_HXX +#define SVX_SIDEBAR_DIAL_CONTROL_HXX + +#include <svx/dialcontrol.hxx> + +namespace svx { namespace sidebar { + +/** Provide some improvements over the standard DialControl. +*/ +class SVX_DLLPUBLIC SidebarDialControl : public svx::DialControl +{ +public: + SidebarDialControl (Window* pParent, const ResId& rResId); + virtual ~SidebarDialControl (void); + + virtual void MouseButtonDown (const MouseEvent& rMEvt); + +protected: + virtual void HandleMouseEvent (const Point& rPos, bool bInitial); +}; + +} } // end of namespace svx::sidebar + +#endif diff --git a/svx/inc/svx/sidebar/ValueSetWithTextControl.hxx b/svx/inc/svx/sidebar/ValueSetWithTextControl.hxx new file mode 100644 index 000000000000..03531521c5e7 --- /dev/null +++ b/svx/inc/svx/sidebar/ValueSetWithTextControl.hxx @@ -0,0 +1,161 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#ifndef _SVX_SIDEBAR_VALUESETWITHTEXT_CONTROL_HXX_ +#define _SVX_SIDEBAR_VALUESETWITHTEXT_CONTROL_HXX_ + +#include "svx/svxdllapi.h" + +#include <svtools/valueset.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 <vcl/image.hxx> + +#include <vector> + +namespace com{namespace sun{ namespace star{ + namespace container{ + class XIndexAccess; + } + namespace beans{ + struct PropertyValue; + } + namespace text{ + class XNumberingFormatter; + } +}}} + +namespace svx { namespace sidebar { + +/** Specialization of class <ValueSet>. + This specialization allows is a one-columned ValueSet which allow + items containing an image and a text or a text and a second text. + + Especially, used for sidebar related controls. +*/ +class SVX_DLLPUBLIC ValueSetWithTextControl : public ValueSet +{ +public: + // control type of specialized <ValueSet>: + // - image + text + // - text + text + enum tControlType + { + IMAGE_TEXT, + TEXT_TEXT + }; + + ValueSetWithTextControl( + const tControlType eControlType, + Window* pParent, + const ResId& rResId); + + virtual ~ValueSetWithTextControl(void); + + // add item for control type IMAGE_TEXT + // if control type does not match IMAGE_TEXT no item is added. + // @param pSelectedItemImage + // selection item image is optional. if not provided, it is the same as the image item + // @param pItemHelpText + // help text is optional. if not provided, it is the same as the item text + void AddItem( + const Image& rItemImage, + const Image* pSelectedItemImage, + const XubString& rItemText, + const XubString* pItemHelpText ); + + // replace item images for control type IMAGE_TEXT + void ReplaceItemImages( + const sal_uInt16 nItemId, + const Image& rItemImage, + const Image* pSelectedItemImage ); + + // add item for control type TEXT_TEXT + // if control type does not match TEXT_TEXT no item is added. + // @param pItemHelpText + // help text is optional. if not provided, it is the same as the item text + void AddItem( + const XubString& rItemText, + const XubString& rItemText2, + const XubString* pItemHelpText ); + + virtual void UserDraw( const UserDrawEvent& rUDEvt ); + +private: + struct ValueSetWithTextItem + { + Image maItemImage; + Image maSelectedItemImage; + XubString maItemText; + XubString maItemText2; + }; + + typedef ::std::vector< ValueSetWithTextItem > tItemList; + + const tControlType meControlType; + tItemList maItems; +}; + +class SVX_DLLPUBLIC SvxNumValueSet2 : public ValueSet +{ + Color aLineColor; + Rectangle aOrgRect; + VirtualDevice* pVDev; + + com::sun::star::uno::Reference<com::sun::star::text::XNumberingFormatter> xFormatter; + com::sun::star::lang::Locale aLocale; + + com::sun::star::uno::Sequence< + com::sun::star::uno::Sequence< + com::sun::star::beans::PropertyValue> > aNumSettings; + + + public: + SvxNumValueSet2( Window* pParent, const ResId& rResId); + ~SvxNumValueSet2(); + + virtual void UserDraw( const UserDrawEvent& rUDEvt ); + + + void SetNumberingSettings( + const com::sun::star::uno::Sequence< + com::sun::star::uno::Sequence< + com::sun::star::beans::PropertyValue> >& aNum, + com::sun::star::uno::Reference<com::sun::star::text::XNumberingFormatter>& xFormatter, + const com::sun::star::lang::Locale& rLocale ); +}; + +class SVX_DLLPUBLIC SvxNumValueSet3 : public ValueSet +{ + public: + SvxNumValueSet3( Window* pParent, const ResId& rResId); + ~SvxNumValueSet3(); + + virtual void UserDraw( const UserDrawEvent& rUDEvt ); + +}; + +} } // end of namespace svx::sidebar + +#endif diff --git a/svx/inc/svx/svdedtv.hxx b/svx/inc/svx/svdedtv.hxx index 5ba95fcb25c9..879dcbd26ace 100644 --- a/svx/inc/svx/svdedtv.hxx +++ b/svx/inc/svx/svdedtv.hxx @@ -243,6 +243,7 @@ public: void SetMarkedObjRect(const Rectangle& rRect, sal_Bool bCopy=sal_False); void MoveMarkedObj(const Size& rSiz, bool bCopy=false); void ResizeMarkedObj(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bCopy=false); + void ResizeMultMarkedObj(const Point& rRef, const Fraction& xFact, const Fraction& yFact, const bool bCopy, const bool bWdh, const bool bHgt); long GetMarkedObjRotate() const; void RotateMarkedObj(const Point& rRef, long nWink, bool bCopy=false); void MirrorMarkedObj(const Point& rRef1, const Point& rRef2, bool bCopy=false); diff --git a/svx/inc/svx/svdedxv.hxx b/svx/inc/svx/svdedxv.hxx index 6d8203b0d325..e7d6b7cbdb08 100644 --- a/svx/inc/svx/svdedxv.hxx +++ b/svx/inc/svx/svdedxv.hxx @@ -270,6 +270,9 @@ public: virtual void AddWindowToPaintView(OutputDevice* pNewWin); virtual void DeleteWindowFromPaintView(OutputDevice* pOldWin); + sal_uInt16 GetSelectionLevel() const; + + //************************************************************************ // Object-MacroModus (z.B. Rect als Button oder sowas): //************************************************************************ diff --git a/svx/inc/svx/svdmodel.hxx b/svx/inc/svx/svdmodel.hxx index 05814e23330e..5418a4527ab6 100644 --- a/svx/inc/svx/svdmodel.hxx +++ b/svx/inc/svx/svdmodel.hxx @@ -78,16 +78,11 @@ class SfxStyleSheet; class SfxUndoAction; class SfxUndoManager; class XBitmapList; -class XBitmapTable; -class XColorTable; +class XColorList; class XDashList; -class XDashTable; class XGradientList; -class XGradientTable; class XHatchList; -class XHatchTable; class XLineEndList; -class XLineEndTable; class SvxForbiddenCharactersTable; class SvNumberFormatter; class SotStorage; @@ -282,7 +277,7 @@ public: FASTBOOL mbInDestruction; // Zeiger auf Paletten, Listen und Tabellen - XColorTable* pColorTable; + XColorList* pColorTable; XDashList* pDashList; XLineEndList* pLineEndList; XHatchList* pHatchList; @@ -658,8 +653,8 @@ public: const Link& GetIOProgressHdl() const { return aIOProgressLink; } // Zugriffsmethoden fuer Paletten, Listen und Tabellen - void SetColorTable(XColorTable* pTable) ; - XColorTable* GetColorTable() const { return pColorTable; } + void SetColorTable(XColorList* pTable) ; + XColorList* GetColorTable() const { return pColorTable; } void SetDashList(XDashList* pList) ; XDashList* GetDashList() const { return pDashList; } void SetLineEndList(XLineEndList* pList) ; diff --git a/svx/inc/svx/svdobj.hxx b/svx/inc/svx/svdobj.hxx index dd18589bc9d9..14a9301148e1 100644 --- a/svx/inc/svx/svdobj.hxx +++ b/svx/inc/svx/svdobj.hxx @@ -40,6 +40,7 @@ #include <svx/sdrobjectuser.hxx> #include "svx/svxdllapi.h" #include "svx/shapeproperty.hxx" +#include <svl/poolitem.hxx> //************************************************************ // Vorausdeklarationen @@ -855,6 +856,9 @@ protected: void SetObjectItemSet(const SfxItemSet& rSet); const SfxPoolItem& GetObjectItem(const sal_uInt16 nWhich) const; + // get SfxMapUnit the object is using + SfxMapUnit GetObjectMapUnit() const; + public: // syntactical sugar for ItemSet accesses void SetMergedItemSetAndBroadcast(const SfxItemSet& rSet, sal_Bool bClearAllItems = sal_False); diff --git a/svx/inc/svx/svdogrp.hxx b/svx/inc/svx/svdogrp.hxx index b32c44096ef9..3b70be0218f9 100644 --- a/svx/inc/svx/svdogrp.hxx +++ b/svx/inc/svx/svdogrp.hxx @@ -48,9 +48,6 @@ protected: virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); SdrObjList* pSub; // Subliste (Kinder) - long nDrehWink; - long nShearWink; - Point aRefPoint; // Referenzpunkt innerhalb der Objektgruppe FASTBOOL bRefPoint; // Ist ein RefPoint gesetzt? diff --git a/svx/inc/svx/svdstr.hrc b/svx/inc/svx/svdstr.hrc index 60225090efc4..a78cf826b4b9 100644 --- a/svx/inc/svx/svdstr.hrc +++ b/svx/inc/svx/svdstr.hrc @@ -785,8 +785,11 @@ #define SIP_SA_CROP_MARKERS (SIP_Begin + 276) #define SIP_SA_CROP_FINE_MARKERS (SIP_Begin + 277) #define SIP_SA_ACCESSIBILITY_CROP_MARKERS (SIP_Begin + 278) +#define IMG_DIACONTROL_NORMAL (SIP_Begin + 279) +#define IMG_DIACONTROL_H (SIP_Begin + 280) -#define SIP_End (SIP_SA_ACCESSIBILITY_CROP_MARKERS) + +#define SIP_End (IMG_DIACONTROL_H) #define SDR_ResourceEnd (SIP_End) diff --git a/svx/inc/svx/svxids.hrc b/svx/inc/svx/svxids.hrc index 3a31540fcfe2..a864e41381da 100755 --- a/svx/inc/svx/svxids.hrc +++ b/svx/inc/svx/svxids.hrc @@ -373,6 +373,8 @@ #define FN_NUM_BULLET_OFF (FN_EDIT + 37) /* Numerierung aus */ #define FN_NUM_BULLET_ON (FN_EDIT + 38) /* Numerierung mit Bullets an */ #define FN_NUM_NUMBERING_ON (FN_EDIT + 44) /* Numerierung an */ +#define FN_BUL_NUM_RULE_INDEX (FN_EDIT + 120) /* Achieving num rule index */ +#define FN_NUM_NUM_RULE_INDEX (FN_EDIT + 121) #define FN_INSERT (SID_SW_START + 300) #define FN_DELETE_BOOKMARK (FN_INSERT + 1) @@ -682,6 +684,9 @@ #define SID_TWAIN_TRANSFER ( SID_SVX_START + 332 ) #define SID_CONTOUR_DLG ( SID_SVX_START + 334 ) #define SID_CONTOUR_EXEC ( SID_SVX_START + 335 ) + +//#define SID_SIDEBAR ( SID_SVX_START + 336 ) -> sfxsids.hrc + #define SID_BORDER_OBJECT ( SID_SVX_START + 340 ) #define SID_BORDER_LEFTLINE ( SID_SVX_START + 341 ) #define SID_BORDER_RIGHTLINE ( SID_SVX_START + 342 ) @@ -748,6 +753,8 @@ #define SID_ATTR_3D_AMBIENTCOLOR ( SID_SVX_START + 411 ) #define SID_IMPORT_GRAPH_LINK ( SID_SVX_START + 412 ) +//#define SID_ATTR_PARA_REGISTER ( SID_SVX_START + 413 ) -> editids.hrc + //! moved to sfx2, still in use: //#define SID_HTML_MODE ( SID_SVX_START + 414 ) @@ -1257,8 +1264,26 @@ #define SID_TRANSLITERATE_TITLE_CASE (SID_SVX_START+1103) #define SID_TRANSLITERATE_TOGGLE_CASE (SID_SVX_START+1104) +// new slots for panels +#define SID_ATTR_FILL_TRANSPARENCE (SID_SVX_START+1105) +#define SID_ATTR_FILL_FLOATTRANSPARENCE (SID_SVX_START+1106) +#define SID_ATTR_LINE_TRANSPARENCE (SID_SVX_START+1107) +#define SID_FLIP_HORIZONTAL (SID_SVX_START+1108) +#define SID_FLIP_VERTICAL (SID_SVX_START+1109) +#define SID_ATTR_LINE_JOINT (SID_SVX_START+1110) +#define SID_ATTR_LINE_CAP (SID_SVX_START+1111) +#define SID_ATTR_TRANSFORM_MATRIX (SID_SVX_START+1112) + +#define SID_CELL_FORMAT_BORDER (SID_SVX_START+1113) +#define SID_CHAR_DLG_EFFECT (SID_SVX_START+1114) +#define SID_ATTR_PARA_LEFT (SID_SVX_START + 1115) +#define SID_ATTR_PARA_RIGHT (SID_SVX_START + 1116) + +#define FN_SVX_SET_NUMBER (SID_SVX_START + 1117) +#define FN_SVX_SET_BULLET (SID_SVX_START + 1118) + // IMPORTANT NOTE: adjust SID_SVX_FIRSTFREE, when adding new slot id -#define SID_SVX_FIRSTFREE (SID_TRANSLITERATE_TOGGLE_CASE + 1) +#define SID_SVX_FIRSTFREE (FN_SVX_SET_BULLET + 1) // -------------------------------------------------------------------------- // Overflow check for slot IDs diff --git a/svx/inc/svx/svxitems.hrc b/svx/inc/svx/svxitems.hrc index d6f035c62607..f001e4107c6e 100644 --- a/svx/inc/svx/svxitems.hrc +++ b/svx/inc/svx/svxitems.hrc @@ -70,6 +70,9 @@ #define RID_SVXITEMS_BRUSHSTYLE_75 (RID_SVXITEMS_START + 55) #define RID_SVXITEMS_BRUSHSTYLE_BITMAP (RID_SVXITEMS_START + 56) +// enum ColorName ----------------------------------------------------------- +#define RID_SVXITEMS_COLOR_WHITE (RID_SVXITEMS_START + 76) + // enum FontFamily ------------------------------------------------------- #define RID_SVXITEMS_FONTFAMILY_BEGIN (RID_SVXITEMS_START + 100) #define RID_SVXITEMS_FONTFAMILY_DONTKNOW (RID_SVXITEMS_START + 100) diff --git a/svx/inc/svx/xattr.hxx b/svx/inc/svx/xattr.hxx index 6dea0ad2cbcf..357a8c68c0e2 100644 --- a/svx/inc/svx/xattr.hxx +++ b/svx/inc/svx/xattr.hxx @@ -24,26 +24,12 @@ #define _XATTR_HXX // include --------------------------------------------------------------- - -#ifndef _XDEF_HXX -//#include <svx/xdef.hxx> -#endif -#ifndef _XENUM_HXX -//#include <svx/xenum.hxx> -#endif -#ifndef _XPOLY_HXX -//#include <svx/xpoly.hxx> -#endif -#ifndef _SVX_RECTENUM_HXX -//#include <svx/rectenum.hxx> -#endif - -class XColorTable; -class XDashTable; -class XLineEndTable; -class XHatchTable; -class XBitmapTable; -class XGradientTable; +class XColorList; +class XDashList; +class XLineEndList; +class XHatchList; +class XBitmapList; +class XGradientList; #include <svx/xit.hxx> #include <svx/xcolit.hxx> diff --git a/svx/inc/svx/xcolit.hxx b/svx/inc/svx/xcolit.hxx index 0c6f4b843e2e..82855e350d28 100644 --- a/svx/inc/svx/xcolit.hxx +++ b/svx/inc/svx/xcolit.hxx @@ -29,7 +29,7 @@ #include <svx/xit.hxx> -class XColorTable; +class XColorList; //----------------- // class XColorItem @@ -55,7 +55,7 @@ public: virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const; virtual SvStream& Store(SvStream& rOut, sal_uInt16 nItemVersion ) const; - const Color& GetColorValue(const XColorTable* pTable = 0) const; + const Color& GetColorValue(const XColorList* pTable = 0) const; void SetColorValue(const Color& rNew) { aColor = rNew; Detach(); } }; diff --git a/svx/inc/svx/xenum.hxx b/svx/inc/svx/xenum.hxx index f615cf78a1f9..d23302bd78d4 100644 --- a/svx/inc/svx/xenum.hxx +++ b/svx/inc/svx/xenum.hxx @@ -25,14 +25,6 @@ #define _XENUM_HXX enum XLineStyle { XLINE_NONE, XLINE_SOLID, XLINE_DASH }; -enum XLineJoint -{ - XLINEJOINT_NONE, // no rounding - XLINEJOINT_MIDDLE, // calc middle value between joints - XLINEJOINT_BEVEL, // join edges with line - XLINEJOINT_MITER, // extend till cut - XLINEJOINT_ROUND // create arc -}; enum XDashStyle { XDASH_RECT, XDASH_ROUND, XDASH_RECTRELATIVE, XDASH_ROUNDRELATIVE }; enum XFillStyle { XFILL_NONE, XFILL_SOLID, XFILL_GRADIENT, XFILL_HATCH, diff --git a/svx/inc/svx/xflgrit.hxx b/svx/inc/svx/xflgrit.hxx index a55862f94389..3f5dd828a671 100644 --- a/svx/inc/svx/xflgrit.hxx +++ b/svx/inc/svx/xflgrit.hxx @@ -59,7 +59,7 @@ public: SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String &rText, const IntlWrapper * = 0 ) const; - const XGradient& GetGradientValue(const XGradientTable* pTable = 0) const; // GetValue -> GetGradientValue + const XGradient& GetGradientValue(const XGradientList* pTable = 0) const; // GetValue -> GetGradientValue void SetGradientValue(const XGradient& rNew) { aGradient = rNew; Detach(); } // SetValue -> SetGradientValue static sal_Bool CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 ); diff --git a/svx/inc/svx/xflhtit.hxx b/svx/inc/svx/xflhtit.hxx index ddf367059949..b8b3e0a05bc7 100644 --- a/svx/inc/svx/xflhtit.hxx +++ b/svx/inc/svx/xflhtit.hxx @@ -61,7 +61,7 @@ public: virtual FASTBOOL HasMetrics() const; virtual FASTBOOL ScaleMetrics(long nMul, long nDiv); - const XHatch& GetHatchValue(const XHatchTable* pTable = 0) const; // GetValue -> GetHatchValue + const XHatch& GetHatchValue(const XHatchList* pTable = 0) const; // GetValue -> GetHatchValue void SetHatchValue(const XHatch& rNew) { aHatch = rNew; Detach(); } // SetValue -> SetHatchValue static sal_Bool CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 ); diff --git a/svx/inc/svx/xit.hxx b/svx/inc/svx/xit.hxx index 67580505f21a..156c88258b72 100644 --- a/svx/inc/svx/xit.hxx +++ b/svx/inc/svx/xit.hxx @@ -30,12 +30,12 @@ /************************************************************************/ -class XColorTable; -class XDashTable; -class XLineEndTable; -class XHatchTable; -class XBitmapTable; -class XGradientTable; +class XColorList; +class XDashList; +class XLineEndList; +class XHatchList; +class XBitmapList; +class XGradientList; class SfxItemPool; class NameOrIndex; class XPropertyList; diff --git a/svx/inc/svx/xlineit.hxx b/svx/inc/svx/xlineit.hxx index ce58730b53ef..2491bed4aa15 100644 --- a/svx/inc/svx/xlineit.hxx +++ b/svx/inc/svx/xlineit.hxx @@ -32,7 +32,7 @@ #include <svl/eitem.hxx> class XDash; -class XDashTable; +class XDashList; class SvStream; #include <svx/xdash.hxx> diff --git a/svx/inc/svx/xlinjoit.hxx b/svx/inc/svx/xlinjoit.hxx index 7b45dbd0fd74..0a74c2740243 100644 --- a/svx/inc/svx/xlinjoit.hxx +++ b/svx/inc/svx/xlinjoit.hxx @@ -27,16 +27,17 @@ #include <svl/eitem.hxx> #include <svx/xenum.hxx> #include "svx/svxdllapi.h" +#include <com/sun/star/drawing/LineJoint.hpp> //--------------------- -// class LineStyleItem +// class XLineJointItem //--------------------- class SVX_DLLPUBLIC XLineJointItem : public SfxEnumItem { public: TYPEINFO(); - XLineJointItem( XLineJoint eLineJoint = XLINEJOINT_ROUND ); + XLineJointItem( com::sun::star::drawing::LineJoint eLineJoint = com::sun::star::drawing::LineJoint_ROUND ); XLineJointItem( SvStream& rIn ); virtual sal_uInt16 GetVersion( sal_uInt16 nFileFormatVersion ) const; @@ -49,8 +50,8 @@ public: SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String &rText, const IntlWrapper * = 0 ) const; - virtual sal_uInt16 GetValueCount() const; - XLineJoint GetValue() const { return (XLineJoint) SfxEnumItem::GetValue(); } + virtual sal_uInt16 GetValueCount() const; + com::sun::star::drawing::LineJoint GetValue() const { return (com::sun::star::drawing::LineJoint) SfxEnumItem::GetValue(); } }; #endif // _SVX_XLINJOIT_HXX diff --git a/svx/inc/svx/xlncapit.hxx b/svx/inc/svx/xlncapit.hxx index 1949e9fda419..bccbcaf5e8b8 100644 --- a/svx/inc/svx/xlncapit.hxx +++ b/svx/inc/svx/xlncapit.hxx @@ -28,7 +28,7 @@ #include <com/sun/star/drawing/LineCap.hpp> //--------------------- -// class LineStyleItem +// class XLineCapItem //--------------------- class SVX_DLLPUBLIC XLineCapItem : public SfxEnumItem diff --git a/svx/inc/svx/xlndsit.hxx b/svx/inc/svx/xlndsit.hxx index c7d83fed2396..9ef7b5a38e99 100644 --- a/svx/inc/svx/xlndsit.hxx +++ b/svx/inc/svx/xlndsit.hxx @@ -65,7 +65,7 @@ public: virtual FASTBOOL HasMetrics() const; virtual FASTBOOL ScaleMetrics(long nMul, long nDiv); - const XDash& GetDashValue(const XDashTable* pTable = 0) const; // GetValue -> GetDashValue + const XDash& GetDashValue(const XDashList* pTable = 0) const; // GetValue -> GetDashValue void SetDashValue(const XDash& rNew) { aDash = rNew; Detach(); } // SetValue -> SetDashValue static sal_Bool CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 ); diff --git a/svx/inc/svx/xlnedit.hxx b/svx/inc/svx/xlnedit.hxx index 7b50ce8446d7..f0a62713cd31 100644 --- a/svx/inc/svx/xlnedit.hxx +++ b/svx/inc/svx/xlnedit.hxx @@ -59,7 +59,7 @@ public: SfxMapUnit ePresMetric, String &rText, const IntlWrapper * = 0 ) const; - basegfx::B2DPolyPolygon GetLineEndValue(const XLineEndTable* pTable = 0) const; + basegfx::B2DPolyPolygon GetLineEndValue(const XLineEndList* pTable = 0) const; void SetLineEndValue(const basegfx::B2DPolyPolygon& rPolyPolygon) { maPolyPolygon = rPolyPolygon; Detach(); } XLineEndItem* checkForUniqueItem( SdrModel* pModel ) const; diff --git a/svx/inc/svx/xlnstit.hxx b/svx/inc/svx/xlnstit.hxx index 270b0a509c44..3ab186106fa5 100644 --- a/svx/inc/svx/xlnstit.hxx +++ b/svx/inc/svx/xlnstit.hxx @@ -59,7 +59,7 @@ public: SfxMapUnit ePresMetric, String &rText, const IntlWrapper * = 0 ) const; - basegfx::B2DPolyPolygon GetLineStartValue(const XLineEndTable* pTable = 0) const; + basegfx::B2DPolyPolygon GetLineStartValue(const XLineEndList* pTable = 0) const; void SetLineStartValue(const basegfx::B2DPolyPolygon& rPolyPolygon) { maPolyPolygon = rPolyPolygon; Detach(); } XLineStartItem* checkForUniqueItem( SdrModel* pModel ) const; diff --git a/svx/inc/svx/xtable.hxx b/svx/inc/svx/xtable.hxx index 5a8a7060eed8..fc6d826b9182 100644 --- a/svx/inc/svx/xtable.hxx +++ b/svx/inc/svx/xtable.hxx @@ -33,19 +33,16 @@ #include <tools/color.hxx> #include <tools/string.hxx> #include <tools/table.hxx> -#include "svx/svxdllapi.h" +#include <svx/svxdllapi.h> #include <basegfx/polygon/b2dpolypolygon.hxx> #include <svtools/grfmgr.hxx> +#include <svx/XPropertyEntry.hxx> class Color; class Bitmap; class VirtualDevice; class XOutdevItemPool; -// Breite und Hoehe der LB-Bitmaps -#define BITMAP_WIDTH 32 -#define BITMAP_HEIGHT 12 - // Standard-Vergleichsstring extern sal_Unicode __FAR_DATA pszStandard[]; // "standard" @@ -53,24 +50,6 @@ extern sal_Unicode __FAR_DATA pszStandard[]; // "standard" // enum COL_NAME nicht verglichen werden kann. SVX_DLLPUBLIC Color RGB_Color( ColorData nColorName ); -// --------------------- -// class XPropertyEntry -// --------------------- - -class XPropertyEntry -{ -protected: - String aName; - - XPropertyEntry(const String& rName) : aName(rName) {} - XPropertyEntry(const XPropertyEntry& rOther): aName(rOther.aName) {} -public: - - virtual ~XPropertyEntry() {} - void SetName(const String& rName) { aName = rName; } - String& GetName() { return aName; } -}; - // ------------------ // class XColorEntry // ------------------ @@ -206,59 +185,6 @@ public: } }; -// --------------------- -// class XPropertyTable -// --------------------- - -class SVX_DLLPUBLIC XPropertyTable -{ -protected: - String aName; // nicht persistent ! - String aPath; - XOutdevItemPool* pXPool; - - Table aTable; - Table* pBmpTable; - - sal_Bool bTableDirty; - sal_Bool bBitmapsDirty; - sal_Bool bOwnPool; - - XPropertyTable( const String& rPath, - XOutdevItemPool* pXPool = NULL, - sal_uInt16 nInitSize = 16, - sal_uInt16 nReSize = 16 ); - XPropertyTable( SvStream& rIn ); - void Clear(); - -public: - virtual ~XPropertyTable(); - - long Count() const; - - sal_Bool Insert(long nIndex, XPropertyEntry* pEntry); - XPropertyEntry* Replace(long nIndex, XPropertyEntry* pEntry); - XPropertyEntry* Remove(long nIndex, sal_uInt16 nDummy); - XPropertyEntry* Get( long nIndex, sal_uInt16 nDummy ) const; - - long Get(const String& rName); - Bitmap* GetBitmap( long nIndex ) const; - - const String& GetName() const { return aName; } - void SetName( const String& rString ); - const String& GetPath() const { return aPath; } - void SetPath( const String& rString ) { aPath = rString; } - sal_Bool IsDirty() const { return bTableDirty && bBitmapsDirty; } - void SetDirty( sal_Bool bDirty = sal_True ) - { bTableDirty = bDirty; bBitmapsDirty = bDirty; } - - virtual sal_Bool Load() = 0; - virtual sal_Bool Save() = 0; - virtual sal_Bool Create() = 0; - virtual sal_Bool CreateBitmapsForUI() = 0; - virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True ) = 0; -}; - // -------------------- // class XPropertyList // -------------------- @@ -266,23 +192,18 @@ public: class SVX_DLLPUBLIC XPropertyList { protected: - String aName; // nicht persistent ! - String aPath; - XOutdevItemPool* pXPool; - - List aList; - List* pBmpList; - - sal_Bool bListDirty; - sal_Bool bBitmapsDirty; - sal_Bool bOwnPool; - - XPropertyList( const String& rPath, - XOutdevItemPool* pXPool = NULL, - sal_uInt16 nInitSize = 16, - sal_uInt16 nReSize = 16 ); - XPropertyList( SvStream& rIn ); + String maName; // nicht persistent ! + String maPath; + XOutdevItemPool* mpXPool; + + List maList; + + /// bitfield + bool mbListDirty : 1; + + XPropertyList( const String& rPath, XOutdevItemPool* pXPool = 0 ); void Clear(); + virtual Bitmap CreateBitmapForUI( long nIndex ) = 0; public: virtual ~XPropertyList(); @@ -295,63 +216,35 @@ public: XPropertyEntry* Get( long nIndex, sal_uInt16 nDummy ) const; long Get(const String& rName); - Bitmap* GetBitmap( long nIndex ) const; + Bitmap GetUiBitmap( long nIndex ) const; - const String& GetName() const { return aName; } + const String& GetName() const { return maName; } void SetName( const String& rString ); - const String& GetPath() const { return aPath; } - void SetPath( const String& rString ) { aPath = rString; } - sal_Bool IsDirty() const { return bListDirty && bBitmapsDirty; } - void SetDirty( sal_Bool bDirty = sal_True ) - { bListDirty = bDirty; bBitmapsDirty = bDirty; } + const String& GetPath() const { return maPath; } + void SetPath( const String& rString ) { maPath = rString; } + bool IsDirty() const { return mbListDirty; } + void SetDirty( bool bDirty = true ) { mbListDirty = bDirty; } virtual sal_Bool Load() = 0; virtual sal_Bool Save() = 0; virtual sal_Bool Create() = 0; - virtual sal_Bool CreateBitmapsForUI() = 0; - virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True ) = 0; -}; - -// ------------------ -// class XColorTable -// ------------------ - -class SVX_DLLPUBLIC XColorTable : public XPropertyTable -{ -public: - XColorTable( const String& rPath, - XOutdevItemPool* pXPool = NULL, - sal_uInt16 nInitSize = 16, - sal_uInt16 nReSize = 16 ); - virtual ~XColorTable(); - - using XPropertyTable::Replace; - XColorEntry* Replace(long nIndex, XColorEntry* pEntry ); - using XPropertyTable::Remove; - XColorEntry* Remove(long nIndex); - using XPropertyTable::Get; - XColorEntry* GetColor(long nIndex) const; - virtual sal_Bool Load(); - virtual sal_Bool Save(); - virtual sal_Bool Create(); - virtual sal_Bool CreateBitmapsForUI(); - virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True ); - - static XColorTable* GetStdColorTable(); + sal_uInt32 getUiBitmapWidth() const; + sal_uInt32 getUiBitmapHeight() const; + sal_uInt32 getUiBitmapLineWidth() const; }; // ------------------- // class XColorList // ------------------- -class XColorList : public XPropertyList +class SVX_DLLPUBLIC XColorList : public XPropertyList { +protected: + virtual Bitmap CreateBitmapForUI( long nIndex ); + public: - XColorList( const String& rPath, - XOutdevItemPool* pXPool = NULL, - sal_uInt16 nInitSize = 16, - sal_uInt16 nReSize = 16 ); + XColorList( const String& rPath, XOutdevItemPool* pXPool = 0 ); virtual ~XColorList(); using XPropertyList::Replace; @@ -364,35 +257,8 @@ public: virtual sal_Bool Load(); virtual sal_Bool Save(); virtual sal_Bool Create(); - virtual sal_Bool CreateBitmapsForUI(); - virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True ); -}; -// -------------------- -// class XLineEndTable -// -------------------- - -class XLineEndTable : public XPropertyTable -{ -public: - XLineEndTable( const String& rPath, - XOutdevItemPool* pXPool = NULL, - sal_uInt16 nInitSize = 16, - sal_uInt16 nReSize = 16 ); - virtual ~XLineEndTable(); - - using XPropertyTable::Replace; - XLineEndEntry* Replace(long nIndex, XLineEndEntry* pEntry ); - using XPropertyTable::Remove; - XLineEndEntry* Remove(long nIndex); - using XPropertyTable::Get; - XLineEndEntry* GetLineEnd(long nIndex) const; - - virtual sal_Bool Load(); - virtual sal_Bool Save(); - virtual sal_Bool Create(); - virtual sal_Bool CreateBitmapsForUI(); - virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True ); + static XColorList* GetStdColorList(); }; // ------------------- @@ -408,8 +274,11 @@ private: void impCreate(); void impDestroy(); +protected: + virtual Bitmap CreateBitmapForUI(long nIndex); + public: - XLineEndList(const String& rPath, XOutdevItemPool* pXPool = 0, sal_uInt16 nInitSize = 16, sal_uInt16 nReSize = 16); + XLineEndList(const String& rPath, XOutdevItemPool* pXPool = 0); virtual ~XLineEndList(); using XPropertyList::Replace; @@ -422,35 +291,6 @@ public: virtual sal_Bool Load(); virtual sal_Bool Save(); virtual sal_Bool Create(); - virtual sal_Bool CreateBitmapsForUI(); - virtual Bitmap* CreateBitmapForUI(long nIndex, sal_Bool bDelete = sal_True); -}; - -// -------------------- -// class XDashTable -// -------------------- - -class XDashTable : public XPropertyTable -{ -public: - XDashTable( const String& rPath, - XOutdevItemPool* pXPool = NULL, - sal_uInt16 nInitSize = 16, - sal_uInt16 nReSize = 16 ); - virtual ~XDashTable(); - - using XPropertyTable::Replace; - XDashEntry* Replace(long nIndex, XDashEntry* pEntry ); - using XPropertyTable::Remove; - XDashEntry* Remove(long nIndex); - using XPropertyTable::Get; - XDashEntry* GetDash(long nIndex) const; - - virtual sal_Bool Load(); - virtual sal_Bool Save(); - virtual sal_Bool Create(); - virtual sal_Bool CreateBitmapsForUI(); - virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True ); }; // ------------------- @@ -462,12 +302,19 @@ class SVX_DLLPUBLIC XDashList : public XPropertyList { private: impXDashList* mpData; + Bitmap maBitmapSolidLine; + String maStringSolidLine; + String maStringNoLine; void impCreate(); void impDestroy(); +protected: + Bitmap ImpCreateBitmapForXDash(const XDash* pDash); + virtual Bitmap CreateBitmapForUI(long nIndex); + public: - XDashList(const String& rPath, XOutdevItemPool* pXPool = 0, sal_uInt16 nInitSize = 16, sal_uInt16 nReSize = 16); + XDashList(const String& rPath, XOutdevItemPool* pXPool = 0); virtual ~XDashList(); using XPropertyList::Replace; @@ -480,35 +327,16 @@ public: virtual sal_Bool Load(); virtual sal_Bool Save(); virtual sal_Bool Create(); - virtual sal_Bool CreateBitmapsForUI(); - virtual Bitmap* CreateBitmapForUI(long nIndex, sal_Bool bDelete = sal_True); -}; - -// -------------------- -// class XHatchTable -// -------------------- -class XHatchTable : public XPropertyTable -{ -public: - XHatchTable( const String& rPath, - XOutdevItemPool* pXPool = NULL, - sal_uInt16 nInitSize = 16, - sal_uInt16 nReSize = 16 ); - virtual ~XHatchTable(); - - using XPropertyTable::Replace; - XHatchEntry* Replace(long nIndex, XHatchEntry* pEntry ); - using XPropertyTable::Remove; - XHatchEntry* Remove(long nIndex); - using XPropertyTable::Get; - XHatchEntry* GetHatch(long nIndex) const; + // Special call to get a bitmap for the solid line representation. It + // creates a bitmap fitting in size and style to the ones you get by + // using GetUiBitmap for existing entries. + Bitmap GetBitmapForUISolidLine() const; - virtual sal_Bool Load(); - virtual sal_Bool Save(); - virtual sal_Bool Create(); - virtual sal_Bool CreateBitmapsForUI(); - virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True ); + // Special calls to get the translated strings for the UI entry for no + // line style (XLINE_NONE) and solid line style (XLINE_SOLID) for dialogs + String GetStringForUiSolidLine() const; + String GetStringForUiNoLine() const; }; // ------------------- @@ -524,8 +352,11 @@ private: void impCreate(); void impDestroy(); +protected: + virtual Bitmap CreateBitmapForUI(long nIndex); + public: - XHatchList(const String& rPath, XOutdevItemPool* pXPool = 0, sal_uInt16 nInitSize = 16, sal_uInt16 nReSize = 16); + XHatchList(const String& rPath, XOutdevItemPool* pXPool = 0); ~XHatchList(); using XPropertyList::Replace; @@ -538,35 +369,6 @@ public: virtual sal_Bool Load(); virtual sal_Bool Save(); virtual sal_Bool Create(); - virtual sal_Bool CreateBitmapsForUI(); - virtual Bitmap* CreateBitmapForUI(long nIndex, sal_Bool bDelete = sal_True); -}; - -// --------------------- -// class XGradientTable -// --------------------- - -class XGradientTable : public XPropertyTable -{ -public: - XGradientTable( const String& rPath, - XOutdevItemPool* pXPool = NULL, - sal_uInt16 nInitSize = 16, - sal_uInt16 nReSize = 16 ); - virtual ~XGradientTable(); - - using XPropertyTable::Replace; - XGradientEntry* Replace(long nIndex, XGradientEntry* pEntry ); - using XPropertyTable::Remove; - XGradientEntry* Remove(long nIndex); - using XPropertyTable::Get; - XGradientEntry* GetGradient(long nIndex) const; - - virtual sal_Bool Load(); - virtual sal_Bool Save(); - virtual sal_Bool Create(); - virtual sal_Bool CreateBitmapsForUI(); - virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True ); }; // ------------------- @@ -582,8 +384,11 @@ private: void impCreate(); void impDestroy(); +protected: + virtual Bitmap CreateBitmapForUI(long nIndex); + public: - XGradientList(const String& rPath, XOutdevItemPool* pXPool = 0, sal_uInt16 nInitSize = 16, sal_uInt16 nReSize = 16); + XGradientList(const String& rPath, XOutdevItemPool* pXPool = 0); virtual ~XGradientList(); using XPropertyList::Replace; @@ -596,35 +401,6 @@ public: virtual sal_Bool Load(); virtual sal_Bool Save(); virtual sal_Bool Create(); - virtual sal_Bool CreateBitmapsForUI(); - virtual Bitmap* CreateBitmapForUI(long nIndex, sal_Bool bDelete = sal_True); -}; - -// --------------------- -// class XBitmapTable -// --------------------- - -class XBitmapTable : public XPropertyTable -{ -public: - XBitmapTable( const String& rPath, - XOutdevItemPool* pXPool = NULL, - sal_uInt16 nInitSize = 16, - sal_uInt16 nReSize = 16 ); - virtual ~XBitmapTable(); - - using XPropertyTable::Replace; - XBitmapEntry* Replace(long nIndex, XBitmapEntry* pEntry ); - using XPropertyTable::Remove; - XBitmapEntry* Remove(long nIndex); - using XPropertyTable::Get; - XBitmapEntry* GetBitmap(long nIndex) const; - - virtual sal_Bool Load(); - virtual sal_Bool Save(); - virtual sal_Bool Create(); - virtual sal_Bool CreateBitmapsForUI(); - virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True ); }; // ------------------- @@ -633,11 +409,11 @@ public: class SVX_DLLPUBLIC XBitmapList : public XPropertyList { +protected: + virtual Bitmap CreateBitmapForUI( long nIndex ); + public: - XBitmapList( const String& rPath, - XOutdevItemPool* pXPool = NULL, - sal_uInt16 nInitSize = 16, - sal_uInt16 nReSize = 16 ); + XBitmapList( const String& rPath, XOutdevItemPool* pXPool = 0); virtual ~XBitmapList(); using XPropertyList::Replace; @@ -650,8 +426,8 @@ public: virtual sal_Bool Load(); virtual sal_Bool Save(); virtual sal_Bool Create(); - virtual sal_Bool CreateBitmapsForUI(); - virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True ); }; #endif // _XTABLE_HXX + +// eof diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi index 6402ebc0bad3..20b0952f1f90 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -3883,6 +3883,30 @@ SfxVoidItem FontDialog SID_CHAR_DLG GroupId = GID_FORMAT; ] +SfxVoidItem FontDialogEff SID_CHAR_DLG_EFFECT +() +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = TRUE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerItem; + Asynchron; + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_FORMAT; +] + //-------------------------------------------------------------------------- SvxFontHeightItem FontHeight SID_ATTR_CHAR_FONTHEIGHT @@ -4288,6 +4312,55 @@ XFormTextStyleItem FontWorkTextStyle SID_FORMTEXT_STYLE GroupId = GID_SPECIAL; ] +SvxLRSpaceItem ParaOutlineLeft SID_ATTR_PARA_LEFT + +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = TRUE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_VIEW; +] + +//-------------------------------------------------------------------------- +SvxLRSpaceItem ParaOutlineRight SID_ATTR_PARA_RIGHT +() +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = TRUE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_VIEW; +] + //-------------------------------------------------------------------------- SfxVoidItem FormatArea SID_ATTRIBUTES_AREA () @@ -6330,6 +6403,63 @@ SfxVoidItem DefaultNumbering FN_NUM_NUMBERING_ON GroupId = GID_ENUMERATION; ] +SfxBoolItem CurrentBulNumRule FN_BUL_NUM_RULE_INDEX +(SfxUInt16Item On FN_PARAM_1) +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = TRUE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + ImageRotation = TRUE; + ImageReflection = TRUE; + /* status: */ + SlotType = SfxBoolItem + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_ENUMERATION; +] +SfxBoolItem CurrentNumNumRule FN_NUM_NUM_RULE_INDEX +(SfxUInt16Item On FN_PARAM_1) +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = TRUE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + ImageRotation = TRUE; + ImageReflection = TRUE; + /* status: */ + SlotType = SfxBoolItem + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_ENUMERATION; +] + //-------------------------------------------------------------------------- SfxVoidItem InsertObject SID_INSERT_OBJECT ( SfxGlobalNameItem ClassId SID_INSERT_OBJECT ) @@ -7201,6 +7331,32 @@ SvxLineSpacingItem LineSpacing SID_ATTR_PARA_LINESPACE GroupId = GID_FORMAT; ] +SvxULSpaceItem ULSpacing SID_ATTR_PARA_ULSPACE + +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_FORMAT; +] + //-------------------------------------------------------------------------- SvxLineItem LineStyle SID_FRAME_LINESTYLE @@ -7654,6 +7810,57 @@ SfxVoidItem OutlineBullet SID_OUTLINE_BULLET GroupId = GID_FORMAT; ] +SfxUInt16Item SetNumber FN_SVX_SET_NUMBER +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_SPECIAL; +] + +//-------------------------------------------------------------------------- +SfxUInt16Item SetBullet FN_SVX_SET_BULLET +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_SPECIAL; +] + //-------------------------------------------------------------------------- SfxVoidItem OutlineCollapse SID_OUTLINE_COLLAPSE () @@ -15105,3 +15312,669 @@ SfxVoidItem PrepareMailExport SID_MAIL_PREPAREEXPORT GroupId = GID_EXPLORER; ] +//-------------------------------------------------------------------------- + +SfxUInt16Item FillTransparence SID_ATTR_FILL_TRANSPARENCE +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_FORMAT; +] + +//-------------------------------------------------------------------------- + +XFillFloatTransparenceItem FillFloatTransparence SID_ATTR_FILL_FLOATTRANSPARENCE +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_FORMAT; +] + +//-------------------------------------------------------------------------- + +SfxUInt16Item LineTransparence SID_ATTR_LINE_TRANSPARENCE +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_FORMAT; +] + +//-------------------------------------------------------------------------- + + +//-------------------------------------------------------------------------- + +XLineJointItem LineJoint SID_ATTR_LINE_JOINT +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_FORMAT; +] + +//-------------------------------------------------------------------------- + +XLineCapItem LineCap SID_ATTR_LINE_CAP +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_FORMAT; +] + +//-------------------------------------------------------------------------- + +XLineStartItem LineStart SID_ATTR_LINE_START +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_FORMAT; +] + +//-------------------------------------------------------------------------- + +XLineEndItem LineEnd SID_ATTR_LINE_END +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_FORMAT; +] + +//-------------------------------------------------------------------------- + +SfxUInt32Item SvxTransFormPosX SID_ATTR_TRANSFORM_POS_X +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_SPECIAL; +] + +//-------------------------------------------------------------------------- + +SfxUInt32Item SvxTransFormPosY SID_ATTR_TRANSFORM_POS_Y +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_SPECIAL; +] + +//-------------------------------------------------------------------------- + +SfxUInt32Item SvxTransFormWidth SID_ATTR_TRANSFORM_WIDTH +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_SPECIAL; +] + +//-------------------------------------------------------------------------- + +SfxUInt32Item SvxTransFormHeight SID_ATTR_TRANSFORM_HEIGHT +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_SPECIAL; +] + +//-------------------------------------------------------------------------- + +SfxUInt32Item TransAngle SID_ATTR_TRANSFORM_ANGLE +[ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_FORMAT; +] + +//-------------------------------------------------------------------------- + +SfxUInt32Item TransRotX SID_ATTR_TRANSFORM_ROT_X +[ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_FORMAT; +] + +//-------------------------------------------------------------------------- + +SfxUInt32Item TransRotY SID_ATTR_TRANSFORM_ROT_Y +[ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_FORMAT; +] + +//-------------------------------------------------------------------------- + +SfxBoolItem ProtectPos SID_ATTR_TRANSFORM_PROTECT_POS +[ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_FORMAT; +] + +//-------------------------------------------------------------------------- + +SfxBoolItem ProtectSize SID_ATTR_TRANSFORM_PROTECT_SIZE +[ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_FORMAT; +] + +//-------------------------------------------------------------------------- + +SfxVoidItem SvxFlipHorizontal SID_FLIP_HORIZONTAL +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_EDIT; +] + +//-------------------------------------------------------------------------- + +SfxVoidItem SvxFlipVertical SID_FLIP_VERTICAL +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_EDIT; +] + +//-------------------------------------------------------------------------- + +SfxBoolItem SvxAutoWidth SID_ATTR_TRANSFORM_AUTOWIDTH +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_EDIT; +] + +//-------------------------------------------------------------------------- + +SfxVoidItem SvxFlipVertical SID_FLIP_VERTICAL +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_EDIT; +] + +//-------------------------------------------------------------------------- + +SfxBoolItem SvxAutoWidth SID_ATTR_TRANSFORM_AUTOWIDTH +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_SPECIAL; +] + +//-------------------------------------------------------------------------- + +SfxBoolItem SvxAutoHeight SID_ATTR_TRANSFORM_AUTOHEIGHT +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_SPECIAL; +] + +//---------------------------------------------------------------------- +SvxLineItem BorderTLBR SID_ATTR_BORDER_DIAG_TLBR +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_FORMAT; +] + +SvxLineItem BorderBLTR SID_ATTR_BORDER_DIAG_BLTR +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_FORMAT; +] + +//-------------------------------------------------------------------------- + +SfxVoidItem SCDialogBorder SID_CELL_FORMAT_BORDER +() +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = TRUE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerItem; + Asynchron; + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_FORMAT; +] + +//-------------------------------------------------------------------------- +// eof diff --git a/svx/sdi/xoitems.sdi b/svx/sdi/xoitems.sdi index 18b3db64a895..67572c27c6e0 100644 --- a/svx/sdi/xoitems.sdi +++ b/svx/sdi/xoitems.sdi @@ -142,6 +142,28 @@ enum SvxLineStyle item SvxLineStyle XLineStyleItem; +enum SvxLineJoint +{ + // com::sun::star::drawing::LineJoint + SVX_LINEJOINT_NONE, // no rounding + SVX_LINEJOINT_MIDDLE, // calc middle value between joints + SVX_LINEJOINT_BEVEL, // join edges with line + SVX_LINEJOINT_MITER, // extend till cut + SVX_LINEJOINT_ROUND // create arc +}; + +item SvxLineJoint XLineJointItem; + +enum SvxLineCap +{ + // com::sun::star::drawing::LineCap + SVX_LINECAP_BUTT, + SVX_LINECAP_ROUND, + SVX_LINECAP_SQUARE +}; + +item SvxLineCap XLineCapItem; + item INT32 XLineWidthItem; item INT32 XFormTextStyleItem; item INT32 XFormTextAdjustItem; @@ -156,3 +178,7 @@ item INT32 XFormTextShadowItem; // SfxEnumItem item INT32 XFormTextShadowColorItem; // XColorItem item INT32 XFormTextShadowXValItem; // SfxMetricItem/SfxInt32Item item INT32 XFormTextShadowYValItem; // SfxMetricItem/SfxInt32Item + +item XFillGradient XFillFloatTransparenceItem; // XFillGradient + +// eof diff --git a/svx/source/dialog/_bmpmask.cxx b/svx/source/dialog/_bmpmask.cxx index 73484ed512d6..da13a0d96c01 100644 --- a/svx/source/dialog/_bmpmask.cxx +++ b/svx/source/dialog/_bmpmask.cxx @@ -605,7 +605,7 @@ sal_Bool SvxBmpMask::NeedsColorTable() const //------------------------------------------------------------------------- -void SvxBmpMask::SetColorTable( const XColorTable* pTable ) +void SvxBmpMask::SetColorTable( const XColorList* pTable ) { if ( pTable && ( pTable != pColTab ) ) { diff --git a/svx/source/dialog/dialcontrol.cxx b/svx/source/dialog/dialcontrol.cxx index 0f88b1c1c201..782ddef27dc2 100644 --- a/svx/source/dialog/dialcontrol.cxx +++ b/svx/source/dialog/dialcontrol.cxx @@ -24,7 +24,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" #include "svx/dialcontrol.hxx" - +#include "bmpmask.hrc" +#include <svx/dialmgr.hxx> +#include <tools/rcid.h> #include <math.h> #include <vcl/virdev.hxx> #include <vcl/svapp.hxx> @@ -40,39 +42,13 @@ const long DIAL_OUTER_WIDTH = 8; // ============================================================================ -class DialControlBmp : public VirtualDevice -{ -public: - explicit DialControlBmp( Window& rParent ); - - void InitBitmap( const Size& rSize, const Font& rFont ); - void CopyBackground( const DialControlBmp& rSrc ); - void DrawBackground( const Size& rSize, bool bEnabled ); - void DrawElements( const String& rText, sal_Int32 nAngle ); - -private: - const Color& GetBackgroundColor() const; - const Color& GetTextColor() const; - const Color& GetScaleLineColor() const; - const Color& GetButtonLineColor() const; - const Color& GetButtonFillColor( bool bMain ) const; - - void Init( const Size& rSize ); - void DrawBackground(); - - Window& mrParent; - Rectangle maRect; - long mnCenterX; - long mnCenterY; - bool mbEnabled; -}; // ---------------------------------------------------------------------------- DialControlBmp::DialControlBmp( Window& rParent ) : VirtualDevice( rParent, 0, 0 ), - mrParent( rParent ), - mbEnabled( true ) + mbEnabled( true ), + mrParent( rParent ) { EnableRTL( sal_False ); } @@ -232,40 +208,23 @@ void DialControlBmp::DrawBackground() maRect.Right() - DIAL_OUTER_WIDTH, maRect.Bottom() - DIAL_OUTER_WIDTH ) ); } -// ============================================================================ -struct DialControl_Impl -{ - DialControlBmp maBmpEnabled; - DialControlBmp maBmpDisabled; - DialControlBmp maBmpBuffered; - Link maModifyHdl; - NumericField* mpLinkField; - Size maWinSize; - Font maWinFont; - sal_Int32 mnAngle; - sal_Int32 mnOldAngle; - long mnCenterX; - long mnCenterY; - bool mbNoRot; - - explicit DialControl_Impl( Window& rParent ); - void Init( const Size& rWinSize, const Font& rWinFont ); -}; + // ---------------------------------------------------------------------------- -DialControl_Impl::DialControl_Impl( Window& rParent ) : - maBmpEnabled( rParent ), - maBmpDisabled( rParent ), - maBmpBuffered( rParent ), +DialControl::DialControl_Impl::DialControl_Impl ( + Window& rParent ) : + mpBmpEnabled(new DialControlBmp(rParent)), + mpBmpDisabled(new DialControlBmp(rParent)), + mpBmpBuffered(new DialControlBmp(rParent)), mpLinkField( 0 ), mnAngle( 0 ), mbNoRot( false ) { } -void DialControl_Impl::Init( const Size& rWinSize, const Font& rWinFont ) +void DialControl::DialControl_Impl::Init( const Size& rWinSize, const Font& rWinFont ) { // "(x - 1) | 1" creates odd value <= x, to have a well-defined center pixel position maWinSize = Size( (rWinSize.Width() - 1) | 1, (rWinSize.Height() - 1) | 1 ); @@ -275,9 +234,9 @@ void DialControl_Impl::Init( const Size& rWinSize, const Font& rWinFont ) mnCenterY = maWinSize.Height() / 2; maWinFont.SetTransparent( sal_True ); - maBmpEnabled.DrawBackground( maWinSize, true ); - maBmpDisabled.DrawBackground( maWinSize, false ); - maBmpBuffered.InitBitmap( maWinSize, maWinFont ); + mpBmpEnabled->DrawBackground( maWinSize, true ); + mpBmpDisabled->DrawBackground( maWinSize, false ); + mpBmpBuffered->InitBitmap( maWinSize, maWinFont ); } // ============================================================================ @@ -313,7 +272,7 @@ DialControl::~DialControl() void DialControl::Paint( const Rectangle& ) { Point aPos; - DrawBitmapEx( aPos, mpImpl->maBmpBuffered.GetBitmapEx( aPos, mpImpl->maWinSize ) ); + DrawBitmapEx( aPos, mpImpl->mpBmpBuffered->GetBitmapEx( aPos, mpImpl->maWinSize ) ); } void DialControl::StateChanged( StateChangedType nStateChange ) @@ -414,7 +373,7 @@ sal_Int32 DialControl::GetRotation() const void DialControl::SetRotation( sal_Int32 nAngle ) { - ImplSetRotation( nAngle, false ); + SetRotation( nAngle, false ); } void DialControl::SetLinkedField( NumericField* pField ) @@ -461,13 +420,13 @@ void DialControl::Init( const Size& rWinSize ) void DialControl::InvalidateControl() { - mpImpl->maBmpBuffered.CopyBackground( IsEnabled() ? mpImpl->maBmpEnabled : mpImpl->maBmpDisabled ); + mpImpl->mpBmpBuffered->CopyBackground( IsEnabled() ? *mpImpl->mpBmpEnabled : *mpImpl->mpBmpDisabled ); if( !mpImpl->mbNoRot ) - mpImpl->maBmpBuffered.DrawElements( GetText(), mpImpl->mnAngle ); + mpImpl->mpBmpBuffered->DrawElements( GetText(), mpImpl->mnAngle ); Invalidate(); } -void DialControl::ImplSetRotation( sal_Int32 nAngle, bool bBroadcast ) +void DialControl::SetRotation( sal_Int32 nAngle, bool bBroadcast ) { bool bOldSel = mpImpl->mbNoRot; mpImpl->mbNoRot = false; @@ -512,7 +471,7 @@ void DialControl::HandleMouseEvent( const Point& rPos, bool bInitial ) nAngle = 36000 - nAngle; if( bInitial ) // round to entire 15 degrees nAngle = ((nAngle + 750) / 1500) * 1500; - ImplSetRotation( nAngle, true ); + SetRotation( nAngle, true ); } } @@ -521,7 +480,7 @@ void DialControl::HandleEscapeEvent() if( IsMouseCaptured() ) { ReleaseMouse(); - ImplSetRotation( mpImpl->mnOldAngle, true ); + SetRotation( mpImpl->mnOldAngle, true ); if( mpImpl->mpLinkField ) mpImpl->mpLinkField->GrabFocus(); } @@ -530,7 +489,7 @@ void DialControl::HandleEscapeEvent() IMPL_LINK( DialControl, LinkedFieldModifyHdl, NumericField*, pField ) { if( pField ) - ImplSetRotation( static_cast< sal_Int32 >( pField->GetValue() * 100 ), false ); + SetRotation( static_cast< sal_Int32 >( pField->GetValue() * 100 ), false ); return 0; } diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx index efa5f3f85b4b..597ecc2f9d50 100644 --- a/svx/source/dialog/dlgctrl.cxx +++ b/svx/source/dialog/dlgctrl.cxx @@ -47,7 +47,6 @@ #include <svx/svdopath.hxx> #include <svx/sdr/contact/objectcontactofobjlistpainter.hxx> #include <svx/sdr/contact/displayinfo.hxx> -#include <linectrl.hrc> #include <vcl/bmpacc.hxx> #include <svx/xbtmpit.hxx> @@ -1095,7 +1094,7 @@ BitmapEx SvxBitmapCtl::GetBitmapEx() |* \************************************************************************/ -void ColorLB::Fill( const XColorTable* pColorTab ) +void ColorLB::Fill( const XColorList* pColorTab ) { long nCount = pColorTab->Count(); XColorEntry* pEntry; @@ -1130,7 +1129,7 @@ void ColorLB::Modify( XColorEntry* pEntry, sal_uInt16 nPos, Bitmap* ) |* \************************************************************************/ -void FillAttrLB::Fill( const XColorTable* pColorTab ) +void FillAttrLB::Fill( const XColorList* pColorTab ) { long nCount = pColorTab->Count(); XColorEntry* pEntry; @@ -1184,9 +1183,9 @@ void HatchingLB::Fill( const XHatchList* pList ) for( long i = 0; i < nCount; i++ ) { pEntry = pList->GetHatch( i ); - Bitmap* pBitmap = pList->GetBitmap( i ); - if( pBitmap ) - InsertEntry( pEntry->GetName(), *pBitmap ); + const Bitmap aBitmap = pList->GetUiBitmap( i ); + if( !aBitmap.IsEmpty() ) + InsertEntry( pEntry->GetName(), aBitmap ); else InsertEntry( pEntry->GetName() ); } @@ -1294,9 +1293,9 @@ void FillAttrLB::Fill( const XHatchList* pList ) for( long i = 0; i < nCount; i++ ) { pEntry = pList->GetHatch( i ); - Bitmap* pBitmap = pList->GetBitmap( i ); - if( pBitmap ) - ListBox::InsertEntry( pEntry->GetName(), *pBitmap ); + const Bitmap aBitmap = pList->GetUiBitmap( i ); + if( !aBitmap.IsEmpty() ) + ListBox::InsertEntry( pEntry->GetName(), aBitmap ); else InsertEntry( pEntry->GetName() ); } @@ -1343,9 +1342,9 @@ void GradientLB::Fill( const XGradientList* pList ) for( long i = 0; i < nCount; i++ ) { pEntry = pList->GetGradient( i ); - Bitmap* pBitmap = pList->GetBitmap( i ); - if( pBitmap ) - InsertEntry( pEntry->GetName(), *pBitmap ); + const Bitmap aBitmap = pList->GetUiBitmap( i ); + if( !aBitmap.IsEmpty() ) + InsertEntry( pEntry->GetName(), aBitmap ); else InsertEntry( pEntry->GetName() ); } @@ -1466,9 +1465,9 @@ void FillAttrLB::Fill( const XGradientList* pList ) for( long i = 0; i < nCount; i++ ) { pEntry = pList->GetGradient( i ); - Bitmap* pBitmap = pList->GetBitmap( i ); - if( pBitmap ) - ListBox::InsertEntry( pEntry->GetName(), *pBitmap ); + const Bitmap aBitmap = pList->GetUiBitmap( i ); + if( !aBitmap.IsEmpty() ) + ListBox::InsertEntry( pEntry->GetName(), aBitmap ); else InsertEntry( pEntry->GetName() ); } @@ -1488,28 +1487,32 @@ BitmapLB::BitmapLB(Window* pParent, ResId Id, bool bUserDraw /*= false*/ ) mpList(NULL), mbUserDraw(bUserDraw) { - maVD.SetOutputSizePixel(Size(32, 16)); EnableUserDraw(mbUserDraw); } /************************************************************************/ -void BitmapLB::SetVirtualDevice() +void BitmapLB::SetVirtualDevice(const Size& rSize) { + maVD.SetOutputSizePixel(rSize); + if(maBitmapEx.GetSizePixel().Width() > 8 || maBitmapEx.GetSizePixel().Height() > 8) { - maVD.DrawBitmapEx(Point(0, 0), Size(32, 16), maBitmapEx); + maVD.DrawBitmapEx(Point(0, 0), rSize, maBitmapEx); } else { - maVD.DrawBitmapEx(Point(0, 0), maBitmapEx); - maVD.DrawBitmapEx(Point(8, 0), maBitmapEx); - maVD.DrawBitmapEx(Point(16, 0), maBitmapEx); - maVD.DrawBitmapEx(Point(24, 0), maBitmapEx); - maVD.DrawBitmapEx(Point(0, 8), maBitmapEx); - maVD.DrawBitmapEx(Point(8, 8), maBitmapEx); - maVD.DrawBitmapEx(Point(16, 8), maBitmapEx); - maVD.DrawBitmapEx(Point(24, 8), maBitmapEx); + const Size aBitmapSize(maBitmapEx.GetSizePixel()); + + for(sal_uInt32 y(0); y < rSize.Height(); y += aBitmapSize.Height()) + { + for(sal_uInt32 x(0); x < rSize.Width(); x += aBitmapSize.Width()) + { + maVD.DrawBitmapEx( + Point(x, y), + maBitmapEx); + } + } } } @@ -1536,8 +1539,12 @@ void BitmapLB::Fill(const XBitmapList* pList) { pEntry = pList->GetBitmap(i); maBitmapEx = pEntry->GetGraphicObject().GetGraphic().GetBitmapEx(); - SetVirtualDevice(); - InsertEntry(pEntry->GetName(), maVD.GetBitmap(Point(0, 2), Size(32, 12))); + const Size aSize(pList->getUiBitmapWidth(), pList->getUiBitmapHeight()); + SetVirtualDevice(aSize); + InsertEntry( + pEntry->GetName(), + maVD.GetBitmap(Point(0, 0), + aSize)); } } @@ -1588,35 +1595,41 @@ void BitmapLB::UserDraw(const UserDrawEvent& rUDEvt) /************************************************************************/ -void BitmapLB::Append(XBitmapEntry* pEntry, BitmapEx* pBmpEx) +void BitmapLB::Append(const Size& rSize, const XBitmapEntry& rEntry, BitmapEx* pBmpEx) { if(pBmpEx) { - maBitmapEx = pEntry->GetGraphicObject().GetGraphic().GetBitmapEx(); - SetVirtualDevice(); - InsertEntry(pEntry->GetName(), maVD.GetBitmap(Point(0, 2), Size(32, 12))); + maBitmapEx = rEntry.GetGraphicObject().GetGraphic().GetBitmapEx(); + SetVirtualDevice(rSize); + InsertEntry( + rEntry.GetName(), + maVD.GetBitmap(Point(0, 0), + rSize)); } else { - InsertEntry(pEntry->GetName()); + InsertEntry(rEntry.GetName()); } } /************************************************************************/ -void BitmapLB::Modify(XBitmapEntry* pEntry, sal_uInt16 nPos, BitmapEx* pBmpEx) +void BitmapLB::Modify(const Size& rSize, const XBitmapEntry& rEntry, sal_uInt16 nPos, BitmapEx* pBmpEx) { RemoveEntry(nPos); if(pBmpEx) { - maBitmapEx = pEntry->GetGraphicObject().GetGraphic().GetBitmapEx(); - SetVirtualDevice(); - InsertEntry(pEntry->GetName(), maVD.GetBitmap(Point(0, 2), Size(32, 12)), nPos); + maBitmapEx = rEntry.GetGraphicObject().GetGraphic().GetBitmapEx(); + SetVirtualDevice(rSize); + InsertEntry( + rEntry.GetName(), + maVD.GetBitmap(Point(0, 0), rSize), + nPos); } else { - InsertEntry(pEntry->GetName()); + InsertEntry(rEntry.GetName()); } } @@ -1657,7 +1670,6 @@ FillAttrLB::FillAttrLB( Window* pParent, ResId Id ) maVD(), maBitmapEx() { - maVD.SetOutputSizePixel(Size(32, 16)); } /************************************************************************/ @@ -1665,29 +1677,32 @@ FillAttrLB::FillAttrLB( Window* pParent, ResId Id ) FillAttrLB::FillAttrLB(Window* pParent, WinBits aWB) : ColorListBox(pParent, aWB) { - maVD.SetOutputSizePixel(Size(32, 16)); } /************************************************************************/ -void FillAttrLB::SetVirtualDevice() +void FillAttrLB::SetVirtualDevice(const Size& rSize) { + maVD.SetOutputSizePixel(rSize); maVD.Erase(); if(maBitmapEx.GetSizePixel().Width() > 8 || maBitmapEx.GetSizePixel().Height() > 8) { - maVD.DrawBitmapEx(Point(0, 0), Size(32, 16), maBitmapEx); + maVD.DrawBitmapEx(Point(0, 0), rSize, maBitmapEx); } else { - maVD.DrawBitmapEx(Point(0, 0), maBitmapEx); - maVD.DrawBitmapEx(Point(8, 0), maBitmapEx); - maVD.DrawBitmapEx(Point(16, 0), maBitmapEx); - maVD.DrawBitmapEx(Point(24, 0), maBitmapEx); - maVD.DrawBitmapEx(Point(0, 8), maBitmapEx); - maVD.DrawBitmapEx(Point(8, 8), maBitmapEx); - maVD.DrawBitmapEx(Point(16, 8), maBitmapEx); - maVD.DrawBitmapEx(Point(24, 8), maBitmapEx); + const Size aBitmapSize(maBitmapEx.GetSizePixel()); + + for(sal_uInt32 y(0); y < rSize.Height(); y += aBitmapSize.Height()) + { + for(sal_uInt32 x(0); x < rSize.Width(); x += aBitmapSize.Width()) + { + maVD.DrawBitmapEx( + Point(x, y), + maBitmapEx); + } + } } } @@ -1704,8 +1719,12 @@ void FillAttrLB::Fill(const XBitmapList* pList) { pEntry = pList->GetBitmap( i ); maBitmapEx = pEntry->GetGraphicObject().GetGraphic().GetBitmapEx(); - SetVirtualDevice(); - ListBox::InsertEntry(pEntry->GetName(), maVD.GetBitmap(Point(0, 2), Size(32, 12))); + const Size aSize(pList->getUiBitmapWidth(), pList->getUiBitmapHeight()); + SetVirtualDevice(aSize); + ListBox::InsertEntry( + pEntry->GetName(), + maVD.GetBitmap(Point(0, 0), + aSize)); } ListBox::SetUpdateMode(true); @@ -1759,9 +1778,17 @@ void FillTypeLB::Fill() |* Fuellt die Listbox (vorlaeufig) mit Strings |* \************************************************************************/ - void LineLB::Fill( const XDashList* pList ) { + Clear(); + + // entry for 'none' + InsertEntry(pList->GetStringForUiNoLine()); + + // entry for solid line + InsertEntry(pList->GetStringForUiSolidLine(), pList->GetBitmapForUISolidLine()); + + // entries for dashed lines long nCount = pList->Count(); XDashEntry* pEntry; SetUpdateMode( sal_False ); @@ -1769,11 +1796,11 @@ void LineLB::Fill( const XDashList* pList ) for( long i = 0; i < nCount; i++ ) { pEntry = pList->GetDash( i ); - Bitmap* pBitmap = const_cast<XDashList*>(pList)->CreateBitmapForUI( i ); - if( pBitmap ) + const Bitmap aBitmap = const_cast< XDashList* >(pList)->GetUiBitmap( i ); + if( !aBitmap.IsEmpty() ) { - InsertEntry( pEntry->GetName(), *pBitmap ); - delete pBitmap; + InsertEntry( pEntry->GetName(), aBitmap ); + //delete pBitmap; } else InsertEntry( pEntry->GetName() ); @@ -1781,33 +1808,9 @@ void LineLB::Fill( const XDashList* pList ) SetUpdateMode( sal_True ); } -void LineLB::FillStyles() -{ - ResMgr& rMgr = DIALOG_MGR(); - - // Linienstile - Clear(); - InsertEntry( String( ResId( RID_SVXSTR_INVISIBLE, rMgr ) ) ); - - const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings(); - Bitmap aBitmap ( SVX_RES ( RID_SVXCTRL_LINECTRL ) ); - Color aSourceColors[2]; - Color aDestColors[2]; - - aSourceColors[0] = Color( COL_WHITE ); - aSourceColors[1] = Color( COL_BLACK ); - - aDestColors[0] = rStyles.GetFieldColor(); - aDestColors[1] = rStyles.GetFieldTextColor(); - - aBitmap.Replace ( aSourceColors, aDestColors, 2 ); - Image aSolidLine ( aBitmap ); - InsertEntry( String( ResId( RID_SVXSTR_SOLID, rMgr ) ), aSolidLine ); -} - /************************************************************************/ -void LineLB::Append( XDashEntry* pEntry, Bitmap* pBmp ) +void LineLB::Append( XDashEntry* pEntry, const Bitmap* pBmp ) { if( pBmp ) InsertEntry( pEntry->GetName(), *pBmp ); @@ -1817,7 +1820,7 @@ void LineLB::Append( XDashEntry* pEntry, Bitmap* pBmp ) /************************************************************************/ -void LineLB::Modify( XDashEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp ) +void LineLB::Modify( XDashEntry* pEntry, sal_uInt16 nPos, const Bitmap* pBmp ) { RemoveEntry( nPos ); @@ -1858,6 +1861,20 @@ void LineLB::SelectEntryByList( const XDashList* pList, const String& rStr, |* Fuellt die Listbox (vorlaeufig) mit Strings |* \************************************************************************/ +LineEndLB::LineEndLB( Window* pParent, ResId Id ) + : ListBox( pParent, Id ) +{ +} + +LineEndLB::LineEndLB( Window* pParent, WinBits aWB ) + : ListBox( pParent, aWB ) +{ +} + +LineEndLB::~LineEndLB(void) +{ +} + void LineEndLB::Fill( const XLineEndList* pList, sal_Bool bStart ) { @@ -1869,17 +1886,16 @@ void LineEndLB::Fill( const XLineEndList* pList, sal_Bool bStart ) for( long i = 0; i < nCount; i++ ) { pEntry = pList->GetLineEnd( i ); - Bitmap* pBitmap = const_cast<XLineEndList*>(pList)->CreateBitmapForUI( i ); - if( pBitmap ) + const Bitmap aBitmap = const_cast< XLineEndList* >(pList)->GetUiBitmap( i ); + if( !aBitmap.IsEmpty() ) { - Size aBmpSize( pBitmap->GetSizePixel() ); + Size aBmpSize( aBitmap.GetSizePixel() ); aVD.SetOutputSizePixel( aBmpSize, sal_False ); - aVD.DrawBitmap( Point(), *pBitmap ); + aVD.DrawBitmap( Point(), aBitmap ); InsertEntry( pEntry->GetName(), aVD.GetBitmap( bStart ? Point() : Point( aBmpSize.Width() / 2, 0 ), Size( aBmpSize.Width() / 2, aBmpSize.Height() ) ) ); - - delete pBitmap; + //delete pBitmap; } else InsertEntry( pEntry->GetName() ); @@ -1889,8 +1905,7 @@ void LineEndLB::Fill( const XLineEndList* pList, sal_Bool bStart ) /************************************************************************/ -void LineEndLB::Append( XLineEndEntry* pEntry, Bitmap* pBmp, - sal_Bool bStart ) +void LineEndLB::Append( XLineEndEntry* pEntry, const Bitmap* pBmp, sal_Bool bStart ) { if( pBmp ) { @@ -1909,8 +1924,7 @@ void LineEndLB::Append( XLineEndEntry* pEntry, Bitmap* pBmp, /************************************************************************/ -void LineEndLB::Modify( XLineEndEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp, - sal_Bool bStart ) +void LineEndLB::Modify( XLineEndEntry* pEntry, sal_uInt16 nPos, const Bitmap* pBmp, sal_Bool bStart ) { RemoveEntry( nPos ); diff --git a/svx/source/dialog/dlgutil.cxx b/svx/source/dialog/dlgutil.cxx index 6d72b7174f8e..dd05fb010711 100644 --- a/svx/source/dialog/dlgutil.cxx +++ b/svx/source/dialog/dlgutil.cxx @@ -48,3 +48,12 @@ FieldUnit GetModuleFieldUnit( const SfxItemSet& rSet ) return eUnit; } +// ----------------------------------------------------------------------- + +FieldUnit GetModuleFieldUnit() +{ + return SfxModule::GetCurrentFieldUnit(); +} + +// ----------------------------------------------------------------------- +// eof diff --git a/svx/source/dialog/fontwork.cxx b/svx/source/dialog/fontwork.cxx index 5e9264fc3c85..84cae7d15cd7 100644 --- a/svx/source/dialog/fontwork.cxx +++ b/svx/source/dialog/fontwork.cxx @@ -903,7 +903,7 @@ IMPL_LINK( SvxFontWorkDialog, ColorSelectHdl_Impl, void *, EMPTYARG ) |* \************************************************************************/ -void SvxFontWorkDialog::SetColorTable(const XColorTable* pTable) +void SvxFontWorkDialog::SetColorTable(const XColorList* pTable) { if ( pTable && pTable != pColorTable ) { diff --git a/svx/source/dialog/sdstring.src b/svx/source/dialog/sdstring.src index 319689163e73..ff27ca1f0aef 100644 --- a/svx/source/dialog/sdstring.src +++ b/svx/source/dialog/sdstring.src @@ -45,7 +45,7 @@ String RID_SVXSTR_LINESTYLE }; String RID_SVXSTR_INVISIBLE { - Text [ en-US ] = "Invisible" ; + Text [ en-US ] = "None" ; }; String RID_SVXSTR_COLOR { diff --git a/svx/source/dialog/svxbmpnumvalueset.src b/svx/source/dialog/svxbmpnumvalueset.src index 9832dbc4d2e9..482f06805448 100644 --- a/svx/source/dialog/svxbmpnumvalueset.src +++ b/svx/source/dialog/svxbmpnumvalueset.src @@ -57,7 +57,8 @@ String RID_SVXSTR_BULLET_DESCRIPTION_7 }; String RID_SVXSTR_SINGLENUM_DESCRIPTION_0 { - Text [en-US] = "Number 1) 2) 3)"; + //Text [en-US] = "Number 1) 2) 3)"; + Text [en-US] = "Number %NUMBERINGSAMPLE"; }; String RID_SVXSTR_SINGLENUM_DESCRIPTION_1 { diff --git a/svx/source/gallery2/GalleryControl.cxx b/svx/source/gallery2/GalleryControl.cxx new file mode 100644 index 000000000000..ac84b50c0240 --- /dev/null +++ b/svx/source/gallery2/GalleryControl.cxx @@ -0,0 +1,302 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "sidebar/PanelFactory.hxx" + +#include "GalleryControl.hxx" + +#include "gallery.hrc" +#include "svx/galmisc.hxx" +#include "svx/gallery1.hxx" +#include "galbrws1.hxx" +#include "galbrws2.hxx" +#include "GallerySplitter.hxx" +#include <vcl/svapp.hxx> +#include <sfx2/sidebar/Theme.hxx> + +#include <boost/bind.hpp> + +namespace svx { namespace sidebar { + +static const sal_Int32 gnInitialVerticalSplitPosition (150); + + +GalleryControl::GalleryControl ( + SfxBindings* pBindings, + Window* pParentWindow) + : Window(pParentWindow, GAL_RESID(RID_SVXDLG_GALLERYBROWSER)), + mpGallery (Gallery::GetGalleryInstance()), + mpBrowser1(new GalleryBrowser1( + this, + GAL_RESID(GALLERY_BROWSER1), + mpGallery, + ::boost::bind(&GalleryControl::KeyInput,this,_1,_2), + ::boost::bind(&GalleryControl::ThemeSelectionHasChanged, this))), + mpSplitter(new GallerySplitter( + this, + GAL_RESID(GALLERY_SPLITTER), + ::boost::bind(&GalleryControl::InitSettings, this))), + mpBrowser2(new GalleryBrowser2(this, GAL_RESID(GALLERY_BROWSER2), mpGallery)), + maLastSize(GetOutputSizePixel()), + mbIsInitialResize(true) +{ + FreeResource(); + + mpBrowser1->SelectTheme(0); + mpBrowser1->Show(sal_True); + + mpBrowser2->Show(sal_True); + + mpSplitter->SetHorizontal(false); + mpSplitter->SetSplitHdl( LINK( this, GalleryControl, SplitHdl ) ); + mpSplitter->Show( sal_True ); + + InitSettings(); +} + + + + +GalleryControl::~GalleryControl (void) +{ +} + + + + +void GalleryControl::InitSettings (void) +{ + SetBackground( Wallpaper( GALLERY_DLG_COLOR ) ); + SetControlBackground( GALLERY_DLG_COLOR ); + SetControlForeground( GALLERY_DLG_COLOR ); + + mpSplitter->SetBackground( Wallpaper( GALLERY_DLG_COLOR ) ); + mpSplitter->SetControlBackground( GALLERY_DLG_COLOR ); + mpSplitter->SetControlForeground( GALLERY_DLG_COLOR ); + + mpBrowser1->SetBackground( Wallpaper( GALLERY_DLG_COLOR ) ); + mpBrowser1->SetControlBackground( GALLERY_DLG_COLOR ); + mpBrowser1->SetControlForeground( GALLERY_DLG_COLOR ); + + mpBrowser2->SetBackground( Wallpaper( GALLERY_DLG_COLOR ) ); + mpBrowser2->SetControlBackground( GALLERY_DLG_COLOR ); + mpBrowser2->SetControlForeground( GALLERY_DLG_COLOR ); + + const Wallpaper aBackground (sfx2::sidebar::Theme::GetWallpaper(sfx2::sidebar::Theme::Paint_PanelBackground)); + mpSplitter->SetBackground(aBackground); + SetBackground(aBackground); + mpBrowser2->SetBackground(aBackground); +} + + + + +void GalleryControl::Resize (void) +{ + // call parent + Window::Resize(); + + // update hor/ver + const Size aNewSize( GetOutputSizePixel() ); + if (aNewSize.Width()<=0 || aNewSize.Height()<=0) + return; + + const bool bNewLayoutHorizontal(aNewSize.Width() > aNewSize.Height()); + const bool bOldLayoutHorizontal(mpSplitter->IsHorizontal()); + long nSplitPos( bOldLayoutHorizontal ? mpSplitter->GetPosPixel().X() : mpSplitter->GetPosPixel().Y()); + const long nSplitSize( bOldLayoutHorizontal ? mpSplitter->GetOutputSizePixel().Width() : mpSplitter->GetOutputSizePixel().Height()); + + if(bNewLayoutHorizontal != bOldLayoutHorizontal) + { + mpSplitter->SetHorizontal(bNewLayoutHorizontal); + } + else + { + if (mbIsInitialResize) + { + nSplitPos = gnInitialVerticalSplitPosition; + if (nSplitPos > aNewSize.Height()/2) + nSplitPos = aNewSize.Height()/2; + } + } + mbIsInitialResize = false; + + const long nFrameLen = LogicToPixel( Size( 3, 0 ), MAP_APPFONT ).Width(); + const long nFrameLen2 = nFrameLen << 1; + + if(bNewLayoutHorizontal) + { + mpBrowser1->SetPosSizePixel( + Point( nFrameLen, nFrameLen ), + Size(nSplitPos - nFrameLen, aNewSize.Height() - nFrameLen2) ); + + mpSplitter->SetPosSizePixel( + Point( nSplitPos, 0), + Size( nSplitSize, aNewSize.Height() ) ); + + mpSplitter->SetDragRectPixel( + Rectangle( + Point( nFrameLen2, 0 ), + Size( aNewSize.Width() - ( nFrameLen2 << 1 ) - nSplitSize, aNewSize.Height() ) ) ); + + mpBrowser2->SetPosSizePixel( + Point( nSplitPos + nSplitSize, nFrameLen ), + Size( aNewSize.Width() - nSplitSize - nSplitPos - nFrameLen, aNewSize.Height() - nFrameLen2 ) ); + } + else + { + mpBrowser1->SetPosSizePixel( + Point( nFrameLen, nFrameLen ), + Size(aNewSize.Width() - nFrameLen2, nSplitPos - nFrameLen)); + + mpSplitter->SetPosSizePixel( + Point( 0, nSplitPos), + Size( aNewSize.Width(), nSplitSize ) ); + + mpSplitter->SetDragRectPixel( + Rectangle( + Point( 0, nFrameLen2 ), + Size( aNewSize.Width(), aNewSize.Height() - ( nFrameLen2 << 1 ) - nSplitSize ) )); + + mpBrowser2->SetPosSizePixel( + Point( nFrameLen, nSplitPos + nSplitSize ), + Size( aNewSize.Width() - nFrameLen2, aNewSize.Height() - nSplitSize - nSplitPos - nFrameLen )); + } + + maLastSize = aNewSize; +} + + + + +sal_Bool GalleryControl::KeyInput( const KeyEvent& rKEvt, Window* ) +{ + const sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode(); + sal_Bool bRet = ( !rKEvt.GetKeyCode().IsMod1() && + ( ( KEY_TAB == nCode ) || ( KEY_F6 == nCode && rKEvt.GetKeyCode().IsMod2() ) ) ); + + if( bRet ) + { + if( !rKEvt.GetKeyCode().IsShift() ) + { + if( mpBrowser1->mpThemes->HasChildPathFocus( sal_True ) ) + mpBrowser2->GetViewWindow()->GrabFocus(); + else if( mpBrowser2->GetViewWindow()->HasFocus() ) + mpBrowser2->maViewBox.GrabFocus(); + else if( mpBrowser2->maViewBox.HasFocus() ) + mpBrowser1->maNewTheme.GrabFocus(); + else + mpBrowser1->mpThemes->GrabFocus(); + } + else + { + if( mpBrowser1->mpThemes->HasChildPathFocus( sal_True ) ) + mpBrowser1->maNewTheme.GrabFocus(); + else if( mpBrowser1->maNewTheme.HasFocus() ) + mpBrowser2->maViewBox.GrabFocus(); + else if( mpBrowser2->maViewBox.HasFocus() ) + mpBrowser2->GetViewWindow()->GrabFocus(); + else + mpBrowser1->mpThemes->GrabFocus(); + } + } + + return bRet; +} + + + + +void GalleryControl::GetFocus (void) +{ + Window::GetFocus(); + mpBrowser1->GrabFocus(); +} + + + + +void GalleryControl::ThemeSelectionHasChanged (void) +{ + mpBrowser2->SelectTheme(mpBrowser1->GetSelectedTheme()); +} + + + + +INetURLObject GalleryControl::GetURL (void) const +{ + return mpBrowser2->GetURL(); +} + + + + +String GalleryControl::GetFilterName (void) const +{ + return mpBrowser2->GetFilterName(); +} + + + + +Graphic GalleryControl::GetGraphic(void) const +{ + return mpBrowser2->GetGraphic(); +} + + + + +sal_Bool GalleryControl::GetVCDrawModel( FmFormModel& rModel ) const +{ + return mpBrowser2->GetVCDrawModel( rModel ); +} + + + + +sal_Bool GalleryControl::IsLinkage (void) const +{ + return mpBrowser2->IsLinkage(); +} + + + + +IMPL_LINK( GalleryControl, SplitHdl, void*, EMPTYARG ) +{ + if(mpSplitter->IsHorizontal()) + { + mpSplitter->SetPosPixel( Point( mpSplitter->GetSplitPosPixel(), mpSplitter->GetPosPixel().Y() ) ); + } + else + { + mpSplitter->SetPosPixel( Point( mpSplitter->GetPosPixel().X(), mpSplitter->GetSplitPosPixel() ) ); + } + + Resize(); + + return 0L; +} + + +} } // end of namespace svx::sidebar diff --git a/svx/source/gallery2/GallerySplitter.cxx b/svx/source/gallery2/GallerySplitter.cxx new file mode 100644 index 000000000000..b16abc21f166 --- /dev/null +++ b/svx/source/gallery2/GallerySplitter.cxx @@ -0,0 +1,55 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "precompiled_svx.hxx" + +#include "GallerySplitter.hxx" + + +DBG_NAME(GallerySplitter) + +GallerySplitter::GallerySplitter( + Window* pParent, + const ResId& rResId, + const ::boost::function<void(void)>& rDataChangeFunctor) + : Splitter( pParent, rResId ), + maDataChangeFunctor(rDataChangeFunctor) +{ + DBG_CTOR(GallerySplitter,NULL); +} + + + + +GallerySplitter::~GallerySplitter() +{ + DBG_DTOR(GallerySplitter,NULL); +} + + + + +void GallerySplitter::DataChanged( const DataChangedEvent& rDCEvt ) +{ + Splitter::DataChanged( rDCEvt ); + if (maDataChangeFunctor) + maDataChangeFunctor(); +} diff --git a/svx/source/gallery2/GallerySplitter.hxx b/svx/source/gallery2/GallerySplitter.hxx new file mode 100644 index 000000000000..85e7041e9126 --- /dev/null +++ b/svx/source/gallery2/GallerySplitter.hxx @@ -0,0 +1,45 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#ifndef SVX_GALLERY_SPLITTER_HXX +#define SVX_GALLERY_SPLITTER_HXX + +#include <vcl/split.hxx> +#include <boost/function.hpp> + +class GallerySplitter : public Splitter +{ +public: + GallerySplitter ( + Window* pParent, + const ResId& rResId, + const ::boost::function<void(void)>& rDataChangeFunctor); + virtual ~GallerySplitter (void); + +protected: + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + +private: + ::boost::function<void(void)> maDataChangeFunctor; +}; + + +#endif diff --git a/svx/source/gallery2/galbrws.cxx b/svx/source/gallery2/galbrws.cxx index 2e1f0a578f28..6c92d797698c 100644 --- a/svx/source/gallery2/galbrws.cxx +++ b/svx/source/gallery2/galbrws.cxx @@ -19,8 +19,6 @@ * *************************************************************/ - - // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" @@ -35,48 +33,9 @@ #include "galbrws1.hxx" #include "galbrws2.hxx" #include "svx/galbrws.hxx" +#include "GallerySplitter.hxx" -// ------------------- -// - GallerySplitter - -// ------------------- - -class GallerySplitter : public Splitter -{ -protected: - - virtual void DataChanged( const DataChangedEvent& rDCEvt ); - -public: - - GallerySplitter( Window* pParent, const ResId& rResId ); - virtual ~GallerySplitter(); -}; - -// ----------------------------------------------------------------------------- -DBG_NAME(GallerySplitter) - -GallerySplitter::GallerySplitter( Window* pParent, const ResId& rResId ) : - Splitter( pParent, rResId ) -{ - DBG_CTOR(GallerySplitter,NULL); - -} - -// ----------------------------------------------------------------------------- - -GallerySplitter::~GallerySplitter() -{ - - DBG_DTOR(GallerySplitter,NULL); -} - -// ----------------------------------------------------------------------------- - -void GallerySplitter::DataChanged( const DataChangedEvent& rDCEvt ) -{ - Splitter::DataChanged( rDCEvt ); - static_cast< GalleryBrowser* >( GetParent() )->InitSettings(); -} +#include <boost/bind.hpp> // ------------------------- // - SvxGalleryChildWindow - @@ -110,24 +69,40 @@ SFX_IMPL_DOCKINGWINDOW( GalleryChildWindow, SID_GALLERY ) // ------------------ DBG_NAME(GalleryBrowser) -GalleryBrowser::GalleryBrowser( SfxBindings* _pBindings, SfxChildWindow* pCW, - Window* pParent, const ResId& rResId ) : - SfxDockingWindow( _pBindings, pCW, pParent, rResId ) +GalleryBrowser::GalleryBrowser( + SfxBindings* _pBindings, + SfxChildWindow* pCW, + Window* pParent, + const ResId& rResId) +: SfxDockingWindow(_pBindings, pCW, pParent, rResId), + maLastSize(GetOutputSizePixel()), + mpSplitter(0), + mpBrowser1(0), + mpBrowser2(0), + mpGallery(0) { DBG_CTOR(GalleryBrowser,NULL); mpGallery = Gallery::GetGalleryInstance(); - mpBrowser1 = new GalleryBrowser1( this, GAL_RESID( GALLERY_BROWSER1 ), mpGallery ); - mpSplitter = new GallerySplitter( this, GAL_RESID( GALLERY_SPLITTER ) ); + mpBrowser1 = new GalleryBrowser1( + this, + GAL_RESID( GALLERY_BROWSER1 ), + mpGallery, + ::boost::bind(&GalleryBrowser::KeyInput,this,_1,_2), + ::boost::bind(&GalleryBrowser::ThemeSelectionHasChanged, this)); + mpSplitter = new GallerySplitter( this, GAL_RESID( GALLERY_SPLITTER ), + ::boost::bind(&GalleryBrowser::InitSettings, this)); mpBrowser2 = new GalleryBrowser2( this, GAL_RESID( GALLERY_BROWSER2 ), mpGallery ); FreeResource(); - SetMinOutputSizePixel( maLastSize = GetOutputSizePixel() ); + SetMinOutputSizePixel(maLastSize); mpBrowser1->SelectTheme( 0 ); mpBrowser1->Show( sal_True ); mpBrowser2->Show( sal_True ); + const bool bLayoutHorizontal(maLastSize.Width() > maLastSize.Height()); + mpSplitter->SetHorizontal(bLayoutHorizontal); mpSplitter->SetSplitHdl( LINK( this, GalleryBrowser, SplitHdl ) ); mpSplitter->Show( sal_True ); @@ -170,23 +145,62 @@ void GalleryBrowser::InitSettings() void GalleryBrowser::Resize() { + // call parent SfxDockingWindow::Resize(); - const long nFrameWidth = LogicToPixel( Size( 3, 0 ), MAP_APPFONT ).Width(); - const long nFrameWidth2 = nFrameWidth << 1; - Size aMinSize( GetMinOutputSizePixel() ); - Size aNewSize( GetOutputSizePixel() ); - Point aSplitPos( mpSplitter->GetPosPixel() ); - const Size aSplitSize( mpSplitter->GetOutputSizePixel() ); + // update hor/ver + const Size aNewSize( GetOutputSizePixel() ); + const bool bNewLayoutHorizontal(aNewSize.Width() > aNewSize.Height()); + const bool bOldLayoutHorizontal(mpSplitter->IsHorizontal()); + const long nSplitPos( bOldLayoutHorizontal ? mpSplitter->GetPosPixel().X() : mpSplitter->GetPosPixel().Y()); + const long nSplitSize( bOldLayoutHorizontal ? mpSplitter->GetOutputSizePixel().Width() : mpSplitter->GetOutputSizePixel().Height()); - mpBrowser1->SetPosSizePixel( Point( nFrameWidth, nFrameWidth ), - Size( aSplitPos.X() - nFrameWidth, aNewSize.Height() - nFrameWidth2 ) ); + if(bNewLayoutHorizontal != bOldLayoutHorizontal) + { + mpSplitter->SetHorizontal(bNewLayoutHorizontal); + } - mpSplitter->SetPosSizePixel( aSplitPos, Size( aSplitSize.Width(), aNewSize.Height() ) ); - mpSplitter->SetDragRectPixel( Rectangle( Point( nFrameWidth2, 0 ), Size( aNewSize.Width() - ( nFrameWidth2 << 1 ) - aSplitSize.Width(), aNewSize.Height() ) ) ); + const long nFrameLen = LogicToPixel( Size( 3, 0 ), MAP_APPFONT ).Width(); + const long nFrameLen2 = nFrameLen << 1; - mpBrowser2->SetPosSizePixel( Point( aSplitPos.X() + aSplitSize.Width(), nFrameWidth ), - Size( aNewSize.Width() - aSplitSize.Width() - aSplitPos.X() - nFrameWidth, aNewSize.Height() - nFrameWidth2 ) ); + if(bNewLayoutHorizontal) + { + mpBrowser1->SetPosSizePixel( + Point( nFrameLen, nFrameLen ), + Size(nSplitPos - nFrameLen, aNewSize.Height() - nFrameLen2) ); + + mpSplitter->SetPosSizePixel( + Point( nSplitPos, 0), + Size( nSplitSize, aNewSize.Height() ) ); + + mpSplitter->SetDragRectPixel( + Rectangle( + Point( nFrameLen2, 0 ), + Size( aNewSize.Width() - ( nFrameLen2 << 1 ) - nSplitSize, aNewSize.Height() ) ) ); + + mpBrowser2->SetPosSizePixel( + Point( nSplitPos + nSplitSize, nFrameLen ), + Size( aNewSize.Width() - nSplitSize - nSplitPos - nFrameLen, aNewSize.Height() - nFrameLen2 ) ); + } + else + { + mpBrowser1->SetPosSizePixel( + Point( nFrameLen, nFrameLen ), + Size(aNewSize.Width() - nFrameLen2, nSplitPos - nFrameLen)); + + mpSplitter->SetPosSizePixel( + Point( 0, nSplitPos), + Size( aNewSize.Width(), nSplitSize ) ); + + mpSplitter->SetDragRectPixel( + Rectangle( + Point( 0, nFrameLen2 ), + Size( aNewSize.Width(), aNewSize.Height() - ( nFrameLen2 << 1 ) - nSplitSize ) )); + + mpBrowser2->SetPosSizePixel( + Point( nFrameLen, nSplitPos + nSplitSize ), + Size( aNewSize.Width() - nFrameLen2, aNewSize.Height() - nSplitSize - nSplitPos - nFrameLen )); + } maLastSize = aNewSize; } @@ -289,8 +303,19 @@ sal_Bool GalleryBrowser::IsLinkage() const IMPL_LINK( GalleryBrowser, SplitHdl, void*, EMPTYARG ) { - mpSplitter->SetPosPixel( Point( mpSplitter->GetSplitPosPixel(), mpSplitter->GetPosPixel().Y() ) ); + if(mpSplitter->IsHorizontal()) + { + mpSplitter->SetPosPixel( Point( mpSplitter->GetSplitPosPixel(), mpSplitter->GetPosPixel().Y() ) ); + } + else + { + mpSplitter->SetPosPixel( Point( mpSplitter->GetPosPixel().X(), mpSplitter->GetSplitPosPixel() ) ); + } + Resize(); return 0L; } + +// ----------------------------------------------------------------------------- +// eof diff --git a/svx/source/gallery2/galbrws1.cxx b/svx/source/gallery2/galbrws1.cxx index aae042f6c3e3..3ef6109694ec 100644 --- a/svx/source/gallery2/galbrws1.cxx +++ b/svx/source/gallery2/galbrws1.cxx @@ -147,7 +147,13 @@ long GalleryThemeListBox::PreNotify( NotifyEvent& rNEvt ) // ------------------- DBG_NAME(GalleryBrowser1) -GalleryBrowser1::GalleryBrowser1( GalleryBrowser* pParent, const ResId& rResId, Gallery* pGallery ) : +GalleryBrowser1::GalleryBrowser1( + Window* pParent, + const ResId& rResId, + Gallery* pGallery, + const ::boost::function<sal_Bool(const KeyEvent&,Window*)>& rKeyInputHandler, + const ::boost::function<void(void)>& rThemeSlectionHandler) + : Control ( pParent, rResId ), maNewTheme ( this, WB_3DLOOK ), mpThemes ( new GalleryThemeListBox( this, WB_TABSTOP | WB_3DLOOK | WB_BORDER | WB_HSCROLL | WB_VSCROLL | WB_AUTOHSCROLL | WB_SORT ) ), @@ -157,7 +163,9 @@ GalleryBrowser1::GalleryBrowser1( GalleryBrowser* pParent, const ResId& rResId, aImgNormal ( GalleryResGetBitmapEx( RID_SVXBMP_THEME_NORMAL ) ), aImgDefault ( GalleryResGetBitmapEx( RID_SVXBMP_THEME_DEFAULT ) ), aImgReadOnly ( GalleryResGetBitmapEx( RID_SVXBMP_THEME_READONLY ) ), - aImgImported ( GalleryResGetBitmapEx( RID_SVXBMP_THEME_IMPORTED ) ) + aImgImported ( GalleryResGetBitmapEx( RID_SVXBMP_THEME_IMPORTED ) ), + maKeyInputHandler(rKeyInputHandler), + maThemeSlectionHandler(rThemeSlectionHandler) { DBG_CTOR(GalleryBrowser1,NULL); @@ -591,7 +599,9 @@ void GalleryBrowser1::ShowContextMenu() sal_Bool GalleryBrowser1::KeyInput( const KeyEvent& rKEvt, Window* pWindow ) { - sal_Bool bRet = static_cast< GalleryBrowser* >( GetParent() )->KeyInput( rKEvt, pWindow ); + sal_Bool bRet (sal_False); + if (maKeyInputHandler) + bRet = maKeyInputHandler(rKEvt, pWindow); if( !bRet ) { @@ -699,7 +709,8 @@ IMPL_LINK( GalleryBrowser1, PopupMenuHdl, Menu*, pMenu ) IMPL_LINK( GalleryBrowser1, SelectThemeHdl, void*, EMPTYARG ) { - ( (GalleryBrowser*) GetParent() )->ThemeSelectionHasChanged(); + if (maThemeSlectionHandler) + maThemeSlectionHandler(); return 0L; } diff --git a/svx/source/gallery2/galbrws1.hxx b/svx/source/gallery2/galbrws1.hxx index ce36ba43faa8..6626ebe40a09 100644 --- a/svx/source/gallery2/galbrws1.hxx +++ b/svx/source/gallery2/galbrws1.hxx @@ -28,6 +28,8 @@ #include <vector> #include "svx/galbrws.hxx" +#include <boost/function.hpp> + // ----------------- // - GalleryButton - // ----------------- @@ -74,9 +76,12 @@ class VclAbstractDialog2; struct ExchangeData; class SfxItemSet; +namespace svx { namespace sidebar { class GalleryControl; } } + class GalleryBrowser1 : public Control, SfxListener { friend class GalleryBrowser; + friend class svx::sidebar::GalleryControl; friend class GalleryThemeListBox; using Control::Notify; using Window::KeyInput; @@ -94,6 +99,9 @@ private: Image aImgReadOnly; Image aImgImported; + ::boost::function<sal_Bool(const KeyEvent&,Window*)> maKeyInputHandler; + ::boost::function<void(void)> maThemeSlectionHandler; + void ImplAdjustControls(); sal_uIntPtr ImplInsertThemeEntry( const GalleryThemeEntry* pEntry ); void ImplFillExchangeData( const GalleryTheme* pThm, ExchangeData& rData ); @@ -119,7 +127,12 @@ private: public: - GalleryBrowser1( GalleryBrowser* pParent, const ResId& rResId, Gallery* pGallery ); + GalleryBrowser1( + Window* pParent, + const ResId& rResId, + Gallery* pGallery, + const ::boost::function<sal_Bool(const KeyEvent&,Window*)>& rKeyInputHandler, + const ::boost::function<void(void)>& rThemeSlectionHandler); ~GalleryBrowser1(); void SelectTheme( const String& rThemeName ) { mpThemes->SelectEntry( rThemeName ); SelectThemeHdl( NULL ); } diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx index f1fd738b2501..26dc86f80131 100644 --- a/svx/source/gallery2/galbrws2.cxx +++ b/svx/source/gallery2/galbrws2.cxx @@ -53,6 +53,7 @@ #include <svx/dialmgr.hxx> #include <svx/svxdlg.hxx> #include <svx/dialogs.hrc> +#include "GalleryControl.hxx" // ----------- // - Defines - @@ -315,7 +316,7 @@ void GalleryToolBox::KeyInput( const KeyEvent& rKEvt ) // ------------------- DBG_NAME(GalleryBrowser2) -GalleryBrowser2::GalleryBrowser2( GalleryBrowser* pParent, const ResId& rResId, Gallery* pGallery ) : +GalleryBrowser2::GalleryBrowser2( Window* pParent, const ResId& rResId, Gallery* pGallery ) : Control ( pParent, rResId ), mpGallery ( pGallery ), mpCurTheme ( NULL ), @@ -574,7 +575,16 @@ sal_Bool GalleryBrowser2::KeyInput( const KeyEvent& rKEvt, Window* pWindow ) { Point aSelPos; const sal_uIntPtr nItemId = ImplGetSelectedItemId( NULL, aSelPos ); - sal_Bool bRet = static_cast< GalleryBrowser* >( GetParent() )->KeyInput( rKEvt, pWindow ); + GalleryBrowser* pParentBrowser = dynamic_cast<GalleryBrowser*>(GetParent()); + sal_Bool bRet = sal_False; + if (pParentBrowser != NULL) + bRet = pParentBrowser->KeyInput( rKEvt, pWindow ); + else + { + svx::sidebar::GalleryControl* pParentControl = dynamic_cast<svx::sidebar::GalleryControl*>(GetParent()); + if (pParentControl != NULL) + bRet = pParentControl->KeyInput(rKEvt, pWindow); + } if( !bRet && !maViewBox.HasFocus() && nItemId && mpCurTheme ) { diff --git a/svx/source/gallery2/gallery1.cxx b/svx/source/gallery2/gallery1.cxx index e2c880284e6d..254739e29c51 100644 --- a/svx/source/gallery2/gallery1.cxx +++ b/svx/source/gallery2/gallery1.cxx @@ -77,7 +77,12 @@ GalleryThemeEntry::GalleryThemeEntry( const INetURLObject& rBaseURL, const Strin SetModified( _bNewFile ); if( nId && bThemeNameFromResource ) - aName = String( GAL_RESID( RID_GALLERYSTR_THEME_START + (sal_uInt16) nId ) ); + { + const ResId aId (GAL_RESID( RID_GALLERYSTR_THEME_START + (sal_uInt16) nId)); + if (aId.GetpResource() == NULL) + OSL_TRACE(""); + aName = String(aId); + } if( !aName.Len() ) aName = rName; diff --git a/svx/source/items/drawitem.cxx b/svx/source/items/drawitem.cxx index 3378c697a058..2e10538612ce 100644 --- a/svx/source/items/drawitem.cxx +++ b/svx/source/items/drawitem.cxx @@ -55,7 +55,7 @@ SvxColorTableItem::SvxColorTableItem() // ----------------------------------------------------------------------- -SvxColorTableItem::SvxColorTableItem( XColorTable* pTable, sal_uInt16 nW ) : +SvxColorTableItem::SvxColorTableItem( XColorList* pTable, sal_uInt16 nW ) : SfxPoolItem( nW ), pColorTable( pTable ) { @@ -120,7 +120,7 @@ sal_Bool SvxColorTableItem::PutValue( const com::sun::star::uno::Any& rVal, sal_ sal_Int64 aValue = 0; if ( rVal >>= aValue ) { - pColorTable = (XColorTable *)(sal_uLong)aValue; + pColorTable = (XColorList*)(sal_uLong)aValue; return sal_True; } diff --git a/svx/source/items/svxitems.src b/svx/source/items/svxitems.src index 3fc0c3918d06..fc7c23624b16 100644 --- a/svx/source/items/svxitems.src +++ b/svx/source/items/svxitems.src @@ -211,7 +211,12 @@ String RID_SVXITEMS_BRUSHSTYLE_BITMAP { Text [ en-US ] = "Image" ; }; - +// enum ColorName ----------------------------------------------------------- +String RID_SVXITEMS_COLOR_WHITE +{ + Text [ en-US ] = "White" ; +}; +// end enum ColorName ----------------------------------------------------------- String RID_SVXITEMS_HORJUST_STANDARD { Text [ en-US ] = "Horizontal alignment default" ; diff --git a/svx/source/sdr/attribute/sdrformtextattribute.cxx b/svx/source/sdr/attribute/sdrformtextattribute.cxx index 1608b9524391..8b5d5122dcc3 100644 --- a/svx/source/sdr/attribute/sdrformtextattribute.cxx +++ b/svx/source/sdr/attribute/sdrformtextattribute.cxx @@ -56,27 +56,27 @@ namespace { - basegfx::B2DLineJoin impGetB2DLineJoin(XLineJoint eLineJoint) + basegfx::B2DLineJoin impGetB2DLineJoin(com::sun::star::drawing::LineJoint eLineJoint) { switch(eLineJoint) { - case XLINEJOINT_MIDDLE : + case com::sun::star::drawing::LineJoint_MIDDLE : { return basegfx::B2DLINEJOIN_MIDDLE; } - case XLINEJOINT_BEVEL : + case com::sun::star::drawing::LineJoint_BEVEL : { return basegfx::B2DLINEJOIN_BEVEL; } - case XLINEJOINT_MITER : + case com::sun::star::drawing::LineJoint_MITER : { return basegfx::B2DLINEJOIN_MITER; } - case XLINEJOINT_ROUND : + case com::sun::star::drawing::LineJoint_ROUND : { return basegfx::B2DLINEJOIN_ROUND; } - default : + default : // com::sun::star::drawing::LineJoint_NONE { return basegfx::B2DLINEJOIN_NONE; // XLINEJOINT_NONE } @@ -115,7 +115,7 @@ namespace } const sal_uInt32 nLineWidth = ((const XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue(); - const XLineJoint eLineJoint = ((const XLineJointItem&)(rSet.Get(XATTR_LINEJOINT))).GetValue(); + const com::sun::star::drawing::LineJoint eLineJoint = ((const XLineJointItem&)(rSet.Get(XATTR_LINEJOINT))).GetValue(); const com::sun::star::drawing::LineCap eLineCap = ((const XLineCapItem&)(rSet.Get(XATTR_LINECAP))).GetValue(); return drawinglayer::attribute::LineAttribute( diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx index 20cb325ec062..a218bc9012d2 100644 --- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx +++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx @@ -137,29 +137,29 @@ namespace drawinglayer } } - basegfx::B2DLineJoin XLineJointtoB2DLineJoin(XLineJoint eLineJoint) + basegfx::B2DLineJoin LineJointToB2DLineJoin(com::sun::star::drawing::LineJoint eLineJoint) { switch(eLineJoint) { - case XLINEJOINT_MIDDLE : + case com::sun::star::drawing::LineJoint_MIDDLE : { return basegfx::B2DLINEJOIN_MIDDLE; } - case XLINEJOINT_BEVEL : + case com::sun::star::drawing::LineJoint_BEVEL : { return basegfx::B2DLINEJOIN_BEVEL; } - case XLINEJOINT_MITER : + case com::sun::star::drawing::LineJoint_MITER : { return basegfx::B2DLINEJOIN_MITER; } - case XLINEJOINT_ROUND : + case com::sun::star::drawing::LineJoint_ROUND : { return basegfx::B2DLINEJOIN_ROUND; } - default : + default : // com::sun::star::drawing::LineJoint_NONE { - return basegfx::B2DLINEJOIN_NONE; // XLINEJOINT_NONE + return basegfx::B2DLINEJOIN_NONE; } } } @@ -238,7 +238,7 @@ namespace drawinglayer { const sal_uInt32 nWidth(((const XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue()); const Color aColor(((const XLineColorItem&)(rSet.Get(XATTR_LINECOLOR))).GetColorValue()); - const XLineJoint eJoint(((const XLineJointItem&)(rSet.Get(XATTR_LINEJOINT))).GetValue()); + const com::sun::star::drawing::LineJoint eJoint(((const XLineJointItem&)(rSet.Get(XATTR_LINEJOINT))).GetValue()); const com::sun::star::drawing::LineCap eCap(((const XLineCapItem&)(rSet.Get(XATTR_LINECAP))).GetValue()); ::std::vector< double > aDotDashArray; double fFullDotDashLen(0.0); @@ -254,7 +254,7 @@ namespace drawinglayer } return attribute::SdrLineAttribute( - XLineJointtoB2DLineJoin(eJoint), + LineJointToB2DLineJoin(eJoint), (double)nWidth, (double)nTransparence * 0.01, aColor.getBColor(), @@ -399,6 +399,26 @@ namespace drawinglayer if(100 != nTransparence) { + // need to check XFillFloatTransparence, object fill may still be completely transparent + const SfxPoolItem* pGradientItem; + + if(SFX_ITEM_SET == rSet.GetItemState(XATTR_FILLFLOATTRANSPARENCE, sal_True, &pGradientItem) + && ((XFillFloatTransparenceItem*)pGradientItem)->IsEnabled()) + { + const XGradient& rGradient = ((XFillFloatTransparenceItem*)pGradientItem)->GetGradientValue(); + const sal_uInt8 nStartLuminance(rGradient.GetStartColor().GetLuminance()); + const sal_uInt8 nEndLuminance(rGradient.GetEndColor().GetLuminance()); + const bool bCompletelyTransparent(0xff == nStartLuminance && 0xff == nEndLuminance); + + if(bCompletelyTransparent) + { + nTransparence = 100; + } + } + } + + if(100 != nTransparence) + { const Color aColor(((const XFillColorItem&)(rSet.Get(XATTR_FILLCOLOR))).GetColorValue()); attribute::FillGradientAttribute aGradient; attribute::FillHatchAttribute aHatch; @@ -569,8 +589,13 @@ namespace drawinglayer const sal_uInt8 nStartLuminance(rGradient.GetStartColor().GetLuminance()); const sal_uInt8 nEndLuminance(rGradient.GetEndColor().GetLuminance()); const bool bCompletelyTransparent(0xff == nStartLuminance && 0xff == nEndLuminance); + const bool bNotTransparent(0x00 == nStartLuminance && 0x00 == nEndLuminance); - if(!bCompletelyTransparent) + // create nothing when completely transparent: This case is already checked for the + // normal fill attributes, XFILL_NONE will be used. + // create nothing when not transparent: use normal fill, no need t create a FillGradientAttribute. + // Both cases are optimizations, always creating FillGradientAttribute will work, too + if(!bNotTransparent && !bCompletelyTransparent) { const double fStartLum(nStartLuminance / 255.0); const double fEndLum(nEndLuminance / 255.0); diff --git a/svx/source/sidebar/ColorPanel.cxx b/svx/source/sidebar/ColorPanel.cxx new file mode 100644 index 000000000000..42bf02cd339a --- /dev/null +++ b/svx/source/sidebar/ColorPanel.cxx @@ -0,0 +1,233 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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..91c2987ad241 --- /dev/null +++ b/svx/source/sidebar/ColorPanel.hxx @@ -0,0 +1,61 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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/ContextChangeEventMultiplexer.cxx b/svx/source/sidebar/ContextChangeEventMultiplexer.cxx new file mode 100644 index 000000000000..f9838ed86e4f --- /dev/null +++ b/svx/source/sidebar/ContextChangeEventMultiplexer.cxx @@ -0,0 +1,91 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "precompiled_svx.hxx" + +#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..6b364aa549c3 --- /dev/null +++ b/svx/source/sidebar/EmptyPanel.cxx @@ -0,0 +1,80 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "precompiled_svx.hxx" + +#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/inc/linectrl.hrc b/svx/source/sidebar/EmptyPanel.hrc index eb0bf489be63..9380db7412d6 100644 --- a/svx/source/inc/linectrl.hrc +++ b/svx/source/sidebar/EmptyPanel.hrc @@ -19,6 +19,8 @@ * *************************************************************/ +#include <svx/dialogs.hrc> -#define RID_SVXCTRL_LINECTRL 257 +// For RID_SIDEBAR_EMPTY_PANEL +#define FT_MESSAGE 1 diff --git a/svx/source/sidebar/EmptyPanel.hxx b/svx/source/sidebar/EmptyPanel.hxx new file mode 100644 index 000000000000..e6ef0b2beef6 --- /dev/null +++ b/svx/source/sidebar/EmptyPanel.hxx @@ -0,0 +1,51 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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 diff --git a/svx/source/sidebar/EmptyPanel.src b/svx/source/sidebar/EmptyPanel.src new file mode 100644 index 000000000000..1a008f976b05 --- /dev/null +++ b/svx/source/sidebar/EmptyPanel.src @@ -0,0 +1,33 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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..ecc912ff0a1e --- /dev/null +++ b/svx/source/sidebar/PanelFactory.cxx @@ -0,0 +1,209 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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..a5745bd8a860 --- /dev/null +++ b/svx/source/sidebar/SelectionAnalyzer.cxx @@ -0,0 +1,461 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "precompiled_svx.hxx" + +#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* pObj = pObjList->GetObj(0); + 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_uInt16 nIndex=1; nIndex<nSubObjCount; ++nIndex) + { + pObj = pObjList->GetObj(nIndex); + 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; + } + } + + 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..fb0ff011b6ac --- /dev/null +++ b/svx/source/sidebar/SelectionChangeHandler.cxx @@ -0,0 +1,119 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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..4b1472d3372f --- /dev/null +++ b/svx/source/sidebar/area/AreaPropertyPanel.cxx @@ -0,0 +1,1373 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "svx/sidebar/PopupContainer.hxx" +#include "AreaTransparencyGradientControl.hxx" + +#include <sfx2/sidebar/propertypanel.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(), + mpColorTableItem(), + 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)), + maImgAxialH(SVX_RES(IMG_AXIAL_H)), + maImgElliH(SVX_RES(IMG_ELLI_H)), + maImgQuadH(SVX_RES(IMG_QUAD_H)), + maImgRadialH(SVX_RES(IMG_RADIAL_H)), + maImgSquareH(SVX_RES(IMG_SQUARE_H)), + maImgLinearH(SVX_RES(IMG_LINEAR_H)), + maImgColorH(SVX_RES(IMG_COLOR_H)), + 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, GetDisplayBackground().GetColor().IsDark()? maImgColorH : 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(); + const bool bHighContrast(GetSettings().GetStyleSettings().GetHighContrastMode()); + sal_uInt16 nEntryPos(0); + Image* pImage = 0; + + mpLBTransType->Enable(); + mpMTRTransparent->Hide(); + mpBTNGradient->Enable(); + mpBTNGradient->Show(); + + switch(rGradient.GetGradientStyle()) + { + case XGRAD_LINEAR: + { + nEntryPos = 2; + pImage = bHighContrast ? &maImgLinearH : &maImgLinear; + break; + } + case XGRAD_AXIAL: + { + nEntryPos = 3; + pImage = bHighContrast ? &maImgAxialH : &maImgAxial; + break; + } + case XGRAD_RADIAL: + { + nEntryPos = 4; + pImage = bHighContrast ? &maImgRadialH : &maImgRadial; + break; + } + case XGRAD_ELLIPTICAL: + { + nEntryPos = 5; + pImage = bHighContrast ? &maImgElliH : &maImgElli; + break; + } + case XGRAD_SQUARE: + { + nEntryPos = 6; + pImage = bHighContrast ? &maImgQuadH : &maImgQuad; + break; + } + case XGRAD_RECT: + { + nEntryPos = 7; + pImage = bHighContrast ? &maImgSquareH : &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) + { + mpColorTableItem.reset(pState ? (SvxColorTableItem*)pState->Clone() : 0); + + if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue()== XFILL_SOLID) + { + if ( mpColorItem ) + { + String aString( mpColorItem->GetName() ); + Color aColor = mpColorItem->GetColorValue(); + mpLbFillAttr->Clear(); + SvxColorTableItem aItem( *(const SvxColorTableItem*)( + pSh->GetItem( SID_COLOR_TABLE ) ) ); + mpLbFillAttr->Enable(); + mpLbFillAttr->Fill( aItem.GetColorTable() ); + 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: + DBG_ERROR( "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,GetSettings().GetStyleSettings().GetHighContrastMode()? maImgLinearH : maImgLinear); // high contrast + break; + case 3: + mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT,GetSettings().GetStyleSettings().GetHighContrastMode()? maImgAxialH : maImgAxial); + break; + case 4: + mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT,GetSettings().GetStyleSettings().GetHighContrastMode()? maImgRadialH : maImgRadial); + break; + case 5: + mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT,GetSettings().GetStyleSettings().GetHighContrastMode()? maImgElliH : maImgElli ); + break; + case 6: + mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT,GetSettings().GetStyleSettings().GetHighContrastMode()? maImgQuadH : maImgQuad ); + break; + case 7: + mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT,GetSettings().GetStyleSettings().GetHighContrastMode()? maImgSquareH : 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..4e1470b960b4 --- /dev/null +++ b/svx/source/sidebar/area/AreaPropertyPanel.hrc @@ -0,0 +1,96 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +// 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 + +//high contrast +#define IMG_AXIAL_H 34 +#define IMG_ELLI_H 35 +#define IMG_QUAD_H 36 +#define IMG_RADIAL_H 37 +#define IMG_SQUARE_H 38 +#define IMG_LINEAR_H 39 +#define IMG_COLOR_H 40 + + +#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..870705d5cadd --- /dev/null +++ b/svx/source/sidebar/area/AreaPropertyPanel.hxx @@ -0,0 +1,211 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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< SvxColorTableItem > mpColorTableItem; + ::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; + + //for high contract + Image maImgAxialH; + Image maImgElliH; + Image maImgQuadH; + Image maImgRadialH; + Image maImgSquareH; + Image maImgLinearH; + Image maImgColorH; + + 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..a75c44a7fba2 --- /dev/null +++ b/svx/source/sidebar/area/AreaPropertyPanel.src @@ -0,0 +1,423 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "AreaPropertyPanel.hrc" +#include <sfx2/sidebar/propertypanel.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";}; + }; + + //high contract + Image IMG_AXIAL_H + { + ImageBitmap = Bitmap{File = "symphony/axial_h.png";}; + }; + Image IMG_ELLI_H + { + ImageBitmap = Bitmap{File = "symphony/ellipsoid_h.png";}; + }; + Image IMG_QUAD_H + { + ImageBitmap = Bitmap{File = "symphony/Quadratic_h.png";}; + }; + Image IMG_RADIAL_H + { + ImageBitmap = Bitmap{File = "symphony/radial_h.png";}; + }; + Image IMG_SQUARE_H + { + ImageBitmap = Bitmap{File = "symphony/Square_h.png";}; + }; + Image IMG_LINEAR_H + { + ImageBitmap = Bitmap{File = "symphony/linear_h.png";}; + }; + Image IMG_COLOR_H + { + ImageBitmap = Bitmap{File = "symphony/fill_color_h.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..f59f382bddd0 --- /dev/null +++ b/svx/source/sidebar/area/AreaTransparencyGradientControl.cxx @@ -0,0 +1,349 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "AreaTransparencyGradientControl.hxx" +#include "AreaPropertyPanel.hxx" +#include "AreaPropertyPanel.hrc" + +#include <svx/dialogs.hrc> +#include <svx/dialmgr.hxx> +#include <svx/xflftrit.hxx> +#include <sfx2/sidebar/propertypanel.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)), + 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)), + maBtnLeft45(this, SVX_RES(BTN_LEFT_SECOND)), + maBtnRight45(this, SVX_RES(BTN_RIGHT_FIRST)), + 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(AreaTransparencyGradientControl, ModifiedTrgrHdl_Impl, void *, pControl) +{ + 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(AreaTransparencyGradientControl, Left_Click45_Impl, void *, pControl) +{ + 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(AreaTransparencyGradientControl, Right_Click45_Impl, void *, pControl) +{ + 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..98322aa176c3 --- /dev/null +++ b/svx/source/sidebar/area/AreaTransparencyGradientControl.hxx @@ -0,0 +1,78 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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..be1f9f4af312 --- /dev/null +++ b/svx/source/sidebar/area/AreaTransparencyGradientPopup.cxx @@ -0,0 +1,60 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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..04f79ff340ae --- /dev/null +++ b/svx/source/sidebar/area/AreaTransparencyGradientPopup.hxx @@ -0,0 +1,51 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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..42bf02cd339a --- /dev/null +++ b/svx/source/sidebar/debug/ColorPanel.cxx @@ -0,0 +1,233 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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/debug/ColorPanel.hxx b/svx/source/sidebar/debug/ColorPanel.hxx new file mode 100644 index 000000000000..91c2987ad241 --- /dev/null +++ b/svx/source/sidebar/debug/ColorPanel.hxx @@ -0,0 +1,61 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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..d101bc34b2a6 --- /dev/null +++ b/svx/source/sidebar/debug/ContextPanel.cxx @@ -0,0 +1,69 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "precompiled_svx.hxx" + +#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..d126d2272868 --- /dev/null +++ b/svx/source/sidebar/debug/ContextPanel.hxx @@ -0,0 +1,56 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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..5c899e8363cf --- /dev/null +++ b/svx/source/sidebar/debug/NotYetImplementedPanel.cxx @@ -0,0 +1,49 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "precompiled_svx.hxx" + +#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..69592d010d5f --- /dev/null +++ b/svx/source/sidebar/debug/NotYetImplementedPanel.hxx @@ -0,0 +1,47 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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/tbxctrls/linectrl.src b/svx/source/sidebar/gallery/GalleryPanel.hxx index 7b823536105b..7d36e154c6f4 100644 --- a/svx/source/tbxctrls/linectrl.src +++ b/svx/source/sidebar/gallery/GalleryPanel.hxx @@ -19,12 +19,12 @@ * *************************************************************/ +#ifndef SVX_SIDEBAR_GALLERY_PANEL_HXX +#define SVX_SIDEBAR_GALLERY_PANEL_HXX - -#include "linectrl.hrc" - -Bitmap RID_SVXCTRL_LINECTRL +class GelleryPanel { - File = "soliline.bmp" ; }; + +#endif diff --git a/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx b/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx new file mode 100644 index 000000000000..f0b46e2a4669 --- /dev/null +++ b/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx @@ -0,0 +1,459 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include <sfx2/sidebar/propertypanel.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( GraphicPropertyPanel, ClickColorModeHdl, ToolBox *, pBox ) +{ + 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..884fc245a26a --- /dev/null +++ b/svx/source/sidebar/graphic/GraphicPropertyPanel.hrc @@ -0,0 +1,82 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +// 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..26e68096a3b2 --- /dev/null +++ b/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx @@ -0,0 +1,127 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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, ToolBox * ); + 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..1071ec8d5f81 --- /dev/null +++ b/svx/source/sidebar/graphic/GraphicPropertyPanel.src @@ -0,0 +1,257 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "GraphicPropertyPanel.hrc" +#include <sfx2/sidebar/propertypanel.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..52b3c5f062a2 --- /dev/null +++ b/svx/source/sidebar/line/LinePropertyPanel.cxx @@ -0,0 +1,1161 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include <sfx2/sidebar/propertypanel.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 <i18npool/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), + mpLineEndList(0), + mpLineStyleList(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(), + mpIMGWidthIconH(), + 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)); + + //high contrast + mpIMGWidthIconH.reset(new Image[8]); + mpIMGWidthIconH[0] = Image(SVX_RES(IMG_WIDTH1_ICON_H)); + mpIMGWidthIconH[1] = Image(SVX_RES(IMG_WIDTH2_ICON_H)); + mpIMGWidthIconH[2] = Image(SVX_RES(IMG_WIDTH3_ICON_H)); + mpIMGWidthIconH[3] = Image(SVX_RES(IMG_WIDTH4_ICON_H)); + mpIMGWidthIconH[4] = Image(SVX_RES(IMG_WIDTH5_ICON_H)); + mpIMGWidthIconH[5] = Image(SVX_RES(IMG_WIDTH6_ICON_H)); + mpIMGWidthIconH[6] = Image(SVX_RES(IMG_WIDTH7_ICON_H)); + mpIMGWidthIconH[7] = Image(SVX_RES(IMG_WIDTH8_ICON_H)); + + 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(LinePropertyPanel, ChangeLineStyleHdl, ToolBox*, pToolBox) +{ + 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(mpLineStyleList && mpLineStyleList->Count() > (long)(nPos - 2)) + { + // XLINE_DASH + const XLineStyleItem aItemA(XLINE_DASH); + const XLineDashItem aItemB(mpLBStyle->GetSelectEntry(), mpLineStyleList->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( mpLineEndList && mpLineEndList->Count() > (long) ( nPos - 1 ) ) + pItem = new XLineStartItem( mpLBStart->GetSelectEntry(),mpLineEndList->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( mpLineEndList && mpLineEndList->Count() > (long) ( nPos - 1 ) ) + pItem = new XLineEndItem( mpLBEnd->GetSelectEntry(), mpLineEndList->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, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[n-1] : 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, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[0] : mpIMGWidthIcon[0]); + else if(nVal > 6 && nVal <= 9) + mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[1] : mpIMGWidthIcon[1]); + else if(nVal > 9 && nVal <= 12) + mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[2] : mpIMGWidthIcon[2]); + else if(nVal > 12 && nVal <= 19) + mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[3] : mpIMGWidthIcon[3]); + else if(nVal > 19 && nVal <= 26) + mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[4] : mpIMGWidthIcon[4]); + else if(nVal > 26 && nVal <= 37) + mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[5] : mpIMGWidthIcon[5]); + else if(nVal > 37 && nVal <=52) + mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[6] : mpIMGWidthIcon[6]); + else if(nVal > 52) + mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[7] : 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 ) ) ); + mpLineEndList = aItem.GetLineEndList(); + + if(mpLineEndList) + { + FillLineEndListBox(*mpLBStart, *mpLBEnd, *mpLineEndList); + } + + 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 ) ) ); + mpLineStyleList = aItem.GetDashList(); + + if(mpLineStyleList) + { + FillLineStyleListBox(*mpLBStyle, *mpLineStyleList); + } + + 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 && mpLineStyleList) + { + const XDash& rDash = mpDashItem->GetDashValue(); + for(sal_Int32 a(0);!bSelected && a < mpLineStyleList->Count(); a++) + { + XDashEntry* pEntry = mpLineStyleList->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 && mpLineEndList) + { + const basegfx::B2DPolyPolygon& rItemPolygon = mpStartItem->GetLineStartValue(); + for(sal_Int32 a(0);!bSelected && a < mpLineEndList->Count(); a++) + { + XLineEndEntry* pEntry = mpLineEndList->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 && mpLineEndList) + { + const basegfx::B2DPolyPolygon& rItemPolygon = mpEndItem->GetLineEndValue(); + for(sal_Int32 a(0);!bSelected && a < mpLineEndList->Count(); a++) + { + XLineEndEntry* pEntry = mpLineEndList->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..5adb139cded9 --- /dev/null +++ b/svx/source/sidebar/line/LinePropertyPanel.hrc @@ -0,0 +1,140 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +// 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 + +#define IMG_WIDTH1_ICON_H 61 +#define IMG_WIDTH2_ICON_H 62 +#define IMG_WIDTH3_ICON_H 63 +#define IMG_WIDTH4_ICON_H 64 +#define IMG_WIDTH5_ICON_H 65 +#define IMG_WIDTH6_ICON_H 66 +#define IMG_WIDTH7_ICON_H 67 +#define IMG_WIDTH8_ICON_H 68 + +//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_LINE1_S 6 +#define IMG_LINE2 7 +#define IMG_LINE2_S 8 +#define IMG_LINE3 9 +#define IMG_LINE3_S 10 +#define IMG_LINE4 11 +#define IMG_LINE4_S 12 +#define IMG_LINE5 13 +#define IMG_LINE5_S 14 +#define IMG_LINE6 15 +#define IMG_LINE6_S 16 +#define IMG_LINE7 17 +#define IMG_LINE7_S 18 +#define IMG_LINE8 19 +#define IMG_LINE8_S 20 +#define IMG_LINE9 21 +#define IMG_LINE9_S 22 +#define IMG_LINE10 23 +#define IMG_LINE10_S 24 +#define IMG_LINE11 25 +#define IMG_LINE11_S 26 + +// #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 + +#define IMG_LINE1_H 43 +#define IMG_LINE2_H 44 +#define IMG_LINE3_H 45 +#define IMG_LINE4_H 46 +#define IMG_LINE5_H 47 +#define IMG_LINE6_H 48 +#define IMG_LINE7_H 49 +#define IMG_LINE8_H 50 +#define IMG_LINE9_H 51 +#define IMG_LINE10_H 52 +#define IMG_LINE11_H 53 + +//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..0a75879c2399 --- /dev/null +++ b/svx/source/sidebar/line/LinePropertyPanel.hxx @@ -0,0 +1,198 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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 "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; + XLineEndList* mpLineEndList; + XDashList* mpLineStyleList; + ::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; + ::boost::scoped_array<Image> mpIMGWidthIconH; //high contrast + + 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, ToolBox*); + 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..acf994c501b2 --- /dev/null +++ b/svx/source/sidebar/line/LinePropertyPanel.src @@ -0,0 +1,614 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "LinePropertyPanel.hrc" +#include <sfx2/sidebar/propertypanel.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";}; + }; + + //high contrast for line width + //WIDTH ICON + Image IMG_WIDTH1_ICON_H + { + ImageBitmap = Bitmap{File = "symphony/width1_h.png";}; + }; + Image IMG_WIDTH2_ICON_H + { + ImageBitmap = Bitmap{File = "symphony/width2_h.png";}; + }; + Image IMG_WIDTH3_ICON_H + { + ImageBitmap = Bitmap{File = "symphony/width3_h.png";}; + }; + Image IMG_WIDTH4_ICON_H + { + ImageBitmap = Bitmap{File = "symphony/width4_h.png";}; + }; + Image IMG_WIDTH5_ICON_H + { + ImageBitmap = Bitmap{File = "symphony/width5_h.png";}; + }; + Image IMG_WIDTH6_ICON_H + { + ImageBitmap = Bitmap{File = "symphony/width6_h.png";}; + }; + Image IMG_WIDTH7_ICON_H + { + ImageBitmap = Bitmap{File = "symphony/width7_h.png";}; + }; + Image IMG_WIDTH8_ICON_H + { + ImageBitmap = Bitmap{File = "symphony/width8_h.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_LINE1_S + { + ImageBitmap = Bitmap{File = "symphony/style_line1_h.png";}; + }; + Image IMG_LINE2 + { + ImageBitmap = Bitmap{File = "symphony/style_line2.png";}; + }; + Image IMG_LINE2_S + { + ImageBitmap = Bitmap{File = "symphony/style_line2_h.png";}; + }; + Image IMG_LINE3 + { + ImageBitmap = Bitmap{File = "symphony/style_line3.png";}; + }; + Image IMG_LINE3_S + { + ImageBitmap = Bitmap{File = "symphony/style_line3_h.png";}; + }; + Image IMG_LINE4 + { + ImageBitmap = Bitmap{File = "symphony/style_line4.png";}; + }; + Image IMG_LINE4_S + { + ImageBitmap = Bitmap{File = "symphony/style_line4_h.png";}; + }; + Image IMG_LINE5 + { + ImageBitmap = Bitmap{File = "symphony/style_line5.png";}; + }; + Image IMG_LINE5_S + { + ImageBitmap = Bitmap{File = "symphony/style_line5_h.png";}; + }; + Image IMG_LINE6 + { + ImageBitmap = Bitmap{File = "symphony/style_line6.png";}; + }; + Image IMG_LINE6_S + { + ImageBitmap = Bitmap{File = "symphony/style_line6_h.png";}; + }; + Image IMG_LINE7 + { + ImageBitmap = Bitmap{File = "symphony/style_line7.png";}; + }; + Image IMG_LINE7_S + { + ImageBitmap = Bitmap{File = "symphony/style_line7_h.png";}; + }; + Image IMG_LINE8 + { + ImageBitmap = Bitmap{File = "symphony/style_line8.png";}; + }; + Image IMG_LINE8_S + { + ImageBitmap = Bitmap{File = "symphony/style_line8_h.png";}; + }; + Image IMG_LINE9 + { + ImageBitmap = Bitmap{File = "symphony/style_line9.png";}; + }; + Image IMG_LINE9_S + { + ImageBitmap = Bitmap{File = "symphony/style_line9_h.png";}; + }; + Image IMG_LINE10 + { + ImageBitmap = Bitmap{File = "symphony/style_line10.png";}; + }; + Image IMG_LINE10_S + { + ImageBitmap = Bitmap{File = "symphony/style_line10_h.png";}; + }; + Image IMG_LINE11 + { + ImageBitmap = Bitmap{File = "symphony/style_line11.png";}; + }; + Image IMG_LINE11_S + { + ImageBitmap = Bitmap{File = "symphony/style_line11_h.png";}; + }; + + //high contrast + Image IMG_LINE1_H + { + ImageBitmap = Bitmap{File = "symphony/style_line1_hh.png";}; + }; + Image IMG_LINE2_H + { + ImageBitmap = Bitmap{File = "symphony/style_line2_hh.png";}; + }; + Image IMG_LINE3_H + { + ImageBitmap = Bitmap{File = "symphony/style_line3_hh.png";}; + }; + Image IMG_LINE4_H + { + ImageBitmap = Bitmap{File = "symphony/style_line4_hh.png";}; + }; + Image IMG_LINE5_H + { + ImageBitmap = Bitmap{File = "symphony/style_line5_hh.png";}; + }; + Image IMG_LINE6_H + { + ImageBitmap = Bitmap{File = "symphony/style_line6_hh.png";}; + }; + Image IMG_LINE7_H + { + ImageBitmap = Bitmap{File = "symphony/style_line7_hh.png";}; + }; + Image IMG_LINE8_H + { + ImageBitmap = Bitmap{File = "symphony/style_line8_hh.png";}; + }; + Image IMG_LINE9_H + { + ImageBitmap = Bitmap{File = "symphony/style_line9_hh.png";}; + }; + Image IMG_LINE10_H + { + ImageBitmap = Bitmap{File = "symphony/style_line10_hh.png";}; + }; + Image IMG_LINE11_H + { + ImageBitmap = Bitmap{File = "symphony/style_line11_hh.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..7400c7cc9f22 --- /dev/null +++ b/svx/source/sidebar/line/LineStyleValueSet.cxx @@ -0,0 +1,134 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "LineStyleValueSet.hxx" + +#include <i18npool/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(); + long nRectWidth = aRect.GetWidth(); + Point aBLPos = aRect.TopLeft(); + if(nItemId == 1) + { + const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + Color aOldFillColor = pDev->GetFillColor(); + const Color aTextColor = rStyleSettings.GetFieldTextColor(); + + //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..fb3bd054fa5d --- /dev/null +++ b/svx/source/sidebar/line/LineStyleValueSet.hxx @@ -0,0 +1,51 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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..01b1bbbbca5e --- /dev/null +++ b/svx/source/sidebar/line/LineWidthControl.cxx @@ -0,0 +1,376 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "LineWidthControl.hxx" +#include "LinePropertyPanel.hrc" +#include "LinePropertyPanel.hxx" + +#include <svx/dialogs.hrc> +#include <svx/dialmgr.hxx> +#include <sfx2/sidebar/propertypanel.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 contract 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) ); + + LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() ); + const sal_Unicode cSep = aLocaleWrapper.getNumDecimalSep().GetChar(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( String::CreateFromDouble( (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..88b614714c0a --- /dev/null +++ b/svx/source/sidebar/line/LineWidthControl.hxx @@ -0,0 +1,75 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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..ba83aba0e196 --- /dev/null +++ b/svx/source/sidebar/line/LineWidthPopup.cxx @@ -0,0 +1,88 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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( + String::CreateFromInt32(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..9b64dae9a086 --- /dev/null +++ b/svx/source/sidebar/line/LineWidthPopup.hxx @@ -0,0 +1,53 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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..67839c250146 --- /dev/null +++ b/svx/source/sidebar/line/LineWidthValueSet.cxx @@ -0,0 +1,196 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "LineWidthValueSet.hxx" + +#include <i18npool/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..da42d4f7ee85 --- /dev/null +++ b/svx/source/sidebar/line/LineWidthValueSet.hxx @@ -0,0 +1,57 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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 100755 index 000000000000..28c7a9bec2de --- /dev/null +++ b/svx/source/sidebar/nbdtmg.cxx @@ -0,0 +1,2101 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ +#include "precompiled_svx.hxx" +#ifndef _NBDTMG_HXX +#include <svx/nbdtmg.hxx> +#endif +#ifndef _SVX_SVXIDS_HRC +#include <svx/svxids.hrc> +#endif +#ifndef _SV_SVAPP_HXX +#include <vcl/svapp.hxx> +#endif +#ifndef _SFXITEMSET_HXX +#include <svl/itemset.hxx> +#endif +#ifndef _SFXREQUEST_HXX +#include <sfx2/request.hxx> +#endif +#ifndef _SFXSTRITEM_HXX +#include <svl/stritem.hxx> +#endif +#ifndef _UNO_LINGU_HXX +#include <editeng/unolingu.hxx> +#endif +#ifndef _CTRLTOOL_HXX +#include <svtools/ctrltool.hxx> +#endif +#ifndef _SFX_OBJSH_HXX +#include <sfx2/objsh.hxx> +#endif +#ifndef _SVX_FLSTITEM_HXX +#include <editeng/flstitem.hxx> +#endif +#ifndef _SFXITEMPOOL_HXX +#include <svl/itempool.hxx> +#endif +#ifndef _SV_OUTDEV_HXX +#include <vcl/outdev.hxx> +#endif +#ifndef _GALLERY_HXX_ +#include <svx/gallery.hxx> +#endif +#ifndef _SVX_BRSHITEM_HXX +#include <editeng/brshitem.hxx> +#endif +#include <svx/dialmgr.hxx> +#ifndef _SVX_DIALOGS_HRC +#include <svx/dialogs.hrc> +#endif +#ifndef _SV_GRAPH_HXX +#include <vcl/graph.hxx> +#endif + +#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 NUM_TYPE_MEMBER 4 +#define NUM_VALUSET_COUNT 16 +#define MAX_VALUESET_GRAPHIC 30 + +typedef NumSettings_Impl* NumSettings_ImplPtr; +SV_DECL_PTRARR_DEL(NumSettingsArr_Impl,NumSettings_ImplPtr,8,4) +SV_IMPL_PTRARR( NumSettingsArr_Impl, NumSettings_ImplPtr ) + +typedef NumberSettings_Impl* NumberSettings_ImplPtr; +SV_DECL_PTRARR_DEL(NumberSettingsArr_Impl,NumberSettings_ImplPtr,8,4) +SV_IMPL_PTRARR( NumberSettingsArr_Impl, NumberSettings_ImplPtr ) + +Font& lcl_GetDefaultBulletFont() +{ + static sal_Bool bInit = 0; + static Font aDefBulletFont( UniString::CreateFromAscii( + RTL_CONSTASCII_STRINGPARAM( "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 = String::CreateFromAscii("%LIST_NUM"); + String sNUM = String::CreateFromInt32( 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.Count();i++) + { + GrfBulDataRelation* pEntry = new GrfBulDataRelation(eNBType::GRAPHICBULLETS); + GrfBulDataRelation* pSrcEntry = (GrfBulDataRelation*)(aTypeMgr.aGrfDataLst.GetObject(i)); + if ( pEntry && pSrcEntry) + { + pEntry->bIsCustomized = pSrcEntry->bIsCustomized; + pEntry->nTabIndex = pSrcEntry->nTabIndex; + pEntry->nGallaryIndex = pSrcEntry->nGallaryIndex; + pEntry->sGrfName = pSrcEntry->sGrfName; + pEntry->sDescription = pSrcEntry->sDescription; + aGrfDataLst.Insert( pEntry, LIST_APPEND ); + } + } +} +void GraphyicBulletsTypeMgr::Init() +{ + List aGrfNames; + GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, aGrfNames); + for(sal_uInt16 i = 0; i < aGrfNames.Count(); i++) + { + String* pGrfNm = (String*) aGrfNames.GetObject(i); + INetURLObject aObj(*pGrfNm); + if(aObj.GetProtocol() == INET_PROT_FILE) + *pGrfNm = aObj.PathToFileName(); + + GrfBulDataRelation* pEntry = new GrfBulDataRelation(eNBType::GRAPHICBULLETS); + pEntry->nTabIndex = i+1; + pEntry->nGallaryIndex = i; + pEntry->sGrfName = *pGrfNm; + + if( i < MAX_VALUESET_GRAPHIC ) + { + pEntry->sDescription = SVX_RESSTR( RID_SVXSTR_GRAPHICS_DESCRIPTIONS + i ); + }else + { + pEntry->sDescription = *pGrfNm; + } + + aGrfDataLst.Insert( pEntry, LIST_APPEND ); + } +} +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.Count();i++) + { + GrfBulDataRelation* pEntry = (GrfBulDataRelation*) aGrfDataLst.GetObject(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.Count() ) + 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 = (GrfBulDataRelation*) aGrfDataLst.GetObject(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 = String::CreateFromAscii("%LIST_NUM"); + String sNUM = String::CreateFromInt32( 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.Count() ) + return sal_False; + + String sGrfName; + GrfBulDataRelation* pEntry = (GrfBulDataRelation*) aGrfDataLst.GetObject(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.Count() ; + + if ( nIndex >= nLength ) + return sRet; + else + { + GrfBulDataRelation* pEntry = (GrfBulDataRelation*) aGrfDataLst.GetObject(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.Count() ; + + if ( nIndex >= nLength ) + return bRet; + else + { + GrfBulDataRelation* pEntry = (GrfBulDataRelation*) aGrfDataLst.GetObject(nIndex); + if ( pEntry ) + { + bRet = pEntry->bIsCustomized; + }; + } + + return bRet; +} +String GraphyicBulletsTypeMgr::GetGrfName(sal_uInt16 nIndex) +{ + String sRet; + if ( nIndex < aGrfDataLst.Count() ) + { + GrfBulDataRelation* pEntry = (GrfBulDataRelation*) aGrfDataLst.GetObject(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(String::CreateFromAscii("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(String::CreateFromAscii("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(String::CreateFromAscii("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(); + //String* pGrfName = (String*)(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 = String::CreateFromAscii("%LIST_NUM"); + String sNUM = String::CreateFromInt32( 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(); + //String* pGrfName = (String*)(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 = String::CreateFromAscii("%LIST_NUM"); + String sNUM = String::CreateFromInt32( 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 = String::CreateFromAscii("%LIST_NUM"); + String sNUM = String::CreateFromInt32( 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 = String::CreateFromAscii("%LIST_NUM"); + String sNUM = String::CreateFromInt32( 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(String::CreateFromAscii("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(String::CreateFromAscii("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(String::CreateFromAscii("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(String::CreateFromAscii("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; + LanguageType eLang = Application::GetSettings().GetLanguage(); + Locale aLocale = SvxCreateLocale(eLang); + 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 += String::CreateFromAscii(" "); + + sText+=String(xFormatter->makeNumberingString( aLevel, aLocale )); + } + catch(Exception&) + { + DBG_ERROR("Exception in DefaultNumberingProvider::makeNumberingString"); + } + } + } + String aStrFromRES(SVX_RESSTR( RID_SVXSTR_SINGLENUM_DESCRIPTIONS)); + String aReplace = String::CreateFromAscii("%NUMBERINGSAMPLE"); + aStrFromRES.SearchAndReplace(aReplace,sText); + pNumEntry->sDescription = aStrFromRES; + } + //End modification + + //pNumEntry->sDescription = SVX_RESSTR( RID_SVXSTR_SINGLENUM_DESCRIPTION_0 + i ); + pNumberSettingsArr->Insert(pNumEntry, pNumberSettingsArr->Count()); + } + } + 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 sSuffix = aFmt.GetSuffix(); + String sEmpty; + sal_Int16 eNumType = aFmt.GetNumberingType(); + + sal_uInt16 nCount = pNumberSettingsArr->Count(); + for(sal_uInt16 i = nFromIndex; i < nCount; i++) + { + NumberSettings_ImplPtr _pSet = pNumberSettingsArr->GetObject(i); + sal_Int16 eNType = _pSet->pNumSetting->nNumberType; + String sLocalPreFix = _pSet->pNumSetting->sPrefix.getStr(); + String sLocalSuffix = _pSet->pNumSetting->sSuffix.getStr(); + if (sPreFix.CompareTo(sLocalPreFix)==COMPARE_EQUAL && + sSuffix.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->Count(); + if ( nIndex >= nCount ) + return sal_False; + + NumberSettings_ImplPtr _pSet = pNumberSettingsArr->GetObject(nIndex); + + _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 = String::CreateFromAscii("%LIST_NUM"); + String sNUM = String::CreateFromInt32( nIndex + 1 ); + aStrFromRES.SearchAndReplace(aReplace,sNUM); + _pSet->sDescription = aStrFromRES; + } else { + _pSet->sDescription = GetDescription(nIndex,true); + } + ImplStore(String::CreateFromAscii("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->Count() <= nIndex) + return sal_False; + NumberSettingsArr_Impl* pCurrentNumberSettingsArr=pNumberSettingsArr; + if (isDefault) pCurrentNumberSettingsArr=pDefaultNumberSettingsArr; + NumberSettings_ImplPtr _pSet = pCurrentNumberSettingsArr->GetObject(nIndex); + 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->Count(); + + if ( nIndex >= nLength ) + return sRet; + else + sRet = pNumberSettingsArr->GetObject(nIndex)->sDescription; + if (isDefault) sRet = pDefaultNumberSettingsArr->GetObject(nIndex)->sDescription; + + return sRet; +} +sal_Bool NumberingTypeMgr::IsCustomized(sal_uInt16 nIndex) +{ + sal_Bool bRet = sal_False; + sal_uInt16 nLength = 0; + nLength = pNumberSettingsArr->Count(); + + if ( nIndex >= nLength ) + bRet = sal_False; + else + bRet = pNumberSettingsArr->GetObject(nIndex)->bIsCustomized; + + return bRet; +} +sal_uInt16 NumberingTypeMgr::GetNumCount() const +{ + sal_uInt16 nRet = 0; + if ( pNumberSettingsArr ) + nRet = pNumberSettingsArr->Count(); + + return nRet; +} +NumberSettings_Impl* NumberingTypeMgr::GetNumSettingByIndex(sal_uInt16 nIndex) const +{ + NumberSettings_Impl* pRet = 0; + if ( pNumberSettingsArr && nIndex< pNumberSettingsArr->Count() ) + { + pRet = pNumberSettingsArr->GetObject(nIndex); + } + + 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(String::CreateFromAscii("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(String::CreateFromAscii("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(String::CreateFromAscii("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; + LanguageType eLang = Application::GetSettings().GetLanguage(); + Locale aLocale = SvxCreateLocale(eLang); + 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->Insert( pNew, pItemArr->pNumSettingsArr->Count() ); + } + } + } + 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->Count(); + for (sal_uInt16 iLevel=0;iLevel < nCount;iLevel++) + { + NumSettings_ImplPtr _pSet = pItemArr->pNumSettingsArr->GetObject(iLevel); + sal_Int16 eNType = _pSet->nNumberType; + const sal_Unicode cLocalPrefix = _pSet->sPrefix.getLength() ? _pSet->sPrefix.getStr()[0] : 0; + const sal_Unicode cLocalSuffix = _pSet->sSuffix.getLength() ? _pSet->sSuffix.getStr()[0] : 0; + + SvxNumberFormat aFmt(aNum.GetLevel(iLevel)); + sal_Unicode cPrefix = rtl::OUString(aFmt.GetPrefix()).getStr()[0]; + sal_Unicode cSuffix = rtl::OUString(aFmt.GetSuffix()).getStr()[0]; + String sPreFix = aFmt.GetPrefix(); + String sSuffix = 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.getStr())==COMPARE_EQUAL) && + ( sSuffix.CompareTo(_pSet->sSuffix.getStr())==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->Count(); + 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->GetObject(iLevel); + + _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 = String::CreateFromAscii("%LIST_NUM"); + String sNUM = String::CreateFromInt32( nIndex + 1 ); + aStrFromRES.SearchAndReplace(aReplace,sNUM); + pItemArr->sDescription = aStrFromRES; + } else { + pItemArr->sDescription = GetDescription(nIndex,true); + } + ImplStore(String::CreateFromAscii("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(); + sal_uInt16 nMask = 1; + for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++) + { + if(pNumSettingsArr->Count() > i) + pLevelSettings = pNumSettingsArr->GetObject(i); + + 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->Count() > 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 100755 index 000000000000..b9f351d53237 --- /dev/null +++ b/svx/source/sidebar/nbdtmgfact.cxx @@ -0,0 +1,51 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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(); + } +} +}} + diff --git a/svx/source/sidebar/paragraph/ParaBulletsControl.cxx b/svx/source/sidebar/paragraph/ParaBulletsControl.cxx new file mode 100755 index 000000000000..5f14ad2af101 --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaBulletsControl.cxx @@ -0,0 +1,145 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "precompiled_svx.hxx" +#include "ParaBulletsControl.hxx" +#include "ParaPropertyPanel.hrc" +#include <sfx2/sidebar/propertypanel.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)), + mrParaPropertyPanel(rPanel), + mpBindings(NULL), + maBulletsVS(this,SVX_RES(VS_VALUES)), + maFISep(this,SVX_RES(IMG_SEPERATOR_BULLET)), + maMoreButton(this,SVX_RES(CB_BULLET_MORE)) +{ + 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 contract + 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 100755 index 000000000000..b7e535175c19 --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaBulletsControl.hxx @@ -0,0 +1,61 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ +#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 100755 index 000000000000..088a231c3f0c --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaBulletsPopup.cxx @@ -0,0 +1,63 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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 100755 index 000000000000..c32ec8adb18f --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaBulletsPopup.hxx @@ -0,0 +1,53 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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 100755 index 000000000000..773af4ad1ad5 --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx @@ -0,0 +1,819 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "precompiled_svx.hxx" +#include "ParaLineSpacingControl.hxx" +#include "ParaPropertyPanel.hrc" +#include <sfx2/sidebar/propertypanel.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)) +, mrParaPropertyPanel(rPanel) +, mpBindings(NULL) +,aLineDist ( this, SVX_RES( LB_LINE_SPACING )), +aLineDistAtPercentBox ( this, SVX_RES( ED_SBINDE_LINEDISTPERCENT ) ), +aLineDistAtMetricBox ( this, SVX_RES( ED_SBINDE_LINEDISTPOINT ) ), +maCustomFT ( this, SVX_RES( FT_CUSTOM ) ), +maLSpacingFT ( this, SVX_RES( FT_LINE_SPACING ) ), +maOfFT ( this, SVX_RES( FT_OF ) ), +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)), +maImgCusGrey (SVX_RES(IMG_CUSTOM_GRAY)), +maImgCus (SVX_RES(IMG_CUSTOM)), +maStrCus (SVX_RES(STR_LCVALUE)), +pActLineDistFld ( &aLineDistAtPercentBox ), +nMinFixDist ( BEGIN_VALUE ), +maValue ( 0 ), +maPos ( 0 ), +maLineSpacing (ValueSetWithTextControl::IMAGE_TEXT,this, SVX_RES( LINE_SPACING ) ), +mpImg (NULL), +mpImgSel (NULL), +mpStr (NULL), +mpStrTip (NULL), +maLine (SVX_RES(STR_LSPACING)), +maOf (SVX_RES(STR_LS_OF)) +, mbUseLineSPCustom (0) +, mbLineSPDisable (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( String::CreateFromInt64( 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( String::CreateFromInt64( 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( String::CreateFromInt64( maValue )); + break; + case LLINESPACE_MIN: + sHelpText += maLine; + sHelpText.Append(String("At Least: ", 10, RTL_TEXTENCODING_ASCII_US)); + sHelpText += maOf; + sHelpText.Append( String::CreateFromInt64( maValue )); + break; + case LLINESPACE_DURCH: + sHelpText += maLine; + sHelpText.Append(String("Leading: ", 9, RTL_TEXTENCODING_ASCII_US)); + sHelpText += maOf; + sHelpText.Append( String::CreateFromInt64( maValue )); + break; + case LLINESPACE_FIX: + sHelpText += maLine; + sHelpText.Append(String("Fixed: ", 7, RTL_TEXTENCODING_ASCII_US)); + sHelpText += maOf; + sHelpText.Append( String::CreateFromInt64( 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; + } + } + 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; + } + } + 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(String::CreateFromAscii("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().Len() ) + 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().Len() ) + aLineDistAtMetricBox.SetValue( + aLineDistAtMetricBox.Normalize( 0 ), FUNIT_TWIP ); + aLineDistAtPercentBox.Hide(); + pActLineDistFld->Show(); + pActLineDistFld->Enable(); + break; + + case LLINESPACE_PROP: + aLineDistAtMetricBox.Hide(); + pActLineDistFld = &aLineDistAtPercentBox; + + if ( !aLineDistAtPercentBox.GetText().Len() ) + 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( ParaLineSpacingControl, LineSPDistAtHdl_Impl, MetricField*, pBox ) +{ + 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: + DBG_ERROR( "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(); + short nKern = 0; + long nVal = 0; + 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 100755 index 000000000000..51d3d80b7353 --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx @@ -0,0 +1,116 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ +#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, MetricField*); + DECL_LINK(VSSelHdl, void*); +}; +}} + +#endif + diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx b/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx new file mode 100755 index 000000000000..7edf768df509 --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx @@ -0,0 +1,82 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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 100755 index 000000000000..5d8f7bb071c6 --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaLineSpacingPopup.hxx @@ -0,0 +1,53 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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 100755 index 000000000000..167e4fb88bab --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaNumberingControl.cxx @@ -0,0 +1,171 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "precompiled_svx.hxx" +#include "ParaNumberingControl.hxx" +#include "ParaPropertyPanel.hrc" +#include <sfx2/sidebar/propertypanel.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; + LanguageType eLang = GetSettings().GetLanguage(); + Locale aLocale = SvxCreateLocale(eLang); + 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 contract + 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 100755 index 000000000000..2e534c691886 --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaNumberingControl.hxx @@ -0,0 +1,65 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ +#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 100755 index 000000000000..a65ea223cc7a --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaNumberingPopup.cxx @@ -0,0 +1,64 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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 100755 index 000000000000..d4dbaa693c79 --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaNumberingPopup.hxx @@ -0,0 +1,54 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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 100755 index 000000000000..b12baf5d89ac --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx @@ -0,0 +1,1686 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "precompiled_svx.hxx" +#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/propertypanel.hrc> +#include <sfx2/sidebar/ControlFactory.hxx> +#include <svx/sidebar/PopupContainer.hxx> +#include <sfx2/dispatch.hxx> +#include <editeng/colritem.hxx> +#include <editeng/brshitem.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 NEGATIVE_MAX_VALUE -9999 +#define BEGIN_VALUE 28 +#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)) + +#define LINE_POINT1_WHITE Point(LogicToPixel(Point(LINE_X_WHITE,LINE_TOP_Y), MAP_APPFONT)) +#define LINE_POINT2_WHITE Point(LogicToPixel(Point(LINE_X_WHITE,LINE_BOT_Y), MAP_APPFONT)) +#define LINE_POINT3_WHITE Point(LogicToPixel(Point(LINE_X_WHITE,LINE_TOP_Y2), MAP_APPFONT)) +#define LINE_POINT4_WHITE Point(LogicToPixel(Point(LINE_X_WHITE,LINE_BOT_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( ParaPropertyPanel, ModifyIndentHdl_Impl, SvxRelativeField*, pBox ) +{ + 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( ParaPropertyPanel, ULSpaceHdl_Impl, SvxRelativeField*, pBox ) +{ + 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 100755 index 000000000000..168df5f5517c --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.hrc @@ -0,0 +1,378 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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 BMP_BULLET_MORE_H 6 +#define IMG_SEPERATOR_BULLET 7 + +#define VS_NUMBERING 10 +#define CB_NUMBERING_MORE 12 +#define BMP_NUMERING_MORE 13 +#define BMP_NUMERING_MORE_H 14 +#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
\ No newline at end of file diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx new file mode 100755 index 000000000000..f8f28b2d4076 --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx @@ -0,0 +1,290 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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, SvxRelativeField*); + DECL_LINK(ClickIndent_IncDec_Hdl_Impl, ToolBox*); + DECL_LINK(ClickProDemote_Hdl_Impl, ToolBox*); + DECL_LINK(ULSpaceHdl_Impl, SvxRelativeField*); + 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 100755 index 000000000000..926e3a6f5fa3 --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.src @@ -0,0 +1,982 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "ParaPropertyPanel.hrc" +#include <sfx2/sidebar/propertypanel.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"; + }; + Bitmap BMP_BULLET_MORE_H + { + File = "symphony/__morebutton_h.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"; + }; + Bitmap BMP_NUMERING_MORE_H + { + File = "symphony/__morebutton_h.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"; +};
\ No newline at end of file diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx new file mode 100644 index 000000000000..23df38c34cf4 --- /dev/null +++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx @@ -0,0 +1,1229 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include <sfx2/sidebar/propertypanel.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") +#define NO_SELECT (65535) + + + +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 = Max( GetCoreValue( *mpMtrWidth, mePoolUnit ), 1L ); + mlOldHeight = Max( GetCoreValue( *mpMtrHeight, mePoolUnit ), 1L ); + } + + // mpCbxScale must synchronized with that on Position and Size tabpage on Shape Properties dialog + SvtViewOptions aPageOpt( E_TABPAGE, String::CreateFromInt32( RID_SVXPAGE_POSITION_SIZE ) ); + aPageOpt.SetUserItem( USERITEM_NAME, ::com::sun::star::uno::makeAny( ::rtl::OUString( String::CreateFromInt32( mpCbxScale->IsChecked() ) ) ) ); + + return 0; +} + + + +IMPL_LINK( PosSizePropertyPanel, AngleModifiedHdl, void *, EMPTYARG ) +{ + String sTmp = mpMtrAngle->GetText(); + bool bNegative = 0; + sal_Unicode nChar = sTmp.GetChar( 0 ); + + if( nChar == '-' ) + { + bNegative = 1; + nChar = sTmp.GetChar( 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, String::CreateFromInt32( 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; + String sNull = String::CreateFromAscii(""); + meDlgUnit = GetCurrentUnit(eState,pState); + + if( mpMtrPosX->GetText() == sNull ) + bPosXBlank = true; + SetFieldUnit( *mpMtrPosX, meDlgUnit, true ); + if(bPosXBlank) + mpMtrPosX->SetText(String()); + + if( mpMtrPosY->GetText() == sNull ) + bPosYBlank = true; + SetFieldUnit( *mpMtrPosY, meDlgUnit, true ); + if(bPosYBlank) + mpMtrPosY->SetText(String()); + + if( mpMtrWidth->GetText() == sNull ) + bWidthBlank = true; + SetFieldUnit( *mpMtrWidth, meDlgUnit, true ); + if(bWidthBlank) + mpMtrWidth->SetText(String()); + + if( mpMtrHeight->GetText() == sNull ) + 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..eb0846808183 --- /dev/null +++ b/svx/source/sidebar/possize/PosSizePropertyPanel.hrc @@ -0,0 +1,108 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +// 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..ca3f5ad3aef8 --- /dev/null +++ b/svx/source/sidebar/possize/PosSizePropertyPanel.hxx @@ -0,0 +1,182 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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..a6b062126bec --- /dev/null +++ b/svx/source/sidebar/possize/PosSizePropertyPanel.src @@ -0,0 +1,227 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "PosSizePropertyPanel.hrc" +#include <sfx2/sidebar/propertypanel.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..14be83e70d22 --- /dev/null +++ b/svx/source/sidebar/possize/SidebarDialControl.cxx @@ -0,0 +1,86 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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..f1a77897f50a --- /dev/null +++ b/svx/source/sidebar/possize/SidebarDialControlBmp.cxx @@ -0,0 +1,94 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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( + sfx2::sidebar::Theme::IsHighContrastMode() + ? SVX_RES(IMG_DIACONTROL_H) + : SVX_RES(IMG_DIACONTROL_NORMAL)); + // 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..80ebcfb1816d --- /dev/null +++ b/svx/source/sidebar/possize/SidebarDialControlBmp.hxx @@ -0,0 +1,47 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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..92fcb41997c6 --- /dev/null +++ b/svx/source/sidebar/text/SvxSBFontNameBox.cxx @@ -0,0 +1,178 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "precompiled_svx.hxx" + +#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 ); + EnableSymbols( 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..ac06cbcbe50f --- /dev/null +++ b/svx/source/sidebar/text/SvxSBFontNameBox.hxx @@ -0,0 +1,80 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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..a99ffdb78d91 --- /dev/null +++ b/svx/source/sidebar/text/TextCharacterSpacingControl.cxx @@ -0,0 +1,468 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "precompiled_svx.hxx" +#include "TextCharacterSpacingControl.hxx" +#include "TextPropertyPanel.hrc" +#include <sfx2/sidebar/propertypanel.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( String::CreateFromDouble( (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( String::CreateFromDouble( (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..df2f9eb7ced4 --- /dev/null +++ b/svx/source/sidebar/text/TextCharacterSpacingControl.hxx @@ -0,0 +1,96 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ +#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..4d44757b3749 --- /dev/null +++ b/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx @@ -0,0 +1,79 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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( String::CreateFromInt32( 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..7d02dab3d500 --- /dev/null +++ b/svx/source/sidebar/text/TextCharacterSpacingPopup.hxx @@ -0,0 +1,48 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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..cf776324d26e --- /dev/null +++ b/svx/source/sidebar/text/TextPropertyPanel.cxx @@ -0,0 +1,1591 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "precompiled_svx.hxx" + +#include "TextPropertyPanel.hrc" +#include "TextPropertyPanel.hxx" +#include "SvxSBFontNameBox.hxx" + +#include "svx/dialmgr.hxx" + +#include <editeng/brshitem.hxx> +#include <editeng/colritem.hxx> +#include <editeng/crsditem.hxx> +#include <editeng/escpitem.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/propertypanel.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 FONT_CONTROL_WIDTH 160 +#define SIZE_CONTROL_WIDTH 80 +#define CONTROL_COMBOX_HEIGHT 20 +#define CONTROL_HEIGHT_5X 120 + + +#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))), + maCharSpacePopup(this, ::boost::bind(&TextPropertyPanel::CreateCharacterSpacingControl, this, _1)), + maFontColorPopup(this, ::boost::bind(&TextPropertyPanel::CreateFontColorPopupControl, this, _1)), + maBrushColorPopup(this, ::boost::bind(&TextPropertyPanel::CreateBrushColorPopupControl, this, _1)), + maUnderlinePopup(this, ::boost::bind(&TextPropertyPanel::CreateUnderlinePopupControl, this, _1)), + 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)), + + maImgIncreaseHigh (SVX_RES( IMG_INCREASE_H )), + maImgDecreaseHigh (SVX_RES( IMG_DECREASE_H )), + maImgBoldHigh (SVX_RES( IMG_BOLD_H )), + maImgItalicHigh (SVX_RES( IMG_ITALIC_H )), + maImgUnderlineHigh (SVX_RES( IMG_UNDERLINE_H )), + maImgStrikeHigh (SVX_RES( IMG_STRIKEOUT_H )), + maImgShadowHigh (SVX_RES( IMG_SHADOWED_H )), + maImgFontColorHigh (SVX_RES( IMG_FONTCOLOR_H)), + maImgSupScriptHigh (SVX_RES( IMG_SUPSCRIPT_H)), + maImgSubScriptHigh (SVX_RES( IMG_SUBSCRIPT_H)), + maImgHighlightHigh (SVX_RES( IMG_HIGHLIGHT_H)), + + mpFontList (NULL), + mbMustDelete (false), + mbFocusOnFontSizeCtrl(false), + 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, Theme::IsHighContrastMode()); +} + + +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( String::CreateFromAscii( "" ), String::CreateFromAscii( "" ))); + 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, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgIncreaseHigh : maImgIncrease); + mpToolBoxIncDec->SetItemImage(TBI_DECREASE, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgDecreaseHigh : maImgDecrease); + mpToolBoxFont->SetItemImage(TBI_BOLD, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgBoldHigh : maImgBold); + mpToolBoxFont->SetItemImage(TBI_ITALIC, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgItalicHigh : maImgItalic); + mpToolBoxFont->SetItemImage(TBI_UNDERLINE, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgUnderlineHigh : maImgUnderline); + mpToolBoxFont->SetItemImage(TBI_STRIKEOUT, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgStrikeHigh : maImgStrike); + mpToolBoxFont->SetItemImage(TBI_SHADOWED, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgShadowHigh : maImgShadow); + + mpToolBoxFontColor->SetItemImage(TBI_FONTCOLOR, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgFontColorHigh : maImgFontColor); + //for sw + mpToolBoxScriptSw->SetItemImage(TBI_SUPER_SW, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgSupScriptHigh : maImgSupScript); + mpToolBoxScriptSw->SetItemImage(TBI_SUB_SW, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgSubScriptHigh : maImgSubScript); + //for sc and sd + mpToolBoxScript->SetItemImage(TBI_SUPER, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgSupScriptHigh : maImgSupScript); + mpToolBoxScript->SetItemImage(TBI_SUB, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgSubScriptHigh : maImgSubScript); + mpToolBoxSpacing->SetItemImage(TBI_SPACING, maImgNormalIcon); + mpToolBoxHighlight->SetItemImage(TBI_HIGHLIGHT, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgHighlightHigh : 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..4d1ea4715df5 --- /dev/null +++ b/svx/source/sidebar/text/TextPropertyPanel.hrc @@ -0,0 +1,227 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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_INCREASE_H 12 +#define IMG_DECREASE 13 +#define IMG_DECREASE_H 14 +#define IMG_BOLD 15 +#define IMG_BOLD_H 16 +#define IMG_ITALIC 17 +#define IMG_ITALIC_H 18 +#define IMG_UNDERLINE 19 +#define IMG_UNDERLINE_H 20 +#define IMG_STRIKEOUT 21 +#define IMG_STRIKEOUT_H 22 +#define IMG_SHADOWED 23 +#define IMG_SHADOWED_H 24 +#define IMG_FONTCOLOR 25 +#define IMG_FONTCOLOR_H 26 +#define IMG_SUPSCRIPT 27 +#define IMG_SUPSCRIPT_H 28 +#define IMG_SUBSCRIPT 29 +#define IMG_SUBSCRIPT_H 30 +//#define IMG_SPACING 31 +//#define IMG_SPACING_H 32 +#define IMG_HIGHLIGHT 33 +#define IMG_HIGHLIGHT_H 34 + +#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 BMP_UNDERLINE_MORE_H 4 + +#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_H 30 +#define IMG_DOUBLE_H 31 +#define IMG_BOLD2_H 32 +#define IMG_DOT_H 33 +#define IMG_DOT_BOLD_H 34 +#define IMG_DASH_H 35 +#define IMG_DASH_LONG_H 36 +#define IMG_DASH_DOT_H 37 +#define IMG_DASH_DOT_DOT_H 38 +#define IMG_WAVE_H 39 + +#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..05a9c8889f6e --- /dev/null +++ b/svx/source/sidebar/text/TextPropertyPanel.hxx @@ -0,0 +1,246 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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; + + Image maImgIncreaseHigh; + Image maImgDecreaseHigh; + Image maImgBoldHigh; + Image maImgItalicHigh; + Image maImgUnderlineHigh; + Image maImgStrikeHigh; + Image maImgShadowHigh; + Image maImgFontColorHigh; + Image maImgSupScriptHigh; + Image maImgSubScriptHigh; + Image maImgHighlightHigh; + + 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..b492a9005b71 --- /dev/null +++ b/svx/source/sidebar/text/TextPropertyPanel.src @@ -0,0 +1,801 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "TextPropertyPanel.hrc" +#include <sfx2/sidebar/propertypanel.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_INCREASE_H + { + ImageBitmap = Bitmap{File = "symphony/enlarge font.png";}; + }; + Image IMG_DECREASE + { + ImageBitmap = Bitmap{File = "symphony/decrease font.png";}; + }; + Image IMG_DECREASE_H + { + ImageBitmap = Bitmap{File = "symphony/decrease font.png";}; + }; + Image IMG_BOLD + { + ImageBitmap = Bitmap{File = "symphony/sc_bold.png";};//sc_bold.bmp + }; + Image IMG_BOLD_H + { + ImageBitmap = Bitmap{File = "symphony/sc_bold.png";}; + }; + Image IMG_ITALIC + { + ImageBitmap = Bitmap{File = "symphony/sc_italic.png";};//sc_italic.bmp + }; + Image IMG_ITALIC_H + { + ImageBitmap = Bitmap{File = "symphony/sc_italic.png";}; + }; + Image IMG_UNDERLINE + { + ImageBitmap = Bitmap{File = "symphony/sc_underline.png";};//sc_underline.png + }; + Image IMG_UNDERLINE_H + { + ImageBitmap = Bitmap{File = "symphony/sc_underline.png";}; + }; + + Image IMG_STRIKEOUT + { + ImageBitmap = Bitmap{File = "symphony/sc_strikeout.png";};//sc_strikeout.png + }; + Image IMG_STRIKEOUT_H + { + ImageBitmap = Bitmap{File = "symphony/sc_strikeout.png";}; + }; + Image IMG_SHADOWED + { + ImageBitmap = Bitmap{File = "symphony/sc_shadowed.png";};//sc_shadowed.png + }; + Image IMG_SHADOWED_H + { + ImageBitmap = Bitmap{File = "symphony/sc_shadowed.png";}; + }; + Image IMG_FONTCOLOR + { + ImageBitmap = Bitmap{File = "symphony/sc_color.png";}; + }; + Image IMG_FONTCOLOR_H + { + ImageBitmap = Bitmap{File = "symphony/sc_color.png";}; + }; + Image IMG_SUPSCRIPT + { + ImageBitmap = Bitmap{File = "symphony/sc_superscript.png";}; + }; + Image IMG_SUPSCRIPT_H + { + ImageBitmap = Bitmap{File = "symphony/sc_superscript.png";}; + }; + Image IMG_SUBSCRIPT + { + ImageBitmap = Bitmap{File = "symphony/sc_subscript.png";}; + }; + Image IMG_SUBSCRIPT_H + { + ImageBitmap = Bitmap{File = "symphony/sc_subscript.png";}; + }; +// Image IMG_SPACING +// { +// ImageBitmap = Bitmap{File = "symphony/icon_normal.png";}; +// }; +// Image IMG_SPACING_H +// { +// ImageBitmap = Bitmap{File = "symphony/icon_normal.png";}; +// }; + Image IMG_HIGHLIGHT + { + ImageBitmap = Bitmap{File = "symphony/Highlight.png";};//sc_backcolor + }; + Image IMG_HIGHLIGHT_H + { + ImageBitmap = Bitmap{File = "symphony/Highlight.png";}; + }; + + //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";}; + }; + + //high contract + Image IMG_SINGLE_H + { + ImageBitmap = Bitmap{File = "symphony/line1_h.bmp";}; + }; + Image IMG_DOUBLE_H + { + ImageBitmap = Bitmap{File = "symphony/line2_h.bmp";}; + }; + Image IMG_BOLD2_H + { + ImageBitmap = Bitmap{File = "symphony/line3_h.bmp";}; + }; + Image IMG_DOT_H + { + ImageBitmap = Bitmap{File = "symphony/line4_h.bmp";}; + }; + Image IMG_DOT_BOLD_H + { + ImageBitmap = Bitmap{File = "symphony/line5_h.bmp";}; + }; + Image IMG_DASH_H + { + ImageBitmap = Bitmap{File = "symphony/line6_h.bmp";}; + }; + Image IMG_DASH_LONG_H + { + ImageBitmap = Bitmap{File = "symphony/line7_h.bmp";}; + }; + Image IMG_DASH_DOT_H + { + ImageBitmap = Bitmap{File = "symphony/line8_h.bmp";}; + }; + Image IMG_DASH_DOT_DOT_H + { + ImageBitmap = Bitmap{File = "symphony/line9_h.bmp";}; + }; + Image IMG_WAVE_H + { + ImageBitmap = Bitmap{File = "symphony/line10_h.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"; +// }; +// Bitmap BMP_UNDERLINE_MORE_H +// { +// File = "symphony/morebutton_h.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..5ab48be6808e --- /dev/null +++ b/svx/source/sidebar/text/TextUnderlineControl.cxx @@ -0,0 +1,281 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "precompiled_svx.hxx" +#include "TextUnderlineControl.hxx" +#include "TextPropertyPanel.hrc" +#include <sfx2/sidebar/propertypanel.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)) + +// high contrast +, maIMGSingleH (SVX_RES(IMG_SINGLE_H)) +, maIMGDoubleH (SVX_RES(IMG_DOUBLE_H)) +, maIMGBoldH (SVX_RES(IMG_BOLD2_H)) +, maIMGDotH (SVX_RES(IMG_DOT_H)) +, maIMGDotBoldH (SVX_RES(IMG_DOT_BOLD_H)) +, maIMGDashH (SVX_RES(IMG_DASH_H)) +, maIMGDashLongH (SVX_RES(IMG_DASH_LONG_H)) +, maIMGDashDotH (SVX_RES(IMG_DASH_DOT_H)) +, maIMGDashDotDotH(SVX_RES(IMG_DASH_DOT_DOT_H)) +, maIMGWaveH (SVX_RES(IMG_WAVE_H)) + +, 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 contract + 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, GetDisplayBackground().GetColor().IsDark()? maIMGSingleH :maIMGSingle); + maVSUnderline.SetItemImage(2, GetDisplayBackground().GetColor().IsDark()? maIMGDoubleH : maIMGDouble ); + maVSUnderline.SetItemImage(3, GetDisplayBackground().GetColor().IsDark()? maIMGBoldH : maIMGBold); + maVSUnderline.SetItemImage(4, GetDisplayBackground().GetColor().IsDark()? maIMGDotH : maIMGDot); + maVSUnderline.SetItemImage(5, GetDisplayBackground().GetColor().IsDark()? maIMGDotBoldH :maIMGDotBold); + maVSUnderline.SetItemImage(6, GetDisplayBackground().GetColor().IsDark()? maIMGDashH :maIMGDash); + maVSUnderline.SetItemImage(7, GetDisplayBackground().GetColor().IsDark()? maIMGDashLongH : maIMGDashLong); + maVSUnderline.SetItemImage(8, GetDisplayBackground().GetColor().IsDark()? maIMGDashDotH : maIMGDashDot); + maVSUnderline.SetItemImage(9, GetDisplayBackground().GetColor().IsDark()? maIMGDashDotDotH : maIMGDashDotDot); + maVSUnderline.SetItemImage(10, GetDisplayBackground().GetColor().IsDark()? maIMGWaveH : 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..a579934f0fad --- /dev/null +++ b/svx/source/sidebar/text/TextUnderlineControl.hxx @@ -0,0 +1,94 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ +#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; + + //add for high contract + Image maIMGSingleH; + Image maIMGDoubleH; + Image maIMGBoldH; + Image maIMGDotH; + Image maIMGDotBoldH; + Image maIMGDashH; + Image maIMGDashLongH; + Image maIMGDashDotH; + Image maIMGDashDotDotH; + Image maIMGWaveH; + + 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..307eda3909aa --- /dev/null +++ b/svx/source/sidebar/text/TextUnderlinePopup.cxx @@ -0,0 +1,60 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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..8343590e02bc --- /dev/null +++ b/svx/source/sidebar/text/TextUnderlinePopup.hxx @@ -0,0 +1,47 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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..6fece95f6651 --- /dev/null +++ b/svx/source/sidebar/tools/ColorControl.cxx @@ -0,0 +1,228 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "precompiled_svx.hxx" + +#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 */} + }; + ::boost::shared_ptr<XColorList> 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) + { + XColorList* pTable = ((SvxColorTableItem*)pItem)->GetColorTable(); + if (pTable != NULL) + return ::boost::shared_ptr<XColorList>(pTable, JustReleaseDeleter()); + } + } + + return ::boost::shared_ptr<XColorList>(new XColorList(SvtPathOptions().GetPalettePath())); + } +} // 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) +{ + ::boost::shared_ptr<XColorList> pColorTable (GetColorTable()); + + if (pColorTable) + { + const long nColorCount (pColorTable->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 = pColorTable->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.Equals(String::CreateFromAscii(""))) + { + 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..7d1d2103709a --- /dev/null +++ b/svx/source/sidebar/tools/ColorPopup.cxx @@ -0,0 +1,60 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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..f9d6661f8e0c --- /dev/null +++ b/svx/source/sidebar/tools/Popup.cxx @@ -0,0 +1,148 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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..513fbb163396 --- /dev/null +++ b/svx/source/sidebar/tools/PopupContainer.cxx @@ -0,0 +1,57 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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..a499457fb7d5 --- /dev/null +++ b/svx/source/sidebar/tools/PopupControl.cxx @@ -0,0 +1,62 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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..c2e51b052f41 --- /dev/null +++ b/svx/source/sidebar/tools/ValueSetWithTextControl.cxx @@ -0,0 +1,529 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#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 <i18npool/mslangid.hxx> +#include <svtools/valueset.hxx> +#include <editeng/brshitem.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( UniString::CreateFromAscii( + RTL_CONSTASCII_STRINGPARAM( "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; +} + +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_uInt32 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 aFont = pDev->GetFont(); + Size aSize = aFont.GetSize(); + aSize.Height() = nRectHeight/4; + aFont.SetSize( aSize ); + pDev->SetFont(aFont); + 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 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 diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx index 392fa5327490..4d7e66ce3442 100644 --- a/svx/source/svdraw/svdedtv1.cxx +++ b/svx/source/svdraw/svdedtv1.cxx @@ -55,6 +55,9 @@ #include <svx/sdr/contact/viewcontact.hxx> #include <svx/e3dsceneupdater.hxx> #include <svx/obj3d.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <svx/AffineMatrixItem.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -249,23 +252,77 @@ void SdrEditView::ResizeMarkedObj(const Point& rRef, const Fraction& xFact, cons if( bUndo ) EndUndo(); } - -long SdrEditView::GetMarkedObjRotate() const +void SdrEditView::ResizeMultMarkedObj(const Point& rRef, + const Fraction& xFact, + const Fraction& yFact, + const bool bCopy, + const bool bWdh, + const bool bHgt) { - sal_Bool b1st=sal_True; - sal_Bool bOk=sal_True; - long nWink=0; + const bool bUndo = IsUndoEnabled(); + if( bUndo ) + { + XubString aStr; + ImpTakeDescriptionStr(STR_EditResize,aStr); + if (bCopy) + aStr+=ImpGetResStr(STR_EditWithCopy); + BegUndo(aStr); + } + + if (bCopy) + CopyMarkedObj(); + sal_uIntPtr nMarkAnz=GetMarkedObjectCount(); - for (sal_uIntPtr nm=0; nm<nMarkAnz && bOk; nm++) { + for (sal_uIntPtr nm=0; nm<nMarkAnz; nm++) + { SdrMark* pM=GetSdrMarkByIndex(nm); SdrObject* pO=pM->GetMarkedSdrObj(); - long nWink2=pO->GetRotateAngle(); - if (b1st) nWink=nWink2; - else if (nWink2!=nWink) bOk=sal_False; - b1st=sal_False; + if( bUndo ) + { + std::vector< SdrUndoAction* > vConnectorUndoActions( CreateConnectorUndo( *pO ) ); + AddUndoActions( vConnectorUndoActions ); + AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO)); + } + + Fraction aFrac(1,1); + if (bWdh && bHgt) + pO->Resize(rRef, xFact, yFact); + else if (bWdh) + pO->Resize(rRef, xFact, aFrac); + else if (bHgt) + pO->Resize(rRef, aFrac, yFact); } - if (!bOk) nWink=0; - return nWink; + if( bUndo ) + EndUndo(); +} + +long SdrEditView::GetMarkedObjRotate() const +{ + long nRetval(0); + + if(GetMarkedObjectCount()) + { + SdrMark* pM = GetSdrMarkByIndex(0); + SdrObject* pO = pM->GetMarkedSdrObj(); + + nRetval = pO->GetRotateAngle(); + } + + return nRetval; + //sal_Bool b1st=sal_True; + //sal_Bool bOk=sal_True; + //long nWink=0; + //sal_uIntPtr nMarkAnz=GetMarkedObjectCount(); + //for (sal_uIntPtr nm=0; nm<nMarkAnz && bOk; nm++) { + // SdrMark* pM=GetSdrMarkByIndex(nm); + // SdrObject* pO=pM->GetMarkedSdrObj(); + // long nWink2=pO->GetRotateAngle(); + // if (b1st) nWink=nWink2; + // else if (nWink2!=nWink) bOk=sal_False; + // b1st=sal_False; + //} + //if (!bOk) nWink=0; + //return nWink; } void SdrEditView::RotateMarkedObj(const Point& rRef, long nWink, bool bCopy) @@ -1196,11 +1253,13 @@ sal_Bool SdrEditView::SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRe SfxItemSet SdrEditView::GetGeoAttrFromMarked() const { SfxItemSet aRetSet(pMod->GetItemPool(), // SID_ATTR_TRANSFORM_... aus s:svxids.hrc - SID_ATTR_TRANSFORM_POS_X,SID_ATTR_TRANSFORM_ANGLE, - SID_ATTR_TRANSFORM_PROTECT_POS,SID_ATTR_TRANSFORM_AUTOHEIGHT, - SDRATTR_ECKENRADIUS,SDRATTR_ECKENRADIUS, - 0); - if (AreObjectsMarked()) { + SID_ATTR_TRANSFORM_POS_X, SID_ATTR_TRANSFORM_ANGLE, + SID_ATTR_TRANSFORM_PROTECT_POS, SID_ATTR_TRANSFORM_AUTOHEIGHT, + SDRATTR_ECKENRADIUS, SDRATTR_ECKENRADIUS, + 0); + + if (AreObjectsMarked()) + { SfxItemSet aMarkAttr(GetAttrFromMarked(sal_False)); // wg. AutoGrowHeight und Eckenradius Rectangle aRect(GetMarkedObjRect()); @@ -1262,7 +1321,8 @@ SfxItemSet SdrEditView::GetGeoAttrFromMarked() const sal_Bool bSizProt=pObj->IsResizeProtect(); sal_Bool bPosProtDontCare=sal_False; sal_Bool bSizProtDontCare=sal_False; - for (sal_uIntPtr i=1; i<nMarkCount && (!bPosProtDontCare || !bSizProtDontCare); i++) { + for (sal_uIntPtr i=1; i<nMarkCount && (!bPosProtDontCare || !bSizProtDontCare); i++) + { pObj=rMarkList.GetMark(i)->GetMarkedSdrObj(); if (bPosProt!=pObj->IsMoveProtect()) bPosProtDontCare=sal_True; if (bSizProt!=pObj->IsResizeProtect()) bSizProtDontCare=sal_True; @@ -1304,7 +1364,48 @@ SfxItemSet SdrEditView::GetGeoAttrFromMarked() const aRetSet.Put(SdrEckenradiusItem(nRadius)); } + basegfx::B2DHomMatrix aTransformation; + + if(nMarkCount > 1) + { + // multiple objects, range is collected in aRect + aTransformation = basegfx::tools::createScaleTranslateB2DHomMatrix( + aRect.Left(), aRect.Top(), + aRect.getWidth(), aRect.getHeight()); + } + else if(pObj) + { + // single object, get homogen transformation + basegfx::B2DPolyPolygon aPolyPolygon; + + pObj->TRGetBaseGeometry(aTransformation, aPolyPolygon); + } + + if(aTransformation.isIdentity()) + { + aRetSet.InvalidateItem(SID_ATTR_TRANSFORM_MATRIX); + } + else + { + com::sun::star::geometry::AffineMatrix2D aAffineMatrix2D; + Point aPageOffset(0, 0); + + if(GetSdrPageView()) + { + aPageOffset = GetSdrPageView()->GetPageOrigin(); + } + + aAffineMatrix2D.m00 = aTransformation.get(0, 0); + aAffineMatrix2D.m01 = aTransformation.get(0, 1); + aAffineMatrix2D.m02 = aTransformation.get(0, 2) - aPageOffset.X(); + aAffineMatrix2D.m10 = aTransformation.get(1, 0); + aAffineMatrix2D.m11 = aTransformation.get(1, 1); + aAffineMatrix2D.m12 = aTransformation.get(1, 2) - aPageOffset.Y(); + + aRetSet.Put(AffineMatrixItem(&aAffineMatrix2D)); + } } + return aRetSet; } @@ -1373,6 +1474,7 @@ void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& rAttr) sal_Bool bChgPos=sal_False; sal_Bool bChgSiz=sal_False; + sal_Bool bChgWdh=sal_False; sal_Bool bChgHgt=sal_False; sal_Bool bRotate=sal_False; sal_Bool bShear =sal_False; @@ -1395,6 +1497,7 @@ void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& rAttr) if (SFX_ITEM_SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_WIDTH,sal_True,&pPoolItem)) { nSizX=((const SfxUInt32Item*)pPoolItem)->GetValue(); bChgSiz=sal_True; + bChgWdh=sal_True; } if (SFX_ITEM_SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_HEIGHT,sal_True,&pPoolItem)) { nSizY=((const SfxUInt32Item*)pPoolItem)->GetValue(); @@ -1487,7 +1590,7 @@ void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& rAttr) GetSdrPageView()->PagePosToLogic(aRef); } - ResizeMarkedObj(aRef,aWdt,aHgt); + ResizeMultMarkedObj(aRef, aWdt, aHgt, false, bChgWdh, bChgHgt); } // Rotieren diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index 28e785253a3e..1aa6d18c46b2 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -2035,6 +2035,38 @@ void SdrObjEditView::OnEndPasteOrDrop( PasteOrDropInfos* ) // applications can derive from these virtual methods to do something before a drop or paste operation } +sal_uInt16 SdrObjEditView::GetSelectionLevel() const +{ + sal_uInt16 nLevel = 0xFFFF; + if( IsTextEdit() ) + { + DBG_ASSERT(pTextEditOutlinerView!=NULL,"SdrObjEditView::GetAttributes(): pTextEditOutlinerView=NULL"); + DBG_ASSERT(pTextEditOutliner!=NULL,"SdrObjEditView::GetAttributes(): pTextEditOutliner=NULL"); + if( pTextEditOutlinerView ) + { + //start and end position + ESelection aSelect = pTextEditOutlinerView->GetSelection(); + sal_uInt16 nStartPara = ::std::min( aSelect.nStartPara, aSelect.nEndPara ); + sal_uInt16 nEndPara = ::std::max( aSelect.nStartPara, aSelect.nEndPara ); + //get level from each paragraph + nLevel = 0; + for( sal_uInt16 nPara = nStartPara; nPara <= nEndPara; nPara++ ) + { + sal_uInt16 nParaDepth = 1 << pTextEditOutliner->GetDepth( nPara ); + if( !(nLevel & nParaDepth) ) + nLevel += nParaDepth; + } + //reduce one level for Outliner Object + //if( nLevel > 0 && GetTextEditObject()->GetObjIdentifier() == OBJ_OUTLINETEXT ) + // nLevel = nLevel >> 1; + //no bullet paragraph selected + if( nLevel == 0) + nLevel = 0xFFFF; + } + } + return nLevel; +} + bool SdrObjEditView::SupportsFormatPaintbrush( sal_uInt32 nObjectInventor, sal_uInt16 nObjectIdentifier ) const { if( nObjectInventor != SdrInventor && nObjectInventor != E3dInventor ) diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx index d164cb1ed913..1314161502bc 100644 --- a/svx/source/svdraw/svdfmtf.cxx +++ b/svx/source/svdraw/svdfmtf.cxx @@ -351,19 +351,19 @@ void ImpSdrGDIMetaFileImport::SetAttributes(SdrObject* pObj, bool bForceTextAttr switch(maLineJoin) { default : // basegfx::B2DLINEJOIN_NONE - mpLineAttr->Put(XLineJointItem(XLINEJOINT_NONE)); + mpLineAttr->Put(XLineJointItem(com::sun::star::drawing::LineJoint_NONE)); break; case basegfx::B2DLINEJOIN_MIDDLE: - mpLineAttr->Put(XLineJointItem(XLINEJOINT_MIDDLE)); + mpLineAttr->Put(XLineJointItem(com::sun::star::drawing::LineJoint_MIDDLE)); break; case basegfx::B2DLINEJOIN_BEVEL: - mpLineAttr->Put(XLineJointItem(XLINEJOINT_BEVEL)); + mpLineAttr->Put(XLineJointItem(com::sun::star::drawing::LineJoint_BEVEL)); break; case basegfx::B2DLINEJOIN_MITER: - mpLineAttr->Put(XLineJointItem(XLINEJOINT_MITER)); + mpLineAttr->Put(XLineJointItem(com::sun::star::drawing::LineJoint_MITER)); break; case basegfx::B2DLINEJOIN_ROUND: - mpLineAttr->Put(XLineJointItem(XLINEJOINT_ROUND)); + mpLineAttr->Put(XLineJointItem(com::sun::star::drawing::LineJoint_ROUND)); break; } diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx index cf6630d6172d..0f2686b15226 100644 --- a/svx/source/svdraw/svdmodel.cxx +++ b/svx/source/svdraw/svdmodel.cxx @@ -762,7 +762,7 @@ bool SdrModel::IsUndoEnabled() const void SdrModel::ImpCreateTables() { // der Writer hat seinen eigenen ColorTable - if (!bExtColorTable) pColorTable=new XColorTable(aTablePath,(XOutdevItemPool*)pItemPool); + if (!bExtColorTable) pColorTable=new XColorList(aTablePath,(XOutdevItemPool*)pItemPool); pDashList =new XDashList (aTablePath,(XOutdevItemPool*)pItemPool); pLineEndList =new XLineEndList (aTablePath,(XOutdevItemPool*)pItemPool); pHatchList =new XHatchList (aTablePath,(XOutdevItemPool*)pItemPool); @@ -2173,7 +2173,7 @@ const ::com::sun::star::uno::Sequence< sal_Int8 >& SdrModel::getUnoTunnelImpleme // // i120668, move from the header files, add delete action // -void SdrModel::SetColorTable(XColorTable* pTable) { delete pColorTable; pColorTable=pTable; } +void SdrModel::SetColorTable(XColorList* pTable) { delete pColorTable; pColorTable=pTable; } void SdrModel::SetDashList(XDashList* pList) { delete pDashList; pDashList=pList; } void SdrModel::SetLineEndList(XLineEndList* pList) { delete pLineEndList; pLineEndList=pList; } void SdrModel::SetHatchList(XHatchList* pList) { delete pHatchList; pHatchList=pList; } diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index 20ec9a3528e5..d34ada5c41cf 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -3300,7 +3300,7 @@ void SdrObjCustomShape::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, aGeo.RecalcTan(); // force metric to pool metric - SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0); + const SfxMapUnit eMapUnit(GetObjectMapUnit()); if(eMapUnit != SFX_MAPUNIT_100TH_MM) { switch(eMapUnit) @@ -3447,7 +3447,7 @@ sal_Bool SdrObjCustomShape::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, ba } // force MapUnit to 100th mm - SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0); + const SfxMapUnit eMapUnit(GetObjectMapUnit()); if(eMapUnit != SFX_MAPUNIT_100TH_MM) { switch(eMapUnit) diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index c1a21fca565a..2bfa847f8552 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -2030,6 +2030,23 @@ const SfxPoolItem& SdrObject::GetObjectItem(const sal_uInt16 nWhich) const return GetObjectItemSet().Get(nWhich); } +SfxMapUnit SdrObject::GetObjectMapUnit() const +{ + SfxMapUnit aRetval(SFX_MAPUNIT_100TH_MM); + SdrItemPool* pPool = GetObjectItemPool(); + + if(pPool) + { + aRetval = pPool->GetMetric(0); + } + else + { + OSL_ENSURE(pPool, "SdrObjects always need a pool (!)"); + } + + return aRetval; +} + const SfxPoolItem& SdrObject::GetMergedItem(const sal_uInt16 nWhich) const { return GetMergedItemSet().Get(nWhich); @@ -3028,7 +3045,7 @@ sal_Bool SdrObject::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B } // force MapUnit to 100th mm - SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0); + const SfxMapUnit eMapUnit(GetObjectMapUnit()); if(eMapUnit != SFX_MAPUNIT_100TH_MM) { switch(eMapUnit) @@ -3079,7 +3096,7 @@ void SdrObject::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const ba } // force metric to pool metric - SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0); + const SfxMapUnit eMapUnit(GetObjectMapUnit()); if(eMapUnit != SFX_MAPUNIT_100TH_MM) { switch(eMapUnit) diff --git a/svx/source/svdraw/svdogrp.cxx b/svx/source/svdraw/svdogrp.cxx index 7acee8d8d2cf..0c3902a5583e 100644 --- a/svx/source/svdraw/svdogrp.cxx +++ b/svx/source/svdraw/svdogrp.cxx @@ -97,8 +97,6 @@ SdrObjGroup::SdrObjGroup() pSub->SetOwnerObj(this); pSub->SetListKind(SDROBJLIST_GROUPOBJ); bRefPoint=sal_False; - nDrehWink=0; - nShearWink=0; bClosedObj=sal_False; } @@ -308,8 +306,6 @@ void SdrObjGroup::operator=(const SdrObject& rObj) pSub->CopyObjects(*rObj.GetSubList()); // copy local paremeters - nDrehWink =((SdrObjGroup&)rObj).nDrehWink; - nShearWink =((SdrObjGroup&)rObj).nShearWink; aRefPoint =((SdrObjGroup&)rObj).aRefPoint; bRefPoint =((SdrObjGroup&)rObj).bRefPoint; } @@ -388,13 +384,33 @@ FASTBOOL SdrObjGroup::BegCreate(SdrDragStat& /*rStat*/) long SdrObjGroup::GetRotateAngle() const { - return nDrehWink; + const sal_uInt32 nObjCount(pSub->GetObjCount()); + long nRetval(0); + + if(nObjCount) + { + SdrObject* pObj = pSub->GetObj(0); + + nRetval = pObj->GetRotateAngle(); + } + + return nRetval; } long SdrObjGroup::GetShearAngle(FASTBOOL /*bVertical*/) const { - return nShearWink; + const sal_uInt32 nObjCount(pSub->GetObjCount()); + long nRetval(0); + + if(nObjCount) + { + SdrObject* pObj = pSub->GetObj(0); + + nRetval = pObj->GetShearAngle(); + } + + return nRetval; } @@ -476,7 +492,6 @@ void SdrObjGroup::NbcResize(const Point& rRef, const Fraction& xFact, const Frac void SdrObjGroup::NbcRotate(const Point& rRef, long nWink, double sn, double cs) { SetGlueReallyAbsolute(sal_True); - nDrehWink=NormAngle360(nDrehWink+nWink); RotatePoint(aRefPoint,rRef,sn,cs); SdrObjList* pOL=pSub; sal_uIntPtr nObjAnz=pOL->GetObjCount(); @@ -507,7 +522,6 @@ void SdrObjGroup::NbcMirror(const Point& rRef1, const Point& rRef2) void SdrObjGroup::NbcShear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear) { SetGlueReallyAbsolute(sal_True); - nShearWink+=nWink; ShearPoint(aRefPoint,rRef,tn); SdrObjList* pOL=pSub; sal_uIntPtr nObjAnz=pOL->GetObjCount(); @@ -647,7 +661,6 @@ void SdrObjGroup::Rotate(const Point& rRef, long nWink, double sn, double cs) if (nWink!=0) { SetGlueReallyAbsolute(sal_True); Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect(); - nDrehWink=NormAngle360(nDrehWink+nWink); RotatePoint(aRefPoint,rRef,sn,cs); // #32383# Erst die Verbinder verschieben, dann den Rest SdrObjList* pOL=pSub; @@ -700,7 +713,6 @@ void SdrObjGroup::Shear(const Point& rRef, long nWink, double tn, FASTBOOL bVShe if (nWink!=0) { SetGlueReallyAbsolute(sal_True); Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect(); - nShearWink+=nWink; ShearPoint(aRefPoint,rRef,tn); // #32383# Erst die Verbinder verschieben, dann den Rest SdrObjList* pOL=pSub; diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx index b62ac517f3c8..b6fc7c8535c6 100644 --- a/svx/source/svdraw/svdopath.cxx +++ b/svx/source/svdraw/svdopath.cxx @@ -2962,7 +2962,7 @@ sal_Bool SdrPathObj::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx:: } // force MapUnit to 100th mm - SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0); + const SfxMapUnit eMapUnit(GetObjectMapUnit()); if(eMapUnit != SFX_MAPUNIT_100TH_MM) { switch(eMapUnit) @@ -3032,7 +3032,7 @@ void SdrPathObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const b aGeo.RecalcTan(); // force metric to pool metric - SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0); + const SfxMapUnit eMapUnit(GetObjectMapUnit()); if(eMapUnit != SFX_MAPUNIT_100TH_MM) { switch(eMapUnit) diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx index e330c993db09..315979b59618 100644 --- a/svx/source/svdraw/svdotext.cxx +++ b/svx/source/svdraw/svdotext.cxx @@ -1710,7 +1710,7 @@ sal_Bool SdrTextObj::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx:: } // force MapUnit to 100th mm - SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0); + const SfxMapUnit eMapUnit(GetObjectMapUnit()); if(eMapUnit != SFX_MAPUNIT_100TH_MM) { switch(eMapUnit) @@ -1772,7 +1772,7 @@ void SdrTextObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const b aGeo.RecalcTan(); // force metric to pool metric - SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0); + const SfxMapUnit eMapUnit(GetObjectMapUnit()); if(eMapUnit != SFX_MAPUNIT_100TH_MM) { switch(eMapUnit) diff --git a/svx/source/svdraw/svdstr.src b/svx/source/svdraw/svdstr.src index 64a8c9dde105..93b44e115892 100644 --- a/svx/source/svdraw/svdstr.src +++ b/svx/source/svdraw/svdstr.src @@ -2870,6 +2870,16 @@ Bitmap SIP_SA_ACCESSIBILITY_CROP_MARKERS File = "cropmarkersACC.bmp"; }; +// DialControl bitmaps +Bitmap IMG_DIACONTROL_NORMAL +{ + File = "rotation.png"; +}; +Bitmap IMG_DIACONTROL_H +{ + File = "rotation_h.png"; +}; + //IAccessibility2 Implementation 2009----- String STR_ObjNameSingulFONTWORK { diff --git a/svx/source/table/accessibletableshape.cxx b/svx/source/table/accessibletableshape.cxx index 0467840abb92..f144186ec6c0 100644 --- a/svx/source/table/accessibletableshape.cxx +++ b/svx/source/table/accessibletableshape.cxx @@ -34,7 +34,7 @@ #include <vcl/svapp.hxx> #include <svx/AccessibleTableShape.hxx> -#include "tablecontroller.hxx" +#include <svx/sdr/table/tablecontroller.hxx> #include "accessiblecell.hxx" #include <algorithm> diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx index 19b2ecc8adcb..9606c43726f2 100644 --- a/svx/source/table/tablecontroller.cxx +++ b/svx/source/table/tablecontroller.cxx @@ -24,7 +24,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" -#include "tablecontroller.hxx" +#include <svx/sdr/table/tablecontroller.hxx> +#include <tablemodel.hxx> #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> #include <com/sun/star/container/XIndexAccess.hpp> diff --git a/svx/source/tbxctrls/fillctrl.cxx b/svx/source/tbxctrls/fillctrl.cxx index 5a116a01d1b9..bd69ac94b1bb 100644 --- a/svx/source/tbxctrls/fillctrl.cxx +++ b/svx/source/tbxctrls/fillctrl.cxx @@ -129,14 +129,6 @@ void SvxFillToolBoxControl::StateChanged( delete pStyleItem; pStyleItem = (XFillStyleItem*) pState->Clone(); pFillTypeLB->Enable(); - - eLastXFS = pFillTypeLB->GetSelectEntryPos(); - bUpdate = sal_True; - - XFillStyle eXFS = (XFillStyle)pStyleItem->GetValue(); - pFillTypeLB->SelectEntryPos( - sal::static_int_cast< sal_uInt16 >( eXFS ) ); - pFillAttrLB->Enable(); } else if( pStyleItem ) { @@ -175,6 +167,27 @@ void SvxFillToolBoxControl::StateChanged( bEnableControls = sal_True; } } + + if( pStyleItem ) + { + // ensure that the correct entry is selected in pFillTypeLB. It + // might have been changed by nSID == SID_ATTR_FILL_STYLE, but + // it might also be in an in-between state when user had started to + // change fillstyle, but not yet changed fillvalue for new style + // and when nSID == SID_ATTR_FILL_COLOR/SID_ATTR_FILL_GRADIENT/ + // SID_ATTR_FILL_HATCH/SID_ATTR_FILL_BITMAP value change is triggered + eLastXFS = pFillTypeLB->GetSelectEntryPos(); + XFillStyle eXFS = (XFillStyle)pStyleItem->GetValue(); + + if(eLastXFS != eXFS) + { + bUpdate = sal_True; + pFillTypeLB->SelectEntryPos( sal::static_int_cast< sal_uInt16 >( eXFS ) ); + } + + pFillAttrLB->Enable(); + } + if( bEnableControls ) { //pFillTypeLB->Enable(); @@ -320,13 +333,13 @@ void SvxFillToolBoxControl::Update( const SfxPoolItem* pState ) XGradientList aGradientList( aEmptyString ); aGradientList.Insert( pEntry ); aGradientList.SetDirty( sal_False ); - Bitmap* pBmp = aGradientList.CreateBitmapForUI( 0 ); + const Bitmap aBmp = aGradientList.GetUiBitmap( 0 ); - if( pBmp ) + if( !aBmp.IsEmpty() ) { - ( (ListBox*)pFillAttrLB )->InsertEntry( pEntry->GetName(), *pBmp ); + ( (ListBox*)pFillAttrLB )->InsertEntry( pEntry->GetName(), aBmp ); pFillAttrLB->SelectEntryPos( pFillAttrLB->GetEntryCount() - 1 ); - delete pBmp; + //delete pBmp; } aGradientList.Remove( 0 ); @@ -370,13 +383,13 @@ void SvxFillToolBoxControl::Update( const SfxPoolItem* pState ) XHatchList aHatchList( aEmptyString ); aHatchList.Insert( pEntry ); aHatchList.SetDirty( sal_False ); - Bitmap* pBmp = aHatchList.CreateBitmapForUI( 0 ); + const Bitmap aBmp = aHatchList.GetUiBitmap( 0 ); - if( pBmp ) + if( !aBmp.IsEmpty() ) { - ( (ListBox*)pFillAttrLB )->InsertEntry( pEntry->GetName(), *pBmp ); + ( (ListBox*)pFillAttrLB )->InsertEntry( pEntry->GetName(), aBmp ); pFillAttrLB->SelectEntryPos( pFillAttrLB->GetEntryCount() - 1 ); - delete pBmp; + //delete pBmp; } aHatchList.Remove( 0 ); diff --git a/svx/source/tbxctrls/itemwin.cxx b/svx/source/tbxctrls/itemwin.cxx index 119c4c77eb6e..5141ed32c0ab 100644 --- a/svx/source/tbxctrls/itemwin.cxx +++ b/svx/source/tbxctrls/itemwin.cxx @@ -52,8 +52,6 @@ #include "svx/linectrl.hxx" #include <svtools/colorcfg.hxx> -#include "linectrl.hrc" - using namespace ::com::sun::star::uno; using namespace ::com::sun::star::frame; using namespace ::com::sun::star::util; @@ -272,7 +270,7 @@ void SvxLineBox::DataChanged( const DataChangedEvent& rDCEvt ) void SvxLineBox::FillControl() { - FillStyles(); + // FillStyles(); if ( !mpSh ) mpSh = SfxObjectShell::Current(); diff --git a/svx/source/tbxctrls/linectrl.cxx b/svx/source/tbxctrls/linectrl.cxx index ec47f8d3c6e9..0ba5f8d10f29 100644 --- a/svx/source/tbxctrls/linectrl.cxx +++ b/svx/source/tbxctrls/linectrl.cxx @@ -525,7 +525,6 @@ void SvxLineEndWindow::FillValueSet() if( pLineEndList ) { XLineEndEntry* pEntry = NULL; - Bitmap* pBmp = NULL; VirtualDevice aVD; long nCount = pLineEndList->Count(); @@ -535,16 +534,16 @@ void SvxLineEndWindow::FillValueSet() basegfx::B2DPolyPolygon aNothing; pLineEndList->Insert( new XLineEndEntry( aNothing, SVX_RESSTR( RID_SVXSTR_NONE ) ) ); pEntry = pLineEndList->GetLineEnd( nCount ); - pBmp = pLineEndList->GetBitmap( nCount ); - DBG_ASSERT( pBmp, "UI-Bitmap wurde nicht erzeugt" ); + Bitmap aBmp = pLineEndList->GetUiBitmap( nCount ); + OSL_ENSURE( !aBmp.IsEmpty(), "UI-Bitmap wurde nicht erzeugt" ); - aBmpSize = pBmp->GetSizePixel(); + aBmpSize = aBmp.GetSizePixel(); aVD.SetOutputSizePixel( aBmpSize, sal_False ); aBmpSize.Width() = aBmpSize.Width() / 2; Point aPt0( 0, 0 ); Point aPt1( aBmpSize.Width(), 0 ); - aVD.DrawBitmap( Point(), *pBmp ); + aVD.DrawBitmap( Point(), aBmp ); aLineEndSet.InsertItem( 1, aVD.GetBitmap( aPt0, aBmpSize ), pEntry->GetName() ); aLineEndSet.InsertItem( 2, aVD.GetBitmap( aPt1, aBmpSize ), pEntry->GetName() ); @@ -554,10 +553,10 @@ void SvxLineEndWindow::FillValueSet() { pEntry = pLineEndList->GetLineEnd( i ); DBG_ASSERT( pEntry, "Konnte auf LineEndEntry nicht zugreifen" ); - pBmp = pLineEndList->GetBitmap( i ); - DBG_ASSERT( pBmp, "UI-Bitmap wurde nicht erzeugt" ); + aBmp = pLineEndList->GetUiBitmap( i ); + OSL_ENSURE( !aBmp.IsEmpty(), "UI-Bitmap wurde nicht erzeugt" ); - aVD.DrawBitmap( aPt0, *pBmp ); + aVD.DrawBitmap( aPt0, aBmp ); aLineEndSet.InsertItem( (sal_uInt16)((i+1L)*2L+1L), aVD.GetBitmap( aPt0, aBmpSize ), pEntry->GetName() ); aLineEndSet.InsertItem( (sal_uInt16)((i+2L)*2L), aVD.GetBitmap( aPt1, aBmpSize ), pEntry->GetName() ); } diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index b9703c6975e1..93f726ff5ef3 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -834,7 +834,7 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString& rCommand, { SfxObjectShell* pDocSh = SfxObjectShell::Current(); const SfxPoolItem* pItem = NULL; - XColorTable* pColorTable = NULL; + XColorList* pColorTable = NULL; sal_Bool bKillTable = sal_False; const Size aSize12( 13, 13 ); @@ -844,7 +844,7 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString& rCommand, if ( !pColorTable ) { - pColorTable = new XColorTable( SvtPathOptions().GetPalettePath() ); + pColorTable = new XColorList( SvtPathOptions().GetPalettePath() ); bKillTable = sal_True; } @@ -1014,7 +1014,7 @@ void SvxColorWindow_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eState, co { if (( nSID == SID_COLOR_TABLE ) && ( pState->ISA( SvxColorTableItem ))) { - XColorTable* pColorTable = pState ? ((SvxColorTableItem *)pState)->GetColorTable() : NULL; + XColorList* pColorTable = pState ? ((SvxColorTableItem *)pState)->GetColorTable() : NULL; if ( pColorTable ) { diff --git a/svx/source/tbxctrls/tbxcolorupdate.cxx b/svx/source/tbxctrls/tbxcolorupdate.cxx index fa3c8ab032b6..d909b4387485 100644 --- a/svx/source/tbxctrls/tbxcolorupdate.cxx +++ b/svx/source/tbxctrls/tbxcolorupdate.cxx @@ -83,7 +83,7 @@ namespace svx { BitmapEx aBmpEx( aImage.GetBitmapEx() ); Bitmap aBmp( aBmpEx.GetBitmap() ); - BitmapWriteAccess* pBmpAcc = aBmp.AcquireWriteAccess(); + BitmapWriteAccess* pBmpAcc = aBmp.IsEmpty() ? NULL : aBmp.AcquireWriteAccess(); maBmpSize = aBmp.GetSizePixel(); @@ -117,6 +117,20 @@ namespace svx { if( maBmpSize.Width() <= 16 ) maUpdRect = Rectangle( Point( 0,12 ), Size( maBmpSize.Width(), 4 ) ); + else if(76 == maBmpSize.Width() && 12 == maBmpSize.Height()) + { + maUpdRect.Left() = 22; + maUpdRect.Top() = 2; + maUpdRect.Right() = 73; + maUpdRect.Bottom() = 9; + } + else if(30 == maBmpSize.Width() && 16 == maBmpSize.Height()) + { + maUpdRect.Left() = 17; + maUpdRect.Top() = 2; + maUpdRect.Right() = 27; + maUpdRect.Bottom() = 13; + } else maUpdRect = Rectangle( Point( 1, maBmpSize.Height() - 7 ), Size( maBmpSize.Width() - 2 ,6 ) ); } diff --git a/svx/source/unodraw/XPropertyTable.cxx b/svx/source/unodraw/XPropertyTable.cxx index 8f4a9e5ad54b..297c619916c6 100644 --- a/svx/source/unodraw/XPropertyTable.cxx +++ b/svx/source/unodraw/XPropertyTable.cxx @@ -50,15 +50,13 @@ using namespace ::vos; class SvxUnoXPropertyTable : public WeakImplHelper2< container::XNameContainer, lang::XServiceInfo > { private: - XPropertyTable* mpTable; XPropertyList* mpList; sal_Int16 mnWhich; - long getCount() const { return mpList ? mpList->Count() : (mpTable?mpTable->Count():0); } + long getCount() const { return mpList ? mpList->Count() : 0 ; } XPropertyEntry* get( long index ) const; public: SvxUnoXPropertyTable( sal_Int16 nWhich, XPropertyList* pList ) throw(); - SvxUnoXPropertyTable( sal_Int16 nWhich, XPropertyTable* pTable ) throw(); virtual ~SvxUnoXPropertyTable() throw(); @@ -84,13 +82,8 @@ public: virtual sal_Bool SAL_CALL hasElements( ) throw( uno::RuntimeException); }; -SvxUnoXPropertyTable::SvxUnoXPropertyTable( sal_Int16 nWhich, XPropertyTable* pTable ) throw() -: mpTable( pTable ), mpList( NULL ), mnWhich( nWhich ) -{ -} - SvxUnoXPropertyTable::SvxUnoXPropertyTable( sal_Int16 nWhich, XPropertyList* pList ) throw() -: mpTable( NULL ), mpList( pList ), mnWhich( nWhich ) +: mpList( pList ), mnWhich( nWhich ) { } @@ -100,9 +93,7 @@ SvxUnoXPropertyTable::~SvxUnoXPropertyTable() throw() XPropertyEntry* SvxUnoXPropertyTable::get( long index ) const { - if( mpTable ) - return mpTable->Get( index, 0 ); - else if( mpList ) + if( mpList ) return mpList->Get( index, 0 ); else return NULL; @@ -131,7 +122,7 @@ void SAL_CALL SvxUnoXPropertyTable::insertByName( const OUString& aName, const { OGuard aGuard( Application::GetSolarMutex() ); - if( NULL == mpList && NULL == mpTable ) + if( NULL == mpList ) throw lang::IllegalArgumentException(); if( hasByName( aName ) ) @@ -146,8 +137,6 @@ void SAL_CALL SvxUnoXPropertyTable::insertByName( const OUString& aName, const if( mpList ) mpList->Insert( pNewEntry ); - else - mpTable->Insert( mpTable->Count(), pNewEntry ); } void SAL_CALL SvxUnoXPropertyTable::removeByName( const OUString& Name ) @@ -168,8 +157,6 @@ void SAL_CALL SvxUnoXPropertyTable::removeByName( const OUString& Name ) { if( mpList ) delete mpList->Remove( i, 0 ); - else - delete mpTable->Remove( i, 0 ); return; } } @@ -200,8 +187,6 @@ void SAL_CALL SvxUnoXPropertyTable::replaceByName( const OUString& aName, const if( mpList ) delete mpList->Replace( pNewEntry, i ); - else - delete mpTable->Replace( i, pNewEntry ); return; } } @@ -291,7 +276,7 @@ sal_Bool SAL_CALL SvxUnoXPropertyTable::hasElements( ) class SvxUnoXColorTable : public SvxUnoXPropertyTable { public: - SvxUnoXColorTable( XPropertyTable* pTable ) throw() : SvxUnoXPropertyTable( XATTR_LINECOLOR, pTable ) {}; + SvxUnoXColorTable( XPropertyList* pTable ) throw() : SvxUnoXPropertyTable( XATTR_LINECOLOR, pTable ) {}; // SvxUnoXPropertyTable virtual uno::Any getAny( const XPropertyEntry* pEntry ) const throw(); @@ -305,7 +290,7 @@ public: virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw( uno::RuntimeException); }; -uno::Reference< uno::XInterface > SAL_CALL SvxUnoXColorTable_createInstance( XPropertyTable* pTable ) throw() +uno::Reference< uno::XInterface > SAL_CALL SvxUnoXColorTable_createInstance( XPropertyList* pTable ) throw() { return (OWeakObject*) new SvxUnoXColorTable( pTable ); } diff --git a/svx/source/unodraw/unoctabl.cxx b/svx/source/unodraw/unoctabl.cxx index d9dae7469d33..d8e555288a28 100644 --- a/svx/source/unodraw/unoctabl.cxx +++ b/svx/source/unodraw/unoctabl.cxx @@ -44,7 +44,7 @@ using namespace ::cppu; class SvxUnoColorTable : public WeakImplHelper2< container::XNameContainer, lang::XServiceInfo > { private: - XColorTable* pTable; + XColorList* pTable; public: SvxUnoColorTable() throw(); @@ -83,7 +83,7 @@ public: SvxUnoColorTable::SvxUnoColorTable() throw() { - pTable = new XColorTable( SvtPathOptions().GetPalettePath() ); + pTable = new XColorList( SvtPathOptions().GetPalettePath() ); } SvxUnoColorTable::~SvxUnoColorTable() throw() @@ -135,14 +135,14 @@ void SAL_CALL SvxUnoColorTable::insertByName( const OUString& aName, const uno:: if( pTable ) { XColorEntry* pEntry = new XColorEntry( Color( (ColorData)nColor ), aName ); - pTable->Insert( pTable->Count(), pEntry ); + pTable->Insert( pEntry, pTable->Count() ); } } void SAL_CALL SvxUnoColorTable::removeByName( const OUString& Name ) throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) { - long nIndex = pTable ? ((XPropertyTable*)pTable)->Get( Name ) : -1; + long nIndex = pTable ? ((XPropertyList*)pTable)->Get( Name ) : -1; if( nIndex == -1 ) throw container::NoSuchElementException(); @@ -157,23 +157,23 @@ void SAL_CALL SvxUnoColorTable::replaceByName( const OUString& aName, const uno: if( !(aElement >>= nColor) ) throw lang::IllegalArgumentException(); - long nIndex = pTable ? ((XPropertyTable*)pTable)->Get( aName ) : -1; + long nIndex = pTable ? ((XPropertyList*)pTable)->Get( aName ) : -1; if( nIndex == -1 ) throw container::NoSuchElementException(); XColorEntry* pEntry = new XColorEntry( Color( (ColorData)nColor ), aName ); - delete pTable->Replace( nIndex, pEntry ); + delete pTable->Replace( pEntry, nIndex ); } // XNameAccess uno::Any SAL_CALL SvxUnoColorTable::getByName( const OUString& aName ) throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) { - long nIndex = pTable ? ((XPropertyTable*)pTable)->Get( aName ) : -1; + long nIndex = pTable ? ((XPropertyList*)pTable)->Get( aName ) : -1; if( nIndex == -1 ) throw container::NoSuchElementException(); - XColorEntry* pEntry = ((XColorTable*)pTable)->GetColor( nIndex ); + XColorEntry* pEntry = ((XColorList*)pTable)->GetColor( nIndex ); return uno::Any( (sal_Int32) pEntry->GetColor().GetRGBColor() ); } @@ -197,7 +197,7 @@ uno::Sequence< OUString > SAL_CALL SvxUnoColorTable::getElementNames( ) sal_Bool SAL_CALL SvxUnoColorTable::hasByName( const OUString& aName ) throw( uno::RuntimeException ) { - long nIndex = pTable ? ((XPropertyTable*)pTable)->Get( aName ) : -1; + long nIndex = pTable ? ((XPropertyList*)pTable)->Get( aName ) : -1; return nIndex != -1; } @@ -238,6 +238,8 @@ uno::Reference< uno::XInterface > SAL_CALL create_EnhancedCustomShapeEngine( con #include "cppuhelper/factory.hxx" #include "uno/lbnames.h" #include <svx/sdr/primitive2d/primitiveFactory2d.hxx> +#include "sidebar/PanelFactory.hxx" + /* namespace svx @@ -366,16 +368,15 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( ::svx::SvXMLGraphicExportHelper_createInstance, ::svx::SvXMLGraphicExportHelper_getSupportedServiceNames() ); } -/* - else if( ::svx::ExtrusionDepthController_getImplementationName().equalsAscii( pImplName ) ) + else if (::svx::sidebar::PanelFactory::getImplementationName().equalsAscii(pImplName)) { xFactory = ::cppu::createSingleFactory( - reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ), - ::svx::ExtrusionDepthController_getImplementationName(), - ::svx::ExtrusionDepthController_createInstance, - ::svx::ExtrusionDepthController_getSupportedServiceNames() ); + reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), + ::svx::sidebar::PanelFactory::getImplementationName(), + ::svx::sidebar::PanelFactory::createInstance, + ::svx::sidebar::PanelFactory::getSupportedServiceNames()); } -*/ + if( xFactory.is()) { xFactory->acquire(); diff --git a/svx/source/xoutdev/XPropertyEntry.cxx b/svx/source/xoutdev/XPropertyEntry.cxx new file mode 100755 index 000000000000..19d0e3a3dfbe --- /dev/null +++ b/svx/source/xoutdev/XPropertyEntry.cxx @@ -0,0 +1,44 @@ +/************************************************************** + * + * 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 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svx.hxx" + +#include <svx/XPropertyEntry.hxx> +// -------------------- + +XPropertyEntry::XPropertyEntry(const String& rName) +: maName(rName), + maUiBitmap() +{ +} + +XPropertyEntry::XPropertyEntry(const XPropertyEntry& rOther) +: maName(rOther.maName), + maUiBitmap(rOther.maUiBitmap) +{ +} + +XPropertyEntry::~XPropertyEntry() +{ +} + +// eof diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx index c09501beaf8a..4788ec94bafa 100644 --- a/svx/source/xoutdev/xattr.cxx +++ b/svx/source/xoutdev/xattr.cxx @@ -471,11 +471,11 @@ SvStream& XColorItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const /************************************************************************* |* -|* const XColor& XColorItem::GetColorValue(const XColorTable* pTable) const +|* const XColor& XColorItem::GetColorValue(const XColorList* pTable) const |* \************************************************************************/ -const Color& XColorItem::GetColorValue(const XColorTable* pTable) const +const Color& XColorItem::GetColorValue(const XColorList* pTable) const { if (!IsIndex()) return aColor; @@ -1047,7 +1047,7 @@ SvStream& XLineDashItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const /************************************************************************* |* -|* const XDash& XLineDashItem::GetValue(const XDashTable* pTable) const +|* const XDash& XLineDashItem::GetValue(const XDashList* pTable) const |* |* Beschreibung |* Ersterstellung 15.11.94 @@ -1055,7 +1055,7 @@ SvStream& XLineDashItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const |* *************************************************************************/ -const XDash& XLineDashItem::GetDashValue(const XDashTable* pTable) const // GetValue -> GetDashValue +const XDash& XLineDashItem::GetDashValue(const XDashList* pTable) const // GetValue -> GetDashValue { if (!IsIndex()) return aDash; @@ -1868,7 +1868,7 @@ SvStream& XLineStartItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const /************************************************************************* |* -|* const basegfx::B2DPolyPolygon& XLineStartItem::GetValue(const XLineEndTable* pTable) +|* const basegfx::B2DPolyPolygon& XLineStartItem::GetValue(const XLineEndList* pTable) |* const |* |* Beschreibung @@ -1877,7 +1877,7 @@ SvStream& XLineStartItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const |* *************************************************************************/ -basegfx::B2DPolyPolygon XLineStartItem::GetLineStartValue(const XLineEndTable* pTable) const +basegfx::B2DPolyPolygon XLineStartItem::GetLineStartValue(const XLineEndList* pTable) const { if (!IsIndex()) { @@ -2340,7 +2340,7 @@ SvStream& XLineEndItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const /************************************************************************* |* -|* const basegfx::B2DPolyPolygon& XLineEndItem::GetValue(const XLineEndTable* pTable) const +|* const basegfx::B2DPolyPolygon& XLineEndItem::GetValue(const XLineEndList* pTable) const |* |* Beschreibung |* Ersterstellung 15.11.94 @@ -2348,7 +2348,7 @@ SvStream& XLineEndItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const |* *************************************************************************/ -basegfx::B2DPolyPolygon XLineEndItem::GetLineEndValue(const XLineEndTable* pTable) const +basegfx::B2DPolyPolygon XLineEndItem::GetLineEndValue(const XLineEndList* pTable) const { if (!IsIndex()) { @@ -3713,7 +3713,7 @@ SvStream& XFillGradientItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) co /************************************************************************* |* -|* const XGradient& XFillGradientItem::GetValue(const XGradientTable* pTable) +|* const XGradient& XFillGradientItem::GetValue(const XGradientList* pTable) |* const |* |* Beschreibung @@ -3722,7 +3722,7 @@ SvStream& XFillGradientItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) co |* *************************************************************************/ -const XGradient& XFillGradientItem::GetGradientValue(const XGradientTable* pTable) const // GetValue -> GetGradientValue +const XGradient& XFillGradientItem::GetGradientValue(const XGradientList* pTable) const // GetValue -> GetGradientValue { if (!IsIndex()) return aGradient; @@ -4423,7 +4423,7 @@ SvStream& XFillHatchItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const /************************************************************************* |* -|* const XHatch& XFillHatchItem::GetValue(const XHatchTable* pTable) const +|* const XHatch& XFillHatchItem::GetValue(const XHatchList* pTable) const |* |* Beschreibung |* Ersterstellung 15.11.94 @@ -4431,7 +4431,7 @@ SvStream& XFillHatchItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const |* *************************************************************************/ -const XHatch& XFillHatchItem::GetHatchValue(const XHatchTable* pTable) const // GetValue -> GetHatchValue +const XHatch& XFillHatchItem::GetHatchValue(const XHatchList* pTable) const // GetValue -> GetHatchValue { if (!IsIndex()) return aHatch; diff --git a/svx/source/xoutdev/xattr2.cxx b/svx/source/xoutdev/xattr2.cxx index 69a4b7fbc556..79cb92dffc6c 100644 --- a/svx/source/xoutdev/xattr2.cxx +++ b/svx/source/xoutdev/xattr2.cxx @@ -37,6 +37,7 @@ #include <svx/dialmgr.hxx> #include <editeng/itemtype.hxx> #include <svx/xdef.hxx> +#include <svx/AffineMatrixItem.hxx> #define GLOBALOVERFLOW @@ -143,7 +144,7 @@ TYPEINIT1_AUTOFACTORY(XLineJointItem, SfxEnumItem); // ----------------------------------------------------------------------------- -XLineJointItem::XLineJointItem( XLineJoint eLineJoint ) : +XLineJointItem::XLineJointItem( com::sun::star::drawing::LineJoint eLineJoint ) : SfxEnumItem(XATTR_LINEJOINT, sal::static_int_cast< sal_uInt16 >(eLineJoint)) { } @@ -169,7 +170,7 @@ SfxPoolItem* XLineJointItem::Create( SvStream& rIn, sal_uInt16 nVer ) const XLineJointItem* pRet = new XLineJointItem( rIn ); if(nVer < 1) - pRet->SetValue(XLINEJOINT_ROUND); + pRet->SetValue(com::sun::star::drawing::LineJoint_ROUND); return pRet; } @@ -184,7 +185,7 @@ SfxPoolItem* XLineJointItem::Clone(SfxItemPool* /*pPool*/) const // ----------------------------------------------------------------------------- SfxItemPresentation XLineJointItem::GetPresentation( SfxItemPresentation ePres, SfxMapUnit /*eCoreUnit*/, - SfxMapUnit /*ePresUnit*/, XubString& rText, const IntlWrapper*) const + SfxMapUnit /*ePresUnit*/, XubString& rText, const IntlWrapper*) const { rText.Erase(); @@ -199,26 +200,26 @@ SfxItemPresentation XLineJointItem::GetPresentation( SfxItemPresentation ePres, switch( GetValue() ) { - case( XLINEJOINT_NONE ): + case( com::sun::star::drawing::LineJoint_NONE ): nId = RID_SVXSTR_LINEJOINT_NONE; break; - case( XLINEJOINT_MIDDLE ): + case( com::sun::star::drawing::LineJoint_MIDDLE ): nId = RID_SVXSTR_LINEJOINT_MIDDLE; break; - case( XLINEJOINT_BEVEL ): + case( com::sun::star::drawing::LineJoint_BEVEL ): nId = RID_SVXSTR_LINEJOINT_BEVEL; break; - case( XLINEJOINT_MITER ): + case( com::sun::star::drawing::LineJoint_MITER ): nId = RID_SVXSTR_LINEJOINT_MITER; break; - case( XLINEJOINT_ROUND ): + case( com::sun::star::drawing::LineJoint_ROUND ): nId = RID_SVXSTR_LINEJOINT_ROUND; break; } @@ -237,28 +238,7 @@ SfxItemPresentation XLineJointItem::GetPresentation( SfxItemPresentation ePres, sal_Bool XLineJointItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const { - ::com::sun::star::drawing::LineJoint eJoint = ::com::sun::star::drawing::LineJoint_NONE; - - switch( GetValue() ) - { - case XLINEJOINT_NONE: - break; - case XLINEJOINT_MIDDLE: - eJoint = ::com::sun::star::drawing::LineJoint_MIDDLE; - break; - case XLINEJOINT_BEVEL: - eJoint = ::com::sun::star::drawing::LineJoint_BEVEL; - break; - case XLINEJOINT_MITER: - eJoint = ::com::sun::star::drawing::LineJoint_MITER; - break; - case XLINEJOINT_ROUND: - eJoint = ::com::sun::star::drawing::LineJoint_ROUND; - break; - default: - DBG_ERROR( "Unknown LineJoint enum value!" ); - } - + const ::com::sun::star::drawing::LineJoint eJoint = GetValue(); rVal <<= eJoint; return sal_True; } @@ -267,7 +247,6 @@ sal_Bool XLineJointItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 sal_Bool XLineJointItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) { - XLineJoint eJoint = XLINEJOINT_NONE; ::com::sun::star::drawing::LineJoint eUnoJoint; if(!(rVal >>= eUnoJoint)) @@ -279,25 +258,7 @@ sal_Bool XLineJointItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_u eUnoJoint = (::com::sun::star::drawing::LineJoint)nLJ; } - switch( eUnoJoint ) - { - case ::com::sun::star::drawing::LineJoint_MIDDLE: - eJoint = XLINEJOINT_MIDDLE; - break; - case ::com::sun::star::drawing::LineJoint_BEVEL: - eJoint = XLINEJOINT_BEVEL; - break; - case ::com::sun::star::drawing::LineJoint_MITER: - eJoint = XLINEJOINT_MITER; - break; - case ::com::sun::star::drawing::LineJoint_ROUND: - eJoint = XLINEJOINT_ROUND; - break; - default: - break; - } - - SetValue( sal::static_int_cast< sal_uInt16 >( eJoint ) ); + SetValue( sal::static_int_cast< sal_uInt16 >( eUnoJoint ) ); return sal_True; } @@ -310,6 +271,116 @@ sal_uInt16 XLineJointItem::GetValueCount() const return 5; } +//--------------------- +// class AffineMatrixItem +//--------------------- + +TYPEINIT1_AUTOFACTORY(AffineMatrixItem, SfxPoolItem); + +AffineMatrixItem::AffineMatrixItem(const com::sun::star::geometry::AffineMatrix2D* pMatrix) +: SfxPoolItem(SID_ATTR_TRANSFORM_MATRIX) +{ + if(pMatrix) + { + maMatrix = *pMatrix; + } + else + { + maMatrix.m00 = 1.0; + maMatrix.m01 = 0.0; + maMatrix.m02 = 0.0; + maMatrix.m10 = 0.0; + maMatrix.m11 = 1.0; + maMatrix.m12 = 0.0; + } +} + +AffineMatrixItem::AffineMatrixItem(SvStream& rIn) +: SfxPoolItem(SID_ATTR_TRANSFORM_MATRIX) +{ + rIn >> maMatrix.m00; + rIn >> maMatrix.m01; + rIn >> maMatrix.m02; + rIn >> maMatrix.m10; + rIn >> maMatrix.m11; + rIn >> maMatrix.m12; +} + +AffineMatrixItem::AffineMatrixItem(const AffineMatrixItem& rRef) +: SfxPoolItem(SID_ATTR_TRANSFORM_MATRIX) +{ + maMatrix = rRef.maMatrix; +} + +AffineMatrixItem::~AffineMatrixItem() +{ +} + +int AffineMatrixItem::operator==(const SfxPoolItem& rRef) const +{ + if(!SfxPoolItem::operator==(rRef)) + { + return 0; + } + + const AffineMatrixItem* pRef = dynamic_cast< const AffineMatrixItem* >(&rRef); + + if(!pRef) + { + return 0; + } + + return (maMatrix.m00 == pRef->maMatrix.m00 + && maMatrix.m01 == pRef->maMatrix.m01 + && maMatrix.m02 == pRef->maMatrix.m02 + && maMatrix.m10 == pRef->maMatrix.m10 + && maMatrix.m11 == pRef->maMatrix.m11 + && maMatrix.m12 == pRef->maMatrix.m12); +} + +SfxPoolItem* AffineMatrixItem::Clone( SfxItemPool* /*pPool*/ ) const +{ + return new AffineMatrixItem(*this); +} + +SfxPoolItem* AffineMatrixItem::Create( SvStream& rIn, sal_uInt16 /*nVer*/ ) const +{ + return new AffineMatrixItem(rIn); +} + +SvStream& AffineMatrixItem::Store(SvStream &rStream, sal_uInt16 /*nItemVersion*/ ) const +{ + rStream << maMatrix.m00; + rStream << maMatrix.m01; + rStream << maMatrix.m02; + rStream << maMatrix.m10; + rStream << maMatrix.m11; + rStream << maMatrix.m12; + return rStream; +} + +sal_Bool AffineMatrixItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const +{ + rVal <<= maMatrix; + return sal_True; +} + +sal_Bool AffineMatrixItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) +{ + if (rVal >>= maMatrix) + { + return sal_True; + } + + DBG_ERROR( "AffineMatrixItem::PutValue - Wrong type!" ); + return sal_False; +} + +const com::sun::star::geometry::AffineMatrix2D& AffineMatrixItem::GetAffineMatrix2D() const +{ + return maMatrix; +} + //----------------------- // class XLineCapItem - //----------------------- diff --git a/svx/source/xoutdev/xpool.cxx b/svx/source/xoutdev/xpool.cxx index 5e452f417767..4dad4a90c20a 100644 --- a/svx/source/xoutdev/xpool.cxx +++ b/svx/source/xoutdev/xpool.cxx @@ -162,6 +162,13 @@ XOutdevItemPool::XOutdevItemPool( mpLocalItemInfos[XATTR_FORMTXTSHDWYVAL -XATTR_START]._nSID = SID_FORMTEXT_SHDWYVAL; mpLocalItemInfos[XATTR_FORMTXTHIDEFORM -XATTR_START]._nSID = SID_FORMTEXT_HIDEFORM; + // associate new slots for panels with known items + mpLocalItemInfos[XATTR_FILLTRANSPARENCE - XATTR_START]._nSID = SID_ATTR_FILL_TRANSPARENCE; + mpLocalItemInfos[XATTR_FILLFLOATTRANSPARENCE - XATTR_START]._nSID = SID_ATTR_FILL_FLOATTRANSPARENCE; + mpLocalItemInfos[XATTR_LINETRANSPARENCE - XATTR_START]._nSID = SID_ATTR_LINE_TRANSPARENCE; + mpLocalItemInfos[XATTR_LINEJOINT - XATTR_START]._nSID = SID_ATTR_LINE_JOINT; + mpLocalItemInfos[XATTR_LINECAP - XATTR_START]._nSID = SID_ATTR_LINE_CAP; + // if it's my own creation level, set Defaults and ItemInfos if(XATTR_START == GetFirstWhich() && XATTR_END == GetLastWhich()) { diff --git a/svx/source/xoutdev/xtabbtmp.cxx b/svx/source/xoutdev/xtabbtmp.cxx index 4b7993b9c5c7..eaae50f49b3b 100644 --- a/svx/source/xoutdev/xtabbtmp.cxx +++ b/svx/source/xoutdev/xtabbtmp.cxx @@ -51,102 +51,13 @@ static char const aChckBitmap0[] = { 0x04, 0x00, 'S','O','B','0'}; // old static char const aChckBitmap1[] = { 0x04, 0x00, 'S','O','B','1'}; // = 5.2 static char const aChckXML[] = { 'P', 'K', 0x03, 0x04 }; // = 6.0 -// ------------------- -// class XBitmapTable -// ------------------- - -/************************************************************************* -|* -|* XBitmapTable::XBitmapTable() -|* -*************************************************************************/ - -XBitmapTable::XBitmapTable( const String& rPath, - XOutdevItemPool* pInPool, - sal_uInt16 nInitSize, sal_uInt16 nReSize ) : - XPropertyTable( rPath, pInPool, nInitSize, nReSize) -{ - pBmpTable = new Table( nInitSize, nReSize ); -} - -/************************************************************************/ - -XBitmapTable::~XBitmapTable() -{ -} - -/************************************************************************/ - -XBitmapEntry* XBitmapTable::Replace(long nIndex, XBitmapEntry* pEntry ) -{ - return (XBitmapEntry*) XPropertyTable::Replace(nIndex, pEntry); -} - -/************************************************************************/ - -XBitmapEntry* XBitmapTable::Remove(long nIndex) -{ - return (XBitmapEntry*) XPropertyTable::Remove(nIndex, 0); -} - -/************************************************************************/ - -XBitmapEntry* XBitmapTable::GetBitmap(long nIndex) const -{ - return (XBitmapEntry*) XPropertyTable::Get(nIndex, 0); -} - -/************************************************************************/ - -sal_Bool XBitmapTable::Load() -{ - return( sal_False ); -} - -/************************************************************************/ - -sal_Bool XBitmapTable::Save() -{ - return( sal_False ); -} - -/************************************************************************/ - -sal_Bool XBitmapTable::Create() -{ - return( sal_False ); -} - -/************************************************************************/ - -sal_Bool XBitmapTable::CreateBitmapsForUI() -{ - return( sal_False ); -} - -/************************************************************************/ - -Bitmap* XBitmapTable::CreateBitmapForUI( long /*nIndex*/, sal_Bool /*bDelete*/) -{ - return( NULL ); -} - // ------------------ // class XBitmapList // ------------------ -/************************************************************************* -|* -|* XBitmapList::XBitmapList() -|* -*************************************************************************/ - -XBitmapList::XBitmapList( const String& rPath, - XOutdevItemPool* pInPool, - sal_uInt16 nInitSize, sal_uInt16 nReSize ) : - XPropertyList( rPath, pInPool, nInitSize, nReSize) +XBitmapList::XBitmapList( const String& rPath, XOutdevItemPool* pInPool ) : + XPropertyList( rPath, pInPool ) { - // pBmpList = new List( nInitSize, nReSize ); } /************************************************************************/ @@ -180,19 +91,19 @@ XBitmapEntry* XBitmapList::GetBitmap(long nIndex) const sal_Bool XBitmapList::Load() { - if( bListDirty ) + if( mbListDirty ) { - bListDirty = sal_False; + mbListDirty = false; - INetURLObject aURL( aPath ); + INetURLObject aURL( maPath ); if( INET_PROT_NOT_VALID == aURL.GetProtocol() ) { - DBG_ASSERT( !aPath.Len(), "invalid URL" ); + DBG_ASSERT( !maPath.Len(), "invalid URL" ); return sal_False; } - aURL.Append( aName ); + aURL.Append( maName ); if( !aURL.getExtension().getLength() ) aURL.setExtension( rtl::OUString( pszExtBitmap, 3 ) ); @@ -207,15 +118,15 @@ sal_Bool XBitmapList::Load() sal_Bool XBitmapList::Save() { - INetURLObject aURL( aPath ); + INetURLObject aURL( maPath ); if( INET_PROT_NOT_VALID == aURL.GetProtocol() ) { - DBG_ASSERT( !aPath.Len(), "invalid URL" ); + DBG_ASSERT( !maPath.Len(), "invalid URL" ); return sal_False; } - aURL.Append( aName ); + aURL.Append( maName ); if( !aURL.getExtension().getLength() ) aURL.setExtension( rtl::OUString( pszExtBitmap, 3 ) ); @@ -276,16 +187,9 @@ sal_Bool XBitmapList::Create() /************************************************************************/ -sal_Bool XBitmapList::CreateBitmapsForUI() -{ - return( sal_False ); -} - -/************************************************************************/ - -Bitmap* XBitmapList::CreateBitmapForUI( long /*nIndex*/, sal_Bool /*bDelete*/) +Bitmap XBitmapList::CreateBitmapForUI( long /*nIndex*/ ) { - return( NULL ); + return Bitmap(); } // eof diff --git a/svx/source/xoutdev/xtabcolr.cxx b/svx/source/xoutdev/xtabcolr.cxx index e211e3753628..1d8cb45d6d34 100644 --- a/svx/source/xoutdev/xtabcolr.cxx +++ b/svx/source/xoutdev/xtabcolr.cxx @@ -55,78 +55,63 @@ static char const aChckColor[] = { 0x04, 0x00, 'S','O','C','L'}; // < 5.2 static char const aChckColor0[] = { 0x04, 0x00, 'S','O','C','0'}; // = 5.2 static char const aChckXML[] = { '<', '?', 'x', 'm', 'l' }; // = 6.0 -// ------------------ -// class XColorTable -// ------------------ - -static XColorTable* pTable=0; - /************************************************************************* |* -|* XColorTable::XColorTable() +|* XColorList::XColorList() |* *************************************************************************/ -XColorTable::XColorTable( const String& rPath, - XOutdevItemPool* pInPool, - sal_uInt16 nInitSize, sal_uInt16 nReSize ) : - XPropertyTable( rPath, pInPool, nInitSize, nReSize) +static XColorList* pStaticGlobalColorList = 0; + +XColorList::XColorList( const String& rPath, XOutdevItemPool* pInPool ) : + XPropertyList( rPath, pInPool ) { - // ColorTable braucht keine eigene BmpTable - // pBmpTable = new Table( nInitSize, nReSize ); } /************************************************************************/ -XColorTable::~XColorTable() -{ -} - -XColorTable* XColorTable::GetStdColorTable() +XColorList::~XColorList() { - if ( !pTable ) - pTable = new XColorTable( SvtPathOptions().GetPalettePath() ); - return pTable; } /************************************************************************/ -XColorEntry* XColorTable::Replace(long nIndex, XColorEntry* pEntry ) +XColorEntry* XColorList::Replace(XColorEntry* pEntry, long nIndex ) { - return (XColorEntry*) XPropertyTable::Replace(nIndex, pEntry); + return (XColorEntry*) XPropertyList::Replace(pEntry, nIndex); } /************************************************************************/ -XColorEntry* XColorTable::Remove(long nIndex) +XColorEntry* XColorList::Remove(long nIndex) { - return (XColorEntry*) XPropertyTable::Remove(nIndex, 0); + return (XColorEntry*) XPropertyList::Remove(nIndex, 0); } /************************************************************************/ -XColorEntry* XColorTable::GetColor(long nIndex) const +XColorEntry* XColorList::GetColor(long nIndex) const { - return (XColorEntry*) XPropertyTable::Get(nIndex, 0); + return (XColorEntry*) XPropertyList::Get(nIndex, 0); } /************************************************************************/ -sal_Bool XColorTable::Load() +sal_Bool XColorList::Load() { - if( bTableDirty ) + if( mbListDirty ) { - bTableDirty = sal_False; + mbListDirty = false; - INetURLObject aURL( aPath ); + INetURLObject aURL( maPath ); if( INET_PROT_NOT_VALID == aURL.GetProtocol() ) { - DBG_ASSERT( !aPath.Len(), "invalid URL" ); + DBG_ASSERT( !maPath.Len(), "invalid URL" ); return sal_False; } - aURL.Append( aName ); + aURL.Append( maName ); if( !aURL.getExtension().getLength() ) aURL.setExtension( rtl::OUString( pszExtColor, 3 ) ); @@ -139,17 +124,17 @@ sal_Bool XColorTable::Load() /************************************************************************/ -sal_Bool XColorTable::Save() +sal_Bool XColorList::Save() { - INetURLObject aURL( aPath ); + INetURLObject aURL( maPath ); if( INET_PROT_NOT_VALID == aURL.GetProtocol() ) { - DBG_ASSERT( !aPath.Len(), "invalid URL" ); + DBG_ASSERT( !maPath.Len(), "invalid URL" ); return sal_False; } - aURL.Append( aName ); + aURL.Append( maName ); if( !aURL.getExtension().getLength() ) aURL.setExtension( rtl::OUString( pszExtColor, 3 ) ); @@ -160,7 +145,7 @@ sal_Bool XColorTable::Save() /************************************************************************/ -sal_Bool XColorTable::Create() +sal_Bool XColorList::Create() { XubString aStr; xub_StrLen nLen; @@ -217,328 +202,249 @@ sal_Bool XColorTable::Create() for( sal_uInt16 n = 0; n < 16; ++n ) { - Insert( n, new XColorEntry( Color( aColTab[n] ), - String( ResId( aResId[ n ], rRes )) ) ); + Insert( new XColorEntry( Color( aColTab[n] ), String( ResId( aResId[ n ], rRes )) ), n ); } aStr = SVX_RESSTR( RID_SVXSTR_GREY ); aStr.AppendAscii(" 80%"); nLen = aStr.Len() - 3; - Insert(16, new XColorEntry( Color( 51, 51, 51 ), aStr ) ); + Insert( new XColorEntry( Color( 51, 51, 51 ), aStr ) , 16); aStr.SetChar(nLen, sal_Unicode('7')); - Insert(17, new XColorEntry( Color( 76, 76, 76 ), aStr ) ); + Insert( new XColorEntry( Color( 76, 76, 76 ), aStr ) , 17); aStr.SetChar(nLen, sal_Unicode('6')); - Insert(18, new XColorEntry( Color(102,102,102 ), aStr ) ); + Insert( new XColorEntry( Color(102,102,102 ), aStr ) , 18); aStr.SetChar(nLen, sal_Unicode('4')); - Insert(19, new XColorEntry( Color(153,153,153 ), aStr ) ); + Insert( new XColorEntry( Color(153,153,153 ), aStr ) , 19); aStr.SetChar(nLen, sal_Unicode('3')); - Insert(20, new XColorEntry( Color(179,179,179 ), aStr ) ); + Insert( new XColorEntry( Color(179,179,179 ), aStr ) , 20); aStr.SetChar(nLen, sal_Unicode('2')); - Insert(21, new XColorEntry( Color(204,204,204 ), aStr ) ); + Insert( new XColorEntry( Color(204,204,204 ), aStr ) , 21); // BM: new 15% aStr.SetChar(nLen, sal_Unicode('1')); aStr.SetChar(nLen + 1, sal_Unicode('5')); - Insert(22, new XColorEntry( Color(217,217,217 ), aStr ) ); + Insert( new XColorEntry( Color(217,217,217 ), aStr ) , 22); aStr.SetChar(nLen + 1, sal_Unicode('0')); - Insert(23, new XColorEntry( Color(230,230,230 ), aStr ) ); - Insert(24, new XColorEntry( Color(230,230,255 ), SVX_RESSTR( RID_SVXSTR_BLUEGREY ) ) ); + Insert( new XColorEntry( Color(230,230,230 ), aStr ) , 23); + Insert( new XColorEntry( Color(230,230,255 ), SVX_RESSTR( RID_SVXSTR_BLUEGREY ) ) , 24); aStr = SVX_RESSTR( RID_SVXSTR_RED ); aStr.AppendAscii(" 1"); nLen = aStr.Len() - 1; - Insert(25, new XColorEntry( Color(255, 51,102 ), aStr ) ); + Insert( new XColorEntry( Color(255, 51,102 ), aStr ) , 25); aStr.SetChar(nLen, sal_Unicode('2')); - Insert(26, new XColorEntry( Color(220, 35, 0 ), aStr ) ); + Insert( new XColorEntry( Color(220, 35, 0 ), aStr ) , 26); aStr.SetChar(nLen, sal_Unicode('3')); - Insert(27, new XColorEntry( Color(184, 71, 0 ), aStr ) ); + Insert( new XColorEntry( Color(184, 71, 0 ), aStr ) , 27); aStr.SetChar(nLen, sal_Unicode('4')); - Insert(28, new XColorEntry( Color(255, 51, 51 ), aStr ) ); + Insert( new XColorEntry( Color(255, 51, 51 ), aStr ) , 28); aStr.SetChar(nLen, sal_Unicode('5')); - Insert(29, new XColorEntry( Color(235, 97, 61 ), aStr ) ); + Insert( new XColorEntry( Color(235, 97, 61 ), aStr ) , 29); aStr.SetChar(nLen, sal_Unicode('6')); - Insert(30, new XColorEntry( Color(184, 71, 71 ), aStr ) ); + Insert( new XColorEntry( Color(184, 71, 71 ), aStr ) , 30); aStr.SetChar(nLen, sal_Unicode('7')); - Insert(31, new XColorEntry( Color(184, 0, 71 ), aStr ) ); + Insert( new XColorEntry( Color(184, 0, 71 ), aStr ) , 31); aStr.SetChar(nLen, sal_Unicode('8')); - Insert(32, new XColorEntry( Color(153, 40, 76 ), aStr ) ); + Insert( new XColorEntry( Color(153, 40, 76 ), aStr ) , 32); aStr = SVX_RESSTR( RID_SVXSTR_MAGENTA ); aStr.AppendAscii(" 1"); nLen = aStr.Len() - 1; - Insert(33, new XColorEntry( Color(148, 0,107 ), aStr ) ); + Insert( new XColorEntry( Color(148, 0,107 ), aStr ) , 33); aStr.SetChar(nLen, sal_Unicode('2')); - Insert(34, new XColorEntry( Color(148, 71,107 ), aStr ) ); + Insert( new XColorEntry( Color(148, 71,107 ), aStr ) , 34); aStr.SetChar(nLen, sal_Unicode('3')); - Insert(35, new XColorEntry( Color(148, 71,148 ), aStr ) ); + Insert( new XColorEntry( Color(148, 71,148 ), aStr ) , 35); aStr.SetChar(nLen, sal_Unicode('4')); - Insert(36, new XColorEntry( Color(153,102,204 ), aStr ) ); + Insert( new XColorEntry( Color(153,102,204 ), aStr ) , 36); aStr.SetChar(nLen, sal_Unicode('5')); - Insert(37, new XColorEntry( Color(107, 71,148 ), aStr ) ); + Insert( new XColorEntry( Color(107, 71,148 ), aStr ) , 37); aStr.SetChar(nLen, sal_Unicode('6')); - Insert(38, new XColorEntry( Color(107, 35,148 ), aStr ) ); + Insert( new XColorEntry( Color(107, 35,148 ), aStr ) , 38); aStr.SetChar(nLen, sal_Unicode('7')); - Insert(39, new XColorEntry( Color(107, 0,148 ), aStr ) ); + Insert( new XColorEntry( Color(107, 0,148 ), aStr ) , 39); aStr.SetChar(nLen, sal_Unicode('8')); - Insert(40, new XColorEntry( Color( 94, 17,166 ), aStr ) ); + Insert( new XColorEntry( Color( 94, 17,166 ), aStr ) , 40); aStr = SVX_RESSTR( RID_SVXSTR_BLUE ); aStr.AppendAscii(" 1"); nLen = aStr.Len() - 1; - Insert(41, new XColorEntry( Color( 40, 0,153 ), aStr ) ); + Insert( new XColorEntry( Color( 40, 0,153 ), aStr ) , 41); aStr.SetChar(nLen, sal_Unicode('2')); - Insert(42, new XColorEntry( Color( 71, 0,184 ), aStr ) ); + Insert( new XColorEntry( Color( 71, 0,184 ), aStr ) , 42); aStr.SetChar(nLen, sal_Unicode('3')); - Insert(43, new XColorEntry( Color( 35, 0,220 ), aStr ) ); + Insert( new XColorEntry( Color( 35, 0,220 ), aStr ) , 43); aStr.SetChar(nLen, sal_Unicode('4')); - Insert(44, new XColorEntry( Color( 35, 35,220 ), aStr ) ); + Insert( new XColorEntry( Color( 35, 35,220 ), aStr ) , 44); aStr.SetChar(nLen, sal_Unicode('5')); - Insert(45, new XColorEntry( Color( 0, 71,255 ), aStr ) ); + Insert( new XColorEntry( Color( 0, 71,255 ), aStr ) , 45); aStr.SetChar(nLen, sal_Unicode('6')); - Insert(46, new XColorEntry( Color( 0,153,255 ), aStr ) ); + Insert( new XColorEntry( Color( 0,153,255 ), aStr ) , 46); aStr.SetChar(nLen, sal_Unicode('7')); - Insert(47, new XColorEntry( Color( 0,184,255 ), aStr ) ); + Insert( new XColorEntry( Color( 0,184,255 ), aStr ) , 47); aStr.SetChar(nLen, sal_Unicode('8')); - Insert(48, new XColorEntry( Color(153,204,255 ), aStr ) ); + Insert( new XColorEntry( Color(153,204,255 ), aStr ) , 48); //Insert(48, new XColorEntry( Color( 46,215,255 ), aStr ) ); aStr = SVX_RESSTR( RID_SVXSTR_CYAN ); aStr.AppendAscii(" 1"); nLen = aStr.Len() - 1; - Insert(49, new XColorEntry( Color( 0,220,255 ), aStr ) ); + Insert( new XColorEntry( Color( 0,220,255 ), aStr ) , 49); aStr.SetChar(nLen, sal_Unicode('2')); - Insert(50, new XColorEntry( Color( 0,204,204 ), aStr ) ); + Insert( new XColorEntry( Color( 0,204,204 ), aStr ) , 50); aStr.SetChar(nLen, sal_Unicode('3')); - Insert(51, new XColorEntry( Color( 35,184,220 ), aStr ) ); + Insert( new XColorEntry( Color( 35,184,220 ), aStr ) , 51); aStr.SetChar(nLen, sal_Unicode('4')); - Insert(52, new XColorEntry( Color( 71,184,184 ), aStr ) ); + Insert( new XColorEntry( Color( 71,184,184 ), aStr ) , 52); aStr.SetChar(nLen, sal_Unicode('5')); - Insert(53, new XColorEntry( Color( 51,163,163 ), aStr ) ); + Insert( new XColorEntry( Color( 51,163,163 ), aStr ) , 53); aStr.SetChar(nLen, sal_Unicode('6')); - Insert(54, new XColorEntry( Color( 25,138,138 ), aStr ) ); + Insert( new XColorEntry( Color( 25,138,138 ), aStr ) , 54); aStr.SetChar(nLen, sal_Unicode('7')); - Insert(55, new XColorEntry( Color( 0,107,107 ), aStr ) ); + Insert( new XColorEntry( Color( 0,107,107 ), aStr ) , 55); aStr.SetChar(nLen, sal_Unicode('8')); - Insert(56, new XColorEntry( Color( 0, 74, 74 ), aStr ) ); + Insert( new XColorEntry( Color( 0, 74, 74 ), aStr ) , 56); aStr = SVX_RESSTR( RID_SVXSTR_GREEN ); aStr.AppendAscii(" 1"); nLen = aStr.Len() - 1; - Insert(57, new XColorEntry( Color( 53, 94, 0 ), aStr ) ); + Insert( new XColorEntry( Color( 53, 94, 0 ), aStr ) , 57); aStr.SetChar(nLen, sal_Unicode('2')); - Insert(58, new XColorEntry( Color( 92,133, 38 ), aStr ) ); + Insert( new XColorEntry( Color( 92,133, 38 ), aStr ) , 58); aStr.SetChar(nLen, sal_Unicode('3')); - Insert(59, new XColorEntry( Color(125,166, 71 ), aStr ) ); + Insert( new XColorEntry( Color(125,166, 71 ), aStr ) , 59); aStr.SetChar(nLen, sal_Unicode('4')); - Insert(60, new XColorEntry( Color(148,189, 94 ), aStr ) ); + Insert( new XColorEntry( Color(148,189, 94 ), aStr ) , 60); aStr.SetChar(nLen, sal_Unicode('5')); - Insert(61, new XColorEntry( Color( 0,174, 0 ), aStr ) ); + Insert( new XColorEntry( Color( 0,174, 0 ), aStr ) , 61); aStr.SetChar(nLen, sal_Unicode('6')); - Insert(62, new XColorEntry( Color( 51,204,102 ), aStr ) ); + Insert( new XColorEntry( Color( 51,204,102 ), aStr ) , 62); aStr.SetChar(nLen, sal_Unicode('7')); - Insert(63, new XColorEntry( Color( 61,235, 61 ), aStr ) ); + Insert( new XColorEntry( Color( 61,235, 61 ), aStr ) , 63); aStr.SetChar(nLen, sal_Unicode('8')); - Insert(64, new XColorEntry( Color( 35,255, 35 ), aStr ) ); + Insert( new XColorEntry( Color( 35,255, 35 ), aStr ) , 64); aStr = SVX_RESSTR( RID_SVXSTR_YELLOW ); aStr.AppendAscii(" 1"); nLen = aStr.Len() - 1; - Insert(65, new XColorEntry( Color(230,255, 0 ), aStr ) ); + Insert( new XColorEntry( Color(230,255, 0 ), aStr ) , 65); aStr.SetChar(nLen, sal_Unicode('2')); - Insert(66, new XColorEntry( Color(255,255,153 ), aStr ) ); + Insert( new XColorEntry( Color(255,255,153 ), aStr ) , 66); aStr.SetChar(nLen, sal_Unicode('3')); - Insert(67, new XColorEntry( Color(255,255,102 ), aStr ) ); + Insert( new XColorEntry( Color(255,255,102 ), aStr ) , 67); aStr.SetChar(nLen, sal_Unicode('4')); - Insert(68, new XColorEntry( Color(230,230, 76 ), aStr ) ); + Insert( new XColorEntry( Color(230,230, 76 ), aStr ) , 68); aStr.SetChar(nLen, sal_Unicode('5')); - Insert(69, new XColorEntry( Color(204,204, 0 ), aStr ) ); + Insert( new XColorEntry( Color(204,204, 0 ), aStr ) , 69); aStr.SetChar(nLen, sal_Unicode('6')); - Insert(70, new XColorEntry( Color(179,179, 0 ), aStr ) ); + Insert( new XColorEntry( Color(179,179, 0 ), aStr ) , 70); aStr.SetChar(nLen, sal_Unicode('7')); - Insert(71, new XColorEntry( Color(128,128, 25 ), aStr ) ); + Insert( new XColorEntry( Color(128,128, 25 ), aStr ) , 71); aStr.SetChar(nLen, sal_Unicode('8')); - Insert(72, new XColorEntry( Color(102,102, 0 ), aStr ) ); + Insert( new XColorEntry( Color(102,102, 0 ), aStr ) , 72); aStr = SVX_RESSTR( RID_SVXSTR_BROWN ); aStr.AppendAscii(" 1"); nLen = aStr.Len() - 1; - Insert(73, new XColorEntry( Color( 76, 25, 0 ), aStr ) ); + Insert( new XColorEntry( Color( 76, 25, 0 ), aStr ) , 73); aStr.SetChar(nLen, sal_Unicode('2')); - Insert(74, new XColorEntry( Color(102, 51, 0 ), aStr ) ); + Insert( new XColorEntry( Color(102, 51, 0 ), aStr ) , 74); aStr.SetChar(nLen, sal_Unicode('3')); - Insert(75, new XColorEntry( Color(128, 76, 25 ), aStr ) ); + Insert( new XColorEntry( Color(128, 76, 25 ), aStr ) , 75); aStr.SetChar(nLen, sal_Unicode('4')); - Insert(76, new XColorEntry( Color(153,102, 51 ), aStr ) ); + Insert( new XColorEntry( Color(153,102, 51 ), aStr ) , 76); aStr = SVX_RESSTR( RID_SVXSTR_ORANGE ); aStr.AppendAscii(" 1"); nLen = aStr.Len() - 1; - Insert(77, new XColorEntry( Color(204,102, 51 ), aStr ) ); + Insert( new XColorEntry( Color(204,102, 51 ), aStr ) , 77); aStr.SetChar(nLen, sal_Unicode('2')); - Insert(78, new XColorEntry( Color(255,102, 51 ), aStr ) ); + Insert( new XColorEntry( Color(255,102, 51 ), aStr ) , 78); aStr.SetChar(nLen, sal_Unicode('3')); - Insert(79, new XColorEntry( Color(255,153,102 ), aStr ) ); + Insert( new XColorEntry( Color(255,153,102 ), aStr ) , 79); aStr.SetChar(nLen, sal_Unicode('4')); - Insert(80, new XColorEntry( Color(255,204,153 ), aStr ) ); + Insert( new XColorEntry( Color(255,204,153 ), aStr ) , 80); // new chart colors aStr = SVX_RESSTR( RID_SVXSTR_VIOLET ); - Insert( 81, new XColorEntry( Color( 0x99, 0x99, 0xff ), aStr ) ); + Insert( new XColorEntry( Color( 0x99, 0x99, 0xff ), aStr ) , 81); aStr = SVX_RESSTR( RID_SVXSTR_BORDEAUX ); - Insert( 82, new XColorEntry( Color( 0x99, 0x33, 0x66 ), aStr ) ); + Insert( new XColorEntry( Color( 0x99, 0x33, 0x66 ), aStr ) , 82); aStr = SVX_RESSTR( RID_SVXSTR_PALE_YELLOW ); - Insert( 83, new XColorEntry( Color( 0xff, 0xff, 0xcc ), aStr ) ); + Insert( new XColorEntry( Color( 0xff, 0xff, 0xcc ), aStr ) , 83); aStr = SVX_RESSTR( RID_SVXSTR_PALE_GREEN ); - Insert( 84, new XColorEntry( Color( 0xcc, 0xff, 0xff ), aStr ) ); + Insert( new XColorEntry( Color( 0xcc, 0xff, 0xff ), aStr ) , 84); aStr = SVX_RESSTR( RID_SVXSTR_DKVIOLET ); - Insert( 85, new XColorEntry( Color( 0x66, 0x00, 0x66 ), aStr ) ); + Insert( new XColorEntry( Color( 0x66, 0x00, 0x66 ), aStr ) , 85); aStr = SVX_RESSTR( RID_SVXSTR_SALMON ); - Insert( 86, new XColorEntry( Color( 0xff, 0x80, 0x80 ), aStr ) ); + Insert( new XColorEntry( Color( 0xff, 0x80, 0x80 ), aStr ) , 86); aStr = SVX_RESSTR( RID_SVXSTR_SEABLUE ); - Insert( 87, new XColorEntry( Color( 0x00, 0x66, 0xcc ), aStr ) ); + Insert( new XColorEntry( Color( 0x00, 0x66, 0xcc ), aStr ) , 87); // Sun colors aStr = SVX_RESSTR( RID_SVXSTR_COLOR_SUN ); aStr.AppendAscii(" 1"); nLen = aStr.Len() - 1; - Insert( 88, new XColorEntry( Color( 0x33, 0x33, 0x66 ), aStr ) ); + Insert( new XColorEntry( Color( 0x33, 0x33, 0x66 ), aStr ) , 88); aStr.SetChar(nLen, sal_Unicode('2')); - Insert( 89, new XColorEntry( Color( 0x66, 0x66, 0x99 ), aStr ) ); + Insert( new XColorEntry( Color( 0x66, 0x66, 0x99 ), aStr ) , 89); aStr.SetChar(nLen, sal_Unicode('3')); - Insert( 90, new XColorEntry( Color( 0x99, 0x99, 0xcc ), aStr ) ); + Insert( new XColorEntry( Color( 0x99, 0x99, 0xcc ), aStr ) , 90); aStr.SetChar(nLen, sal_Unicode('4')); - Insert( 91, new XColorEntry( Color( 0xcc, 0xcc, 0xff ), aStr ) ); + Insert( new XColorEntry( Color( 0xcc, 0xcc, 0xff ), aStr ) , 91); // Chart default colors aStr = SVX_RESSTR( RID_SVXSTR_COLOR_CHART ); aStr.AppendAscii(" 1"); nLen = aStr.Len() - 1; - Insert( 92, new XColorEntry( Color( 0x00, 0x45, 0x86 ), aStr ) ); + Insert( new XColorEntry( Color( 0x00, 0x45, 0x86 ), aStr ) , 92); aStr.SetChar(nLen, sal_Unicode('2')); - Insert( 93, new XColorEntry( Color( 0xff, 0x42, 0x0e ), aStr ) ); + Insert( new XColorEntry( Color( 0xff, 0x42, 0x0e ), aStr ) , 93); aStr.SetChar(nLen, sal_Unicode('3')); - Insert( 94, new XColorEntry( Color( 0xff, 0xd3, 0x20 ), aStr ) ); + Insert( new XColorEntry( Color( 0xff, 0xd3, 0x20 ), aStr ) , 94); aStr.SetChar(nLen, sal_Unicode('4')); - Insert( 95, new XColorEntry( Color( 0x57, 0x9d, 0x1c ), aStr ) ); + Insert( new XColorEntry( Color( 0x57, 0x9d, 0x1c ), aStr ) , 95); aStr.SetChar(nLen, sal_Unicode('5')); - Insert( 96, new XColorEntry( Color( 0x7e, 0x00, 0x21 ), aStr ) ); + Insert( new XColorEntry( Color( 0x7e, 0x00, 0x21 ), aStr ) , 96); aStr.SetChar(nLen, sal_Unicode('6')); - Insert( 97, new XColorEntry( Color( 0x83, 0xca, 0xff ), aStr ) ); + Insert( new XColorEntry( Color( 0x83, 0xca, 0xff ), aStr ) , 97); aStr.SetChar(nLen, sal_Unicode('7')); - Insert( 98, new XColorEntry( Color( 0x31, 0x40, 0x04 ), aStr ) ); + Insert( new XColorEntry( Color( 0x31, 0x40, 0x04 ), aStr ) , 98); aStr.SetChar(nLen, sal_Unicode('8')); - Insert( 99, new XColorEntry( Color( 0xae, 0xcf, 0x00 ), aStr ) ); + Insert( new XColorEntry( Color( 0xae, 0xcf, 0x00 ), aStr ) , 99); aStr.SetChar(nLen, sal_Unicode('9')); - Insert( 100, new XColorEntry( Color( 0x4b, 0x1f, 0x6f ), aStr ) ); + Insert( new XColorEntry( Color( 0x4b, 0x1f, 0x6f ), aStr ) , 100); aStr.SetChar(nLen, sal_Unicode('1')); aStr.AppendAscii("0"); nLen = aStr.Len() - 1; - Insert( 101, new XColorEntry( Color( 0xff, 0x95, 0x0e ), aStr ) ); + Insert( new XColorEntry( Color( 0xff, 0x95, 0x0e ), aStr ) , 101); aStr.SetChar(nLen, sal_Unicode('1')); - Insert( 102, new XColorEntry( Color( 0xc5, 0x00, 0x0b ), aStr ) ); + Insert( new XColorEntry( Color( 0xc5, 0x00, 0x0b ), aStr ) , 102); aStr.SetChar(nLen, sal_Unicode('2')); - Insert( 103, new XColorEntry( Color( 0x00, 0x84, 0xd1 ), aStr ) ); + Insert( new XColorEntry( Color( 0x00, 0x84, 0xd1 ), aStr ) , 103); return( Count() == 104 ); } /************************************************************************/ -sal_Bool XColorTable::CreateBitmapsForUI() -{ - return( sal_False ); -} - -/************************************************************************/ - -Bitmap* XColorTable::CreateBitmapForUI( long /*nIndex*/, sal_Bool /*bDelete*/) -{ - return( NULL ); -} - -// -------------------- -// class XColorList -// -------------------- - -/************************************************************************* -|* -|* XColorList::XColorList() -|* -*************************************************************************/ - -XColorList::XColorList( const String& rPath, - XOutdevItemPool* pInPool, - sal_uInt16 nInitSize, sal_uInt16 nReSize ) : - XPropertyList( rPath, pInPool, nInitSize, nReSize) -{ - // pBmpList = new List( nInitSize, nReSize ); -} - -/************************************************************************/ - -XColorList::~XColorList() +Bitmap XColorList::CreateBitmapForUI( long /*nIndex*/ ) { + return Bitmap(); } /************************************************************************/ -XColorEntry* XColorList::Replace(XColorEntry* pEntry, long nIndex ) -{ - return (XColorEntry*) XPropertyList::Replace(pEntry, nIndex); -} - -/************************************************************************/ - -XColorEntry* XColorList::Remove(long nIndex) -{ - return (XColorEntry*) XPropertyList::Remove(nIndex, 0); -} - -/************************************************************************/ - -XColorEntry* XColorList::GetColor(long nIndex) const -{ - return (XColorEntry*) XPropertyList::Get(nIndex, 0); -} - -/************************************************************************/ - -sal_Bool XColorList::Load() -{ - return( sal_False ); -} - -/************************************************************************/ - -sal_Bool XColorList::Save() -{ - return( sal_False ); -} - -/************************************************************************/ - -sal_Bool XColorList::Create() -{ - return( sal_False ); -} - -/************************************************************************/ - -sal_Bool XColorList::CreateBitmapsForUI() -{ - return( sal_False ); -} - -/************************************************************************/ - -Bitmap* XColorList::CreateBitmapForUI( long /*nIndex*/, sal_Bool /*bDelete*/) +XColorList* XColorList::GetStdColorList() { - return( NULL ); + if ( !pStaticGlobalColorList ) + pStaticGlobalColorList = new XColorList( SvtPathOptions().GetPalettePath() ); + return pStaticGlobalColorList; } // eof diff --git a/svx/source/xoutdev/xtabdash.cxx b/svx/source/xoutdev/xtabdash.cxx index 84f52f7291b4..3ae3eb715575 100644 --- a/svx/source/xoutdev/xtabdash.cxx +++ b/svx/source/xoutdev/xtabdash.cxx @@ -70,86 +70,6 @@ char const aChckDash[] = { 0x04, 0x00, 'S','O','D','L'}; // < 5.2 char const aChckDash0[] = { 0x04, 0x00, 'S','O','D','0'}; // = 5.2 char const aChckXML[] = { '<', '?', 'x', 'm', 'l' }; // = 6.0 -// ----------------- -// class XDashTable -// ----------------- - -/************************************************************************* -|* -|* XDashTable::XDashTable() -|* -*************************************************************************/ - -XDashTable::XDashTable( const String& rPath, - XOutdevItemPool* pInPool, - sal_uInt16 nInitSize, sal_uInt16 nReSize ) : - XPropertyTable( rPath, pInPool, nInitSize, nReSize) -{ - pBmpTable = new Table( nInitSize, nReSize ); -} - -/************************************************************************/ - -XDashTable::~XDashTable() -{ -} - -/************************************************************************/ - -XDashEntry* XDashTable::Replace(long nIndex, XDashEntry* pEntry ) -{ - return (XDashEntry*) XPropertyTable::Replace(nIndex, pEntry); -} - -/************************************************************************/ - -XDashEntry* XDashTable::Remove(long nIndex) -{ - return (XDashEntry*) XPropertyTable::Remove(nIndex, 0); -} - -/************************************************************************/ - -XDashEntry* XDashTable::GetDash(long nIndex) const -{ - return (XDashEntry*) XPropertyTable::Get(nIndex, 0); -} - -/************************************************************************/ - -sal_Bool XDashTable::Load() -{ - return( sal_False ); -} - -/************************************************************************/ - -sal_Bool XDashTable::Save() -{ - return( sal_False ); -} - -/************************************************************************/ - -sal_Bool XDashTable::Create() -{ - return( sal_False ); -} - -/************************************************************************/ - -sal_Bool XDashTable::CreateBitmapsForUI() -{ - return( sal_False ); -} - -/************************************************************************/ - -Bitmap* XDashTable::CreateBitmapForUI( long /*nIndex*/, sal_Bool /*bDelete*/) -{ - return( NULL ); -} - // ---------------- // class XDashList // ---------------- @@ -193,11 +113,12 @@ void XDashList::impCreate() VirtualDevice* pVirDev = new VirtualDevice; OSL_ENSURE(0 != pVirDev, "XDashList: no VirtualDevice created!" ); pVirDev->SetMapMode(MAP_100TH_MM); - const Size aSize(pVirDev->PixelToLogic(Size(BITMAP_WIDTH * 2, BITMAP_HEIGHT))); + const Size aSize(pVirDev->PixelToLogic(Size(getUiBitmapWidth() * 2, getUiBitmapHeight()))); pVirDev->SetOutputSize(aSize); pVirDev->SetDrawMode(rStyleSettings.GetHighContrastMode() ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT : DRAWMODE_DEFAULT); + pVirDev->SetBackground(rStyleSettings.GetFieldColor()); SdrModel* pSdrModel = new SdrModel(); OSL_ENSURE(0 != pSdrModel, "XDashList: no SdrModel created!" ); @@ -221,8 +142,8 @@ void XDashList::impCreate() pLineObject->SetModel(pSdrModel); pLineObject->SetMergedItem(XLineStyleItem(XLINE_DASH)); pLineObject->SetMergedItem(XLineColorItem(String(), rStyleSettings.GetFieldTextColor())); - pLineObject->SetMergedItem(XLineWidthItem(30)); - + const Size aLineWidth(pVirDev->PixelToLogic(Size(getUiBitmapLineWidth(), 0))); + pLineObject->SetMergedItem(XLineWidthItem(aLineWidth.getWidth())); mpData = new impXDashList(pVirDev, pSdrModel, pBackgroundObject, pLineObject); OSL_ENSURE(0 != mpData, "XDashList: data creation went wrong!" ); } @@ -237,11 +158,13 @@ void XDashList::impDestroy() } } -XDashList::XDashList(const String& rPath, XOutdevItemPool* pInPool, sal_uInt16 nInitSize, sal_uInt16 nReSize) -: XPropertyList(rPath, pInPool, nInitSize, nReSize), - mpData(0) +XDashList::XDashList(const String& rPath, XOutdevItemPool* pInPool ) +: XPropertyList(rPath, pInPool ), + mpData(0), + maBitmapSolidLine(), + maStringSolidLine(), + maStringNoLine() { - pBmpList = new List(nInitSize, nReSize); } XDashList::~XDashList() @@ -266,19 +189,19 @@ XDashEntry* XDashList::GetDash(long nIndex) const sal_Bool XDashList::Load() { - if( bListDirty ) + if( mbListDirty ) { - bListDirty = sal_False; + mbListDirty = false; - INetURLObject aURL( aPath ); + INetURLObject aURL( maPath ); if( INET_PROT_NOT_VALID == aURL.GetProtocol() ) { - DBG_ASSERT( !aPath.Len(), "invalid URL" ); + DBG_ASSERT( !maPath.Len(), "invalid URL" ); return sal_False; } - aURL.Append( aName ); + aURL.Append( maName ); if( !aURL.getExtension().getLength() ) aURL.setExtension( rtl::OUString( pszExtDash, 3 ) ); @@ -291,15 +214,15 @@ sal_Bool XDashList::Load() sal_Bool XDashList::Save() { - INetURLObject aURL( aPath ); + INetURLObject aURL( maPath ); if( INET_PROT_NOT_VALID == aURL.GetProtocol() ) { - DBG_ASSERT( !aPath.Len(), "invalid URL" ); + DBG_ASSERT( !maPath.Len(), "invalid URL" ); return sal_False; } - aURL.Append( aName ); + aURL.Append( maName ); if( !aURL.getExtension().getLength() ) aURL.setExtension( rtl::OUString( pszExtDash, 3 ) ); @@ -324,32 +247,21 @@ sal_Bool XDashList::Create() return( sal_True ); } -sal_Bool XDashList::CreateBitmapsForUI() -{ - impCreate(); - - for( long i = 0; i < Count(); i++) - { - Bitmap* pBmp = CreateBitmapForUI( i, sal_False ); - DBG_ASSERT( pBmp, "XDashList: Bitmap(UI) konnte nicht erzeugt werden!" ); - - if( pBmp ) - pBmpList->Insert( pBmp, i ); - } - - impDestroy(); - - return( sal_True ); -} - -Bitmap* XDashList::CreateBitmapForUI( long nIndex, sal_Bool bDelete ) +Bitmap XDashList::ImpCreateBitmapForXDash(const XDash* pDash) { impCreate(); VirtualDevice* pVD = mpData->getVirtualDevice(); SdrObject* pLine = mpData->getLineObject(); - pLine->SetMergedItem(XLineStyleItem(XLINE_DASH)); - pLine->SetMergedItem(XLineDashItem(String(), GetDash(nIndex)->GetDash())); + if(pDash) + { + pLine->SetMergedItem(XLineStyleItem(XLINE_DASH)); + pLine->SetMergedItem(XLineDashItem(String(), *pDash)); + } + else + { + pLine->SetMergedItem(XLineStyleItem(XLINE_SOLID)); + } sdr::contact::SdrObjectVector aObjectVector; aObjectVector.push_back(mpData->getBackgroundObject()); @@ -357,17 +269,50 @@ Bitmap* XDashList::CreateBitmapForUI( long nIndex, sal_Bool bDelete ) sdr::contact::ObjectContactOfObjListPainter aPainter(*pVD, aObjectVector, 0); sdr::contact::DisplayInfo aDisplayInfo; + pVD->Erase(); aPainter.ProcessDisplay(aDisplayInfo); const Point aZero(0, 0); - Bitmap* pBitmap = new Bitmap(pVD->GetBitmap(aZero, pVD->GetOutputSize())); + return pVD->GetBitmap(aZero, pVD->GetOutputSize()); +} + +Bitmap XDashList::CreateBitmapForUI( long nIndex ) +{ + const XDash& rDash = GetDash(nIndex)->GetDash(); + + return ImpCreateBitmapForXDash(&rDash); +} + +Bitmap XDashList::GetBitmapForUISolidLine() const +{ + if(maBitmapSolidLine.IsEmpty()) + { + const_cast< XDashList* >(this)->maBitmapSolidLine = const_cast< XDashList* >(this)->ImpCreateBitmapForXDash(0); + } - if(bDelete) + return maBitmapSolidLine; +} + +String XDashList::GetStringForUiSolidLine() const +{ + if(!maStringSolidLine.Len()) + { + const_cast< XDashList* >(this)->maStringSolidLine = String(ResId(RID_SVXSTR_SOLID, DIALOG_MGR())); + } + + return maStringSolidLine; +} + +String XDashList::GetStringForUiNoLine() const +{ + if(!maStringNoLine.Len()) { - impDestroy(); + // formally was RID_SVXSTR_INVISIBLE, but tomake equal + // everywhere, use RID_SVXSTR_NONE + const_cast< XDashList* >(this)->maStringNoLine = String(ResId(RID_SVXSTR_NONE, DIALOG_MGR())); } - return pBitmap; + return maStringNoLine; } ////////////////////////////////////////////////////////////////////////////// diff --git a/svx/source/xoutdev/xtabgrdt.cxx b/svx/source/xoutdev/xtabgrdt.cxx index 692c0f25cd1c..69e19acac5df 100644 --- a/svx/source/xoutdev/xtabgrdt.cxx +++ b/svx/source/xoutdev/xtabgrdt.cxx @@ -67,86 +67,6 @@ char const aChckGradient[] = { 0x04, 0x00, 'S','O','G','L'}; // < 5.2 char const aChckGradient0[] = { 0x04, 0x00, 'S','O','G','0'}; // = 5.2 char const aChckXML[] = { '<', '?', 'x', 'm', 'l' }; // = 6.0 -// --------------------- -// class XGradientTable -// --------------------- - -/************************************************************************* -|* -|* XGradientTable::XGradientTable() -|* -*************************************************************************/ - -XGradientTable::XGradientTable( const String& rPath, - XOutdevItemPool* pInPool, - sal_uInt16 nInitSize, sal_uInt16 nReSize ) : - XPropertyTable( rPath, pInPool, nInitSize, nReSize) -{ - pBmpTable = new Table( nInitSize, nReSize ); -} - -/************************************************************************/ - -XGradientTable::~XGradientTable() -{ -} - -/************************************************************************/ - -XGradientEntry* XGradientTable::Replace(long nIndex, XGradientEntry* pEntry ) -{ - return (XGradientEntry*) XPropertyTable::Replace(nIndex, pEntry); -} - -/************************************************************************/ - -XGradientEntry* XGradientTable::Remove(long nIndex) -{ - return (XGradientEntry*) XPropertyTable::Remove(nIndex, 0); -} - -/************************************************************************/ - -XGradientEntry* XGradientTable::GetGradient(long nIndex) const -{ - return (XGradientEntry*) XPropertyTable::Get(nIndex, 0); -} - -/************************************************************************/ - -sal_Bool XGradientTable::Load() -{ - return( sal_False ); -} - -/************************************************************************/ - -sal_Bool XGradientTable::Save() -{ - return( sal_False ); -} - -/************************************************************************/ - -sal_Bool XGradientTable::Create() -{ - return( sal_False ); -} - -/************************************************************************/ - -sal_Bool XGradientTable::CreateBitmapsForUI() -{ - return( sal_False ); -} - -/************************************************************************/ - -Bitmap* XGradientTable::CreateBitmapForUI( long /*nIndex*/, sal_Bool /*bDelete*/) -{ - return( NULL ); -} - // -------------------- // class XGradientList // -------------------- @@ -186,11 +106,12 @@ void XGradientList::impCreate() VirtualDevice* pVirDev = new VirtualDevice; OSL_ENSURE(0 != pVirDev, "XGradientList: no VirtualDevice created!" ); pVirDev->SetMapMode(MAP_100TH_MM); - const Size aSize(pVirDev->PixelToLogic(Size(BITMAP_WIDTH, BITMAP_HEIGHT))); + const Size aSize(pVirDev->PixelToLogic(Size(getUiBitmapWidth(), getUiBitmapHeight()))); pVirDev->SetOutputSize(aSize); pVirDev->SetDrawMode(rStyleSettings.GetHighContrastMode() ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT : DRAWMODE_DEFAULT); + pVirDev->SetBackground(rStyleSettings.GetFieldColor()); SdrModel* pSdrModel = new SdrModel(); OSL_ENSURE(0 != pSdrModel, "XGradientList: no SdrModel created!" ); @@ -204,7 +125,7 @@ void XGradientList::impCreate() pBackgroundObject->SetMergedItem(XFillStyleItem(XFILL_GRADIENT)); pBackgroundObject->SetMergedItem(XLineStyleItem(XLINE_SOLID)); pBackgroundObject->SetMergedItem(XLineColorItem(String(), Color(COL_BLACK))); - pBackgroundObject->SetMergedItem(XGradientStepCountItem(sal_uInt16((BITMAP_WIDTH + BITMAP_HEIGHT) / 3))); + pBackgroundObject->SetMergedItem(XGradientStepCountItem(sal_uInt16((getUiBitmapWidth() + getUiBitmapHeight()) / 3))); mpData = new impXGradientList(pVirDev, pSdrModel, pBackgroundObject); OSL_ENSURE(0 != mpData, "XGradientList: data creation went wrong!" ); @@ -220,11 +141,10 @@ void XGradientList::impDestroy() } } -XGradientList::XGradientList( const String& rPath, XOutdevItemPool* pInPool, sal_uInt16 nInitSize, sal_uInt16 nReSize) -: XPropertyList(rPath, pInPool, nInitSize, nReSize), +XGradientList::XGradientList( const String& rPath, XOutdevItemPool* pInPool ) +: XPropertyList(rPath, pInPool ), mpData(0) { - pBmpList = new List(nInitSize, nReSize); } XGradientList::~XGradientList() @@ -253,19 +173,19 @@ XGradientEntry* XGradientList::GetGradient(long nIndex) const sal_Bool XGradientList::Load() { - if( bListDirty ) + if( mbListDirty ) { - bListDirty = sal_False; + mbListDirty = false; - INetURLObject aURL( aPath ); + INetURLObject aURL( maPath ); if( INET_PROT_NOT_VALID == aURL.GetProtocol() ) { - DBG_ASSERT( !aPath.Len(), "invalid URL" ); + DBG_ASSERT( !maPath.Len(), "invalid URL" ); return sal_False; } - aURL.Append( aName ); + aURL.Append( maName ); if( !aURL.getExtension().getLength() ) aURL.setExtension( rtl::OUString( pszExtGradient, 3 ) ); @@ -279,15 +199,15 @@ sal_Bool XGradientList::Load() sal_Bool XGradientList::Save() { - INetURLObject aURL( aPath ); + INetURLObject aURL( maPath ); if( INET_PROT_NOT_VALID == aURL.GetProtocol() ) { - DBG_ASSERT( !aPath.Len(), "invalid URL" ); + DBG_ASSERT( !maPath.Len(), "invalid URL" ); return sal_False; } - aURL.Append( aName ); + aURL.Append( maName ); if( !aURL.getExtension().getLength() ) aURL.setExtension( rtl::OUString( pszExtGradient, 3 ) ); @@ -318,25 +238,7 @@ sal_Bool XGradientList::Create() return( sal_True ); } -sal_Bool XGradientList::CreateBitmapsForUI() -{ - impCreate(); - - for( long i = 0; i < Count(); i++) - { - Bitmap* pBmp = CreateBitmapForUI( i, sal_False ); - DBG_ASSERT( pBmp, "XGradientList: Bitmap(UI) konnte nicht erzeugt werden!" ); - - if( pBmp ) - pBmpList->Insert( pBmp, i ); - } - - impDestroy(); - - return( sal_False ); -} - -Bitmap* XGradientList::CreateBitmapForUI( long nIndex, sal_Bool bDelete ) +Bitmap XGradientList::CreateBitmapForUI( long nIndex ) { impCreate(); VirtualDevice* pVD = mpData->getVirtualDevice(); @@ -351,17 +253,11 @@ Bitmap* XGradientList::CreateBitmapForUI( long nIndex, sal_Bool bDelete ) sdr::contact::ObjectContactOfObjListPainter aPainter(*pVD, aObjectVector, 0); sdr::contact::DisplayInfo aDisplayInfo; + pVD->Erase(); aPainter.ProcessDisplay(aDisplayInfo); const Point aZero(0, 0); - Bitmap* pBitmap = new Bitmap(pVD->GetBitmap(aZero, pVD->GetOutputSize())); - - if(bDelete) - { - impDestroy(); - } - - return pBitmap; + return pVD->GetBitmap(aZero, pVD->GetOutputSize()); } ////////////////////////////////////////////////////////////////////////////// diff --git a/svx/source/xoutdev/xtabhtch.cxx b/svx/source/xoutdev/xtabhtch.cxx index a5454144795f..7f0e6d7466d7 100644 --- a/svx/source/xoutdev/xtabhtch.cxx +++ b/svx/source/xoutdev/xtabhtch.cxx @@ -66,86 +66,6 @@ char const aChckHatch[] = { 0x04, 0x00, 'S','O','H','L'}; // < 5.2 char const aChckHatch0[] = { 0x04, 0x00, 'S','O','H','0'}; // = 5.2 char const aChckXML[] = { '<', '?', 'x', 'm', 'l' }; // = 6.0 -// ------------------ -// class XHatchTable -// ------------------ - -/************************************************************************* -|* -|* XHatchTable::XHatchTable() -|* -*************************************************************************/ - -XHatchTable::XHatchTable( const String& rPath, - XOutdevItemPool* pInPool, - sal_uInt16 nInitSize, sal_uInt16 nReSize ) : - XPropertyTable( rPath, pInPool, nInitSize, nReSize) -{ - pBmpTable = new Table( nInitSize, nReSize ); -} - -/************************************************************************/ - -XHatchTable::~XHatchTable() -{ -} - -/************************************************************************/ - -XHatchEntry* XHatchTable::Replace(long nIndex, XHatchEntry* pEntry ) -{ - return (XHatchEntry*) XPropertyTable::Replace(nIndex, pEntry); -} - -/************************************************************************/ - -XHatchEntry* XHatchTable::Remove(long nIndex) -{ - return (XHatchEntry*) XPropertyTable::Remove(nIndex, 0); -} - -/************************************************************************/ - -XHatchEntry* XHatchTable::GetHatch(long nIndex) const -{ - return (XHatchEntry*) XPropertyTable::Get(nIndex, 0); -} - -/************************************************************************/ - -sal_Bool XHatchTable::Load() -{ - return( sal_False ); -} - -/************************************************************************/ - -sal_Bool XHatchTable::Save() -{ - return( sal_False ); -} - -/************************************************************************/ - -sal_Bool XHatchTable::Create() -{ - return( sal_False ); -} - -/************************************************************************/ - -sal_Bool XHatchTable::CreateBitmapsForUI() -{ - return( sal_False ); -} - -/************************************************************************/ - -Bitmap* XHatchTable::CreateBitmapForUI( long /*nIndex*/, sal_Bool /*bDelete*/) -{ - return( NULL ); -} - // ----------------- // class XHatchList // ----------------- @@ -189,11 +109,12 @@ void XHatchList::impCreate() VirtualDevice* pVirDev = new VirtualDevice; OSL_ENSURE(0 != pVirDev, "XDashList: no VirtualDevice created!" ); pVirDev->SetMapMode(MAP_100TH_MM); - const Size aSize(pVirDev->PixelToLogic(Size(BITMAP_WIDTH, BITMAP_HEIGHT))); + const Size aSize(pVirDev->PixelToLogic(Size(getUiBitmapWidth(), getUiBitmapHeight()))); pVirDev->SetOutputSize(aSize); pVirDev->SetDrawMode(rStyleSettings.GetHighContrastMode() ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT : DRAWMODE_DEFAULT); + pVirDev->SetBackground(rStyleSettings.GetFieldColor()); SdrModel* pSdrModel = new SdrModel(); OSL_ENSURE(0 != pSdrModel, "XDashList: no SdrModel created!" ); @@ -229,11 +150,10 @@ void XHatchList::impDestroy() } } -XHatchList::XHatchList(const String& rPath, XOutdevItemPool* pInPool, sal_uInt16 nInitSize, sal_uInt16 nReSize) -: XPropertyList(rPath, pInPool, nInitSize, nReSize), +XHatchList::XHatchList(const String& rPath, XOutdevItemPool* pInPool) +: XPropertyList(rPath, pInPool), mpData(0) { - pBmpList = new List(nInitSize, nReSize); } XHatchList::~XHatchList() @@ -262,19 +182,19 @@ XHatchEntry* XHatchList::GetHatch(long nIndex) const sal_Bool XHatchList::Load() { - if( bListDirty ) + if( mbListDirty ) { - bListDirty = sal_False; + mbListDirty = false; - INetURLObject aURL( aPath ); + INetURLObject aURL( maPath ); if( INET_PROT_NOT_VALID == aURL.GetProtocol() ) { - DBG_ASSERT( !aPath.Len(), "invalid URL" ); + DBG_ASSERT( !maPath.Len(), "invalid URL" ); return sal_False; } - aURL.Append( aName ); + aURL.Append( maName ); if( !aURL.getExtension().getLength() ) aURL.setExtension( rtl::OUString( pszExtHatch, 3 ) ); @@ -287,15 +207,15 @@ sal_Bool XHatchList::Load() sal_Bool XHatchList::Save() { - INetURLObject aURL( aPath ); + INetURLObject aURL( maPath ); if( INET_PROT_NOT_VALID == aURL.GetProtocol() ) { - DBG_ASSERT( !aPath.Len(), "invalid URL" ); + DBG_ASSERT( !maPath.Len(), "invalid URL" ); return sal_False; } - aURL.Append( aName ); + aURL.Append( maName ); if( !aURL.getExtension().getLength() ) aURL.setExtension( rtl::OUString( pszExtHatch, 3 ) ); @@ -320,25 +240,7 @@ sal_Bool XHatchList::Create() return( sal_True ); } -sal_Bool XHatchList::CreateBitmapsForUI() -{ - impCreate(); - - for( long i = 0; i < Count(); i++) - { - Bitmap* pBmp = CreateBitmapForUI( i, sal_False ); - DBG_ASSERT( pBmp, "XHatchList: Bitmap(UI) konnte nicht erzeugt werden!" ); - - if( pBmp ) - pBmpList->Insert( pBmp, i ); - } - - impDestroy(); - - return( sal_True ); -} - -Bitmap* XHatchList::CreateBitmapForUI( long nIndex, sal_Bool bDelete ) +Bitmap XHatchList::CreateBitmapForUI( long nIndex ) { impCreate(); VirtualDevice* pVD = mpData->getVirtualDevice(); @@ -353,17 +255,11 @@ Bitmap* XHatchList::CreateBitmapForUI( long nIndex, sal_Bool bDelete ) sdr::contact::ObjectContactOfObjListPainter aPainter(*pVD, aObjectVector, 0); sdr::contact::DisplayInfo aDisplayInfo; + pVD->Erase(); aPainter.ProcessDisplay(aDisplayInfo); const Point aZero(0, 0); - Bitmap* pBitmap = new Bitmap(pVD->GetBitmap(aZero, pVD->GetOutputSize())); - - if(bDelete) - { - impDestroy(); - } - - return pBitmap; + return pVD->GetBitmap(aZero, pVD->GetOutputSize()); } ////////////////////////////////////////////////////////////////////////////// diff --git a/svx/source/xoutdev/xtable.cxx b/svx/source/xoutdev/xtable.cxx index 5d0b2c51d439..ba1d875311c4 100644 --- a/svx/source/xoutdev/xtable.cxx +++ b/svx/source/xoutdev/xtable.cxx @@ -26,6 +26,8 @@ #include <svx/xtable.hxx> #include <svx/xpool.hxx> +#include <svx/svdobj.hxx> +#include <svx/svdpool.hxx> #define GLOBALOVERFLOW @@ -41,311 +43,36 @@ Color RGB_Color( ColorData nColorName ) return aRGBColor; } -// --------------------- -// class XPropertyTable -// --------------------- - -/************************************************************************* -|* -|* XPropertyTable::XPropertyTable() -|* -*************************************************************************/ - -XPropertyTable::XPropertyTable( const String& rPath, - XOutdevItemPool* pInPool, - sal_uInt16 nInitSize, sal_uInt16 nReSize ) : - aName ( pszStandard, 8 ), - aPath ( rPath ), - pXPool ( pInPool ), - aTable ( nInitSize, nReSize ), - pBmpTable ( NULL ), - bTableDirty ( sal_True ), - bBitmapsDirty ( sal_True ), - bOwnPool ( sal_False ) -{ - if( !pXPool ) - { - bOwnPool = sal_True; - pXPool = new XOutdevItemPool; - DBG_ASSERT( pXPool, "XOutPool konnte nicht erzeugt werden!" ); - } -} - -/************************************************************************* -|* -|* XPropertyTable::XPropertyTable( SvStraem& ) -|* -*************************************************************************/ - -XPropertyTable::XPropertyTable( SvStream& /*rIn*/) : - pBmpTable ( NULL ) -{ -} - -/************************************************************************* -|* -|* XPropertyTable::~XPropertyTable() -|* -*************************************************************************/ - -XPropertyTable::~XPropertyTable() -{ - XPropertyEntry* pEntry = (XPropertyEntry*)aTable.First(); - Bitmap* pBitmap = NULL; - for (sal_uIntPtr nIndex = 0; nIndex < aTable.Count(); nIndex++) - { - delete pEntry; - pEntry = (XPropertyEntry*)aTable.Next(); - } - // Hier wird die Bitmaptabelle geloescht - if( pBmpTable ) - { - pBitmap = (Bitmap*) pBmpTable->First(); - - for( sal_uIntPtr nIndex = 0; nIndex < pBmpTable->Count(); nIndex++ ) - { - delete pBitmap; - pBitmap = (Bitmap*) pBmpTable->Next(); - } - delete pBmpTable; - pBmpTable = NULL; - } - // Eigener Pool wird geloescht - if( bOwnPool && pXPool ) - { - SfxItemPool::Free(pXPool); - } -} - -/************************************************************************* -|* -|* XPropertyTable::Clear() -|* -*************************************************************************/ - -void XPropertyTable::Clear() -{ - aTable.Clear(); - if( pBmpTable ) - pBmpTable->Clear(); -} - -/************************************************************************/ - -long XPropertyTable::Count() const -{ - if( bTableDirty ) - { - // ( (XPropertyTable*) this )->bTableDirty = sal_False; <- im Load() - if( !( (XPropertyTable*) this )->Load() ) - ( (XPropertyTable*) this )->Create(); - } - return( aTable.Count() ); -} - -/************************************************************************* -|* -|* XPropertyEntry* XPropertyTable::Get() -|* -*************************************************************************/ - -XPropertyEntry* XPropertyTable::Get( long nIndex, sal_uInt16 /*nDummy*/) const -{ - if( bTableDirty ) - { - // ( (XPropertyTable*) this )->bTableDirty = sal_False; <- im Load() - if( !( (XPropertyTable*) this )->Load() ) - ( (XPropertyTable*) this )->Create(); - } - return (XPropertyEntry*) aTable.GetObject( (sal_uIntPtr) nIndex ); -} - -/************************************************************************* -|* -|* long XPropertyTable::Get(const String& rName) -|* -*************************************************************************/ - -long XPropertyTable::Get(const XubString& rName) -{ - if( bTableDirty ) - { - // bTableDirty = sal_False; - if( !Load() ) - Create(); - } - long nPos = 0; - XPropertyEntry* pEntry = (XPropertyEntry*)aTable.First(); - while (pEntry && pEntry->GetName() != rName) - { - nPos++; - pEntry = (XPropertyEntry*)aTable.Next(); - } - if (!pEntry) nPos = -1; - return nPos; -} - -/************************************************************************* -|* -|* Bitmap* XPropertyTable::GetBitmap() -|* -*************************************************************************/ - -Bitmap* XPropertyTable::GetBitmap( long nIndex ) const -{ - if( pBmpTable ) - { - if( bBitmapsDirty ) - { - ( (XPropertyTable*) this )->bBitmapsDirty = sal_False; - ( (XPropertyTable*) this )->CreateBitmapsForUI(); - } - - if( pBmpTable->Count() >= (sal_uIntPtr) nIndex ) - return (Bitmap*) pBmpTable->GetObject( (sal_uIntPtr) nIndex ); - } - return( NULL ); -} - -/************************************************************************* -|* -|* void XPropertyTable::Insert() -|* -*************************************************************************/ - -sal_Bool XPropertyTable::Insert( long nIndex, XPropertyEntry* pEntry ) -{ - sal_Bool bReturn = aTable.Insert( (sal_uIntPtr) nIndex, pEntry ); - - if( pBmpTable && !bBitmapsDirty ) - { - Bitmap* pBmp = CreateBitmapForUI( (sal_uIntPtr) nIndex ); - pBmpTable->Insert( (sal_uIntPtr) nIndex, pBmp ); - } - return bReturn; -} - -/************************************************************************* -|* -|* void XPropertyTable::Replace() -|* -*************************************************************************/ - -XPropertyEntry* XPropertyTable::Replace( long nIndex, XPropertyEntry* pEntry ) -{ - XPropertyEntry* pOldEntry = (XPropertyEntry*) aTable.Replace( (sal_uIntPtr) nIndex, pEntry ); - - if( pBmpTable && !bBitmapsDirty ) - { - Bitmap* pBmp = CreateBitmapForUI( (sal_uIntPtr) nIndex ); - Bitmap* pOldBmp = (Bitmap*) pBmpTable->Replace( (sal_uIntPtr) nIndex, pBmp ); - if( pOldBmp ) - delete pOldBmp; - } - return pOldEntry; -} - -/************************************************************************* -|* -|* void XPropertyTable::Remove() -|* -*************************************************************************/ - -XPropertyEntry* XPropertyTable::Remove( long nIndex, sal_uInt16 /*nDummy*/) -{ - if( pBmpTable && !bBitmapsDirty ) - { - Bitmap* pOldBmp = (Bitmap*) pBmpTable->Remove( (sal_uIntPtr) nIndex ); - if( pOldBmp ) - delete pOldBmp; - } - return (XPropertyEntry*) aTable.Remove((sal_uIntPtr)nIndex); -} - -/************************************************************************/ - -void XPropertyTable::SetName( const String& rString ) -{ - if(rString.Len()) - { - aName = rString; - } -} - // -------------------- // class XPropertyList // -------------------- - -/************************************************************************* -|* -|* XPropertyList::XPropertyList() -|* -*************************************************************************/ - -XPropertyList::XPropertyList( const String& rPath, - XOutdevItemPool* pInPool, - sal_uInt16 nInitSize, sal_uInt16 nReSize ) : - aName ( pszStandard, 8 ), - aPath ( rPath ), - pXPool ( pInPool ), - aList ( nInitSize, nReSize ), - pBmpList ( NULL ), - bListDirty ( sal_True ), - bBitmapsDirty ( sal_True ), - bOwnPool ( sal_False ) +XPropertyList::XPropertyList( const String& rPath, XOutdevItemPool* pInPool ) : + maName ( pszStandard, 8 ), + maPath ( rPath ), + mpXPool ( pInPool ), + maList ( 16, 16 ), + mbListDirty (true) { - if( !pXPool ) + if( !mpXPool ) { - bOwnPool = sal_True; - pXPool = new XOutdevItemPool; - DBG_ASSERT( pXPool, "XOutPool konnte nicht erzeugt werden!" ); + mpXPool = static_cast< XOutdevItemPool* >(&SdrObject::GetGlobalDrawObjectItemPool()); } } /************************************************************************* |* -|* XPropertyList::XPropertyList( SvStraem& ) -|* -*************************************************************************/ - -XPropertyList::XPropertyList( SvStream& /*rIn*/) : - pBmpList ( NULL ) -{ -} - -/************************************************************************* -|* |* XPropertyList::~XPropertyList() |* *************************************************************************/ XPropertyList::~XPropertyList() { - XPropertyEntry* pEntry = (XPropertyEntry*)aList.First(); - Bitmap* pBitmap = NULL; - for( sal_uIntPtr nIndex = 0; nIndex < aList.Count(); nIndex++ ) + XPropertyEntry* pEntry = (XPropertyEntry*)maList.First(); + for( sal_uIntPtr nIndex = 0; nIndex < maList.Count(); nIndex++ ) { delete pEntry; - pEntry = (XPropertyEntry*)aList.Next(); - } - - if( pBmpList ) - { - pBitmap = (Bitmap*) pBmpList->First(); - - for( sal_uIntPtr nIndex = 0; nIndex < pBmpList->Count(); nIndex++ ) - { - delete pBitmap; - pBitmap = (Bitmap*) pBmpList->Next(); - } - delete pBmpList; - pBmpList = NULL; - } - - if( bOwnPool && pXPool ) - { - SfxItemPool::Free(pXPool); + pEntry = (XPropertyEntry*)maList.Next(); } } @@ -357,22 +84,20 @@ XPropertyList::~XPropertyList() void XPropertyList::Clear() { - aList.Clear(); - if( pBmpList ) - pBmpList->Clear(); + maList.Clear(); } /************************************************************************/ long XPropertyList::Count() const { - if( bListDirty ) + if( mbListDirty ) { // ( (XPropertyList*) this )->bListDirty = sal_False; <- im Load() if( !( (XPropertyList*) this )->Load() ) ( (XPropertyList*) this )->Create(); } - return( aList.Count() ); + return( maList.Count() ); } /************************************************************************* @@ -383,13 +108,13 @@ long XPropertyList::Count() const XPropertyEntry* XPropertyList::Get( long nIndex, sal_uInt16 /*nDummy*/) const { - if( bListDirty ) + if( mbListDirty ) { // ( (XPropertyList*) this )->bListDirty = sal_False; <- im Load() if( !( (XPropertyList*) this )->Load() ) ( (XPropertyList*) this )->Create(); } - return (XPropertyEntry*) aList.GetObject( (sal_uIntPtr) nIndex ); + return (XPropertyEntry*) maList.GetObject( (sal_uIntPtr) nIndex ); } /************************************************************************* @@ -400,18 +125,18 @@ XPropertyEntry* XPropertyList::Get( long nIndex, sal_uInt16 /*nDummy*/) const long XPropertyList::Get(const XubString& rName) { - if( bListDirty ) + if( mbListDirty ) { //bListDirty = sal_False; if( !Load() ) Create(); } long nPos = 0; - XPropertyEntry* pEntry = (XPropertyEntry*)aList.First(); + XPropertyEntry* pEntry = (XPropertyEntry*)maList.First(); while (pEntry && pEntry->GetName() != rName) { nPos++; - pEntry = (XPropertyEntry*)aList.Next(); + pEntry = (XPropertyEntry*)maList.Next(); } if (!pEntry) nPos = -1; return nPos; @@ -423,19 +148,23 @@ long XPropertyList::Get(const XubString& rName) |* *************************************************************************/ -Bitmap* XPropertyList::GetBitmap( long nIndex ) const +Bitmap XPropertyList::GetUiBitmap( long nIndex ) const { - if( pBmpList ) + Bitmap aRetval; + XPropertyEntry* pEntry = (XPropertyEntry*)maList.GetObject((sal_uIntPtr)nIndex); + + if(pEntry) { - if( bBitmapsDirty ) + aRetval = pEntry->GetUiBitmap(); + + if(aRetval.IsEmpty()) { - ( (XPropertyList*) this )->bBitmapsDirty = sal_False; - ( (XPropertyList*) this )->CreateBitmapsForUI(); + aRetval = const_cast< XPropertyList* >(this)->CreateBitmapForUI(nIndex); + pEntry->SetUiBitmap(aRetval); } - if( pBmpList->Count() >= (sal_uIntPtr) nIndex ) - return (Bitmap*) pBmpList->GetObject( (sal_uIntPtr) nIndex ); } - return( NULL ); + + return aRetval; } /************************************************************************* @@ -446,14 +175,7 @@ Bitmap* XPropertyList::GetBitmap( long nIndex ) const void XPropertyList::Insert( XPropertyEntry* pEntry, long nIndex ) { - aList.Insert( pEntry, (sal_uIntPtr) nIndex ); - - if( pBmpList && !bBitmapsDirty ) - { - Bitmap* pBmp = CreateBitmapForUI( - (sal_uIntPtr) nIndex < aList.Count() ? nIndex : aList.Count() - 1 ); - pBmpList->Insert( pBmp, (sal_uIntPtr) nIndex ); - } + maList.Insert( pEntry, (sal_uIntPtr) nIndex ); } /************************************************************************* @@ -464,16 +186,7 @@ void XPropertyList::Insert( XPropertyEntry* pEntry, long nIndex ) XPropertyEntry* XPropertyList::Replace( XPropertyEntry* pEntry, long nIndex ) { - XPropertyEntry* pOldEntry = (XPropertyEntry*) aList.Replace( pEntry, (sal_uIntPtr) nIndex ); - - if( pBmpList && !bBitmapsDirty ) - { - Bitmap* pBmp = CreateBitmapForUI( (sal_uIntPtr) nIndex ); - Bitmap* pOldBmp = (Bitmap*) pBmpList->Replace( pBmp, (sal_uIntPtr) nIndex ); - if( pOldBmp ) - delete pOldBmp; - } - return pOldEntry; + return (XPropertyEntry*) maList.Replace( pEntry, (sal_uIntPtr) nIndex ); } /************************************************************************* @@ -484,13 +197,7 @@ XPropertyEntry* XPropertyList::Replace( XPropertyEntry* pEntry, long nIndex ) XPropertyEntry* XPropertyList::Remove( long nIndex, sal_uInt16 /*nDummy*/) { - if( pBmpList && !bBitmapsDirty ) - { - Bitmap* pOldBmp = (Bitmap*) pBmpList->Remove( (sal_uIntPtr) nIndex ); - if( pOldBmp ) - delete pOldBmp; - } - return (XPropertyEntry*) aList.Remove( (sal_uIntPtr) nIndex ); + return (XPropertyEntry*) maList.Remove( (sal_uIntPtr) nIndex ); } /************************************************************************/ @@ -499,9 +206,29 @@ void XPropertyList::SetName( const String& rString ) { if(rString.Len()) { - aName = rString; + maName = rString; } } +sal_uInt32 XPropertyList::getUiBitmapWidth() const +{ + static sal_uInt32 nWidth = 32; // alternative: 42; + + return nWidth; +} + +sal_uInt32 XPropertyList::getUiBitmapHeight() const +{ + static sal_uInt32 nHeight = 12; // alternative: 16; + return nHeight; +} + +sal_uInt32 XPropertyList::getUiBitmapLineWidth() const +{ + static sal_uInt32 nLineWidth = 3; + + return nLineWidth; +} +// eof diff --git a/svx/source/xoutdev/xtablend.cxx b/svx/source/xoutdev/xtablend.cxx index be150004a373..4f40c1ac5574 100644 --- a/svx/source/xoutdev/xtablend.cxx +++ b/svx/source/xoutdev/xtablend.cxx @@ -67,6 +67,7 @@ #include <svx/svdmodel.hxx> #include <svx/sdr/contact/objectcontactofobjlistpainter.hxx> #include <svx/sdr/contact/displayinfo.hxx> +#include <svx/xlnwtit.hxx> #define GLOBALOVERFLOW @@ -74,90 +75,9 @@ using namespace com::sun::star; using namespace rtl; sal_Unicode const pszExtLineEnd[] = {'s','o','e'}; - -static char const aChckLEnd[] = { 0x04, 0x00, 'S','O','E','L'}; // < 5.2 -static char const aChckLEnd0[] = { 0x04, 0x00, 'S','O','E','0'}; // = 5.2 -static char const aChckXML[] = { '<', '?', 'x', 'm', 'l' }; // = 6.0 - -// -------------------- -// class XLineEndTable -// -------------------- - -/************************************************************************* -|* -|* XLineEndTable::XLineEndTable() -|* -*************************************************************************/ - -XLineEndTable::XLineEndTable( const String& rPath, - XOutdevItemPool* pInPool, - sal_uInt16 nInitSize, sal_uInt16 nReSize ) : - XPropertyTable( rPath, pInPool, nInitSize, nReSize) -{ - pBmpTable = new Table( nInitSize, nReSize ); -} - -/************************************************************************/ - -XLineEndTable::~XLineEndTable() -{ -} - -/************************************************************************/ - -XLineEndEntry* XLineEndTable::Replace(long nIndex, XLineEndEntry* pEntry ) -{ - return (XLineEndEntry*) XPropertyTable::Replace(nIndex, pEntry); -} - -/************************************************************************/ - -XLineEndEntry* XLineEndTable::Remove(long nIndex) -{ - return (XLineEndEntry*) XPropertyTable::Remove(nIndex, 0); -} - -/************************************************************************/ - -XLineEndEntry* XLineEndTable::GetLineEnd(long nIndex) const -{ - return (XLineEndEntry*) XPropertyTable::Get(nIndex, 0); -} - -/************************************************************************/ - -sal_Bool XLineEndTable::Load() -{ - return( sal_False ); -} - -/************************************************************************/ - -sal_Bool XLineEndTable::Save() -{ - return( sal_False ); -} - -/************************************************************************/ - -sal_Bool XLineEndTable::Create() -{ - return( sal_False ); -} - -/************************************************************************/ - -Bitmap* XLineEndTable::CreateBitmapForUI( long /*nIndex*/, sal_Bool /*bDelete*/) -{ - return( NULL ); -} - -/************************************************************************/ - -sal_Bool XLineEndTable::CreateBitmapsForUI() -{ - return( sal_False ); -} +//static char const aChckLEnd[] = { 0x04, 0x00, 'S','O','E','L'}; // < 5.2 +//static char const aChckLEnd0[] = { 0x04, 0x00, 'S','O','E','0'}; // = 5.2 +//static char const aChckXML[] = { '<', '?', 'x', 'm', 'l' }; // = 6.0 // -------------------- // class XLineEndList @@ -202,11 +122,12 @@ void XLineEndList::impCreate() VirtualDevice* pVirDev = new VirtualDevice; OSL_ENSURE(0 != pVirDev, "XLineEndList: no VirtualDevice created!" ); pVirDev->SetMapMode(MAP_100TH_MM); - const Size aSize(pVirDev->PixelToLogic(Size(BITMAP_WIDTH * 2, BITMAP_HEIGHT))); + const Size aSize(pVirDev->PixelToLogic(Size(getUiBitmapWidth() * 2, getUiBitmapHeight()))); pVirDev->SetOutputSize(aSize); pVirDev->SetDrawMode(rStyleSettings.GetHighContrastMode() ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT : DRAWMODE_DEFAULT); + pVirDev->SetBackground(rStyleSettings.GetFieldColor()); SdrModel* pSdrModel = new SdrModel(); OSL_ENSURE(0 != pSdrModel, "XLineEndList: no SdrModel created!" ); @@ -228,8 +149,11 @@ void XLineEndList::impCreate() SdrObject* pLineObject = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aPolygon)); OSL_ENSURE(0 != pLineObject, "XLineEndList: no LineObject created!" ); pLineObject->SetModel(pSdrModel); - pLineObject->SetMergedItem(XLineStartWidthItem(aSize.Height())); - pLineObject->SetMergedItem(XLineEndWidthItem(aSize.Height())); + const Size aLineWidth(pVirDev->PixelToLogic(Size(getUiBitmapLineWidth(), 0))); + pLineObject->SetMergedItem(XLineWidthItem(aLineWidth.getWidth())); + const sal_uInt32 nArrowHeight((aSize.Height() * 8) / 10); + pLineObject->SetMergedItem(XLineStartWidthItem(nArrowHeight)); + pLineObject->SetMergedItem(XLineEndWidthItem(nArrowHeight)); pLineObject->SetMergedItem(XLineColorItem(String(), rStyleSettings.GetFieldTextColor())); mpData = new impXLineEndList(pVirDev, pSdrModel, pBackgroundObject, pLineObject); @@ -246,11 +170,10 @@ void XLineEndList::impDestroy() } } -XLineEndList::XLineEndList(const String& rPath, XOutdevItemPool* _pXPool, sal_uInt16 nInitSize, sal_uInt16 nReSize) -: XPropertyList(rPath, _pXPool, nInitSize, nReSize), +XLineEndList::XLineEndList(const String& rPath, XOutdevItemPool* _pXPool) +: XPropertyList(rPath, _pXPool), mpData(0) { - pBmpList = new List(nInitSize, nReSize); } XLineEndList::~XLineEndList() @@ -275,19 +198,19 @@ XLineEndEntry* XLineEndList::GetLineEnd(long nIndex) const sal_Bool XLineEndList::Load() { - if( bListDirty ) + if( mbListDirty ) { - bListDirty = sal_False; + mbListDirty = false; - INetURLObject aURL( aPath ); + INetURLObject aURL( maPath ); if( INET_PROT_NOT_VALID == aURL.GetProtocol() ) { - DBG_ASSERT( !aPath.Len(), "invalid URL" ); + DBG_ASSERT( !maPath.Len(), "invalid URL" ); return sal_False; } - aURL.Append( aName ); + aURL.Append( maName ); if( !aURL.getExtension().getLength() ) aURL.setExtension( rtl::OUString( pszExtLineEnd, 3 ) ); @@ -300,15 +223,15 @@ sal_Bool XLineEndList::Load() sal_Bool XLineEndList::Save() { - INetURLObject aURL( aPath ); + INetURLObject aURL( maPath ); if( INET_PROT_NOT_VALID == aURL.GetProtocol() ) { - DBG_ASSERT( !aPath.Len(), "invalid URL" ); + DBG_ASSERT( !maPath.Len(), "invalid URL" ); return sal_False; } - aURL.Append( aName ); + aURL.Append( maName ); if( !aURL.getExtension().getLength() ) aURL.setExtension( rtl::OUString( pszExtLineEnd, 3 ) ); @@ -340,25 +263,7 @@ sal_Bool XLineEndList::Create() return( sal_True ); } -sal_Bool XLineEndList::CreateBitmapsForUI() -{ - impCreate(); - - for( long i = 0; i < Count(); i++) - { - Bitmap* pBmp = CreateBitmapForUI( i, sal_False ); - OSL_ENSURE(0 != pBmp, "XLineEndList: Bitmap(UI) could not be created!" ); - - if( pBmp ) - pBmpList->Insert( pBmp, i ); - } - - impDestroy(); - - return( sal_True ); -} - -Bitmap* XLineEndList::CreateBitmapForUI( long nIndex, sal_Bool bDelete ) +Bitmap XLineEndList::CreateBitmapForUI( long nIndex ) { impCreate(); VirtualDevice* pVD = mpData->getVirtualDevice(); @@ -374,17 +279,11 @@ Bitmap* XLineEndList::CreateBitmapForUI( long nIndex, sal_Bool bDelete ) sdr::contact::ObjectContactOfObjListPainter aPainter(*pVD, aObjectVector, 0); sdr::contact::DisplayInfo aDisplayInfo; + pVD->Erase(); aPainter.ProcessDisplay(aDisplayInfo); const Point aZero(0, 0); - Bitmap* pBitmap = new Bitmap(pVD->GetBitmap(aZero, pVD->GetOutputSize())); - - if(bDelete) - { - impDestroy(); - } - - return pBitmap; + return pVD->GetBitmap(aZero, pVD->GetOutputSize()); } ////////////////////////////////////////////////////////////////////////////// diff --git a/svx/util/svx.component b/svx/util/svx.component index e5c516a252bf..a22f0d767592 100644 --- a/svx/util/svx.component +++ b/svx/util/svx.component @@ -69,4 +69,7 @@ <implementation name="com.sun.star.svx.UpSearchToolboxController"> <service name="com.sun.star.frame.ToolbarController"/> </implementation> + <implementation name="org.apache.openoffice.comp.svx.sidebar.PanelFactory"> + <service name="com.sun.star.ui.UIElementFactory"/> + </implementation> </component> |