diff options
Diffstat (limited to 'sw')
89 files changed, 5470 insertions, 250 deletions
diff --git a/sw/AllLangResTarget_sw.mk b/sw/AllLangResTarget_sw.mk index f0ec55fa98a5..4aa005c083c6 100644 --- a/sw/AllLangResTarget_sw.mk +++ b/sw/AllLangResTarget_sw.mk @@ -135,6 +135,8 @@ $(eval $(call gb_SrsTarget_add_files,sw/res,\ sw/source/ui/ribbar/tbxanchr.src \ sw/source/ui/ribbar/workctrl.src \ sw/source/ui/shells/shells.src \ + sw/source/ui/sidebar/PagePropertyPanel.src \ + sw/source/ui/sidebar/WrapPropertyPanel.src \ sw/source/ui/smartmenu/stmenu.src \ sw/source/ui/table/table.src \ sw/source/ui/table/tabledlg.src \ diff --git a/sw/CppunitTest_sw_macros_test.mk b/sw/CppunitTest_sw_macros_test.mk index 21736b32c997..cf3c425318ff 100644 --- a/sw/CppunitTest_sw_macros_test.mk +++ b/sw/CppunitTest_sw_macros_test.mk @@ -92,6 +92,7 @@ $(eval $(call gb_CppunitTest_use_components,sw_macros_test,\ sfx2/util/sfx \ sot/util/sot \ svl/source/fsstor/fsstorage \ + svtools/util/svt \ toolkit/util/tk \ ucb/source/core/ucb1 \ ucb/source/ucp/file/ucpfile1 \ diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk index 7727862be114..679d60d32cbe 100644 --- a/sw/Library_sw.mk +++ b/sw/Library_sw.mk @@ -648,6 +648,13 @@ $(eval $(call gb_Library_add_exception_objects,sw,\ sw/source/ui/shells/txtattr \ sw/source/ui/shells/txtcrsr \ sw/source/ui/shells/txtnum \ + sw/source/ui/sidebar/PageOrientationControl \ + sw/source/ui/sidebar/PageMarginControl \ + sw/source/ui/sidebar/PageSizeControl \ + sw/source/ui/sidebar/PageColumnControl \ + sw/source/ui/sidebar/PagePropertyPanel \ + sw/source/ui/sidebar/WrapPropertyPanel \ + sw/source/ui/sidebar/SwPanelFactory \ sw/source/ui/smartmenu/stmenu \ sw/source/ui/table/chartins \ sw/source/ui/table/swtablerep \ diff --git a/sw/inc/SwPanelFactory.hxx b/sw/inc/SwPanelFactory.hxx new file mode 100644 index 000000000000..ac2e5c82be00 --- /dev/null +++ b/sw/inc/SwPanelFactory.hxx @@ -0,0 +1,70 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SW_SIDEBAR_PANEL_FACTORY_HXX +#define SW_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 sw { namespace sidebar { + +namespace +{ + typedef ::cppu::WeakComponentImplHelper1 < + css::ui::XUIElementFactory + > PanelFactoryInterfaceBase; +} + + +class SwPanelFactory + : 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); + + SwPanelFactory(void); + virtual ~SwPanelFactory(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 sw::sidebar + +#endif diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h index b7186f0d4577..08bb1d75f40e 100644 --- a/sw/inc/cmdid.h +++ b/sw/inc/cmdid.h @@ -52,6 +52,7 @@ included in c-context files, so c++ style stuff will cause problems. #define FN_EXTRA2 (SID_SW_START + 2200) #define FN_PARAM2 (SID_SW_START + 2400) #define FN_NOTES (SID_SW_START + 2500) +#define FN_SIDEBAR (SID_SW_START + 2550) #define FN_HEADERFOOTER (SID_SW_START + 2600) #define FN_PAGEBREAK (SID_SW_START + 2610) @@ -323,6 +324,7 @@ included in c-context files, so c++ style stuff will cause problems. #define FN_FLIP_HORZ_GRAFIC (FN_FORMAT + 25) /* mirror horizontally */ #define FN_FLIP_VERT_GRAFIC (FN_FORMAT + 26) /* mirror vertically */ +#define FN_FORMAT_PAGE_SETTING_DLG (FN_FORMAT + 42) /* */ #define FN_NUM_FORMAT_TABLE_DLG (FN_FORMAT + 45) /* number format in table */ #define FN_FORMAT_BORDER_DLG (FN_FORMAT + 48) /* */ #define FN_FORMAT_PAGE_COLUMN_DLG (FN_FORMAT + 49) /* columns per page */ @@ -434,10 +436,9 @@ included in c-context files, so c++ style stuff will cause problems. #define FN_FRAME_WRAP_CONTOUR (FN_FORMAT + 184) /* */ -#define FN_TABLE_VERT_NONE (FN_FORMAT + 185) /* vertical alignment in table cells */ -#define FN_TABLE_VERT_CENTER (FN_FORMAT + 186) /* -"- */ -#define FN_TABLE_VERT_BOTTOM (FN_FORMAT + 187) /* -"- */ -#define FN_TABLE_SET_VERT_ALIGN (FN_FORMAT + 188) /* -"- */ +// +185..+187 removed in favor of corresponding globally available slot + +#define FN_TABLE_SET_VERT_ALIGN (FN_FORMAT + 188) /* vertical alignment in Writer table cells */ #define FN_TABLE_MODE_FIX (FN_FORMAT + 189) /* table mode */ #define FN_TABLE_MODE_FIX_PROP (FN_FORMAT + 190) /* -"- */ #define FN_TABLE_MODE_VARIABLE (FN_FORMAT + 191) /* -"- */ @@ -898,6 +899,11 @@ included in c-context files, so c++ style stuff will cause problems. #define FN_UNO_TITLE (FN_FRAME + 19) #define FN_UNO_DESCRIPTION (FN_FRAME + 20) +#define FN_PROPERTY_WRAP_DLG (FN_SIDEBAR + 0) +#define SID_ATTR_PAGE_COLUMN (FN_SIDEBAR + 1) +#define SID_ATTR_PAGE_ULSPACE (FN_SIDEBAR + 2) +#define SID_ATTR_PAGE_LRSPACE (FN_SIDEBAR + 3) + //Member IDs for Fill / SetVariable of items #define MID_STYLE 0xe0 #define MID_PWIDTH 0xe1 diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx index 39bb3ceea796..4f1a43d53243 100644 --- a/sw/inc/docsh.hxx +++ b/sw/inc/docsh.hxx @@ -101,11 +101,20 @@ class SW_DLLPUBLIC SwDocShell: public SfxObjectShell, public SfxListener SW_DLLPRIVATE virtual void Draw( OutputDevice*, const JobSetup&, sal_uInt16); /// Methods for StyleSheets - SW_DLLPRIVATE sal_uInt16 Edit( const String &rName, const String& rParent, sal_uInt16 nFamily, - sal_uInt16 nMask, sal_Bool bNew, - sal_uInt16 nPageId = 0, - SwWrtShell* pActShell = 0, - sal_Bool bBasic = sal_False ); + + // @param nSlot + // Only used for nFamily == SFX_STYLE_FAMILY_PAGE. Identifies optional Slot by which the edit is triggered. + // Used to activate certain dialog pane + SW_DLLPRIVATE sal_uInt16 Edit( + const String &rName, + const String& rParent, + const sal_uInt16 nFamily, + sal_uInt16 nMask, + const sal_Bool bNew, + const sal_uInt16 nSlot = 0, + SwWrtShell* pActShell = 0, + const sal_Bool bBasic = sal_False ); + SW_DLLPRIVATE sal_uInt16 Delete(const String &rName, sal_uInt16 nFamily); SW_DLLPRIVATE sal_uInt16 Hide(const String &rName, sal_uInt16 nFamily, bool bHidden); SW_DLLPRIVATE sal_uInt16 ApplyStyles(const String &rName, sal_uInt16 nFamily, SwWrtShell* pShell = 0, @@ -244,10 +253,13 @@ public: void _LoadStyles( SfxObjectShell& rSource, sal_Bool bPreserveCurrentDocument ); - /// Display dialog for page style. If required display column page. - void FormatPage( const String& rPage, - sal_uInt16 nPageId = 0, - SwWrtShell* pActShell = 0 ); + // Show page style format dialog + // @param nSlot + // Identifies slot by which the dialog is triggered. Used to activate certain dialog pane + void FormatPage( + const String& rPage, + const sal_uInt16 nSlot, + SwWrtShell& rActShell ); // #i59688# /** linked graphics are now loaded on demand. diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx index f73611c4f06b..6e4972193a7f 100644 --- a/sw/inc/editsh.hxx +++ b/sw/inc/editsh.hxx @@ -523,6 +523,9 @@ public: sal_Bool HasNumber() const; sal_Bool HasBullet() const; + sal_Bool SelectionHasNumber() const; + sal_Bool SelectionHasBullet() const; + String GetUniqueNumRuleName( const String* pChkStr = 0, bool bAutoNum = true ) const; void ChgNumRuleFmts( const SwNumRule& rRule ); diff --git a/sw/inc/helpid.h b/sw/inc/helpid.h index 53195eea032f..2fa479fd36da 100644 --- a/sw/inc/helpid.h +++ b/sw/inc/helpid.h @@ -195,6 +195,14 @@ #define HID_COMPATIBILITY_OPTIONS_BOX "SW_HID_COMPATIBILITY_OPTIONS_BOX" #define HID_COMPARISON_OPT "SW_HID_COMPARISON_OPT" +#define HID_PROPERTYPANEL_WRAP_SECTION "SW_HID_PROPERTYPANEL_WRAP_SECTION" +#define HID_PROPERTYPANEL_WRAP_RB_NO_WRAP "SW_HID_PROPERTYPANEL_WRAP_RB_NO_WRAP" +#define HID_PROPERTYPANEL_WRAP_RB_WRAP_LEFT "SW_HID_PROPERTYPANEL_WRAP_RB_WRAP_LEFT" +#define HID_PROPERTYPANEL_WRAP_RB_WRAP_RIGHT "SW_HID_PROPERTYPANEL_WRAP_RB_WRAP_RIGHT" +#define HID_PROPERTYPANEL_WRAP_RB_WRAP_PARALLEL "SW_HID_PROPERTYPANEL_WRAP_RB_WRAP_PARALLEL" +#define HID_PROPERTYPANEL_WRAP_RB_WRAP_THROUGH "SW_HID_PROPERTYPANEL_WRAP_RB_WRAP_THROUGH" +#define HID_PROPERTYPANEL_WRAP_RB_WRAP_IDEAL "SW_HID_PROPERTYPANEL_WRAP_RB_WRAP_IDEAL" + // AutoPilot Help-IDs #define HID_LETTER_PAGE1 "SW_HID_LETTER_PAGE1" @@ -230,6 +238,27 @@ #define HID_AGENDA_PAGE6 "SW_HID_AGENDA_PAGE6" +// sw::sidebar::PagePropertyPanel +#define HID_SWPAGE_ORIENTATION "HID_SWPAGE_ORIENTATION" +#define HID_SWPAGE_TBI_ORIENTATION "HID_SWPAGE_TBI_ORIENTATION" +#define HID_SWPAGE_MARGIN "HID_SWPAGE_MARGIN" +#define HID_SWPAGE_TBI_MARGIN "HID_SWPAGE_TBI_MARGIN" +#define HID_SWPAGE_SIZE "HID_SWPAGE_SIZE" +#define HID_SWPAGE_TBI_SIZE "HID_SWPAGE_TBI_SIZE" +#define HID_SWPAGE_COLUMN "HID_SWPAGE_COLUMN" +#define HID_SWPAGE_TBI_COLUMN "HID_SWPAGE_TBI_COLUMN" +#define HID_SWPAGE_LEFT_MARGIN "HID_SWPAGE_LEFT_MARGIN" +#define HID_SWPAGE_RIGHT_MARGIN "HID_SWPAGE_RIGHT_MARGIN" +#define HID_SWPAGE_TOP_MARGIN "HID_SWPAGE_TOP_MARGIN" +#define HID_SWPAGE_BOTTOM_MARGIN "HID_SWPAGE_BOTTOM_MARGIN" +#define HID_SWPAGE_SIZE_MORE "HID_SWPAGE_SIZE_MORE" +#define HID_SWPAGE_COLUMN_MORE "HID_SWPAGE_COLUMN_MORE" +#define HID_SWPAGE_VS_ORIENTATION "HID_SWPAGE_VS_ORIENTATION" +#define HID_SWPAGE_VS_MARGIN "HID_SWPAGE_VS_MARGIN" +#define HID_SWPAGE_VS_SIZE "HID_SWPAGE_VS_SIZE" +#define HID_SWPAGE_VS_COLUMN "HID_SWPAGE_VS_COLUMN" +#define HID_PROPERTYPANEL_SWPAGE_SECTION "HID_PROPERTYPANEL_SWPAGE_SECTION" + // HelpIds for Menu #define HID_MN_SUB_TBLROW "SW_HID_MN_SUB_TBLROW" diff --git a/sw/inc/rcid.hrc b/sw/inc/rcid.hrc index 75b296d050cf..78fa83a7afde 100644 --- a/sw/inc/rcid.hrc +++ b/sw/inc/rcid.hrc @@ -67,6 +67,7 @@ #define RC_UNDO (RC_BASE + 3750) #define RC_SMARTTAG (RC_BASE + 3950) // SMARTTAGS #define RC_UNOCORE (RC_BASE + 4050) +#define RC_PROPERTYPANEL (RC_BASE + 4070) #define RC_ANNOTATION (RC_BASE + 4150) #define RC_PAGEFRM (RC_BASE + 4250) #define RC_IDXTXT (RC_BASE + 4350) @@ -255,6 +256,9 @@ #define RC_IDXTXT_BEGIN RC_IDXTXT #define RC_IDXTXT_END (RC_IDXTXT + 10) +// property panel +#define RC_PROPERTYPANEL_BEGIN RC_PROPERTYPANEL +#define RC_PROPERTYPANEL_END (RC_PROPERTYPANEL + 10) #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx index df02c3b194ec..2e8ae75d2039 100644 --- a/sw/inc/swabstdlg.hxx +++ b/sw/inc/swabstdlg.hxx @@ -401,13 +401,16 @@ public: sal_Bool bFmt = sal_False, sal_uInt16 nDefPage = 0, const String* pFmtStr = 0) = 0; //add for SwFrmDlg + // @param nSlot + // Identifies optional Slot by which the creation of the Template (Style) dialog is triggered. + // Currently used, if nRegion == SFX_STYLE_FAMILY_PAGE in order to activate certain dialog pane virtual SfxAbstractApplyTabDialog* CreateTemplateDialog( Window* pParent, SfxStyleSheetBase& rBase, - sal_uInt16 nRegion, - sal_uInt16 nPageId = 0, + sal_uInt16 nRegion, + const sal_uInt16 nSlot = 0, SwWrtShell* pActShell = 0, - sal_Bool bNew = sal_False ) = 0; //add for SwTemplateDlg + sal_Bool bNew = sal_False ) = 0; //add for SwTemplateDlg virtual AbstractGlossaryDlg* CreateGlossaryDlg(SfxViewFrame* pViewFrame, SwGlossaryHdl* pGlosHdl, SwWrtShell *pWrtShell) = 0; //add for SwGlossaryDlg diff --git a/sw/inc/swcommands.h b/sw/inc/swcommands.h index 1037141d4a5a..6722b2d5d8f4 100644 --- a/sw/inc/swcommands.h +++ b/sw/inc/swcommands.h @@ -27,9 +27,9 @@ #define CMD_FN_FRAME_ALIGN_VERT_TOP ".uno:AlignTop" #define CMD_FN_FRAME_ALIGN_VERT_CENTER ".uno:AlignVerticalCenter" #define CMD_FN_EDIT_AUTH_ENTRY_DLG ".uno:AuthoritiesEntryDialog" -#define CMD_FN_TABLE_VERT_BOTTOM ".uno:CellVertBottom" -#define CMD_FN_TABLE_VERT_CENTER ".uno:CellVertCenter" -#define CMD_FN_TABLE_VERT_NONE ".uno:CellVertTop" +#define CMD_SID_TABLE_VERT_BOTTOM ".uno:CellVertBottom" +#define CMD_SID_TABLE_VERT_CENTER ".uno:CellVertCenter" +#define CMD_SID_TABLE_VERT_NONE ".uno:CellVertTop" #define CMD_FN_CONVERT_TEXT_TABLE ".uno:ConvertTableText" #define CMD_FN_NUM_BULLET_DOWN ".uno:DecrementLevel" #define CMD_FN_TABLE_DELETE_COL ".uno:DeleteColumns" @@ -134,3 +134,4 @@ #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ + diff --git a/sw/sdi/_annotsh.sdi b/sw/sdi/_annotsh.sdi index 5e78e2cede5a..142d5e788cec 100644 --- a/sw/sdi/_annotsh.sdi +++ b/sw/sdi/_annotsh.sdi @@ -174,6 +174,24 @@ interface _Annotation DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] + SID_ATTR_PARA_LRSPACE + [ + ExecMethod = Exec; + StateMethod = GetState ; + ] + + SID_ATTR_PARA_LINESPACE + [ + ExecMethod = Exec; + StateMethod = GetState ; + ] + + SID_ATTR_PARA_ULSPACE + [ + ExecMethod = Exec; + StateMethod = GetState ; + ] + FN_INSERT_STRING [ ExecMethod = Exec ; @@ -202,6 +220,13 @@ interface _Annotation DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] + SID_CHAR_DLG_EFFECT + [ + ExecMethod = Exec ; + StateMethod = GetState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] + SID_ATTR_CHAR_WEIGHT // api: [ ExecMethod = Exec ; diff --git a/sw/sdi/_basesh.sdi b/sw/sdi/_basesh.sdi index cd9a211fbc08..4b87dabf30e4 100644 --- a/sw/sdi/_basesh.sdi +++ b/sw/sdi/_basesh.sdi @@ -250,6 +250,12 @@ interface BaseTextSelection DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] + FN_FORMAT_PAGE_SETTING_DLG + [ + ExecMethod = ExecDlg ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] + FN_CONVERT_TABLE_TO_TEXT [ ExecMethod = Execute ; diff --git a/sw/sdi/_frmsh.sdi b/sw/sdi/_frmsh.sdi index a06927aab122..31cb86d0f281 100644 --- a/sw/sdi/_frmsh.sdi +++ b/sw/sdi/_frmsh.sdi @@ -142,6 +142,27 @@ interface BaseTextFrame DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] + SID_ATTR_TRANSFORM + [ + ExecMethod = Execute ; + StateMethod = GetState ; + ] + SID_ATTR_TRANSFORM_WIDTH + [ + StateMethod = GetState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] + SID_ATTR_TRANSFORM_HEIGHT + [ + StateMethod = GetState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] + SID_ATTR_TRANSFORM_PROTECT_SIZE + [ + StateMethod = GetState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] + SID_ATTR_ULSPACE // status(final|play) [ ExecMethod = Execute ; @@ -163,6 +184,12 @@ interface BaseTextFrame StateMethod = GetState ; DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] + FN_PROPERTY_WRAP_DLG // status(final|play) + [ + ExecMethod = Execute ; + StateMethod = GetState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] SID_FRAME_LINESTYLE // status() [ diff --git a/sw/sdi/_grfsh.sdi b/sw/sdi/_grfsh.sdi index 508b99599e6e..a3198b919e9d 100644 --- a/sw/sdi/_grfsh.sdi +++ b/sw/sdi/_grfsh.sdi @@ -27,6 +27,12 @@ interface BaseTextGraphic StateMethod = GetAttrState ; DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] + SID_FLIP_VERTICAL + [ + ExecMethod = ExecAttr ; + StateMethod = GetAttrState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] FN_FLIP_HORZ_GRAFIC // status(final|play) [ @@ -34,6 +40,12 @@ interface BaseTextGraphic StateMethod = GetAttrState ; DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] + SID_FLIP_HORIZONTAL + [ + ExecMethod = ExecAttr ; + StateMethod = GetAttrState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] FN_FORMAT_GRAFIC_DLG // status(final|play) [ @@ -41,6 +53,12 @@ interface BaseTextGraphic StateMethod = GetAttrState ; DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] + FN_PROPERTY_WRAP_DLG // status(final|play) + [ + ExecMethod = Execute ; + StateMethod = GetAttrState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] SID_SAVE_GRAPHIC [ diff --git a/sw/sdi/_tabsh.sdi b/sw/sdi/_tabsh.sdi index e83800e36a84..bb76241bf43f 100644 --- a/sw/sdi/_tabsh.sdi +++ b/sw/sdi/_tabsh.sdi @@ -58,26 +58,27 @@ interface BaseTextTable ] - FN_TABLE_VERT_NONE + SID_TABLE_VERT_NONE [ ExecMethod = Execute ; StateMethod = GetState ; DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] - FN_TABLE_VERT_CENTER + SID_TABLE_VERT_CENTER [ ExecMethod = Execute ; StateMethod = GetState ; DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] - FN_TABLE_VERT_BOTTOM + SID_TABLE_VERT_BOTTOM [ ExecMethod = Execute ; StateMethod = GetState ; DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] + FN_TABLE_SET_COL_WIDTH // status( final|play ) [ ExecMethod = Execute ; diff --git a/sw/sdi/_textsh.sdi b/sw/sdi/_textsh.sdi index cc9bf6198a35..594e46bf47dd 100644 --- a/sw/sdi/_textsh.sdi +++ b/sw/sdi/_textsh.sdi @@ -54,6 +54,7 @@ interface BaseText SID_ATTR_BRUSH_CHAR // status() [ ExecMethod = Execute ; + StateMethod = GetTxtCtrlState ; DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] @@ -722,6 +723,18 @@ interface BaseText StateMethod = GetState ; DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] + FN_BUL_NUM_RULE_INDEX // status(final|play) + [ + ExecMethod = ExecEnterNum ; + StateMethod = GetState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] + FN_NUM_NUM_RULE_INDEX // status(final|play) + [ + ExecMethod = ExecEnterNum ; + StateMethod = GetState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] FN_NUMBER_BULLETS // status(final|play) [ ExecMethod = ExecEnterNum ; @@ -780,6 +793,21 @@ interface BaseText ExecMethod = ExecMoveMisc ; StateMethod = NoState ; ] + FN_SVX_SET_NUMBER + [ + ExecMethod = ExecSetNumber; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] + FN_SVX_SET_BULLET + [ + ExecMethod = ExecSetNumber; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] + SID_OUTLINE_BULLET // status(final|play) + [ + ExecMethod = ExecEnterNum ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] FN_INSERT_FOOTNOTE_DLG // status(final|play|rec) [ @@ -1184,6 +1212,11 @@ interface BaseText ExecMethod = Execute ; DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] + SID_ATTR_PARA_LRSPACE + [ + ExecMethod = Execute ; + StateMethod = GetAttrState; + ] FN_SELECT_PARA // status(final|play) [ ExecMethod = Execute ; @@ -1431,6 +1464,12 @@ interface BaseText ExecMethod = Execute ; DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] + + SID_CHAR_DLG_EFFECT + [ + ExecMethod = Execute ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] SID_CHAR_DLG_FOR_PARAGRAPH [ ExecMethod = Execute ; diff --git a/sw/sdi/_viewsh.sdi b/sw/sdi/_viewsh.sdi index eb4d596e9f78..bd05db1accfd 100644 --- a/sw/sdi/_viewsh.sdi +++ b/sw/sdi/_viewsh.sdi @@ -416,6 +416,31 @@ interface BaseTextEditView ExecMethod = Execute ; StateMethod = GetState ; ] + + SID_ATTR_PARA_ULSPACE + [ + ExecMethod = ExecTabWin ; + StateMethod = StateTabWin ; + ] + + SID_ATTR_PAGE_COLUMN + [ + ExecMethod = ExecTabWin ; + StateMethod = StateTabWin ; + ] + SID_ATTR_PAGE_ULSPACE + [ + ExecMethod = ExecTabWin ; + StateMethod = StateTabWin ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] + SID_ATTR_PAGE_LRSPACE + [ + ExecMethod = ExecTabWin ; + StateMethod = StateTabWin ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] + SID_THESAURUS // status(final|play) [ ExecMethod = ExecLingu ; diff --git a/sw/sdi/drawsh.sdi b/sw/sdi/drawsh.sdi index d7991b19688f..3fa3445d488c 100644 --- a/sw/sdi/drawsh.sdi +++ b/sw/sdi/drawsh.sdi @@ -28,6 +28,20 @@ interface TextDraw : TextDrawBase Export = FALSE; ] + SID_ATTR_LINE_START + [ + ExecMethod = ExecDrawAttrArgs ; + StateMethod = DisableState ; + Export = FALSE; + ] + + SID_ATTR_LINE_END + [ + ExecMethod = ExecDrawAttrArgs ; + StateMethod = DisableState ; + Export = FALSE; + ] + SID_ATTR_LINE_STYLE [ Export = FALSE; @@ -43,6 +57,30 @@ interface TextDraw : TextDrawBase DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] + SID_ATTR_LINE_TRANSPARENCE + [ + Export = FALSE; + ExecMethod = ExecDrawAttrArgs ; + StateMethod = GetDrawAttrState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] + + SID_ATTR_LINE_JOINT + [ + Export = FALSE; + ExecMethod = ExecDrawAttrArgs ; + StateMethod = GetDrawAttrState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] + + SID_ATTR_LINE_CAP + [ + Export = FALSE; + ExecMethod = ExecDrawAttrArgs ; + StateMethod = GetDrawAttrState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] + SID_DASH_LIST [ StateMethod = GetDrawAttrState ; @@ -129,6 +167,22 @@ interface TextDraw : TextDrawBase DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] + SID_ATTR_FILL_TRANSPARENCE + [ + Export = FALSE; + ExecMethod = ExecDrawAttrArgs ; + StateMethod = GetDrawAttrState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] + + SID_ATTR_FILL_FLOATTRANSPARENCE + [ + Export = FALSE; + ExecMethod = ExecDrawAttrArgs ; + StateMethod = GetDrawAttrState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] + SID_ATTRIBUTES_LINE [ ExecMethod = ExecDrawDlg ; @@ -153,6 +207,12 @@ interface TextDraw : TextDrawBase StateMethod = GetState ; DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] + SID_FLIP_VERTICAL + [ + ExecMethod = Execute ; + StateMethod = GetState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] FN_FLIP_HORZ_GRAFIC [ @@ -160,6 +220,12 @@ interface TextDraw : TextDrawBase StateMethod = GetState ; DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] + SID_FLIP_HORIZONTAL + [ + ExecMethod = Execute ; + StateMethod = GetState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] SID_OBJECT_ROTATE [ diff --git a/sw/sdi/drwbassh.sdi b/sw/sdi/drwbassh.sdi index 73fd8e8e1093..0ca950889b17 100644 --- a/sw/sdi/drwbassh.sdi +++ b/sw/sdi/drwbassh.sdi @@ -27,6 +27,7 @@ interface TextDrawBase : BaseTextDrawBase shell SwDrawBaseShell: SwBaseShell { import TextDrawBase[Automation]; + import Sidebar; SID_OBJECT_ALIGN [ diff --git a/sw/sdi/drwtxtsh.sdi b/sw/sdi/drwtxtsh.sdi index 0bfb4551ed2e..5e326f771226 100644 --- a/sw/sdi/drwtxtsh.sdi +++ b/sw/sdi/drwtxtsh.sdi @@ -205,6 +205,24 @@ interface TextDrawText DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] + SID_ATTR_PARA_LRSPACE //for indent + [ + ExecMethod = Execute ; + StateMethod = GetState ; + ] + + SID_ATTR_PARA_LINESPACE // api: + [ + ExecMethod = Execute ; + StateMethod = GetState ; + ] + + SID_ATTR_PARA_ULSPACE + [ + ExecMethod = Execute ; + StateMethod = GetState ; + ] + SID_ATTR_PARA_ADJUST_LEFT // api: [ ExecMethod = Execute ; @@ -294,6 +312,13 @@ interface TextDrawText StateMethod = GetState ; DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] + + SID_CHAR_DLG_EFFECT + [ + ExecMethod = Execute ; + StateMethod = GetState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] SID_CHAR_DLG_FOR_PARAGRAPH [ ExecMethod = Execute ; @@ -572,6 +597,25 @@ interface TextDrawText [ StateMethod = StateDisableItems ; ] + + SID_TABLE_VERT_NONE + [ + ExecMethod = ExecDraw ; + StateMethod = GetStatePropPanelAttr ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] + SID_TABLE_VERT_CENTER + [ + ExecMethod = ExecDraw ; + StateMethod = GetStatePropPanelAttr ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] + SID_TABLE_VERT_BOTTOM + [ + ExecMethod = ExecDraw ; + StateMethod = GetStatePropPanelAttr ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] } interface TextDrawFont diff --git a/sw/sdi/sidebar.sdi b/sw/sdi/sidebar.sdi new file mode 100644 index 000000000000..e23a88c88cb3 --- /dev/null +++ b/sw/sdi/sidebar.sdi @@ -0,0 +1,30 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +interface Sidebar [ Automation = FALSE; ] +{ + SID_ATTR_TRANSFORM_WIDTH [ StateMethod = GetDrawAttrStateForIFBX; ] + SID_ATTR_TRANSFORM_HEIGHT [ StateMethod = GetDrawAttrStateForIFBX; ] + SID_ATTR_TRANSFORM_POS_X [ StateMethod = GetDrawAttrStateForIFBX; ] + SID_ATTR_TRANSFORM_POS_Y [ StateMethod = GetDrawAttrStateForIFBX; ] + SID_ATTR_TRANSFORM_ANGLE [ StateMethod = GetDrawAttrStateForIFBX; ] + SID_ATTR_TRANSFORM_ROT_X [ StateMethod = GetDrawAttrStateForIFBX; ] + SID_ATTR_TRANSFORM_ROT_Y [ StateMethod = GetDrawAttrStateForIFBX; ] + SID_ATTR_TRANSFORM_PROTECT_POS [ StateMethod = GetDrawAttrStateForIFBX;] + SID_ATTR_TRANSFORM_PROTECT_SIZE [ StateMethod = GetDrawAttrStateForIFBX;] +} diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi index 7601a52a0ffa..c9e027eca730 100644 --- a/sw/sdi/swriter.sdi +++ b/sw/sdi/swriter.sdi @@ -726,87 +726,6 @@ SfxVoidItem CalculateSel FN_CALCULATE ] //-------------------------------------------------------------------------- -SfxBoolItem CellVertBottom FN_TABLE_VERT_BOTTOM - -[ - /* 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_TABLE; -] - -//-------------------------------------------------------------------------- -SfxBoolItem CellVertCenter FN_TABLE_VERT_CENTER - -[ - /* 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_TABLE; -] - -//-------------------------------------------------------------------------- -SfxBoolItem CellVertTop FN_TABLE_VERT_NONE - -[ - /* 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_TABLE; -] - -//-------------------------------------------------------------------------- SfxBoolItem ChainFrames FN_FRAME_CHAIN [ @@ -3454,6 +3373,31 @@ SfxVoidItem GraphicDialog FN_FORMAT_GRAFIC_DLG ] //-------------------------------------------------------------------------- +SfxVoidItem ObjectWrapDialog FN_PROPERTY_WRAP_DLG +() +[ + /* 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_GRAPHIC; +] + +//-------------------------------------------------------------------------- SfxVoidItem Grow FN_GROW_FONT_SIZE () [ @@ -6292,6 +6236,30 @@ SfxVoidItem PageDialog FN_FORMAT_PAGE_DLG GroupId = GID_FORMAT; ] +SfxVoidItem PageSettingDialog FN_FORMAT_PAGE_SETTING_DLG +() +[ + /* 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; +] + //-------------------------------------------------------------------------- SfxVoidItem TitlePageDialog FN_FORMAT_TITLEPAGE_DLG () @@ -10411,3 +10379,81 @@ SfxVoidItem OpenFromWriter FN_OPEN_FILE ToolBoxConfig = TRUE, GroupId = GID_APPLICATION; ] + +SfxInt16Item SwPageColumn SID_ATTR_PAGE_COLUMN + +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = TRUE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = TRUE, + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_VIEW; +] + +SvxLongULSpaceItem SwPageULMargin SID_ATTR_PAGE_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; +] + +SvxLongLRSpaceItem SwPageLRMargin SID_ATTR_PAGE_LRSPACE + +[ + /* 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; +] diff --git a/sw/sdi/swslots.sdi b/sw/sdi/swslots.sdi index fa1e7df30edc..8b2554bec662 100644 --- a/sw/sdi/swslots.sdi +++ b/sw/sdi/swslots.sdi @@ -69,6 +69,7 @@ ModulePrefix( "Sw" ) include "wtextsh.sdi" include "_drwbase.sdi" + include "sidebar.sdi" include "drwbassh.sdi" include "wdrwbase.sdi" diff --git a/sw/sdi/wdrwbase.sdi b/sw/sdi/wdrwbase.sdi index 6822df49661a..0b3c16528900 100644 --- a/sw/sdi/wdrwbase.sdi +++ b/sw/sdi/wdrwbase.sdi @@ -28,6 +28,7 @@ interface WebDrawBase : BaseTextDrawBase shell SwWebDrawBaseShell: SwBaseShell { import WebDrawBase[Automation]; + import Sidebar; SID_OBJECT_ALIGN [ diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx index fc6809c2ee5c..920853f6b463 100644 --- a/sw/source/core/doc/docdesc.cxx +++ b/sw/source/core/doc/docdesc.cxx @@ -18,10 +18,13 @@ */ +#include <cmdid.h> #include <svx/svdmodel.hxx> #include <editeng/ulspitem.hxx> #include <editeng/paperinf.hxx> #include "editeng/frmdiritem.hxx" +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> #include <sfx2/printer.hxx> #include <fmtfsize.hxx> #include <fmthdft.hxx> @@ -417,6 +420,18 @@ void SwDoc::ChgPageDesc( sal_uInt16 i, const SwPageDesc &rChged ) { GetIDocumentUndoRedo().DelAllUndoObj(); } + + SfxBindings* pBindings = + ( GetDocShell() && GetDocShell()->GetDispatcher() ) ? GetDocShell()->GetDispatcher()->GetBindings() : 0; + if ( pBindings ) + { + pBindings->Invalidate( SID_ATTR_PAGE_COLUMN ); + pBindings->Invalidate( SID_ATTR_PAGE ); + pBindings->Invalidate( SID_ATTR_PAGE_SIZE ); + pBindings->Invalidate( SID_ATTR_PAGE_ULSPACE ); + pBindings->Invalidate( SID_ATTR_PAGE_LRSPACE ); + } + } /// All descriptors whose Follow point to the to-be-deleted have to be adapted. diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx index 8bd4f50f691e..3fa8bf9d982c 100644 --- a/sw/source/core/edit/ednumber.cxx +++ b/sw/source/core/edit/ednumber.cxx @@ -157,7 +157,90 @@ bool SwEditShell::NoNum() return bRet; } // Loeschen, Splitten der Aufzaehlungsliste +sal_Bool SwEditShell::SelectionHasNumber() const +{ + sal_Bool bResult = HasNumber(); + const SwTxtNode * pTxtNd = + GetCrsr()->GetPoint()->nNode.GetNode().GetTxtNode(); + if (!bResult && pTxtNd && pTxtNd->Len()==0 && !pTxtNd->GetNumRule()) { + SwPamRanges aRangeArr( *GetCrsr() ); + SwPaM aPam( *GetCrsr()->GetPoint() ); + for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n ) + { + aRangeArr.SetPam( n, aPam ); + { + sal_uInt32 nStt = aPam.GetPoint()->nNode.GetIndex(), + nEnd = aPam.GetMark()->nNode.GetIndex(); + if( nStt > nEnd ) + { + sal_uInt32 nTmp = nStt; nStt = nEnd; nEnd = nTmp; + } + for (sal_uInt32 nPos = nStt; nPos<=nEnd; nPos++) + { + pTxtNd = mpDoc->GetNodes()[nPos]->GetTxtNode(); + if (pTxtNd && pTxtNd->Len()!=0) + { + bResult = pTxtNd->HasNumber(); + + // --> OD 2005-10-26 #b6340308# + // special case: outline numbered, not counted paragraph + if ( bResult && + pTxtNd->GetNumRule() == GetDoc()->GetOutlineNumRule() && + !pTxtNd->IsCountedInList() ) + { + bResult = sal_False; + } + if (bResult==sal_False) { + break; + } + // <-- + } + } + } + } + + } + return bResult; +} +//Sym3_879 add a new function to determine number on/off status +sal_Bool SwEditShell::SelectionHasBullet() const +{ + sal_Bool bResult = HasBullet(); + const SwTxtNode * pTxtNd = + GetCrsr()->GetPoint()->nNode.GetNode().GetTxtNode(); + if (!bResult && pTxtNd && pTxtNd->Len()==0 && !pTxtNd->GetNumRule()) { + SwPamRanges aRangeArr( *GetCrsr() ); + SwPaM aPam( *GetCrsr()->GetPoint() ); + for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n ) + { + aRangeArr.SetPam( n, aPam ); + { + sal_uInt32 nStt = aPam.GetPoint()->nNode.GetIndex(), + nEnd = aPam.GetMark()->nNode.GetIndex(); + if( nStt > nEnd ) + { + sal_uInt32 nTmp = nStt; nStt = nEnd; nEnd = nTmp; + } + for (sal_uInt32 nPos = nStt; nPos<=nEnd; nPos++) + { + pTxtNd = mpDoc->GetNodes()[nPos]->GetTxtNode(); + if (pTxtNd && pTxtNd->Len()!=0) + { + bResult = pTxtNd->HasBullet(); + + if (bResult==sal_False) { + break; + } + } + } + } + } + + } + + return bResult; +} // -> #i29560# sal_Bool SwEditShell::HasNumber() const { diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index 4c979791352d..2ffbc1d6b49c 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -2475,7 +2475,7 @@ sal_uInt8 SwFEShell::IsSelObjProtected( sal_uInt16 eType ) const { // TODO/LATER: use correct aspect const bool bNeverResize = (embed::EmbedMisc::EMBED_NEVERRESIZE & xObj->getStatus( embed::Aspects::MSOLE_CONTENT )); - if ( (FLYPROTECT_CONTENT & eType) && bNeverResize ) + if ( ( (FLYPROTECT_CONTENT & eType) || (FLYPROTECT_SIZE & eType) ) && bNeverResize ) { nChk |= FLYPROTECT_SIZE; nChk |= FLYPROTECT_FIXED; diff --git a/sw/source/ui/app/docst.cxx b/sw/source/ui/app/docst.cxx index 90867fe9fddf..bdb823ae5874 100644 --- a/sw/source/ui/app/docst.cxx +++ b/sw/source/ui/app/docst.cxx @@ -268,7 +268,7 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq ) if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( SID_STYLE_FAMILY, sal_False, &pItem )) { - sal_uInt16 nFamily = ((const SfxUInt16Item*)pItem)->GetValue(); + const sal_uInt16 nFamily = ((const SfxUInt16Item*)pItem)->GetValue(); String sName; sal_uInt16 nMask = 0; @@ -283,7 +283,7 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq ) sal_False, &pItem )) sParent = ((const SfxStringItem*)pItem)->GetValue(); - nRet = Edit( sName, sParent, nFamily, nMask, sal_True, sal_False, 0, rReq.IsAPI() ); + nRet = Edit( sName, sParent, nFamily, nMask, sal_True, 0, 0, rReq.IsAPI() ); } break; @@ -445,7 +445,7 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq ) switch(nSlot) { case SID_STYLE_EDIT: - nRet = Edit(aParam, aEmptyStr, nFamily, nMask, sal_False, sal_False, pActShell ); + nRet = Edit(aParam, aEmptyStr, nFamily, nMask, sal_False, 0, pActShell ); break; case SID_STYLE_DELETE: nRet = Delete(aParam, nFamily); @@ -604,10 +604,15 @@ IMPL_LINK_NOARG(ApplyStyle, ApplyHdl) return m_nRet; } -// Edit -sal_uInt16 SwDocShell::Edit( const String &rName, const String &rParent, sal_uInt16 nFamily, sal_uInt16 nMask, - sal_Bool bNew, sal_uInt16 nPageId, SwWrtShell* pActShell, - sal_Bool bBasic ) +sal_uInt16 SwDocShell::Edit( + const String &rName, + const String &rParent, + const sal_uInt16 nFamily, + sal_uInt16 nMask, + const sal_Bool bNew, + const sal_uInt16 nSlot, + SwWrtShell* pActShell, + const sal_Bool bBasic ) { OSL_ENSURE(GetWrtShell(), "No Shell, no Styles"); SfxStyleSheetBase *pStyle = 0; @@ -758,7 +763,7 @@ sal_uInt16 SwDocShell::Edit( const String &rName, const String &rParent, sal_uIn SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "Dialogdiet fail!"); SfxAbstractApplyTabDialog* pDlg = pFact->CreateTemplateDialog( - 0, *(xTmp.get()), nFamily, nPageId, + 0, *(xTmp.get()), nFamily, nSlot, pActShell ? pActShell : pWrtShell, bNew); OSL_ENSURE(pDlg, "Dialogdiet fail!"); ApplyStyle aApplyStyleHelper(*this, bNew, pStyle, nRet, xTmp, nFamily, pDlg, mxBasePool, bModified); @@ -1276,9 +1281,12 @@ void SwDocShell::_LoadStyles( SfxObjectShell& rSource, sal_Bool bPreserveCurrent } -void SwDocShell::FormatPage( const String& rPage, sal_uInt16 nPageId, SwWrtShell* pActShell ) +void SwDocShell::FormatPage( + const String& rPage, + const sal_uInt16 nSlot, + SwWrtShell& rActShell ) { - Edit( rPage, aEmptyStr, SFX_STYLE_FAMILY_PAGE, 0, sal_False, nPageId, pActShell); + Edit( rPage, aEmptyStr, SFX_STYLE_FAMILY_PAGE, 0, sal_False, nSlot, &rActShell); } Bitmap SwDocShell::GetStyleFamilyBitmap( SfxStyleFamily eFamily ) diff --git a/sw/source/ui/app/mn.src b/sw/source/ui/app/mn.src index 630411eceef3..e8175e2bb00c 100644 --- a/sw/source/ui/app/mn.src +++ b/sw/source/ui/app/mn.src @@ -443,20 +443,20 @@ location: <project>/uiconfig/[swriter|sweb|sglobal]/menubar/menubar.xml SEPARATOR ; \ MenuItem\ {\ - Identifier = FN_TABLE_VERT_NONE ; \ - HelpId = CMD_FN_TABLE_VERT_NONE ; \ + Identifier = SID_TABLE_VERT_NONE ; \ + HelpId = CMD_SID_TABLE_VERT_NONE ; \ Text [ en-US ] = "~Top" ; \ };\ MenuItem\ {\ - Identifier = FN_TABLE_VERT_CENTER ; \ - HelpId = CMD_FN_TABLE_VERT_CENTER ; \ + Identifier = SID_TABLE_VERT_CENTER ; \ + HelpId = CMD_SID_TABLE_VERT_CENTER ; \ Text [ en-US ] = "C~enter" ; \ };\ MenuItem\ {\ - Identifier = FN_TABLE_VERT_BOTTOM ; \ - HelpId = CMD_FN_TABLE_VERT_BOTTOM ; \ + Identifier = SID_TABLE_VERT_BOTTOM ; \ + HelpId = CMD_SID_TABLE_VERT_BOTTOM ; \ Text [ en-US ] = "~Bottom" ; \ };\ SEPARATOR ; \ diff --git a/sw/source/ui/app/swmodule.cxx b/sw/source/ui/app/swmodule.cxx index 7161248dd171..126cea5d7352 100644 --- a/sw/source/ui/app/swmodule.cxx +++ b/sw/source/ui/app/swmodule.cxx @@ -106,6 +106,7 @@ #include <mailmergechildwindow.hxx> #include <modcfg.hxx> #include <fontcfg.hxx> +#include <sfx2/sidebar/SidebarChildWindow.hxx> #include <sfx2/taskpane.hxx> #include <sfx2/evntconf.hxx> #include <sfx2/appuno.hxx> @@ -399,7 +400,8 @@ void SwDLL::RegisterControls() ::avmedia::MediaPlayer::RegisterChildWindow(0, pMod); SvxSmartTagsControl::RegisterControl(SID_OPEN_SMARTTAGMENU, pMod); - ::sfx2::TaskPaneWrapper::RegisterChildWindow( sal_False, pMod ); + ::sfx2::sidebar::SidebarChildWindow::RegisterChildWindow(0, pMod); + ::sfx2::TaskPaneWrapper::RegisterChildWindow(0, pMod); } diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index dffb169306e9..fffa43c2b640 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -1041,12 +1041,12 @@ SfxAbstractTabDialog* SwAbstractDialogFactory_Impl::CreateFrmTabDialog( int nRes SfxAbstractApplyTabDialog* SwAbstractDialogFactory_Impl::CreateTemplateDialog( Window* pParent, SfxStyleSheetBase& rBase, - sal_uInt16 nRegion, - sal_uInt16 nPageId, + sal_uInt16 nRegion, + const sal_uInt16 nSlot, SwWrtShell* pActShell, - sal_Bool bNew ) //add for SwTemplateDlg + sal_Bool bNew ) //add for SwTemplateDlg { - SfxTabDialog* pDlg = new SwTemplateDlg( pParent, rBase, nRegion, nPageId, pActShell, bNew ); + SfxTabDialog* pDlg = new SwTemplateDlg( pParent, rBase, nRegion, nSlot, pActShell, bNew ); return new AbstractApplyTabDialog_Impl( pDlg ); } diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx index 791a6ac142ec..7ca57c282191 100644 --- a/sw/source/ui/dialog/swdlgfact.hxx +++ b/sw/source/ui/dialog/swdlgfact.hxx @@ -504,7 +504,7 @@ public: Window* pParent, SfxStyleSheetBase& rBase, sal_uInt16 nRegion, - sal_uInt16 nPageId = 0, + const sal_uInt16 nSlot = 0, SwWrtShell* pActShell = 0, sal_Bool bNew = sal_False ); //add for SwTemplateDlg virtual AbstractGlossaryDlg* CreateGlossaryDlg(SfxViewFrame* pViewFrame, diff --git a/sw/source/ui/docvw/HeaderFooterWin.cxx b/sw/source/ui/docvw/HeaderFooterWin.cxx index cb69646e4a8d..970e541d0a55 100644 --- a/sw/source/ui/docvw/HeaderFooterWin.cxx +++ b/sw/source/ui/docvw/HeaderFooterWin.cxx @@ -410,7 +410,7 @@ void SwHeaderFooterWin::ExecuteCommand( sal_uInt16 nSlot ) rView.GetDocShell()->FormatPage( rStyleName, - nPageId, &rSh ); + nPageId, rSh ); } break; case FN_HEADERFOOTER_BORDERBACK: diff --git a/sw/source/ui/fmtui/tmpdlg.cxx b/sw/source/ui/fmtui/tmpdlg.cxx index 34cad31241c0..8944b2a34af6 100644 --- a/sw/source/ui/fmtui/tmpdlg.cxx +++ b/sw/source/ui/fmtui/tmpdlg.cxx @@ -76,7 +76,7 @@ extern SW_DLLPUBLIC SwWrtShell* GetActiveWrtShell(); SwTemplateDlg::SwTemplateDlg(Window* pParent, SfxStyleSheetBase& rBase, sal_uInt16 nRegion, - sal_uInt16 nPageId, + const sal_uInt16 nSlot, SwWrtShell* pActShell, sal_Bool bNew ) : SfxStyleDialog( pParent, @@ -242,8 +242,14 @@ SwTemplateDlg::SwTemplateDlg(Window* pParent, AddTabPage(TP_FOOTER_PAGE, String(SW_RES(STR_PAGE_FOOTER)), SvxFooterPage::Create, SvxFooterPage::GetRanges ); - if(nPageId) - SetCurPageId(nPageId); + if ( nSlot == FN_FORMAT_PAGE_COLUMN_DLG ) + { + SetCurPageId(TP_COLUMN); + } + else if ( nSlot == FN_FORMAT_PAGE_SETTING_DLG ) + { + SetCurPageId(TP_PAGE_STD); + } OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_PAGE ), "GetTabPageCreatorFunc fail!"); OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_PAGE ), "GetTabPageRangesFunc fail!"); diff --git a/sw/source/ui/inc/drwbassh.hxx b/sw/source/ui/inc/drwbassh.hxx index 5cd5b428008c..d4f57c350f83 100644 --- a/sw/source/ui/inc/drwbassh.hxx +++ b/sw/source/ui/inc/drwbassh.hxx @@ -43,6 +43,7 @@ public: void Execute(SfxRequest &); void GetState(SfxItemSet &); + void GetDrawAttrStateForIFBX( SfxItemSet& rSet ); void DisableState(SfxItemSet &rSet) { Disable(rSet);} sal_Bool Disable(SfxItemSet& rSet, sal_uInt16 nWhich = 0); diff --git a/sw/source/ui/inc/drwtxtsh.hxx b/sw/source/ui/inc/drwtxtsh.hxx index e7d687b85c1d..e4bbc8d69883 100644 --- a/sw/source/ui/inc/drwtxtsh.hxx +++ b/sw/source/ui/inc/drwtxtsh.hxx @@ -54,6 +54,7 @@ public: void Execute(SfxRequest &); void ExecDraw(SfxRequest &); + void GetStatePropPanelAttr(SfxItemSet &); void GetState(SfxItemSet &); void GetDrawTxtCtrlState(SfxItemSet&); diff --git a/sw/source/ui/inc/textsh.hxx b/sw/source/ui/inc/textsh.hxx index 0dc0370d3493..7edcedb61ff3 100644 --- a/sw/source/ui/inc/textsh.hxx +++ b/sw/source/ui/inc/textsh.hxx @@ -57,6 +57,7 @@ public: void ExecMoveLingu(SfxRequest &); void ExecMoveMisc(SfxRequest &); void ExecField(SfxRequest &rReq); + void ExecSetNumber(SfxRequest &); void StateField(SfxItemSet &); void ExecIdx(SfxRequest &); void GetIdxState(SfxItemSet &); diff --git a/sw/source/ui/inc/tmpdlg.hxx b/sw/source/ui/inc/tmpdlg.hxx index c2ca989c15f6..d66b208251f3 100644 --- a/sw/source/ui/inc/tmpdlg.hxx +++ b/sw/source/ui/inc/tmpdlg.hxx @@ -32,18 +32,21 @@ class SwTemplateDlg: public SfxStyleDialog sal_uInt16 nType; sal_uInt16 nHtmlMode; - SwWrtShell* pWrtShell; + SwWrtShell* pWrtShell; sal_Bool bNewStyle; DECL_LINK( NumOptionsHdl, PushButton* ); public: + // @param nSlot + // Identifies optional Slot by which the creation of the Template (Style) dialog is triggered. + // Currently used, if nRegion == SFX_STYLE_FAMILY_PAGE in order to activate certain dialog pane SwTemplateDlg( Window* pParent, SfxStyleSheetBase& rBase, - sal_uInt16 nRegion, - sal_uInt16 nPageId = 0, + sal_uInt16 nRegion, + const sal_uInt16 nSlot = 0, SwWrtShell* pActShell = 0, - sal_Bool bNew = sal_False ); + sal_Bool bNew = sal_False ); ~SwTemplateDlg(); const SfxItemSet* GetRefreshedSet(); diff --git a/sw/source/ui/inc/wrap.hxx b/sw/source/ui/inc/wrap.hxx index ccb898815d1c..684ef6cca0d9 100644 --- a/sw/source/ui/inc/wrap.hxx +++ b/sw/source/ui/inc/wrap.hxx @@ -76,7 +76,6 @@ class SwWrapTabPage: public SfxTabPage CheckBox aWrapOutsideCB; ImageList aWrapIL; - ImageList aWrapILH; sal_uInt16 nOldLeftMargin; sal_uInt16 nOldRightMargin; diff --git a/sw/source/ui/misc/titlepage.cxx b/sw/source/ui/misc/titlepage.cxx index 67dd361c9672..f76e11bf9812 100644 --- a/sw/source/ui/misc/titlepage.cxx +++ b/sw/source/ui/misc/titlepage.cxx @@ -252,7 +252,7 @@ SwTitlePageDlg::~SwTitlePageDlg() IMPL_LINK_NOARG(SwTitlePageDlg, EditHdl) { SwView& rView = mpSh->GetView(); - rView.GetDocShell()->FormatPage(m_pPagePropertiesLB->GetSelectEntry(), false, mpSh); + rView.GetDocShell()->FormatPage(m_pPagePropertiesLB->GetSelectEntry(), false, *mpSh); rView.InvalidateRulerPos(); return 0; diff --git a/sw/source/ui/shells/annotsh.cxx b/sw/source/ui/shells/annotsh.cxx index 2b0151918950..e5ccd066fba0 100644 --- a/sw/source/ui/shells/annotsh.cxx +++ b/sw/source/ui/shells/annotsh.cxx @@ -34,6 +34,8 @@ #include <sfx2/dispatch.hxx> #include <sfx2/request.hxx> #include <editeng/spltitem.hxx> +#include <editeng/lrspitem.hxx> +#include <editeng/ulspitem.hxx> #include <editeng/orphitem.hxx> #include <editeng/formatbreakitem.hxx> #include <editeng/widwitem.hxx> @@ -99,6 +101,7 @@ #include <svx/dialogs.hrc> #include <svx/svxids.hrc> +#include <sfx2/sidebar/EnumContext.hxx> #include <svl/itempool.hxx> #include <editeng/outliner.hxx> #include <editeng/editeng.hxx> @@ -146,6 +149,7 @@ SwAnnotationShell::SwAnnotationShell( SwView& r ) { SwWrtShell &rSh = rView.GetWrtShell(); SetPool(rSh.GetAttrPool().GetSecondaryPool()); + SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Annotation)); } SwAnnotationShell::~SwAnnotationShell() @@ -181,6 +185,35 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) sal_uInt16 nEEWhich = 0; switch (nSlot) { + case SID_ATTR_PARA_LRSPACE: + { + SvxLRSpaceItem aParaMargin((const SvxLRSpaceItem&)rReq. + GetArgs()->Get(nSlot)); + aParaMargin.SetWhich( EE_PARA_LRSPACE ); + + aNewAttr.Put(aParaMargin); + rReq.Done(); + break; + } + case SID_ATTR_PARA_LINESPACE: + { + SvxLineSpacingItem aParaMargin = (const SvxLineSpacingItem&)pNewAttrs->Get( + GetPool().GetWhich(nSlot)); + aParaMargin.SetWhich( EE_PARA_SBL ); + + aNewAttr.Put(aParaMargin); + rReq.Done(); + break; + } + case SID_ATTR_PARA_ULSPACE: + { + SvxULSpaceItem aULSpace = (const SvxULSpaceItem&)pNewAttrs->Get( + GetPool().GetWhich(nSlot)); + aULSpace.SetWhich( EE_PARA_ULSPACE ); + aNewAttr.Put( aULSpace ); + rReq.Done(); + } + break; case SID_ATTR_CHAR_FONT: case SID_ATTR_CHAR_FONTHEIGHT: case SID_ATTR_CHAR_WEIGHT: @@ -198,8 +231,19 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) case SID_ATTR_CHAR_COLOR: nEEWhich = EE_CHAR_COLOR; break; case SID_ATTR_CHAR_UNDERLINE: { - FontUnderline eFU = ((const SvxUnderlineItem&)aEditAttr.Get(EE_CHAR_UNDERLINE)).GetLineStyle(); - aNewAttr.Put(SvxUnderlineItem(eFU == UNDERLINE_SINGLE ? UNDERLINE_NONE : UNDERLINE_SINGLE, EE_CHAR_UNDERLINE)); + if( rReq.GetArgs() ) + { + SFX_REQUEST_ARG( rReq, pItem, SvxUnderlineItem, SID_ATTR_CHAR_UNDERLINE , sal_False ); + if (pItem) + { + aNewAttr.Put(*pItem); + } + else + { + FontUnderline eFU = ( (const SvxUnderlineItem&) aEditAttr.Get( EE_CHAR_UNDERLINE ) ).GetLineStyle(); + aNewAttr.Put( SvxUnderlineItem( eFU != UNDERLINE_NONE ?UNDERLINE_NONE : UNDERLINE_SINGLE, EE_CHAR_UNDERLINE ) ); + } + } break; } case SID_ATTR_CHAR_OVERLINE: @@ -412,6 +456,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) } } break; + case SID_CHAR_DLG_EFFECT: case SID_CHAR_DLG: { const SfxItemSet* pArgs = rReq.GetArgs(); @@ -433,8 +478,12 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); - SfxAbstractTabDialog* pDlg = pFact->CreateSwCharDlg(rView.GetWindow(), rView, aDlgAttr, 0, sal_True); + SfxAbstractTabDialog* pDlg = pFact->CreateSwCharDlg( rView.GetWindow(), rView, aDlgAttr, 0, sal_True ); OSL_ENSURE(pDlg, "Dialogdiet fail!"); + if (nSlot == SID_CHAR_DLG_EFFECT) + { + pDlg->SetCurPageId(TP_CHAR_EXT); + } sal_uInt16 nRet = pDlg->Execute(); if(RET_OK == nRet ) { @@ -576,6 +625,44 @@ void SwAnnotationShell::GetState(SfxItemSet& rSet) sal_uInt16 nSlotId = GetPool().GetSlotId( nWhich ); switch( nSlotId ) { + case SID_ATTR_PARA_LRSPACE: + { + SfxItemState eState = aEditAttr.GetItemState( EE_PARA_LRSPACE ); + if( eState >= SFX_ITEM_DEFAULT ) + { + SvxLRSpaceItem aLR = ( (const SvxLRSpaceItem&) aEditAttr.Get( EE_PARA_LRSPACE ) ); + aLR.SetWhich(SID_ATTR_PARA_LRSPACE); + rSet.Put(aLR); + } + else + rSet.InvalidateItem(nSlotId); + } + break; + case SID_ATTR_PARA_LINESPACE: + { + SfxItemState eState = aEditAttr.GetItemState( EE_PARA_SBL ); + if( eState >= SFX_ITEM_DEFAULT ) + { + SvxLineSpacingItem aLR = ( (const SvxLineSpacingItem&) aEditAttr.Get( EE_PARA_SBL ) ); + rSet.Put(aLR); + } + else + rSet.InvalidateItem(nSlotId); + } + break; + case SID_ATTR_PARA_ULSPACE: + { + SfxItemState eState = aEditAttr.GetItemState( EE_PARA_ULSPACE ); + if( eState >= SFX_ITEM_DEFAULT ) + { + SvxULSpaceItem aULSpace = (const SvxULSpaceItem&) aEditAttr.Get( EE_PARA_ULSPACE ); + aULSpace.SetWhich(SID_ATTR_PARA_ULSPACE); + rSet.Put(aULSpace); + } + else + rSet.InvalidateItem(nSlotId); + } + break; case SID_ATTR_CHAR_FONT: case SID_ATTR_CHAR_FONTHEIGHT: case SID_ATTR_CHAR_WEIGHT: @@ -606,6 +693,8 @@ void SwAnnotationShell::GetState(SfxItemSet& rSet) case SID_ATTR_CHAR_SHADOWED: nEEWhich = EE_CHAR_SHADOW;break; case SID_ATTR_CHAR_STRIKEOUT: nEEWhich = EE_CHAR_STRIKEOUT;break; case SID_ATTR_CHAR_LANGUAGE : nEEWhich = EE_CHAR_LANGUAGE;break; + case SID_ATTR_CHAR_ESCAPEMENT: nEEWhich = EE_CHAR_ESCAPEMENT;break; + case SID_ATTR_CHAR_KERNING: nEEWhich = EE_CHAR_KERNING;break; case FN_SET_SUPER_SCRIPT: case FN_SET_SUB_SCRIPT: { @@ -742,7 +831,17 @@ void SwAnnotationShell::GetState(SfxItemSet& rSet) } if(nEEWhich) + { rSet.Put(aEditAttr.Get(nEEWhich, sal_True), nWhich); + if(nEEWhich == EE_CHAR_KERNING) + { + SfxItemState eState = aEditAttr.GetItemState( EE_CHAR_KERNING, sal_True ); + if ( eState == SFX_ITEM_DONTCARE ) + { + rSet.InvalidateItem(EE_CHAR_KERNING); + } + } + } if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()==SwPostItHelper::DELETED) rSet.DisableItem( nWhich ); diff --git a/sw/source/ui/shells/basesh.cxx b/sw/source/ui/shells/basesh.cxx index ff8aa17d5775..05ce67dd1543 100644 --- a/sw/source/ui/shells/basesh.cxx +++ b/sw/source/ui/shells/basesh.cxx @@ -2335,8 +2335,9 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq) delete pDlg; } break; - case FN_FORMAT_PAGE_COLUMN_DLG: case FN_FORMAT_PAGE_DLG: + case FN_FORMAT_PAGE_COLUMN_DLG: + case FN_FORMAT_PAGE_SETTING_DLG: { if( !bBackground ) { @@ -2345,11 +2346,10 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq) // Temporary view, because the shell does not need to be valid after the dialogue // for example disable header SwView& rTempView = GetView(); - sal_uInt16 nPageId = 0; - if ( nSlot == FN_FORMAT_PAGE_COLUMN_DLG ) - nPageId = TP_COLUMN ; - rTempView.GetDocShell()->FormatPage(rPageDesc.GetName(), - nPageId, &rSh ); + rTempView.GetDocShell()->FormatPage( + rPageDesc.GetName(), + nSlot, + rSh ); rTempView.InvalidateRulerPos(); } } diff --git a/sw/source/ui/shells/beziersh.cxx b/sw/source/ui/shells/beziersh.cxx index cdabed254436..fe87a0a8b93a 100644 --- a/sw/source/ui/shells/beziersh.cxx +++ b/sw/source/ui/shells/beziersh.cxx @@ -23,6 +23,7 @@ #include <svl/eitem.hxx> #include <svl/whiter.hxx> #include <svx/svdopath.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include <sfx2/request.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/objface.hxx> @@ -59,6 +60,8 @@ SwBezierShell::SwBezierShell(SwView &_rView): SwWrtShell *pSh = &GetShell(); SdrView* pSdrView = pSh->GetDrawView(); pSdrView->SetEliminatePolyPointLimitAngle(1500L); + + SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Draw)); } void SwBezierShell::Execute(SfxRequest &rReq) diff --git a/sw/source/ui/shells/drawdlg.cxx b/sw/source/ui/shells/drawdlg.cxx index a68e94aa6828..8373278cbc06 100644 --- a/sw/source/ui/shells/drawdlg.cxx +++ b/sw/source/ui/shells/drawdlg.cxx @@ -93,12 +93,18 @@ void SwDrawShell::ExecDrawDlg(SfxRequest& rReq) static sal_uInt16 aInval[] = { - SID_ATTR_FILL_STYLE, SID_ATTR_FILL_COLOR, 0 + SID_ATTR_FILL_STYLE, + SID_ATTR_FILL_COLOR, + SID_ATTR_FILL_TRANSPARENCE, + SID_ATTR_FILL_FLOATTRANSPARENCE, + 0 }; SfxBindings &rBnd = GetView().GetViewFrame()->GetBindings(); rBnd.Invalidate(aInval); rBnd.Update(SID_ATTR_FILL_STYLE); rBnd.Update(SID_ATTR_FILL_COLOR); + rBnd.Update(SID_ATTR_FILL_TRANSPARENCE); + rBnd.Update(SID_ATTR_FILL_FLOATTRANSPARENCE); } delete pDlg; } @@ -132,8 +138,16 @@ void SwDrawShell::ExecDrawDlg(SfxRequest& rReq) static sal_uInt16 aInval[] = { - SID_ATTR_LINE_STYLE, SID_ATTR_LINE_WIDTH, - SID_ATTR_LINE_COLOR, 0 + SID_ATTR_LINE_STYLE, // ( SID_SVX_START + 169 ) + SID_ATTR_LINE_DASH, // ( SID_SVX_START + 170 ) + SID_ATTR_LINE_WIDTH, // ( SID_SVX_START + 171 ) + SID_ATTR_LINE_COLOR, // ( SID_SVX_START + 172 ) + SID_ATTR_LINE_START, // ( SID_SVX_START + 173 ) + SID_ATTR_LINE_END, // ( SID_SVX_START + 174 ) + SID_ATTR_LINE_TRANSPARENCE, // (SID_SVX_START+1107) + SID_ATTR_LINE_JOINT, // (SID_SVX_START+1110) + SID_ATTR_LINE_CAP, // (SID_SVX_START+1111) + 0 }; GetView().GetViewFrame()->GetBindings().Invalidate(aInval); @@ -181,12 +195,17 @@ void SwDrawShell::ExecDrawAttrArgs(SfxRequest& rReq) case SID_ATTR_FILL_GRADIENT: case SID_ATTR_FILL_HATCH: case SID_ATTR_FILL_BITMAP: + case SID_ATTR_FILL_TRANSPARENCE: + case SID_ATTR_FILL_FLOATTRANSPARENCE: pDis->Execute(SID_ATTRIBUTES_AREA, sal_False); break; case SID_ATTR_LINE_STYLE: case SID_ATTR_LINE_DASH: case SID_ATTR_LINE_WIDTH: case SID_ATTR_LINE_COLOR: + case SID_ATTR_LINE_TRANSPARENCE: + case SID_ATTR_LINE_JOINT: + case SID_ATTR_LINE_CAP: pDis->Execute(SID_ATTRIBUTES_LINE, sal_False); break; } diff --git a/sw/source/ui/shells/drawsh.cxx b/sw/source/ui/shells/drawsh.cxx index bcf1b08e64e2..e55459801130 100644 --- a/sw/source/ui/shells/drawsh.cxx +++ b/sw/source/ui/shells/drawsh.cxx @@ -43,6 +43,8 @@ #include <com/sun/star/ui/dialogs/XSLTFilterDialog.hpp> #include <svx/xtable.hxx> +#include <sfx2/sidebar/EnumContext.hxx> +#include <svx/svdoashp.hxx> #include "swundo.hxx" #include "wrtsh.hxx" @@ -158,9 +160,11 @@ void SwDrawShell::Execute(SfxRequest &rReq) break; case FN_FLIP_HORZ_GRAFIC: + case SID_FLIP_HORIZONTAL: bMirror = false; /* no break */ case FN_FLIP_VERT_GRAFIC: + case SID_FLIP_VERTICAL: rSh.MirrorSelection( bMirror ); break; @@ -321,11 +325,13 @@ void SwDrawShell::GetState(SfxItemSet& rSet) break; case FN_FLIP_HORZ_GRAFIC: + case SID_FLIP_HORIZONTAL: if ( !pSdrView->IsMirrorAllowed() || bProtected ) rSet.DisableItem( nWhich ); break; case FN_FLIP_VERT_GRAFIC: + case SID_FLIP_VERTICAL: if ( !pSdrView->IsMirrorAllowed() || bProtected ) rSet.DisableItem( nWhich ); break; @@ -353,6 +359,8 @@ SwDrawShell::SwDrawShell(SwView &_rView) : { SetHelpId(SW_DRAWSHELL); SetName(OUString("Draw")); + + SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Draw)); } // Edit SfxRequests for FontWork diff --git a/sw/source/ui/shells/drformsh.cxx b/sw/source/ui/shells/drformsh.cxx index e0d4112e8713..255aed0a97b5 100644 --- a/sw/source/ui/shells/drformsh.cxx +++ b/sw/source/ui/shells/drformsh.cxx @@ -26,6 +26,7 @@ #include <sfx2/app.hxx> #include <sfx2/viewfrm.hxx> #include <sfx2/dispatch.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include <svl/srchitem.hxx> #include <svx/fmglob.hxx> #include <svx/svdouno.hxx> @@ -251,6 +252,7 @@ SwDrawFormShell::SwDrawFormShell(SwView &_rView) : SetHelpId(SW_DRAWFORMSHELL); GetShell().NoEdit(true); SetName(OUString("DrawForm")); + SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Form)); } SwDrawFormShell::~SwDrawFormShell() diff --git a/sw/source/ui/shells/drwbassh.cxx b/sw/source/ui/shells/drwbassh.cxx index 4658462a00d5..7d3c2802a30f 100644 --- a/sw/source/ui/shells/drwbassh.cxx +++ b/sw/source/ui/shells/drwbassh.cxx @@ -357,6 +357,10 @@ void SwDrawBaseShell::Execute(SfxRequest &rReq) } } + else + { + pSdrView->SetGeoAttrToMarked( *pArgs ); + } } } break; @@ -727,6 +731,18 @@ void SwDrawBaseShell::GetState(SfxItemSet& rSet) } } +void SwDrawBaseShell::GetDrawAttrStateForIFBX( SfxItemSet& rSet ) +{ + SwWrtShell *pSh = &GetShell(); + SdrView* pSdrView = pSh->GetDrawView(); + const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList(); + if( rMarkList.GetMark(0) != 0 ) + { + SfxItemSet aNewAttr(pSdrView->GetGeoAttrFromMarked()); + rSet.Put(aNewAttr,false); + } +} + sal_Bool SwDrawBaseShell::Disable(SfxItemSet& rSet, sal_uInt16 nWhich) { sal_Bool bDisable = GetShell().IsSelObjProtected(FLYPROTECT_CONTENT); diff --git a/sw/source/ui/shells/drwtxtex.cxx b/sw/source/ui/shells/drwtxtex.cxx index 31760259ed19..c6f20106e601 100644 --- a/sw/source/ui/shells/drwtxtex.cxx +++ b/sw/source/ui/shells/drwtxtex.cxx @@ -29,6 +29,8 @@ #include <tools/shl.hxx> #include <svx/svdview.hxx> #include <editeng/spltitem.hxx> +#include <editeng/lrspitem.hxx> +#include <editeng/ulspitem.hxx> #include <editeng/orphitem.hxx> #include <editeng/formatbreakitem.hxx> #include <editeng/widwitem.hxx> @@ -204,6 +206,33 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) case SID_ATTR_PARA_ADJUST_BLOCK: aNewAttr.Put(SvxAdjustItem(SVX_ADJUST_BLOCK, EE_PARA_JUST)); break; + case SID_ATTR_PARA_LRSPACE: + { + SvxLRSpaceItem aParaMargin((const SvxLRSpaceItem&)rReq. + GetArgs()->Get(nSlot)); + aParaMargin.SetWhich( EE_PARA_LRSPACE ); + aNewAttr.Put(aParaMargin); + rReq.Done(); + } + break; + case SID_ATTR_PARA_LINESPACE: + { + SvxLineSpacingItem aLineSpace = (const SvxLineSpacingItem&)pNewAttrs->Get( + GetPool().GetWhich(nSlot)); + aLineSpace.SetWhich( EE_PARA_SBL ); + aNewAttr.Put( aLineSpace ); + rReq.Done(); + } + break; + case SID_ATTR_PARA_ULSPACE: + { + SvxULSpaceItem aULSpace = (const SvxULSpaceItem&)pNewAttrs->Get( + GetPool().GetWhich(nSlot)); + aULSpace.SetWhich( EE_PARA_ULSPACE ); + aNewAttr.Put( aULSpace ); + rReq.Done(); + } + break; case SID_ATTR_PARA_LINESPACE_10: { @@ -254,6 +283,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) } break; + case SID_CHAR_DLG_EFFECT: case SID_CHAR_DLG: case SID_CHAR_DLG_FOR_PARAGRAPH: { @@ -285,6 +315,10 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) SfxAbstractTabDialog* pDlg = pFact->CreateSwCharDlg(pView->GetWindow(), *pView, aDlgAttr, 0, sal_True); OSL_ENSURE(pDlg, "Dialogdiet fail!"); + if (nSlot == SID_CHAR_DLG_EFFECT) + { + pDlg->SetCurPageId(TP_CHAR_EXT); + } sal_uInt16 nRet = pDlg->Execute(); if(RET_OK == nRet ) { @@ -586,6 +620,49 @@ ASK_ADJUST: } break; + case SID_ATTR_PARA_LRSPACE: + { + SfxItemState eState = aEditAttr.GetItemState(EE_PARA_LRSPACE); + if( eState >= SFX_ITEM_DEFAULT ) + { + SvxLRSpaceItem aLR = (const SvxLRSpaceItem&) aEditAttr.Get( EE_PARA_LRSPACE ); + aLR.SetWhich(SID_ATTR_PARA_LRSPACE); + rSet.Put(aLR); + } + else + rSet.InvalidateItem(nSlotId); + nSlotId = 0; + } + break; + case SID_ATTR_PARA_LINESPACE: + { + SfxItemState eState = aEditAttr.GetItemState(EE_PARA_SBL); + if( eState >= SFX_ITEM_DEFAULT ) + { + SvxLineSpacingItem aLR = (const SvxLineSpacingItem&) aEditAttr.Get( EE_PARA_SBL ); + rSet.Put(aLR); + } + else + rSet.InvalidateItem(nSlotId); + nSlotId = 0; + } + break; + case SID_ATTR_PARA_ULSPACE: + { + SfxItemState eState = aEditAttr.GetItemState(EE_PARA_ULSPACE); + if( eState >= SFX_ITEM_DEFAULT ) + { + SvxULSpaceItem aULSpace = (const SvxULSpaceItem&) aEditAttr.Get( EE_PARA_ULSPACE ); + aULSpace.SetWhich(SID_ATTR_PARA_ULSPACE); + rSet.Put(aULSpace); + } + else + rSet.InvalidateItem(nSlotId); + Invalidate(SID_ATTR_PARA_ULSPACE); + nSlotId = 0; + } + break; + case SID_ATTR_PARA_LINESPACE_10: nLSpace = 100; goto ASK_LINESPACE; case SID_ATTR_PARA_LINESPACE_15: nLSpace = 150; goto ASK_LINESPACE; case SID_ATTR_PARA_LINESPACE_20: nLSpace = 200; goto ASK_LINESPACE; diff --git a/sw/source/ui/shells/drwtxtsh.cxx b/sw/source/ui/shells/drwtxtsh.cxx index ca238ae0bfc6..e2cc1819c754 100644 --- a/sw/source/ui/shells/drwtxtsh.cxx +++ b/sw/source/ui/shells/drwtxtsh.cxx @@ -37,6 +37,7 @@ #include <sfx2/bindings.hxx> #include <svx/fontwork.hxx> #include <sfx2/request.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include <svl/whiter.hxx> #include <editeng/outliner.hxx> #include <editeng/editstat.hxx> @@ -131,6 +132,7 @@ SwDrawTextShell::SwDrawTextShell(SwView &rV) : rSh.NoEdit(true); SetName(OUString("ObjectText")); SetHelpId(SW_DRWTXTSHELL); + SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_DrawText)); } SwDrawTextShell::~SwDrawTextShell() @@ -486,6 +488,28 @@ void SwDrawTextShell::ExecDraw(SfxRequest &rReq) } } break; + case SID_TABLE_VERT_NONE: + case SID_TABLE_VERT_CENTER: + case SID_TABLE_VERT_BOTTOM: + { + sal_uInt16 nSId = rReq.GetSlot(); + if (pSdrView->AreObjectsMarked()) + { + SdrTextVertAdjust eTVA = SDRTEXTVERTADJUST_TOP; + if (nSId == SID_TABLE_VERT_CENTER) + eTVA = SDRTEXTVERTADJUST_CENTER; + else if (nSId == SID_TABLE_VERT_BOTTOM) + eTVA = SDRTEXTVERTADJUST_BOTTOM; + + SfxItemSet aNewAttr( pSdrView->GetModel()->GetItemPool() ); + pSdrView->GetAttributes( aNewAttr ); + aNewAttr.Put(SdrTextVertAdjustItem(eTVA)); + pSdrView->SetAttributes(aNewAttr); + rReq.Done(); + } + + } + break; default: OSL_ENSURE(!this, "unexpected slot-id"); @@ -816,4 +840,55 @@ void SwDrawTextShell::InsertSymbol(SfxRequest& rReq) return &pOutliner->GetUndoManager(); } +void SwDrawTextShell::GetStatePropPanelAttr(SfxItemSet &rSet) +{ + SfxWhichIter aIter( rSet ); + sal_uInt16 nWhich = aIter.FirstWhich(); + + SwWrtShell &rSh = GetShell(); + pSdrView = rSh.GetDrawView(); + + SfxItemSet aAttrs( pSdrView->GetModel()->GetItemPool() ); + pSdrView->GetAttributes( aAttrs ); + + while ( nWhich ) + { + sal_uInt16 nSlotId = SfxItemPool::IsWhich(nWhich) + ? GetPool().GetSlotId(nWhich) + : nWhich; + switch ( nSlotId ) + { + case SID_TABLE_VERT_NONE: + case SID_TABLE_VERT_CENTER: + case SID_TABLE_VERT_BOTTOM: + sal_Bool bContour = sal_False; + SfxItemState eConState = aAttrs.GetItemState( SDRATTR_TEXT_CONTOURFRAME ); + if( eConState != SFX_ITEM_DONTCARE ) + { + bContour = ( ( const SdrTextContourFrameItem& )aAttrs.Get( SDRATTR_TEXT_CONTOURFRAME ) ).GetValue(); + } + if (bContour) break; + + SfxItemState eVState = aAttrs.GetItemState( SDRATTR_TEXT_VERTADJUST ); + //SfxItemState eHState = aAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST ); + + //if(SFX_ITEM_DONTCARE != eVState && SFX_ITEM_DONTCARE != eHState) + if(SFX_ITEM_DONTCARE != eVState) + { + SdrTextVertAdjust eTVA = (SdrTextVertAdjust)((const SdrTextVertAdjustItem&)aAttrs.Get(SDRATTR_TEXT_VERTADJUST)).GetValue(); + sal_Bool bSet = (nSlotId == SID_TABLE_VERT_NONE && eTVA == SDRTEXTVERTADJUST_TOP) || + (nSlotId == SID_TABLE_VERT_CENTER && eTVA == SDRTEXTVERTADJUST_CENTER) || + (nSlotId == SID_TABLE_VERT_BOTTOM && eTVA == SDRTEXTVERTADJUST_BOTTOM); + rSet.Put(SfxBoolItem(nSlotId, bSet)); + } + else + { + rSet.Put(SfxBoolItem(nSlotId, sal_False)); + } + break; + } + nWhich = aIter.NextWhich(); + } +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/shells/frmsh.cxx b/sw/source/ui/shells/frmsh.cxx index b7998c427046..4422916e0400 100644 --- a/sw/source/ui/shells/frmsh.cxx +++ b/sw/source/ui/shells/frmsh.cxx @@ -28,6 +28,8 @@ #include <svl/rectitem.hxx> #include <svl/ptitem.hxx> #include <svl/stritem.hxx> +#include <svl/intitem.hxx> +#include <svl/eitem.hxx> #include <editeng/colritem.hxx> #include <editeng/lineitem.hxx> #include <editeng/boxitem.hxx> @@ -35,6 +37,7 @@ #include <sfx2/dispatch.hxx> #include <sfx2/request.hxx> #include <sfx2/objface.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include <svx/hlnkitem.hxx> // #i73249# #include <svx/svdview.hxx> @@ -365,7 +368,38 @@ void SwFrameShell::Execute(SfxRequest &rReq) } } break; + + case SID_ATTR_TRANSFORM: + { + bool bApplyNewSize = false; + + Size aNewSize = aMgr.GetSize(); + if ( SFX_ITEM_SET == pArgs->GetItemState( SID_ATTR_TRANSFORM_WIDTH, sal_False, &pItem ) ) + { + aNewSize.setWidth( static_cast< const SfxUInt32Item* >(pItem)->GetValue() ); + bApplyNewSize = true; + } + + if ( SFX_ITEM_SET == pArgs->GetItemState( SID_ATTR_TRANSFORM_HEIGHT, sal_False, &pItem ) ) + { + aNewSize.setHeight( static_cast< const SfxUInt32Item* >(pItem)->GetValue() ); + bApplyNewSize = true; + } + + if ( bApplyNewSize ) + { + aMgr.SetSize( aNewSize ); + } + else + { + bUpdateMgr = sal_False; + } + + } + break; + case FN_FORMAT_FRAME_DLG: + case FN_PROPERTY_WRAP_DLG: { const int nSel = rSh.GetSelectionType(); if (nSel & nsSelectionType::SEL_GRF) @@ -449,6 +483,11 @@ void SwFrameShell::Execute(SfxRequest &rReq) nDefPage); OSL_ENSURE(pDlg, "Dialogdiet fail!"); + if ( nSlot == FN_PROPERTY_WRAP_DLG ) + { + pDlg->SetCurPageId(TP_FRM_WRAP); + } + if ( pDlg->Execute() ) { const SfxItemSet* pOutSet = pDlg->GetOutputItemSet(); @@ -615,16 +654,17 @@ void SwFrameShell::Execute(SfxRequest &rReq) OSL_ENSURE( !this, "wrong dispatcher" ); return; } - // Template AutoUpdate - SwFrmFmt* pFmt = rSh.GetCurFrmFmt(); if ( bUpdateMgr ) { - if(bCopyToFmt && pFmt && pFmt->IsAutoUpdateFmt()) + SwFrmFmt* pFmt = rSh.GetCurFrmFmt(); + if ( bCopyToFmt && pFmt && pFmt->IsAutoUpdateFmt() ) { rSh.AutoUpdateFrame(pFmt, aMgr.GetAttrSet()); } else + { aMgr.UpdateFlyFrm(); + } } } @@ -834,6 +874,40 @@ void SwFrameShell::GetState(SfxItemSet& rSet) if ( bParentCntProt ) rSet.DisableItem( nWhich ); break; + + case SID_ATTR_TRANSFORM: + { + rSet.DisableItem( nWhich ); + } + break; + + case SID_ATTR_TRANSFORM_PROTECT_SIZE: + { + const sal_uInt8 eProtection = rSh.IsSelObjProtected( FLYPROTECT_SIZE ); + if ( ( eProtection & FLYPROTECT_CONTENT ) || + ( eProtection & FLYPROTECT_SIZE ) ) + { + rSet.Put( SfxBoolItem( SID_ATTR_TRANSFORM_PROTECT_SIZE, sal_True ) ); + } + else + { + rSet.Put( SfxBoolItem( SID_ATTR_TRANSFORM_PROTECT_SIZE, sal_False ) ); + } + } + break; + + case SID_ATTR_TRANSFORM_WIDTH: + { + rSet.Put( SfxUInt32Item( SID_ATTR_TRANSFORM_WIDTH, aMgr.GetSize().getWidth() ) ); + } + break; + + case SID_ATTR_TRANSFORM_HEIGHT: + { + rSet.Put( SfxUInt32Item( SID_ATTR_TRANSFORM_HEIGHT, aMgr.GetSize().getHeight() ) ); + } + break; + case FN_FORMAT_FRAME_DLG: { const int nSel = rSh.GetSelectionType(); @@ -854,6 +928,7 @@ void SwFrameShell::GetState(SfxItemSet& rSet) } break; + default: /* do nothing */; break; @@ -871,6 +946,8 @@ SwFrameShell::SwFrameShell(SwView &_rView) : // #96392# Use this to announce it is the frame shell who creates the selection. SwTransferable::CreateSelection( _rView.GetWrtShell(), (ViewShell *) this ); + + SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Frame)); } SwFrameShell::~SwFrameShell() diff --git a/sw/source/ui/shells/grfsh.cxx b/sw/source/ui/shells/grfsh.cxx index d1dc7c49f2db..585b8fd29ba3 100644 --- a/sw/source/ui/shells/grfsh.cxx +++ b/sw/source/ui/shells/grfsh.cxx @@ -31,6 +31,7 @@ #include <editeng/sizeitem.hxx> #include <editeng/protitem.hxx> #include <sfx2/request.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include <svl/srchitem.hxx> #include <sfx2/htmlmode.hxx> #include <svx/sdgluitm.hxx> @@ -178,6 +179,7 @@ void SwGrfShell::Execute(SfxRequest &rReq) break; case SID_INSERT_GRAPHIC: case FN_FORMAT_GRAFIC_DLG: + case FN_PROPERTY_WRAP_DLG: { SwFlyFrmAttrMgr aMgr( sal_False, &rSh, rSh.IsFrmSelected() ? FRMMGR_TYPE_NONE : FRMMGR_TYPE_GRF); @@ -291,6 +293,10 @@ void SwGrfShell::Execute(SfxRequest &rReq) GetView().GetWindow(), aSet, sal_False, DLG_FRM_GRF); OSL_ENSURE(pDlg, "Dialogdiet fail!"); + + if (nSlot == FN_PROPERTY_WRAP_DLG) + pDlg->SetCurPageId(TP_FRM_WRAP); + if( pDlg->Execute() ) { rSh.StartAllAction(); @@ -438,12 +444,14 @@ void SwGrfShell::ExecAttr( SfxRequest &rReq ) { case FN_FLIP_VERT_GRAFIC: case FN_FLIP_HORZ_GRAFIC: + case SID_FLIP_VERTICAL: + case SID_FLIP_HORIZONTAL: { GetShell().GetCurAttr( aGrfSet ); SwMirrorGrf aMirror( (SwMirrorGrf&)aGrfSet.Get( RES_GRFATR_MIRRORGRF ) ); sal_uInt16 nMirror = aMirror.GetValue(); - if( FN_FLIP_VERT_GRAFIC == nSlot ) + if( FN_FLIP_VERT_GRAFIC == nSlot || nSlot==SID_FLIP_VERTICAL ) switch( nMirror ) { case RES_MIRROR_GRAPH_DONT: nMirror = RES_MIRROR_GRAPH_VERT; @@ -816,6 +824,7 @@ SwGrfShell::SwGrfShell(SwView &_rView) : { SetName(OUString("Graphic")); SetHelpId(SW_GRFSHELL); + SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Graphic)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/shells/mediash.cxx b/sw/source/ui/shells/mediash.cxx index 047c9ba976ca..3bb0c31e0d30 100644 --- a/sw/source/ui/shells/mediash.cxx +++ b/sw/source/ui/shells/mediash.cxx @@ -58,6 +58,7 @@ #include <popup.hrc> #include <sfx2/objface.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include <svx/svdomedia.hxx> #include <svx/sdr/contact/viewcontactofsdrmediaobj.hxx> #include <avmedia/mediaitem.hxx> @@ -192,6 +193,7 @@ SwMediaShell::SwMediaShell(SwView &_rView) : { SetName(OUString("Media Playback")); SetHelpId(SW_MEDIASHELL); + SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Media)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/shells/olesh.cxx b/sw/source/ui/shells/olesh.cxx index b155637d92f5..b4f32cec4a81 100644 --- a/sw/source/ui/shells/olesh.cxx +++ b/sw/source/ui/shells/olesh.cxx @@ -21,6 +21,7 @@ #include <sfx2/request.hxx> #include <sfx2/objface.hxx> #include <sfx2/objitem.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include <wrtsh.hxx> #include <view.hxx> #include <helpid.h> @@ -51,7 +52,7 @@ SwOleShell::SwOleShell(SwView &_rView) : { SetName(OUString("Object")); SetHelpId(SW_OLESHELL); + SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_OLE)); } - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/shells/slotadd.cxx b/sw/source/ui/shells/slotadd.cxx index b05002af8604..41f7825e182b 100644 --- a/sw/source/ui/shells/slotadd.cxx +++ b/sw/source/ui/shells/slotadd.cxx @@ -127,6 +127,11 @@ #define SvxDrawAlignItem SfxAllEnumItem #define avmedia_MediaItem ::avmedia::MediaItem +#include <svx/xflftrit.hxx> +#include <svx/xlncapit.hxx> +#include <svx/xlinjoit.hxx> +#include <svx/AffineMatrixItem.hxx> + #define SFX_TYPEMAP #include <sfx2/msg.hxx> #include "swslots.hxx" diff --git a/sw/source/ui/shells/tabsh.cxx b/sw/source/ui/shells/tabsh.cxx index 8a35591f6013..b5d24e811c86 100644 --- a/sw/source/ui/shells/tabsh.cxx +++ b/sw/source/ui/shells/tabsh.cxx @@ -44,6 +44,7 @@ #include <sfx2/request.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/objface.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include <fmtornt.hxx> #include <fmtclds.hxx> @@ -1095,13 +1096,13 @@ void SwTableShell::Execute(SfxRequest &rReq) aMgr.ColWidthDlg(GetView().GetWindow()); } break; - case FN_TABLE_VERT_NONE: - case FN_TABLE_VERT_CENTER: - case FN_TABLE_VERT_BOTTOM: + case SID_TABLE_VERT_NONE: + case SID_TABLE_VERT_CENTER: + case SID_TABLE_VERT_BOTTOM: { - sal_uInt16 nAlign = nSlot == FN_TABLE_VERT_NONE ? + sal_uInt16 nAlign = nSlot == SID_TABLE_VERT_NONE ? text::VertOrientation::NONE : - nSlot == FN_TABLE_VERT_CENTER ? + nSlot == SID_TABLE_VERT_CENTER ? text::VertOrientation::CENTER : text::VertOrientation::BOTTOM; rSh.SetBoxAlign(nAlign); bCallDone = true; @@ -1234,14 +1235,15 @@ void SwTableShell::GetState(SfxItemSet &rSet) case RES_UL_SPACE: rSet.Put(pFmt->GetULSpace()); break; - case FN_TABLE_VERT_NONE: - case FN_TABLE_VERT_CENTER: - case FN_TABLE_VERT_BOTTOM: + + case SID_TABLE_VERT_NONE: + case SID_TABLE_VERT_CENTER: + case SID_TABLE_VERT_BOTTOM: { sal_uInt16 nAlign = rSh.GetBoxAlign(); - sal_Bool bSet = (nSlot == FN_TABLE_VERT_NONE && nAlign == text::VertOrientation::NONE) || - (nSlot == FN_TABLE_VERT_CENTER && nAlign == text::VertOrientation::CENTER) || - (nSlot == FN_TABLE_VERT_BOTTOM && nAlign == text::VertOrientation::BOTTOM); + sal_Bool bSet = nSlot == (SID_TABLE_VERT_NONE && nAlign == text::VertOrientation::NONE) || + (nSlot == SID_TABLE_VERT_CENTER && nAlign == text::VertOrientation::CENTER) || + (nSlot == SID_TABLE_VERT_BOTTOM && nAlign == text::VertOrientation::BOTTOM); rSet.Put(SfxBoolItem(nSlot, bSet)); } break; @@ -1342,6 +1344,7 @@ SwTableShell::SwTableShell(SwView &_rView) : { SetName(OUString("Table")); SetHelpId(SW_TABSHELL); + SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Table)); } void SwTableShell::GetFrmBorderState(SfxItemSet &rSet) diff --git a/sw/source/ui/shells/textsh.cxx b/sw/source/ui/shells/textsh.cxx index 6aa8ee576e98..62907a448c45 100644 --- a/sw/source/ui/shells/textsh.cxx +++ b/sw/source/ui/shells/textsh.cxx @@ -97,6 +97,7 @@ #define SwTextShell #include <sfx2/msg.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include <swslots.hxx> #include <SwRewriter.hxx> #include <comcore.hrc> @@ -913,6 +914,7 @@ SwTextShell::SwTextShell(SwView &_rView) : { SetName(OUString("Text")); SetHelpId(SW_TEXTSHELL); + SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Text)); } SwTextShell::~SwTextShell() diff --git a/sw/source/ui/shells/textsh1.cxx b/sw/source/ui/shells/textsh1.cxx index ce79e21c5501..25976e97841b 100644 --- a/sw/source/ui/shells/textsh1.cxx +++ b/sw/source/ui/shells/textsh1.cxx @@ -116,7 +116,19 @@ #include <wordcountdialog.hxx> #include <tools/diagnose_ex.h> +#ifndef _NBDTMGFACT_HXX +#include <svx/nbdtmgfact.hxx> +#endif +#ifndef _NBDTMG_HXX +#include <svx/nbdtmg.hxx> +#endif + + +#include <numrule.hxx> + + using namespace ::com::sun::star; +using namespace svx::sidebar; void sw_CharDialog( SwWrtShell &rWrtSh, bool bUseDialog, sal_uInt16 nSlot,const SfxItemSet *pArgs, SfxRequest *pReq ) { @@ -174,6 +186,10 @@ void sw_CharDialog( SwWrtShell &rWrtSh, bool bUseDialog, sal_uInt16 nSlot,const if( FN_INSERT_HYPERLINK == nSlot ) pDlg->SetCurPageId("hyperlink"); } + if (nSlot == SID_CHAR_DLG_EFFECT) + { + pDlg->SetCurPageId(TP_CHAR_EXT); + } const SfxItemSet* pSet = NULL; if ( !bUseDialog ) @@ -818,6 +834,7 @@ void SwTextShell::Execute(SfxRequest &rReq) // intentionally no break } case SID_CHAR_DLG: + case SID_CHAR_DLG_EFFECT: { sw_CharDialog( rWrtSh, bUseDialog, nSlot, pArgs, &rReq ); } @@ -842,6 +859,7 @@ void SwTextShell::Execute(SfxRequest &rReq) case FN_NUMBER_NEWSTART_AT : case FN_FORMAT_DROPCAPS : case FN_DROP_TEXT: + case SID_ATTR_PARA_LRSPACE: { sal_uInt16 nWhich = GetPool().GetWhich( nSlot ); if ( pArgs && pArgs->GetItemState( nWhich ) == SFX_ITEM_SET ) @@ -944,7 +962,15 @@ void SwTextShell::Execute(SfxRequest &rReq) SfxItemSet* pSet = NULL; if ( !bUseDialog ) { - pSet = (SfxItemSet*) pArgs; + if ( nSlot == SID_ATTR_PARA_LRSPACE) + { + SvxLRSpaceItem aParaMargin((const SvxLRSpaceItem&)pArgs->Get(nSlot)); + aParaMargin.SetWhich( RES_LR_SPACE); + aCoreSet.Put(aParaMargin); + pSet = &aCoreSet; + + } else + pSet = (SfxItemSet*) pArgs; } else if ( NULL != pDlg && pDlg->Execute() == RET_OK ) @@ -1012,14 +1038,14 @@ void SwTextShell::Execute(SfxRequest &rReq) //SetNumRuleStart(sal_True) restarts the numbering at the value //that is defined at the starting point of the numbering level //otherwise the SetNodeNumStart() value determines the start - //if it's set to something different than USHRT_MAX + //if it's set to something different than (sal_uInt16)0xFFFF sal_Bool bStart = ((SfxBoolItem&)pSet->Get(FN_NUMBER_NEWSTART)).GetValue(); - // - // Default value for restart value has to be USHRT_MAX + + // Default value for restart value has to be (sal_uInt16)0xFFFF // in order to indicate that the restart value of the list // style has to be used on restart. - sal_uInt16 nNumStart = USHRT_MAX; + sal_uInt16 nNumStart = (sal_uInt16)0xFFFF; if( SFX_ITEM_SET == pSet->GetItemState(FN_NUMBER_NEWSTART_AT) ) { nNumStart = ((SfxUInt16Item&)pSet->Get(FN_NUMBER_NEWSTART_AT)).GetValue(); @@ -1609,6 +1635,51 @@ void SwTextShell::GetState( SfxItemSet &rSet ) rSet.DisableItem(nWhich); } break; + case FN_NUM_NUMBERING_ON: + rSet.Put(SfxBoolItem(FN_NUM_NUMBERING_ON,rSh.SelectionHasNumber())); + break; + case FN_NUM_BULLET_ON: + rSet.Put(SfxBoolItem(FN_NUM_BULLET_ON,rSh.SelectionHasBullet())); + break; + case FN_BUL_NUM_RULE_INDEX: + case FN_NUM_NUM_RULE_INDEX: + { + SwNumRule* pCurRule = (SwNumRule*)(GetShell().GetCurNumRule()); + sal_uInt16 nActNumLvl = (sal_uInt16)0xFFFF; + rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,DEFAULT_NONE)); + rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,DEFAULT_NONE)); + if( pCurRule ) + { + nActNumLvl = GetShell().GetNumLevel(); + if( nActNumLvl < MAXLEVEL ) + { + nActNumLvl = 1<<nActNumLvl; + } + SvxNumRule aSvxRule = pCurRule->MakeSvxNumRule(); + if ( GetShell().HasBullet()) + { + rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,(sal_uInt16)0xFFFF)); + rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,(sal_uInt16)0xFFFF)); + NBOTypeMgrBase* pBullets = NBOutlineTypeMgrFact::CreateInstance(eNBOType::MIXBULLETS); + if ( pBullets ) + { + sal_uInt16 nBulIndex = pBullets->GetNBOIndexForNumRule(aSvxRule,nActNumLvl); + rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,nBulIndex)); + } + }else if ( GetShell().HasNumber() ) + { + rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,(sal_uInt16)0xFFFF)); + rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,(sal_uInt16)0xFFFF)); + NBOTypeMgrBase* pNumbering = NBOutlineTypeMgrFact::CreateInstance(eNBOType::NUMBERING); + if ( pNumbering ) + { + sal_uInt16 nBulIndex = pNumbering->GetNBOIndexForNumRule(aSvxRule,nActNumLvl); + rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,nBulIndex)); + } + } + } + } + break; case FN_NUM_CONTINUE: { { diff --git a/sw/source/ui/shells/txtattr.cxx b/sw/source/ui/shells/txtattr.cxx index 46595077172b..45f8e37d453e 100644 --- a/sw/source/ui/shells/txtattr.cxx +++ b/sw/source/ui/shells/txtattr.cxx @@ -30,6 +30,7 @@ #include <editeng/fhgtitem.hxx> #include <editeng/adjustitem.hxx> #include <editeng/lspcitem.hxx> +#include <editeng/lrspitem.hxx> #include <editeng/udlnitem.hxx> #include <editeng/escapementitem.hxx> #include <sfx2/htmlmode.hxx> @@ -638,6 +639,19 @@ void SwTextShell::GetAttrState(SfxItemSet &rSet) rSet.Put(SvxAdjustItem((SvxAdjust)eAdjust, SID_ATTR_PARA_ADJUST )); nSlot = 0; break; + case SID_ATTR_PARA_LRSPACE: + { + eState = aCoreSet.GetItemState(RES_LR_SPACE); + if( eState >= SFX_ITEM_DEFAULT ) + { + SvxLRSpaceItem aLR = ( (const SvxLRSpaceItem&) aCoreSet.Get( RES_LR_SPACE ) ); + aLR.SetWhich(SID_ATTR_PARA_LRSPACE); + rSet.Put(aLR); + } + else + rSet.InvalidateItem(nSlot); + nSlot = 0; + } case SID_ATTR_PARA_LEFT_TO_RIGHT : case SID_ATTR_PARA_RIGHT_TO_LEFT : diff --git a/sw/source/ui/shells/txtnum.cxx b/sw/source/ui/shells/txtnum.cxx index a9ef38022d16..f55e3f22fdaf 100644 --- a/sw/source/ui/shells/txtnum.cxx +++ b/sw/source/ui/shells/txtnum.cxx @@ -36,6 +36,11 @@ #include "swabstdlg.hxx" #include <globals.hrc> #include <sfx2/tabdlg.hxx> +#include <svx/nbdtmg.hxx> +#include <svx/nbdtmgfact.hxx> +#include <sfx2/viewfrm.hxx> +#include <sfx2/bindings.hxx> +using namespace svx::sidebar; void SwTextShell::ExecEnterNum(SfxRequest &rReq) { @@ -44,14 +49,15 @@ void SwTextShell::ExecEnterNum(SfxRequest &rReq) { case FN_NUM_NUMBERING_ON: { + GetShell().StartAllAction(); SFX_REQUEST_ARG( rReq, pItem, SfxBoolItem, FN_PARAM_1 , sal_False ); - sal_Bool bMode = !GetShell().HasNumber(); // #i29560# + sal_Bool bMode = !GetShell().SelectionHasNumber(); // #i29560# if ( pItem ) bMode = pItem->GetValue(); else rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bMode ) ); - if ( bMode != (GetShell().HasNumber()) ) // #i29560# + if ( bMode != (GetShell().SelectionHasNumber()) ) // #i29560# { rReq.Done(); if( bMode ) @@ -59,18 +65,28 @@ void SwTextShell::ExecEnterNum(SfxRequest &rReq) else GetShell().NumOrBulletOff(); // #i29560# } + sal_Bool bNewResult = GetShell().SelectionHasNumber(); + if (bNewResult!=bMode) { + SfxBindings& rBindings = GetView().GetViewFrame()->GetBindings(); + SfxBoolItem aItem(FN_NUM_NUMBERING_ON,!bNewResult); + rBindings.SetState(aItem); + SfxBoolItem aNewItem(FN_NUM_NUMBERING_ON,bNewResult); + rBindings.SetState(aNewItem); + } + GetShell().EndAllAction(); } break; case FN_NUM_BULLET_ON: { + GetShell().StartAllAction(); SFX_REQUEST_ARG( rReq, pItem, SfxBoolItem, FN_PARAM_1 , sal_False ); - sal_Bool bMode = !GetShell().HasBullet(); // #i29560# + sal_Bool bMode = !GetShell().SelectionHasBullet(); // #i29560# if ( pItem ) bMode = pItem->GetValue(); else rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bMode ) ); - if ( bMode != (GetShell().HasBullet()) ) // #i29560# + if ( bMode != (GetShell().SelectionHasBullet()) ) // #i29560# { rReq.Done(); if( bMode ) @@ -78,9 +94,19 @@ void SwTextShell::ExecEnterNum(SfxRequest &rReq) else GetShell().NumOrBulletOff(); // #i29560# } + sal_Bool bNewResult = GetShell().SelectionHasBullet(); + if (bNewResult!=bMode) { + SfxBindings& rBindings = GetView().GetViewFrame()->GetBindings(); + SfxBoolItem aItem(FN_NUM_BULLET_ON,!bNewResult); + rBindings.SetState(aItem); + SfxBoolItem aNewItem(FN_NUM_BULLET_ON,bNewResult); + rBindings.SetState(aNewItem); + } + GetShell().EndAllAction(); } break; case FN_NUMBER_BULLETS: + case SID_OUTLINE_BULLET: { SfxItemSet aSet(GetPool(), SID_HTML_MODE, SID_HTML_MODE, @@ -213,4 +239,179 @@ void SwTextShell::ExecEnterNum(SfxRequest &rReq) } } +void SwTextShell::ExecSetNumber(SfxRequest &rReq) +{ + SwNumRule aRule( GetShell().GetUniqueNumRuleName(), + // #i89178# + numfunc::GetDefaultPositionAndSpaceMode() ); + + SvxNumRule aSvxRule = aRule.MakeSvxNumRule(); + const bool bRightToLeft = GetShell().IsInRightToLeftText( 0 ); + + if( bRightToLeft ) + { + for( sal_uInt8 n = 0; n < MAXLEVEL; ++n ) + { + SvxNumberFormat aFmt( aSvxRule.GetLevel( n ) ); + /* if ( n && bHtml ) + { + // 1/2" for HTML + aFmt.SetLSpace(720); + aFmt.SetAbsLSpace(n * 720); + }*/ + // #i38904# Default alignment for + // numbering/bullet should be rtl in rtl paragraph: + if ( bRightToLeft ) + { + aFmt.SetNumAdjust( SVX_ADJUST_RIGHT ); + } + aSvxRule.SetLevel( n, aFmt, sal_False ); + } + aSvxRule.SetFeatureFlag(NUM_ENABLE_EMBEDDED_BMP, sal_False); + } + + const SwNumRule* pCurRule = GetShell().GetCurNumRule(); + sal_uInt16 nActNumLvl = (sal_uInt16)0xFFFF; + if( pCurRule ) + { + sal_uInt16 nLevel = GetShell().GetNumLevel(); + if( nLevel < MAXLEVEL ) + { + nActNumLvl = 1<<nLevel; + } + + aSvxRule = pCurRule->MakeSvxNumRule(); + + //convert type of linked bitmaps from SVX_NUM_BITMAP to (SVX_NUM_BITMAP|LINK_TOKEN) + for(sal_uInt16 i = 0; i < aSvxRule.GetLevelCount(); i++) + { + SvxNumberFormat aFmt(aSvxRule.GetLevel(i)); + if(SVX_NUM_BITMAP == aFmt.GetNumberingType()) + { + const SvxBrushItem* pBrush = aFmt.GetBrush(); + const String* pLinkStr; + if(pBrush && + 0 != (pLinkStr = pBrush->GetGraphicLink()) && + pLinkStr->Len()) + aFmt.SetNumberingType(SvxExtNumType(SVX_NUM_BITMAP|LINK_TOKEN)); + aSvxRule.SetLevel(i, aFmt, aSvxRule.Get(i) != 0); + } + } + } + + + switch(rReq.GetSlot()) + { + case FN_SVX_SET_NUMBER: + { + SFX_REQUEST_ARG( rReq, pItem, SfxUInt16Item, FN_SVX_SET_NUMBER , sal_False ); + if (pItem) + { + sal_uInt16 nIdx = pItem->GetValue(); + if (nIdx==DEFAULT_NONE) { + GetShell().DelNumRules(); + break; + } + --nIdx; + + NBOTypeMgrBase* pNumbering = NBOutlineTypeMgrFact::CreateInstance(eNBOType::NUMBERING); + if ( pNumbering ) + { + SwNumRule aTmpRule( GetShell().GetUniqueNumRuleName(), + numfunc::GetDefaultPositionAndSpaceMode() ); + + SvxNumRule aTempRule = aTmpRule.MakeSvxNumRule(); + //Sym3_2508, set unit attribute to NB Manager + SfxItemSet aSet(GetPool(), + SID_ATTR_NUMBERING_RULE, SID_PARAM_CUR_NUM_LEVEL, + 0 ); + aSet.Put(SvxNumBulletItem(aTempRule)); + pNumbering->SetItems(&aSet); + pNumbering->ApplyNumRule(aTempRule,nIdx,nActNumLvl); + + sal_uInt16 nMask = 1; + for(sal_uInt16 i = 0; i < aSvxRule.GetLevelCount(); i++) + { + if(nActNumLvl & nMask) + { + SvxNumberFormat aFmt(aTempRule.GetLevel(i)); + aSvxRule.SetLevel(i, aFmt); + } + nMask <<= 1 ; + } + + aSvxRule.UnLinkGraphics(); + SwNumRule aSetRule( pCurRule + ? pCurRule->GetName() + : GetShell().GetUniqueNumRuleName(), + numfunc::GetDefaultPositionAndSpaceMode() ); + aSetRule.SetSvxRule( aSvxRule, GetShell().GetDoc()); + + aSetRule.SetAutoRule( sal_True ); + const bool bCreateList = (pCurRule == 0); + GetShell().SetCurNumRule( aSetRule, bCreateList ); + } + //End + } + break; + } + case FN_SVX_SET_BULLET: + { + SFX_REQUEST_ARG( rReq, pItem, SfxUInt16Item, FN_SVX_SET_BULLET , sal_False ); + if (pItem) + { + sal_uInt16 nIdx = pItem->GetValue(); + if (nIdx==DEFAULT_NONE) { + GetShell().DelNumRules(); + break; + } + nIdx--; + + NBOTypeMgrBase* pBullets = NBOutlineTypeMgrFact::CreateInstance(eNBOType::MIXBULLETS); + if ( pBullets ) + { + SwNumRule aTmpRule( GetShell().GetUniqueNumRuleName(), + numfunc::GetDefaultPositionAndSpaceMode() ); + + SvxNumRule aTempRule = aTmpRule.MakeSvxNumRule(); + //Sym3_2508, set unit attribute to NB Manager + SfxItemSet aSet(GetPool(), + SID_ATTR_NUMBERING_RULE, SID_PARAM_CUR_NUM_LEVEL, + 0 ); + aSet.Put(SvxNumBulletItem(aTempRule)); + pBullets->SetItems(&aSet); + + //SvxNumRule aTempRule( 0, 10, false ); + pBullets->ApplyNumRule(aTempRule,nIdx,nActNumLvl); + sal_uInt16 nMask = 1; + for(sal_uInt16 i = 0; i < aSvxRule.GetLevelCount(); i++) + { + if(nActNumLvl & nMask) + { + SvxNumberFormat aFmt(aTempRule.GetLevel(i)); + aSvxRule.SetLevel(i, aFmt); + } + nMask <<= 1; + } + aSvxRule.UnLinkGraphics(); + + SwNumRule aSetRule( pCurRule + ? pCurRule->GetName() + : GetShell().GetUniqueNumRuleName(), + numfunc::GetDefaultPositionAndSpaceMode() ); + + aSetRule.SetSvxRule( aSvxRule, GetShell().GetDoc()); + + aSetRule.SetAutoRule( sal_True ); + const bool bCreateList = (pCurRule == 0); + GetShell().SetCurNumRule( aSetRule, bCreateList ); + } + //End + } + + } + break; + } +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/sidebar/PageColumnControl.cxx b/sw/source/ui/sidebar/PageColumnControl.cxx new file mode 100644 index 000000000000..8c3643ebed8a --- /dev/null +++ b/sw/source/ui/sidebar/PageColumnControl.cxx @@ -0,0 +1,110 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "PageColumnControl.hxx" +#include "PagePropertyPanel.hxx" +#include "PagePropertyPanel.hrc" + +#include <cmdid.h> +#include <swtypes.hxx> + +#include <svx/sidebar/ValueSetWithTextControl.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> + +namespace sw { namespace sidebar { + +PageColumnControl::PageColumnControl( + Window* pParent, + PagePropertyPanel& rPanel, + const sal_uInt16 nColumnType, + const bool bLandscape ) + : ::svx::sidebar::PopupControl( pParent, SW_RES(RID_POPUP_SWPAGE_COLUMN) ) + , mpColumnValueSet( new ::svx::sidebar::ValueSetWithTextControl( ::svx::sidebar::ValueSetWithTextControl::IMAGE_TEXT, this, SW_RES(VS_COLUMN) ) ) + , maMoreButton( this, SW_RES(CB_COLUMN_MORE) ) + , mnColumnType( nColumnType ) + , mrPagePropPanel(rPanel) +{ + mpColumnValueSet->SetStyle( mpColumnValueSet->GetStyle() | WB_3DLOOK | WB_NO_DIRECTSELECT ); + mpColumnValueSet->SetColor(GetSettings().GetStyleSettings().GetMenuColor()); + + if ( bLandscape ) + { + mpColumnValueSet->AddItem( SW_RES(IMG_ONE_L), 0, SW_RES(STR_ONE), 0 ); + mpColumnValueSet->AddItem( SW_RES(IMG_TWO_L), 0, SW_RES(STR_TWO), 0 ); + mpColumnValueSet->AddItem( SW_RES(IMG_THREE_L), 0, SW_RES(STR_THREE), 0 ); + mpColumnValueSet->AddItem( SW_RES(IMG_LEFT_L), 0, SW_RES(STR_LEFT), 0 ); + mpColumnValueSet->AddItem( SW_RES(IMG_RIGHT_L), 0, SW_RES(STR_RIGHT), 0 ); + } + else + { + mpColumnValueSet->AddItem( SW_RES(IMG_ONE), 0, SW_RES(STR_ONE), 0 ); + mpColumnValueSet->AddItem( SW_RES(IMG_TWO), 0, SW_RES(STR_TWO), 0 ); + mpColumnValueSet->AddItem( SW_RES(IMG_THREE), 0, SW_RES(STR_THREE), 0 ); + mpColumnValueSet->AddItem( SW_RES(IMG_LEFT), 0, SW_RES(STR_LEFT), 0 ); + mpColumnValueSet->AddItem( SW_RES(IMG_RIGHT), 0, SW_RES(STR_RIGHT), 0 ); + } + + mpColumnValueSet->SetNoSelection(); + mpColumnValueSet->SetSelectHdl( LINK(this, PageColumnControl,ImplColumnHdl ) ); + mpColumnValueSet->Show(); + mpColumnValueSet->SelectItem( mnColumnType ); + mpColumnValueSet->Format(); + mpColumnValueSet->StartSelection(); + + maMoreButton.SetClickHdl( LINK( this, PageColumnControl, MoreButtonClickHdl_Impl ) ); + maMoreButton.GrabFocus(); + + FreeResource(); +} + + +PageColumnControl::~PageColumnControl(void) +{ + delete mpColumnValueSet; +} + + +IMPL_LINK(PageColumnControl, ImplColumnHdl, void *, pControl) +{ + mpColumnValueSet->SetNoSelection(); + if ( pControl == mpColumnValueSet ) + { + const sal_uInt32 nColumnType = mpColumnValueSet->GetSelectItemId(); + if ( nColumnType != mnColumnType ) + { + mnColumnType = nColumnType; + mrPagePropPanel.ExecuteColumnChange( mnColumnType ); + } + } + + mrPagePropPanel.ClosePageColumnPopup(); + return 0; +} + +IMPL_LINK(PageColumnControl, MoreButtonClickHdl_Impl, void *, EMPTYARG) +{ + mrPagePropPanel.GetBindings()->GetDispatcher()->Execute( FN_FORMAT_PAGE_COLUMN_DLG, SFX_CALLMODE_ASYNCHRON ); + + mrPagePropPanel.ClosePageColumnPopup(); + return 0; +} + + +} } // end of namespace sw::sidebar + diff --git a/sw/source/ui/sidebar/PageColumnControl.hxx b/sw/source/ui/sidebar/PageColumnControl.hxx new file mode 100644 index 000000000000..0208a92a4b70 --- /dev/null +++ b/sw/source/ui/sidebar/PageColumnControl.hxx @@ -0,0 +1,63 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SW_SIDEBAR_PAGE_COLUMN_CONTROL_HXX_ +#define _SW_SIDEBAR_PAGE_COLUMN_CONTROL_HXX_ + +#include <svx/sidebar/PopupControl.hxx> + +#include <vcl/image.hxx> +#include <vcl/button.hxx> + +#include <vector> + +namespace svx { namespace sidebar { + class ValueSetWithTextControl; +} } + +namespace sw { namespace sidebar { + +class PagePropertyPanel; + + +class PageColumnControl + : public ::svx::sidebar::PopupControl +{ +public: + PageColumnControl( + Window* pParent, + PagePropertyPanel& rPanel, + const sal_uInt16 nColumnType, + const bool bLandscape ); + + ~PageColumnControl(void); + +private: + ::svx::sidebar::ValueSetWithTextControl* mpColumnValueSet; + PushButton maMoreButton; + + sal_uInt16 mnColumnType; + + PagePropertyPanel& mrPagePropPanel; + + DECL_LINK(ImplColumnHdl, void*); + DECL_LINK(MoreButtonClickHdl_Impl, void*); +}; + +} } // end of namespace sw::sidebar + +#endif diff --git a/sw/source/ui/sidebar/PageMarginControl.cxx b/sw/source/ui/sidebar/PageMarginControl.cxx new file mode 100644 index 000000000000..6bbc4b7c46d1 --- /dev/null +++ b/sw/source/ui/sidebar/PageMarginControl.cxx @@ -0,0 +1,518 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "PageMarginControl.hxx" +#include "PagePropertyPanel.hxx" +#include "PagePropertyPanel.hrc" + +#include <swtypes.hxx> + +#include <svx/sidebar/ValueSetWithTextControl.hxx> + +#define SWPAGE_LEFT_GVALUE String("Sw_Page_Left", 12, RTL_TEXTENCODING_ASCII_US) +#define SWPAGE_RIGHT_GVALUE String("Sw_Page_Right", 13, RTL_TEXTENCODING_ASCII_US) +#define SWPAGE_TOP_GVALUE String("Sw_Page_Top", 11, RTL_TEXTENCODING_ASCII_US) +#define SWPAGE_DOWN_GVALUE String("Sw_Page_Down", 12, RTL_TEXTENCODING_ASCII_US) +#define SWPAGE_MIRROR_GVALUE String("Sw_Page_Mirrored", 16, RTL_TEXTENCODING_ASCII_US) + + +namespace sw { namespace sidebar { + +PageMarginControl::PageMarginControl( + Window* pParent, + PagePropertyPanel& rPanel, + const SvxLongLRSpaceItem& aPageLRMargin, + const SvxLongULSpaceItem& aPageULMargin, + const bool bMirrored, + const Size aPageSize, + const sal_Bool bLandscape, + const FieldUnit eFUnit, + const SfxMapUnit eUnit ) + : ::svx::sidebar::PopupControl( pParent, SW_RES(RID_POPUP_SWPAGE_MARGIN) ) + , mpMarginValueSet( new ::svx::sidebar::ValueSetWithTextControl( ::svx::sidebar::ValueSetWithTextControl::IMAGE_TEXT, this, SW_RES(VS_MARGIN) ) ) + , maCustom(this, SW_RES(FT_CUSTOM)) + , maLeft(this, SW_RES(FT_LEFT)) + , maInner(this, SW_RES(FT_INNER)) + , maLeftMarginEdit(this, SW_RES(MF_SWLEFT_MARGIN)) + , maRight(this, SW_RES(FT_RIGHT)) + , maOuter(this, SW_RES(FT_OUTER)) + , maRightMarginEdit(this, SW_RES(MF_SWRIGHT_MARGIN)) + , maTop(this, SW_RES(FT_TOP)) + , maTopMarginEdit(this, SW_RES(MF_SWTOP_MARGIN)) + , maBottom(this, SW_RES(FT_BOTTOM)) + , maBottomMarginEdit(this, SW_RES(MF_SWBOTTOM_MARGIN)) + , maWidthHeightField( this, SW_RES(FLD_WIDTH_HEIGHT) ) + , mnPageLeftMargin( aPageLRMargin.GetLeft() ) + , mnPageRightMargin( aPageLRMargin.GetRight() ) + , mnPageTopMargin( aPageULMargin.GetUpper() ) + , mnPageBottomMargin( aPageULMargin.GetLower() ) + , mbMirrored( bMirrored ) + , meUnit( eUnit ) + , mbUserCustomValuesAvailable(false) + , mnUserCustomPageLeftMargin(0) + , mnUserCustomPageRightMargin(0) + , mnUserCustomPageTopMargin(0) + , mnUserCustomPageBottomMargin(0) + , mbUserCustomMirrored(false) + , mbCustomValuesUsed( false ) + , mrPagePropPanel(rPanel) +{ + maWidthHeightField.Hide(); + SetFieldUnit( maWidthHeightField, eFUnit ); + + mbUserCustomValuesAvailable = GetUserCustomValues(); + + mpMarginValueSet->SetStyle( mpMarginValueSet->GetStyle() | WB_3DLOOK | WB_NO_DIRECTSELECT ); + mpMarginValueSet->SetColor( GetSettings().GetStyleSettings().GetMenuColor() ); + + FillValueSet( bLandscape, mbUserCustomValuesAvailable ); + + mpMarginValueSet->SetNoSelection(); + mpMarginValueSet->SetSelectHdl( LINK(this, PageMarginControl,ImplMarginHdl ) ); + mpMarginValueSet->Show(); + + SelectValueSetItem(); + + SetFieldUnit( maLeftMarginEdit, eFUnit ); + Link aLinkLR = LINK( this, PageMarginControl, ModifyLRMarginHdl ); + maLeftMarginEdit.SetModifyHdl( aLinkLR ); + SetMetricValue( maLeftMarginEdit, mnPageLeftMargin, meUnit ); + + SetFieldUnit( maRightMarginEdit, eFUnit ); + maRightMarginEdit.SetModifyHdl( aLinkLR ); + SetMetricValue( maRightMarginEdit, mnPageRightMargin, meUnit ); + + Link aLinkUL = LINK( this, PageMarginControl, ModifyULMarginHdl ); + SetFieldUnit( maTopMarginEdit, eFUnit ); + maTopMarginEdit.SetModifyHdl( aLinkUL ); + SetMetricValue( maTopMarginEdit, mnPageTopMargin, meUnit ); + + SetFieldUnit( maBottomMarginEdit, eFUnit ); + maBottomMarginEdit.SetModifyHdl( aLinkUL ); + SetMetricValue( maBottomMarginEdit, mnPageBottomMargin, meUnit ); + + SetMetricFieldMaxValues( aPageSize ); + + if ( mbMirrored ) + { + maLeft.Hide(); + maRight.Hide(); + maInner.Show(); + maOuter.Show(); + } + else + { + maLeft.Show(); + maRight.Show(); + maInner.Hide(); + maOuter.Hide(); + } + + FreeResource(); +} + + +PageMarginControl::~PageMarginControl(void) +{ + delete mpMarginValueSet; + + StoreUserCustomValues(); +} + + +void PageMarginControl::SetMetricFieldMaxValues( const Size aPageSize ) +{ + const long nML = maLeftMarginEdit.Denormalize( maLeftMarginEdit.GetValue(FUNIT_TWIP) ); + const long nMR = maRightMarginEdit.Denormalize( maRightMarginEdit.GetValue(FUNIT_TWIP) ); + const long nMT = maTopMarginEdit.Denormalize(maTopMarginEdit.GetValue(FUNIT_TWIP) ); + const long nMB = maBottomMarginEdit.Denormalize( maBottomMarginEdit.GetValue(FUNIT_TWIP) ); + + const long nPH = LogicToLogic( aPageSize.Height(), (MapUnit)meUnit, MAP_TWIP ); + const long nPW = LogicToLogic( aPageSize.Width(), (MapUnit)meUnit, MAP_TWIP ); + + // Left + long nMax = nPW - nMR - MINBODY; + maLeftMarginEdit.SetMax(maLeftMarginEdit.Normalize(nMax), FUNIT_TWIP); + + // Right + nMax = nPW - nML - MINBODY; + maRightMarginEdit.SetMax(maRightMarginEdit.Normalize(nMax), FUNIT_TWIP); + + //Top + nMax = nPH - nMB - MINBODY; + maTopMarginEdit.SetMax(maTopMarginEdit.Normalize(nMax), FUNIT_TWIP); + + //Bottom + nMax = nPH - nMT - MINBODY; + maBottomMarginEdit.SetMax(maTopMarginEdit.Normalize(nMax), FUNIT_TWIP); +} + + +void PageMarginControl::FillValueSet( + const bool bLandscape, + const bool bUserCustomValuesAvailable ) +{ + const XubString aLeft = SW_RES(STR_MARGIN_TOOLTIP_LEFT); + const XubString aRight = SW_RES(STR_MARGIN_TOOLTIP_RIGHT); + const XubString aTop = SW_RES(STR_MARGIN_TOOLTIP_TOP); + const XubString aBottom = SW_RES(STR_MARGIN_TOOLTIP_BOT); + + SetMetricValue( maWidthHeightField, SWPAGE_NARROW_VALUE, meUnit ); + const XubString aNarrowValText = maWidthHeightField.GetText(); + XubString aHelpText = aLeft; + aHelpText += aNarrowValText; + aHelpText += aRight; + aHelpText += aNarrowValText; + aHelpText += aTop; + aHelpText += aNarrowValText; + aHelpText += aBottom; + aHelpText += aNarrowValText; + mpMarginValueSet->AddItem( + (bLandscape ? SW_RES(IMG_NARROW_L) : SW_RES(IMG_NARROW) ), 0, + SW_RES(STR_NARROW), &aHelpText ); + + SetMetricValue( maWidthHeightField, SWPAGE_NORMAL_VALUE, meUnit ); + const XubString aNormalValText = maWidthHeightField.GetText(); + aHelpText = aLeft; + aHelpText += aNormalValText; + aHelpText += aRight; + aHelpText += aNormalValText; + aHelpText += aTop; + aHelpText += aNormalValText; + aHelpText += aBottom; + aHelpText += aNormalValText; + mpMarginValueSet->AddItem( + (bLandscape ? SW_RES(IMG_NORMAL_L) : SW_RES(IMG_NORMAL) ), 0, + SW_RES(STR_NORMAL), &aHelpText ); + + SetMetricValue( maWidthHeightField, SWPAGE_WIDE_VALUE1, meUnit ); + const XubString aWide1ValText = maWidthHeightField.GetText(); + SetMetricValue( maWidthHeightField, SWPAGE_WIDE_VALUE2, meUnit ); + const XubString aWide2ValText = maWidthHeightField.GetText(); + aHelpText = aLeft; + aHelpText += aWide2ValText; + aHelpText += aRight; + aHelpText += aWide2ValText; + aHelpText += aTop; + aHelpText += aWide1ValText; + aHelpText += aBottom; + aHelpText += aWide1ValText; + mpMarginValueSet->AddItem( + (bLandscape ? SW_RES(IMG_WIDE_L) : SW_RES(IMG_WIDE) ), 0, + SW_RES(STR_WIDE), &aHelpText ); + + const XubString aInner = SW_RES(STR_MARGIN_TOOLTIP_INNER); + const XubString aOuter = SW_RES(STR_MARGIN_TOOLTIP_OUTER); + + SetMetricValue( maWidthHeightField, SWPAGE_WIDE_VALUE3, meUnit ); + const XubString aWide3ValText = maWidthHeightField.GetText(); + aHelpText = aInner; + aHelpText += aWide3ValText; + aHelpText += aOuter; + aHelpText += aWide3ValText; + aHelpText += aTop; + aHelpText += aWide1ValText; + aHelpText += aBottom; + aHelpText += aWide1ValText; + mpMarginValueSet->AddItem( + (bLandscape ? SW_RES(IMG_MIRRORED_L) : SW_RES(IMG_MIRRORED) ), 0, + SW_RES(STR_MIRRORED), &aHelpText ); + + if ( bUserCustomValuesAvailable ) + { + aHelpText = mbUserCustomMirrored ? aInner : aLeft; + SetMetricValue( maWidthHeightField, mnUserCustomPageLeftMargin, meUnit ); + aHelpText += maWidthHeightField.GetText(); + aHelpText += mbUserCustomMirrored ? aOuter : aRight; + SetMetricValue( maWidthHeightField, mnUserCustomPageRightMargin, meUnit ); + aHelpText += maWidthHeightField.GetText(); + aHelpText += aTop; + SetMetricValue( maWidthHeightField, mnUserCustomPageTopMargin, meUnit ); + aHelpText += maWidthHeightField.GetText(); + aHelpText += aBottom; + SetMetricValue( maWidthHeightField, mnUserCustomPageBottomMargin, meUnit ); + aHelpText += maWidthHeightField.GetText(); + } + else + { + aHelpText = XubString(); + } + mpMarginValueSet->AddItem( + (bUserCustomValuesAvailable ? SW_RES(IMG_CUSTOM) : SW_RES(IMG_CUSTOM_DIS) ), 0, + SW_RES(STR_LCVALUE), &aHelpText ); +} + + +void PageMarginControl::SelectValueSetItem() +{ + const long cTolerance = 5; + + if( abs(mnPageLeftMargin - SWPAGE_NARROW_VALUE) <= cTolerance && + abs(mnPageRightMargin - SWPAGE_NARROW_VALUE) <= cTolerance && + abs(mnPageTopMargin - SWPAGE_NARROW_VALUE) <= cTolerance && + abs(mnPageBottomMargin - SWPAGE_NARROW_VALUE) <= cTolerance && + !mbMirrored ) + { + mpMarginValueSet->SelectItem(1); + } + else if( abs(mnPageLeftMargin - SWPAGE_NORMAL_VALUE) <= cTolerance && + abs(mnPageRightMargin - SWPAGE_NORMAL_VALUE) <= cTolerance && + abs(mnPageTopMargin - SWPAGE_NORMAL_VALUE) <= cTolerance && + abs(mnPageBottomMargin - SWPAGE_NORMAL_VALUE) <= cTolerance && + !mbMirrored ) + { + mpMarginValueSet->SelectItem(2); + } + else if( abs(mnPageLeftMargin - SWPAGE_WIDE_VALUE2) <= cTolerance && + abs(mnPageRightMargin - SWPAGE_WIDE_VALUE2) <= cTolerance && + abs(mnPageTopMargin - SWPAGE_WIDE_VALUE1) <= cTolerance && + abs(mnPageBottomMargin - SWPAGE_WIDE_VALUE1) <= cTolerance && + !mbMirrored ) + { + mpMarginValueSet->SelectItem(3); + } + else if( abs(mnPageLeftMargin - SWPAGE_WIDE_VALUE3) <= cTolerance && + abs(mnPageRightMargin - SWPAGE_WIDE_VALUE1) <= cTolerance && + abs(mnPageTopMargin - SWPAGE_WIDE_VALUE1) <= cTolerance && + abs(mnPageBottomMargin - SWPAGE_WIDE_VALUE1) <= cTolerance && + mbMirrored ) + { + mpMarginValueSet->SelectItem(4); + } + else + { + mpMarginValueSet->SelectItem(0); + } + + mpMarginValueSet->Format(); + mpMarginValueSet->StartSelection(); +}; + + +IMPL_LINK(PageMarginControl, ImplMarginHdl, void *, pControl) +{ + if ( pControl == mpMarginValueSet ) + { + const sal_uInt16 iPos = mpMarginValueSet->GetSelectItemId(); + bool bMirrored = false; + bool bApplyNewPageMargins = true; + switch ( iPos ) + { + case 1: + mnPageLeftMargin = SWPAGE_NARROW_VALUE; + mnPageRightMargin = SWPAGE_NARROW_VALUE; + mnPageTopMargin = SWPAGE_NARROW_VALUE; + mnPageBottomMargin = SWPAGE_NARROW_VALUE; + bMirrored = false; + break; + case 2: + mnPageLeftMargin = SWPAGE_NORMAL_VALUE; + mnPageRightMargin = SWPAGE_NORMAL_VALUE; + mnPageTopMargin = SWPAGE_NORMAL_VALUE; + mnPageBottomMargin = SWPAGE_NORMAL_VALUE; + bMirrored = false; + break; + case 3: + mnPageLeftMargin = SWPAGE_WIDE_VALUE2; + mnPageRightMargin = SWPAGE_WIDE_VALUE2; + mnPageTopMargin = SWPAGE_WIDE_VALUE1; + mnPageBottomMargin = SWPAGE_WIDE_VALUE1; + bMirrored = false; + break; + case 4: + mnPageLeftMargin = SWPAGE_WIDE_VALUE3; + mnPageRightMargin = SWPAGE_WIDE_VALUE1; + mnPageTopMargin = SWPAGE_WIDE_VALUE1; + mnPageBottomMargin = SWPAGE_WIDE_VALUE1; + bMirrored = true; + break; + case 5: + if ( mbUserCustomValuesAvailable ) + { + mnPageLeftMargin = mnUserCustomPageLeftMargin; + mnPageRightMargin = mnUserCustomPageRightMargin; + mnPageTopMargin = mnUserCustomPageTopMargin; + mnPageBottomMargin = mnUserCustomPageBottomMargin; + bMirrored = mbUserCustomMirrored; + } + else + { + bApplyNewPageMargins = false; + } + break; + } + + if ( bApplyNewPageMargins ) + { + mpMarginValueSet->SetNoSelection(); + mrPagePropPanel.ExecuteMarginLRChange( mnPageLeftMargin, mnPageRightMargin ); + mrPagePropPanel.ExecuteMarginULChange( mnPageTopMargin, mnPageBottomMargin ); + if ( mbMirrored != bMirrored ) + { + mbMirrored = bMirrored; + mrPagePropPanel.ExecutePageLayoutChange( mbMirrored ); + } + + mbCustomValuesUsed = false; + mrPagePropPanel.ClosePageMarginPopup(); + } + else + { + // back to initial selection + SelectValueSetItem(); + } + } + + return 0; +} + + +IMPL_LINK( PageMarginControl, ModifyLRMarginHdl, MetricField *, EMPTYARG ) +{ + mpMarginValueSet->SetNoSelection(); + mpMarginValueSet->SelectItem(0); + mpMarginValueSet->Format(); + mpMarginValueSet->StartSelection(); + + mnPageLeftMargin = GetCoreValue( maLeftMarginEdit, meUnit ); + mnPageRightMargin = GetCoreValue( maRightMarginEdit, meUnit ); + mrPagePropPanel.ExecuteMarginLRChange( mnPageLeftMargin, mnPageRightMargin ); + mbCustomValuesUsed = true; + return 0; +} + +IMPL_LINK( PageMarginControl, ModifyULMarginHdl, MetricField *, EMPTYARG ) +{ + mpMarginValueSet->SetNoSelection(); + mpMarginValueSet->SelectItem(0); + mpMarginValueSet->Format(); + mpMarginValueSet->StartSelection(); + + mnPageTopMargin = GetCoreValue( maTopMarginEdit, meUnit ); + mnPageBottomMargin = GetCoreValue( maBottomMarginEdit, meUnit ); + mrPagePropPanel.ExecuteMarginULChange( mnPageTopMargin, mnPageBottomMargin ); + mbCustomValuesUsed = true; + return 0; +} + + +bool PageMarginControl::GetUserCustomValues() +{ + bool bUserCustomValuesAvailable = false; + + SvtViewOptions aWinOpt( E_WINDOW, SWPAGE_LEFT_GVALUE ); + 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 ); + mnUserCustomPageLeftMargin = aWinData.ToInt32(); + bUserCustomValuesAvailable = true; + } + + SvtViewOptions aWinOpt2( E_WINDOW, SWPAGE_RIGHT_GVALUE ); + 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 ); + mnUserCustomPageRightMargin = aWinData.ToInt32(); + bUserCustomValuesAvailable = true; + } + + SvtViewOptions aWinOpt3( E_WINDOW, SWPAGE_TOP_GVALUE ); + if ( aWinOpt3.Exists() ) + { + ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt3.GetUserData(); + ::rtl::OUString aTmp; + if ( aSeq.getLength()) + aSeq[0].Value >>= aTmp; + String aWinData( aTmp ); + mnUserCustomPageTopMargin = aWinData.ToInt32(); + bUserCustomValuesAvailable = true; + } + + SvtViewOptions aWinOpt4( E_WINDOW, SWPAGE_DOWN_GVALUE ); + if ( aWinOpt4.Exists() ) + { + ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt4.GetUserData(); + ::rtl::OUString aTmp; + if ( aSeq.getLength()) + aSeq[0].Value >>= aTmp; + String aWinData( aTmp ); + mnUserCustomPageBottomMargin = aWinData.ToInt32(); + bUserCustomValuesAvailable = true; + } + + SvtViewOptions aWinOpt5( E_WINDOW, SWPAGE_MIRROR_GVALUE ); + if ( aWinOpt5.Exists() ) + { + ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt5.GetUserData(); + ::rtl::OUString aTmp; + if ( aSeq.getLength()) + aSeq[0].Value >>= aTmp; + String aWinData( aTmp ); + mbUserCustomMirrored = aWinData.ToInt32() == 0 ? false : true; + bUserCustomValuesAvailable = true; + } + + return bUserCustomValuesAvailable; +} + +void PageMarginControl::StoreUserCustomValues() +{ + if ( !mbCustomValuesUsed ) + { + return; + } + + ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq(1); + SvtViewOptions aWinOpt( E_WINDOW, SWPAGE_LEFT_GVALUE ); + + aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("mnPageLeftMargin") ); + aSeq[0].Value <<= ::rtl::OUString::number( mnPageLeftMargin ); + aWinOpt.SetUserData( aSeq ); + + SvtViewOptions aWinOpt2( E_WINDOW, SWPAGE_RIGHT_GVALUE ); + aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("mnPageRightMargin") ); + aSeq[0].Value <<= ::rtl::OUString::number( mnPageRightMargin ); + aWinOpt2.SetUserData( aSeq ); + + SvtViewOptions aWinOpt3( E_WINDOW, SWPAGE_TOP_GVALUE ); + aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("mnPageTopMargin") ); + aSeq[0].Value <<= ::rtl::OUString::number( mnPageTopMargin ); + aWinOpt3.SetUserData( aSeq ); + + SvtViewOptions aWinOpt4( E_WINDOW, SWPAGE_DOWN_GVALUE ); + aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("mnPageBottomMargin") ); + aSeq[0].Value <<= ::rtl::OUString::number( mnPageBottomMargin ); + aWinOpt4.SetUserData( aSeq ); + + SvtViewOptions aWinOpt5( E_WINDOW, SWPAGE_MIRROR_GVALUE ); + aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("mbMirrored") ); + aSeq[0].Value <<= ::rtl::OUString::number( (mbMirrored ? 1 : 0) ); + aWinOpt5.SetUserData( aSeq ); +} + + +} } // end of namespace sw::sidebar + diff --git a/sw/source/ui/sidebar/PageMarginControl.hxx b/sw/source/ui/sidebar/PageMarginControl.hxx new file mode 100644 index 000000000000..1c6687c221e6 --- /dev/null +++ b/sw/source/ui/sidebar/PageMarginControl.hxx @@ -0,0 +1,120 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SW_SIDEBAR_PAGE_MARGIN_CONTROL_HXX_ +#define _SW_SIDEBAR_PAGE_MARGIN_CONTROL_HXX_ + +#include <svx/sidebar/PopupControl.hxx> + +#include <tools/fldunit.hxx> +#include <svl/poolitem.hxx> +#include <svx/rulritem.hxx> +#include <unotools/viewoptions.hxx> +#include <vcl/fixed.hxx> +#include <vcl/field.hxx> +#include <svtools/unitconv.hxx> +#include <vector> + +#define SWPAGE_NARROW_VALUE 720 +#define SWPAGE_NORMAL_VALUE 1136 +#define SWPAGE_WIDE_VALUE1 1440 +#define SWPAGE_WIDE_VALUE2 2880 +#define SWPAGE_WIDE_VALUE3 1800 + + +namespace svx { namespace sidebar { + class ValueSetWithTextControl; +} } + +static const long MINBODY = 284; //0.5 cm in twips + +namespace sw { namespace sidebar { + +class PagePropertyPanel; + + +class PageMarginControl + : public ::svx::sidebar::PopupControl +{ +public: + PageMarginControl( + Window* pParent, + PagePropertyPanel& rPanel, + const SvxLongLRSpaceItem& aPageLRMargin, + const SvxLongULSpaceItem& aPageULMargin, + const bool bMirrored, + const Size aPageSize, + const sal_Bool bLandscape, + const FieldUnit eFUnit, + const SfxMapUnit eUnit ); + ~PageMarginControl(void); + +private: + ::svx::sidebar::ValueSetWithTextControl* mpMarginValueSet; + + FixedText maCustom; + FixedText maLeft; + FixedText maInner; + MetricField maLeftMarginEdit; + FixedText maRight; + FixedText maOuter; + MetricField maRightMarginEdit; + FixedText maTop; + MetricField maTopMarginEdit; + FixedText maBottom; + MetricField maBottomMarginEdit; + + // hidden metric field + MetricField maWidthHeightField; + + long mnPageLeftMargin; + long mnPageRightMargin; + long mnPageTopMargin; + long mnPageBottomMargin; + bool mbMirrored; + + const SfxMapUnit meUnit; + + bool mbUserCustomValuesAvailable; + long mnUserCustomPageLeftMargin; + long mnUserCustomPageRightMargin; + long mnUserCustomPageTopMargin; + long mnUserCustomPageBottomMargin; + bool mbUserCustomMirrored; + + bool mbCustomValuesUsed; + + PagePropertyPanel& mrPagePropPanel; + + DECL_LINK( ImplMarginHdl, void* ); + DECL_LINK( ModifyLRMarginHdl, MetricField* ); + DECL_LINK( ModifyULMarginHdl, MetricField* ); + + void SetMetricFieldMaxValues( const Size aPageSize ); + + bool GetUserCustomValues(); + void StoreUserCustomValues(); + + void FillValueSet( + const bool bLandscape, + const bool bUserCustomValuesAvailable ); + void SelectValueSetItem(); +}; + +} } // end of namespace sw::sidebar + +#endif diff --git a/sw/source/ui/sidebar/PageOrientationControl.cxx b/sw/source/ui/sidebar/PageOrientationControl.cxx new file mode 100644 index 000000000000..e1268ab35558 --- /dev/null +++ b/sw/source/ui/sidebar/PageOrientationControl.cxx @@ -0,0 +1,88 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "PageOrientationControl.hxx" +#include "PagePropertyPanel.hxx" +#include "PagePropertyPanel.hrc" + +#include <swtypes.hxx> + +#include <svx/sidebar/ValueSetWithTextControl.hxx> + +namespace sw { namespace sidebar { + +PageOrientationControl::PageOrientationControl( + Window* pParent, + PagePropertyPanel& rPanel, + const sal_Bool bLandscape ) + : ::svx::sidebar::PopupControl( pParent, SW_RES(RID_POPUP_SWPAGE_ORIENTATION) ) + , mpOrientationValueSet( new ::svx::sidebar::ValueSetWithTextControl( ::svx::sidebar::ValueSetWithTextControl::IMAGE_TEXT, this, SW_RES(VS_ORIENTATION) ) ) + , mbLandscape( bLandscape ) + , mrPagePropPanel(rPanel) +{ + mpOrientationValueSet->SetStyle( mpOrientationValueSet->GetStyle() | WB_3DLOOK | WB_NO_DIRECTSELECT ); + mpOrientationValueSet->SetColor(GetSettings().GetStyleSettings().GetMenuColor()); + + // initialize <ValueSetWithText> control + { + mpOrientationValueSet->AddItem( SW_RES(IMG_PORTRAIT), 0, SW_RES(STR_PORTRAIT), 0 ); + mpOrientationValueSet->AddItem( SW_RES(IMG_LANDSCAPE), 0, SW_RES(STR_LANDSCAPE), 0 ); + } + + Link aLink = LINK(this, PageOrientationControl,ImplOrientationHdl ); + mpOrientationValueSet->SetSelectHdl(aLink); + mpOrientationValueSet->SetNoSelection(); + mpOrientationValueSet->StartSelection(); + mpOrientationValueSet->Show(); + mpOrientationValueSet->SelectItem( (mbLandscape == sal_True) ? 2 : 1 ); + mpOrientationValueSet->GrabFocus(); + mpOrientationValueSet->Format(); + mpOrientationValueSet->StartSelection(); + + FreeResource(); +} + + +PageOrientationControl::~PageOrientationControl(void) +{ + delete mpOrientationValueSet; +} + + +IMPL_LINK(PageOrientationControl, ImplOrientationHdl, void *, pControl) +{ + mpOrientationValueSet->SetNoSelection(); + if ( pControl == mpOrientationValueSet ) + { + const sal_uInt32 iPos = mpOrientationValueSet->GetSelectItemId(); + const bool bChanged = ( ( iPos == 1 ) && mbLandscape ) || + ( ( iPos == 2 ) && !mbLandscape ); + if ( bChanged ) + { + mbLandscape = !mbLandscape; + mrPagePropPanel.ExecuteOrientationChange( mbLandscape ); + } + } + + mrPagePropPanel.ClosePageOrientationPopup(); + return 0; +} + + +} } // end of namespace sw::sidebar + diff --git a/sw/source/ui/sidebar/PageOrientationControl.hxx b/sw/source/ui/sidebar/PageOrientationControl.hxx new file mode 100644 index 000000000000..a26a7f3ece4d --- /dev/null +++ b/sw/source/ui/sidebar/PageOrientationControl.hxx @@ -0,0 +1,54 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SW_SIDEBAR_PAGE_ORIENTATION_CONTROL_HXX_ +#define _SW_SIDEBAR_PAGE_ORIENTATION_CONTROL_HXX_ + +#include <svx/sidebar/PopupControl.hxx> + +namespace svx { namespace sidebar { + class ValueSetWithTextControl; +} } + +namespace sw { namespace sidebar { + +class PagePropertyPanel; + + +class PageOrientationControl + : public ::svx::sidebar::PopupControl +{ +public: + PageOrientationControl( + Window* pParent, + PagePropertyPanel& rPanel, + const sal_Bool bLandscape ); + ~PageOrientationControl(void); + +private: + ::svx::sidebar::ValueSetWithTextControl* mpOrientationValueSet; + + sal_Bool mbLandscape; + + PagePropertyPanel& mrPagePropPanel; + + DECL_LINK(ImplOrientationHdl, void*); +}; + +} } // end of namespace sw::sidebar + +#endif diff --git a/sw/source/ui/sidebar/PagePropertyPanel.cxx b/sw/source/ui/sidebar/PagePropertyPanel.cxx new file mode 100644 index 000000000000..b731114c8a61 --- /dev/null +++ b/sw/source/ui/sidebar/PagePropertyPanel.cxx @@ -0,0 +1,757 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "PagePropertyPanel.hxx" +#include "PagePropertyPanel.hrc" + +#include "PropertyPanel.hrc" + +#include <svx/sidebar/PopupContainer.hxx> +#include "PageOrientationControl.hxx" +#include "PageMarginControl.hxx" +#include "PageSizeControl.hxx" +#include "PageColumnControl.hxx" + +#include <swtypes.hxx> +#include <cmdid.h> + +#include <svl/intitem.hxx> +#include <editeng/sizeitem.hxx> +#include <editeng/paperinf.hxx> +#include <svx/svxids.hrc> +#include <svx/dlgutil.hxx> +#include <svx/rulritem.hxx> + +#include <sfx2/sidebar/ControlFactory.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/viewsh.hxx> +#include <sfx2/objsh.hxx> + +#include <boost/bind.hpp> + +#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) + +namespace sw { namespace sidebar { + +PagePropertyPanel* PagePropertyPanel::Create ( + Window* pParent, + SfxBindings* pBindings) +{ + if (pParent == NULL) + throw ::com::sun::star::lang::IllegalArgumentException(A2S("no parent Window given to PagePropertyPanel::Create"), NULL, 0); + if (pBindings == NULL) + throw ::com::sun::star::lang::IllegalArgumentException(A2S("no SfxBindings given to PagePropertyPanel::Create"), NULL, 2); + + return new PagePropertyPanel( + pParent, + pBindings); +} + +PagePropertyPanel::PagePropertyPanel( + Window* pParent, + SfxBindings* pBindings) + : Control(pParent, SW_RES(RID_PROPERTYPANEL_SWPAGE)) + , mpBindings(pBindings) + // visible controls + , maFtOrientation( this, SW_RES(FT_ORIENTATION) ) + , mpToolBoxOrientationBackground( ::sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this) ) + , mpToolBoxOrientation( ::sfx2::sidebar::ControlFactory::CreateToolBox( mpToolBoxOrientationBackground.get(), SW_RES(TB_ORIENTATION)) ) + , maFtMargin( this, SW_RES(FT_MARGIN) ) + , mpToolBoxMarginBackground( ::sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this) ) + , mpToolBoxMargin( ::sfx2::sidebar::ControlFactory::CreateToolBox( mpToolBoxMarginBackground.get(), SW_RES(TB_MARGIN)) ) + , maFtSize( this, SW_RES(FT_SIZE) ) + , mpToolBoxSizeBackground( ::sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this) ) + , mpToolBoxSize( ::sfx2::sidebar::ControlFactory::CreateToolBox( mpToolBoxSizeBackground.get(), SW_RES(TB_SIZE)) ) + , maFtColumn( this, SW_RES(FT_COLUMN) ) + , mpToolBoxColumnBackground( ::sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this) ) + , mpToolBoxColumn( ::sfx2::sidebar::ControlFactory::CreateToolBox( mpToolBoxColumnBackground.get(), SW_RES(TB_COLUMN)) ) + // image resources + , maImgSize (NULL) + , maImgSize_L (NULL) + , mImgPortrait (SW_RES(IMG_PAGE_PORTRAIT)) + , mImgLandscape (SW_RES(IMG_PAGE_LANDSCAPE)) + , mImgNarrow (SW_RES(IMG_PAGE_NARROW)) + , mImgNormal (SW_RES(IMG_PAGE_NORMAL)) + , mImgWide (SW_RES(IMG_PAGE_WIDE)) + , mImgMirrored (SW_RES(IMG_PAGE_MIRRORED)) + , mImgMarginCustom (SW_RES(IMG_PAGE_MARGIN_CUSTOM)) + , mImgNarrow_L (SW_RES(IMG_PAGE_NARROW_L)) + , mImgNormal_L (SW_RES(IMG_PAGE_NORMAL_L)) + , mImgWide_L (SW_RES(IMG_PAGE_WIDE_L)) + , mImgMirrored_L (SW_RES(IMG_PAGE_MIRRORED_L)) + , mImgMarginCustom_L (SW_RES(IMG_PAGE_MARGIN_CUSTOM_L)) + , mImgA3 (SW_RES(IMG_PAGE_A3)) + , mImgA4 (SW_RES(IMG_PAGE_A4)) + , mImgA5 (SW_RES(IMG_PAGE_A5)) + , mImgB4 (SW_RES(IMG_PAGE_B4)) + , mImgB5 (SW_RES(IMG_PAGE_B5)) + , mImgC5 (SW_RES(IMG_PAGE_C5)) + , mImgLetter (SW_RES(IMG_PAGE_LETTER)) + , mImgLegal (SW_RES(IMG_PAGE_LEGAL)) + , mImgSizeNone (SW_RES(IMG_PAGE_SIZE_NONE)) + , mImgA3_L (SW_RES(IMG_PAGE_A3_L)) + , mImgA4_L (SW_RES(IMG_PAGE_A4_L)) + , mImgA5_L (SW_RES(IMG_PAGE_A5_L)) + , mImgB4_L (SW_RES(IMG_PAGE_B4_L)) + , mImgB5_L (SW_RES(IMG_PAGE_B5_L)) + , mImgC5_L (SW_RES(IMG_PAGE_C5_L)) + , mImgLetter_L (SW_RES(IMG_PAGE_LETTER_L)) + , mImgLegal_L (SW_RES(IMG_PAGE_LEGAL_L)) + , mImgSizeNone_L (SW_RES(IMG_PAGE_SIZE_NONE_L)) + , mImgColumn1 (SW_RES(IMG_PAGE_COLUMN_1)) + , mImgColumn2 (SW_RES(IMG_PAGE_COLUMN_2)) + , mImgColumn3 (SW_RES(IMG_PAGE_COLUMN_3)) + , mImgLeft (SW_RES(IMG_PAGE_COLUMN_LEFT)) + , mImgRight (SW_RES(IMG_PAGE_COLUMN_RIGHT)) + , mImgColumnNone (SW_RES(IMG_PAGE_COLUMN_NONE)) + , mImgColumn1_L (SW_RES(IMG_PAGE_COLUMN_1_L)) + , mImgColumn2_L (SW_RES(IMG_PAGE_COLUMN_2_L)) + , mImgColumn3_L (SW_RES(IMG_PAGE_COLUMN_3_L)) + , mImgLeft_L (SW_RES(IMG_PAGE_COLUMN_LEFT_L)) + , mImgRight_L (SW_RES(IMG_PAGE_COLUMN_RIGHT_L)) + , mImgColumnNone_L (SW_RES(IMG_PAGE_COLUMN_NONE_L)) + + , mpPageItem( new SvxPageItem(SID_ATTR_PAGE) ) + , mpPageLRMarginItem( new SvxLongLRSpaceItem( 0, 0, SID_ATTR_PAGE_LRSPACE ) ) + , mpPageULMarginItem( new SvxLongULSpaceItem( 0, 0, SID_ATTR_PAGE_ULSPACE ) ) + , mpPageSizeItem( new SvxSizeItem(SID_ATTR_PAGE_SIZE) ) + , mePaper( PAPER_USER ) + , mpPageColumnTypeItem( new SfxInt16Item(SID_ATTR_PAGE_COLUMN) ) + + , meFUnit() + , meUnit() + + , m_aSwPagePgULControl(SID_ATTR_PAGE_ULSPACE, *pBindings, *this) + , m_aSwPagePgLRControl(SID_ATTR_PAGE_LRSPACE, *pBindings, *this) + , m_aSwPagePgSizeControl(SID_ATTR_PAGE_SIZE, *pBindings, *this) + , m_aSwPagePgControl(SID_ATTR_PAGE, *pBindings, *this) + , m_aSwPageColControl(SID_ATTR_PAGE_COLUMN, *pBindings, *this) + , m_aSwPagePgMetricControl(SID_ATTR_METRIC, *pBindings, *this) + + , mpOrientationPopup() + , mpMarginPopup() + , mpSizePopup() + , mpColumnPopup() + + , mbInvalidateSIDAttrPageOnSIDAttrPageSizeNotify( false ) +{ + Initialize(); + mbInvalidateSIDAttrPageOnSIDAttrPageSizeNotify = true; + FreeResource(); +} + +PagePropertyPanel::~PagePropertyPanel() +{ + delete[] maImgSize; + delete[] maImgSize_L; + + // destroy the toolbox windows. + mpToolBoxOrientation.reset(); + mpToolBoxMargin.reset(); + mpToolBoxSize.reset(); + mpToolBoxColumn.reset(); + + // destroy the background windows of the toolboxes. + mpToolBoxOrientationBackground.reset(); + mpToolBoxMarginBackground.reset(); + mpToolBoxSizeBackground.reset(); + mpToolBoxColumnBackground.reset(); +} + +void PagePropertyPanel::Initialize() +{ + maFtOrientation.SetBackground(Wallpaper()); + maFtMargin.SetBackground(Wallpaper()); + maFtSize.SetBackground(Wallpaper()); + maFtColumn.SetBackground(Wallpaper()); + + // popup for page orientation + Link aLink = LINK( this, PagePropertyPanel, ClickOrientationHdl ); + mpToolBoxOrientation->SetDropdownClickHdl( aLink ); + mpToolBoxOrientation->SetSelectHdl( aLink ); + mpToolBoxOrientation->SetItemImage( TBI_ORIENTATION, mImgPortrait); + mpToolBoxOrientation->SetItemBits( TBI_ORIENTATION, mpToolBoxOrientation->GetItemBits( TBI_ORIENTATION ) | TIB_DROPDOWNONLY ); + mpToolBoxOrientation->SetQuickHelpText(TBI_ORIENTATION,String(SW_RES(STR_QHELP_TB_ORIENTATION))); + mpToolBoxOrientation->SetOutputSizePixel( mpToolBoxOrientation->CalcWindowSizePixel() ); + mpToolBoxOrientation->SetBackground( Wallpaper() ); + mpToolBoxOrientation->SetPaintTransparent( sal_True ); + + // popup for page margins + aLink = LINK( this, PagePropertyPanel, ClickMarginHdl ); + mpToolBoxMargin->SetDropdownClickHdl( aLink ); + mpToolBoxMargin->SetSelectHdl( aLink ); + mpToolBoxMargin->SetItemImage(TBI_MARGIN, mImgNormal); + mpToolBoxMargin->SetItemBits( TBI_MARGIN, mpToolBoxMargin->GetItemBits( TBI_MARGIN ) | TIB_DROPDOWNONLY ); + mpToolBoxMargin->SetQuickHelpText(TBI_MARGIN,String(SW_RES(STR_QHELP_TB_MARGIN))); + mpToolBoxMargin->SetOutputSizePixel( mpToolBoxMargin->CalcWindowSizePixel() ); + mpToolBoxMargin->SetBackground(Wallpaper()); + mpToolBoxMargin->SetPaintTransparent( sal_True ); + + // popup for page size + aLink = LINK( this, PagePropertyPanel, ClickSizeHdl ); + mpToolBoxSize->SetDropdownClickHdl( aLink ); + mpToolBoxSize->SetSelectHdl( aLink ); + mpToolBoxSize->SetItemImage(TBI_SIZE, mImgLetter); + mpToolBoxSize->SetItemBits( TBI_SIZE, mpToolBoxSize->GetItemBits( TBI_SIZE ) | TIB_DROPDOWNONLY ); + mpToolBoxSize->SetQuickHelpText(TBI_SIZE,String(SW_RES(STR_QHELP_TB_SIZE))); + mpToolBoxSize->SetOutputSizePixel( mpToolBoxSize->CalcWindowSizePixel() ); + mpToolBoxSize->SetBackground(Wallpaper()); + mpToolBoxSize->SetPaintTransparent( sal_True ); + maImgSize = new Image[8]; + maImgSize[0] = mImgA3; + maImgSize[1] = mImgA4; + maImgSize[2] = mImgA5; + maImgSize[3] = mImgB4; + maImgSize[4] = mImgB5; + maImgSize[5] = mImgC5; + maImgSize[6] = mImgLetter; + maImgSize[7] = mImgLegal; + maImgSize_L = new Image[8]; + maImgSize_L[0] = mImgA3_L; + maImgSize_L[1] = mImgA4_L; + maImgSize_L[2] = mImgA5_L; + maImgSize_L[3] = mImgB4_L; + maImgSize_L[4] = mImgB5_L; + maImgSize_L[5] = mImgC5_L; + maImgSize_L[6] = mImgLetter_L; + maImgSize_L[7] = mImgLegal_L; + + // popup for page column property + aLink = LINK( this, PagePropertyPanel, ClickColumnHdl ); + mpToolBoxColumn->SetDropdownClickHdl( aLink ); + mpToolBoxColumn->SetSelectHdl( aLink ); + mpToolBoxColumn->SetItemImage(TBI_COLUMN, mImgColumn1); + mpToolBoxColumn->SetItemBits( TBI_COLUMN, mpToolBoxColumn->GetItemBits( TBI_COLUMN ) | TIB_DROPDOWNONLY ); + mpToolBoxColumn->SetQuickHelpText(TBI_COLUMN,String(SW_RES(STR_QHELP_TB_COLUMN))); + mpToolBoxColumn->SetOutputSizePixel( mpToolBoxColumn->CalcWindowSizePixel() ); + mpToolBoxColumn->SetBackground(Wallpaper()); + mpToolBoxColumn->SetPaintTransparent( sal_True ); + + meFUnit = GetModuleFieldUnit(); + meUnit = m_aSwPagePgSizeControl.GetCoreMetric(); + + // 'pull' for page style's attribute values + mpBindings->Update( SID_ATTR_PAGE_LRSPACE ); + mpBindings->Update( SID_ATTR_PAGE_ULSPACE ); + mpBindings->Update( SID_ATTR_PAGE ); + mpBindings->Update( SID_ATTR_PAGE_SIZE ); +} + + +::svx::sidebar::PopupControl* PagePropertyPanel::CreatePageOrientationControl( ::svx::sidebar::PopupContainer* pParent ) +{ + return new PageOrientationControl( pParent, *this , mpPageItem->IsLandscape() ); +} + + +IMPL_LINK( PagePropertyPanel, ClickOrientationHdl, ToolBox*, pToolBox ) +{ + if ( ! mpOrientationPopup) + { + mpOrientationPopup.reset( + new ::svx::sidebar::Popup( + this, + ::boost::bind(&PagePropertyPanel::CreatePageOrientationControl, this, _1), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Page orientation")) ) ); + } + mpOrientationPopup->Show( *pToolBox ); + + return 0L; +} + + +void PagePropertyPanel::ExecuteOrientationChange( const sal_Bool bLandscape ) +{ + { + // set new page orientation + mpPageItem->SetLandscape( bLandscape ); + + // swap the width and height of the page size + mpPageSizeItem->SetSize( Size( mpPageSizeItem->GetSize().Height(), mpPageSizeItem->GetSize().Width() ) ); + + // apply changed attributes + GetBindings()->GetDispatcher()->Execute( SID_ATTR_PAGE_SIZE, SFX_CALLMODE_RECORD, mpPageSizeItem.get(), mpPageItem.get(), 0L ); + } + + // check, if margin values still fit to the changed page size. + // if not, adjust margin values + { + const long nML = mpPageLRMarginItem->GetLeft(); + const long nMR = mpPageLRMarginItem->GetRight(); + const long nTmpPW = nML + nMR + MINBODY; + + const long nPW = mpPageSizeItem->GetSize().Width(); + + if ( nTmpPW > nPW ) + { + if ( nML <= nMR ) + { + ExecuteMarginLRChange( mpPageLRMarginItem->GetLeft(), nMR - (nTmpPW - nPW ) ); + } + else + { + ExecuteMarginLRChange( nML - (nTmpPW - nPW ), mpPageLRMarginItem->GetRight() ); + } + } + + const long nMT = mpPageULMarginItem->GetUpper(); + const long nMB = mpPageULMarginItem->GetLower(); + const long nTmpPH = nMT + nMB + MINBODY; + + const long nPH = mpPageSizeItem->GetSize().Height(); + + if ( nTmpPH > nPH ) + { + if ( nMT <= nMB ) + { + ExecuteMarginULChange( mpPageULMarginItem->GetUpper(), nMB - ( nTmpPH - nPH ) ); + } + else + { + ExecuteMarginULChange( nMT - ( nTmpPH - nPH ), mpPageULMarginItem->GetLower() ); + } + } + } +} + + +void PagePropertyPanel::ClosePageOrientationPopup() +{ + mpOrientationPopup->Hide(); +} + + + + +::svx::sidebar::PopupControl* PagePropertyPanel::CreatePageMarginControl( ::svx::sidebar::PopupContainer* pParent ) +{ + return new PageMarginControl( + pParent, + *this, + *mpPageLRMarginItem.get(), + *mpPageULMarginItem.get(), + mpPageItem->GetPageUsage() == SVX_PAGE_MIRROR, + mpPageSizeItem->GetSize(), + mpPageItem->IsLandscape(), + meFUnit, + meUnit ); +} + + +void PagePropertyPanel::ExecuteMarginLRChange( + const long nPageLeftMargin, + const long nPageRightMargin ) +{ + mpPageLRMarginItem->SetLeft( nPageLeftMargin ); + mpPageLRMarginItem->SetRight( nPageRightMargin ); + GetBindings()->GetDispatcher()->Execute( SID_ATTR_PAGE_LRSPACE, SFX_CALLMODE_RECORD, mpPageLRMarginItem.get(), 0L ); +} + +void PagePropertyPanel::ExecuteMarginULChange( + const long nPageTopMargin, + const long nPageBottomMargin ) +{ + mpPageULMarginItem->SetUpper( nPageTopMargin ); + mpPageULMarginItem->SetLower( nPageBottomMargin ); + GetBindings()->GetDispatcher()->Execute( SID_ATTR_PAGE_ULSPACE, SFX_CALLMODE_RECORD, mpPageULMarginItem.get(), 0L ); +} + + +void PagePropertyPanel::ExecutePageLayoutChange( const bool bMirrored ) +{ + mpPageItem->SetPageUsage( bMirrored ? SVX_PAGE_MIRROR : SVX_PAGE_ALL ); + GetBindings()->GetDispatcher()->Execute( SID_ATTR_PAGE, SFX_CALLMODE_RECORD, mpPageItem.get(), 0L ); +} + + +IMPL_LINK( PagePropertyPanel, ClickMarginHdl, ToolBox*, pToolBox ) +{ + if ( ! mpMarginPopup) + mpMarginPopup.reset( + new ::svx::sidebar::Popup( + this, + ::boost::bind(&PagePropertyPanel::CreatePageMarginControl, this, _1), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Page margins")) ) ); + mpMarginPopup->Show( *pToolBox ); + + return 0L; +} + + +void PagePropertyPanel::ClosePageMarginPopup() +{ + mpMarginPopup->Hide(); +} + + + + +::svx::sidebar::PopupControl* PagePropertyPanel::CreatePageSizeControl( ::svx::sidebar::PopupContainer* pParent ) +{ + return new PageSizeControl( + pParent, + *this, + mePaper, + mpPageItem->IsLandscape(), + meFUnit ); +} + + +void PagePropertyPanel::ExecuteSizeChange( const Paper ePaper ) +{ + Size aPageSize = SvxPaperInfo::GetPaperSize( ePaper, (MapUnit)(meUnit) ); + if ( mpPageItem->IsLandscape() ) + { + Swap( aPageSize ); + } + mpPageSizeItem->SetSize( aPageSize ); + + mpBindings->GetDispatcher()->Execute(SID_ATTR_PAGE_SIZE, SFX_CALLMODE_RECORD, mpPageSizeItem.get(), 0L ); +} + + +IMPL_LINK( PagePropertyPanel, ClickSizeHdl, ToolBox*, pToolBox ) +{ + if ( ! mpSizePopup) + mpSizePopup.reset( + new ::svx::sidebar::Popup( + this, + ::boost::bind(&PagePropertyPanel::CreatePageSizeControl, this, _1), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Page size")) ) ); + mpSizePopup->Show( *pToolBox ); + + return 0L; +} + + +void PagePropertyPanel::ClosePageSizePopup() +{ + mpSizePopup->Hide(); +} + + + + +::svx::sidebar::PopupControl* PagePropertyPanel::CreatePageColumnControl( ::svx::sidebar::PopupContainer* pParent ) +{ + return new PageColumnControl( + pParent, + *this, + mpPageColumnTypeItem->GetValue(), + mpPageItem->IsLandscape() ); +} + + +void PagePropertyPanel::ExecuteColumnChange( const sal_uInt16 nColumnType ) +{ + mpPageColumnTypeItem->SetValue( nColumnType ); + mpBindings->GetDispatcher()->Execute(SID_ATTR_PAGE_COLUMN, SFX_CALLMODE_RECORD, mpPageColumnTypeItem.get(), 0L ); +} + + +IMPL_LINK( PagePropertyPanel, ClickColumnHdl, ToolBox*, pToolBox ) +{ + if ( ! mpColumnPopup) + mpColumnPopup.reset( + new ::svx::sidebar::Popup( + this, + ::boost::bind(&PagePropertyPanel::CreatePageColumnControl, this, _1), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Page columns")) ) ); + mpColumnPopup->Show( *pToolBox ); + + return 0L; +} + + +void PagePropertyPanel::ClosePageColumnPopup() +{ + mpColumnPopup->Hide(); +} + + + + +void PagePropertyPanel::NotifyItemUpdate( + const sal_uInt16 nSId, + const SfxItemState eState, + const SfxPoolItem* pState) +{ + switch( nSId ) + { + case SID_ATTR_PAGE_COLUMN: + { + if ( eState >= SFX_ITEM_AVAILABLE && + pState && pState->ISA(SfxInt16Item) ) + { + mpPageColumnTypeItem.reset( static_cast<SfxInt16Item*>(pState->Clone()) ); + ChangeColumnImage( mpPageColumnTypeItem->GetValue() ); + } + } + break; + case SID_ATTR_PAGE_LRSPACE: + if ( eState >= SFX_ITEM_AVAILABLE && + pState && pState->ISA(SvxLongLRSpaceItem) ) + { + mpPageLRMarginItem.reset( static_cast<SvxLongLRSpaceItem*>(pState->Clone()) ); + ChangeMarginImage(); + } + break; + + case SID_ATTR_PAGE_ULSPACE: + if ( eState >= SFX_ITEM_AVAILABLE && + pState && pState->ISA(SvxLongULSpaceItem) ) + { + mpPageULMarginItem.reset( static_cast<SvxLongULSpaceItem*>(pState->Clone()) ); + ChangeMarginImage(); + } + break; + + case SID_ATTR_PAGE: + if ( eState >= SFX_ITEM_AVAILABLE && + pState && pState->ISA(SvxPageItem) ) + { + mpPageItem.reset( static_cast<SvxPageItem*>(pState->Clone()) ); + if ( mpPageItem->IsLandscape() ) + { + mpToolBoxOrientation->SetItemImage(TBI_ORIENTATION, mImgLandscape); + } + else + { + mpToolBoxOrientation->SetItemImage(TBI_ORIENTATION, mImgPortrait); + } + ChangeMarginImage(); + ChangeSizeImage(); + ChangeColumnImage( mpPageColumnTypeItem->GetValue() ); + } + break; + + case SID_ATTR_PAGE_SIZE: + if ( mbInvalidateSIDAttrPageOnSIDAttrPageSizeNotify ) + { + mpBindings->Invalidate( SID_ATTR_PAGE, sal_True, sal_False ); + } + if ( eState >= SFX_ITEM_AVAILABLE && + pState && pState->ISA(SvxSizeItem) ) + { + mpPageSizeItem.reset( static_cast<SvxSizeItem*>(pState->Clone()) ); + ChangeSizeImage(); + } + break; + case SID_ATTR_METRIC: + MetricState( eState, pState ); + break; + } +} + + +void PagePropertyPanel::MetricState( SfxItemState eState, const SfxPoolItem* pState ) +{ + meFUnit = FUNIT_NONE; + if ( pState && eState >= SFX_ITEM_DEFAULT ) + { + meFUnit = (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 ) + meFUnit = (FieldUnit)( (SfxUInt16Item*)pItem )->GetValue(); + } + else + { + DBG_ERRORFILE( "<PagePropertyPanel::MetricState(..)>: no module found" ); + } + } + } +} + + + + +void PagePropertyPanel::ChangeMarginImage() +{ + if ( mpPageLRMarginItem.get() == 0 || + mpPageULMarginItem.get() == 0 || + mpPageItem.get() == 0 ) + { + return; + } + + const long cTolerance = 5; + + if( abs(mpPageLRMarginItem->GetLeft() - SWPAGE_NARROW_VALUE) <= cTolerance && + abs(mpPageLRMarginItem->GetRight() - SWPAGE_NARROW_VALUE) <= cTolerance && + abs(mpPageULMarginItem->GetUpper() - SWPAGE_NARROW_VALUE) <= cTolerance && + abs(mpPageULMarginItem->GetLower() - SWPAGE_NARROW_VALUE) <= cTolerance && + mpPageItem->GetPageUsage() != SVX_PAGE_MIRROR ) + mpToolBoxMargin->SetItemImage( TBI_MARGIN, mpPageItem->IsLandscape() ? mImgNarrow_L : mImgNarrow ); + + else if( abs(mpPageLRMarginItem->GetLeft() - SWPAGE_NORMAL_VALUE) <= cTolerance && + abs(mpPageLRMarginItem->GetRight() - SWPAGE_NORMAL_VALUE) <= cTolerance && + abs(mpPageULMarginItem->GetUpper() - SWPAGE_NORMAL_VALUE) <= cTolerance && + abs(mpPageULMarginItem->GetLower() - SWPAGE_NORMAL_VALUE) <= cTolerance && + mpPageItem->GetPageUsage() != SVX_PAGE_MIRROR ) + mpToolBoxMargin->SetItemImage(TBI_MARGIN, mpPageItem->IsLandscape() ? mImgNormal_L : mImgNormal ); + + else if( abs(mpPageLRMarginItem->GetLeft() - SWPAGE_WIDE_VALUE2) <= cTolerance && + abs(mpPageLRMarginItem->GetRight() - SWPAGE_WIDE_VALUE2) <= cTolerance && + abs(mpPageULMarginItem->GetUpper() - SWPAGE_WIDE_VALUE1) <= cTolerance && + abs(mpPageULMarginItem->GetLower() - SWPAGE_WIDE_VALUE1) <= cTolerance && + mpPageItem->GetPageUsage() != SVX_PAGE_MIRROR ) + mpToolBoxMargin->SetItemImage(TBI_MARGIN, mpPageItem->IsLandscape() ? mImgWide_L : mImgWide ); + + else if( abs(mpPageLRMarginItem->GetLeft() - SWPAGE_WIDE_VALUE3) <= cTolerance && + abs(mpPageLRMarginItem->GetRight() - SWPAGE_WIDE_VALUE1) <= cTolerance && + abs(mpPageULMarginItem->GetUpper() - SWPAGE_WIDE_VALUE1) <= cTolerance && + abs(mpPageULMarginItem->GetLower() - SWPAGE_WIDE_VALUE1) <= cTolerance && + mpPageItem->GetPageUsage() == SVX_PAGE_MIRROR ) + mpToolBoxMargin->SetItemImage(TBI_MARGIN, mpPageItem->IsLandscape() ? mImgMirrored_L : mImgMirrored ); + + else + mpToolBoxMargin->SetItemImage(TBI_MARGIN, mpPageItem->IsLandscape() ? mImgMarginCustom_L : mImgMarginCustom ); +} + + +void PagePropertyPanel::ChangeSizeImage() +{ + if ( mpPageSizeItem.get() == 0 || + mpPageItem.get() == 0 ) + { + return; + } + + Size aTmpPaperSize = mpPageSizeItem->GetSize(); + if ( mpPageItem->IsLandscape() ) + { + Swap( aTmpPaperSize ); // Swap(..) defined in editeng/paperinf.hxx + } + + mePaper = SvxPaperInfo::GetSvxPaper( aTmpPaperSize, static_cast<MapUnit>(meUnit), sal_True ); + + sal_uInt16 nImageIdx = 0; + switch ( mePaper ) + { + case PAPER_A3: + nImageIdx = 1; + break; + case PAPER_A4: + nImageIdx = 2; + break; + case PAPER_A5: + nImageIdx = 3; + break; + case PAPER_B4_ISO: + nImageIdx = 4; + break; + case PAPER_B5_ISO: + nImageIdx = 5; + break; + case PAPER_ENV_C5: + nImageIdx = 6; + break; + case PAPER_LETTER: + nImageIdx = 7; + break; + case PAPER_LEGAL: + nImageIdx = 8; + break; + default: + nImageIdx = 0; + mePaper = PAPER_USER; + break; + } + + if ( nImageIdx == 0 ) + { + mpToolBoxSize->SetItemImage( TBI_SIZE, + ( mpPageItem->IsLandscape() ? mImgSizeNone_L : mImgSizeNone ) ); + } + else + { + mpToolBoxSize->SetItemImage( TBI_SIZE, + ( mpPageItem->IsLandscape() ? maImgSize_L[nImageIdx-1] : maImgSize[nImageIdx-1] ) ); + } +} + + +void PagePropertyPanel::ChangeColumnImage( const sal_uInt16 nColumnType ) +{ + if ( mpPageItem.get() == 0 ) + { + return; + } + + if ( !mpPageItem->IsLandscape() ) + { + switch( nColumnType ) + { + case 1: + mpToolBoxColumn->SetItemImage(TBI_COLUMN, mImgColumn1); + break; + case 2: + mpToolBoxColumn->SetItemImage(TBI_COLUMN, mImgColumn2); + break; + case 3: + mpToolBoxColumn->SetItemImage(TBI_COLUMN, mImgColumn3); + break; + case 4: + mpToolBoxColumn->SetItemImage(TBI_COLUMN, mImgLeft); + break; + case 5: + mpToolBoxColumn->SetItemImage(TBI_COLUMN, mImgRight); + break; + default: + mpToolBoxColumn->SetItemImage(TBI_COLUMN, mImgColumnNone); + } + } + else + { + switch( nColumnType ) + { + case 1: + mpToolBoxColumn->SetItemImage(TBI_COLUMN, mImgColumn1_L); + break; + case 2: + mpToolBoxColumn->SetItemImage(TBI_COLUMN, mImgColumn2_L); + break; + case 3: + mpToolBoxColumn->SetItemImage(TBI_COLUMN, mImgColumn3_L); + break; + case 4: + mpToolBoxColumn->SetItemImage(TBI_COLUMN, mImgLeft_L); + break; + case 5: + mpToolBoxColumn->SetItemImage(TBI_COLUMN, mImgRight_L); + break; + default: + mpToolBoxColumn->SetItemImage(TBI_COLUMN, mImgColumnNone_L); + } + } +} + +} } // end of namespace ::sw::sidebar diff --git a/sw/source/ui/sidebar/PagePropertyPanel.hrc b/sw/source/ui/sidebar/PagePropertyPanel.hrc new file mode 100644 index 000000000000..a4592ae68588 --- /dev/null +++ b/sw/source/ui/sidebar/PagePropertyPanel.hrc @@ -0,0 +1,196 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "PropertyPanel.hrc" + +#define FT_ORIENTATION 1 +#define TB_ORIENTATION 2 +#define FT_MARGIN 3 +#define TB_MARGIN 4 +#define FT_SIZE 5 +#define TB_SIZE 6 +#define FT_COLUMN 7 +#define TB_COLUMN 8 +#define TBI_MARGIN 9 +#define IMG_PORTRAIT 10 +#define IMG_LANDSCAPE 11 +#define STR_PORTRAIT 12 +#define STR_LANDSCAPE 13 +#define ED_SWPAPER_WIDTH 14 +#define ED_SWPAPER_HEIGHT 15 +#define LB_SWPAPER_TRAY 16 +#define LB_SWPAPER_SIZE 17 +#define MF_SWLEFT_MARGIN 18 +#define MF_SWRIGHT_MARGIN 19 +#define MF_SWTOP_MARGIN 20 +#define MF_SWBOTTOM_MARGIN 21 +#define TBI_SIZE 22 +#define VS_SIZE 23 +#define STR_LCVALUE 24 +#define FT_CUSTOM 25 +#define FLD_WIDTH_HEIGHT 26 + +#define TBI_ORIENTATION 28 +#define VS_ORIENTATION 29 +#define IMG_PAGE_PORTRAIT 30 +#define IMG_PAGE_LANDSCAPE 31 +#define IMG_NARROW 32 +#define IMG_NORMAL 33 +#define IMG_WIDE 34 +#define IMG_MIRRORED 35 +#define STR_NARROW 36 +#define STR_NORMAL 37 +#define STR_WIDE 38 +#define STR_MIRRORED 39 +#define VS_MARGIN 40 +#define IMG_CUSTOM 41 +#define FT_LEFT 42 +#define FT_RIGHT 43 +#define FT_TOP 44 +#define FT_BOTTOM 45 +#define FT_INNER 46 +#define FT_OUTER 47 +#define TBI_COLUMN 48 +#define VS_COLUMN 49 +#define MBOX_WIDTH 50 +#define IMG_ONE 51 +#define IMG_TWO 52 +#define IMG_THREE 53 +#define IMG_LEFT 54 +#define IMG_RIGHT 55 +#define STR_ONE 56 +#define STR_TWO 57 +#define STR_THREE 58 +#define STR_LEFT 59 +#define STR_RIGHT 60 +#define CB_COLUMN_MORE 61 + +#define CB_SIZE_MORE 61 + +#define IMG_PAGE_NARROW 64 +#define IMG_PAGE_NORMAL 65 +#define IMG_PAGE_WIDE 63 +#define IMG_PAGE_MIRRORED 67 +#define IMG_PAGE_MARGIN_CUSTOM 68 +#define IMG_PAGE_A3 69 +#define IMG_PAGE_A4 70 +#define IMG_PAGE_A5 71 +#define IMG_PAGE_B4 72 +#define IMG_PAGE_B5 73 +#define IMG_PAGE_C5 74 +#define IMG_PAGE_LETTER 75 +#define IMG_PAGE_LEGAL 76 +#define IMG_PAGE_COLUMN_1 77 +#define IMG_PAGE_COLUMN_2 78 +#define IMG_PAGE_COLUMN_3 79 +#define IMG_PAGE_COLUMN_LEFT 80 +#define IMG_PAGE_COLUMN_RIGHT 81 +#define IMG_PAGE_SIZE_NONE 82 +#define IMG_PAGE_COLUMN_NONE 83 +#define IMG_PAGE_COLUMN_1_L 84 +#define IMG_PAGE_COLUMN_2_L 85 +#define IMG_PAGE_COLUMN_3_L 86 +#define IMG_PAGE_COLUMN_LEFT_L 87 +#define IMG_PAGE_COLUMN_RIGHT_L 88 +#define IMG_PAGE_COLUMN_NONE_L 89 +#define IMG_ONE_L 90 +#define IMG_TWO_L 91 +#define IMG_THREE_L 92 +#define IMG_LEFT_L 93 +#define IMG_RIGHT_L 94 +#define IMG_PAGE_A3_L 95 +#define IMG_PAGE_A4_L 96 +#define IMG_PAGE_A5_L 97 +#define IMG_PAGE_B4_L 98 +#define IMG_PAGE_B5_L 99 +#define IMG_PAGE_C5_L 100 +#define IMG_PAGE_LETTER_L 101 +#define IMG_PAGE_LEGAL_L 102 +#define IMG_PAGE_SIZE_NONE_L 103 +#define IMG_PAGE_NARROW_L 104 +#define IMG_PAGE_NORMAL_L 105 +#define IMG_PAGE_WIDE_L 106 +#define IMG_PAGE_MIRRORED_L 107 +#define IMG_PAGE_MARGIN_CUSTOM_L 108 +#define IMG_NARROW_L 109 +#define IMG_NORMAL_L 110 +#define IMG_WIDE_L 111 +#define IMG_MIRRORED_L 112 +#define FLD_LEFT_MARGIN 113 +#define FLD_RIGHT_MARGIN 114 +#define FLD_TOP_MARGIN 115 +#define FLD_BOTTOM_MARGIN 116 + +#define STR_QHELP_TB_ORIENTATION 117 +#define STR_QHELP_TB_MARGIN 118 +#define STR_QHELP_TB_SIZE 119 +#define STR_QHELP_TB_COLUMN 120 +#define IMG_CUSTOM_DIS 121 +// +#define STR_MARGIN_TOOLTIP_LEFT 122 +#define STR_MARGIN_TOOLTIP_RIGHT 123 +#define STR_MARGIN_TOOLTIP_INNER 124 +#define STR_MARGIN_TOOLTIP_OUTER 125 +#define STR_MARGIN_TOOLTIP_TOP 126 +#define STR_MARGIN_TOOLTIP_BOT 127 + +#define POPUP_MARGIN 4 +#define VS_WIDTH 78 +#define ITEM_HEIGHT 17 +#define ITEM_HEIGHT2 15 + +//========================================Position============================================== + +#define FT_ORIENTATION_X SECTIONPAGE_MARGIN_HORIZONTAL +#define FT_ORIENTATION_Y SECTIONPAGE_MARGIN_VERTICAL_TOP +#define TBX_ORIENTATION_X FT_ORIENTATION_X +#define TBX_ORIENTATION_Y FT_ORIENTATION_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL +#define FT_MARGIN_X FT_ORIENTATION_X + MBOX_WIDTH + CONTROL_SPACING_HORIZONTAL +#define FT_MARGIN_Y FT_ORIENTATION_Y +#define TBX_MARGIN_X FT_MARGIN_X +#define TBX_MARGIN_Y TBX_ORIENTATION_Y +#define FT_SIZE_X FT_ORIENTATION_X +#define FT_SIZE_Y TBX_ORIENTATION_Y + 20 + CONTROL_SPACING_VERTICAL +#define TBX_SIZE_X FT_SIZE_X +#define TBX_SIZE_Y FT_SIZE_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL +#define FT_COLUMN_X FT_MARGIN_X +#define FT_COLUMN_Y FT_SIZE_Y +#define TBX_COLUMN_X FT_COLUMN_X +#define TBX_COLUMN_Y TBX_SIZE_Y + +#define FT_CUSTOM_X POPUP_MARGIN + OFFSET_X +#define FT_CUSTOM_Y POPUPPANEL_MARGIN_SMALL * 2 + ITEM_HEIGHT * 5 + +#define POP_BORDER_X POPUP_MARGIN + OFFSET_X + 1 +#define POP_BORDER_Y POPUPPANEL_MARGIN_SMALL * 3 + ITEM_HEIGHT * 5 + TEXT_HEIGHT +#define BD_WIDTH VS_WIDTH - 6 +#define BD_HEIGHT MBOX_HEIGHT*4 + CONTROL_SPACING_VERTICAL*5 + +#define FT_X POP_BORDER_X + CONTROL_SPACING_HORIZONTAL +#define MF_X FT_X + 25 + CONTROL_SPACING_HORIZONTAL +#define LEFT_MF_Y POP_BORDER_Y + CONTROL_SPACING_VERTICAL +#define RIGHT_MF_Y LEFT_MF_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL +#define TOP_MF_Y RIGHT_MF_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL +#define BOTTOM_MF_Y TOP_MF_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL +#define FT_LEFT_Y LEFT_MF_Y + 1 +#define FT_RIGHT_Y RIGHT_MF_Y + 1 +#define FT_TOP_Y TOP_MF_Y + 1 +#define FT_BOTTOM_Y BOTTOM_MF_Y + 1 + +#define MARGIN_PANEL_HEIGHT POP_BORDER_Y + BD_HEIGHT + POPUP_MARGIN + OFFSET_Y +#define CUST_MORE_BUTTON_IMG_OFF_X POPUPPANEL_MARGIN_HORIZONTAL + OFFSET_X +#define PAGE_HEIGHT TBX_COLUMN_Y + 20 + SECTIONPAGE_MARGIN_VERTICAL_BOT
\ No newline at end of file diff --git a/sw/source/ui/sidebar/PagePropertyPanel.hxx b/sw/source/ui/sidebar/PagePropertyPanel.hxx new file mode 100644 index 000000000000..311f0ee489af --- /dev/null +++ b/sw/source/ui/sidebar/PagePropertyPanel.hxx @@ -0,0 +1,219 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SW_SIDEBAR_PAGE_PROPERTY_PANEL_HXX +#define SW_SIDEBAR_PAGE_PROPERTY_PANEL_HXX + +#include <svx/sidebar/Popup.hxx> + +#include <sfx2/sidebar/ControllerItem.hxx> + +namespace svx { namespace sidebar { + class PopupControl; +} } + +#include <i18nutil/paper.hxx> + +#include <svx/pageitem.hxx> +#include <svx/rulritem.hxx> +#include <editeng/sizeitem.hxx> + +#include <vcl/ctrl.hxx> +#include <vcl/fixed.hxx> +#include <vcl/button.hxx> +#include <vcl/toolbox.hxx> +#include <vcl/lstbox.hxx> +#include <vcl/field.hxx> +#include <svl/intitem.hxx> + +#include <boost/scoped_ptr.hpp> + + +namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; + +namespace sw { namespace sidebar { + + class PagePropertyPanel + : public Control, + public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface + { + public: + static PagePropertyPanel* Create( + Window* pParent, + SfxBindings* pBindings ); + + // interface of ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface + virtual void NotifyItemUpdate( + const sal_uInt16 nSId, + const SfxItemState eState, + const SfxPoolItem* pState ); + + SfxBindings* GetBindings() const + { + return mpBindings; + } + + + ::svx::sidebar::PopupControl* CreatePageOrientationControl( ::svx::sidebar::PopupContainer* pParent ); + void ExecuteOrientationChange( const sal_Bool bLandscape ); + void ClosePageOrientationPopup(); + + ::svx::sidebar::PopupControl* CreatePageMarginControl( ::svx::sidebar::PopupContainer* pParent ); + void ExecuteMarginLRChange( + const long nPageLeftMargin, + const long nPageRightMargin ); + void ExecuteMarginULChange( + const long nPageTopMargin, + const long nPageBottomMargin ); + void ExecutePageLayoutChange( const bool bMirrored ); + void ClosePageMarginPopup(); + + ::svx::sidebar::PopupControl* CreatePageSizeControl( ::svx::sidebar::PopupContainer* pParent ); + void ExecuteSizeChange( const Paper ePaper ); + void ClosePageSizePopup(); + + ::svx::sidebar::PopupControl* CreatePageColumnControl( ::svx::sidebar::PopupContainer* pParent ); + void ExecuteColumnChange( const sal_uInt16 nColumnType ); + void ClosePageColumnPopup(); + + private: + PagePropertyPanel( + Window* pParent, + SfxBindings* pBindings ); + virtual ~PagePropertyPanel(void); + + SfxBindings* mpBindings; + + // toolboxes - on click open corresponding popup + FixedText maFtOrientation; + ::boost::scoped_ptr<Window> mpToolBoxOrientationBackground; + ::boost::scoped_ptr<ToolBox> mpToolBoxOrientation; + FixedText maFtMargin; + ::boost::scoped_ptr<Window> mpToolBoxMarginBackground; + ::boost::scoped_ptr<ToolBox> mpToolBoxMargin; + FixedText maFtSize; + ::boost::scoped_ptr<Window> mpToolBoxSizeBackground; + ::boost::scoped_ptr<ToolBox> mpToolBoxSize; + FixedText maFtColumn; + ::boost::scoped_ptr<Window> mpToolBoxColumnBackground; + ::boost::scoped_ptr<ToolBox> mpToolBoxColumn; + + Image* maImgSize; + Image* maImgSize_L; + Image mImgPortrait; + Image mImgLandscape; + Image mImgNarrow; + Image mImgNormal; + Image mImgWide; + Image mImgMirrored; + Image mImgMarginCustom; + Image mImgNarrow_L; + Image mImgNormal_L; + Image mImgWide_L; + Image mImgMirrored_L; + Image mImgMarginCustom_L; + Image mImgA3; + Image mImgA4; + Image mImgA5; + Image mImgB4; + Image mImgB5; + Image mImgC5; + Image mImgLetter; + Image mImgLegal; + Image mImgSizeNone; + Image mImgA3_L; + Image mImgA4_L; + Image mImgA5_L; + Image mImgB4_L; + Image mImgB5_L; + Image mImgC5_L; + Image mImgLetter_L; + Image mImgLegal_L; + Image mImgSizeNone_L; + Image mImgColumn1; + Image mImgColumn2; + Image mImgColumn3; + Image mImgLeft; + Image mImgRight; + Image mImgColumnNone; + Image mImgColumn1_L; + Image mImgColumn2_L; + Image mImgColumn3_L; + Image mImgLeft_L; + Image mImgRight_L; + Image mImgColumnNone_L; + + // item keeping the following page style attributes: + // - page orientation + // - page usage - only left, only right, both, mirrored + // item also hold the numbering type for the page style which should + // be kept stable. + ::boost::scoped_ptr<SvxPageItem> mpPageItem; + + // item keeping the page style's left and right margins + ::boost::scoped_ptr<SvxLongLRSpaceItem> mpPageLRMarginItem; + // item keeping the page style's top and bottom margins + ::boost::scoped_ptr<SvxLongULSpaceItem> mpPageULMarginItem; + + // item keeping the page style's page size + ::boost::scoped_ptr<SvxSizeItem> mpPageSizeItem; + // Paper corresponding to the page style's page size + Paper mePaper; + + // item keeping the page column type + ::boost::scoped_ptr<SfxInt16Item> mpPageColumnTypeItem; + + FieldUnit meFUnit; + SfxMapUnit meUnit; + + // controller items + ::sfx2::sidebar::ControllerItem m_aSwPagePgULControl; + ::sfx2::sidebar::ControllerItem m_aSwPagePgLRControl; + ::sfx2::sidebar::ControllerItem m_aSwPagePgSizeControl; + ::sfx2::sidebar::ControllerItem m_aSwPagePgControl; + ::sfx2::sidebar::ControllerItem m_aSwPageColControl; + ::sfx2::sidebar::ControllerItem m_aSwPagePgMetricControl; + + // popups + ::boost::scoped_ptr< ::svx::sidebar::Popup > mpOrientationPopup; + ::boost::scoped_ptr< ::svx::sidebar::Popup > mpMarginPopup; + ::boost::scoped_ptr< ::svx::sidebar::Popup > mpSizePopup; + ::boost::scoped_ptr< ::svx::sidebar::Popup > mpColumnPopup; + + bool mbInvalidateSIDAttrPageOnSIDAttrPageSizeNotify; + + // handler for popup toolboxes to show the popups + DECL_LINK(ClickOrientationHdl, ToolBox* ); + DECL_LINK(ClickMarginHdl, ToolBox* ); + DECL_LINK(ClickSizeHdl, ToolBox* ); + DECL_LINK(ClickColumnHdl, ToolBox* ); + + void Initialize(); + + void MetricState( SfxItemState eState, const SfxPoolItem* pState ); + + // helper to adjust popup toolbox' images + void ChangeMarginImage(); + void ChangeSizeImage(); + void ChangeColumnImage( const sal_uInt16 nColumnType ); + + }; + +} } // end of namespace ::sw::sidebar + +#endif diff --git a/sw/source/ui/sidebar/PagePropertyPanel.src b/sw/source/ui/sidebar/PagePropertyPanel.src new file mode 100644 index 000000000000..d03f2d1c432d --- /dev/null +++ b/sw/source/ui/sidebar/PagePropertyPanel.src @@ -0,0 +1,695 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include "PropertyPanel.hrc" +#include "PagePropertyPanel.hrc" +#include "helpid.h" + +// page property panel control +Control RID_PROPERTYPANEL_SWPAGE +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + Size = MAP_APPFONT( PROPERTYPAGE_WIDTH, PAGE_HEIGHT ); + HelpID = HID_PROPERTYPANEL_SWPAGE_SECTION; + Text = "Page"; + + FixedText FT_ORIENTATION + { + Pos = MAP_APPFONT ( FT_ORIENTATION_X, FT_ORIENTATION_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH, TEXT_HEIGHT) ; + Text [ en-US ] = "~Orientation:"; + }; + ToolBox TB_ORIENTATION + { + Pos = MAP_APPFONT (TBX_ORIENTATION_X, TBX_ORIENTATION_Y) ; + HelpID = HID_SWPAGE_ORIENTATION; + SVLook = TRUE ; + TabStop = TRUE ; + Text = "Orientation" ; + ItemList = + { + ToolBoxItem + { + HelpID = HID_SWPAGE_TBI_ORIENTATION; + Identifier = TBI_ORIENTATION ; + Text [ en-US ] = "Orientation" ; + DropDown = TRUE ; + }; + }; + }; + String STR_QHELP_TB_ORIENTATION + { + Text [ en-US ] = "Select the paper orientation - vertically (portrait) or horizontally (landscape) - for the current page style."; + }; + + FixedText FT_MARGIN + { + Pos = MAP_APPFONT ( FT_MARGIN_X, FT_MARGIN_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH + 50, TEXT_HEIGHT) ; + Text [ en-US ] = "~Margin:"; + }; + ToolBox TB_MARGIN + { + SVLook = TRUE ; + Pos = MAP_APPFONT (TBX_MARGIN_X, TBX_MARGIN_Y) ; + HelpID = HID_SWPAGE_MARGIN; + TabStop = TRUE ; + Text = "Margin" ; + ItemList = + { + ToolBoxItem + { + HelpID = HID_SWPAGE_TBI_MARGIN; + Identifier = TBI_MARGIN ; + Text [ en-US ] = "Margin" ; + DropDown = TRUE ; + }; + }; + }; + String STR_QHELP_TB_MARGIN + { + Text [ en-US ] = "Select the margin values for the current page style."; + }; + + FixedText FT_SIZE + { + Pos = MAP_APPFONT ( FT_SIZE_X, FT_SIZE_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH, TEXT_HEIGHT) ; + Text [ en-US ] = "~Size:"; + }; + ToolBox TB_SIZE + { + SVLook = TRUE ; + Pos = MAP_APPFONT ( TBX_SIZE_X , TBX_SIZE_Y ) ; + HelpID = HID_SWPAGE_SIZE; + TabStop = TRUE ; + Text = "Size" ; + ItemList = + { + ToolBoxItem + { + HelpID = HID_SWPAGE_TBI_SIZE; + Identifier = TBI_SIZE ; + Text [ en-US ] = "Size" ; + DropDown = TRUE ; + }; + }; + }; + String STR_QHELP_TB_SIZE + { + Text [ en-US ] = "Select a predefined paper size for the current page style."; + }; + + FixedText FT_COLUMN + { + Pos = MAP_APPFONT ( FT_COLUMN_X, FT_COLUMN_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH + 50, TEXT_HEIGHT) ; + Text [ en-US ] = "~Column:"; + }; + ToolBox TB_COLUMN + { + SVLook = TRUE ; + Pos = MAP_APPFONT ( TBX_COLUMN_X , TBX_COLUMN_Y ) ; + HelpID = HID_SWPAGE_COLUMN; + TabStop = TRUE ; + Text = "Column" ; + ItemList = + { + ToolBoxItem + { + HelpID = HID_SWPAGE_TBI_COLUMN; + Identifier = TBI_COLUMN; + Text [ en-US ] = "Column" ; + DropDown = TRUE ; + }; + }; + }; + String STR_QHELP_TB_COLUMN + { + Text [ en-US ] = "Select the layout and the number of columns for the current page style."; + }; + + Image IMG_PAGE_PORTRAIT + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/portraitcopy_24x24.png";}; + }; + Image IMG_PAGE_LANDSCAPE + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/Landscapecopy_24x24.png";}; + }; + Image IMG_PAGE_NARROW + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/format_L_narrow_24x24.png";}; + }; + Image IMG_PAGE_NORMAL + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/format_L_nomal_24x24.png";}; + }; + Image IMG_PAGE_WIDE + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/format_L_wide_24x24.png";}; + }; + Image IMG_PAGE_MIRRORED + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/format_L_mirror_24x24.png";}; + }; + Image IMG_PAGE_MARGIN_CUSTOM + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/format_L_copy_24x24.png";}; + }; + Image IMG_PAGE_NARROW_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/formatnarrow_24x24.png";}; + }; + Image IMG_PAGE_NORMAL_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/formatnormal_24x24.png";}; + }; + Image IMG_PAGE_WIDE_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/formatwide_24x24.png";}; + }; + Image IMG_PAGE_MIRRORED_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/formatmirror_24x24.png";}; + }; + Image IMG_PAGE_MARGIN_CUSTOM_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/formatcopy_24x24.png";}; + }; + Image IMG_PAGE_A3 + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsize_L_A3_24x24.png";}; + }; + Image IMG_PAGE_A4 + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsize_L_A4_24x24.png";}; + }; + Image IMG_PAGE_A5 + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsize_L_A5_24x24.png";}; + }; + Image IMG_PAGE_B4 + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsize_L_B4_24x24.png";}; + }; + Image IMG_PAGE_B5 + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsize_L_B5_24x24.png";}; + }; + Image IMG_PAGE_C5 + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsize_L_C5_24x24.png";}; + }; + Image IMG_PAGE_LETTER + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsize_L_copy_24x24.png";}; + }; + Image IMG_PAGE_LEGAL + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsize_L_copy_24x24.png";}; + }; + Image IMG_PAGE_SIZE_NONE + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsize_L_copy_24x24.png";}; + }; + Image IMG_PAGE_A3_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsizeA3_24x24.png";}; + }; + Image IMG_PAGE_A4_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsizeA4_24x24.png";}; + }; + Image IMG_PAGE_A5_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsizeA5_24x24.png";}; + }; + Image IMG_PAGE_B4_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsizeB4_24x24.png";}; + }; + Image IMG_PAGE_B5_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsizeB5_24x24.png";}; + }; + Image IMG_PAGE_C5_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsizeC5_24x24.png";}; + }; + Image IMG_PAGE_LETTER_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsizecopy_24x24.png";}; + }; + Image IMG_PAGE_LEGAL_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsizecopy_24x24.png";}; + }; + Image IMG_PAGE_SIZE_NONE_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/documentsizecopy_24x24.png";}; + }; + Image IMG_PAGE_COLUMN_1 + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column_L_1_24x24.png";}; + }; + Image IMG_PAGE_COLUMN_2 + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column_L_2_24x24.png";}; + }; + Image IMG_PAGE_COLUMN_3 + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column_L_3_24x24.png";}; + }; + Image IMG_PAGE_COLUMN_LEFT + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column_L_left_24x24.png";}; + }; + Image IMG_PAGE_COLUMN_RIGHT + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column_L_right_24x24.png";}; + }; + Image IMG_PAGE_COLUMN_NONE + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column_L_copy_24x24.png";}; + }; + Image IMG_PAGE_COLUMN_1_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column1_24x24.png";}; + }; + Image IMG_PAGE_COLUMN_2_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column2_24x24.png";}; + }; + Image IMG_PAGE_COLUMN_3_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column3_24x24.png";}; + }; + Image IMG_PAGE_COLUMN_LEFT_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/columnleft_24x24.png";}; + }; + Image IMG_PAGE_COLUMN_RIGHT_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/columnright_24x24.png";}; + }; + Image IMG_PAGE_COLUMN_NONE_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/columncopy_24x24.png";}; + }; +}; + +// popup for page orientation attribute +Control RID_POPUP_SWPAGE_ORIENTATION +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + Size = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL * 2 + POPUP_BORDER_WIDTH + VS_WIDTH, ITEM_HEIGHT*2 + POPUPPANEL_MARGIN_SMALL*2 ); + + Control VS_ORIENTATION + { + Pos = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL + OFFSET_X, POPUPPANEL_MARGIN_SMALL + OFFSET_Y); + Size = MAP_APPFONT ( VS_WIDTH , ITEM_HEIGHT*2); + HelpID = HID_SWPAGE_VS_ORIENTATION; + TabStop = TRUE ; + Text = "Orientation"; + }; + Image IMG_PORTRAIT + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/portraitcopy_24x24.png";}; + }; + Image IMG_LANDSCAPE + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/Landscapecopy_24x24.png";}; + }; + String STR_PORTRAIT + { + Text [ en-US ] = "Portrait"; + }; + String STR_LANDSCAPE + { + Text [ en-US ] = "Landscape"; + }; +}; + +// popup for page style's margin attributes +Control RID_POPUP_SWPAGE_MARGIN +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + Size = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL * 2 + POPUP_BORDER_WIDTH + VS_WIDTH, MARGIN_PANEL_HEIGHT ); + + Control VS_MARGIN + { + Pos = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL + OFFSET_X, POPUPPANEL_MARGIN_SMALL + OFFSET_Y ); + Size = MAP_APPFONT ( VS_WIDTH , ITEM_HEIGHT*5); + HelpID = HID_SWPAGE_VS_MARGIN; + TabStop = TRUE ; + Text = "Margin"; + }; + FixedText FT_CUSTOM + { + Pos = MAP_APPFONT ( FT_CUSTOM_X, FT_CUSTOM_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH + 30, TEXT_HEIGHT) ; + Text [ en-US ] = "Custom:"; + }; + FixedText FT_LEFT + { + Pos = MAP_APPFONT ( FT_X, FT_LEFT_Y ); + Size = MAP_APPFONT ( 25, TEXT_HEIGHT) ; + Text [ en-US ] = "~Left:"; + }; + FixedText FT_INNER + { + Pos = MAP_APPFONT ( FT_X, FT_LEFT_Y ); + Size = MAP_APPFONT ( 25, TEXT_HEIGHT) ; + Text [ en-US ] = "I~nner:"; + }; + MetricField MF_SWLEFT_MARGIN + { + Border = TRUE; + Pos = MAP_APPFONT ( MF_X , LEFT_MF_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH - 12, MBOX_HEIGHT ); + HelpID = HID_SWPAGE_LEFT_MARGIN; + Left = TRUE; + Repeat = TRUE; + Spin = TRUE; + Maximum = 9999; + DecimalDigits = 2; + Unit = FUNIT_CM; + Last = 9999; + SpinSize = 10; + }; + FixedText FT_RIGHT + { + Pos = MAP_APPFONT ( FT_X, FT_RIGHT_Y ); + Size = MAP_APPFONT ( 25, TEXT_HEIGHT) ; + Text [ en-US ] = "~Right:"; + }; + FixedText FT_OUTER + { + Pos = MAP_APPFONT ( FT_X, FT_RIGHT_Y ); + Size = MAP_APPFONT ( 25, TEXT_HEIGHT) ; + Text [ en-US ] = "O~uter:"; + }; + MetricField MF_SWRIGHT_MARGIN + { + Border = TRUE; + Pos = MAP_APPFONT ( MF_X , RIGHT_MF_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH - 12, MBOX_HEIGHT ); + HelpID = HID_SWPAGE_RIGHT_MARGIN; + Left = TRUE; + Repeat = TRUE; + Spin = TRUE; + Maximum = 9999; + DecimalDigits = 2; + Unit = FUNIT_CM; + Last = 9999; + SpinSize = 10; + }; + FixedText FT_TOP + { + Pos = MAP_APPFONT ( FT_X, FT_TOP_Y ); + Size = MAP_APPFONT ( 25, TEXT_HEIGHT) ; + Text [ en-US ] = "~Top:"; + }; + MetricField MF_SWTOP_MARGIN + { + Border = TRUE; + Pos = MAP_APPFONT ( MF_X , TOP_MF_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH - 12, MBOX_HEIGHT ); + HelpID = HID_SWPAGE_TOP_MARGIN; + Left = TRUE; + Repeat = TRUE; + Spin = TRUE; + Maximum = 9999; + DecimalDigits = 2; + Unit = FUNIT_CM; + Last = 9999; + SpinSize = 10; + }; + FixedText FT_BOTTOM + { + Pos = MAP_APPFONT ( FT_X, FT_BOTTOM_Y ); + Size = MAP_APPFONT ( 25, TEXT_HEIGHT) ; + Text [ en-US ] = "~Bottom:"; + }; + MetricField MF_SWBOTTOM_MARGIN + { + Border = TRUE; + Pos = MAP_APPFONT ( MF_X , BOTTOM_MF_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH - 12, MBOX_HEIGHT ); + HelpID = HID_SWPAGE_BOTTOM_MARGIN; + Left = TRUE; + Repeat = TRUE; + Spin = TRUE; + Maximum = 9999; + DecimalDigits = 2; + Unit = FUNIT_CM; + Last = 9999; + SpinSize = 10; + }; + MetricField FLD_WIDTH_HEIGHT + { + Border = TRUE; + Left = TRUE; + Repeat = TRUE; + Spin = TRUE; + Maximum = 9999; + DecimalDigits = 2; + Unit = FUNIT_CM; + Last = 9999; + SpinSize = 10; + }; + + Image IMG_NARROW + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/format_L_narrow_24x24.png";}; + }; + Image IMG_NORMAL + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/format_L_nomal_24x24.png";}; + }; + Image IMG_WIDE + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/format_L_wide_24x24.png";}; + }; + Image IMG_MIRRORED + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/format_L_mirror_24x24.png";}; + }; + Image IMG_NARROW_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/formatnarrow_24x24.png";}; + }; + Image IMG_NORMAL_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/formatnormal_24x24.png";}; + }; + Image IMG_WIDE_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/formatwide_24x24.png";}; + }; + Image IMG_MIRRORED_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/formatmirror_24x24.png";}; + }; + Image IMG_CUSTOM + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/last_custom_common.png";}; + }; + Image IMG_CUSTOM_DIS + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/last_custom_common_grey.png";}; + }; + String STR_LCVALUE + { + Text [ en-US ] = "Last Custom Values"; + }; + String STR_NARROW + { + Text [ en-US ] = "Narrow"; + }; + String STR_NORMAL + { + Text [ en-US ] = "Normal"; + }; + String STR_WIDE + { + Text [ en-US ] = "Wide"; + }; + String STR_MIRRORED + { + Text [ en-US ] = "Mirrored"; + }; + String STR_MARGIN_TOOLTIP_LEFT + { + Text [ en-US ] = "Left: "; + }; + String STR_MARGIN_TOOLTIP_RIGHT + { + Text [ en-US ] = ". Right: "; + }; + String STR_MARGIN_TOOLTIP_INNER + { + Text [ en-US ] = "Inner: "; + }; + String STR_MARGIN_TOOLTIP_OUTER + { + Text [ en-US ] = ". Outer: "; + }; + String STR_MARGIN_TOOLTIP_TOP + { + Text [ en-US ] = ". Top: "; + }; + String STR_MARGIN_TOOLTIP_BOT + { + Text [ en-US ] = ". Bottom: "; + }; +}; + +// popup for page style's page size +Control RID_POPUP_SWPAGE_SIZE +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + Size = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL * 2 + POPUP_BORDER_WIDTH + VS_WIDTH + 22, ITEM_HEIGHT2*8 + POPUPPANEL_MARGIN_SMALL*2 + CONTROL_SPACING_VERTICAL + 15 ); + + Control VS_SIZE + { + Pos = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL + OFFSET_X, POPUPPANEL_MARGIN_SMALL + OFFSET_Y); + Size = MAP_APPFONT ( VS_WIDTH + 22 , ITEM_HEIGHT2*8); + HelpID = HID_SWPAGE_VS_SIZE; + TabStop = TRUE ; + Text = "Size"; + }; + PushButton CB_SIZE_MORE + { + Pos = MAP_APPFONT ( POPUPPANEL_MARGIN_SMALL + 2*OFFSET_X, POPUPPANEL_MARGIN_SMALL + 2*OFFSET_Y + ITEM_HEIGHT2*8 ) ; + Size = MAP_APPFONT ( VS_WIDTH - 2 + 22, 15 ) ; + HelpID = HID_SWPAGE_SIZE_MORE; + TabStop = TRUE ; + Text [ en-US ] = "~More Options"; + QuickHelpText [ en-US ] = "More Options" ; + }; + MetricField FLD_WIDTH_HEIGHT + { + Border = TRUE; + Left = TRUE; + Repeat = TRUE; + Spin = TRUE; + Maximum = 9999; + DecimalDigits = 2; + Unit = FUNIT_CM; + Last = 9999; + SpinSize = 10; + }; +}; + +// popup for page style's column attribute +Control RID_POPUP_SWPAGE_COLUMN +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + Size = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL * 2 + POPUP_BORDER_WIDTH + VS_WIDTH - 15, ITEM_HEIGHT*5 + POPUPPANEL_MARGIN_SMALL*2 + CONTROL_SPACING_VERTICAL + 15 ); + + Control VS_COLUMN + { + Pos = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL + OFFSET_X, POPUPPANEL_MARGIN_SMALL + OFFSET_Y); + Size = MAP_APPFONT ( VS_WIDTH -15 , ITEM_HEIGHT*5); + HelpID = HID_SWPAGE_VS_COLUMN; + TabStop = TRUE ; + Text = "Column"; + }; + PushButton CB_COLUMN_MORE + { + Pos = MAP_APPFONT ( POPUPPANEL_MARGIN_SMALL + 2*OFFSET_X, POPUPPANEL_MARGIN_SMALL + 2*OFFSET_Y + ITEM_HEIGHT*5 ) ; + Size = MAP_APPFONT ( VS_WIDTH - 2 - 15, 15 ) ; + HelpID = HID_SWPAGE_COLUMN_MORE; + TabStop = TRUE ; + Text [ en-US ] = "~More Options"; + QuickHelpText [ en-US ] = "More Options" ; + }; + Image IMG_ONE + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column_L_1_24x24.png";}; + }; + Image IMG_TWO + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column_L_2_24x24.png";}; + }; + Image IMG_THREE + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column_L_3_24x24.png";}; + }; + Image IMG_LEFT + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column_L_left_24x24.png";}; + }; + Image IMG_RIGHT + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column_L_right_24x24.png";}; + }; + Image IMG_ONE_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column1_24x24.png";}; + }; + Image IMG_TWO_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column2_24x24.png";}; + }; + Image IMG_THREE_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/column3_24x24.png";}; + }; + Image IMG_LEFT_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/columnleft_24x24.png";}; + }; + Image IMG_RIGHT_L + { + ImageBitmap = Bitmap{File = "sidebar/pageproppanel/columnright_24x24.png";}; + }; + String STR_ONE + { + Text [ en-US ] = "1 Column"; + }; + String STR_TWO + { + Text [ en-US ] = "2 Columns"; + }; + String STR_THREE + { + Text [ en-US ] = "3 Columns"; + }; + String STR_LEFT + { + Text [ en-US ] = "Left"; + }; + String STR_RIGHT + { + Text [ en-US ] = "Right"; + }; +}; diff --git a/sw/source/ui/sidebar/PageSizeControl.cxx b/sw/source/ui/sidebar/PageSizeControl.cxx new file mode 100644 index 000000000000..1f6cfd8487ce --- /dev/null +++ b/sw/source/ui/sidebar/PageSizeControl.cxx @@ -0,0 +1,181 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "PageSizeControl.hxx" +#include "PagePropertyPanel.hxx" +#include "PagePropertyPanel.hrc" + +#include <cmdid.h> +#include <swtypes.hxx> + +#include <svx/sidebar/ValueSetWithTextControl.hxx> + +#include <tools/inetmime.hxx> +#include <editeng/paperinf.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> + + +namespace sw { namespace sidebar { + +PageSizeControl::PageSizeControl( + Window* pParent, + PagePropertyPanel& rPanel, + const Paper ePaper, + const sal_Bool bLandscape, + const FieldUnit eFUnit ) + : ::svx::sidebar::PopupControl( pParent, SW_RES(RID_POPUP_SWPAGE_SIZE) ) + , mpSizeValueSet( new ::svx::sidebar::ValueSetWithTextControl( ::svx::sidebar::ValueSetWithTextControl::TEXT_TEXT, this, SW_RES(VS_SIZE) ) ) + , maMoreButton( this, SW_RES(CB_SIZE_MORE) ) + , maWidthHeightField( this, SW_RES(FLD_WIDTH_HEIGHT) ) + , mePaper( ePaper ) + , maPaperList() + , mrPagePropPanel(rPanel) +{ + maWidthHeightField.Hide(); + SetFieldUnit( maWidthHeightField, eFUnit ); + + maPaperList.push_back( PAPER_A3 ); + maPaperList.push_back( PAPER_A4 ); + maPaperList.push_back( PAPER_A5 ); + maPaperList.push_back( PAPER_B4_ISO ); + maPaperList.push_back( PAPER_B5_ISO ); + maPaperList.push_back( PAPER_ENV_C5 ); + maPaperList.push_back( PAPER_LETTER ); + maPaperList.push_back( PAPER_LEGAL ); + + mpSizeValueSet->SetStyle( mpSizeValueSet->GetStyle() | WB_3DLOOK | WB_NO_DIRECTSELECT ); + mpSizeValueSet->SetColor( GetSettings().GetStyleSettings().GetMenuColor() ); + + sal_uInt16 nSelectedItem = 0; + { + XubString aMetricStr; + { + const XubString aText = maWidthHeightField.GetText(); + for (short i = aText.Len() - 1; i >= 0; i--) + { + sal_Unicode c = aText.GetChar(i); + if ( INetMIME::isAlpha(c) || (c == '\'') || (c == '\"') || (c == '%') ) + { + aMetricStr.Insert(c, 0); + } + else + { + if (aMetricStr.Len()) + { + break; + } + } + } + } + + const LocaleDataWrapper& localeDataWrapper = maWidthHeightField.GetLocaleDataWrapper(); + String WidthStr; + String HeightStr; + String ItemText2; + for ( ::std::vector< Paper >::size_type nPaperIdx = 0; + nPaperIdx < maPaperList.size(); + ++nPaperIdx ) + { + Size aPaperSize = SvxPaperInfo::GetPaperSize( maPaperList[ nPaperIdx ] ); + if ( bLandscape ) + { + Swap( aPaperSize ); + } + maWidthHeightField.SetValue( maWidthHeightField.Normalize( aPaperSize.Width() ), FUNIT_TWIP ); + WidthStr = localeDataWrapper.getNum( + maWidthHeightField.GetValue(), + maWidthHeightField.GetDecimalDigits(), + maWidthHeightField.IsUseThousandSep(), + maWidthHeightField.IsShowTrailingZeros() ); + + maWidthHeightField.SetValue( maWidthHeightField.Normalize( aPaperSize.Height() ), FUNIT_TWIP); + HeightStr = localeDataWrapper.getNum( + maWidthHeightField.GetValue(), + maWidthHeightField.GetDecimalDigits(), + maWidthHeightField.IsUseThousandSep(), + maWidthHeightField.IsShowTrailingZeros() ); + + ItemText2 = HeightStr; + ItemText2 += OUString(" x "); + ItemText2 += WidthStr; + ItemText2 += OUString(" "); + ItemText2 += aMetricStr; + + mpSizeValueSet->AddItem( + SvxPaperInfo::GetName( maPaperList[ nPaperIdx ] ), + ItemText2, + 0 ); + + if ( maPaperList[ nPaperIdx ] == mePaper ) + { + nSelectedItem = nPaperIdx + 1; + } + } + } + + mpSizeValueSet->SetNoSelection(); + mpSizeValueSet->SetSelectHdl( LINK(this, PageSizeControl,ImplSizeHdl ) ); + mpSizeValueSet->Show(); + + mpSizeValueSet->SelectItem( nSelectedItem ); + mpSizeValueSet->Format(); + mpSizeValueSet->StartSelection(); + + maMoreButton.SetClickHdl( LINK( this, PageSizeControl, MoreButtonClickHdl_Impl ) ); + maMoreButton.GrabFocus(); + + FreeResource(); +} + + +PageSizeControl::~PageSizeControl(void) +{ + delete mpSizeValueSet; +} + + +IMPL_LINK(PageSizeControl, ImplSizeHdl, void *, pControl) +{ + mpSizeValueSet->SetNoSelection(); + if ( pControl == mpSizeValueSet ) + { + const sal_uInt16 nSelectedPaper = mpSizeValueSet->GetSelectItemId(); + const Paper ePaper = maPaperList[nSelectedPaper - 1]; + if ( ePaper != mePaper ) + { + mePaper = ePaper; + mrPagePropPanel.ExecuteSizeChange( mePaper ); + } + } + + mrPagePropPanel.ClosePageSizePopup(); + return 0; +} + +IMPL_LINK(PageSizeControl, MoreButtonClickHdl_Impl, void *, EMPTYARG) +{ + mrPagePropPanel.GetBindings()->GetDispatcher()->Execute( FN_FORMAT_PAGE_SETTING_DLG, SFX_CALLMODE_ASYNCHRON ); + + mrPagePropPanel.ClosePageSizePopup(); + return 0; +} + + +} } // end of namespace sw::sidebar + diff --git a/sw/source/ui/sidebar/PageSizeControl.hxx b/sw/source/ui/sidebar/PageSizeControl.hxx new file mode 100644 index 000000000000..b1afe6ad31f3 --- /dev/null +++ b/sw/source/ui/sidebar/PageSizeControl.hxx @@ -0,0 +1,69 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SW_SIDEBAR_PAGE_SIZE_CONTROL_HXX_ +#define _SW_SIDEBAR_PAGE_SIZE_CONTROL_HXX_ + +#include <svx/sidebar/PopupControl.hxx> + +#include <i18nutil/paper.hxx> + +#include <vcl/button.hxx> +#include <vcl/field.hxx> +#include <svtools/unitconv.hxx> + +#include <vector> + +namespace svx { namespace sidebar { + class ValueSetWithTextControl; +} } + +namespace sw { namespace sidebar { + +class PagePropertyPanel; + + +class PageSizeControl + : public ::svx::sidebar::PopupControl +{ +public: + PageSizeControl( + Window* pParent, + PagePropertyPanel& rPanel, + const Paper ePaper, + const sal_Bool bLandscape, + const FieldUnit eFUnit ); + ~PageSizeControl(void); + +private: + ::svx::sidebar::ValueSetWithTextControl* mpSizeValueSet; + PushButton maMoreButton; + // hidden metric field + MetricField maWidthHeightField; + + Paper mePaper; + ::std::vector< Paper > maPaperList; + + PagePropertyPanel& mrPagePropPanel; + + DECL_LINK(ImplSizeHdl, void*); + DECL_LINK(MoreButtonClickHdl_Impl, void*); +}; + +} } // end of namespace sw::sidebar + +#endif diff --git a/sw/source/ui/sidebar/PropertyPanel.hrc b/sw/source/ui/sidebar/PropertyPanel.hrc new file mode 100644 index 000000000000..564f567a5e3d --- /dev/null +++ b/sw/source/ui/sidebar/PropertyPanel.hrc @@ -0,0 +1,32 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SW_PROPERTY_PANEL_HRC +#define _SW_PROPERTY_PANEL_HRC + +#include "rcid.hrc" + +#define RID_PROPERTYPANEL_SWOBJWRAP_PAGE (RC_PROPERTYPANEL_BEGIN + 1) +#define RID_PROPERTYPANEL_SWPAGE (RC_PROPERTYPANEL_BEGIN + 2) +#define RID_POPUP_SWPAGE_MARGIN (RC_PROPERTYPANEL_BEGIN + 3) +#define RID_POPUP_SWPAGE_ORIENTATION (RC_PROPERTYPANEL_BEGIN + 4) +#define RID_POPUP_SWPAGE_COLUMN (RC_PROPERTYPANEL_BEGIN + 5) +#define RID_POPUP_SWPAGE_SIZE (RC_PROPERTYPANEL_BEGIN + 6) + +#define PROPERTY_PANEL_END RID_POPUP_SWPAGE_SIZE + +#endif diff --git a/sw/source/ui/sidebar/SwPanelFactory.cxx b/sw/source/ui/sidebar/SwPanelFactory.cxx new file mode 100644 index 000000000000..620b52b0f795 --- /dev/null +++ b/sw/source/ui/sidebar/SwPanelFactory.cxx @@ -0,0 +1,147 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "SwPanelFactory.hxx" + +#include <PagePropertyPanel.hxx> +#include <WrapPropertyPanel.hxx> +#include <navipi.hxx> + +#include <sfx2/sidebar/SidebarPanelBase.hxx> +#include <sfx2/sfxbasecontroller.hxx> +#include <toolkit/helper/vclunohelper.hxx> +#include <vcl/window.hxx> +#include <rtl/ref.hxx> +#include <comphelper/namedvaluecollection.hxx> + +#include <boost/bind.hpp> + + +using namespace css; +using namespace cssu; +using ::rtl::OUString; + + +namespace sw { namespace sidebar { + +#define A2S(s) ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)) +#define IMPLEMENTATION_NAME "org.apache.openoffice.comp.sw.sidebar.SwPanelFactory" +#define SERVICE_NAME "com.sun.star.ui.UIElementFactory" + + +::rtl::OUString SAL_CALL SwPanelFactory::getImplementationName (void) +{ + return A2S(IMPLEMENTATION_NAME); +} + + +cssu::Reference<cssu::XInterface> SAL_CALL SwPanelFactory::createInstance( + const uno::Reference<lang::XMultiServiceFactory>& ) +{ + ::rtl::Reference<SwPanelFactory> pPanelFactory (new SwPanelFactory()); + cssu::Reference<cssu::XInterface> xService (static_cast<XWeak*>(pPanelFactory.get()), cssu::UNO_QUERY); + return xService; +} + + +cssu::Sequence<OUString> SAL_CALL SwPanelFactory::getSupportedServiceNames (void) +{ + cssu::Sequence<OUString> aServiceNames (1); + aServiceNames[0] = A2S(SERVICE_NAME); + return aServiceNames; + +} + + +SwPanelFactory::SwPanelFactory (void) + : PanelFactoryInterfaceBase(m_aMutex) +{ +} + + +SwPanelFactory::~SwPanelFactory (void) +{ +} + + +Reference<ui::XUIElement> SAL_CALL SwPanelFactory::createUIElement ( + const ::rtl::OUString& rsResourceURL, + const ::cssu::Sequence<css::beans::PropertyValue>& rArguments) + throw( + container::NoSuchElementException, + lang::IllegalArgumentException, + RuntimeException) +{ + Reference<ui::XUIElement> xElement; + + const ::comphelper::NamedValueCollection aArguments (rArguments); + Reference<frame::XFrame> xFrame (aArguments.getOrDefault("Frame", Reference<frame::XFrame>())); + Reference<awt::XWindow> xParentWindow (aArguments.getOrDefault("ParentWindow", Reference<awt::XWindow>())); + const sal_uInt64 nBindingsValue (aArguments.getOrDefault("SfxBindings", sal_uInt64(0))); + SfxBindings* pBindings = reinterpret_cast<SfxBindings*>(nBindingsValue); + + ::Window* pParentWindow = VCLUnoHelper::GetWindow(xParentWindow); + if ( ! xParentWindow.is() || pParentWindow==NULL) + throw RuntimeException( + A2S("PanelFactory::createUIElement called without ParentWindow"), + NULL); + if ( ! xFrame.is()) + throw RuntimeException( + A2S("PanelFactory::createUIElement called without Frame"), + NULL); + if (pBindings == NULL) + throw RuntimeException( + A2S("PanelFactory::createUIElement called without SfxBindings"), + NULL); + +#define DoesResourceEndWith(s) rsResourceURL.endsWithAsciiL(s,strlen(s)) + if (DoesResourceEndWith("/PagePropertyPanel")) + { + PagePropertyPanel* pPanel = PagePropertyPanel::Create( pParentWindow, pBindings ); + xElement = sfx2::sidebar::SidebarPanelBase::Create( + rsResourceURL, + xFrame, + pPanel, + ui::LayoutSize(-1,-1,-1)); + } + else if (DoesResourceEndWith("/WrapPropertyPanel")) + { + WrapPropertyPanel* pPanel = WrapPropertyPanel::Create( pParentWindow, xFrame, pBindings ); + xElement = sfx2::sidebar::SidebarPanelBase::Create( + rsResourceURL, + xFrame, + pPanel, + ui::LayoutSize(-1,-1,-1)); + } + else if (DoesResourceEndWith("/NavigatorPanel")) + { + Window* pPanel = new SwNavigationPI(pBindings, NULL, pParentWindow); + xElement = sfx2::sidebar::SidebarPanelBase::Create( + rsResourceURL, + xFrame, + pPanel, + ui::LayoutSize(0,-1,-1)); + } +#undef DoesResourceEndWith + + return xElement; +} + +} } // end of namespace sw::sidebar + +// eof diff --git a/sw/source/ui/sidebar/WrapPropertyPanel.cxx b/sw/source/ui/sidebar/WrapPropertyPanel.cxx new file mode 100644 index 000000000000..d3d9a833d78f --- /dev/null +++ b/sw/source/ui/sidebar/WrapPropertyPanel.cxx @@ -0,0 +1,239 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "WrapPropertyPanel.hxx" +#include "WrapPropertyPanel.hrc" +#include "PropertyPanel.hrc" + +#include <cmdid.h> +#include <swtypes.hxx> + +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/sidebar/ControlFactory.hxx> +#include <sfx2/imagemgr.hxx> +#include <svl/eitem.hxx> +#include <vcl/svapp.hxx> + +#include "com/sun/star/lang/IllegalArgumentException.hpp" + +#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) + + +namespace sw { namespace sidebar { + +WrapPropertyPanel* WrapPropertyPanel::Create ( + Window* pParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame, + SfxBindings* pBindings) +{ + if (pParent == NULL) + throw ::com::sun::star::lang::IllegalArgumentException(A2S("no parent Window given to PagePropertyPanel::Create"), NULL, 0); + if ( ! rxFrame.is()) + throw ::com::sun::star::lang::IllegalArgumentException(A2S("no XFrame given to PagePropertyPanel::Create"), NULL, 1); + if (pBindings == NULL) + throw ::com::sun::star::lang::IllegalArgumentException(A2S("no SfxBindings given to PagePropertyPanel::Create"), NULL, 2); + + return new WrapPropertyPanel( + pParent, + rxFrame, + pBindings); +} + + +WrapPropertyPanel::WrapPropertyPanel( + Window* pParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame, + SfxBindings* pBindings ) + : Control(pParent, SW_RES(RID_PROPERTYPANEL_SWOBJWRAP_PAGE)) + , mxFrame( rxFrame ) + , mpBindings(pBindings) + // visible controls + , mpRBNoWrap( ::sfx2::sidebar::ControlFactory::CreateCustomImageRadionButton( this, SW_RES(RB_NO_WRAP) ) ) + , mpRBWrapLeft( ::sfx2::sidebar::ControlFactory::CreateCustomImageRadionButton( this, SW_RES(RB_WRAP_LEFT) ) ) + , mpRBWrapRight( ::sfx2::sidebar::ControlFactory::CreateCustomImageRadionButton( this, SW_RES(RB_WRAP_RIGHT) ) ) + , mpRBWrapParallel( ::sfx2::sidebar::ControlFactory::CreateCustomImageRadionButton( this, SW_RES(RB_WRAP_PARALLEL) ) ) + , mpRBWrapThrough( ::sfx2::sidebar::ControlFactory::CreateCustomImageRadionButton( this, SW_RES(RB_WRAP_THROUGH) ) ) + , mpRBIdealWrap( ::sfx2::sidebar::ControlFactory::CreateCustomImageRadionButton( this, SW_RES(RB_WRAP_IDEAL) ) ) + // resources + , aWrapIL(6,2) + // controller items + , maSwNoWrapControl(FN_FRAME_NOWRAP, *pBindings, *this) + , maSwWrapLeftControl(FN_FRAME_WRAP, *pBindings, *this) + , maSwWrapRightControl(FN_FRAME_WRAP_RIGHT, *pBindings, *this) + , maSwWrapParallelControl(FN_FRAME_WRAP_LEFT, *pBindings, *this) + , maSwWrapThroughControl(FN_FRAME_WRAPTHRU, *pBindings, *this) + , maSwWrapIdealControl(FN_FRAME_WRAP_IDEAL, *pBindings, *this) +{ + Initialize(); + FreeResource(); +} + + +WrapPropertyPanel::~WrapPropertyPanel() +{ +} + + +void WrapPropertyPanel::Initialize() +{ + Link aLink = LINK(this, WrapPropertyPanel, WrapTypeHdl); + mpRBNoWrap->SetClickHdl(aLink); + mpRBWrapLeft->SetClickHdl(aLink); + mpRBWrapRight->SetClickHdl(aLink); + mpRBWrapParallel->SetClickHdl(aLink); + mpRBWrapThrough->SetClickHdl(aLink); + mpRBIdealWrap->SetClickHdl(aLink); + + aWrapIL.AddImage( IMG_NONE, + ::GetImage( mxFrame, A2S(".uno:WrapOff"), sal_False ) ); + aWrapIL.AddImage( IMG_LEFT, + ::GetImage( mxFrame, A2S(".uno:WrapLeft"), sal_False ) ); + aWrapIL.AddImage( IMG_RIGHT, + ::GetImage( mxFrame, A2S(".uno:WrapRight"), sal_False ) ); + aWrapIL.AddImage( IMG_PARALLEL, + ::GetImage( mxFrame, A2S(".uno:WrapOn"), sal_False ) ); + aWrapIL.AddImage( IMG_THROUGH, + ::GetImage( mxFrame, A2S(".uno:WrapThrough"), sal_False ) ); + aWrapIL.AddImage( IMG_IDEAL, + ::GetImage( mxFrame, A2S(".uno:WrapIdeal"), sal_False ) ); + + mpRBNoWrap->SetModeRadioImage( aWrapIL.GetImage(IMG_NONE) ); + if ( Application::GetSettings().GetLayoutRTL() ) + { + mpRBWrapLeft->SetModeRadioImage( aWrapIL.GetImage(IMG_RIGHT) ); + mpRBWrapRight->SetModeRadioImage( aWrapIL.GetImage(IMG_LEFT) ); + } + else + { + mpRBWrapLeft->SetModeRadioImage( aWrapIL.GetImage(IMG_LEFT) ); + mpRBWrapRight->SetModeRadioImage( aWrapIL.GetImage(IMG_RIGHT) ); + } + mpRBWrapParallel->SetModeRadioImage( aWrapIL.GetImage(IMG_PARALLEL) ); + mpRBWrapThrough->SetModeRadioImage( aWrapIL.GetImage(IMG_THROUGH) ); + mpRBIdealWrap->SetModeRadioImage( aWrapIL.GetImage(IMG_IDEAL) ); + + mpRBNoWrap->SetAccessibleName(mpRBNoWrap->GetQuickHelpText()); + mpRBWrapLeft->SetAccessibleName(mpRBWrapLeft->GetQuickHelpText()); + mpRBWrapRight->SetAccessibleName(mpRBWrapRight->GetQuickHelpText()); + mpRBWrapParallel->SetAccessibleName(mpRBWrapParallel->GetQuickHelpText()); + mpRBWrapThrough->SetAccessibleName(mpRBWrapThrough->GetQuickHelpText()); + mpRBIdealWrap->SetAccessibleName(mpRBIdealWrap->GetQuickHelpText()); + + mpBindings->Update( FN_FRAME_NOWRAP ); + mpBindings->Update( FN_FRAME_WRAP ); + mpBindings->Update( FN_FRAME_WRAP_RIGHT ); + mpBindings->Update( FN_FRAME_WRAP_LEFT ); + mpBindings->Update( FN_FRAME_WRAPTHRU ); + mpBindings->Update( FN_FRAME_WRAP_IDEAL ); +} + + +IMPL_LINK(WrapPropertyPanel, WrapTypeHdl, void *, EMPTYARG) +{ + sal_uInt16 nSlot = 0; + if ( mpRBWrapLeft->IsChecked() ) + { + nSlot = FN_FRAME_WRAP_LEFT; + } + else if( mpRBWrapRight->IsChecked() ) + { + nSlot = FN_FRAME_WRAP_RIGHT; + } + else if ( mpRBWrapParallel->IsChecked() ) + { + nSlot = FN_FRAME_WRAP; + } + else if( mpRBWrapThrough->IsChecked() ) + { + nSlot = FN_FRAME_WRAPTHRU; + } + else if( mpRBIdealWrap->IsChecked() ) + { + nSlot = FN_FRAME_WRAP_IDEAL; + } + else + { + nSlot = FN_FRAME_NOWRAP; + } + SfxBoolItem bStateItem( nSlot, sal_True ); + mpBindings->GetDispatcher()->Execute( nSlot, SFX_CALLMODE_RECORD, &bStateItem, 0L ); + + return 0; +} + + +void WrapPropertyPanel::NotifyItemUpdate( + const sal_uInt16 nSId, + const SfxItemState eState, + const SfxPoolItem* pState ) +{ + if ( eState == SFX_ITEM_AVAILABLE && + pState->ISA(SfxBoolItem) ) + { + //Set Radio Button enable + mpRBNoWrap->Enable(true); + mpRBWrapLeft->Enable(true); + mpRBWrapRight->Enable(true); + mpRBWrapParallel->Enable(true); + mpRBWrapThrough->Enable(true); + mpRBIdealWrap->Enable(true); + + const SfxBoolItem* pBoolItem = static_cast< const SfxBoolItem* >( pState ); + switch( nSId ) + { + case FN_FRAME_WRAP_RIGHT: + mpRBWrapRight->Check( pBoolItem->GetValue() ); + break; + case FN_FRAME_WRAP_LEFT: + mpRBWrapLeft->Check( pBoolItem->GetValue() ); + break; + case FN_FRAME_WRAPTHRU: + mpRBWrapThrough->Check( pBoolItem->GetValue() ); + break; + case FN_FRAME_WRAP_IDEAL: + mpRBIdealWrap->Check( pBoolItem->GetValue() ); + break; + case FN_FRAME_WRAP: + mpRBWrapParallel->Check( pBoolItem->GetValue() ); + break; + case FN_FRAME_NOWRAP: + default: + mpRBNoWrap->Check( pBoolItem->GetValue() ); + break; + } + } + else + { + mpRBNoWrap->Enable(false); + mpRBWrapLeft->Enable(false); + mpRBWrapRight->Enable(false); + mpRBWrapParallel->Enable(false); + mpRBWrapThrough->Enable(false); + mpRBIdealWrap->Enable(false); + + mpRBNoWrap->Check( sal_False ); + mpRBWrapLeft->Check( sal_False ); + mpRBWrapRight->Check( sal_False ); + mpRBWrapParallel->Check( sal_False ); + mpRBWrapThrough->Check( sal_False ); + mpRBIdealWrap->Check( sal_False ); + } +} + +} } // end of namespace ::sw::sidebar diff --git a/sw/source/ui/sidebar/WrapPropertyPanel.hrc b/sw/source/ui/sidebar/WrapPropertyPanel.hrc new file mode 100644 index 000000000000..0f578c7ad87c --- /dev/null +++ b/sw/source/ui/sidebar/WrapPropertyPanel.hrc @@ -0,0 +1,38 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SW_WRAPPROPERTYPANEL_HRC +#define _SW_WRAPPROPERTYPANEL_HRC + +// RID_PROPERTYPANEL_SWOBJWRAP_PAGE +#define RB_NO_WRAP 1 +#define RB_WRAP_LEFT 2 +#define RB_WRAP_RIGHT 3 +#define RB_WRAP_PARALLEL 4 +#define RB_WRAP_THROUGH 5 +#define RB_WRAP_IDEAL 6 + +// only for the ImageLists +#define IMG_BEGIN 1 +#define IMG_NONE (IMG_BEGIN) +#define IMG_LEFT (IMG_BEGIN + 1) +#define IMG_RIGHT (IMG_BEGIN + 2) +#define IMG_PARALLEL (IMG_BEGIN + 3) +#define IMG_THROUGH (IMG_BEGIN + 4) +#define IMG_IDEAL (IMG_BEGIN + 5) + +#endif
\ No newline at end of file diff --git a/sw/source/ui/sidebar/WrapPropertyPanel.hxx b/sw/source/ui/sidebar/WrapPropertyPanel.hxx new file mode 100644 index 000000000000..fb30dda5fc18 --- /dev/null +++ b/sw/source/ui/sidebar/WrapPropertyPanel.hxx @@ -0,0 +1,84 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SW_SIDEBAR_WRAP_PROPERTY_PANEL_HXX +#define SW_SIDEBAR_WRAP_PROPERTY_PANEL_HXX + +#include <vcl/button.hxx> +#include <vcl/image.hxx> + +#include <sfx2/sidebar/ControllerItem.hxx> +#include <com/sun/star/frame/XFrame.hpp> + +#include <boost/scoped_ptr.hpp> + + +namespace sw { namespace sidebar { + + class WrapPropertyPanel + : public Control + , public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface + { + public: + static WrapPropertyPanel* Create( + Window* pParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame>& rxFrame, + SfxBindings* pBindings ); + + // interface of ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface + virtual void NotifyItemUpdate( + const sal_uInt16 nSId, + const SfxItemState eState, + const SfxPoolItem* pState ); + + private: + WrapPropertyPanel( + Window* pParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame, + SfxBindings* pBindings ); + + virtual ~WrapPropertyPanel(); + + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame; + SfxBindings* mpBindings; + + ::boost::scoped_ptr<ImageRadioButton> mpRBNoWrap; + ::boost::scoped_ptr<ImageRadioButton> mpRBWrapLeft; + ::boost::scoped_ptr<ImageRadioButton> mpRBWrapRight; + ::boost::scoped_ptr<ImageRadioButton> mpRBWrapParallel; + ::boost::scoped_ptr<ImageRadioButton> mpRBWrapThrough; + ::boost::scoped_ptr<ImageRadioButton> mpRBIdealWrap; + + //Image resource. + ImageList aWrapIL; + + //Controler Items================================== + ::sfx2::sidebar::ControllerItem maSwNoWrapControl; + ::sfx2::sidebar::ControllerItem maSwWrapLeftControl; + ::sfx2::sidebar::ControllerItem maSwWrapRightControl; + ::sfx2::sidebar::ControllerItem maSwWrapParallelControl; + ::sfx2::sidebar::ControllerItem maSwWrapThroughControl; + ::sfx2::sidebar::ControllerItem maSwWrapIdealControl; + + void Initialize(); + + DECL_LINK(WrapTypeHdl, void*); + }; + +} } // end of namespace ::sw::sidebar + +#endif diff --git a/sw/source/ui/sidebar/WrapPropertyPanel.src b/sw/source/ui/sidebar/WrapPropertyPanel.src new file mode 100644 index 000000000000..2a7178c673f6 --- /dev/null +++ b/sw/source/ui/sidebar/WrapPropertyPanel.src @@ -0,0 +1,86 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include "PropertyPanel.hrc" +#include "WrapPropertyPanel.hrc" +#include "helpid.h" + +#define IMAGEBUTTON_WIDTH 16 +#define IMAGEBUTTON_HEIGH 18 +#define IMAGEBUTTON_GAP 1 + +Control RID_PROPERTYPANEL_SWOBJWRAP_PAGE +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + + Size = MAP_APPFONT( PROPERTYPAGE_WIDTH, SECTIONPAGE_MARGIN_VERTICAL_BOT + SECTIONPAGE_MARGIN_VERTICAL_TOP + IMAGEBUTTON_HEIGH ); + HelpID = HID_PROPERTYPANEL_WRAP_SECTION ; + Text [ en-US ] = "Wrap"; + + + ImageRadioButton RB_NO_WRAP + { + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL, SECTIONPAGE_MARGIN_VERTICAL_TOP ); + Size = MAP_APPFONT ( IMAGEBUTTON_WIDTH , IMAGEBUTTON_HEIGH ); + TopImage = True; + HelpID = HID_PROPERTYPANEL_WRAP_RB_NO_WRAP ; + QuickHelpText [ en-US ] = "None"; + }; + ImageRadioButton RB_WRAP_LEFT + { + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + IMAGEBUTTON_WIDTH + IMAGEBUTTON_GAP, SECTIONPAGE_MARGIN_VERTICAL_TOP ); + Size = MAP_APPFONT ( IMAGEBUTTON_WIDTH , IMAGEBUTTON_HEIGH ); + TopImage = True; + HelpID = HID_PROPERTYPANEL_WRAP_RB_WRAP_LEFT ; + QuickHelpText [ en-US ] = "Before"; + }; + ImageRadioButton RB_WRAP_RIGHT + { + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + (IMAGEBUTTON_WIDTH + IMAGEBUTTON_GAP)*2 , SECTIONPAGE_MARGIN_VERTICAL_TOP ); + Size = MAP_APPFONT ( IMAGEBUTTON_WIDTH , IMAGEBUTTON_HEIGH ); + TopImage = True; + HelpID = HID_PROPERTYPANEL_WRAP_RB_WRAP_RIGHT ; + QuickHelpText [ en-US ] = "After"; + }; + ImageRadioButton RB_WRAP_PARALLEL + { + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + (IMAGEBUTTON_WIDTH + IMAGEBUTTON_GAP)*3 , SECTIONPAGE_MARGIN_VERTICAL_TOP ); + Size = MAP_APPFONT (IMAGEBUTTON_WIDTH , IMAGEBUTTON_HEIGH ); + TopImage = True; + HelpID = HID_PROPERTYPANEL_WRAP_RB_WRAP_PARALLEL ; + QuickHelpText [ en-US ] = "Parallel"; + }; + ImageRadioButton RB_WRAP_THROUGH + { + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + (IMAGEBUTTON_WIDTH + IMAGEBUTTON_GAP)*4 , SECTIONPAGE_MARGIN_VERTICAL_TOP ); + Size = MAP_APPFONT (IMAGEBUTTON_WIDTH , IMAGEBUTTON_HEIGH ); + TopImage = True; + HelpID = HID_PROPERTYPANEL_WRAP_RB_WRAP_THROUGH ; + QuickHelpText [ en-US ] = "Through"; + }; + ImageRadioButton RB_WRAP_IDEAL + { + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + (IMAGEBUTTON_WIDTH + IMAGEBUTTON_GAP)*5 , SECTIONPAGE_MARGIN_VERTICAL_TOP ); + Size = MAP_APPFONT (IMAGEBUTTON_WIDTH , IMAGEBUTTON_HEIGH ); + TopImage = True; + HelpID = HID_PROPERTYPANEL_WRAP_RB_WRAP_IDEAL ; + QuickHelpText [ en-US ] = "Optimal"; + }; +}; diff --git a/sw/source/ui/uiview/view0.cxx b/sw/source/ui/uiview/view0.cxx index 671ccb3cf94e..e5f7b3b43733 100644 --- a/sw/source/ui/uiview/view0.cxx +++ b/sw/source/ui/uiview/view0.cxx @@ -36,6 +36,7 @@ #include <sfx2/templdlg.hxx> #include <sfx2/viewfrm.hxx> #include <sfx2/bindings.hxx> +#include <sfx2/sidebar/SidebarChildWindow.hxx> #include <uivwimp.hxx> #include <avmedia/mediaplayer.hxx> #include <swmodule.hxx> @@ -90,6 +91,7 @@ SFX_IMPL_INTERFACE( SwView, SfxViewShell, SW_RES(RID_TOOLS_TOOLBOX) ) { SFX_CHILDWINDOW_CONTEXT_REGISTRATION(SID_NAVIGATOR); SFX_CHILDWINDOW_REGISTRATION(SID_TASKPANE); + SFX_CHILDWINDOW_REGISTRATION(::sfx2::sidebar::SidebarChildWindow::GetChildWindowId()); SFX_CHILDWINDOW_REGISTRATION(SfxTemplateDialogWrapper::GetChildWindowId()); SFX_CHILDWINDOW_REGISTRATION(SfxInfoBarContainerChild::GetChildWindowId()); SFX_CHILDWINDOW_REGISTRATION(SvxSearchDialogWrapper::GetChildWindowId()); diff --git a/sw/source/ui/uiview/view1.cxx b/sw/source/ui/uiview/view1.cxx index 67d5bcc36485..c736e2614348 100644 --- a/sw/source/ui/uiview/view1.cxx +++ b/sw/source/ui/uiview/view1.cxx @@ -21,6 +21,7 @@ #include <svx/svdpagv.hxx> #include <svx/svdview.hxx> #include <svx/ruler.hxx> +#include <svx/sidebar/ContextChangeEventMultiplexer.hxx> #include <idxmrk.hxx> #include <view.hxx> #include <wrtsh.hxx> diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx index 58aa46a96bf4..044a96b265be 100644 --- a/sw/source/ui/uiview/view2.cxx +++ b/sw/source/ui/uiview/view2.cxx @@ -1147,9 +1147,9 @@ void SwView::Execute(SfxRequest &rReq) case SID_ALIGN_ANY_HCENTER : nAlias = SID_ATTR_PARA_ADJUST_CENTER; break; case SID_ALIGN_ANY_RIGHT : nAlias = SID_ATTR_PARA_ADJUST_RIGHT; break; case SID_ALIGN_ANY_JUSTIFIED: nAlias = SID_ATTR_PARA_ADJUST_BLOCK; break; - case SID_ALIGN_ANY_TOP : nAlias = FN_TABLE_VERT_NONE; break; - case SID_ALIGN_ANY_VCENTER : nAlias = FN_TABLE_VERT_CENTER; break; - case SID_ALIGN_ANY_BOTTOM : nAlias = FN_TABLE_VERT_BOTTOM; break; + case SID_ALIGN_ANY_TOP : nAlias = SID_TABLE_VERT_NONE; break; + case SID_ALIGN_ANY_VCENTER : nAlias = SID_TABLE_VERT_CENTER; break; + case SID_ALIGN_ANY_BOTTOM : nAlias = SID_TABLE_VERT_BOTTOM; break; } } else diff --git a/sw/source/ui/uiview/viewstat.cxx b/sw/source/ui/uiview/viewstat.cxx index 295df22effc9..21aa946afce2 100644 --- a/sw/source/ui/uiview/viewstat.cxx +++ b/sw/source/ui/uiview/viewstat.cxx @@ -384,9 +384,9 @@ void SwView::GetState(SfxItemSet &rSet) case SID_ALIGN_ANY_HCENTER : nAlias = SID_ATTR_PARA_ADJUST_CENTER; break; case SID_ALIGN_ANY_RIGHT : nAlias = SID_ATTR_PARA_ADJUST_RIGHT; break; case SID_ALIGN_ANY_JUSTIFIED: nAlias = SID_ATTR_PARA_ADJUST_BLOCK; break; - case SID_ALIGN_ANY_TOP : nAlias = FN_TABLE_VERT_NONE; break; - case SID_ALIGN_ANY_VCENTER : nAlias = FN_TABLE_VERT_CENTER; break; - case SID_ALIGN_ANY_BOTTOM : nAlias = FN_TABLE_VERT_BOTTOM; break; + case SID_ALIGN_ANY_TOP : nAlias = SID_TABLE_VERT_NONE; break; + case SID_ALIGN_ANY_VCENTER : nAlias = SID_TABLE_VERT_CENTER; break; + case SID_ALIGN_ANY_BOTTOM : nAlias = SID_TABLE_VERT_BOTTOM; break; } } else if(m_nSelectionType & (nsSelectionType::SEL_DRW)) diff --git a/sw/source/ui/uiview/viewtab.cxx b/sw/source/ui/uiview/viewtab.cxx index d3a9942734cf..b1ffc8fa2080 100644 --- a/sw/source/ui/uiview/viewtab.cxx +++ b/sw/source/ui/uiview/viewtab.cxx @@ -414,6 +414,24 @@ void SwView::ExecTabWin( SfxRequest& rReq ) } } break; + + // apply new left and right margins to current page style + case SID_ATTR_PAGE_LRSPACE: + { + const SvxLongLRSpaceItem aLongLR( static_cast<const SvxLongLRSpaceItem&>(rReq.GetArgs()->Get( SID_ATTR_PAGE_LRSPACE )) ); + + SwPageDesc aDesc( rDesc ); + { + SvxLRSpaceItem aLR( RES_LR_SPACE ); + aLR.SetLeft((sal_uInt16)aLongLR.GetLeft()); + aLR.SetRight((sal_uInt16)aLongLR.GetRight()); + SwapPageMargin( rDesc, aLR ); + aDesc.GetMaster().SetFmtAttr( aLR ); + } + rSh.ChgPageDesc( nDescId, aDesc ); + } + break; + case SID_ATTR_LONG_ULSPACE: { SvxLongULSpaceItem aLongULSpace( (const SvxLongULSpaceItem&)rReq.GetArgs()-> @@ -535,6 +553,82 @@ void SwView::ExecTabWin( SfxRequest& rReq ) } } break; + + // apply new top and bottom margins to current page style + case SID_ATTR_PAGE_ULSPACE: + { + SvxLongULSpaceItem aLongULSpace( + static_cast<const SvxLongULSpaceItem&>(rReq.GetArgs()->Get( SID_ATTR_PAGE_ULSPACE ) ) ); + + SwPageDesc aDesc( rDesc ); + { + SvxULSpaceItem aUL(RES_UL_SPACE); + aUL.SetUpper((sal_uInt16)aLongULSpace.GetUpper()); + aUL.SetLower((sal_uInt16)aLongULSpace.GetLower()); + aDesc.GetMaster().SetFmtAttr(aUL); + } + rSh.ChgPageDesc( nDescId, aDesc ); + } + break; + + case SID_ATTR_PAGE_COLUMN: + { + const SfxInt16Item aColumnItem( (const SfxInt16Item&)rReq.GetArgs()->Get(nSlot) ); + const sal_uInt16 nPageColumnType = aColumnItem.GetValue(); + + // nPageColumnType = + // 1 - single-columned page + // 2 - two-columned page + // 3 - three-columned page + // 4 - two-columned page with left column width of 2/3 of page width + // 5 - two-columned page with right column width of 2/3 of page width + + sal_uInt16 nCount = 2; + if ( nPageColumnType == 1 ) + { + nCount = 0; + } + else if ( nPageColumnType == 3 ) + { + nCount = 3; + } + + const sal_uInt16 nGutterWidth = 0; + + const SvxLRSpaceItem aLR( rDesc.GetMaster().GetLRSpace() ); + const long nLeft = aLR.GetLeft(); + const long nRight = aLR.GetRight(); + const long nWidth = nPageWidth - nLeft - nRight; + + SwFmtCol aCols( rDesc.GetMaster().GetCol() ); + aCols.Init( nCount, nGutterWidth, nWidth ); + aCols.SetWishWidth( nWidth ); + aCols.SetGutterWidth( nGutterWidth, nWidth ); + aCols.SetOrtho( sal_False, nGutterWidth, nWidth ); + + long nColumnLeft = 0; + long nColumnRight = 0; + if ( nPageColumnType == 4 ) + { + nColumnRight = (long)(nWidth/3); + nColumnLeft = nWidth - nColumnRight; + aCols.GetColumns()[0].SetWishWidth( nColumnLeft ); + aCols.GetColumns()[1].SetWishWidth( nColumnRight ); + } + else if ( nPageColumnType == 5 ) + { + nColumnLeft = (long)(nWidth/3); + nColumnRight = nWidth - nColumnLeft; + aCols.GetColumns()[0].SetWishWidth( nColumnLeft ); + aCols.GetColumns()[1].SetWishWidth( nColumnRight ); + } + + SwPageDesc aDesc( rDesc ); + aDesc.GetMaster().SetFmtAttr( aCols ); + rSh.ChgPageDesc( rSh.GetCurPageDesc(), aDesc ); + } + break; + case SID_ATTR_TABSTOP_VERTICAL: case SID_ATTR_TABSTOP: { @@ -571,6 +665,7 @@ void SwView::ExecTabWin( SfxRequest& rReq ) rSh.SetAttr( aTabStops ); break; } + case SID_ATTR_PARA_LRSPACE_VERTICAL: case SID_ATTR_PARA_LRSPACE: { @@ -651,6 +746,30 @@ void SwView::ExecTabWin( SfxRequest& rReq ) } } break; + + case SID_ATTR_PARA_ULSPACE: + { + SvxULSpaceItem aParaMargin((const SvxULSpaceItem&)rReq. + GetArgs()->Get(nSlot)); + + long nUDist = 0; + long nLDist = 0; + aParaMargin.SetUpper( aParaMargin.GetUpper() - nUDist ); + aParaMargin.SetLower(aParaMargin.GetLower() - nLDist); + + aParaMargin.SetWhich( RES_UL_SPACE ); + SwTxtFmtColl* pColl = rSh.GetCurTxtFmtColl(); + if( pColl && pColl->IsAutoUpdateFmt() ) + { + SfxItemSet aSet(GetPool(), RES_UL_SPACE, RES_UL_SPACE); + aSet.Put(aParaMargin); + rSh.AutoUpdatePara( pColl, aSet); + } + else + rSh.SetAttr( aParaMargin ); + } + break; + case SID_RULER_BORDERS_VERTICAL: case SID_RULER_BORDERS: { @@ -910,6 +1029,45 @@ void SwView::StateTabWin(SfxItemSet& rSet) { switch ( nWhich ) { + + case SID_ATTR_PAGE_COLUMN: + { + sal_uInt16 nColumnType = 0; + + const SwFrmFmt& rMaster = rDesc.GetMaster(); + SwFmtCol aCol(rMaster.GetCol()); + const sal_uInt16 nCols = aCol.GetNumCols(); + if ( nCols == 0 ) + { + nColumnType = 1; + } + else if ( nCols == 2 ) + { + const sal_uInt16 nColLeft = aCol.CalcPrtColWidth(0, aCol.GetWishWidth()); + const sal_uInt16 nColRight = aCol.CalcPrtColWidth(1, aCol.GetWishWidth()); + + if ( abs(nColLeft - nColRight) <= 10 ) + { + nColumnType = 2; + } + else if( abs(nColLeft - nColRight*2) < 20 ) + { + nColumnType = 4; + } + else if( abs(nColLeft*2 - nColRight) < 20 ) + { + nColumnType = 5; + } + } + else if( nCols == 3 ) + { + nColumnType = 3; + } + + rSet.Put( SfxInt16Item( SID_ATTR_PAGE_COLUMN, nColumnType ) ); + } + break; + case SID_ATTR_LONG_LRSPACE: { SvxLongLRSpaceItem aLongLR( (long)aPageLRSpace.GetLeft(), @@ -970,6 +1128,18 @@ void SwView::StateTabWin(SfxItemSet& rSet) } break; } + + // provide left and right margins of current page style + case SID_ATTR_PAGE_LRSPACE: + { + SvxLongLRSpaceItem aLongLR( + (long)aPageLRSpace.GetLeft(), + (long)aPageLRSpace.GetRight(), + SID_ATTR_PAGE_LRSPACE ); + rSet.Put( aLongLR ); + } + break; + case SID_ATTR_LONG_ULSPACE: { // Rand Seite Oben Unten @@ -1014,6 +1184,20 @@ void SwView::StateTabWin(SfxItemSet& rSet) } break; } + + // provide top and bottom margins of current page style + case SID_ATTR_PAGE_ULSPACE: + { + const SvxULSpaceItem aUL( rDesc.GetMaster().GetULSpace() ); + SvxLongULSpaceItem aLongUL( + (long)aUL.GetUpper(), + (long)aUL.GetLower(), + SID_ATTR_PAGE_ULSPACE ); + + rSet.Put( aLongUL ); + } + break; + case SID_ATTR_TABSTOP_VERTICAL : case RES_PARATR_TABSTOP: { @@ -1045,6 +1229,7 @@ void SwView::StateTabWin(SfxItemSet& rSet) } break; } + case SID_ATTR_PARA_LRSPACE_VERTICAL: case SID_ATTR_PARA_LRSPACE: { @@ -1084,6 +1269,20 @@ void SwView::StateTabWin(SfxItemSet& rSet) } break; } + + case SID_ATTR_PARA_ULSPACE: + { + SvxULSpaceItem aUL = (const SvxULSpaceItem&)aCoreSet.Get(RES_UL_SPACE); + aUL.SetWhich(nWhich); + + SfxItemState e = aCoreSet.GetItemState(RES_UL_SPACE); + if( e >= SFX_ITEM_AVAILABLE ) + rSet.Put( aUL ); + else + rSet.InvalidateItem(nWhich); + } + break; + case SID_RULER_BORDER_DISTANCE: { m_nLeftBorderDistance = 0; @@ -1200,6 +1399,7 @@ void SwView::StateTabWin(SfxItemSet& rSet) } } break; + case SID_RULER_TEXT_RIGHT_TO_LEFT: { if ( nSelType & nsSelectionType::SEL_GRF || @@ -1214,6 +1414,7 @@ void SwView::StateTabWin(SfxItemSet& rSet) } } break; + case SID_RULER_BORDERS_VERTICAL: case SID_RULER_BORDERS: { @@ -1443,6 +1644,7 @@ void SwView::StateTabWin(SfxItemSet& rSet) rSet.DisableItem(nWhich); break; } + case SID_RULER_ROWS : case SID_RULER_ROWS_VERTICAL: { @@ -1529,6 +1731,7 @@ void SwView::StateTabWin(SfxItemSet& rSet) rSet.DisableItem(nWhich); } break; + case SID_RULER_PAGE_POS: { SvxPagePosSizeItem aPagePosSize( @@ -1537,6 +1740,7 @@ void SwView::StateTabWin(SfxItemSet& rSet) rSet.Put(aPagePosSize); break; } + case SID_RULER_LR_MIN_MAX: { Rectangle aRectangle; @@ -1637,8 +1841,10 @@ void SwView::StateTabWin(SfxItemSet& rSet) if ( IsTabColFromDoc() ) bColumn = rSh.GetCurMouseColNum( m_aTabColFromDocPos ) != 0; else - bColumn = (nFrmType & (FRMTYPE_COLUMN|FRMTYPE_FLY_ANY| - FRMTYPE_COLSECTOUTTAB)); + bColumn = (nFrmType & (FRMTYPE_COLUMN|FRMTYPE_FLY_ANY|FRMTYPE_COLSECTOUTTAB)) + ? sal_True + : sal_False; + if ( !bColumn ) { if( nFrmType & FRMTYPE_FLY_ANY && IsTabColFromDoc() ) @@ -1760,6 +1966,7 @@ void SwView::StateTabWin(SfxItemSet& rSet) rSet.Put(aLR); } break; + case SID_RULER_PROTECT: { if(bFrmSelection) diff --git a/sw/source/ui/uno/unofreg.cxx b/sw/source/ui/uno/unofreg.cxx index cda4584fa608..995c263f8bec 100644 --- a/sw/source/ui/uno/unofreg.cxx +++ b/sw/source/ui/uno/unofreg.cxx @@ -133,6 +133,8 @@ com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL _crea } +#include "SwPanelFactory.hxx" + #ifdef __cplusplus extern "C" { @@ -352,6 +354,13 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL sw_component_getFactory( LayoutDumpFilter_createInstance, LayoutDumpFilter_getSupportedServiceNames() ); } + else if ( ::sw::sidebar::SwPanelFactory::getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) ) + { + xFactory = ::cppu::createSingleFactory( xMSF, + ::sw::sidebar::SwPanelFactory::getImplementationName(), + ::sw::sidebar::SwPanelFactory::createInstance, + ::sw::sidebar::SwPanelFactory::getSupportedServiceNames() ); + } else if( comp_FinalThreadManager::_getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) ) { diff --git a/sw/source/ui/utlui/navipi.cxx b/sw/source/ui/utlui/navipi.cxx index a82cb2355379..5c6bea7fa967 100644 --- a/sw/source/ui/utlui/navipi.cxx +++ b/sw/source/ui/utlui/navipi.cxx @@ -224,19 +224,20 @@ IMPL_LINK( SwNavigationPI, ToolBoxSelectHdl, ToolBox *, pBox ) break; case FN_SHOW_CONTENT_BOX: case FN_SELECT_CONTENT: - if(pContextWin->GetFloatingWindow()) - { - if(_IsZoomedIn() ) - { - _ZoomOut(); - } - else + if(pContextWin!=NULL && pContextWin->GetFloatingWindow()!=NULL) { - _ZoomIn(); + if(_IsZoomedIn() ) + { + _ZoomOut(); + } + else + { + _ZoomIn(); + } } - } - return sal_True; + return sal_True; // Functions that will trigger a direct action. + case FN_SELECT_FOOTER: { rSh.MoveCrsr(); @@ -526,7 +527,7 @@ void SwNavigationPI::MakeMark() void SwNavigationPI::GotoPage() { - if ( pContextWin->GetFloatingWindow() && pContextWin->GetFloatingWindow()->IsRollUp()) + if (pContextWin && pContextWin->GetFloatingWindow() && pContextWin->GetFloatingWindow()->IsRollUp()) _ZoomIn(); if(IsGlobalMode()) ToggleTree(); @@ -538,14 +539,15 @@ void SwNavigationPI::_ZoomOut() { if (_IsZoomedIn()) { - FloatingWindow* pFloat = pContextWin->GetFloatingWindow(); + FloatingWindow* pFloat = pContextWin!=NULL ? pContextWin->GetFloatingWindow() : NULL; bIsZoomedIn = sal_False; Size aSz(GetOutputSizePixel()); aSz.Height() = nZoomOut; Size aMinOutSizePixel = ((SfxDockingWindow*)GetParent())->GetMinOutputSizePixel(); ((SfxDockingWindow*)GetParent())->SetMinOutputSizePixel(Size( aMinOutSizePixel.Width(),nZoomOutInit)); - pFloat->SetOutputSizePixel(aSz); + if (pFloat != NULL) + pFloat->SetOutputSizePixel(aSz); FillBox(); if(IsGlobalMode()) { @@ -566,53 +568,60 @@ void SwNavigationPI::_ZoomOut() void SwNavigationPI::_ZoomIn() { - FloatingWindow* pFloat = pContextWin->GetFloatingWindow(); - if (pFloat && - (!_IsZoomedIn() || ( pContextWin->GetFloatingWindow()->IsRollUp()))) + if (pContextWin != NULL) { - aContentTree.HideTree(); - aDocListBox.Hide(); - aGlobalTree.HideTree(); - bIsZoomedIn = sal_True; - Size aSz(GetOutputSizePixel()); - if( aSz.Height() > nZoomIn ) - nZoomOut = ( short ) aSz.Height(); - - aSz.Height() = nZoomIn; - Size aMinOutSizePixel = ((SfxDockingWindow*)GetParent())->GetMinOutputSizePixel(); - ((SfxDockingWindow*)GetParent())->SetMinOutputSizePixel(Size( - aMinOutSizePixel.Width(), aSz.Height())); - pFloat->SetOutputSizePixel(aSz); - SvTreeListEntry* pFirst = aContentTree.FirstSelected(); - if(pFirst) - aContentTree.Select(pFirst, sal_True); // Enable toolbox - pConfig->SetSmall( sal_True ); - aContentToolBox.CheckItem(FN_SHOW_CONTENT_BOX, sal_False); + FloatingWindow* pFloat = pContextWin->GetFloatingWindow(); + if (pFloat && + (!_IsZoomedIn() || ( pContextWin->GetFloatingWindow()->IsRollUp()))) + { + aContentTree.HideTree(); + aDocListBox.Hide(); + aGlobalTree.HideTree(); + bIsZoomedIn = sal_True; + Size aSz(GetOutputSizePixel()); + if( aSz.Height() > nZoomIn ) + nZoomOut = ( short ) aSz.Height(); + + aSz.Height() = nZoomIn; + Size aMinOutSizePixel = ((SfxDockingWindow*)GetParent())->GetMinOutputSizePixel(); + ((SfxDockingWindow*)GetParent())->SetMinOutputSizePixel(Size( + aMinOutSizePixel.Width(), aSz.Height())); + pFloat->SetOutputSizePixel(aSz); + SvTreeListEntry* pFirst = aContentTree.FirstSelected(); + if(pFirst) + aContentTree.Select(pFirst, sal_True); // Enable toolbox + pConfig->SetSmall( sal_True ); + aContentToolBox.CheckItem(FN_SHOW_CONTENT_BOX, sal_False); + } } } void SwNavigationPI::Resize() { Window* pParent = GetParent(); - FloatingWindow* pFloat = ((DockingWindow*)pParent)->GetFloatingWindow(); - Size aNewSize; if( !_IsZoomedIn() ) { - //change the minimum width depending on the dock status - Size aMinOutSizePixel = ((SfxDockingWindow*)pParent)->GetMinOutputSizePixel(); - if( pFloat) - { - aNewSize = pFloat->GetOutputSizePixel(); - aMinOutSizePixel.Width() = nWishWidth; - aMinOutSizePixel.Height() = _IsZoomedIn() ? nZoomIn : nZoomOutInit; - } - else + Size aNewSize (pParent->GetOutputSizePixel()); + + SfxDockingWindow* pDockingParent = dynamic_cast<SfxDockingWindow*>(pParent); + if (pDockingParent != NULL) { - aNewSize = pParent->GetOutputSizePixel(); - aMinOutSizePixel.Width() = 0; - aMinOutSizePixel.Height() = 0; + FloatingWindow* pFloat = pDockingParent->GetFloatingWindow(); + //change the minimum width depending on the dock status + Size aMinOutSizePixel = pDockingParent->GetMinOutputSizePixel(); + if( pFloat) + { + aNewSize = pFloat->GetOutputSizePixel(); + aMinOutSizePixel.Width() = nWishWidth; + aMinOutSizePixel.Height() = _IsZoomedIn() ? nZoomIn : nZoomOutInit; + } + else + { + aMinOutSizePixel.Width() = 0; + aMinOutSizePixel.Height() = 0; + } + pDockingParent->SetMinOutputSizePixel(aMinOutSizePixel); } - ((SfxDockingWindow*)GetParent())->SetMinOutputSizePixel(aMinOutSizePixel); const Point aPos = aContentTree.GetPosPixel(); Point aLBPos = aDocListBox.GetPosPixel(); @@ -633,9 +642,8 @@ void SwNavigationPI::Resize() aNewSize.Height() += (nDist + nDocLBIniHeight + aPos.Y() - aGlobalTree.GetPosPixel().Y()); aGlobalTree.SetSizePixel(aNewSize); aDocListBox.setPosSizePixel( aLBPos.X(), aLBPos.Y(), - aDocLBSz.Width(), aDocLBSz.Height(), - WINDOW_POSSIZE_X|WINDOW_POSSIZE_Y|WINDOW_POSSIZE_WIDTH); - + aDocLBSz.Width(), aDocLBSz.Height(), + WINDOW_POSSIZE_X|WINDOW_POSSIZE_Y|WINDOW_POSSIZE_WIDTH); } } @@ -734,21 +742,29 @@ SwNavigationPI::SwNavigationPI( SfxBindings* _pBindings, nWishWidth = aContentToolboxSize.Width(); nWishWidth += 2 * aContentToolBox.GetPosPixel().X(); - FloatingWindow* pFloat = ((DockingWindow*)pParent)->GetFloatingWindow(); - Size aMinSize(pFloat ? nWishWidth : 0, pFloat ? nZoomOutInit : 0); - ((SfxDockingWindow*)pParent)->SetMinOutputSizePixel(aMinSize); - SetOutputSizePixel( Size( nWishWidth, nZoomOutInit)); - Size aTmpParentSize(((SfxDockingWindow*)pParent)->GetSizePixel()); - if( - ( - aTmpParentSize.Width() < aMinSize.Width() || - aTmpParentSize.Height() < aMinSize.Height() - ) - && - ((SfxDockingWindow*)pParent)->GetFloatingWindow() && - !((SfxDockingWindow*)pParent)->GetFloatingWindow()->IsRollUp() - ) - ((SfxDockingWindow*)pParent)->SetOutputSizePixel(aMinSize); + DockingWindow* pDockingParent = dynamic_cast<DockingWindow*>(pParent); + if (pDockingParent != NULL) + { + FloatingWindow* pFloat = pDockingParent->GetFloatingWindow(); + Size aMinSize(pFloat ? nWishWidth : 0, pFloat ? nZoomOutInit : 0); + pDockingParent->SetMinOutputSizePixel(aMinSize); + SetOutputSizePixel( Size( nWishWidth, nZoomOutInit)); + + SfxDockingWindow* pSfxDockingParent = dynamic_cast<SfxDockingWindow*>(pParent); + if (pSfxDockingParent != NULL) + { + Size aTmpParentSize(pSfxDockingParent->GetSizePixel()); + if (aTmpParentSize.Width() < aMinSize.Width() + || aTmpParentSize.Height() < aMinSize.Height()) + { + if (pSfxDockingParent->GetFloatingWindow() + && ! pSfxDockingParent->GetFloatingWindow()->IsRollUp()) + { + pSfxDockingParent->SetOutputSizePixel(aMinSize); + } + } + } + } aContentTree.setPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y ); aContentTree.SetStyle( aContentTree.GetStyle()|WB_HASBUTTONS|WB_HASBUTTONSATROOT| @@ -820,6 +836,15 @@ SwNavigationPI::SwNavigationPI( SfxBindings* _pBindings, aContentTree.SetAccessibleName(SW_RESSTR(STR_ACCESS_TL_CONTENT)); aGlobalTree.SetAccessibleName(SW_RESSTR(STR_ACCESS_TL_GLOBAL)); aDocListBox.SetAccessibleName(aStatusArr[3]); + + if (pContextWin == NULL) + { + // When the context window is missing then the navigator is + // displayed in the sidebar. While the navigator could change + // its size, the sidebar can not, and the navigator would just + // waste space. Therefore hide this button. + aContentToolBox.RemoveItem(aContentToolBox.GetItemPos(FN_SHOW_CONTENT_BOX)); + } } SwNavigationPI::~SwNavigationPI() diff --git a/sw/source/ui/wrtsh/wrtsh1.cxx b/sw/source/ui/wrtsh/wrtsh1.cxx index 3ab82308105d..f38099e4eb22 100644 --- a/sw/source/ui/wrtsh/wrtsh1.cxx +++ b/sw/source/ui/wrtsh/wrtsh1.cxx @@ -1785,7 +1785,7 @@ void SwWrtShell::ChangeHeaderOrFooter( if ( !IsHeaderFooterEdit() ) ToggleHeaderFooterEdit(); bCrsrSet = SetCrsrInHdFt( - !rStyleName.Len() ? USHRT_MAX : nFrom, + !rStyleName.Len() ? (sal_uInt16)0xFFFF : nFrom, bHeader ); } } diff --git a/sw/source/ui/wrtsh/wrtsh3.cxx b/sw/source/ui/wrtsh/wrtsh3.cxx index 010d7f3a6bdf..fd4c89493b02 100644 --- a/sw/source/ui/wrtsh/wrtsh3.cxx +++ b/sw/source/ui/wrtsh/wrtsh3.cxx @@ -111,7 +111,12 @@ void SwWrtShell::DrawSelChanged( ) static sal_uInt16 const aInval[] = { SID_ATTR_FILL_STYLE, SID_ATTR_FILL_COLOR, SID_ATTR_LINE_STYLE, - SID_ATTR_LINE_WIDTH, SID_ATTR_LINE_COLOR, 0 + SID_ATTR_LINE_WIDTH, SID_ATTR_LINE_COLOR, + /*AF: these may be needed for the sidebar. + SID_SVX_AREA_TRANSPARENCY, SID_SVX_AREA_TRANSP_GRADIENT, + SID_SVX_AREA_TRANS_TYPE, + */ + 0 }; GetView().GetViewFrame()->GetBindings().Invalidate(aInval); diff --git a/sw/uiconfig/swriter/menubar/menubar.xml b/sw/uiconfig/swriter/menubar/menubar.xml index 3c437407c8b1..89d15b34294e 100644 --- a/sw/uiconfig/swriter/menubar/menubar.xml +++ b/sw/uiconfig/swriter/menubar/menubar.xml @@ -142,6 +142,7 @@ <menu:menuitem menu:id=".uno:ViewDataSourceBrowser"/> <menu:menuitem menu:id=".uno:Navigator"/> <menu:menuitem menu:id=".uno:TaskPane"/> + <menu:menuitem menu:id=".uno:Sidebar"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:FullScreen"/> <menu:menu menu:id=".uno:Zoom"> diff --git a/sw/util/sw.component b/sw/util/sw.component index 456fe70e6a21..2f7c9998d14f 100644 --- a/sw/util/sw.component +++ b/sw/util/sw.component @@ -94,4 +94,7 @@ <implementation name="com.sun.star.comp.Writer.LayoutDump"> <service name="com.sun.star.comp.Writer.LayoutDump"/> </implementation> + <implementation name="org.apache.openoffice.comp.sw.sidebar.SwPanelFactory"> + <service name="com.sun.star.ui.UIElementFactory"/> + </implementation> </component> |