diff options
author | Oliver-Rainer Wittmann <orw@apache.org> | 2013-04-10 08:20:16 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2013-05-20 11:33:10 +0100 |
commit | d02f75a8c36705924ddd6a5921fe3012fafce812 (patch) | |
tree | 40da9f25714a77f5e9e17ef7bee81c33a1a11b4b | |
parent | d8d55787b81cdc955b73c8befa4ab608f46e32aa (diff) |
Resolves: #i121420# merge sidebar feature
(cherry picked from commit 0a0a9b32aa5bf1ce2554ad37cbba3c7a105db2b5)
Conflicts:
chart2/source/controller/dialogs/dlg_View3D.cxx
chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx
chart2/source/controller/drawinglayer/ViewElementListProvider.cxx
chart2/source/controller/inc/ViewElementListProvider.hxx
chart2/source/controller/inc/dlg_View3D.hxx
chart2/source/controller/main/ShapeController.cxx
chart2/source/inc/chartview/DrawModelWrapper.hxx
chart2/source/view/main/DrawModelWrapper.cxx
cui/source/inc/border.hxx
cui/source/inc/cuitabarea.hxx
cui/source/inc/cuitabline.hxx
cui/source/inc/sdrcelldlg.hxx
cui/source/inc/treeopt.hxx
cui/source/options/optchart.cxx
cui/source/options/optchart.hxx
cui/source/options/optcolor.cxx
cui/source/options/treeopt.cxx
cui/source/tabpages/backgrnd.cxx
cui/source/tabpages/border.cxx
cui/source/tabpages/chardlg.cxx
cui/source/tabpages/numpages.cxx
cui/source/tabpages/tpcolor.cxx
cui/source/tabpages/tplneend.cxx
editeng/inc/editeng/outliner.hxx
extensions/source/propctrlr/standardcontrol.cxx
framework/source/register/registerservices.cxx
offapi/com/sun/star/ui/makefile.mk
officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
officecfg/registry/data/org/openoffice/Office/UI/makefile.mk
officecfg/registry/schema/org/openoffice/Office/UI/makefile.mk
postprocess/packregistry/makefile.mk
reportdesign/source/ui/dlg/Condition.cxx
reportdesign/source/ui/misc/UITools.cxx
sc/inc/document.hxx
sc/inc/helpids.h
sc/inc/sc.hrc
sc/prj/build.lst
sc/sdi/scalc.sdi
sc/source/core/data/documen9.cxx
sc/source/core/data/drwlayer.cxx
sc/source/ui/app/scdll.cxx
sc/source/ui/app/typemap.cxx
sc/source/ui/dbgui/scendlg.cxx
sc/source/ui/docshell/docsh2.cxx
sc/source/ui/docshell/docsh4.cxx
sc/source/ui/drawfunc/chartsh.cxx
sc/source/ui/drawfunc/drawsh.cxx
sc/source/ui/drawfunc/drawsh2.cxx
sc/source/ui/drawfunc/drawsh4.cxx
sc/source/ui/drawfunc/drformsh.cxx
sc/source/ui/drawfunc/drtxtob.cxx
sc/source/ui/drawfunc/drtxtob1.cxx
sc/source/ui/drawfunc/drtxtob2.cxx
sc/source/ui/drawfunc/graphsh.cxx
sc/source/ui/drawfunc/oleobjsh.cxx
sc/source/ui/inc/chartsh.hxx
sc/source/ui/inc/formatsh.hxx
sc/source/ui/miscdlgs/tabbgcolordlg.cxx
sc/source/ui/navipi/navipi.cxx
sc/source/ui/optdlg/opredlin.cxx
sc/source/ui/optdlg/tpview.cxx
sc/source/ui/sidebar/makefile.mk
sc/source/ui/view/auditsh.cxx
sc/source/ui/view/cellsh.cxx
sc/source/ui/view/editsh.cxx
sc/source/ui/view/formatsh.cxx
sc/source/ui/view/pivotsh.cxx
sc/source/ui/view/tabvwsh.cxx
sc/util/makefile.mk
sd/inc/sdabstdlg.hxx
sd/prj/build.lst
sd/sdi/ToolPanelViewShell.sdi
sd/sdi/makefile.mk
sd/source/ui/accessibility/makefile.mk
sd/source/ui/animations/CustomAnimationDialog.cxx
sd/source/ui/dlg/PaneChildWindows.cxx
sd/source/ui/dlg/PaneShells.cxx
sd/source/ui/dlg/copydlg.cxx
sd/source/ui/dlg/navigatr.cxx
sd/source/ui/dlg/sddlgfact.cxx
sd/source/ui/dlg/sddlgfact.hxx
sd/source/ui/docshell/docshel3.cxx
sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.cxx
sd/source/ui/framework/factories/TaskPanelFactory.cxx
sd/source/ui/framework/factories/TaskPanelFactory.hxx
sd/source/ui/framework/factories/ViewShellWrapper.cxx
sd/source/ui/framework/factories/makefile.mk
sd/source/ui/framework/module/ImpressModule.cxx
sd/source/ui/framework/module/ToolPanelModule.cxx
sd/source/ui/framework/tools/FrameworkHelper.cxx
sd/source/ui/func/fuolbull.cxx
sd/source/ui/inc/DrawViewShell.hxx
sd/source/ui/inc/PaneChildWindows.hxx
sd/source/ui/inc/celltempl.hxx
sd/source/ui/inc/copydlg.hxx
sd/source/ui/inc/dlgpage.hxx
sd/source/ui/inc/framework/FrameworkHelper.hxx
sd/source/ui/inc/prltempl.hxx
sd/source/ui/inc/tabtempl.hxx
sd/source/ui/inc/taskpane/ILayoutableWindow.hxx
sd/source/ui/inc/taskpane/PanelId.hxx
sd/source/ui/inc/tpaction.hxx
sd/source/ui/sidebar/AllMasterPagesSelector.cxx
sd/source/ui/sidebar/AllMasterPagesSelector.hxx
sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx
sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx
sd/source/ui/sidebar/DocumentHelper.cxx
sd/source/ui/sidebar/DocumentHelper.hxx
sd/source/ui/sidebar/LayoutMenu.cxx
sd/source/ui/sidebar/LayoutMenu.hxx
sd/source/ui/sidebar/MasterPageContainer.cxx
sd/source/ui/sidebar/MasterPageContainer.hxx
sd/source/ui/sidebar/MasterPageContainerFiller.cxx
sd/source/ui/sidebar/MasterPageContainerFiller.hxx
sd/source/ui/sidebar/MasterPageContainerProviders.cxx
sd/source/ui/sidebar/MasterPageContainerProviders.hxx
sd/source/ui/sidebar/MasterPageContainerQueue.cxx
sd/source/ui/sidebar/MasterPageContainerQueue.hxx
sd/source/ui/sidebar/MasterPageDescriptor.cxx
sd/source/ui/sidebar/MasterPageDescriptor.hxx
sd/source/ui/sidebar/MasterPageObserver.cxx
sd/source/ui/sidebar/MasterPagesSelector.cxx
sd/source/ui/sidebar/MasterPagesSelector.hxx
sd/source/ui/sidebar/PreviewValueSet.cxx
sd/source/ui/sidebar/PreviewValueSet.hxx
sd/source/ui/sidebar/RecentMasterPagesSelector.cxx
sd/source/ui/sidebar/RecentlyUsedMasterPages.cxx
sd/source/ui/sidebar/SidebarShellManager.cxx
sd/source/ui/sidebar/SlideTransitionPanel.hxx
sd/source/ui/sidebar/makefile.mk
sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
sd/source/ui/table/TableDesignPane.hxx
sd/source/ui/toolpanel/ControlContainer.cxx
sd/source/ui/toolpanel/ControlContainerDescriptor.hxx
sd/source/ui/toolpanel/MethodGuard.hxx
sd/source/ui/toolpanel/ScrollPanel.cxx
sd/source/ui/toolpanel/SlideSorterCacheDisplay.cxx
sd/source/ui/toolpanel/SubToolPanel.cxx
sd/source/ui/toolpanel/TaskPaneFocusManager.cxx
sd/source/ui/toolpanel/TaskPaneTreeNode.cxx
sd/source/ui/toolpanel/TitleBar.cxx
sd/source/ui/toolpanel/TitledControl.cxx
sd/source/ui/toolpanel/ToolPanel.cxx
sd/source/ui/toolpanel/ToolPanel.hxx
sd/source/ui/toolpanel/ToolPanelFactory.cxx
sd/source/ui/toolpanel/ToolPanelUIElement.cxx
sd/source/ui/toolpanel/ToolPanelUIElement.hxx
sd/source/ui/toolpanel/ToolPanelViewShell.cxx
sd/source/ui/toolpanel/controls/CustomAnimationPanel.cxx
sd/source/ui/toolpanel/controls/CustomAnimationPanel.hxx
sd/source/ui/toolpanel/controls/MasterPagesPanel.cxx
sd/source/ui/toolpanel/controls/MasterPagesPanel.hxx
sd/source/ui/toolpanel/controls/SlideTransitionPanel.cxx
sd/source/ui/toolpanel/controls/SlideTransitionPanel.hxx
sd/source/ui/toolpanel/controls/TableDesignPanel.cxx
sd/source/ui/toolpanel/controls/TableDesignPanel.hxx
sd/source/ui/unoidl/UnoDocumentSettings.cxx
sd/source/ui/view/ViewShellBase.cxx
sd/source/ui/view/drtxtob.cxx
sd/source/ui/view/drviews3.cxx
sd/source/ui/view/drviews7.cxx
sd/source/ui/view/drviewsa.cxx
sd/source/ui/view/drviewsf.cxx
sd/source/ui/view/outlnvsh.cxx
sd/source/ui/view/sdview.cxx
sd/source/ui/view/viewshel.cxx
sd/uiconfig/sdraw/menubar/menubar.xml
sd/util/makefile.mk
sfx2/Package_inc.mk
sfx2/inc/sfx2/sfx.hrc
sfx2/inc/sfx2/sfxsids.hrc
sfx2/source/control/bindings.cxx
sfx2/source/dialog/templdlg.cxx
sfx2/source/inc/templdgi.hxx
svx/AllLangResTarget_svx.mk
svx/Package_inc.mk
svx/inc/svx/XPropertyTable.hxx
svx/inc/svx/bmpmask.hxx
svx/inc/svx/colrctrl.hxx
svx/inc/svx/dialogs.hrc
svx/inc/svx/dlgctrl.hxx
svx/inc/svx/dlgutil.hxx
svx/inc/svx/drawitem.hxx
svx/inc/svx/fontwork.hxx
svx/inc/svx/galbrws.hxx
svx/inc/svx/sdr/table/tablecontroller.hxx
svx/inc/svx/svdmodel.hxx
svx/inc/svx/svdstr.hrc
svx/inc/svx/svxids.hrc
svx/inc/svx/svxitems.hrc
svx/inc/svx/xattr.hxx
svx/inc/svx/xflgrit.hxx
svx/inc/svx/xflhtit.hxx
svx/inc/svx/xit.hxx
svx/inc/svx/xlineit.hxx
svx/inc/svx/xlndsit.hxx
svx/inc/svx/xlnedit.hxx
svx/inc/svx/xlnstit.hxx
svx/inc/svx/xtable.hxx
svx/sdi/svx.sdi
svx/source/dialog/_bmpmask.cxx
svx/source/dialog/dialcontrol.cxx
svx/source/dialog/dlgctrl.cxx
svx/source/dialog/dlgutil.cxx
svx/source/dialog/fontwork.cxx
svx/source/gallery2/galbrws.cxx
svx/source/gallery2/galbrws1.cxx
svx/source/gallery2/gallery1.cxx
svx/source/items/drawitem.cxx
svx/source/items/svxitems.src
svx/source/sdr/attribute/sdrformtextattribute.cxx
svx/source/sidebar/ColorPanel.hxx
svx/source/sidebar/EmptyPanel.hrc
svx/source/sidebar/EmptyPanel.hxx
svx/source/sidebar/gallery/GalleryPanel.hxx
svx/source/svdraw/svdedtv1.cxx
svx/source/svdraw/svdmodel.cxx
svx/source/svdraw/svdogrp.cxx
svx/source/svdraw/svdstr.src
svx/source/tbxctrls/tbcontrl.cxx
svx/source/unodraw/XPropertyTable.cxx
svx/source/unodraw/unoctabl.cxx
svx/source/xoutdev/XPropertyEntry.cxx
svx/source/xoutdev/xattr.cxx
svx/source/xoutdev/xattr2.cxx
svx/source/xoutdev/xtabbtmp.cxx
svx/source/xoutdev/xtabcolr.cxx
svx/source/xoutdev/xtabdash.cxx
svx/source/xoutdev/xtabgrdt.cxx
svx/source/xoutdev/xtabhtch.cxx
svx/source/xoutdev/xtable.cxx
svx/source/xoutdev/xtablend.cxx
svx/util/svx.component
sw/inc/cmdid.h
sw/inc/docsh.hxx
sw/inc/editsh.hxx
sw/inc/helpid.h
sw/inc/rcid.hrc
sw/inc/swabstdlg.hxx
sw/inc/swcommands.h
sw/sdi/swriter.sdi
sw/source/core/doc/docdesc.cxx
sw/source/core/draw/drawdoc.cxx
sw/source/ui/app/docsh2.cxx
sw/source/ui/app/docshdrw.cxx
sw/source/ui/app/docshini.cxx
sw/source/ui/app/docst.cxx
sw/source/ui/config/optpage.cxx
sw/source/ui/dialog/swdlgfact.cxx
sw/source/ui/dialog/swdlgfact.hxx
sw/source/ui/fmtui/tmpdlg.cxx
sw/source/ui/inc/tmpdlg.hxx
sw/source/ui/misc/pggrid.cxx
sw/source/ui/shells/annotsh.cxx
sw/source/ui/shells/basesh.cxx
sw/source/ui/shells/beziersh.cxx
sw/source/ui/shells/drawdlg.cxx
sw/source/ui/shells/drawsh.cxx
sw/source/ui/shells/drformsh.cxx
sw/source/ui/shells/drwbassh.cxx
sw/source/ui/shells/drwtxtex.cxx
sw/source/ui/shells/drwtxtsh.cxx
sw/source/ui/shells/frmsh.cxx
sw/source/ui/shells/grfsh.cxx
sw/source/ui/shells/olesh.cxx
sw/source/ui/shells/tabsh.cxx
sw/source/ui/shells/textsh.cxx
sw/source/ui/shells/textsh1.cxx
sw/source/ui/shells/txtnum.cxx
sw/source/ui/uiview/viewtab.cxx
sw/source/ui/uno/unofreg.cxx
sw/source/ui/utlui/navipi.cxx
sw/util/sw.component
vcl/inc/vcl/split.hxx
vcl/inc/vcl/window.hxx
vcl/inc/window.h
vcl/source/window/split.cxx
vcl/source/window/window.cxx
vcl/source/window/window4.cxx
Change-Id: Idebaff59f9d60e4e93290cefefdda4c5a1e9215e
Resolves: #i122194# Adapted license text in propertypanel.hrc
then renamed it to ResourceDefinitions.hrc
(cherry picked from commit e952d1401c1adc41934118ba7f542611ef9da11b)
Conflicts:
sfx2/Package_inc.mk
sfx2/source/sidebar/SidebarChildWindow.cxx
svx/source/sidebar/graphic/GraphicPropertyPanel.cxx
svx/source/sidebar/line/LinePropertyPanel.cxx
svx/source/sidebar/possize/PosSizePropertyPanel.cxx
sw/source/ui/sidebar/PagePropertyPanel.src
sw/source/ui/sidebar/WrapPropertyPanel.src
Change-Id: Ie009056a78ab108556717a501399c83b477b3548
Resolves: #i122194# finally I got the correct file name
Change-Id: If7a075af8c9a829f6f0a69f883c5c6d4ac97ba2a
More merge changes for optional sidebar:
revert toolpanel removal, restore and re-enable task pane
remove apparently un-used SidebarFactory module
add extra visibility annotation to ItemReceiverUpdate
935 files changed, 66148 insertions, 1654 deletions
diff --git a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx index 88b611200308..fa8d1ebcd763 100644 --- a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx +++ b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx @@ -286,10 +286,10 @@ SdrOutliner* DrawViewWrapper::getOutliner() const SfxItemSet DrawViewWrapper::getPositionAndSizeItemSetFromMarkedObject() const { SfxItemSet aFullSet( GetModel()->GetItemPool(), - SID_ATTR_TRANSFORM_POS_X,SID_ATTR_TRANSFORM_ANGLE, - SID_ATTR_TRANSFORM_PROTECT_POS,SID_ATTR_TRANSFORM_AUTOHEIGHT, - SDRATTR_ECKENRADIUS,SDRATTR_ECKENRADIUS, - SID_ATTR_METRIC,SID_ATTR_METRIC, + SID_ATTR_TRANSFORM_POS_X, SID_ATTR_TRANSFORM_ANGLE, + SID_ATTR_TRANSFORM_PROTECT_POS, SID_ATTR_TRANSFORM_AUTOHEIGHT, + SDRATTR_ECKENRADIUS, SDRATTR_ECKENRADIUS, + SID_ATTR_METRIC, SID_ATTR_METRIC, 0); SfxItemSet aGeoSet( E3dView::GetGeoAttrFromMarked() ); aFullSet.Put( aGeoSet ); diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx index 05c23ef2397d..4d3576d27731 100644 --- a/cui/source/tabpages/tpbitmap.cxx +++ b/cui/source/tabpages/tpbitmap.cxx @@ -555,8 +555,8 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickAddHdl_Impl) if( pEntry ) { pBitmapList->Insert( pEntry ); - - aLbBitmaps.Append( pEntry ); + const Size aUiSize(pBitmapList->getUiBitmapWidth(), pBitmapList->getUiBitmapHeight()); + aLbBitmaps.Append(aUiSize, *pEntry ); aLbBitmaps.SelectEntryPos( aLbBitmaps.GetEntryCount() - 1 ); #ifdef WNT @@ -657,7 +657,8 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickImportHdl_Impl) XBitmapEntry* pEntry = new XBitmapEntry( aGraphic, aName ); pBitmapList->Insert( pEntry ); - aLbBitmaps.Append( pEntry ); + const Size aUiSize(pBitmapList->getUiBitmapWidth(), pBitmapList->getUiBitmapHeight()); + aLbBitmaps.Append(aUiSize, *pEntry ); aLbBitmaps.SelectEntryPos( aLbBitmaps.GetEntryCount() - 1 ); #ifdef WNT @@ -705,6 +706,7 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickModifyHdl_Impl) long nCount = pBitmapList->Count(); sal_Bool bDifferent = sal_False; sal_Bool bLoop = sal_True; + const Size aUiSize(pBitmapList->getUiBitmapWidth(), pBitmapList->getUiBitmapHeight()); while( bLoop && pDlg->Execute() == RET_OK ) { @@ -729,7 +731,7 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickModifyHdl_Impl) pEntry->SetGraphicObject(Graphic(aBitmapEx)); - aLbBitmaps.Modify( pEntry, nPos ); + aLbBitmaps.Modify( aUiSize, *pEntry, nPos ); aLbBitmaps.SelectEntryPos( nPos ); *pnBitmapListState |= CT_MODIFIED; diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx index 8f80f9132818..42d5ca8908d3 100644 --- a/cui/source/tabpages/tpline.cxx +++ b/cui/source/tabpages/tpline.cxx @@ -513,7 +513,7 @@ void SvxLineTabPage::FillListboxes() { // Line styles sal_uInt16 nOldSelect = aLbLineStyle.GetSelectEntryPos(); - aLbLineStyle.FillStyles(); + // aLbLineStyle.FillStyles(); aLbLineStyle.Fill( pDashList ); aLbLineStyle.SelectEntryPos( nOldSelect ); @@ -887,22 +887,22 @@ sal_Bool SvxLineTabPage::FillItemSet( SfxItemSet& rAttrs ) { case 0: // Rounded, default { - pNew = new XLineJointItem(XLINEJOINT_ROUND); + pNew = new XLineJointItem(com::sun::star::drawing::LineJoint_ROUND); break; } case 1: // - none - { - pNew = new XLineJointItem(XLINEJOINT_NONE); + pNew = new XLineJointItem(com::sun::star::drawing::LineJoint_NONE); break; } case 2: // Miter { - pNew = new XLineJointItem(XLINEJOINT_MITER); + pNew = new XLineJointItem(com::sun::star::drawing::LineJoint_MITER); break; } case 3: // Bevel { - pNew = new XLineJointItem(XLINEJOINT_BEVEL); + pNew = new XLineJointItem(com::sun::star::drawing::LineJoint_BEVEL); break; } } @@ -1053,22 +1053,22 @@ sal_Bool SvxLineTabPage::FillXLSet_Impl() { case 0: // Rounded, default { - rXLSet.Put(XLineJointItem(XLINEJOINT_ROUND)); + rXLSet.Put(XLineJointItem(com::sun::star::drawing::LineJoint_ROUND)); break; } case 1: // - none - { - rXLSet.Put(XLineJointItem(XLINEJOINT_NONE)); + rXLSet.Put(XLineJointItem(com::sun::star::drawing::LineJoint_NONE)); break; } case 2: // Miter { - rXLSet.Put(XLineJointItem(XLINEJOINT_MITER)); + rXLSet.Put(XLineJointItem(com::sun::star::drawing::LineJoint_MITER)); break; } case 3: // Bevel { - rXLSet.Put(XLineJointItem(XLINEJOINT_BEVEL)); + rXLSet.Put(XLineJointItem(com::sun::star::drawing::LineJoint_BEVEL)); break; } } @@ -1480,15 +1480,16 @@ void SvxLineTabPage::Reset( const SfxItemSet& rAttrs ) } else if(SFX_ITEM_DONTCARE != rAttrs.GetItemState(XATTR_LINEJOINT)) { - XLineJoint eLineJoint = ((const XLineJointItem&)(rAttrs.Get(XATTR_LINEJOINT))).GetValue(); + const com::sun::star::drawing::LineJoint eLineJoint = ((const XLineJointItem&)(rAttrs.Get(XATTR_LINEJOINT))).GetValue(); switch(eLineJoint) { - case XLINEJOINT_ROUND : maLBEdgeStyle.SelectEntryPos(0); break; - case XLINEJOINT_NONE : maLBEdgeStyle.SelectEntryPos(1); break; - case XLINEJOINT_MITER : maLBEdgeStyle.SelectEntryPos(2); break; - case XLINEJOINT_BEVEL : maLBEdgeStyle.SelectEntryPos(3); break; - case XLINEJOINT_MIDDLE : break; + case com::sun::star::drawing::LineJoint_MAKE_FIXED_SIZE: // fallback to round, unused value + case com::sun::star::drawing::LineJoint_MIDDLE : // fallback to round, unused value + case com::sun::star::drawing::LineJoint_ROUND : maLBEdgeStyle.SelectEntryPos(0); break; + case com::sun::star::drawing::LineJoint_NONE : maLBEdgeStyle.SelectEntryPos(1); break; + case com::sun::star::drawing::LineJoint_MITER : maLBEdgeStyle.SelectEntryPos(2); break; + case com::sun::star::drawing::LineJoint_BEVEL : maLBEdgeStyle.SelectEntryPos(3); break; } } else diff --git a/cui/source/tabpages/tplnedef.cxx b/cui/source/tabpages/tplnedef.cxx index 7bf9ad2720fe..563fa72493f4 100644 --- a/cui/source/tabpages/tplnedef.cxx +++ b/cui/source/tabpages/tplnedef.cxx @@ -585,8 +585,8 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ClickAddHdl_Impl) long nDashCount = pDashList->Count(); pDashList->Insert( pEntry, nDashCount ); - Bitmap* pBitmap = pDashList->GetBitmap( nDashCount ); - aLbLineStyles.Append( pEntry, pBitmap ); + const Bitmap aBitmap = pDashList->GetUiBitmap( nDashCount ); + aLbLineStyles.Append( pEntry, &aBitmap ); aLbLineStyles.SelectEntryPos( aLbLineStyles.GetEntryCount() - 1 ); @@ -664,8 +664,8 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ClickModifyHdl_Impl) XDashEntry* pEntry = new XDashEntry( aDash, aName ); delete pDashList->Replace( pEntry, nPos ); - Bitmap* pBitmap = pDashList->GetBitmap( nPos ); - aLbLineStyles.Modify( pEntry, nPos, pBitmap ); + const Bitmap aBitmap = pDashList->GetUiBitmap( nPos ); + aLbLineStyles.Modify( pEntry, nPos, &aBitmap ); aLbLineStyles.SelectEntryPos( nPos ); diff --git a/cui/source/tabpages/tplneend.cxx b/cui/source/tabpages/tplneend.cxx index 3155b3265585..52937bf29856 100644 --- a/cui/source/tabpages/tplneend.cxx +++ b/cui/source/tabpages/tplneend.cxx @@ -370,7 +370,8 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickModifyHdl_Impl) pEntry->SetName( aName ); aEdtName.SetText( aName ); - aLbLineEnds.Modify( pEntry, nPos, pLineEndList->GetBitmap( nPos ) ); + const Bitmap aUiBitmap( pLineEndList->GetUiBitmap( nPos ) ); + aLbLineEnds.Modify( pEntry, nPos, &aUiBitmap ); aLbLineEnds.SelectEntryPos( nPos ); *pnLineEndListState |= CT_MODIFIED; @@ -466,10 +467,10 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickAddHdl_Impl) long nLineEndCount = pLineEndList->Count(); pLineEndList->Insert( pEntry, nLineEndCount ); - Bitmap* pBitmap = pLineEndList->GetBitmap( nLineEndCount ); + const Bitmap aBitmap = pLineEndList->GetUiBitmap( nLineEndCount ); // add to the ListBox - aLbLineEnds.Append( pEntry, pBitmap ); + aLbLineEnds.Append( pEntry, &aBitmap ); aLbLineEnds.SelectEntryPos( aLbLineEnds.GetEntryCount() - 1 ); *pnLineEndListState |= CT_MODIFIED; diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index 66f5fa3c539f..c026f1d951a0 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -3649,6 +3649,16 @@ void SvxScriptSetItem::GetSlotIds( sal_uInt16 nSlotId, sal_uInt16& rLatin, rAsian = SID_ATTR_CHAR_CJK_LANGUAGE; rComplex = SID_ATTR_CHAR_CTL_LANGUAGE; break; + case SID_ATTR_CHAR_SHADOWED: + rLatin = SID_ATTR_CHAR_SHADOWED; + rAsian = SID_ATTR_CHAR_SHADOWED; + rComplex = SID_ATTR_CHAR_SHADOWED; + break; + case SID_ATTR_CHAR_STRIKEOUT: + rLatin = SID_ATTR_CHAR_STRIKEOUT; + rAsian = SID_ATTR_CHAR_STRIKEOUT; + rComplex = SID_ATTR_CHAR_STRIKEOUT; + break; } } diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx index 3782bb4f69e9..c8971da9f06a 100644 --- a/editeng/source/outliner/outliner.cxx +++ b/editeng/source/outliner/outliner.cxx @@ -334,6 +334,52 @@ void Outliner::SetParaIsNumberingRestart( sal_Int32 nPara, sal_Bool bParaIsNumbe } } +sal_Int32 Outliner::GetBulletsNumberingStatus() +{ + sal_Bool bHasBulletsNumbering = FALSE; + sal_uInt32 nParaCount = (sal_uInt32)(pParaList->GetParagraphCount()); + for (sal_uInt32 nPara = 0; nPara < nParaCount; nPara++) + { + if ((bHasBulletsNumbering = ImplHasBullet(nPara))) + { + break; + } + } + sal_uInt16 nBulletsCount = 0; + sal_uInt16 nNumberingCount = 0; + if (bHasBulletsNumbering) + { + // At least have one paragraph that having bullets or numbering. + for (sal_uInt32 nPara = 0; nPara < nParaCount; nPara++) + { + Paragraph* pPara = pParaList->GetParagraph(nPara); + if (!pPara) + { + continue; + } + const SvxNumberFormat* pFmt = GetNumberFormat(nPara); + if (!pFmt) + { + // At least, exists one paragraph that has no Bullets/Numbering. + break; + } + else if ((pFmt->GetNumberingType() == SVX_NUM_BITMAP) || (pFmt->GetNumberingType() == SVX_NUM_CHAR_SPECIAL)) + { + // Having Bullets in this paragraph. + nBulletsCount++; + } + else + { + // Having Numbering in this paragraph. + nNumberingCount++; + } + } + } + sal_Int32 nValue = (nBulletsCount == nParaCount) ? 0 : 2; + nValue = (nNumberingCount == nParaCount) ? 1 : nValue; + return nValue; +} + OutlinerParaObject* Outliner::CreateParaObject( sal_Int32 nStartPara, sal_Int32 nCount ) const { DBG_CHKTHIS(Outliner,0); diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx index 2229857dd837..38ec5e63101c 100644 --- a/editeng/source/outliner/outlvw.cxx +++ b/editeng/source/outliner/outlvw.cxx @@ -40,6 +40,7 @@ #include <editeng/numitem.hxx> #include <vcl/window.hxx> #include <svl/itemset.hxx> +#include <svl/eitem.hxx> #include <editeng/editstat.hxx> using namespace ::com::sun::star; @@ -923,6 +924,204 @@ void OutlinerView::ToggleBullets() pOwner->UndoActionEnd( OLUNDO_DEPTH ); } +sal_Bool OutlinerView::ToggleBullets(sal_Bool bBulletOnOff, sal_Bool bNormalBullet, sal_Bool bMasterView, SvxNumRule* pNumRule, sal_Bool bForceBulletOnOff) +{ + pOwner->UndoActionStart( OLUNDO_DEPTH ); + + ESelection aSel( pEditView->GetSelection() ); + aSel.Adjust(); + + const bool bUpdate = pOwner->pEditEngine->GetUpdateMode(); + pOwner->pEditEngine->SetUpdateMode( sal_False ); + + sal_Int16 nDepth = -2; + sal_Bool bRet = sal_False; + + //Modified by xuezhiy for bullet enhancement + bool bBulletOn = sal_True; + + if( bBulletOnOff ) + { + bool bHasBullet = sal_False; + for ( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ ) + { + bHasBullet = pOwner->ImplHasBullet(nPara); + if(bHasBullet) + break; + } + + if( bHasBullet ) + { + bBulletOn = sal_False; + + for ( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ ) + { + Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); + DBG_ASSERT(pPara, "OutlinerView::ToggleBullets(), illegal selection?"); + + if( pPara ) + { + const SvxNumberFormat* pFmt = pOwner ->GetNumberFormat(nPara); + + if( !pFmt ) + { + // Has no Bullet paragraph + bBulletOn = sal_True; + break; + } + else if( ( pFmt->GetNumberingType() == SVX_NUM_BITMAP ) || ( pFmt->GetNumberingType() == SVX_NUM_CHAR_SPECIAL ) ) + { + // Normal ==>> Numbering + if( !bNormalBullet ) + { + bBulletOn = sal_True; + break; + } + } + else + { + // Numbering ==>> Normal + if( bNormalBullet ) + { + bBulletOn = sal_True; + break; + } + } + } + } + } + + } + if (bForceBulletOnOff) { + bBulletOn = bBulletOnOff; + } + for ( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ ) + { + Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); + DBG_ASSERT(pPara, "OutlinerView::ToggleBullets(), illegal selection?"); + + if( pPara ) + { + bRet = sal_True; + + nDepth = pOwner->GetDepth(nPara); + + if( bBulletOn && nDepth == -1 ) + { + // Off ==>> On + nDepth = 0; + } + else if( !bBulletOn && nDepth == 0 ) + { + // On ==>> Off + nDepth = -1; + } + pOwner->SetDepth( pPara, nDepth ); + + const SfxItemSet& rAttrs = pOwner->GetParaAttribs( nPara ); +// bool bBulletState = ((const SfxBoolItem&) rAttrs.Get( EE_PARA_BULLETSTATE ) ).GetValue(); + + SfxItemSet aAttrs(rAttrs); + aAttrs.Put( SfxBoolItem( EE_PARA_BULLETSTATE, bBulletOn ) ); + + // Change bullet types + if( bBulletOn && pNumRule) + { + bool bSetBulletType = false; + if( !bBulletOnOff ) + { + // Not bullet on/off button + bSetBulletType = true; + } + else + { + const SvxNumberFormat* pFmt = pOwner ->GetNumberFormat(nPara); + + if( !pFmt ) + { + // Has no bullet + bSetBulletType = true; + } + else + { + sal_Int16 nNumType = pFmt->GetNumberingType(); + if( bNormalBullet && nNumType != SVX_NUM_BITMAP && nNumType != SVX_NUM_CHAR_SPECIAL ) + { + // Set to Normal bullet, old bullet type is Numbering bullet + bSetBulletType = true; + } + else if( !bNormalBullet && (nNumType == SVX_NUM_BITMAP || nNumType == SVX_NUM_CHAR_SPECIAL) ) + { + // Set to Numbering bullet, old bullet type is Normal bullet + bSetBulletType = true; + } + } + } + + // Get old bullet space + SvxNumRule aNewRule( *pNumRule ); + + const SfxPoolItem* pPoolItem=NULL; + SfxItemState eState = rAttrs.GetItemState(EE_PARA_NUMBULLET, sal_False, &pPoolItem); + if (eState != SFX_ITEM_SET) + { + // Use default value when has not contain bullet item + ESelection aSelection(nPara, 0); + SfxItemSet aTmpSet( pOwner->pEditEngine->GetAttribs( aSelection ) ); + pPoolItem = aTmpSet.GetItem( EE_PARA_NUMBULLET ); + } + + const SvxNumBulletItem* pNumBulletItem = dynamic_cast< const SvxNumBulletItem* >( pPoolItem ); + //const SvxNumBulletItem& rNumBullet = (const SvxNumBulletItem&) rAttrs.Get( EE_PARA_NUMBULLET ); + if( pNumBulletItem ) + { + sal_uInt16 nLevelCnt = pNumBulletItem->GetNumRule()->GetLevelCount(); + nLevelCnt = std::min( nLevelCnt, pNumRule->GetLevelCount() ); + + for( sal_uInt16 nLevel = 0; nLevel < nLevelCnt; ++nLevel ) + { + const SvxNumberFormat* pOldFmt = pNumBulletItem->GetNumRule()->Get( nLevel ); + const SvxNumberFormat* pNewFmt = pNumRule->Get( nLevel ); + + if( pOldFmt && pNewFmt && (pOldFmt->GetFirstLineOffset() != pNewFmt->GetFirstLineOffset() + || pOldFmt->GetAbsLSpace() != pNewFmt->GetAbsLSpace() ) ) + { + SvxNumberFormat* pNewFmtClone = new SvxNumberFormat( *pNewFmt ); + pNewFmtClone->SetFirstLineOffset( pOldFmt->GetFirstLineOffset() ); + pNewFmtClone->SetAbsLSpace( pOldFmt->GetAbsLSpace() ); + + aNewRule.SetLevel( nLevel, pNewFmtClone ); + delete pNewFmtClone; + } + } + } + + // Don't set bullet attribute to paragraph in Master view + // Because it will be set into style sheet + if( bSetBulletType && !bMasterView ) + aAttrs.Put(SvxNumBulletItem( aNewRule ), EE_PARA_NUMBULLET); + } + + pOwner->SetParaAttribs( nPara, aAttrs ); + + } + } + + // --> OD 2009-03-10 #i100014# + // It is not a good idea to substract 1 from a count and cast the result + // to sal_uInt16 without check, if the count is 0. + sal_uInt16 nParaCount = (sal_uInt16) (pOwner->pParaList->GetParagraphCount()); + // <-- + pOwner->ImplCheckParagraphs( aSel.nStartPara, nParaCount ); + pOwner->pEditEngine->QuickMarkInvalid( ESelection( aSel.nStartPara, 0, nParaCount, 0 ) ); + + pOwner->pEditEngine->SetUpdateMode( bUpdate ); + + pOwner->UndoActionEnd( OLUNDO_DEPTH ); + + return bRet; +} + void OutlinerView::EnableBullets() { pOwner->UndoActionStart( OLUNDO_DEPTH ); @@ -955,6 +1154,126 @@ void OutlinerView::EnableBullets() pOwner->UndoActionEnd( OLUNDO_DEPTH ); } +sal_Bool OutlinerView::ToggleAllParagraphsBullets(sal_Bool bBulletOnOffMode, sal_Bool bNormalBullet, sal_Bool bToggleOn, sal_Bool bMasterView, SvxNumRule* pNumRule) +{ + if (!pOwner || !pOwner->pEditEngine || !pOwner->pParaList) + { + return sal_False; + } + + sal_Bool bReturn = sal_False; + pOwner->UndoActionStart(OLUNDO_DEPTH); + const sal_Bool bUpdate = pOwner->pEditEngine->GetUpdateMode(); + pOwner->pEditEngine->SetUpdateMode(sal_False); + + sal_Int16 nDepth = -2; + sal_uInt16 nParaCount = (sal_uInt16)(pOwner->pParaList->GetParagraphCount()); + for (sal_uInt16 nPara = 0; nPara < nParaCount; nPara++) + { + Paragraph* pPara = pOwner->pParaList->GetParagraph(nPara); + DBG_ASSERT(pPara, "OutlinerView::ToggleAllParagraphsBullets(), illegal selection?"); + + if (pPara) + { + bReturn = sal_True; + nDepth = pOwner->GetDepth(nPara); + if (bToggleOn && nDepth == -1) + { + // Off ==>> On + nDepth = 0; + } + else if (!bToggleOn && nDepth == 0) + { + // On ==>> Off + nDepth = -1; + } + pOwner->SetDepth(pPara, nDepth); + + const SfxItemSet& rAttrs = pOwner->GetParaAttribs(nPara); + SfxItemSet aAttrs(rAttrs); + aAttrs.Put(SfxBoolItem(EE_PARA_BULLETSTATE, bToggleOn)); + + // Change bullet types. + if (bToggleOn && pNumRule) + { + sal_Bool bSetBulletType = sal_False; + if (!bBulletOnOffMode) + { + // Not bullet on/off button. + bSetBulletType = sal_True; + } + else + { + const SvxNumberFormat* pFmt = pOwner ->GetNumberFormat(nPara); + if (!pFmt) + { + // Has no bullet. + bSetBulletType = sal_True; + } + else + { + sal_Int16 nNumType = pFmt->GetNumberingType(); + if (bNormalBullet && nNumType != SVX_NUM_BITMAP && nNumType != SVX_NUM_CHAR_SPECIAL) + { + // Set to Normal bullet, old bullet type is Numbering bullet. + bSetBulletType = sal_True; + } + else if (!bNormalBullet && (nNumType == SVX_NUM_BITMAP || nNumType == SVX_NUM_CHAR_SPECIAL)) + { + // Set to Numbering bullet, old bullet type is Normal bullet. + bSetBulletType = sal_True; + } + } + } + + // Get old bullet space. + SvxNumRule aNewRule(*pNumRule); + const SfxPoolItem* pPoolItem=NULL; + SfxItemState eState = rAttrs.GetItemState(EE_PARA_NUMBULLET, sal_False, &pPoolItem); + ESelection aSelection(nPara, 0); + SfxItemSet aTmpSet(pOwner->pEditEngine->GetAttribs(aSelection)); + if (eState != SFX_ITEM_SET) + { + // Use default value when has not contain bullet item. + pPoolItem = aTmpSet.GetItem(EE_PARA_NUMBULLET); + } + + const SvxNumBulletItem* pNumBulletItem = dynamic_cast< const SvxNumBulletItem* >(pPoolItem); + if (pNumBulletItem) + { + sal_uInt16 nLevelCnt = pNumBulletItem->GetNumRule()->GetLevelCount(); + nLevelCnt = std::min(nLevelCnt, pNumRule->GetLevelCount()); + + for (sal_uInt16 nLevel = 0; nLevel < nLevelCnt; nLevel++) + { + const SvxNumberFormat* pOldFmt = pNumBulletItem->GetNumRule()->Get(nLevel); + const SvxNumberFormat* pNewFmt = pNumRule->Get(nLevel); + if (pOldFmt && pNewFmt && (pOldFmt->GetFirstLineOffset() != pNewFmt->GetFirstLineOffset() || pOldFmt->GetAbsLSpace() != pNewFmt->GetAbsLSpace())) + { + SvxNumberFormat* pNewFmtClone = new SvxNumberFormat(*pNewFmt); + pNewFmtClone->SetFirstLineOffset(pOldFmt->GetFirstLineOffset()); + pNewFmtClone->SetAbsLSpace(pOldFmt->GetAbsLSpace()); + aNewRule.SetLevel(nLevel, pNewFmtClone); + delete pNewFmtClone; + } + } + } + + // Don't set bullet attribute to paragraph in Master view, because it will be set into style sheet. + if (bSetBulletType && !bMasterView) + aAttrs.Put(SvxNumBulletItem(aNewRule), EE_PARA_NUMBULLET); + } + pOwner->SetParaAttribs(nPara, aAttrs); + } + } + + pOwner->ImplCheckParagraphs(0, nParaCount); + pOwner->pEditEngine->QuickMarkInvalid(ESelection(0, 0, nParaCount, 0)); + pOwner->pEditEngine->SetUpdateMode(bUpdate); + pOwner->UndoActionEnd(OLUNDO_DEPTH); + + return bReturn; +} void OutlinerView::RemoveAttribsKeepLanguages( sal_Bool bRemoveParaAttribs ) { diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index bc6f9a979198..feac1c71b79d 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -997,11 +997,11 @@ void DffPropertyReader::ApplyLineAttributes( SfxItemSet& rSet, const MSO_SPT eSh if ( eShapeType == mso_sptMin ) eLineJointDefault = mso_lineJoinRound; MSO_LineJoin eLineJoint = (MSO_LineJoin)GetPropertyValue( DFF_Prop_lineJoinStyle, eLineJointDefault ); - XLineJoint eXLineJoint( XLINEJOINT_MITER ); + com::sun::star::drawing::LineJoint eXLineJoint( com::sun::star::drawing::LineJoint_MITER ); if ( eLineJoint == mso_lineJoinBevel ) - eXLineJoint = XLINEJOINT_BEVEL; + eXLineJoint = com::sun::star::drawing::LineJoint_BEVEL; else if ( eLineJoint == mso_lineJoinRound ) - eXLineJoint = XLINEJOINT_ROUND; + eXLineJoint = com::sun::star::drawing::LineJoint_ROUND; rSet.Put( XLineJointItem( eXLineJoint ) ); if ( nLineFlags & 0x10 ) diff --git a/framework/Library_fwk.mk b/framework/Library_fwk.mk index f534aab81979..d1818146dfd9 100644 --- a/framework/Library_fwk.mk +++ b/framework/Library_fwk.mk @@ -108,6 +108,7 @@ $(eval $(call gb_Library_add_exception_objects,fwk,\ framework/source/services/backingcomp \ framework/source/services/backingwindow \ framework/source/services/desktop \ + framework/source/services/ContextChangeEventMultiplexer \ framework/source/services/frame \ framework/source/services/modulemanager \ framework/source/services/pathsettings \ diff --git a/framework/inc/macros/registration.hxx b/framework/inc/macros/registration.hxx index bfdc18c8db13..f5c102a50770 100644 --- a/framework/inc/macros/registration.hxx +++ b/framework/inc/macros/registration.hxx @@ -71,7 +71,7 @@ ________________________________________________________________________________ { \ LOG_REGISTRATION_GETFACTORY( "\t\tpImplementationName and pServiceManager are valid ...\n" ) \ /* Define variables which are used in following macros. */ \ - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > xFactory ; \ + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xFactory ; \ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceManager ; \ xServiceManager = reinterpret_cast< ::com::sun::star::lang::XMultiServiceFactory* >( pServiceManager ) ; \ /* These parameter will expand to */ \ diff --git a/framework/inc/services/ContextChangeEventMultiplexer.hxx b/framework/inc/services/ContextChangeEventMultiplexer.hxx new file mode 100644 index 000000000000..3a7bd956b7fc --- /dev/null +++ b/framework/inc/services/ContextChangeEventMultiplexer.hxx @@ -0,0 +1,138 @@ +/* + * 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 __FRAMEWORK_SERVICES_CONTEXT_CHANGE_EVENT_MULTIPLEXER_HXX_ +#define __FRAMEWORK_SERVICES_CONTEXT_CHANGE_EVENT_MULTIPLEXER_HXX_ + +#include <com/sun/star/ui/XContextChangeEventMultiplexer.hpp> + +#include <cppuhelper/compbase4.hxx> +#include <cppuhelper/basemutex.hxx> + +#include "macros/xserviceinfo.hxx" + +#include <map> +#include <boost/noncopyable.hpp> + + +namespace +{ + typedef ::cppu::WeakComponentImplHelper4 < + css::ui::XContextChangeEventMultiplexer, + css::lang::XSingleComponentFactory, + css::lang::XServiceInfo, + css::lang::XEventListener + > ContextChangeEventMultiplexerInterfaceBase; +} + + +namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; +namespace cssl = ::com::sun::star::lang; + +namespace framework { + +class ContextChangeEventMultiplexer + : private ::boost::noncopyable, + private ::cppu::BaseMutex, + public ContextChangeEventMultiplexerInterfaceBase +{ +public: + ContextChangeEventMultiplexer(const cssu::Reference<css::uno::XComponentContext>& rxContext); + virtual ~ContextChangeEventMultiplexer (void); + + virtual void SAL_CALL disposing (void); + + // XContextChangeEventMultiplexer + virtual void SAL_CALL addContextChangeEventListener ( + const cssu::Reference<css::ui::XContextChangeEventListener>& rxListener, + const cssu::Reference<cssu::XInterface>& rxEventFocus) + throw(cssu::RuntimeException, cssl::IllegalArgumentException); + virtual void SAL_CALL removeContextChangeEventListener ( + const cssu::Reference<css::ui::XContextChangeEventListener>& rxListener, + const cssu::Reference<cssu::XInterface>& rxEventFocus) + throw(cssu::RuntimeException, cssl::IllegalArgumentException); + virtual void SAL_CALL removeAllContextChangeEventListeners ( + const cssu::Reference<css::ui::XContextChangeEventListener>& rxListener) + throw(cssu::RuntimeException, cssl::IllegalArgumentException); + virtual void SAL_CALL broadcastContextChangeEvent ( + const css::ui::ContextChangeEventObject& rContextChangeEventObject, + const cssu::Reference<cssu::XInterface>& rxEventFocus) + throw(cssu::RuntimeException); + + // XSingleComponentFactory + virtual cssu::Reference<cssu::XInterface> SAL_CALL createInstanceWithContext ( + const cssu::Reference<cssu::XComponentContext>& rxContext) + throw (cssu::Exception, cssu::RuntimeException); + virtual cssu::Reference<cssu::XInterface > SAL_CALL createInstanceWithArgumentsAndContext ( + const cssu::Sequence<cssu::Any>& rArguments, + const cssu::Reference<cssu::XComponentContext>& rxContext) + throw (cssu::Exception, cssu::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName (void) + throw (cssu::RuntimeException); + virtual sal_Bool SAL_CALL supportsService ( + const ::rtl::OUString& rsServiceName) + throw (cssu::RuntimeException); + virtual cssu::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames (void) + throw (cssu::RuntimeException); + + // XEventListener + virtual void SAL_CALL disposing ( + const css::lang::EventObject& rEvent) + throw (cssu::RuntimeException); + + static ::rtl::OUString SAL_CALL impl_getStaticImplementationName (void); + static cssu::Reference<cssu::XInterface> SAL_CALL impl_createFactory ( + const cssu::Reference<cssl::XMultiServiceFactory>& xServiceManager); + +private: + typedef ::std::vector<cssu::Reference<css::ui::XContextChangeEventListener> > ListenerContainer; + class FocusDescriptor + { + public: + ListenerContainer maListeners; + ::rtl::OUString msCurrentApplicationName; + ::rtl::OUString msCurrentContextName; + }; + typedef ::std::map<cssu::Reference<cssu::XInterface>, FocusDescriptor> ListenerMap; + ListenerMap maListeners; + + /** Notify all listeners in the container that is associated with + the given event focus. + + Typically called twice from broadcastEvent(), once for the + given event focus and onece for NULL. + */ + void BroadcastEventToSingleContainer ( + const css::ui::ContextChangeEventObject& rEventObject, + const cssu::Reference<cssu::XInterface>& rxEventFocus); + FocusDescriptor* GetFocusDescriptor ( + const cssu::Reference<cssu::XInterface>& rxEventFocus, + const bool bCreateWhenMissing); + + static cssu::Sequence< ::rtl::OUString > SAL_CALL static_GetSupportedServiceNames (void); + static cssu::Reference<cssu::XInterface> SAL_CALL static_CreateInstance ( + const cssu::Reference<cssu::XComponentContext>& rxComponentContext) + throw (cssu::Exception); +}; + +} // end of namespace framework + +#endif + diff --git a/framework/inc/services/EventMultiplexer.hxx b/framework/inc/services/EventMultiplexer.hxx new file mode 100644 index 000000000000..6e0881c08921 --- /dev/null +++ b/framework/inc/services/EventMultiplexer.hxx @@ -0,0 +1,116 @@ +/* + * 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 __FRAMEWORK_SERVICES_EVENT_MULTIPLEXER_HXX_ +#define __FRAMEWORK_SERVICES_EVENT_MULTIPLEXER_HXX_ + +#include <com/sun/star/util/XEventMultiplexer.hpp> + +#include <cppuhelper/compbase3.hxx> +#include <cppuhelper/basemutex.hxx> + +#include "macros/xserviceinfo.hxx" + +namespace +{ + typedef ::cppu::WeakComponentImplHelper3 < + css::util::XEventMultiplexer, + css::lang::XSingleComponentFactory, + css::lang::XServiceInfo + > EventMultiplexerInterfaceBase; +} + + +namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; +namespace cssl = ::com::sun::star::lang; + +namespace framework { + +class EventMultiplexer + : private ::boost::noncopyable, + private ::cppu::BaseMutex, + public EventMultiplexerInterfaceBase +{ +public: + EventMultiplexer(const cssu::Reference<css::uno::XComponentContext>& rxContext); + virtual ~EventMultiplexer (void); + + // XEventMultiplexer + virtual void SAL_CALL addEventListener ( + const cssu::Reference<css::util::XEventListener>& rxListener, + const cssu::Reference<cssu::XInterface>& rxEventFocus) + throw(cssu::RuntimeException, cssl::IllegalArgumentException); + virtual void SAL_CALL removeEventListener ( + const cssu::Reference<css::util::XEventListener>& rxListener, + const cssu::Reference<cssu::XInterface>& rxEventFocus) + throw(cssu::RuntimeException, cssl::IllegalArgumentException); + virtual void SAL_CALL removeAllEventListeners ( + const cssu::Reference<css::util::XEventListener>& rxListener) + throw(cssu::RuntimeException, cssl::IllegalArgumentException); + virtual void SAL_CALL broadcastEvent ( + const cssl::EventObject& rEventObject, + const cssu::Reference<cssu::XInterface>& rxEventFocus) + throw(cssu::RuntimeException); + + // XSingleComponentFactory + virtual cssu::Reference<cssu::XInterface> SAL_CALL createInstanceWithContext ( + const cssu::Reference<cssu::XComponentContext>& rxContext) + throw (cssu::Exception, cssu::RuntimeException); + virtual cssu::Reference<cssu::XInterface > SAL_CALL createInstanceWithArgumentsAndContext ( + const cssu::Sequence<cssu::Any>& rArguments, + const cssu::Reference<cssu::XComponentContext>& rxContext) + throw (cssu::Exception, cssu::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName (void) + throw (cssu::RuntimeException); + virtual sal_Bool SAL_CALL supportsService ( + const ::rtl::OUString& rsServiceName) + throw (cssu::RuntimeException); + virtual cssu::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames (void) + throw (cssu::RuntimeException); + + static ::rtl::OUString SAL_CALL impl_getStaticImplementationName (void); + static cssu::Reference<cssu::XInterface> SAL_CALL impl_createFactory ( + const cssu::Reference<cssl::XMultiServiceFactory>& xServiceManager); + +private: + typedef ::std::vector<cssu::Reference<css::util::XEventListener> > ListenerContainer; + typedef ::std::map<cssu::Reference<cssu::XInterface>, ListenerContainer> ListenerMap; + ListenerMap maListeners; + + /** Notify all listeners in the container that is associated with + the given event focus. + + Typically called twice from broadcastEvent(), once for the + given event focus and onece for NULL. + */ + void BroadcastEventToSingleContainer ( + const cssl::EventObject& rEventObject, + const cssu::Reference<cssu::XInterface>& rxEventFocus); + + static cssu::Sequence< ::rtl::OUString > SAL_CALL static_GetSupportedServiceNames (void); + static cssu::Reference<cssu::XInterface> SAL_CALL static_CreateInstance ( + const cssu::Reference<cssu::XComponentContext>& rxComponentContext) + throw (cssu::Exception); +}; + +} // end of namespace framework + +#endif + diff --git a/framework/source/register/registerservices.cxx b/framework/source/register/registerservices.cxx index f8fd6c2320cc..33ce118cec5e 100644 --- a/framework/source/register/registerservices.cxx +++ b/framework/source/register/registerservices.cxx @@ -66,12 +66,12 @@ #include <uiconfiguration/uicategorydescription.hxx> #include <services/sessionlistener.hxx> #include <services/taskcreatorsrv.hxx> - #include <uielement/langselectionstatusbarcontroller.hxx> #include <uiconfiguration/imagemanager.hxx> #include <uifactory/windowcontentfactorymanager.hxx> #include <services/substitutepathvars.hxx> #include <services/pathsettings.hxx> +#include <services/ContextChangeEventMultiplexer.hxx> COMPONENTGETFACTORY ( fwk, IFFACTORY( ::framework::URLTransformer ) else @@ -112,7 +112,8 @@ COMPONENTGETFACTORY ( fwk, IFFACTORY( ::framework::WindowContentFactoryManager ) else IFFACTORY( ::framework::TabWindowService ) else IFFACTORY( ::framework::SubstitutePathVariables ) else - IFFACTORY( ::framework::PathSettings ) + IFFACTORY( ::framework::PathSettings ) else + IFFACTORY( ::framework::ContextChangeEventMultiplexer ) ) /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/services/ContextChangeEventMultiplexer.cxx b/framework/source/services/ContextChangeEventMultiplexer.cxx new file mode 100644 index 000000000000..d4f30a40973f --- /dev/null +++ b/framework/source/services/ContextChangeEventMultiplexer.cxx @@ -0,0 +1,383 @@ +/* + * 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 "services/ContextChangeEventMultiplexer.hxx" +#include "services.h" + +using ::rtl::OUString; + +#define A2S(s) ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)) + +using namespace css; +using namespace cssu; + +namespace framework { + +#define IMPLEMENTATION_NAME "org.apache.openoffice.comp.framework.ContextChangeEventMultiplexer" +#define SERVICE_NAME "com.sun.star.ui.ContextChangeEventMultiplexer" +#define SINGLETON_NAME "org.apache.openoffice.comp.framework.ContextChangeEventMultiplexerSigleton" + + +ContextChangeEventMultiplexer::ContextChangeEventMultiplexer ( + const cssu::Reference<cssu::XComponentContext>& rxContext) + : ContextChangeEventMultiplexerInterfaceBase(m_aMutex), + maListeners() +{ + (void)rxContext; +} + + + + +ContextChangeEventMultiplexer::~ContextChangeEventMultiplexer (void) +{ +} + + + + +void SAL_CALL ContextChangeEventMultiplexer::disposing (void) +{ + ListenerMap aListeners; + aListeners.swap(maListeners); + + cssu::Reference<cssu::XInterface> xThis (static_cast<XWeak*>(this)); + css::lang::EventObject aEvent (xThis); + for (ListenerMap::const_iterator iContainer(aListeners.begin()), iEnd(aListeners.end()); + iContainer!=iEnd; + ++iContainer) + { + // Unregister from the focus object. + Reference<lang::XComponent> xComponent (iContainer->first, UNO_QUERY); + if (xComponent.is()) + xComponent->removeEventListener(this); + + // Tell all listeners that we are being disposed. + const FocusDescriptor& rFocusDescriptor (iContainer->second); + for (ListenerContainer::const_iterator + iListener(rFocusDescriptor.maListeners.begin()), + iContainerEnd(rFocusDescriptor.maListeners.end()); + iListener!=iContainerEnd; + ++iListener) + { + (*iListener)->disposing(aEvent); + } + } +} + + + + +// XContextChangeEventMultiplexer + +void SAL_CALL ContextChangeEventMultiplexer::addContextChangeEventListener ( + const cssu::Reference<css::ui::XContextChangeEventListener>& rxListener, + const cssu::Reference<cssu::XInterface>& rxEventFocus) + throw(cssu::RuntimeException,cssl::IllegalArgumentException) +{ + if ( ! rxListener.is()) + throw css::lang::IllegalArgumentException( + A2S("can not add an empty reference"), + static_cast<XWeak*>(this), + 0); + + FocusDescriptor* pFocusDescriptor = GetFocusDescriptor(rxEventFocus, true); + if (pFocusDescriptor != NULL) + { + ListenerContainer& rContainer (pFocusDescriptor->maListeners); + if (::std::find(rContainer.begin(), rContainer.end(), rxListener) == rContainer.end()) + rContainer.push_back(rxListener); + else + { + // The listener was added for the same event focus + // previously. That is an error. + throw cssl::IllegalArgumentException(A2S("listener added twice"), static_cast<XWeak*>(this), 0); + } + } + + // Send out an initial event that informs the new listener about + // the current context. + if (rxEventFocus.is() && pFocusDescriptor!=NULL) + { + css::ui::ContextChangeEventObject aEvent ( + NULL, + pFocusDescriptor->msCurrentApplicationName, + pFocusDescriptor->msCurrentContextName); + rxListener->notifyContextChangeEvent(aEvent); + } +} + + + + +void SAL_CALL ContextChangeEventMultiplexer::removeContextChangeEventListener ( + const cssu::Reference<css::ui::XContextChangeEventListener>& rxListener, + const cssu::Reference<cssu::XInterface>& rxEventFocus) + throw(cssu::RuntimeException,cssl::IllegalArgumentException) +{ + if ( ! rxListener.is()) + throw cssl::IllegalArgumentException( + A2S("can not remove an empty reference"), + static_cast<XWeak*>(this), 0); + + FocusDescriptor* pFocusDescriptor = GetFocusDescriptor(rxEventFocus, false); + if (pFocusDescriptor != NULL) + { + ListenerContainer& rContainer (pFocusDescriptor->maListeners); + const ListenerContainer::iterator iListener ( + ::std::find(rContainer.begin(), rContainer.end(), rxListener)); + if (iListener != rContainer.end()) + { + rContainer.erase(iListener); + + // We hold on to the focus descriptor even when the last listener has been removed. + // This allows us to keep track of the current context and send it to new listeners. + } + } + +} + + + + +void SAL_CALL ContextChangeEventMultiplexer::removeAllContextChangeEventListeners ( + const cssu::Reference<css::ui::XContextChangeEventListener>& rxListener) + throw(cssu::RuntimeException,cssl::IllegalArgumentException) +{ + if ( ! rxListener.is()) + throw cssl::IllegalArgumentException( + A2S("can not remove an empty reference"), + static_cast<XWeak*>(this), 0); + + for (ListenerMap::iterator + iContainer(maListeners.begin()), + iEnd(maListeners.end()); + iContainer!=iEnd; + ++iContainer) + { + const ListenerContainer::iterator iListener ( + ::std::find(iContainer->second.maListeners.begin(), iContainer->second.maListeners.end(), rxListener)); + if (iListener != iContainer->second.maListeners.end()) + { + iContainer->second.maListeners.erase(iListener); + + // We hold on to the focus descriptor even when the last listener has been removed. + // This allows us to keep track of the current context and send it to new listeners. + } + } +} + + + + +void SAL_CALL ContextChangeEventMultiplexer::broadcastContextChangeEvent ( + const css::ui::ContextChangeEventObject& rEventObject, + const cssu::Reference<cssu::XInterface>& rxEventFocus) + throw(cssu::RuntimeException) +{ + // Remember the current context. + if (rxEventFocus.is()) + { + FocusDescriptor* pFocusDescriptor = GetFocusDescriptor(rxEventFocus, true); + if (pFocusDescriptor != NULL) + { + pFocusDescriptor->msCurrentApplicationName = rEventObject.ApplicationName; + pFocusDescriptor->msCurrentContextName = rEventObject.ContextName; + } + } + + BroadcastEventToSingleContainer(rEventObject, rxEventFocus); + if (rxEventFocus.is()) + BroadcastEventToSingleContainer(rEventObject, NULL); +} + + + + +void ContextChangeEventMultiplexer::BroadcastEventToSingleContainer ( + const css::ui::ContextChangeEventObject& rEventObject, + const cssu::Reference<cssu::XInterface>& rxEventFocus) +{ + FocusDescriptor* pFocusDescriptor = GetFocusDescriptor(rxEventFocus, false); + if (pFocusDescriptor != NULL) + { + // Create a copy of the listener container to avoid problems + // when one of the called listeners calls add... or remove... + ListenerContainer aContainer (pFocusDescriptor->maListeners); + for (ListenerContainer::const_iterator + iListener(aContainer.begin()), + iEnd(aContainer.end()); + iListener!=iEnd; + ++iListener) + { + (*iListener)->notifyContextChangeEvent(rEventObject); + } + } +} + + + + +ContextChangeEventMultiplexer::FocusDescriptor* ContextChangeEventMultiplexer::GetFocusDescriptor ( + const cssu::Reference<cssu::XInterface>& rxEventFocus, + const bool bCreateWhenMissing) +{ + ListenerMap::iterator iDescriptor (maListeners.find(rxEventFocus)); + if (iDescriptor == maListeners.end() && bCreateWhenMissing) + { + // Listen for the focus being disposed. + Reference<lang::XComponent> xComponent (rxEventFocus, UNO_QUERY); + if (xComponent.is()) + xComponent->addEventListener(this); + + // Create a new listener container for the event focus. + iDescriptor = maListeners.insert( + ListenerMap::value_type( + rxEventFocus, + FocusDescriptor())).first; + } + if (iDescriptor != maListeners.end()) + return &iDescriptor->second; + else + return NULL; +} + + + + +// XSingleComponentFactory + +cssu::Reference<cssu::XInterface> SAL_CALL ContextChangeEventMultiplexer::createInstanceWithContext ( + const cssu::Reference<cssu::XComponentContext>& rxContext) + throw (cssu::Exception, cssu::RuntimeException) +{ + (void)rxContext; + return cssu::Reference<cssu::XInterface>(); +} + + + + +cssu::Reference<cssu::XInterface > SAL_CALL ContextChangeEventMultiplexer::createInstanceWithArgumentsAndContext ( + const cssu::Sequence<cssu::Any>& rArguments, + const cssu::Reference<cssu::XComponentContext>& rxContext) + throw (cssu::Exception, cssu::RuntimeException) +{ + (void)rArguments; + (void)rxContext; + return cssu::Reference<cssu::XInterface>(); +} + + + + +// XServiceInfo + +::rtl::OUString SAL_CALL ContextChangeEventMultiplexer::getImplementationName (void) + throw(cssu::RuntimeException) +{ + return impl_getStaticImplementationName(); +} + + + + + +sal_Bool SAL_CALL ContextChangeEventMultiplexer::supportsService ( + const ::rtl::OUString& rsServiceName) + throw (cssu::RuntimeException) +{ + return ::comphelper::findValue(static_GetSupportedServiceNames(), rsServiceName, sal_True).getLength() != 0; +} + + + + +cssu::Sequence<OUString> SAL_CALL ContextChangeEventMultiplexer::getSupportedServiceNames (void) + throw (cssu::RuntimeException) +{ + return static_GetSupportedServiceNames(); +} + + + + +void SAL_CALL ContextChangeEventMultiplexer::disposing ( + const css::lang::EventObject& rEvent) + throw (cssu::RuntimeException) +{ + ListenerMap::iterator iDescriptor (maListeners.find(rEvent.Source)); + + if (iDescriptor == maListeners.end()) + { + OSL_ASSERT(iDescriptor != maListeners.end()); + return; + } + + // Should we notify the remaining listeners? + + maListeners.erase(iDescriptor); +} + + + + +// Local and static methods. + +OUString SAL_CALL ContextChangeEventMultiplexer::impl_getStaticImplementationName (void) +{ + return A2S(IMPLEMENTATION_NAME); +} + + + + +cssu::Sequence<OUString> SAL_CALL ContextChangeEventMultiplexer::static_GetSupportedServiceNames (void) +{ + cssu::Sequence<OUString> aServiceNames (2); + aServiceNames[0] = A2S(SERVICE_NAME); + aServiceNames[1] = A2S(SINGLETON_NAME); + return aServiceNames; +} + + + + +cssu::Reference<cssu::XInterface> ContextChangeEventMultiplexer::impl_createFactory ( + const cssu::Reference<cssl::XMultiServiceFactory>& rxServiceManager) +{ + (void)rxServiceManager; + return cppu::createSingleComponentFactory( + ContextChangeEventMultiplexer::static_CreateInstance, + ContextChangeEventMultiplexer::impl_getStaticImplementationName(), + ContextChangeEventMultiplexer::static_GetSupportedServiceNames() + ); +} + + + + +cssu::Reference<cssu::XInterface> SAL_CALL ContextChangeEventMultiplexer::static_CreateInstance ( + const cssu::Reference<cssu::XComponentContext>& rxComponentContext) + throw (cssu::Exception) +{ + ContextChangeEventMultiplexer* pObject = new ContextChangeEventMultiplexer(rxComponentContext); + cssu::Reference<cssu::XInterface> xService (static_cast<XWeak*>(pObject), cssu::UNO_QUERY); + return xService; +} + +} // end of namespace framework diff --git a/framework/source/services/EventMultiplexer.cxx b/framework/source/services/EventMultiplexer.cxx new file mode 100644 index 000000000000..952a29d66f68 --- /dev/null +++ b/framework/source/services/EventMultiplexer.cxx @@ -0,0 +1,266 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "precompiled_framework.hxx" + +#include "services/EventMultiplexer.hxx" +#include "services.h" + +using ::rtl::OUString; + +#define A2S(s) ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)) + +namespace framework { + +#define IMPLEMENTATION_NAME "org.apache.openoffice.comp.framework.EventMultiplexer" +#define SERVICE_NAME "com.sun.star.ui.ContextChangeEventMultiplexer" +#define SINGLETON_NAME "org.apache.openoffice.comp.framework.EventMultiplexer" + + +EventMultiplexer::EventMultiplexer (const cssu::Reference<css::uno::XComponentContext>& rxContext) + : EventMultiplexerInterfaceBase(m_aMutex), + maListeners() +{ + (void)rxContext; +} + + + + +EventMultiplexer::~EventMultiplexer (void) +{ + maListeners.clear(); +} + + + + +// XEventMultiplexer + +void SAL_CALL EventMultiplexer::addEventListener ( + const cssu::Reference<css::util::XEventListener>& rxListener, + const cssu::Reference<cssu::XInterface>& rxEventFocus) + throw(cssu::RuntimeException,cssl::IllegalArgumentException) +{ + if ( ! rxListener.is()) + throw css::lang::IllegalArgumentException(A2S("can not add an empty reference"), static_cast<XWeak*>(this), 0); + + ListenerMap::iterator iListenerContainer (maListeners.find(rxEventFocus)); + if (iListenerContainer == maListeners.end()) + { + // Create a new listener container for the event focus. + iListenerContainer = maListeners.insert( + ListenerMap::value_type( + rxEventFocus, + ListenerContainer())).first; + } + if (iListenerContainer != maListeners.end()) + { + ListenerContainer& rContainer (iListenerContainer->second); + if (::std::find(rContainer.begin(), rContainer.end(), rxListener) == rContainer.end()) + rContainer.push_back(rxListener); + else + { + // The listener was added for the same event focus + // previously. That is an error. + throw cssl::IllegalArgumentException(A2S("listener added twice"), static_cast<XWeak*>(this), 0); + } + } +} + + + + +void SAL_CALL EventMultiplexer::removeEventListener ( + const cssu::Reference<css::util::XEventListener>& rxListener, + const cssu::Reference<cssu::XInterface>& rxEventFocus) + throw(cssu::RuntimeException,cssl::IllegalArgumentException) +{ + if ( ! rxListener.is()) + throw cssl::IllegalArgumentException(A2S("can not remove an empty reference"), static_cast<XWeak*>(this), 0); + + ListenerMap::iterator iListenerContainer (maListeners.find(rxEventFocus)); + if (iListenerContainer != maListeners.end()) + { + ListenerContainer& rContainer (iListenerContainer->second); + const ListenerContainer::iterator iListener (::std::find(rContainer.begin(), rContainer.end(), rxListener)); + if (iListener != rContainer.end()) + rContainer.erase(iListener); + } + +} + + + + +void SAL_CALL EventMultiplexer::removeAllEventListeners ( + const cssu::Reference<css::util::XEventListener>& rxListener) + throw(cssu::RuntimeException,cssl::IllegalArgumentException) +{ + if ( ! rxListener.is()) + throw cssl::IllegalArgumentException(A2S("can not remove an empty reference"), static_cast<XWeak*>(this), 0); + + for (ListenerMap::iterator + iContainer(maListeners.begin()), + iEnd(maListeners.end()); + iContainer!=iEnd; + ++iContainer) + { + const ListenerContainer::iterator iListener (::std::find(iContainer->second.begin(), iContainer->second.end(), rxListener)); + if (iListener != iContainer->second.end()) + iContainer->second.erase(iListener); + } +} + + + + + +void SAL_CALL EventMultiplexer::broadcastEvent ( + const cssl::EventObject& rEventObject, + const cssu::Reference<cssu::XInterface>& rxEventFocus) + throw(cssu::RuntimeException) +{ + BroadcastEventToSingleContainer(rEventObject, rxEventFocus); + if (rxEventFocus.is()) + BroadcastEventToSingleContainer(rEventObject, NULL); +} + + + + +void EventMultiplexer::BroadcastEventToSingleContainer ( + const cssl::EventObject& rEventObject, + const cssu::Reference<cssu::XInterface>& rxEventFocus) +{ + ListenerMap::iterator iListenerContainer (maListeners.find(rxEventFocus)); + if (iListenerContainer != maListeners.end()) + { + // Create a copy of the listener container to avoid problems + // when one of the called listeners calls add... or remove... + ListenerContainer aContainer (iListenerContainer->second); + for (ListenerContainer::const_iterator + iListener(aContainer.begin()), + iEnd(aContainer.end()); + iListener!=iEnd; + ++iListener) + { + (*iListener)->notifyEvent(rEventObject); + } + } +} + + + + +// XSingleComponentFactory +cssu::Reference<cssu::XInterface> SAL_CALL EventMultiplexer::createInstanceWithContext ( + const cssu::Reference<cssu::XComponentContext>& rxContext) + throw (cssu::Exception, cssu::RuntimeException) +{ + return cssu::Reference<cssu::XInterface>(); +} + + + + +cssu::Reference<cssu::XInterface > SAL_CALL EventMultiplexer::createInstanceWithArgumentsAndContext ( + const cssu::Sequence<cssu::Any>& rArguments, + const cssu::Reference<cssu::XComponentContext>& rxContext) + throw (cssu::Exception, cssu::RuntimeException) +{ + return cssu::Reference<cssu::XInterface>(); +} + + + + +// XServiceInfo + +::rtl::OUString SAL_CALL EventMultiplexer::getImplementationName (void) + throw(cssu::RuntimeException) +{ + return impl_getStaticImplementationName(); +} + + + + + +sal_Bool SAL_CALL EventMultiplexer::supportsService ( + const ::rtl::OUString& rsServiceName) + throw (cssu::RuntimeException) +{ + return ::comphelper::findValue(static_GetSupportedServiceNames(), rsServiceName, sal_True).getLength() != 0; +} + + + + +cssu::Sequence<OUString> SAL_CALL EventMultiplexer::getSupportedServiceNames (void) + throw (cssu::RuntimeException) +{ + return static_GetSupportedServiceNames(); +} + + + + +// Local and static methods. + +OUString SAL_CALL EventMultiplexer::impl_getStaticImplementationName (void) +{ + return A2S(IMPLEMENTATION_NAME); +} + + + + +cssu::Sequence<OUString> SAL_CALL EventMultiplexer::static_GetSupportedServiceNames (void) +{ + cssu::Sequence<OUString> aServiceNames (2); + aServiceNames[0] = A2S(SERVICE_NAME); + aServiceNames[1] = A2S(SINGLETON_NAME); + return aServiceNames; +} + + + + +cssu::Reference<cssu::XInterface> EventMultiplexer::impl_createFactory ( + const cssu::Reference<cssl::XMultiServiceFactory>& rxServiceManager) +{ + return cppu::createSingleComponentFactory( + EventMultiplexer::static_CreateInstance, + EventMultiplexer::impl_getStaticImplementationName(), + EventMultiplexer::static_GetSupportedServiceNames() + ); +} + + + + +cssu::Reference<cssu::XInterface> SAL_CALL EventMultiplexer::static_CreateInstance ( + const cssu::Reference<cssu::XComponentContext>& rxComponentContext) + throw (cssu::Exception) +{ + EventMultiplexer* pObject = new EventMultiplexer(rxComponentContext); + cssu::Reference<cssu::XInterface> xService (static_cast<XWeak*>(pObject), cssu::UNO_QUERY); + return xService; +} + +} // end of namespace framework diff --git a/framework/util/fwk.component b/framework/util/fwk.component index efb700a992e1..9d604c51db9d 100644 --- a/framework/util/fwk.component +++ b/framework/util/fwk.component @@ -40,6 +40,10 @@ <implementation name="com.sun.star.comp.framework.DocumentAcceleratorConfiguration"> <service name="com.sun.star.ui.DocumentAcceleratorConfiguration"/> </implementation> + <implementation name="org.apache.openoffice.comp.framework.ContextChangeEventMultiplexer"> + <service name="com.sun.star.ui.ContextChangeEventMultiplexer"/> + <singleton name="com.sun.star.ui.ContextChangeEventMultiplexer"/> + </implementation> <implementation name="com.sun.star.comp.framework.Frame"> <service name="com.sun.star.frame.Frame"/> </implementation> diff --git a/icon-themes/galaxy/sc/res/sidebar/123.png b/icon-themes/galaxy/sc/res/sidebar/123.png Binary files differnew file mode 100755 index 000000000000..0d0a6ef7659c --- /dev/null +++ b/icon-themes/galaxy/sc/res/sidebar/123.png diff --git a/icon-themes/galaxy/sc/res/sidebar/ABC.png b/icon-themes/galaxy/sc/res/sidebar/ABC.png Binary files differnew file mode 100755 index 000000000000..fb7e5c8b5585 --- /dev/null +++ b/icon-themes/galaxy/sc/res/sidebar/ABC.png diff --git a/icon-themes/galaxy/sc/res/sidebar/CellBorder.png b/icon-themes/galaxy/sc/res/sidebar/CellBorder.png Binary files differnew file mode 100755 index 000000000000..f4e8e005c340 --- /dev/null +++ b/icon-themes/galaxy/sc/res/sidebar/CellBorder.png diff --git a/icon-themes/galaxy/sc/res/sidebar/CellBorderLineStyle_005.png b/icon-themes/galaxy/sc/res/sidebar/CellBorderLineStyle_005.png Binary files differnew file mode 100755 index 000000000000..6116ee216ad5 --- /dev/null +++ b/icon-themes/galaxy/sc/res/sidebar/CellBorderLineStyle_005.png diff --git a/icon-themes/galaxy/sc/res/sidebar/CellBorderLineStyle_110.png b/icon-themes/galaxy/sc/res/sidebar/CellBorderLineStyle_110.png Binary files differnew file mode 100755 index 000000000000..ddca641e4839 --- /dev/null +++ b/icon-themes/galaxy/sc/res/sidebar/CellBorderLineStyle_110.png diff --git a/icon-themes/galaxy/sc/res/sidebar/CellBorderLineStyle_250.png b/icon-themes/galaxy/sc/res/sidebar/CellBorderLineStyle_250.png Binary files differnew file mode 100755 index 000000000000..93014bf7be88 --- /dev/null +++ b/icon-themes/galaxy/sc/res/sidebar/CellBorderLineStyle_250.png diff --git a/icon-themes/galaxy/sc/res/sidebar/CellBorderLineStyle_260.png b/icon-themes/galaxy/sc/res/sidebar/CellBorderLineStyle_260.png Binary files differnew file mode 100755 index 000000000000..4fdc28a2690f --- /dev/null +++ b/icon-themes/galaxy/sc/res/sidebar/CellBorderLineStyle_260.png diff --git a/icon-themes/galaxy/sc/res/sidebar/CellBorderLineStyle_400.png b/icon-themes/galaxy/sc/res/sidebar/CellBorderLineStyle_400.png Binary files differnew file mode 100755 index 000000000000..38cda1bfd231 --- /dev/null +++ b/icon-themes/galaxy/sc/res/sidebar/CellBorderLineStyle_400.png diff --git a/icon-themes/galaxy/sc/res/sidebar/CellBorderLineStyle_450.png b/icon-themes/galaxy/sc/res/sidebar/CellBorderLineStyle_450.png Binary files differnew file mode 100755 index 000000000000..245594f90106 --- /dev/null +++ b/icon-themes/galaxy/sc/res/sidebar/CellBorderLineStyle_450.png diff --git a/icon-themes/galaxy/sc/res/sidebar/CellBorderLineStyle_500.png b/icon-themes/galaxy/sc/res/sidebar/CellBorderLineStyle_500.png Binary files differnew file mode 100755 index 000000000000..9a6457d03a13 --- /dev/null +++ b/icon-themes/galaxy/sc/res/sidebar/CellBorderLineStyle_500.png diff --git a/icon-themes/galaxy/sc/res/sidebar/CellBorderLineStyle_505.png b/icon-themes/galaxy/sc/res/sidebar/CellBorderLineStyle_505.png Binary files differnew file mode 100755 index 000000000000..78865c0534fc --- /dev/null +++ b/icon-themes/galaxy/sc/res/sidebar/CellBorderLineStyle_505.png diff --git a/icon-themes/galaxy/sc/res/sidebar/CellBorderLineStyle_750.png b/icon-themes/galaxy/sc/res/sidebar/CellBorderLineStyle_750.png Binary files differnew file mode 100755 index 000000000000..71088c184f8c --- /dev/null +++ b/icon-themes/galaxy/sc/res/sidebar/CellBorderLineStyle_750.png diff --git a/icon-themes/galaxy/sc/res/sidebar/CellBorder_All_18x18.png b/icon-themes/galaxy/sc/res/sidebar/CellBorder_All_18x18.png Binary files differnew file mode 100755 index 000000000000..68f9d451675d --- /dev/null +++ b/icon-themes/galaxy/sc/res/sidebar/CellBorder_All_18x18.png diff --git a/icon-themes/galaxy/sc/res/sidebar/CellBorder_Bottom_18x18.png b/icon-themes/galaxy/sc/res/sidebar/CellBorder_Bottom_18x18.png Binary files differnew file mode 100755 index 000000000000..20d34e229ec7 --- /dev/null +++ b/icon-themes/galaxy/sc/res/sidebar/CellBorder_Bottom_18x18.png diff --git a/icon-themes/galaxy/sc/res/sidebar/CellBorder_Bottom_Double_18x18.png b/icon-themes/galaxy/sc/res/sidebar/CellBorder_Bottom_Double_18x18.png Binary files differnew file mode 100755 index 000000000000..3bf6450c686c --- /dev/null +++ b/icon-themes/galaxy/sc/res/sidebar/CellBorder_Bottom_Double_18x18.png diff --git a/icon-themes/galaxy/sc/res/sidebar/CellBorder_Bottom_Thick_18x18.png b/icon-themes/galaxy/sc/res/sidebar/CellBorder_Bottom_Thick_18x18.png Binary files differnew file mode 100755 index 000000000000..ecf2afa713be --- /dev/null +++ b/icon-themes/galaxy/sc/res/sidebar/CellBorder_Bottom_Thick_18x18.png diff --git a/icon-themes/galaxy/sc/res/sidebar/CellBorder_Empty_18x18.png b/icon-themes/galaxy/sc/res/sidebar/CellBorder_Empty_18x18.png Binary files differnew file mode 100755 index 000000000000..a5f3dd45d8b3 --- /dev/null +++ b/icon-themes/galaxy/sc/res/sidebar/CellBorder_Empty_18x18.png diff --git a/icon-themes/galaxy/sc/res/sidebar/CellBorder_FourBorders_18x18.png b/icon-themes/galaxy/sc/res/sidebar/CellBorder_FourBorders_18x18.png Binary files differnew file mode 100755 index 000000000000..54a42b57b918 --- /dev/null +++ b/icon-themes/galaxy/sc/res/sidebar/CellBorder_FourBorders_18x18.png diff --git a/icon-themes/galaxy/sc/res/sidebar/CellBorder_FourBorders_Thick_18x18.png b/icon-themes/galaxy/sc/res/sidebar/CellBorder_FourBorders_Thick_18x18.png Binary files differnew file mode 100755 index 000000000000..a54c4f57d6b3 --- /dev/null +++ b/icon-themes/galaxy/sc/res/sidebar/CellBorder_FourBorders_Thick_18x18.png diff --git a/icon-themes/galaxy/sc/res/sidebar/CellBorder_LeftAndRight_18x18.png b/icon-themes/galaxy/sc/res/sidebar/CellBorder_LeftAndRight_18x18.png Binary files differnew file mode 100755 index 000000000000..39e9b0ff2ff9 --- /dev/null +++ b/icon-themes/galaxy/sc/res/sidebar/CellBorder_LeftAndRight_18x18.png diff --git a/icon-themes/galaxy/sc/res/sidebar/CellBorder_LeftDiagonal_18x18.png b/icon-themes/galaxy/sc/res/sidebar/CellBorder_LeftDiagonal_18x18.png Binary files differnew file mode 100755 index 000000000000..4e58fee70ca7 --- /dev/null +++ b/icon-themes/galaxy/sc/res/sidebar/CellBorder_LeftDiagonal_18x18.png diff --git a/icon-themes/galaxy/sc/res/sidebar/CellBorder_Left_18x18.png b/icon-themes/galaxy/sc/res/sidebar/CellBorder_Left_18x18.png Binary files differnew file mode 100755 index 000000000000..987389173b47 --- /dev/null +++ b/icon-themes/galaxy/sc/res/sidebar/CellBorder_Left_18x18.png diff --git a/icon-themes/galaxy/sc/res/sidebar/CellBorder_RightDiagonal_18x18.png b/icon-themes/galaxy/sc/res/sidebar/CellBorder_RightDiagonal_18x18.png Binary files differnew file mode 100755 index 000000000000..3325d03918ba --- /dev/null +++ b/icon-themes/galaxy/sc/res/sidebar/CellBorder_RightDiagonal_18x18.png diff --git a/icon-themes/galaxy/sc/res/sidebar/CellBorder_Right_18x18.png b/icon-themes/galaxy/sc/res/sidebar/CellBorder_Right_18x18.png Binary files differnew file mode 100755 index 000000000000..a33eca25b44d --- /dev/null +++ b/icon-themes/galaxy/sc/res/sidebar/CellBorder_Right_18x18.png diff --git a/icon-themes/galaxy/sc/res/sidebar/CellBorder_TopAndBottom_18x18.png b/icon-themes/galaxy/sc/res/sidebar/CellBorder_TopAndBottom_18x18.png Binary files differnew file mode 100755 index 000000000000..4249bf669d6e --- /dev/null +++ b/icon-themes/galaxy/sc/res/sidebar/CellBorder_TopAndBottom_18x18.png diff --git a/icon-themes/galaxy/sc/res/sidebar/CellBorder_TopSingle_BottomDouble_18x18.png b/icon-themes/galaxy/sc/res/sidebar/CellBorder_TopSingle_BottomDouble_18x18.png Binary files differnew file mode 100755 index 000000000000..793a98451a82 --- /dev/null +++ b/icon-themes/galaxy/sc/res/sidebar/CellBorder_TopSingle_BottomDouble_18x18.png diff --git a/icon-themes/galaxy/sc/res/sidebar/CellBorder_TopThin_BottomThick_18x18.png b/icon-themes/galaxy/sc/res/sidebar/CellBorder_TopThin_BottomThick_18x18.png Binary files differnew file mode 100755 index 000000000000..e7c8d0576e53 --- /dev/null +++ b/icon-themes/galaxy/sc/res/sidebar/CellBorder_TopThin_BottomThick_18x18.png diff --git a/icon-themes/galaxy/sc/res/sidebar/CellBorder_Top_18x18.png b/icon-themes/galaxy/sc/res/sidebar/CellBorder_Top_18x18.png Binary files differnew file mode 100755 index 000000000000..1dda1c1cdfd3 --- /dev/null +++ b/icon-themes/galaxy/sc/res/sidebar/CellBorder_Top_18x18.png diff --git a/icon-themes/galaxy/sc/res/sidebar/Line_color.png b/icon-themes/galaxy/sc/res/sidebar/Line_color.png Binary files differnew file mode 100755 index 000000000000..a9522b9eeedd --- /dev/null +++ b/icon-themes/galaxy/sc/res/sidebar/Line_color.png diff --git a/icon-themes/galaxy/sc/res/sidebar/canlendar.png b/icon-themes/galaxy/sc/res/sidebar/canlendar.png Binary files differnew file mode 100755 index 000000000000..b40421e68f3e --- /dev/null +++ b/icon-themes/galaxy/sc/res/sidebar/canlendar.png diff --git a/icon-themes/galaxy/sc/res/sidebar/fill_color.png b/icon-themes/galaxy/sc/res/sidebar/fill_color.png Binary files differnew file mode 100755 index 000000000000..1d5d23feb84c --- /dev/null +++ b/icon-themes/galaxy/sc/res/sidebar/fill_color.png diff --git a/icon-themes/galaxy/sc/res/sidebar/money.png b/icon-themes/galaxy/sc/res/sidebar/money.png Binary files differnew file mode 100755 index 000000000000..15b6ff2107ee --- /dev/null +++ b/icon-themes/galaxy/sc/res/sidebar/money.png diff --git a/icon-themes/galaxy/sc/res/sidebar/morebutton.bmp b/icon-themes/galaxy/sc/res/sidebar/morebutton.bmp Binary files differnew file mode 100755 index 000000000000..c665b3e866a8 --- /dev/null +++ b/icon-themes/galaxy/sc/res/sidebar/morebutton.bmp diff --git a/icon-themes/galaxy/sc/res/sidebar/morebutton_h.bmp b/icon-themes/galaxy/sc/res/sidebar/morebutton_h.bmp Binary files differnew file mode 100755 index 000000000000..c665b3e866a8 --- /dev/null +++ b/icon-themes/galaxy/sc/res/sidebar/morebutton_h.bmp diff --git a/icon-themes/galaxy/sc/res/sidebar/percent.png b/icon-themes/galaxy/sc/res/sidebar/percent.png Binary files differnew file mode 100755 index 000000000000..83f37512545d --- /dev/null +++ b/icon-themes/galaxy/sc/res/sidebar/percent.png diff --git a/icon-themes/galaxy/sc/res/sidebar/sc_alignbottom.png b/icon-themes/galaxy/sc/res/sidebar/sc_alignbottom.png Binary files differnew file mode 100755 index 000000000000..de22c240efdb --- /dev/null +++ b/icon-themes/galaxy/sc/res/sidebar/sc_alignbottom.png diff --git a/icon-themes/galaxy/sc/res/sidebar/sc_aligncenter.png b/icon-themes/galaxy/sc/res/sidebar/sc_aligncenter.png Binary files differnew file mode 100755 index 000000000000..441e6773aab9 --- /dev/null +++ b/icon-themes/galaxy/sc/res/sidebar/sc_aligncenter.png diff --git a/icon-themes/galaxy/sc/res/sidebar/sc_aligncenter_v.png b/icon-themes/galaxy/sc/res/sidebar/sc_aligncenter_v.png Binary files differnew file mode 100755 index 000000000000..919edab0d01b --- /dev/null +++ b/icon-themes/galaxy/sc/res/sidebar/sc_aligncenter_v.png diff --git a/icon-themes/galaxy/sc/res/sidebar/sc_alignjust.png b/icon-themes/galaxy/sc/res/sidebar/sc_alignjust.png Binary files differnew file mode 100755 index 000000000000..1d57b1c4b2ce --- /dev/null +++ b/icon-themes/galaxy/sc/res/sidebar/sc_alignjust.png diff --git a/icon-themes/galaxy/sc/res/sidebar/sc_alignleft.png b/icon-themes/galaxy/sc/res/sidebar/sc_alignleft.png Binary files differnew file mode 100755 index 000000000000..a258013a958c --- /dev/null +++ b/icon-themes/galaxy/sc/res/sidebar/sc_alignleft.png diff --git a/icon-themes/galaxy/sc/res/sidebar/sc_alignright.png b/icon-themes/galaxy/sc/res/sidebar/sc_alignright.png Binary files differnew file mode 100755 index 000000000000..cbf816b540ce --- /dev/null +++ b/icon-themes/galaxy/sc/res/sidebar/sc_alignright.png diff --git a/icon-themes/galaxy/sc/res/sidebar/sc_aligntop.png b/icon-themes/galaxy/sc/res/sidebar/sc_aligntop.png Binary files differnew file mode 100755 index 000000000000..275133c3409d --- /dev/null +++ b/icon-themes/galaxy/sc/res/sidebar/sc_aligntop.png diff --git a/icon-themes/galaxy/sfx2/res/grip.png b/icon-themes/galaxy/sfx2/res/grip.png Binary files differnew file mode 100755 index 000000000000..696998385dbb --- /dev/null +++ b/icon-themes/galaxy/sfx2/res/grip.png diff --git a/icon-themes/galaxy/sfx2/res/menu.png b/icon-themes/galaxy/sfx2/res/menu.png Binary files differnew file mode 100755 index 000000000000..e65517b9ca9d --- /dev/null +++ b/icon-themes/galaxy/sfx2/res/menu.png diff --git a/icon-themes/galaxy/sfx2/res/separator.png b/icon-themes/galaxy/sfx2/res/separator.png Binary files differnew file mode 100755 index 000000000000..d518aefed706 --- /dev/null +++ b/icon-themes/galaxy/sfx2/res/separator.png diff --git a/icon-themes/galaxy/sfx2/res/symphony/morebutton.png b/icon-themes/galaxy/sfx2/res/symphony/morebutton.png Binary files differnew file mode 100644 index 000000000000..5cffa97ca41c --- /dev/null +++ b/icon-themes/galaxy/sfx2/res/symphony/morebutton.png diff --git a/icon-themes/galaxy/sfx2/res/symphony/open_more.png b/icon-themes/galaxy/sfx2/res/symphony/open_more.png Binary files differnew file mode 100644 index 000000000000..c981abf0f3a5 --- /dev/null +++ b/icon-themes/galaxy/sfx2/res/symphony/open_more.png diff --git a/icon-themes/galaxy/sfx2/res/symphony/sidebar-3d-large.png b/icon-themes/galaxy/sfx2/res/symphony/sidebar-3d-large.png Binary files differnew file mode 100644 index 000000000000..7bc11604f897 --- /dev/null +++ b/icon-themes/galaxy/sfx2/res/symphony/sidebar-3d-large.png diff --git a/icon-themes/galaxy/sfx2/res/symphony/sidebar-3d-small.png b/icon-themes/galaxy/sfx2/res/symphony/sidebar-3d-small.png Binary files differnew file mode 100644 index 000000000000..a4cdda9ad5bc --- /dev/null +++ b/icon-themes/galaxy/sfx2/res/symphony/sidebar-3d-small.png diff --git a/icon-themes/galaxy/sfx2/res/symphony/sidebar-animation-large.png b/icon-themes/galaxy/sfx2/res/symphony/sidebar-animation-large.png Binary files differnew file mode 100644 index 000000000000..0be7962635fd --- /dev/null +++ b/icon-themes/galaxy/sfx2/res/symphony/sidebar-animation-large.png diff --git a/icon-themes/galaxy/sfx2/res/symphony/sidebar-animation-small.png b/icon-themes/galaxy/sfx2/res/symphony/sidebar-animation-small.png Binary files differnew file mode 100644 index 000000000000..c494dfa6e170 --- /dev/null +++ b/icon-themes/galaxy/sfx2/res/symphony/sidebar-animation-small.png diff --git a/icon-themes/galaxy/sfx2/res/symphony/sidebar-colors-large.png b/icon-themes/galaxy/sfx2/res/symphony/sidebar-colors-large.png Binary files differnew file mode 100644 index 000000000000..39ecdc12d1bf --- /dev/null +++ b/icon-themes/galaxy/sfx2/res/symphony/sidebar-colors-large.png diff --git a/icon-themes/galaxy/sfx2/res/symphony/sidebar-colors-small.png b/icon-themes/galaxy/sfx2/res/symphony/sidebar-colors-small.png Binary files differnew file mode 100644 index 000000000000..049514bec7df --- /dev/null +++ b/icon-themes/galaxy/sfx2/res/symphony/sidebar-colors-small.png diff --git a/icon-themes/galaxy/sfx2/res/symphony/sidebar-eyedropper-large.png b/icon-themes/galaxy/sfx2/res/symphony/sidebar-eyedropper-large.png Binary files differnew file mode 100644 index 000000000000..be99b1fbc2a4 --- /dev/null +++ b/icon-themes/galaxy/sfx2/res/symphony/sidebar-eyedropper-large.png diff --git a/icon-themes/galaxy/sfx2/res/symphony/sidebar-eyedropper-small.png b/icon-themes/galaxy/sfx2/res/symphony/sidebar-eyedropper-small.png Binary files differnew file mode 100644 index 000000000000..55e182a7cfd8 --- /dev/null +++ b/icon-themes/galaxy/sfx2/res/symphony/sidebar-eyedropper-small.png diff --git a/icon-themes/galaxy/sfx2/res/symphony/sidebar-functions-large.png b/icon-themes/galaxy/sfx2/res/symphony/sidebar-functions-large.png Binary files differnew file mode 100644 index 000000000000..1991850ae7db --- /dev/null +++ b/icon-themes/galaxy/sfx2/res/symphony/sidebar-functions-large.png diff --git a/icon-themes/galaxy/sfx2/res/symphony/sidebar-functions-small.png b/icon-themes/galaxy/sfx2/res/symphony/sidebar-functions-small.png Binary files differnew file mode 100644 index 000000000000..615bd0b8788d --- /dev/null +++ b/icon-themes/galaxy/sfx2/res/symphony/sidebar-functions-small.png diff --git a/icon-themes/galaxy/sfx2/res/symphony/sidebar-gallery-large.png b/icon-themes/galaxy/sfx2/res/symphony/sidebar-gallery-large.png Binary files differnew file mode 100644 index 000000000000..9effe086a135 --- /dev/null +++ b/icon-themes/galaxy/sfx2/res/symphony/sidebar-gallery-large.png diff --git a/icon-themes/galaxy/sfx2/res/symphony/sidebar-gallery-small.png b/icon-themes/galaxy/sfx2/res/symphony/sidebar-gallery-small.png Binary files differnew file mode 100644 index 000000000000..29b3c2545978 --- /dev/null +++ b/icon-themes/galaxy/sfx2/res/symphony/sidebar-gallery-small.png diff --git a/icon-themes/galaxy/sfx2/res/symphony/sidebar-imganim-large.png b/icon-themes/galaxy/sfx2/res/symphony/sidebar-imganim-large.png Binary files differnew file mode 100644 index 000000000000..778e49979e55 --- /dev/null +++ b/icon-themes/galaxy/sfx2/res/symphony/sidebar-imganim-large.png diff --git a/icon-themes/galaxy/sfx2/res/symphony/sidebar-imganim-small.png b/icon-themes/galaxy/sfx2/res/symphony/sidebar-imganim-small.png Binary files differnew file mode 100644 index 000000000000..50a065ac299b --- /dev/null +++ b/icon-themes/galaxy/sfx2/res/symphony/sidebar-imganim-small.png diff --git a/icon-themes/galaxy/sfx2/res/symphony/sidebar-navigator-large.png b/icon-themes/galaxy/sfx2/res/symphony/sidebar-navigator-large.png Binary files differnew file mode 100644 index 000000000000..a078b0a54194 --- /dev/null +++ b/icon-themes/galaxy/sfx2/res/symphony/sidebar-navigator-large.png diff --git a/icon-themes/galaxy/sfx2/res/symphony/sidebar-navigator-small.png b/icon-themes/galaxy/sfx2/res/symphony/sidebar-navigator-small.png Binary files differnew file mode 100644 index 000000000000..00bd1cabf200 --- /dev/null +++ b/icon-themes/galaxy/sfx2/res/symphony/sidebar-navigator-small.png diff --git a/icon-themes/galaxy/sfx2/res/symphony/sidebar-property-large.png b/icon-themes/galaxy/sfx2/res/symphony/sidebar-property-large.png Binary files differnew file mode 100644 index 000000000000..fb0c1595ff68 --- /dev/null +++ b/icon-themes/galaxy/sfx2/res/symphony/sidebar-property-large.png diff --git a/icon-themes/galaxy/sfx2/res/symphony/sidebar-property-small.png b/icon-themes/galaxy/sfx2/res/symphony/sidebar-property-small.png Binary files differnew file mode 100644 index 000000000000..4147aa14cc0b --- /dev/null +++ b/icon-themes/galaxy/sfx2/res/symphony/sidebar-property-small.png diff --git a/icon-themes/galaxy/sfx2/res/symphony/sidebar-style-large.png b/icon-themes/galaxy/sfx2/res/symphony/sidebar-style-large.png Binary files differnew file mode 100644 index 000000000000..0d59a2df0cba --- /dev/null +++ b/icon-themes/galaxy/sfx2/res/symphony/sidebar-style-large.png diff --git a/icon-themes/galaxy/sfx2/res/symphony/sidebar-style-small.png b/icon-themes/galaxy/sfx2/res/symphony/sidebar-style-small.png Binary files differnew file mode 100644 index 000000000000..d570ffa0f8de --- /dev/null +++ b/icon-themes/galaxy/sfx2/res/symphony/sidebar-style-small.png diff --git a/icon-themes/galaxy/sfx2/res/symphony/sidebar-template-large.png b/icon-themes/galaxy/sfx2/res/symphony/sidebar-template-large.png Binary files differnew file mode 100644 index 000000000000..f4beddc5426d --- /dev/null +++ b/icon-themes/galaxy/sfx2/res/symphony/sidebar-template-large.png diff --git a/icon-themes/galaxy/sfx2/res/symphony/sidebar-template-small.png b/icon-themes/galaxy/sfx2/res/symphony/sidebar-template-small.png Binary files differnew file mode 100644 index 000000000000..65bff0c226e8 --- /dev/null +++ b/icon-themes/galaxy/sfx2/res/symphony/sidebar-template-small.png diff --git a/icon-themes/galaxy/sfx2/res/symphony/sidebar-transition-large.png b/icon-themes/galaxy/sfx2/res/symphony/sidebar-transition-large.png Binary files differnew file mode 100644 index 000000000000..f0c319878bb7 --- /dev/null +++ b/icon-themes/galaxy/sfx2/res/symphony/sidebar-transition-large.png diff --git a/icon-themes/galaxy/sfx2/res/symphony/sidebar-transition-small.png b/icon-themes/galaxy/sfx2/res/symphony/sidebar-transition-small.png Binary files differnew file mode 100644 index 000000000000..6cdc89a5e614 --- /dev/null +++ b/icon-themes/galaxy/sfx2/res/symphony/sidebar-transition-small.png diff --git a/icon-themes/galaxy/svx/res/rotation.png b/icon-themes/galaxy/svx/res/rotation.png Binary files differnew file mode 100644 index 000000000000..57f75b98732c --- /dev/null +++ b/icon-themes/galaxy/svx/res/rotation.png diff --git a/icon-themes/galaxy/svx/res/symphony/ b/icon-themes/galaxy/svx/res/symphony/ Binary files differnew file mode 100755 index 000000000000..263af5d328bd --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/ diff --git a/icon-themes/galaxy/svx/res/symphony/AdjustColorBlue_16x16.png b/icon-themes/galaxy/svx/res/symphony/AdjustColorBlue_16x16.png Binary files differnew file mode 100755 index 000000000000..0e4e0b3d2599 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/AdjustColorBlue_16x16.png diff --git a/icon-themes/galaxy/svx/res/symphony/AdjustColorGamma_16x16.png b/icon-themes/galaxy/svx/res/symphony/AdjustColorGamma_16x16.png Binary files differnew file mode 100755 index 000000000000..bc593f743048 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/AdjustColorGamma_16x16.png diff --git a/icon-themes/galaxy/svx/res/symphony/AdjustColorGreen_16x16.png b/icon-themes/galaxy/svx/res/symphony/AdjustColorGreen_16x16.png Binary files differnew file mode 100755 index 000000000000..05f99dcd85b2 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/AdjustColorGreen_16x16.png diff --git a/icon-themes/galaxy/svx/res/symphony/AdjustColorRed_16x16.png b/icon-themes/galaxy/svx/res/symphony/AdjustColorRed_16x16.png Binary files differnew file mode 100755 index 000000000000..86ed800174f8 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/AdjustColorRed_16x16.png diff --git a/icon-themes/galaxy/svx/res/symphony/AlignTextCenter_16x16.png b/icon-themes/galaxy/svx/res/symphony/AlignTextCenter_16x16.png Binary files differnew file mode 100755 index 000000000000..441e6773aab9 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/AlignTextCenter_16x16.png diff --git a/icon-themes/galaxy/svx/res/symphony/AlignTextJustified_16x16.png b/icon-themes/galaxy/svx/res/symphony/AlignTextJustified_16x16.png Binary files differnew file mode 100755 index 000000000000..1d57b1c4b2ce --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/AlignTextJustified_16x16.png diff --git a/icon-themes/galaxy/svx/res/symphony/AlignTextLeft_16x16.png b/icon-themes/galaxy/svx/res/symphony/AlignTextLeft_16x16.png Binary files differnew file mode 100755 index 000000000000..a258013a958c --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/AlignTextLeft_16x16.png diff --git a/icon-themes/galaxy/svx/res/symphony/AlignTextRight_16x16.png b/icon-themes/galaxy/svx/res/symphony/AlignTextRight_16x16.png Binary files differnew file mode 100755 index 000000000000..cbf816b540ce --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/AlignTextRight_16x16.png diff --git a/icon-themes/galaxy/svx/res/symphony/ColorModeBlackWhite_16x16.png b/icon-themes/galaxy/svx/res/symphony/ColorModeBlackWhite_16x16.png Binary files differnew file mode 100755 index 000000000000..c6d333cb45ed --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/ColorModeBlackWhite_16x16.png diff --git a/icon-themes/galaxy/svx/res/symphony/ColorModeGrey_16x16.png b/icon-themes/galaxy/svx/res/symphony/ColorModeGrey_16x16.png Binary files differnew file mode 100755 index 000000000000..5bda54f81d99 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/ColorModeGrey_16x16.png diff --git a/icon-themes/galaxy/svx/res/symphony/ColorModeNormal_16x16.png b/icon-themes/galaxy/svx/res/symphony/ColorModeNormal_16x16.png Binary files differnew file mode 100755 index 000000000000..a618abd72851 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/ColorModeNormal_16x16.png diff --git a/icon-themes/galaxy/svx/res/symphony/ColorModeWaterMark_16x16.png b/icon-themes/galaxy/svx/res/symphony/ColorModeWaterMark_16x16.png Binary files differnew file mode 100755 index 000000000000..1606498d5537 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/ColorModeWaterMark_16x16.png diff --git a/icon-themes/galaxy/svx/res/symphony/DecreaseSpace_16x16.png b/icon-themes/galaxy/svx/res/symphony/DecreaseSpace_16x16.png Binary files differnew file mode 100755 index 000000000000..3f97e69229fe --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/DecreaseSpace_16x16.png diff --git a/icon-themes/galaxy/svx/res/symphony/FlipHorizontally_16x16.png b/icon-themes/galaxy/svx/res/symphony/FlipHorizontally_16x16.png Binary files differnew file mode 100755 index 000000000000..281ee466886d --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/FlipHorizontally_16x16.png diff --git a/icon-themes/galaxy/svx/res/symphony/FlipVertically_16x16.png b/icon-themes/galaxy/svx/res/symphony/FlipVertically_16x16.png Binary files differnew file mode 100755 index 000000000000..7c9c4c45e205 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/FlipVertically_16x16.png diff --git a/icon-themes/galaxy/svx/res/symphony/Highlight.png b/icon-themes/galaxy/svx/res/symphony/Highlight.png Binary files differnew file mode 100755 index 000000000000..8640d2e44be9 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/Highlight.png diff --git a/icon-themes/galaxy/svx/res/symphony/IncreaseSpace_16x16.png b/icon-themes/galaxy/svx/res/symphony/IncreaseSpace_16x16.png Binary files differnew file mode 100755 index 000000000000..f27f369dbe61 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/IncreaseSpace_16x16.png diff --git a/icon-themes/galaxy/svx/res/symphony/Indent2.png b/icon-themes/galaxy/svx/res/symphony/Indent2.png Binary files differnew file mode 100755 index 000000000000..9cb8663a9703 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/Indent2.png diff --git a/icon-themes/galaxy/svx/res/symphony/Indent3.png b/icon-themes/galaxy/svx/res/symphony/Indent3.png Binary files differnew file mode 100755 index 000000000000..c57f2b279c48 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/Indent3.png diff --git a/icon-themes/galaxy/svx/res/symphony/Indent4.png b/icon-themes/galaxy/svx/res/symphony/Indent4.png Binary files differnew file mode 100755 index 000000000000..0cba2f006ed0 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/Indent4.png diff --git a/icon-themes/galaxy/svx/res/symphony/Indent_16x16.png b/icon-themes/galaxy/svx/res/symphony/Indent_16x16.png Binary files differnew file mode 100755 index 000000000000..93137374094e --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/Indent_16x16.png diff --git a/icon-themes/galaxy/svx/res/symphony/Indent_Hanging.png b/icon-themes/galaxy/svx/res/symphony/Indent_Hanging.png Binary files differnew file mode 100755 index 000000000000..4acb5b519983 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/Indent_Hanging.png diff --git a/icon-themes/galaxy/svx/res/symphony/Line_color.png b/icon-themes/galaxy/svx/res/symphony/Line_color.png Binary files differnew file mode 100755 index 000000000000..a9522b9eeedd --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/Line_color.png diff --git a/icon-themes/galaxy/svx/res/symphony/Outdent_16x16.png b/icon-themes/galaxy/svx/res/symphony/Outdent_16x16.png Binary files differnew file mode 100755 index 000000000000..7461944a7083 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/Outdent_16x16.png diff --git a/icon-themes/galaxy/svx/res/symphony/Quadratic.png b/icon-themes/galaxy/svx/res/symphony/Quadratic.png Binary files differnew file mode 100755 index 000000000000..ad579c8e393d --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/Quadratic.png diff --git a/icon-themes/galaxy/svx/res/symphony/Square.png b/icon-themes/galaxy/svx/res/symphony/Square.png Binary files differnew file mode 100755 index 000000000000..1027f8a480f8 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/Square.png diff --git a/icon-themes/galaxy/svx/res/symphony/__morebutton.bmp b/icon-themes/galaxy/svx/res/symphony/__morebutton.bmp Binary files differnew file mode 100755 index 000000000000..c665b3e866a8 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/__morebutton.bmp diff --git a/icon-themes/galaxy/svx/res/symphony/axial.png b/icon-themes/galaxy/svx/res/symphony/axial.png Binary files differnew file mode 100755 index 000000000000..8b398bef1df5 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/axial.png diff --git a/icon-themes/galaxy/svx/res/symphony/blank.png b/icon-themes/galaxy/svx/res/symphony/blank.png Binary files differnew file mode 100755 index 000000000000..d38ff9daebf9 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/blank.png diff --git a/icon-themes/galaxy/svx/res/symphony/decrease font.png b/icon-themes/galaxy/svx/res/symphony/decrease font.png Binary files differnew file mode 100755 index 000000000000..183e0091f590 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/decrease font.png diff --git a/icon-themes/galaxy/svx/res/symphony/ellipsoid.png b/icon-themes/galaxy/svx/res/symphony/ellipsoid.png Binary files differnew file mode 100755 index 000000000000..babaf75b2da8 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/ellipsoid.png diff --git a/icon-themes/galaxy/svx/res/symphony/enlarge font.png b/icon-themes/galaxy/svx/res/symphony/enlarge font.png Binary files differnew file mode 100755 index 000000000000..86c6e5d49daa --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/enlarge font.png diff --git a/icon-themes/galaxy/svx/res/symphony/fill_color.png b/icon-themes/galaxy/svx/res/symphony/fill_color.png Binary files differnew file mode 100755 index 000000000000..1d8837545728 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/fill_color.png diff --git a/icon-themes/galaxy/svx/res/symphony/icon_normal.png b/icon-themes/galaxy/svx/res/symphony/icon_normal.png Binary files differnew file mode 100755 index 000000000000..f69ec0501e9e --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/icon_normal.png diff --git a/icon-themes/galaxy/svx/res/symphony/last_custom_common.png b/icon-themes/galaxy/svx/res/symphony/last_custom_common.png Binary files differnew file mode 100755 index 000000000000..bbbe3255d272 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/last_custom_common.png diff --git a/icon-themes/galaxy/svx/res/symphony/last_custom_common_grey.png b/icon-themes/galaxy/svx/res/symphony/last_custom_common_grey.png Binary files differnew file mode 100755 index 000000000000..c95062eb2897 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/last_custom_common_grey.png diff --git a/icon-themes/galaxy/svx/res/symphony/line1.png b/icon-themes/galaxy/svx/res/symphony/line1.png Binary files differnew file mode 100755 index 000000000000..7b667d5fdfe0 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/line1.png diff --git a/icon-themes/galaxy/svx/res/symphony/line10.png b/icon-themes/galaxy/svx/res/symphony/line10.png Binary files differnew file mode 100755 index 000000000000..956c4f05959e --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/line10.png diff --git a/icon-themes/galaxy/svx/res/symphony/line2.png b/icon-themes/galaxy/svx/res/symphony/line2.png Binary files differnew file mode 100755 index 000000000000..d7c2cae56195 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/line2.png diff --git a/icon-themes/galaxy/svx/res/symphony/line3.png b/icon-themes/galaxy/svx/res/symphony/line3.png Binary files differnew file mode 100755 index 000000000000..0c74e4190570 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/line3.png diff --git a/icon-themes/galaxy/svx/res/symphony/line4.png b/icon-themes/galaxy/svx/res/symphony/line4.png Binary files differnew file mode 100755 index 000000000000..5dc893860d32 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/line4.png diff --git a/icon-themes/galaxy/svx/res/symphony/line5.png b/icon-themes/galaxy/svx/res/symphony/line5.png Binary files differnew file mode 100755 index 000000000000..2f90aedc5b46 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/line5.png diff --git a/icon-themes/galaxy/svx/res/symphony/line6.png b/icon-themes/galaxy/svx/res/symphony/line6.png Binary files differnew file mode 100755 index 000000000000..10a7cedcfcae --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/line6.png diff --git a/icon-themes/galaxy/svx/res/symphony/line7.png b/icon-themes/galaxy/svx/res/symphony/line7.png Binary files differnew file mode 100755 index 000000000000..ff1df906dec3 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/line7.png diff --git a/icon-themes/galaxy/svx/res/symphony/line8.png b/icon-themes/galaxy/svx/res/symphony/line8.png Binary files differnew file mode 100755 index 000000000000..5355d76d7644 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/line8.png diff --git a/icon-themes/galaxy/svx/res/symphony/line9.png b/icon-themes/galaxy/svx/res/symphony/line9.png Binary files differnew file mode 100755 index 000000000000..ba822a7c16e3 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/line9.png diff --git a/icon-themes/galaxy/svx/res/symphony/linear.png b/icon-themes/galaxy/svx/res/symphony/linear.png Binary files differnew file mode 100755 index 000000000000..a9c3191b1919 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/linear.png diff --git a/icon-themes/galaxy/svx/res/symphony/lpselected-spacing-1.png b/icon-themes/galaxy/svx/res/symphony/lpselected-spacing-1.png Binary files differnew file mode 100755 index 000000000000..098636521709 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/lpselected-spacing-1.png diff --git a/icon-themes/galaxy/svx/res/symphony/lpselected-spacing-1_15.png b/icon-themes/galaxy/svx/res/symphony/lpselected-spacing-1_15.png Binary files differnew file mode 100755 index 000000000000..97337b0e77dc --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/lpselected-spacing-1_15.png diff --git a/icon-themes/galaxy/svx/res/symphony/lpselected-spacing-1_5.png b/icon-themes/galaxy/svx/res/symphony/lpselected-spacing-1_5.png Binary files differnew file mode 100755 index 000000000000..90b2532ca23b --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/lpselected-spacing-1_5.png diff --git a/icon-themes/galaxy/svx/res/symphony/lpselected-spacing-2.png b/icon-themes/galaxy/svx/res/symphony/lpselected-spacing-2.png Binary files differnew file mode 100755 index 000000000000..4549b900caf6 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/lpselected-spacing-2.png diff --git a/icon-themes/galaxy/svx/res/symphony/lpsmall-spacing-1.png b/icon-themes/galaxy/svx/res/symphony/lpsmall-spacing-1.png Binary files differnew file mode 100755 index 000000000000..b6afc43b3b9b --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/lpsmall-spacing-1.png diff --git a/icon-themes/galaxy/svx/res/symphony/lpspacing-1.png b/icon-themes/galaxy/svx/res/symphony/lpspacing-1.png Binary files differnew file mode 100755 index 000000000000..6aefacf9f8a0 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/lpspacing-1.png diff --git a/icon-themes/galaxy/svx/res/symphony/lpspacing-1_15.png b/icon-themes/galaxy/svx/res/symphony/lpspacing-1_15.png Binary files differnew file mode 100755 index 000000000000..01c861d88f34 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/lpspacing-1_15.png diff --git a/icon-themes/galaxy/svx/res/symphony/lpspacing-1_5.png b/icon-themes/galaxy/svx/res/symphony/lpspacing-1_5.png Binary files differnew file mode 100755 index 000000000000..27708ca4f070 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/lpspacing-1_5.png diff --git a/icon-themes/galaxy/svx/res/symphony/lpspacing-2.png b/icon-themes/galaxy/svx/res/symphony/lpspacing-2.png Binary files differnew file mode 100755 index 000000000000..12f0fcdcd9cf --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/lpspacing-2.png diff --git a/icon-themes/galaxy/svx/res/symphony/no color.png b/icon-themes/galaxy/svx/res/symphony/no color.png Binary files differnew file mode 100755 index 000000000000..7442b7484945 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/no color.png diff --git a/icon-themes/galaxy/svx/res/symphony/para_numbullet01.png b/icon-themes/galaxy/svx/res/symphony/para_numbullet01.png Binary files differnew file mode 100755 index 000000000000..8cb0cc7bd94a --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/para_numbullet01.png diff --git a/icon-themes/galaxy/svx/res/symphony/para_numbullet02.png b/icon-themes/galaxy/svx/res/symphony/para_numbullet02.png Binary files differnew file mode 100755 index 000000000000..f283c8af12ad --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/para_numbullet02.png diff --git a/icon-themes/galaxy/svx/res/symphony/para_numbullet_rtl01.png b/icon-themes/galaxy/svx/res/symphony/para_numbullet_rtl01.png Binary files differnew file mode 100755 index 000000000000..cae419362f95 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/para_numbullet_rtl01.png diff --git a/icon-themes/galaxy/svx/res/symphony/para_numbullet_rtl02.png b/icon-themes/galaxy/svx/res/symphony/para_numbullet_rtl02.png Binary files differnew file mode 100755 index 000000000000..c5ecb4b690f3 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/para_numbullet_rtl02.png diff --git a/icon-themes/galaxy/svx/res/symphony/para_numbulleth01.png b/icon-themes/galaxy/svx/res/symphony/para_numbulleth01.png Binary files differnew file mode 100755 index 000000000000..6bf74ad750ab --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/para_numbulleth01.png diff --git a/icon-themes/galaxy/svx/res/symphony/para_numbulleth02.png b/icon-themes/galaxy/svx/res/symphony/para_numbulleth02.png Binary files differnew file mode 100755 index 000000000000..8405c705fea8 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/para_numbulleth02.png diff --git a/icon-themes/galaxy/svx/res/symphony/para_vert01.png b/icon-themes/galaxy/svx/res/symphony/para_vert01.png Binary files differnew file mode 100755 index 000000000000..275133c3409d --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/para_vert01.png diff --git a/icon-themes/galaxy/svx/res/symphony/para_vert02.png b/icon-themes/galaxy/svx/res/symphony/para_vert02.png Binary files differnew file mode 100755 index 000000000000..919edab0d01b --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/para_vert02.png diff --git a/icon-themes/galaxy/svx/res/symphony/para_vert03.png b/icon-themes/galaxy/svx/res/symphony/para_vert03.png Binary files differnew file mode 100755 index 000000000000..de22c240efdb --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/para_vert03.png diff --git a/icon-themes/galaxy/svx/res/symphony/para_verth01.png b/icon-themes/galaxy/svx/res/symphony/para_verth01.png Binary files differnew file mode 100755 index 000000000000..9493fba1c393 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/para_verth01.png diff --git a/icon-themes/galaxy/svx/res/symphony/para_verth02.png b/icon-themes/galaxy/svx/res/symphony/para_verth02.png Binary files differnew file mode 100755 index 000000000000..66470c72db77 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/para_verth02.png diff --git a/icon-themes/galaxy/svx/res/symphony/para_verth03.png b/icon-themes/galaxy/svx/res/symphony/para_verth03.png Binary files differnew file mode 100755 index 000000000000..bf889acb3a31 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/para_verth03.png diff --git a/icon-themes/galaxy/svx/res/symphony/radial.png b/icon-themes/galaxy/svx/res/symphony/radial.png Binary files differnew file mode 100755 index 000000000000..bb44a0c68318 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/radial.png diff --git a/icon-themes/galaxy/svx/res/symphony/rotate_left.png b/icon-themes/galaxy/svx/res/symphony/rotate_left.png Binary files differnew file mode 100755 index 000000000000..b537b6b9286a --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/rotate_left.png diff --git a/icon-themes/galaxy/svx/res/symphony/rotate_right.png b/icon-themes/galaxy/svx/res/symphony/rotate_right.png Binary files differnew file mode 100755 index 000000000000..217cf91891b4 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/rotate_right.png diff --git a/icon-themes/galaxy/svx/res/symphony/rotation.png b/icon-themes/galaxy/svx/res/symphony/rotation.png Binary files differnew file mode 100755 index 000000000000..3d197def2724 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/rotation.png diff --git a/icon-themes/galaxy/svx/res/symphony/rte_Indent_16x16.png b/icon-themes/galaxy/svx/res/symphony/rte_Indent_16x16.png Binary files differnew file mode 100755 index 000000000000..28c90a34a62f --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/rte_Indent_16x16.png diff --git a/icon-themes/galaxy/svx/res/symphony/rte_Outdent_16x16.png b/icon-themes/galaxy/svx/res/symphony/rte_Outdent_16x16.png Binary files differnew file mode 100755 index 000000000000..ceae7d35d843 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/rte_Outdent_16x16.png diff --git a/icon-themes/galaxy/svx/res/symphony/sc_backgroundcolor.png b/icon-themes/galaxy/svx/res/symphony/sc_backgroundcolor.png Binary files differnew file mode 100755 index 000000000000..7f926b66bd71 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/sc_backgroundcolor.png diff --git a/icon-themes/galaxy/svx/res/symphony/sc_bold.png b/icon-themes/galaxy/svx/res/symphony/sc_bold.png Binary files differnew file mode 100755 index 000000000000..2f610b2529c8 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/sc_bold.png diff --git a/icon-themes/galaxy/svx/res/symphony/sc_color.png b/icon-themes/galaxy/svx/res/symphony/sc_color.png Binary files differnew file mode 100755 index 000000000000..f11f2181434e --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/sc_color.png diff --git a/icon-themes/galaxy/svx/res/symphony/sc_italic.png b/icon-themes/galaxy/svx/res/symphony/sc_italic.png Binary files differnew file mode 100755 index 000000000000..0ccd22e1cc39 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/sc_italic.png diff --git a/icon-themes/galaxy/svx/res/symphony/sc_shadowed.png b/icon-themes/galaxy/svx/res/symphony/sc_shadowed.png Binary files differnew file mode 100755 index 000000000000..7d3a6992c92a --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/sc_shadowed.png diff --git a/icon-themes/galaxy/svx/res/symphony/sc_strikeout.png b/icon-themes/galaxy/svx/res/symphony/sc_strikeout.png Binary files differnew file mode 100755 index 000000000000..58d2794bb41c --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/sc_strikeout.png diff --git a/icon-themes/galaxy/svx/res/symphony/sc_subscript.png b/icon-themes/galaxy/svx/res/symphony/sc_subscript.png Binary files differnew file mode 100755 index 000000000000..682e6f17ac21 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/sc_subscript.png diff --git a/icon-themes/galaxy/svx/res/symphony/sc_superscript.png b/icon-themes/galaxy/svx/res/symphony/sc_superscript.png Binary files differnew file mode 100755 index 000000000000..33fd1ecef7ae --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/sc_superscript.png diff --git a/icon-themes/galaxy/svx/res/symphony/sc_underline.png b/icon-themes/galaxy/svx/res/symphony/sc_underline.png Binary files differnew file mode 100755 index 000000000000..b2071c5cc423 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/sc_underline.png diff --git a/icon-themes/galaxy/svx/res/symphony/sch_backgroundcolor.png b/icon-themes/galaxy/svx/res/symphony/sch_backgroundcolor.png Binary files differnew file mode 100755 index 000000000000..a2e234fc3311 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/sch_backgroundcolor.png diff --git a/icon-themes/galaxy/svx/res/symphony/selected-line1.png b/icon-themes/galaxy/svx/res/symphony/selected-line1.png Binary files differnew file mode 100755 index 000000000000..99921b34df4e --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/selected-line1.png diff --git a/icon-themes/galaxy/svx/res/symphony/selected-line10.png b/icon-themes/galaxy/svx/res/symphony/selected-line10.png Binary files differnew file mode 100755 index 000000000000..cca4848e0cb5 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/selected-line10.png diff --git a/icon-themes/galaxy/svx/res/symphony/selected-line2.png b/icon-themes/galaxy/svx/res/symphony/selected-line2.png Binary files differnew file mode 100755 index 000000000000..4e68e6ba48c7 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/selected-line2.png diff --git a/icon-themes/galaxy/svx/res/symphony/selected-line3.png b/icon-themes/galaxy/svx/res/symphony/selected-line3.png Binary files differnew file mode 100755 index 000000000000..425869e629c1 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/selected-line3.png diff --git a/icon-themes/galaxy/svx/res/symphony/selected-line4.png b/icon-themes/galaxy/svx/res/symphony/selected-line4.png Binary files differnew file mode 100755 index 000000000000..7fa3f7eb219e --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/selected-line4.png diff --git a/icon-themes/galaxy/svx/res/symphony/selected-line5.png b/icon-themes/galaxy/svx/res/symphony/selected-line5.png Binary files differnew file mode 100755 index 000000000000..60e266c070ae --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/selected-line5.png diff --git a/icon-themes/galaxy/svx/res/symphony/selected-line6.png b/icon-themes/galaxy/svx/res/symphony/selected-line6.png Binary files differnew file mode 100755 index 000000000000..e89d1996e100 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/selected-line6.png diff --git a/icon-themes/galaxy/svx/res/symphony/selected-line7.png b/icon-themes/galaxy/svx/res/symphony/selected-line7.png Binary files differnew file mode 100755 index 000000000000..c53fd70e0064 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/selected-line7.png diff --git a/icon-themes/galaxy/svx/res/symphony/selected-line8.png b/icon-themes/galaxy/svx/res/symphony/selected-line8.png Binary files differnew file mode 100755 index 000000000000..b24ab5588343 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/selected-line8.png diff --git a/icon-themes/galaxy/svx/res/symphony/selected-line9.png b/icon-themes/galaxy/svx/res/symphony/selected-line9.png Binary files differnew file mode 100755 index 000000000000..c6e266ea110c --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/selected-line9.png diff --git a/icon-themes/galaxy/svx/res/symphony/spacing1.png b/icon-themes/galaxy/svx/res/symphony/spacing1.png Binary files differnew file mode 100755 index 000000000000..9e1f4839e25d --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/spacing1.png diff --git a/icon-themes/galaxy/svx/res/symphony/spacing2.png b/icon-themes/galaxy/svx/res/symphony/spacing2.png Binary files differnew file mode 100755 index 000000000000..f4ae81a37ced --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/spacing2.png diff --git a/icon-themes/galaxy/svx/res/symphony/spacing3.png b/icon-themes/galaxy/svx/res/symphony/spacing3.png Binary files differnew file mode 100755 index 000000000000..106e0edaed0b --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/spacing3.png diff --git a/icon-themes/galaxy/svx/res/symphony/spacing_loose.png b/icon-themes/galaxy/svx/res/symphony/spacing_loose.png Binary files differnew file mode 100755 index 000000000000..5ab9f3e02043 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/spacing_loose.png diff --git a/icon-themes/galaxy/svx/res/symphony/spacing_loose_s.png b/icon-themes/galaxy/svx/res/symphony/spacing_loose_s.png Binary files differnew file mode 100755 index 000000000000..46e2f246c558 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/spacing_loose_s.png diff --git a/icon-themes/galaxy/svx/res/symphony/spacing_normal.png b/icon-themes/galaxy/svx/res/symphony/spacing_normal.png Binary files differnew file mode 100755 index 000000000000..bf7d5471160a --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/spacing_normal.png diff --git a/icon-themes/galaxy/svx/res/symphony/spacing_normal_s.png b/icon-themes/galaxy/svx/res/symphony/spacing_normal_s.png Binary files differnew file mode 100755 index 000000000000..76097b309e89 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/spacing_normal_s.png diff --git a/icon-themes/galaxy/svx/res/symphony/spacing_tight.png b/icon-themes/galaxy/svx/res/symphony/spacing_tight.png Binary files differnew file mode 100755 index 000000000000..ac469dbb93ed --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/spacing_tight.png diff --git a/icon-themes/galaxy/svx/res/symphony/spacing_tight_s.png b/icon-themes/galaxy/svx/res/symphony/spacing_tight_s.png Binary files differnew file mode 100755 index 000000000000..dbb969cf57ae --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/spacing_tight_s.png diff --git a/icon-themes/galaxy/svx/res/symphony/spacing_very loose.png b/icon-themes/galaxy/svx/res/symphony/spacing_very loose.png Binary files differnew file mode 100755 index 000000000000..04f3969c6853 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/spacing_very loose.png diff --git a/icon-themes/galaxy/svx/res/symphony/spacing_very loose_s.png b/icon-themes/galaxy/svx/res/symphony/spacing_very loose_s.png Binary files differnew file mode 100755 index 000000000000..21f578408222 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/spacing_very loose_s.png diff --git a/icon-themes/galaxy/svx/res/symphony/spacing_very tight.png b/icon-themes/galaxy/svx/res/symphony/spacing_very tight.png Binary files differnew file mode 100755 index 000000000000..84845c3c9ca5 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/spacing_very tight.png diff --git a/icon-themes/galaxy/svx/res/symphony/spacing_very tight_s.png b/icon-themes/galaxy/svx/res/symphony/spacing_very tight_s.png Binary files differnew file mode 100755 index 000000000000..19b4856b4b0a --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/spacing_very tight_s.png diff --git a/icon-themes/galaxy/svx/res/symphony/style_line1.png b/icon-themes/galaxy/svx/res/symphony/style_line1.png Binary files differnew file mode 100755 index 000000000000..6403c068da07 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/style_line1.png diff --git a/icon-themes/galaxy/svx/res/symphony/style_line10.png b/icon-themes/galaxy/svx/res/symphony/style_line10.png Binary files differnew file mode 100755 index 000000000000..f7d1e34985a3 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/style_line10.png diff --git a/icon-themes/galaxy/svx/res/symphony/style_line11.png b/icon-themes/galaxy/svx/res/symphony/style_line11.png Binary files differnew file mode 100755 index 000000000000..4400dd387e7c --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/style_line11.png diff --git a/icon-themes/galaxy/svx/res/symphony/style_line2.png b/icon-themes/galaxy/svx/res/symphony/style_line2.png Binary files differnew file mode 100755 index 000000000000..4269c7dfadf3 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/style_line2.png diff --git a/icon-themes/galaxy/svx/res/symphony/style_line3.png b/icon-themes/galaxy/svx/res/symphony/style_line3.png Binary files differnew file mode 100755 index 000000000000..3e03ad01f28a --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/style_line3.png diff --git a/icon-themes/galaxy/svx/res/symphony/style_line4.png b/icon-themes/galaxy/svx/res/symphony/style_line4.png Binary files differnew file mode 100755 index 000000000000..21c1115429ea --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/style_line4.png diff --git a/icon-themes/galaxy/svx/res/symphony/style_line5.png b/icon-themes/galaxy/svx/res/symphony/style_line5.png Binary files differnew file mode 100755 index 000000000000..8648065c1951 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/style_line5.png diff --git a/icon-themes/galaxy/svx/res/symphony/style_line6.png b/icon-themes/galaxy/svx/res/symphony/style_line6.png Binary files differnew file mode 100755 index 000000000000..b0b8d7cf88ed --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/style_line6.png diff --git a/icon-themes/galaxy/svx/res/symphony/style_line7.png b/icon-themes/galaxy/svx/res/symphony/style_line7.png Binary files differnew file mode 100755 index 000000000000..e30fc03fc333 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/style_line7.png diff --git a/icon-themes/galaxy/svx/res/symphony/style_line8.png b/icon-themes/galaxy/svx/res/symphony/style_line8.png Binary files differnew file mode 100755 index 000000000000..5c3ed3144a6f --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/style_line8.png diff --git a/icon-themes/galaxy/svx/res/symphony/style_line9.png b/icon-themes/galaxy/svx/res/symphony/style_line9.png Binary files differnew file mode 100755 index 000000000000..10035bae2640 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/style_line9.png diff --git a/icon-themes/galaxy/svx/res/symphony/width1.png b/icon-themes/galaxy/svx/res/symphony/width1.png Binary files differnew file mode 100755 index 000000000000..8faeb437c01f --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/width1.png diff --git a/icon-themes/galaxy/svx/res/symphony/width2.png b/icon-themes/galaxy/svx/res/symphony/width2.png Binary files differnew file mode 100755 index 000000000000..e6574687fac0 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/width2.png diff --git a/icon-themes/galaxy/svx/res/symphony/width3.png b/icon-themes/galaxy/svx/res/symphony/width3.png Binary files differnew file mode 100755 index 000000000000..dfe321603ce3 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/width3.png diff --git a/icon-themes/galaxy/svx/res/symphony/width4.png b/icon-themes/galaxy/svx/res/symphony/width4.png Binary files differnew file mode 100755 index 000000000000..d19ac86ab222 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/width4.png diff --git a/icon-themes/galaxy/svx/res/symphony/width5.png b/icon-themes/galaxy/svx/res/symphony/width5.png Binary files differnew file mode 100755 index 000000000000..de6fb7f906c9 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/width5.png diff --git a/icon-themes/galaxy/svx/res/symphony/width6.png b/icon-themes/galaxy/svx/res/symphony/width6.png Binary files differnew file mode 100755 index 000000000000..27e3cad34eb3 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/width6.png diff --git a/icon-themes/galaxy/svx/res/symphony/width7.png b/icon-themes/galaxy/svx/res/symphony/width7.png Binary files differnew file mode 100755 index 000000000000..5bd3cfe35132 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/width7.png diff --git a/icon-themes/galaxy/svx/res/symphony/width8.png b/icon-themes/galaxy/svx/res/symphony/width8.png Binary files differnew file mode 100755 index 000000000000..1cbb7ebda8e5 --- /dev/null +++ b/icon-themes/galaxy/svx/res/symphony/width8.png diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/Landscapecopy_24x24.png b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/Landscapecopy_24x24.png Binary files differnew file mode 100755 index 000000000000..ce1372162eff --- /dev/null +++ b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/Landscapecopy_24x24.png diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/column1_24x24.png b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/column1_24x24.png Binary files differnew file mode 100755 index 000000000000..48f4a8b1c281 --- /dev/null +++ b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/column1_24x24.png diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/column2_24x24.png b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/column2_24x24.png Binary files differnew file mode 100755 index 000000000000..d8a2de473bf4 --- /dev/null +++ b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/column2_24x24.png diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/column3_24x24.png b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/column3_24x24.png Binary files differnew file mode 100755 index 000000000000..5869559c36ad --- /dev/null +++ b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/column3_24x24.png diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/column_L_1_24x24.png b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/column_L_1_24x24.png Binary files differnew file mode 100755 index 000000000000..bac5e3f468bd --- /dev/null +++ b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/column_L_1_24x24.png diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/column_L_2_24x24.png b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/column_L_2_24x24.png Binary files differnew file mode 100755 index 000000000000..146b66695721 --- /dev/null +++ b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/column_L_2_24x24.png diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/column_L_3_24x24.png b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/column_L_3_24x24.png Binary files differnew file mode 100755 index 000000000000..11ee37536b25 --- /dev/null +++ b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/column_L_3_24x24.png diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/column_L_copy_24x24.png b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/column_L_copy_24x24.png Binary files differnew file mode 100755 index 000000000000..747ac4dd242f --- /dev/null +++ b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/column_L_copy_24x24.png diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/column_L_left_24x24.png b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/column_L_left_24x24.png Binary files differnew file mode 100755 index 000000000000..c6a9f0caa740 --- /dev/null +++ b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/column_L_left_24x24.png diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/column_L_right_24x24.png b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/column_L_right_24x24.png Binary files differnew file mode 100755 index 000000000000..ccdecfe2de6f --- /dev/null +++ b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/column_L_right_24x24.png diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/columncopy_24x24.png b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/columncopy_24x24.png Binary files differnew file mode 100755 index 000000000000..983da8be35ad --- /dev/null +++ b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/columncopy_24x24.png diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/columnleft_24x24.png b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/columnleft_24x24.png Binary files differnew file mode 100755 index 000000000000..c61c76a32b57 --- /dev/null +++ b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/columnleft_24x24.png diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/columnright_24x24.png b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/columnright_24x24.png Binary files differnew file mode 100755 index 000000000000..9421fabc232d --- /dev/null +++ b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/columnright_24x24.png diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/documentsizeA3_24x24.png b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/documentsizeA3_24x24.png Binary files differnew file mode 100755 index 000000000000..e9507282d308 --- /dev/null +++ b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/documentsizeA3_24x24.png diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/documentsizeA4_24x24.png b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/documentsizeA4_24x24.png Binary files differnew file mode 100755 index 000000000000..3039746e09de --- /dev/null +++ b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/documentsizeA4_24x24.png diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/documentsizeA5_24x24.png b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/documentsizeA5_24x24.png Binary files differnew file mode 100755 index 000000000000..2e73f5d246dc --- /dev/null +++ b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/documentsizeA5_24x24.png diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/documentsizeB4_24x24.png b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/documentsizeB4_24x24.png Binary files differnew file mode 100755 index 000000000000..8456ef4d544f --- /dev/null +++ b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/documentsizeB4_24x24.png diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/documentsizeB5_24x24.png b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/documentsizeB5_24x24.png Binary files differnew file mode 100755 index 000000000000..21b37467d657 --- /dev/null +++ b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/documentsizeB5_24x24.png diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/documentsizeC5_24x24.png b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/documentsizeC5_24x24.png Binary files differnew file mode 100755 index 000000000000..91501da5b92c --- /dev/null +++ b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/documentsizeC5_24x24.png diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/documentsize_L_A3_24x24.png b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/documentsize_L_A3_24x24.png Binary files differnew file mode 100755 index 000000000000..a32119dfa20f --- /dev/null +++ b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/documentsize_L_A3_24x24.png diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/documentsize_L_A4_24x24.png b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/documentsize_L_A4_24x24.png Binary files differnew file mode 100755 index 000000000000..5cd5f8e0fcb9 --- /dev/null +++ b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/documentsize_L_A4_24x24.png diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/documentsize_L_A5_24x24.png b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/documentsize_L_A5_24x24.png Binary files differnew file mode 100755 index 000000000000..cc4d2cb627a2 --- /dev/null +++ b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/documentsize_L_A5_24x24.png diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/documentsize_L_B4_24x24.png b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/documentsize_L_B4_24x24.png Binary files differnew file mode 100755 index 000000000000..e1d1bcf2c91e --- /dev/null +++ b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/documentsize_L_B4_24x24.png diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/documentsize_L_B5_24x24.png b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/documentsize_L_B5_24x24.png Binary files differnew file mode 100755 index 000000000000..0e7627201309 --- /dev/null +++ b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/documentsize_L_B5_24x24.png diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/documentsize_L_C5_24x24.png b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/documentsize_L_C5_24x24.png Binary files differnew file mode 100755 index 000000000000..2c880f81b2bc --- /dev/null +++ b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/documentsize_L_C5_24x24.png diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/documentsize_L_copy_24x24.png b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/documentsize_L_copy_24x24.png Binary files differnew file mode 100755 index 000000000000..608d5a586147 --- /dev/null +++ b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/documentsize_L_copy_24x24.png diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/documentsizecopy_24x24.png b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/documentsizecopy_24x24.png Binary files differnew file mode 100755 index 000000000000..ce13c36b3f69 --- /dev/null +++ b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/documentsizecopy_24x24.png diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/format_L_copy_24x24.png b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/format_L_copy_24x24.png Binary files differnew file mode 100755 index 000000000000..747ac4dd242f --- /dev/null +++ b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/format_L_copy_24x24.png diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/format_L_mirror_24x24.png b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/format_L_mirror_24x24.png Binary files differnew file mode 100755 index 000000000000..aa93fbcbb09a --- /dev/null +++ b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/format_L_mirror_24x24.png diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/format_L_narrow_24x24.png b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/format_L_narrow_24x24.png Binary files differnew file mode 100755 index 000000000000..e6d2579d1525 --- /dev/null +++ b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/format_L_narrow_24x24.png diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/format_L_nomal_24x24.png b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/format_L_nomal_24x24.png Binary files differnew file mode 100755 index 000000000000..840ca804a5ae --- /dev/null +++ b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/format_L_nomal_24x24.png diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/format_L_wide_24x24.png b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/format_L_wide_24x24.png Binary files differnew file mode 100755 index 000000000000..a47c1ca6cc36 --- /dev/null +++ b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/format_L_wide_24x24.png diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/formatcopy_24x24.png b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/formatcopy_24x24.png Binary files differnew file mode 100755 index 000000000000..983da8be35ad --- /dev/null +++ b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/formatcopy_24x24.png diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/formatmirror_24x24.png b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/formatmirror_24x24.png Binary files differnew file mode 100755 index 000000000000..696ca1126428 --- /dev/null +++ b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/formatmirror_24x24.png diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/formatnarrow_24x24.png b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/formatnarrow_24x24.png Binary files differnew file mode 100755 index 000000000000..2f4b0e4ca005 --- /dev/null +++ b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/formatnarrow_24x24.png diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/formatnormal_24x24.png b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/formatnormal_24x24.png Binary files differnew file mode 100755 index 000000000000..83fea86ef080 --- /dev/null +++ b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/formatnormal_24x24.png diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/formatwide_24x24.png b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/formatwide_24x24.png Binary files differnew file mode 100755 index 000000000000..b260b07b8d6e --- /dev/null +++ b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/formatwide_24x24.png diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/last_custom_common.png b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/last_custom_common.png Binary files differnew file mode 100755 index 000000000000..bbbe3255d272 --- /dev/null +++ b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/last_custom_common.png diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/last_custom_common_grey.png b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/last_custom_common_grey.png Binary files differnew file mode 100755 index 000000000000..c95062eb2897 --- /dev/null +++ b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/last_custom_common_grey.png diff --git a/icon-themes/galaxy/sw/res/sidebar/pageproppanel/portraitcopy_24x24.png b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/portraitcopy_24x24.png Binary files differnew file mode 100755 index 000000000000..e39324a1d435 --- /dev/null +++ b/icon-themes/galaxy/sw/res/sidebar/pageproppanel/portraitcopy_24x24.png diff --git a/icon-themes/hicontrast/sc/res/sidebar/CellBorderLineStyle_005.png b/icon-themes/hicontrast/sc/res/sidebar/CellBorderLineStyle_005.png Binary files differnew file mode 100755 index 000000000000..444d51484993 --- /dev/null +++ b/icon-themes/hicontrast/sc/res/sidebar/CellBorderLineStyle_005.png diff --git a/icon-themes/hicontrast/sc/res/sidebar/CellBorderLineStyle_110.png b/icon-themes/hicontrast/sc/res/sidebar/CellBorderLineStyle_110.png Binary files differnew file mode 100755 index 000000000000..1144a495ef0d --- /dev/null +++ b/icon-themes/hicontrast/sc/res/sidebar/CellBorderLineStyle_110.png diff --git a/icon-themes/hicontrast/sc/res/sidebar/CellBorderLineStyle_250.png b/icon-themes/hicontrast/sc/res/sidebar/CellBorderLineStyle_250.png Binary files differnew file mode 100755 index 000000000000..8a6cc3ce6d7c --- /dev/null +++ b/icon-themes/hicontrast/sc/res/sidebar/CellBorderLineStyle_250.png diff --git a/icon-themes/hicontrast/sc/res/sidebar/CellBorderLineStyle_260.png b/icon-themes/hicontrast/sc/res/sidebar/CellBorderLineStyle_260.png Binary files differnew file mode 100755 index 000000000000..769a03cb8902 --- /dev/null +++ b/icon-themes/hicontrast/sc/res/sidebar/CellBorderLineStyle_260.png diff --git a/icon-themes/hicontrast/sc/res/sidebar/CellBorderLineStyle_400.png b/icon-themes/hicontrast/sc/res/sidebar/CellBorderLineStyle_400.png Binary files differnew file mode 100755 index 000000000000..cd8503a6de83 --- /dev/null +++ b/icon-themes/hicontrast/sc/res/sidebar/CellBorderLineStyle_400.png diff --git a/icon-themes/hicontrast/sc/res/sidebar/CellBorderLineStyle_450.png b/icon-themes/hicontrast/sc/res/sidebar/CellBorderLineStyle_450.png Binary files differnew file mode 100755 index 000000000000..17fa6fc02932 --- /dev/null +++ b/icon-themes/hicontrast/sc/res/sidebar/CellBorderLineStyle_450.png diff --git a/icon-themes/hicontrast/sc/res/sidebar/CellBorderLineStyle_500.png b/icon-themes/hicontrast/sc/res/sidebar/CellBorderLineStyle_500.png Binary files differnew file mode 100755 index 000000000000..90d8d6937eaa --- /dev/null +++ b/icon-themes/hicontrast/sc/res/sidebar/CellBorderLineStyle_500.png diff --git a/icon-themes/hicontrast/sc/res/sidebar/CellBorderLineStyle_505.png b/icon-themes/hicontrast/sc/res/sidebar/CellBorderLineStyle_505.png Binary files differnew file mode 100755 index 000000000000..94846c3e8779 --- /dev/null +++ b/icon-themes/hicontrast/sc/res/sidebar/CellBorderLineStyle_505.png diff --git a/icon-themes/hicontrast/sc/res/sidebar/CellBorderLineStyle_750.png b/icon-themes/hicontrast/sc/res/sidebar/CellBorderLineStyle_750.png Binary files differnew file mode 100755 index 000000000000..40bafef208b2 --- /dev/null +++ b/icon-themes/hicontrast/sc/res/sidebar/CellBorderLineStyle_750.png diff --git a/icon-themes/hicontrast/sc/res/sidebar/CellBorder_All_18x18.png b/icon-themes/hicontrast/sc/res/sidebar/CellBorder_All_18x18.png Binary files differnew file mode 100755 index 000000000000..2f7909dda654 --- /dev/null +++ b/icon-themes/hicontrast/sc/res/sidebar/CellBorder_All_18x18.png diff --git a/icon-themes/hicontrast/sc/res/sidebar/CellBorder_Bottom_18x18.png b/icon-themes/hicontrast/sc/res/sidebar/CellBorder_Bottom_18x18.png Binary files differnew file mode 100755 index 000000000000..7e3ba683d107 --- /dev/null +++ b/icon-themes/hicontrast/sc/res/sidebar/CellBorder_Bottom_18x18.png diff --git a/icon-themes/hicontrast/sc/res/sidebar/CellBorder_Bottom_Double_18x18.png b/icon-themes/hicontrast/sc/res/sidebar/CellBorder_Bottom_Double_18x18.png Binary files differnew file mode 100755 index 000000000000..6093c976e5db --- /dev/null +++ b/icon-themes/hicontrast/sc/res/sidebar/CellBorder_Bottom_Double_18x18.png diff --git a/icon-themes/hicontrast/sc/res/sidebar/CellBorder_Bottom_Thick_18x18.png b/icon-themes/hicontrast/sc/res/sidebar/CellBorder_Bottom_Thick_18x18.png Binary files differnew file mode 100755 index 000000000000..a824ac0b3814 --- /dev/null +++ b/icon-themes/hicontrast/sc/res/sidebar/CellBorder_Bottom_Thick_18x18.png diff --git a/icon-themes/hicontrast/sc/res/sidebar/CellBorder_Empty_18x18.png b/icon-themes/hicontrast/sc/res/sidebar/CellBorder_Empty_18x18.png Binary files differnew file mode 100755 index 000000000000..f62769b4dae6 --- /dev/null +++ b/icon-themes/hicontrast/sc/res/sidebar/CellBorder_Empty_18x18.png diff --git a/icon-themes/hicontrast/sc/res/sidebar/CellBorder_FourBorders_18x18.png b/icon-themes/hicontrast/sc/res/sidebar/CellBorder_FourBorders_18x18.png Binary files differnew file mode 100755 index 000000000000..7b351935c0cc --- /dev/null +++ b/icon-themes/hicontrast/sc/res/sidebar/CellBorder_FourBorders_18x18.png diff --git a/icon-themes/hicontrast/sc/res/sidebar/CellBorder_FourBorders_Thick_18x18.png b/icon-themes/hicontrast/sc/res/sidebar/CellBorder_FourBorders_Thick_18x18.png Binary files differnew file mode 100755 index 000000000000..a62c20175522 --- /dev/null +++ b/icon-themes/hicontrast/sc/res/sidebar/CellBorder_FourBorders_Thick_18x18.png diff --git a/icon-themes/hicontrast/sc/res/sidebar/CellBorder_LeftAndRight_18x18.png b/icon-themes/hicontrast/sc/res/sidebar/CellBorder_LeftAndRight_18x18.png Binary files differnew file mode 100755 index 000000000000..62ffc82330f2 --- /dev/null +++ b/icon-themes/hicontrast/sc/res/sidebar/CellBorder_LeftAndRight_18x18.png diff --git a/icon-themes/hicontrast/sc/res/sidebar/CellBorder_LeftDiagonal_18x18.png b/icon-themes/hicontrast/sc/res/sidebar/CellBorder_LeftDiagonal_18x18.png Binary files differnew file mode 100755 index 000000000000..64081573bb4a --- /dev/null +++ b/icon-themes/hicontrast/sc/res/sidebar/CellBorder_LeftDiagonal_18x18.png diff --git a/icon-themes/hicontrast/sc/res/sidebar/CellBorder_Left_18x18.png b/icon-themes/hicontrast/sc/res/sidebar/CellBorder_Left_18x18.png Binary files differnew file mode 100755 index 000000000000..7349f5b3f759 --- /dev/null +++ b/icon-themes/hicontrast/sc/res/sidebar/CellBorder_Left_18x18.png diff --git a/icon-themes/hicontrast/sc/res/sidebar/CellBorder_RightDiagonal_18x18.png b/icon-themes/hicontrast/sc/res/sidebar/CellBorder_RightDiagonal_18x18.png Binary files differnew file mode 100755 index 000000000000..ccebd4b4c8d1 --- /dev/null +++ b/icon-themes/hicontrast/sc/res/sidebar/CellBorder_RightDiagonal_18x18.png diff --git a/icon-themes/hicontrast/sc/res/sidebar/CellBorder_Right_18x18.png b/icon-themes/hicontrast/sc/res/sidebar/CellBorder_Right_18x18.png Binary files differnew file mode 100755 index 000000000000..d84d917b3b64 --- /dev/null +++ b/icon-themes/hicontrast/sc/res/sidebar/CellBorder_Right_18x18.png diff --git a/icon-themes/hicontrast/sc/res/sidebar/CellBorder_TopAndBottom_18x18.png b/icon-themes/hicontrast/sc/res/sidebar/CellBorder_TopAndBottom_18x18.png Binary files differnew file mode 100755 index 000000000000..3bd0b73552ab --- /dev/null +++ b/icon-themes/hicontrast/sc/res/sidebar/CellBorder_TopAndBottom_18x18.png diff --git a/icon-themes/hicontrast/sc/res/sidebar/CellBorder_TopSingle_BottomDouble_18x18.png b/icon-themes/hicontrast/sc/res/sidebar/CellBorder_TopSingle_BottomDouble_18x18.png Binary files differnew file mode 100755 index 000000000000..bdc624188b0a --- /dev/null +++ b/icon-themes/hicontrast/sc/res/sidebar/CellBorder_TopSingle_BottomDouble_18x18.png diff --git a/icon-themes/hicontrast/sc/res/sidebar/CellBorder_TopThin_BottomThick_18x18.png b/icon-themes/hicontrast/sc/res/sidebar/CellBorder_TopThin_BottomThick_18x18.png Binary files differnew file mode 100755 index 000000000000..758af77617ba --- /dev/null +++ b/icon-themes/hicontrast/sc/res/sidebar/CellBorder_TopThin_BottomThick_18x18.png diff --git a/icon-themes/hicontrast/sc/res/sidebar/CellBorder_Top_18x18.png b/icon-themes/hicontrast/sc/res/sidebar/CellBorder_Top_18x18.png Binary files differnew file mode 100755 index 000000000000..dfa9c53c73d2 --- /dev/null +++ b/icon-themes/hicontrast/sc/res/sidebar/CellBorder_Top_18x18.png diff --git a/icon-themes/hicontrast/sc/res/sidebar/fill_color.png b/icon-themes/hicontrast/sc/res/sidebar/fill_color.png Binary files differnew file mode 100755 index 000000000000..47e7ea15bfaa --- /dev/null +++ b/icon-themes/hicontrast/sc/res/sidebar/fill_color.png diff --git a/icon-themes/hicontrast/sfx2/res/grip.png b/icon-themes/hicontrast/sfx2/res/grip.png Binary files differnew file mode 100644 index 000000000000..04e370d48bdf --- /dev/null +++ b/icon-themes/hicontrast/sfx2/res/grip.png diff --git a/icon-themes/hicontrast/sfx2/res/menu.png b/icon-themes/hicontrast/sfx2/res/menu.png Binary files differnew file mode 100644 index 000000000000..bebd1d622707 --- /dev/null +++ b/icon-themes/hicontrast/sfx2/res/menu.png diff --git a/icon-themes/hicontrast/sfx2/res/symphony/morebutton.png b/icon-themes/hicontrast/sfx2/res/symphony/morebutton.png Binary files differnew file mode 100644 index 000000000000..5cffa97ca41c --- /dev/null +++ b/icon-themes/hicontrast/sfx2/res/symphony/morebutton.png diff --git a/icon-themes/hicontrast/sfx2/res/symphony/sidebar-3d-large.png b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-3d-large.png Binary files differnew file mode 100644 index 000000000000..7bc11604f897 --- /dev/null +++ b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-3d-large.png diff --git a/icon-themes/hicontrast/sfx2/res/symphony/sidebar-3d-small.png b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-3d-small.png Binary files differnew file mode 100644 index 000000000000..a4cdda9ad5bc --- /dev/null +++ b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-3d-small.png diff --git a/icon-themes/hicontrast/sfx2/res/symphony/sidebar-animation-large.png b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-animation-large.png Binary files differnew file mode 100644 index 000000000000..0be7962635fd --- /dev/null +++ b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-animation-large.png diff --git a/icon-themes/hicontrast/sfx2/res/symphony/sidebar-animation-small.png b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-animation-small.png Binary files differnew file mode 100644 index 000000000000..c494dfa6e170 --- /dev/null +++ b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-animation-small.png diff --git a/icon-themes/hicontrast/sfx2/res/symphony/sidebar-colors-large.png b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-colors-large.png Binary files differnew file mode 100644 index 000000000000..39ecdc12d1bf --- /dev/null +++ b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-colors-large.png diff --git a/icon-themes/hicontrast/sfx2/res/symphony/sidebar-colors-small.png b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-colors-small.png Binary files differnew file mode 100644 index 000000000000..049514bec7df --- /dev/null +++ b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-colors-small.png diff --git a/icon-themes/hicontrast/sfx2/res/symphony/sidebar-eyedropper-large.png b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-eyedropper-large.png Binary files differnew file mode 100644 index 000000000000..be99b1fbc2a4 --- /dev/null +++ b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-eyedropper-large.png diff --git a/icon-themes/hicontrast/sfx2/res/symphony/sidebar-eyedropper-small.png b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-eyedropper-small.png Binary files differnew file mode 100644 index 000000000000..55e182a7cfd8 --- /dev/null +++ b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-eyedropper-small.png diff --git a/icon-themes/hicontrast/sfx2/res/symphony/sidebar-functions-large.png b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-functions-large.png Binary files differnew file mode 100644 index 000000000000..1991850ae7db --- /dev/null +++ b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-functions-large.png diff --git a/icon-themes/hicontrast/sfx2/res/symphony/sidebar-functions-small.png b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-functions-small.png Binary files differnew file mode 100644 index 000000000000..615bd0b8788d --- /dev/null +++ b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-functions-small.png diff --git a/icon-themes/hicontrast/sfx2/res/symphony/sidebar-gallery-large.png b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-gallery-large.png Binary files differnew file mode 100644 index 000000000000..9effe086a135 --- /dev/null +++ b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-gallery-large.png diff --git a/icon-themes/hicontrast/sfx2/res/symphony/sidebar-gallery-small.png b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-gallery-small.png Binary files differnew file mode 100644 index 000000000000..29b3c2545978 --- /dev/null +++ b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-gallery-small.png diff --git a/icon-themes/hicontrast/sfx2/res/symphony/sidebar-imganim-large.png b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-imganim-large.png Binary files differnew file mode 100644 index 000000000000..778e49979e55 --- /dev/null +++ b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-imganim-large.png diff --git a/icon-themes/hicontrast/sfx2/res/symphony/sidebar-imganim-small.png b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-imganim-small.png Binary files differnew file mode 100644 index 000000000000..50a065ac299b --- /dev/null +++ b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-imganim-small.png diff --git a/icon-themes/hicontrast/sfx2/res/symphony/sidebar-navigator-large.png b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-navigator-large.png Binary files differnew file mode 100644 index 000000000000..a078b0a54194 --- /dev/null +++ b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-navigator-large.png diff --git a/icon-themes/hicontrast/sfx2/res/symphony/sidebar-navigator-small.png b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-navigator-small.png Binary files differnew file mode 100644 index 000000000000..00bd1cabf200 --- /dev/null +++ b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-navigator-small.png diff --git a/icon-themes/hicontrast/sfx2/res/symphony/sidebar-property-large.png b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-property-large.png Binary files differnew file mode 100644 index 000000000000..fb0c1595ff68 --- /dev/null +++ b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-property-large.png diff --git a/icon-themes/hicontrast/sfx2/res/symphony/sidebar-property-small.png b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-property-small.png Binary files differnew file mode 100644 index 000000000000..4147aa14cc0b --- /dev/null +++ b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-property-small.png diff --git a/icon-themes/hicontrast/sfx2/res/symphony/sidebar-style-large.png b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-style-large.png Binary files differnew file mode 100644 index 000000000000..0d59a2df0cba --- /dev/null +++ b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-style-large.png diff --git a/icon-themes/hicontrast/sfx2/res/symphony/sidebar-style-small.png b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-style-small.png Binary files differnew file mode 100644 index 000000000000..d570ffa0f8de --- /dev/null +++ b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-style-small.png diff --git a/icon-themes/hicontrast/sfx2/res/symphony/sidebar-template-large.png b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-template-large.png Binary files differnew file mode 100644 index 000000000000..f4beddc5426d --- /dev/null +++ b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-template-large.png diff --git a/icon-themes/hicontrast/sfx2/res/symphony/sidebar-template-small.png b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-template-small.png Binary files differnew file mode 100644 index 000000000000..65bff0c226e8 --- /dev/null +++ b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-template-small.png diff --git a/icon-themes/hicontrast/sfx2/res/symphony/sidebar-transition-large.png b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-transition-large.png Binary files differnew file mode 100644 index 000000000000..f0c319878bb7 --- /dev/null +++ b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-transition-large.png diff --git a/icon-themes/hicontrast/sfx2/res/symphony/sidebar-transition-small.png b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-transition-small.png Binary files differnew file mode 100644 index 000000000000..6cdc89a5e614 --- /dev/null +++ b/icon-themes/hicontrast/sfx2/res/symphony/sidebar-transition-small.png diff --git a/icon-themes/hicontrast/svx/res/rotation.png b/icon-themes/hicontrast/svx/res/rotation.png Binary files differnew file mode 100644 index 000000000000..e8adbfc6e92c --- /dev/null +++ b/icon-themes/hicontrast/svx/res/rotation.png diff --git a/icon-themes/hicontrast/svx/res/symphony/Quadratic.png b/icon-themes/hicontrast/svx/res/symphony/Quadratic.png Binary files differnew file mode 100644 index 000000000000..12d644800e9a --- /dev/null +++ b/icon-themes/hicontrast/svx/res/symphony/Quadratic.png diff --git a/icon-themes/hicontrast/svx/res/symphony/Square.png b/icon-themes/hicontrast/svx/res/symphony/Square.png Binary files differnew file mode 100644 index 000000000000..8d0ccea3e0f4 --- /dev/null +++ b/icon-themes/hicontrast/svx/res/symphony/Square.png diff --git a/icon-themes/hicontrast/svx/res/symphony/__morebutton.bmp b/icon-themes/hicontrast/svx/res/symphony/__morebutton.bmp Binary files differnew file mode 100644 index 000000000000..c665b3e866a8 --- /dev/null +++ b/icon-themes/hicontrast/svx/res/symphony/__morebutton.bmp diff --git a/icon-themes/hicontrast/svx/res/symphony/axial.png b/icon-themes/hicontrast/svx/res/symphony/axial.png Binary files differnew file mode 100644 index 000000000000..5771323542d0 --- /dev/null +++ b/icon-themes/hicontrast/svx/res/symphony/axial.png diff --git a/icon-themes/hicontrast/svx/res/symphony/ellipsoid.png b/icon-themes/hicontrast/svx/res/symphony/ellipsoid.png Binary files differnew file mode 100644 index 000000000000..2a38b320398b --- /dev/null +++ b/icon-themes/hicontrast/svx/res/symphony/ellipsoid.png diff --git a/icon-themes/hicontrast/svx/res/symphony/fill_color.png b/icon-themes/hicontrast/svx/res/symphony/fill_color.png Binary files differnew file mode 100644 index 000000000000..7cbafa57eb99 --- /dev/null +++ b/icon-themes/hicontrast/svx/res/symphony/fill_color.png diff --git a/icon-themes/hicontrast/svx/res/symphony/line1.png b/icon-themes/hicontrast/svx/res/symphony/line1.png Binary files differnew file mode 100644 index 000000000000..8e5dd3a985a9 --- /dev/null +++ b/icon-themes/hicontrast/svx/res/symphony/line1.png diff --git a/icon-themes/hicontrast/svx/res/symphony/line10.png b/icon-themes/hicontrast/svx/res/symphony/line10.png Binary files differnew file mode 100644 index 000000000000..6c81727ca103 --- /dev/null +++ b/icon-themes/hicontrast/svx/res/symphony/line10.png diff --git a/icon-themes/hicontrast/svx/res/symphony/line2.png b/icon-themes/hicontrast/svx/res/symphony/line2.png Binary files differnew file mode 100644 index 000000000000..ad3c78bb36ed --- /dev/null +++ b/icon-themes/hicontrast/svx/res/symphony/line2.png diff --git a/icon-themes/hicontrast/svx/res/symphony/line3.png b/icon-themes/hicontrast/svx/res/symphony/line3.png Binary files differnew file mode 100644 index 000000000000..2d91489a07d7 --- /dev/null +++ b/icon-themes/hicontrast/svx/res/symphony/line3.png diff --git a/icon-themes/hicontrast/svx/res/symphony/line4.png b/icon-themes/hicontrast/svx/res/symphony/line4.png Binary files differnew file mode 100644 index 000000000000..f62c84d524cf --- /dev/null +++ b/icon-themes/hicontrast/svx/res/symphony/line4.png diff --git a/icon-themes/hicontrast/svx/res/symphony/line5.png b/icon-themes/hicontrast/svx/res/symphony/line5.png Binary files differnew file mode 100644 index 000000000000..74d7fad3a05c --- /dev/null +++ b/icon-themes/hicontrast/svx/res/symphony/line5.png diff --git a/icon-themes/hicontrast/svx/res/symphony/line6.png b/icon-themes/hicontrast/svx/res/symphony/line6.png Binary files differnew file mode 100644 index 000000000000..52d4a9a793df --- /dev/null +++ b/icon-themes/hicontrast/svx/res/symphony/line6.png diff --git a/icon-themes/hicontrast/svx/res/symphony/line7.png b/icon-themes/hicontrast/svx/res/symphony/line7.png Binary files differnew file mode 100644 index 000000000000..7592f0265cff --- /dev/null +++ b/icon-themes/hicontrast/svx/res/symphony/line7.png diff --git a/icon-themes/hicontrast/svx/res/symphony/line8.png b/icon-themes/hicontrast/svx/res/symphony/line8.png Binary files differnew file mode 100644 index 000000000000..57b3e4952fb0 --- /dev/null +++ b/icon-themes/hicontrast/svx/res/symphony/line8.png diff --git a/icon-themes/hicontrast/svx/res/symphony/line9.png b/icon-themes/hicontrast/svx/res/symphony/line9.png Binary files differnew file mode 100644 index 000000000000..700a2b02ef79 --- /dev/null +++ b/icon-themes/hicontrast/svx/res/symphony/line9.png diff --git a/icon-themes/hicontrast/svx/res/symphony/linear.png b/icon-themes/hicontrast/svx/res/symphony/linear.png Binary files differnew file mode 100644 index 000000000000..23b7a181717b --- /dev/null +++ b/icon-themes/hicontrast/svx/res/symphony/linear.png diff --git a/icon-themes/hicontrast/svx/res/symphony/radial.png b/icon-themes/hicontrast/svx/res/symphony/radial.png Binary files differnew file mode 100644 index 000000000000..1971f585b0de --- /dev/null +++ b/icon-themes/hicontrast/svx/res/symphony/radial.png diff --git a/icon-themes/hicontrast/svx/res/symphony/rotation.png b/icon-themes/hicontrast/svx/res/symphony/rotation.png Binary files differnew file mode 100644 index 000000000000..874fb82bdcb9 --- /dev/null +++ b/icon-themes/hicontrast/svx/res/symphony/rotation.png diff --git a/icon-themes/hicontrast/svx/res/symphony/style_line1.png b/icon-themes/hicontrast/svx/res/symphony/style_line1.png Binary files differnew file mode 100644 index 000000000000..eadd40e3427a --- /dev/null +++ b/icon-themes/hicontrast/svx/res/symphony/style_line1.png diff --git a/icon-themes/hicontrast/svx/res/symphony/style_line10.png b/icon-themes/hicontrast/svx/res/symphony/style_line10.png Binary files differnew file mode 100644 index 000000000000..d5925aafea8a --- /dev/null +++ b/icon-themes/hicontrast/svx/res/symphony/style_line10.png diff --git a/icon-themes/hicontrast/svx/res/symphony/style_line11.png b/icon-themes/hicontrast/svx/res/symphony/style_line11.png Binary files differnew file mode 100644 index 000000000000..1e6be193527f --- /dev/null +++ b/icon-themes/hicontrast/svx/res/symphony/style_line11.png diff --git a/icon-themes/hicontrast/svx/res/symphony/style_line2.png b/icon-themes/hicontrast/svx/res/symphony/style_line2.png Binary files differnew file mode 100644 index 000000000000..3658e182c94c --- /dev/null +++ b/icon-themes/hicontrast/svx/res/symphony/style_line2.png diff --git a/icon-themes/hicontrast/svx/res/symphony/style_line3.png b/icon-themes/hicontrast/svx/res/symphony/style_line3.png Binary files differnew file mode 100644 index 000000000000..1636e050426f --- /dev/null +++ b/icon-themes/hicontrast/svx/res/symphony/style_line3.png diff --git a/icon-themes/hicontrast/svx/res/symphony/style_line4.png b/icon-themes/hicontrast/svx/res/symphony/style_line4.png Binary files differnew file mode 100644 index 000000000000..35741407ac25 --- /dev/null +++ b/icon-themes/hicontrast/svx/res/symphony/style_line4.png diff --git a/icon-themes/hicontrast/svx/res/symphony/style_line5.png b/icon-themes/hicontrast/svx/res/symphony/style_line5.png Binary files differnew file mode 100644 index 000000000000..5d387d4b33fb --- /dev/null +++ b/icon-themes/hicontrast/svx/res/symphony/style_line5.png diff --git a/icon-themes/hicontrast/svx/res/symphony/style_line6.png b/icon-themes/hicontrast/svx/res/symphony/style_line6.png Binary files differnew file mode 100644 index 000000000000..4a34861b54a5 --- /dev/null +++ b/icon-themes/hicontrast/svx/res/symphony/style_line6.png diff --git a/icon-themes/hicontrast/svx/res/symphony/style_line7.png b/icon-themes/hicontrast/svx/res/symphony/style_line7.png Binary files differnew file mode 100644 index 000000000000..8718ef0332e7 --- /dev/null +++ b/icon-themes/hicontrast/svx/res/symphony/style_line7.png diff --git a/icon-themes/hicontrast/svx/res/symphony/style_line8.png b/icon-themes/hicontrast/svx/res/symphony/style_line8.png Binary files differnew file mode 100644 index 000000000000..db769a43ce78 --- /dev/null +++ b/icon-themes/hicontrast/svx/res/symphony/style_line8.png diff --git a/icon-themes/hicontrast/svx/res/symphony/style_line9.png b/icon-themes/hicontrast/svx/res/symphony/style_line9.png Binary files differnew file mode 100644 index 000000000000..91062daaf673 --- /dev/null +++ b/icon-themes/hicontrast/svx/res/symphony/style_line9.png diff --git a/icon-themes/hicontrast/svx/res/symphony/width1.png b/icon-themes/hicontrast/svx/res/symphony/width1.png Binary files differnew file mode 100644 index 000000000000..1f14d896ca26 --- /dev/null +++ b/icon-themes/hicontrast/svx/res/symphony/width1.png diff --git a/icon-themes/hicontrast/svx/res/symphony/width2.png b/icon-themes/hicontrast/svx/res/symphony/width2.png Binary files differnew file mode 100644 index 000000000000..9a30e3fe2173 --- /dev/null +++ b/icon-themes/hicontrast/svx/res/symphony/width2.png diff --git a/icon-themes/hicontrast/svx/res/symphony/width3.png b/icon-themes/hicontrast/svx/res/symphony/width3.png Binary files differnew file mode 100644 index 000000000000..80e2e22992be --- /dev/null +++ b/icon-themes/hicontrast/svx/res/symphony/width3.png diff --git a/icon-themes/hicontrast/svx/res/symphony/width4.png b/icon-themes/hicontrast/svx/res/symphony/width4.png Binary files differnew file mode 100644 index 000000000000..142768ea34ff --- /dev/null +++ b/icon-themes/hicontrast/svx/res/symphony/width4.png diff --git a/icon-themes/hicontrast/svx/res/symphony/width5.png b/icon-themes/hicontrast/svx/res/symphony/width5.png Binary files differnew file mode 100644 index 000000000000..93100fae2cf9 --- /dev/null +++ b/icon-themes/hicontrast/svx/res/symphony/width5.png diff --git a/icon-themes/hicontrast/svx/res/symphony/width6.png b/icon-themes/hicontrast/svx/res/symphony/width6.png Binary files differnew file mode 100644 index 000000000000..30a9e326931c --- /dev/null +++ b/icon-themes/hicontrast/svx/res/symphony/width6.png diff --git a/icon-themes/hicontrast/svx/res/symphony/width7.png b/icon-themes/hicontrast/svx/res/symphony/width7.png Binary files differnew file mode 100644 index 000000000000..6a51fda02d29 --- /dev/null +++ b/icon-themes/hicontrast/svx/res/symphony/width7.png diff --git a/icon-themes/hicontrast/svx/res/symphony/width8.png b/icon-themes/hicontrast/svx/res/symphony/width8.png Binary files differnew file mode 100644 index 000000000000..60219680af26 --- /dev/null +++ b/icon-themes/hicontrast/svx/res/symphony/width8.png diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index 378516911ede..9848b6af6cc1 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -25,6 +25,7 @@ #include <svl/brdcst.hxx> #include <editeng/editdata.hxx> +#include <editeng/numitem.hxx> #include <i18nlangtag/lang.h> #include <tools/color.hxx> #include <tools/contnr.hxx> @@ -332,7 +333,8 @@ public: or disables numbering for the selected paragraphs if the numbering of the first paragraph is on */ void ToggleBullets(); - + sal_Bool ToggleBullets(sal_Bool bBulletOnOff, sal_Bool bNormalBullet, sal_Bool bMasterView, SvxNumRule* pNumRule = NULL, sal_Bool bForceBulletOnOff = false); + sal_Bool ToggleAllParagraphsBullets(sal_Bool bBulletOnOffMode, sal_Bool bNormalBullet, sal_Bool bToggleOn, sal_Bool bMasterView, SvxNumRule* pNumRule = NULL); /** enables numbering for the selected paragraphs that are not enabled and ignore all selected paragraphs that already have numbering enabled. */ @@ -986,6 +988,8 @@ public: virtual sal_Bool IsParaIsNumberingRestart( sal_Int32 nPara ); virtual void SetParaIsNumberingRestart( sal_Int32 nPara, sal_Bool bParaIsNumberingRestart ); + + sal_Int32 GetBulletsNumberingStatus(); }; #endif diff --git a/include/sfx2/navigat.hxx b/include/sfx2/navigat.hxx index b1cada954d2b..7f0dc928818e 100644 --- a/include/sfx2/navigat.hxx +++ b/include/sfx2/navigat.hxx @@ -35,7 +35,7 @@ public: SFX_DECL_CHILDWINDOW(SfxNavigatorWrapper); }; -class SfxNavigator : public SfxDockingWindow +class SFX2_DLLPUBLIC SfxNavigator : public SfxDockingWindow { SfxChildWindow* pWrapper; diff --git a/include/sfx2/sfx.hrc b/include/sfx2/sfx.hrc index b018a73b212d..7d1fc0a4a286 100644 --- a/include/sfx2/sfx.hrc +++ b/include/sfx2/sfx.hrc @@ -98,6 +98,7 @@ #define RID_SFX_SFXLOCAL_START (RID_SFX_START + 3082) #define RID_SFX_VIEW_START (RID_SFX_START + 4096) +#define RID_SFX_SIDEBAR_START (RID_SFX_START + 4150) // RID_CNT_START2 (RID_SFX_START + 4500) // RID_SFX_CHAOSDOC_START (RID_SFX_START + 5120) // RID_SFX_TPLCOMPONENT_START (RID_SFX_START + 6800) diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc index cd25c9ea05b7..c838c32b6f82 100644 --- a/include/sfx2/sfxsids.hrc +++ b/include/sfx2/sfxsids.hrc @@ -596,6 +596,7 @@ #define SID_SEARCH_OPTIONS (SID_SVX_START + 281) #define SID_ZOOM (SID_SVX_START + 289) #define SID_SEARCH_ITEM (SID_SVX_START + 291) +#define SID_SIDEBAR (SID_SVX_START + 336) #define SID_HYPERLINK_GETLINK (SID_SVX_START + 361) #define SID_HYPERLINK_SETLINK (SID_SVX_START + 362) #define SID_INFOBARCONTAINER (SID_SVX_START + 365) diff --git a/include/sfx2/shell.hxx b/include/sfx2/shell.hxx index cba6efaf8e36..cb5b149714df 100644 --- a/include/sfx2/shell.hxx +++ b/include/sfx2/shell.hxx @@ -238,6 +238,8 @@ public: virtual SfxItemSet* CreateItemSet( sal_uInt16 nId ); virtual void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ); + void SetContextName (const ::rtl::OUString& rsContextName); + #ifndef _SFXSH_HXX SAL_DLLPRIVATE bool CanExecuteSlot_Impl( const SfxSlot &rSlot ); SAL_DLLPRIVATE void DoActivate_Impl( SfxViewFrame *pFrame, sal_Bool bMDI); diff --git a/include/sfx2/sidebar/ContextChangeBroadcaster.hxx b/include/sfx2/sidebar/ContextChangeBroadcaster.hxx new file mode 100644 index 000000000000..08696316430d --- /dev/null +++ b/include/sfx2/sidebar/ContextChangeBroadcaster.hxx @@ -0,0 +1,58 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SFX_SIDEBAR_CONTEXT_CHANGE_BROADCASTER_HXX +#define SFX_SIDEBAR_CONTEXT_CHANGE_BROADCASTER_HXX + +#include <com/sun/star/frame/XFrame.hpp> + +namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; + +namespace sfx2 { namespace sidebar { + + +/** This class is a helper for broadcasting context changes that are + tied to shells being activated or deactivated. +*/ +class ContextChangeBroadcaster +{ +public: + ContextChangeBroadcaster (void); + ~ContextChangeBroadcaster (void); + + void Initialize (const ::rtl::OUString& rsContextName); + + void Activate (const cssu::Reference<css::frame::XFrame>& rxFrame); + void Deactivate (const cssu::Reference<css::frame::XFrame>& rxFrame); + +private: + rtl::OUString msContextName; + bool mbIsContextActive; + + void BroadcastContextChange ( + const cssu::Reference<css::frame::XFrame>& rxFrame, + const ::rtl::OUString& rsModuleName, + const ::rtl::OUString& rsContextName); + ::rtl::OUString GetModuleName ( + const cssu::Reference<css::frame::XFrame>& rxFrame); +}; + + +} } // end of namespace ::sd::sidebar + +#endif diff --git a/include/sfx2/sidebar/ControlFactory.hxx b/include/sfx2/sidebar/ControlFactory.hxx new file mode 100644 index 000000000000..594c36c5fd91 --- /dev/null +++ b/include/sfx2/sidebar/ControlFactory.hxx @@ -0,0 +1,46 @@ +/* + * 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 SFX_SIDEBAR_CONTROL_FACTORY_HXX +#define SFX_SIDEBAR_CONTROL_FACTORY_HXX + +#include <sfx2/dllapi.h> +#include <vcl/button.hxx> + +class ToolBox; + +namespace sfx2 { namespace sidebar { + +class ToolBoxBackground; + + +class SFX2_DLLPUBLIC ControlFactory +{ +public: + static CheckBox* CreateMenuButton (Window* pParentWindow); + static ImageRadioButton* CreateTabItem (Window* pParentWindow); + static ToolBox* CreateToolBox (Window* pParentWindow, const ResId& rResId); + static Window* CreateToolBoxBackground (Window* pParentWindow); + static ImageRadioButton* CreateCustomImageRadionButton( + Window* pParentWindow, + const ResId& rResId ); +}; + + +} } // end of namespace sfx2::sidebar + +#endif diff --git a/include/sfx2/sidebar/ControllerItem.hxx b/include/sfx2/sidebar/ControllerItem.hxx new file mode 100644 index 000000000000..3e7cd83fb75a --- /dev/null +++ b/include/sfx2/sidebar/ControllerItem.hxx @@ -0,0 +1,55 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SVX_SIDEBAR_CONTROLLER_ITEM_HXX +#define SVX_SIDEBAR_CONTROLLER_ITEM_HXX + +#include <sfx2/ctrlitem.hxx> + +#include <boost/function.hpp> + + +namespace sfx2 { namespace sidebar { + +class SFX2_DLLPUBLIC ControllerItem + : public SfxControllerItem +{ +public: + class SFX2_DLLPUBLIC ItemUpdateReceiverInterface + { + public: + virtual void NotifyItemUpdate( + const sal_uInt16 nSId, + const SfxItemState eState, + const SfxPoolItem* pState) = 0; + virtual ~ItemUpdateReceiverInterface(); + }; + ControllerItem ( + const sal_uInt16 nId, + SfxBindings &rBindings, + ItemUpdateReceiverInterface& rItemUpdateReceiver); + virtual ~ControllerItem(); + + virtual void StateChanged (sal_uInt16 nSId, SfxItemState eState, const SfxPoolItem* pState); + +private: + ItemUpdateReceiverInterface& mrItemUpdateReceiver; +}; + +} } // end of namespace sfx2::sidebar + +#endif diff --git a/include/sfx2/sidebar/EnumContext.hxx b/include/sfx2/sidebar/EnumContext.hxx new file mode 100644 index 000000000000..54b07e016783 --- /dev/null +++ b/include/sfx2/sidebar/EnumContext.hxx @@ -0,0 +1,169 @@ +/* + * 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 SFX_SIDEBAR_ENUM_CONTEXT_HXX +#define SFX_SIDEBAR_ENUM_CONTEXT_HXX + +#include "sfx2/dllapi.h" + +#include <rtl/ustring.hxx> + +#include <vector> + + +namespace sfx2 { namespace sidebar { + +class SFX2_DLLPUBLIC EnumContext +{ +public: + enum Application + { + Application_Writer, + Application_WriterWeb, + Application_Calc, + Application_Draw, + Application_Impress, + + // For your convenience to avoid duplicate code in the common + // case that Draw and Impress use identical context configurations. + Application_DrawImpress, + + // Also for your convenience for either Writer or WriterWeb. + Application_WriterAndWeb, + + // Used only by deck or panel descriptors. Matches any + // application. + Application_Any, + + // Use this only in special circumstances. One might be the + // wish to disable a deck or panel during debugging. + Application_None, + + __LastApplicationEnum = Application_None + }; + enum Context + { + Context_3DObject, + Context_Annotation, + Context_Auditing, + Context_Cell, + Context_Chart, + Context_Draw, + Context_DrawPage, + Context_DrawText, + Context_EditCell, + Context_Form, + Context_Frame, + Context_Graphic, + Context_HandoutPage, + Context_MasterPage, + Context_Media, + Context_MultiObject, + Context_NotesPage, + Context_OLE, + Context_OutlineText, + Context_Pivot, + Context_SlidesorterPage, + Context_Table, + Context_Text, + Context_TextObject, + + // Default context of an application. Do we need this? + Context_Default, + + // Used only by deck or panel descriptors. Matches any context. + Context_Any, + + // Special context name that is only used when a deck would + // otherwise be empty. + Context_Empty, + + Context_Unknown, + + __LastContextEnum = Context_Unknown + }; + + EnumContext (void); + EnumContext ( + const Application eApplication, + const Context eContext); + EnumContext ( + const ::rtl::OUString& rsApplicationName, + const ::rtl::OUString& rsContextName); + + /** Return a number that encodes both the application and context + enums. + Use the CombinedEnumContext macro in switch() statements and comparisons. + */ + sal_Int32 GetCombinedContext(void) const; + + /** This variant of the GetCombinedContext() method treats some + application names as identical to each other. Replacements + made are: + Draw or Impress -> DrawImpress + Writer or WriterWeb -> WriterAndWeb + Use the Application_DrawImpress or Application_WriterAndWeb values in the CombinedEnumContext macro. + */ + sal_Int32 GetCombinedContext_DI(void) const; + + const ::rtl::OUString& GetApplicationName (void) const; + const ::rtl::OUString& GetContextName (void) const; + + bool operator == (const EnumContext aOther); + bool operator != (const EnumContext aOther); + + /** When two contexts are matched against each other then + application or context name may have the wildcard value 'any'. + In order to prefer matches without wildcards over matches with + wildcards we introduce a integer evaluation for matches. + */ + const static sal_Int32 NoMatch; + const static sal_Int32 OptimalMatch; + + /** Return the numeric value that describes how good the match + between two contexts is. + Smaller values represent better matches. + */ + sal_Int32 EvaluateMatch (const EnumContext& rOther) const; + + /** Return the best match against the given list of contexts. + */ + sal_Int32 EvaluateMatch (const ::std::vector<EnumContext>& rOthers) const; + + static Application GetApplicationEnum (const ::rtl::OUString& rsApplicationName); + static const ::rtl::OUString& GetApplicationName (const Application eApplication); + + static Context GetContextEnum (const ::rtl::OUString& rsContextName); + static const ::rtl::OUString& GetContextName (const Context eContext); + +private: + Application meApplication; + Context meContext; + + static void ProvideApplicationContainers (void); + static void ProvideContextContainers (void); + static void AddEntry (const ::rtl::OUString& rsName, const Application eApplication); + static void AddEntry (const ::rtl::OUString& rsName, const Context eContext); +}; + + +#define CombinedEnumContext(a,e) ((static_cast<sal_uInt16>(::sfx2::sidebar::EnumContext::a)<<16)\ + | static_cast<sal_uInt16>(::sfx2::sidebar::EnumContext::e)) + +} } // end of namespace sfx2::sidebar + +#endif diff --git a/include/sfx2/sidebar/IContextChangeReceiver.hxx b/include/sfx2/sidebar/IContextChangeReceiver.hxx new file mode 100644 index 000000000000..2b9d57cb1473 --- /dev/null +++ b/include/sfx2/sidebar/IContextChangeReceiver.hxx @@ -0,0 +1,37 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SFX_SIDEBAR_CONTEXT_CHANGE_RECEIVER_INTERFACE_HXX +#define SFX_SIDEBAR_CONTEXT_CHANGE_RECEIVER_INTERFACE_HXX + +#include "EnumContext.hxx" + + +namespace sfx2 { namespace sidebar { + + +class SFX2_DLLPUBLIC IContextChangeReceiver +{ +public: + virtual void HandleContextChange ( + const EnumContext aContext) = 0; + virtual ~IContextChangeReceiver(); +}; + +} } // end of namespace ::sd::sidebar + +#endif diff --git a/include/sfx2/sidebar/ILayoutableWindow.hxx b/include/sfx2/sidebar/ILayoutableWindow.hxx new file mode 100644 index 000000000000..8dc67457e966 --- /dev/null +++ b/include/sfx2/sidebar/ILayoutableWindow.hxx @@ -0,0 +1,44 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SFX_SIDEBAR_LAYOUTABLE_WINDOW_INTERFACE_HXX +#define SFX_SIDEBAR_LAYOUTABLE_WINDOW_INTERFACE_HXX + +#include <tools/gen.hxx> +#include <sal/types.h> +#include <sfx2/dllapi.h> +#include <com/sun/star/ui/LayoutSize.hpp> + +class Window; + +namespace sfx2 { namespace sidebar { + + +class SFX2_DLLPUBLIC ILayoutableWindow +{ +public: + /** Return the preferred height with the constraint, that the + window will be set to the given width. + */ + virtual ::com::sun::star::ui::LayoutSize GetHeightForWidth (const sal_Int32 nWidth) = 0; + virtual ~ILayoutableWindow(); +}; + + +} } // end of namespace ::sd::sidebar + +#endif diff --git a/include/sfx2/sidebar/PopupContainer.hxx b/include/sfx2/sidebar/PopupContainer.hxx new file mode 100644 index 000000000000..f2b8cfaa048c --- /dev/null +++ b/include/sfx2/sidebar/PopupContainer.hxx @@ -0,0 +1,37 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SFX_SIDEBAR_POPUP_CONTAINER_HXX +#define SFX_SIDEBAR_POPUP_CONTAINER_HXX + +#include "sfx2/dllapi.h" +#include <vcl/floatwin.hxx> + +namespace sfx2 { namespace sidebar { + +class SFX2_DLLPUBLIC PopupContainer : public FloatingWindow +{ +public: + PopupContainer (Window* pParent); + virtual ~PopupContainer (void); + + virtual long Notify (NotifyEvent& rNEvt); +}; + +} } // end of namespace sfx2::sidebar + +#endif diff --git a/include/sfx2/sidebar/ResourceDefinitions.hrc b/include/sfx2/sidebar/ResourceDefinitions.hrc new file mode 100644 index 000000000000..b45e398dedf1 --- /dev/null +++ b/include/sfx2/sidebar/ResourceDefinitions.hrc @@ -0,0 +1,141 @@ +/************************************************************** +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*************************************************************/ + +#ifndef _SFX_PROPERTYPANEL_HRC +#define _SFX_PROPERTYPANEL_HRC + +#include <sfx2/sfx.hrc> + +//section page RID +#define RC_PROPERTYPANEL_START RID_SFX_PROPERTYPANEL_START +#define DLG_PROPERTY_DOCKING_WINDOW ( RC_PROPERTYPANEL_START + 0 ) +#define BMP_PROPERTYPANEL_EXPAND ( RC_PROPERTYPANEL_START + 1 ) +#define BMP_PROPERTYPANEL_COLLAPSE ( RC_PROPERTYPANEL_START + 2 ) +#define BMP_PROPERTYPANEL_MOREPROPERTY ( RC_PROPERTYPANEL_START + 5 ) +#define FT_PROPERTYPANEL_NOTSUPPORT_DESC ( RC_PROPERTYPANEL_START + 7 ) + +#define RID_PROPERTYPANEL_TEXTPAGE_TITLEBAR ( RC_PROPERTYPANEL_START + 8 ) +#define RID_PROPERTYPANEL_PARAGRAPHPAGE_TITLEBAR ( RC_PROPERTYPANEL_START + 9 ) +#define RID_PROPERTYPANEL_AREAPAGE_TITLEBAR ( RC_PROPERTYPANEL_START + 10 ) +#define RID_PROPERTYPANEL_TBLDESIGNPAGE_TITLEBAR ( RC_PROPERTYPANEL_START + 11 ) +#define RID_PROPERTYPANEL_LINEPAGE_TITLEBAR ( RC_PROPERTYPANEL_START + 12 ) +#define RID_PROPERTYPANEL_POSIZEPAGE_TITLEBAR ( RC_PROPERTYPANEL_START + 13 ) +#define RID_PROPERTYPANEL_GRAPHICPAGE_TITLEBAR ( RC_PROPERTYPANEL_START + 14 ) +#define RID_PROPERTYPANEL_CELLAPPEARPAGE_TITLEBAR ( RC_PROPERTYPANEL_START + 15 ) +#define RID_PROPERTYPANEL_SWPAGE_PAGE_TITLEBAR (RC_PROPERTYPANEL_START + 16) +#define RID_PROPERTYPANEL_SWOBJWRAP_PAGE_TITLEBAR (RC_PROPERTYPANEL_START + 17) +#define RID_PROPERTYPANEL_SCCELL_PAGE_TITLEBAR (RC_PROPERTYPANEL_START + 18) +#define RID_PROPERTYPANEL_SCALIGNMENT_PAGE_TITLEBAR (RC_PROPERTYPANEL_START + 19) +#define RID_PROPERTYPANEL_SD_PAGELAYOUT_TITLEBAR (RC_PROPERTYPANEL_START+20) +#define RID_PROPERTYPANEL_SD_PAGEPROPERTY_TITLEBAR (RC_PROPERTYPANEL_START+21) +#define RID_PROPERTYPANEL_SD_TABLEDESIGN_TITLEBAR (RC_PROPERTYPANEL_START+22) +#define RID_PROPERTYPANEL_NUMFORMAT_PAGE_TITLEBAR (RC_PROPERTYPANEL_START+23) + +#define RID_PANELDOCK_WINDOW ( RC_PROPERTYPANEL_START + 24 ) +#define STR_TITLE_DISCRIPTION ( RC_PROPERTYPANEL_START + 25 ) // + +#ifndef STD_MASKCOLOR +#define STD_MASKCOLOR Color { Red = 0xFF00; Green = 0x0000; Blue = 0xFF00; } +#endif + +//unit pixel +//panel common +#define PROPERTYPAGE_WIDTH 109 + +//about titlebar + +#define FI_EXPANSION_INDICATOR 1 +#define FT_TITLE 2 +#define STR_MOREPROPERTY_QUICKHELP 3 + +#define TITLEBAR_WIDTH PROPERTYPAGE_WIDTH +#define TITLEBAR_HEIGHT 13 + +#define TITLEBAR_MARGIN_HORIZONTAL 3 +#define TITLEBAR_CONTROL_SPACING_HORIZONTAL 3 + +#define FI_EXPANSION_INDICATOR_WIDTH 6 +#define FI_EXPANSION_INDICATOR_HEIGTH 6 +#define FI_EXPANSION_INDICATOR_X TITLEBAR_MARGIN_HORIZONTAL +#define FI_EXPANSION_INDICATOR_Y (TITLEBAR_HEIGHT - FI_EXPANSION_INDICATOR_HEIGTH)/2 + +#define FT_TITLE_WIDTH 85 +#define FT_TITLE_HEIGHT 10 +#define FT_TITLE_X FI_EXPANSION_INDICATOR_X + FI_EXPANSION_INDICATOR_WIDTH + TITLEBAR_CONTROL_SPACING_HORIZONTAL +#define FT_TITLE_Y (TITLEBAR_HEIGHT - FT_TITLE_HEIGHT)/2 + 1 + + +//about section page +#define SECTIONPAGE_MARGIN_VERTICAL 12 +#define SECTIONPAGE_MARGIN_VERTICAL_TOP 1 +#define SECTIONPAGE_MARGIN_VERTICAL_BOT 5 +#define SECTIONPAGE_MARGIN_HORIZONTAL 3 +#define CONTROL_SPACING_VERTICAL 5 +#define CONTROL_SPACING_HORIZONTAL 3 +#define TEXT_CONTROL_SPACING_VERTICAL 2 + +#define TEXT_HEIGHT 8 +#define CBOX_HEIGHT 12 +#define MBOX_HEIGHT 12 + +#define TBX_OUT_BORDER_OFFSET_X 2 +#define TBX_OUT_BORDER_OFFSET_Y 1 + +//for 16*16 pixel bmp +#define TOOLBOX_ITEM_HEIGHT 15 +#define TOOLBOX_ITEM_WIDTH 13 +#define TOOLBOX_ITEM_DD_WIDTH 19 + +//for 24*16 pixel bmp +#define TOOLBOX_24_16_ITEM_HEIGHT 15 +#define TOOLBOX_24_16_ITEM_DD_WIDTH 23 + +//for 24*24 pixel bmp +#define TOOLBOX_24_24_ITEM_HEIGHT 18 +#define TOOLBOX_24_24_ITEM_DD_WIDTH 24 + +//about popup panel +#define POPUPPANEL_MARGIN_VERTICAL 7 +#define POPUPPANEL_MARGIN_HORIZONTAL 7 + +//for 42*42 pixel bmp +#define TOOLBOX_42_42_ITEM_HEIGHT 30 +#define TOOLBOX_42_42_ITEM_DD_WIDTH 27 +#define TB_BORDER 2 + +#define POPUPPANEL_SEP_VERTICAL_1 10 +#define POPUPPANEL_SEP_VERTICAL_2 6 +#define POPUPPANEL_SEP_HEIGHT 1 + +#define POPUP_BORDER_WIDTH 2 +#define POPUP_BORDER_HEIGHT 3 +#define OFFSET_X 1 +#define OFFSET_Y 1 + +#define POPUP_TOP_GRADIENT_HEIGHT 4 +#define POPUP_BOT_GRADIENT_HEIGHT 6 + +#define POPUP_COLOR_PICKER_WIDTH 97 +#define POPUP_COLOR_PICKER_HEIGHT 114 +//new +#define POPUPPANEL_MARGIN_SMALL 2 +#define POPUPPANEL_MARGIN_LARGE 5 +#endif diff --git a/include/sfx2/sidebar/SidebarChildWindow.hxx b/include/sfx2/sidebar/SidebarChildWindow.hxx new file mode 100644 index 000000000000..23f9194dba32 --- /dev/null +++ b/include/sfx2/sidebar/SidebarChildWindow.hxx @@ -0,0 +1,48 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SFX_SIDEBAR_CHILD_WINDOW_HXX +#define SFX_SIDEBAR_CHILD_WINDOW_HXX + +#include "sfx2/childwin.hxx" + + +namespace sfx2 { namespace sidebar { + +/** Outer container of the sidbar window. + + Has to be registered for every application via the + RegisterChildWindow() method from the RegisterControllers() method + of the applications DLL. +*/ +class SFX2_DLLPUBLIC SidebarChildWindow + : public SfxChildWindow +{ +public: + SidebarChildWindow( + Window* pParent, + sal_uInt16 nId, + SfxBindings* pBindings, + SfxChildWinInfo* pInfo); + + SFX_DECL_CHILDWINDOW_WITHID(SidebarChildWindow); +}; + + +} } // end of namespace sfx2::sidebar + +#endif diff --git a/include/sfx2/sidebar/SidebarPanelBase.hxx b/include/sfx2/sidebar/SidebarPanelBase.hxx new file mode 100644 index 000000000000..7117505ad710 --- /dev/null +++ b/include/sfx2/sidebar/SidebarPanelBase.hxx @@ -0,0 +1,124 @@ +/* + * 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 SFX_SIDEBAR_PANEL_BASE_HXX +#define SFX_SIDEBAR_PANEL_BASE_HXX + +#include "EnumContext.hxx" + +#include <cppuhelper/compbase4.hxx> +#include <cppuhelper/basemutex.hxx> + +#include <com/sun/star/frame/XController.hpp> +#include <com/sun/star/ui/XContextChangeEventListener.hpp> +#include <com/sun/star/ui/XUIElement.hpp> +#include <com/sun/star/ui/XToolPanel.hpp> +#include <com/sun/star/ui/XSidebarPanel.hpp> + +#include <boost/noncopyable.hpp> +#include <boost/function.hpp> + + +namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; + + +class Window; + +namespace sfx2 { namespace sidebar { + +namespace +{ + typedef ::cppu::WeakComponentImplHelper4 < + css::ui::XContextChangeEventListener, + css::ui::XUIElement, + css::ui::XToolPanel, + css::ui::XSidebarPanel + > SidebarPanelBaseInterfaceBase; +} + +/** Base class for sidebar panels that provides some convenience + functionality. +*/ +class SFX2_DLLPUBLIC SidebarPanelBase + : private ::boost::noncopyable, + private ::cppu::BaseMutex, + public SidebarPanelBaseInterfaceBase +{ +public: + static cssu::Reference<css::ui::XUIElement> Create ( + const ::rtl::OUString& rsResourceURL, + const cssu::Reference<css::frame::XFrame>& rxFrame, + Window* mpWindow, + const css::ui::LayoutSize& rLayoutSize); + + // XContextChangeEventListener + virtual void SAL_CALL notifyContextChangeEvent ( + const css::ui::ContextChangeEventObject& rEvent) + throw (cssu::RuntimeException); + + // XEventListener + virtual void SAL_CALL disposing ( + const css::lang::EventObject& rEvent) + throw (cssu::RuntimeException); + + // XUIElement + virtual cssu::Reference<css::frame::XFrame> SAL_CALL getFrame (void) + throw(cssu::RuntimeException); + virtual ::rtl::OUString SAL_CALL getResourceURL (void) + throw(cssu::RuntimeException); + virtual sal_Int16 SAL_CALL getType (void) + throw(cssu::RuntimeException); + virtual cssu::Reference<cssu::XInterface> SAL_CALL getRealInterface (void) + throw(cssu::RuntimeException); + + // XToolPanel + virtual cssu::Reference<css::accessibility::XAccessible> SAL_CALL createAccessible ( + const cssu::Reference<css::accessibility::XAccessible>& rxParentAccessible) + throw(cssu::RuntimeException); + virtual cssu::Reference<css::awt::XWindow> SAL_CALL getWindow (void) + throw(cssu::RuntimeException); + + // XSidebarPanel + virtual css::ui::LayoutSize SAL_CALL getHeightForWidth (sal_Int32 nWidth) + throw(cssu::RuntimeException); + +protected: + cssu::Reference<css::frame::XFrame> mxFrame; + + SidebarPanelBase ( + const ::rtl::OUString& rsResourceURL, + const cssu::Reference<css::frame::XFrame>& rxFrame, + Window* pWindow, + const css::ui::LayoutSize& rLayoutSize); + virtual ~SidebarPanelBase (void); + + virtual void SAL_CALL disposing (void) + throw (cssu::RuntimeException); + + void SetControl (::Window* pControl); + ::Window* GetControl (void) const; + +private: + Window* mpControl; + const ::rtl::OUString msResourceURL; + const css::ui::LayoutSize maLayoutSize; +}; + +} } // end of namespace sfx2::sidebar + +#endif diff --git a/include/sfx2/sidebar/Theme.hxx b/include/sfx2/sidebar/Theme.hxx new file mode 100644 index 000000000000..d34866b7b179 --- /dev/null +++ b/include/sfx2/sidebar/Theme.hxx @@ -0,0 +1,278 @@ +/* + * 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 SFX_SIDEBAR_THEME_HXX +#define SFX_SIDEBAR_THEME_HXX + +#include "sfx2/dllapi.h" + +#include <tools/color.hxx> +#include <vcl/image.hxx> +#include <cppuhelper/compbase2.hxx> +#include <cppuhelper/basemutex.hxx> +#include <tools/gen.hxx> +#include <rtl/ref.hxx> +#include <vcl/wall.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> + +#include <boost/unordered_map.hpp> +#include <map> +#include <boost/optional.hpp> + + +class SvBorder; + +namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; + + +namespace sfx2 { namespace sidebar { + + +namespace +{ + typedef ::cppu::WeakComponentImplHelper2 < + css::beans::XPropertySet, + css::beans::XPropertySetInfo + > ThemeInterfaceBase; +} + +class Paint; + +/** Simple collection of colors, gradients, fonts that define the + look of the sidebar and its controls. +*/ +class SFX2_DLLPUBLIC Theme + : private ::boost::noncopyable, + private ::cppu::BaseMutex, + public ThemeInterfaceBase +{ +public: + enum ThemeItem + { + __Begin, + __Pre_Image = __Begin, + + __AnyItem = __Pre_Image, + + Image_Grip, + Image_Expand, + Image_Collapse, + Image_TabBarMenu, + Image_PanelMenu, + Image_ToolBoxItemSeparator, + Image_Closer, + + __Image_Color, + + Color_DeckTitleFont, + Color_PanelTitleFont, + Color_TabMenuSeparator, + Color_TabItemBorder, + Color_DropDownBorder, + Color_Highlight, + Color_HighlightText, + + __Color_Paint, + + Paint_DeckBackground, + Paint_DeckTitleBarBackground, + Paint_PanelBackground, + Paint_PanelTitleBarBackground, + Paint_TabBarBackground, + Paint_TabItemBackgroundNormal, + Paint_TabItemBackgroundHighlight, + Paint_HorizontalBorder, + Paint_VerticalBorder, + Paint_ToolBoxBackground, + Paint_ToolBoxBorderTopLeft, + Paint_ToolBoxBorderCenterCorners, + Paint_ToolBoxBorderBottomRight, + Paint_DropDownBackground, + + __Paint_Int, + + Int_DeckTitleBarHeight, + Int_DeckBorderSize, + Int_DeckSeparatorHeight, + Int_PanelTitleBarHeight, + Int_TabMenuPadding, + Int_TabMenuSeparatorPadding, + Int_TabItemWidth, + Int_TabItemHeight, + Int_DeckLeftPadding, + Int_DeckTopPadding, + Int_DeckRightPadding, + Int_DeckBottomPadding, + Int_TabBarLeftPadding, + Int_TabBarTopPadding, + Int_TabBarRightPadding, + Int_TabBarBottomPadding, + Int_ButtonCornerRadius, + + __Int_Bool, + + Bool_UseSymphonyIcons, + Bool_UseSystemColors, + Bool_UseToolBoxItemSeparator, + Bool_IsHighContrastModeActive, + + __Bool_Rect, + + Rect_ToolBoxPadding, + Rect_ToolBoxBorder, + + __Post_Rect, + __End=__Post_Rect + }; + + static Image GetImage (const ThemeItem eItem); + static Color GetColor (const ThemeItem eItem); + static const Paint& GetPaint (const ThemeItem eItem); + static const Wallpaper GetWallpaper (const ThemeItem eItem); + static sal_Int32 GetInteger (const ThemeItem eItem); + static bool GetBoolean (const ThemeItem eItem); + static Rectangle GetRectangle (const ThemeItem eItem); + + static bool IsHighContrastMode (void); + + static void HandleDataChange (void); + + Theme (void); + virtual ~Theme (void); + + virtual void SAL_CALL disposing (void); + + static cssu::Reference<css::beans::XPropertySet> GetPropertySet (void); + + // beans::XPropertySet + virtual cssu::Reference<css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo (void) + throw(cssu::RuntimeException); + virtual void SAL_CALL setPropertyValue ( + const ::rtl::OUString& rsPropertyName, + const cssu::Any& rValue) + throw(cssu::RuntimeException); + virtual cssu::Any SAL_CALL getPropertyValue ( + const ::rtl::OUString& rsPropertyName) + throw(css::beans::UnknownPropertyException, + css::lang::WrappedTargetException, + cssu::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( + const ::rtl::OUString& rsPropertyName, + const cssu::Reference<css::beans::XPropertyChangeListener>& rxListener) + throw(css::beans::UnknownPropertyException, + css::lang::WrappedTargetException, + cssu::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( + const ::rtl::OUString& rsPropertyName, + const cssu::Reference<css::beans::XPropertyChangeListener>& rxListener) + throw(css::beans::UnknownPropertyException, + css::lang::WrappedTargetException, + cssu::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( + const ::rtl::OUString& rsPropertyName, + const cssu::Reference<css::beans::XVetoableChangeListener>& rxListener) + throw(css::beans::UnknownPropertyException, + css::lang::WrappedTargetException, + cssu::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( + const ::rtl::OUString& rsPropertyName, + const cssu::Reference<css::beans::XVetoableChangeListener>& rxListener) + throw(css::beans::UnknownPropertyException, + css::lang::WrappedTargetException, + cssu::RuntimeException); + + // beans::XPropertySetInfo + virtual cssu::Sequence<css::beans::Property> SAL_CALL getProperties (void) + throw(cssu::RuntimeException); + virtual css::beans::Property SAL_CALL getPropertyByName (const ::rtl::OUString& rsName) + throw(css::beans::UnknownPropertyException, + cssu::RuntimeException); + virtual sal_Bool SAL_CALL hasPropertyByName (const ::rtl::OUString& rsName) + throw(cssu::RuntimeException); + +private: + static ::rtl::Reference<Theme> mpInstance; + static Theme& GetCurrentTheme (void); + + ::std::vector<Image> maImages; + ::std::vector<Color> maColors; + ::std::vector<Paint> maPaints; + ::std::vector<sal_Int32> maIntegers; + ::std::vector<bool> maBooleans; + ::std::vector<Rectangle> maRectangles; + bool mbIsHighContrastMode; + bool mbIsHighContrastModeSetManually; + + typedef ::boost::unordered_map<rtl::OUString,ThemeItem, rtl::OUStringHash> PropertyNameToIdMap; + PropertyNameToIdMap maPropertyNameToIdMap; + typedef ::std::vector<rtl::OUString> PropertyIdToNameMap; + PropertyIdToNameMap maPropertyIdToNameMap; + typedef ::std::vector<cssu::Any> RawValueContainer; + RawValueContainer maRawValues; + + typedef ::std::vector<cssu::Reference<css::beans::XPropertyChangeListener> > ChangeListenerContainer; + typedef ::std::map<ThemeItem,ChangeListenerContainer> ChangeListeners; + ChangeListeners maChangeListeners; + typedef ::std::vector<cssu::Reference<css::beans::XVetoableChangeListener> > VetoableListenerContainer; + typedef ::std::map<ThemeItem,VetoableListenerContainer> VetoableListeners; + VetoableListeners maVetoableListeners; + + enum PropertyType + { + PT_Image, + PT_Color, + PT_Paint, + PT_Integer, + PT_Boolean, + PT_Rectangle, + PT_Invalid + }; + + void SetupPropertyMaps (void); + void InitializeTheme (void); + void UpdateTheme (void); + static PropertyType GetPropertyType (const ThemeItem eItem); + static cssu::Type GetCppuType (const PropertyType eType); + static sal_Int32 GetIndex ( + const ThemeItem eItem, + const PropertyType eType); + + VetoableListenerContainer* GetVetoableListeners ( + const ThemeItem eItem, + const bool bCreate); + ChangeListenerContainer* GetChangeListeners ( + const ThemeItem eItem, + const bool bCreate); + bool DoVetoableListenersVeto ( + const VetoableListenerContainer* pListeners, + const css::beans::PropertyChangeEvent& rEvent) const; + void BroadcastPropertyChange ( + const ChangeListenerContainer* pListeners, + const css::beans::PropertyChangeEvent& rEvent) const; + void ProcessNewValue ( + const cssu::Any& rValue, + const ThemeItem eItem, + const PropertyType eType); +}; + + + +} } // end of namespace sfx2::sidebar + +#endif diff --git a/include/sfx2/styfitem.hxx b/include/sfx2/styfitem.hxx index b728be448a49..b4c88340b935 100644 --- a/include/sfx2/styfitem.hxx +++ b/include/sfx2/styfitem.hxx @@ -68,9 +68,6 @@ class SFX2_DLLPUBLIC SfxStyleFamilies: public Resource SfxStyleFamilyList aEntryList; public: - /** ctor - <p>Will automatically call updateImages with BMP_COLOR_NORMAL.</p> - */ SfxStyleFamilies( const ResId &); SfxStyleFamilies( ) {}; ~SfxStyleFamilies(); diff --git a/include/sfx2/templdlg.hxx b/include/sfx2/templdlg.hxx index e9fb3a5e4c51..9c57455bc57d 100644 --- a/include/sfx2/templdlg.hxx +++ b/include/sfx2/templdlg.hxx @@ -21,7 +21,7 @@ #include "sal/config.h" #include "sfx2/dllapi.h" - +#include <vcl/ctrl.hxx> #include <rsc/rscsfx.hxx> #include <sfx2/dockwin.hxx> @@ -79,6 +79,30 @@ public: void SetParagraphFamily(); }; +// class SfxTemplatePanelControl ----------------------------------------- + +class SFX2_DLLPUBLIC SfxTemplatePanelControl : public DockingWindow +{ +public: + SfxTemplatePanelControl (SfxBindings* pBindings, Window* pParentWindow); + ~SfxTemplatePanelControl (void); + + virtual void Update(); + virtual void DataChanged( const DataChangedEvent& _rDCEvt ); + virtual void Resize(); + virtual SfxChildAlignment CheckAlignment( SfxChildAlignment, SfxChildAlignment ); + virtual void StateChanged( StateChangedType nStateChange ); + virtual void FreeResource (void); + + ISfxTemplateCommon* GetISfxTemplateCommon(); + void SetParagraphFamily(); + +private: + SfxTemplateDialog_Impl* pImpl; + SfxBindings* mpBindings; +}; + + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/dialcontrol.hxx b/include/svx/dialcontrol.hxx index fbb4d271679d..342a38452ee8 100644 --- a/include/svx/dialcontrol.hxx +++ b/include/svx/dialcontrol.hxx @@ -25,13 +25,43 @@ #include <sfx2/itemconnect.hxx> #include "svx/svxdllapi.h" +#include <boost/scoped_ptr.hpp> + class NumericField; namespace svx { // ============================================================================ -struct DialControl_Impl; +class DialControlBmp : public VirtualDevice +{ +public: + explicit DialControlBmp( Window& rParent ); + + void InitBitmap(const Font& rFont); + void SetSize(const Size& rSize); + void CopyBackground( const DialControlBmp& rSrc ); + void DrawBackground( const Size& rSize, bool bEnabled ); + virtual void DrawBackground(); + virtual void DrawElements( const String& rText, sal_Int32 nAngle ); + +protected: + Rectangle maRect; + bool mbEnabled; + +private: + const Color& GetBackgroundColor() const; + const Color& GetTextColor() const; + const Color& GetScaleLineColor() const; + const Color& GetButtonLineColor() const; + const Color& GetButtonFillColor( bool bMain ) const; + + void Init(); + + Window& mrParent; + long mnCenterX; + long mnCenterY; +}; /** This control allows to input a rotation angle, visualized by a dial. @@ -95,20 +125,44 @@ public: /** Compare value with the saved value */ bool IsValueModified(); -private: +protected: + struct DialControl_Impl + { + ::boost::scoped_ptr<DialControlBmp> mpBmpEnabled; + ::boost::scoped_ptr<DialControlBmp> mpBmpDisabled; + ::boost::scoped_ptr<DialControlBmp> mpBmpBuffered; + Link maModifyHdl; + NumericField* mpLinkField; + Size maWinSize; + Font maWinFont; + sal_Int32 mnAngle; + sal_Int32 mnInitialAngle; + sal_Int32 mnOldAngle; + long mnCenterX; + long mnCenterY; + bool mbNoRot; + + explicit DialControl_Impl( Window& rParent ); + void Init( const Size& rWinSize, const Font& rWinFont ); + void SetSize( const Size& rWinSize ); + }; + std::auto_ptr< DialControl_Impl > mpImpl; + + virtual void HandleMouseEvent( const Point& rPos, bool bInitial ); + virtual void HandleEscapeEvent(); + + void SetRotation( sal_Int32 nAngle, bool bBroadcast ); + void Init( const Size& rWinSize, const Font& rWinFont ); void Init( const Size& rWinSize ); + +private: void InvalidateControl(); - void ImplSetRotation( sal_Int32 nAngle, bool bBroadcast ); void ImplSetFieldLink( const Link& rLink ); - void HandleMouseEvent( const Point& rPos, bool bInitial ); - void HandleEscapeEvent(); DECL_LINK( LinkedFieldModifyHdl, NumericField* ); - - std::auto_ptr< DialControl_Impl > mpImpl; }; // ============================================================================ diff --git a/include/svx/dialogs.hrc b/include/svx/dialogs.hrc index 339cba761e34..08ff470dc2f6 100644 --- a/include/svx/dialogs.hrc +++ b/include/svx/dialogs.hrc @@ -25,8 +25,8 @@ // Resource-Id's ------------------------------------------------------------ -// Please maintain FIRSTFREE (does not apply to strings) -#define RID_SVX_FIRSTFREE 314 +// !!! IMPORTANT: consider and update FIRSTFREE when introducing new RIDs !!! (not for RIDs for Strings - they have there own) +#define RID_SVX_FIRSTFREE 332 // some strings also used in CUI #define RID_SVXERRCTX (RID_SVX_START + 351) @@ -248,7 +248,30 @@ #define RID_SVXDLG_TEXTCONTROL_PARAATTR (RID_SVX_START + 287) #define RID_SVXDLG_LINK_WARNING (RID_SVX_START + 313) -// !!! please update RID_SVX_FIRSTFREE !!! see line 46 +#define RID_SIDEBAR_TEXT_PANEL (RID_SVX_START + 314) +#define RID_POPUPPANEL_TEXTPAGE_UNDERLINE (RID_SVX_START + 315) +#define RID_POPUPPANEL_TEXTPAGE_FONT_COLOR (RID_SVX_START + 316) +#define RID_POPUPPANEL_TEXTPAGE_SPACING (RID_SVX_START + 317) + +#define RID_SIDEBAR_AREA_PANEL (RID_SVX_START + 318) +#define RID_POPUPPANEL_AERAPAGE_COLOR (RID_SVX_START + 319) +#define RID_POPUPPANEL_AREAPAGE_TRGR (RID_SVX_START + 320) + +#define RID_SIDEBAR_LINE_PANEL (RID_SVX_START + 321) +#define RID_POPUPPANEL_LINEPAGE_COLOR (RID_SVX_START + 322) +#define RID_POPUPPANEL_LINEPAGE_STYLE (RID_SVX_START + 323) +#define RID_POPUPPANEL_LINEPAGE_WIDTH (RID_SVX_START + 324) + +#define RID_SIDEBAR_POSSIZE_PANEL (RID_SVX_START + 325) +#define RID_SIDEBAR_GRAPHIC_PANEL (RID_SVX_START + 326) +#define RID_SIDEBAR_EMPTY_PANEL (RID_SVX_START + 327) + +#define RID_SIDEBAR_PARA_PANEL (RID_SVX_START + 328) +#define RID_POPUPPANEL_PARAPAGE_LINESPACING (RID_SVX_START + 329) +#define RID_POPUPPANEL_PARAPAGE_BULLETS (RID_SVX_START + 330) +#define RID_POPUPPANEL_PARAPAGE_NUMBERING (RID_SVX_START + 331) + +// !!! IMPORTANT: consider and update RID_SVX_FIRSTFREE when introducing new RIDs !!! (see above) // Strings ------------------------------------------------------------------ @@ -460,7 +483,7 @@ #define RID_SVXSTR_LINECAP_ROUND (RID_SVX_START + 587 ) #define RID_SVXSTR_LINECAP_SQUARE (RID_SVX_START + 588 ) -// string resources for XLineJoint item +// string resources for com::sun::star::drawing::LineJoint item #define RID_SVXSTR_LINEJOINT_NONE RID_SVXSTR_NONE #define RID_SVXSTR_LINEJOINT_MIDDLE (RID_SVX_START + 589 ) #define RID_SVXSTR_LINEJOINT_BEVEL (RID_SVX_START + 590 ) @@ -926,12 +949,72 @@ #define RID_SVXSTR_OUTLINENUM_DESCRIPTION_5 (RID_SVXSTR_OUTLINENUM_DESCRIPTIONS + 5)//? #define RID_SVXSTR_OUTLINENUM_DESCRIPTION_6 (RID_SVXSTR_OUTLINENUM_DESCRIPTIONS + 6)//? #define RID_SVXSTR_OUTLINENUM_DESCRIPTION_7 (RID_SVXSTR_OUTLINENUM_DESCRIPTIONS + 7)//? +#define RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS (RID_SVX_START + 1172) +#define RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS_0 (RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS + 0) +#define RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS_1 (RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS + 1) +#define RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS_2 (RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS + 2) +#define RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS_3 (RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS + 3) +#define RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS_4 (RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS + 4) + +#define RID_SVXSTR_TEXTCOLOR (RID_SVX_START + 1178) #define RID_SVXSTR_FINDBAR_FIND (RID_SVX_START + 1190) -#define RID_SVXSTR_NEXTFREE (RID_SVX_START + 1191) +#define RID_SVXSTR_NUMBULLET_NONE (RID_SVX_START + 1191) +#define RID_SVXSTR_NUMBULLET_CURRENT_LIST_DESCRIPTION (RID_SVX_START + 1192) +#define RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION (RID_SVX_START + 1193) +#define RID_SVXSTR_NUMBULLET_CUSTOM_NUMBERING_DESCRIPTION (RID_SVX_START + 1194) +#define RID_SVXSTR_NUMBULLET_CUSTOM_MULTILEVEL_DESCRIPTION (RID_SVX_START + 1195) +#define RID_SVXSTR_NUMBULLET_CUSTOMIZED_WATERMARK (RID_SVX_START + 1196) +#define RID_SVXSTR_BULLET_RTL_DESCRIPTION_4 (RID_SVX_START + 1197) +#define RID_SVXSTR_BULLET_RTL_DESCRIPTION_5 (RID_SVX_START + 1198) +#define RID_SVXSTR_OUTLINENUM_RTL_DESCRIPTION_7 (RID_SVX_START + 1199) + +#define RID_SVXSTR_GRAPHICS_DESCRIPTIONS (RID_SVX_START + 1200) +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_0 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 0) // 1200 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_1 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 1) // 1201 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_2 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 2) // 1202 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_3 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 3) // 1203 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_4 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 4) // 1204 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_5 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 5) // 1205 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_6 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 6) // 1206 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_7 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 7) // 1207 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_8 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 8) // 1208 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_9 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 9) // 1209 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_10 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 10) // 1210 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_11 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 11) // 1211 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_12 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 12) // 1212 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_13 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 13) // 1213 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_14 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 14) // 1214 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_15 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 15) // 1215 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_16 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 16) // 1216 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_17 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 17) // 1217 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_18 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 18) // 1218 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_19 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 19) // 1219 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_20 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 20) // 1220 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_21 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 21) // 1221 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_22 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 22) // 1222 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_23 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 23) // 1223 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_24 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 24) // 1224 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_25 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 25) // 1225 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_26 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 26) // 1226 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_27 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 27) // 1227 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_28 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 28) // 1228 +#define RID_SVXSTR_GRAPHICS_DESCRIPTION_29 (RID_SVXSTR_GRAPHICS_DESCRIPTIONS + 29) // 1229 + +// ooo-build specific resources + +#define SVX_OOO_BUILD_START (RID_SVX_START + 1230) +#define RID_SVXBMP_DOC_MODIFIED_YES (SVX_OOO_BUILD_START + 1) // 1231 +#define RID_SVXBMP_DOC_MODIFIED_NO (SVX_OOO_BUILD_START + 2) // 1232 +#define RID_SVXBMP_DOC_MODIFIED_FEEDBACK (SVX_OOO_BUILD_START + 3) // 1233 +#define RID_SVXSTR_DOC_MODIFIED_YES (SVX_OOO_BUILD_START + 4) // 1234 +#define RID_SVXSTR_DOC_MODIFIED_NO (SVX_OOO_BUILD_START + 5) // 1235 +#define RID_SVXSTR_DOC_LOAD (SVX_OOO_BUILD_START + 6) // 1236 + +// !!! IMPORTANT: consider and update RID_SVXSTR_NEXTFREE when introducing new RIDs for Strings !!! +#define RID_SVXSTR_NEXTFREE (RID_SVX_START + 1237) -#define RID_SVXSTR_TEXTCOLOR (RID_SVX_START + 1178) // ---------------------------------------------------------------------------- // if we have _a_lot_ time, we should group the resource ids by type, instead // of grouping them by semantics. The reason is that resource ids have to be @@ -1011,18 +1094,6 @@ #define SID_SC_TP_FORMULA (RID_OFA_START + 259) #define SID_SC_TP_COMPATIBILITY (RID_OFA_START + 260) -// ---------------------------------------------------------------------------- -// ooo-build specific resources - -#define SVX_OOO_BUILD_START (RID_SVX_START + 1200) - -#define RID_SVXBMP_DOC_MODIFIED_YES (SVX_OOO_BUILD_START + 1) -#define RID_SVXBMP_DOC_MODIFIED_NO (SVX_OOO_BUILD_START + 2) -#define RID_SVXBMP_DOC_MODIFIED_FEEDBACK (SVX_OOO_BUILD_START + 3) -#define RID_SVXSTR_DOC_MODIFIED_YES (SVX_OOO_BUILD_START + 4) -#define RID_SVXSTR_DOC_MODIFIED_NO (SVX_OOO_BUILD_START + 5) -#define RID_SVXSTR_DOC_LOAD (SVX_OOO_BUILD_START + 6) - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/dlgctrl.hxx b/include/svx/dlgctrl.hxx index 7297bd559bb5..d24c38f8f354 100644 --- a/include/svx/dlgctrl.hxx +++ b/include/svx/dlgctrl.hxx @@ -258,8 +258,9 @@ public: virtual void Fill(const XBitmapListRef &pList); virtual void UserDraw(const UserDrawEvent& rUDEvt); - void Append(XBitmapEntry* pEntry, BitmapEx* pBmpEx = NULL); - void Modify(XBitmapEntry* pEntry, sal_uInt16 nPos, BitmapEx* pBmpEx = NULL); + void Append(const Size& rSize, const XBitmapEntry& rEntry, BitmapEx* pBmpEx = 0); + void Modify(const Size& rSize, const XBitmapEntry& rEntry, sal_uInt16 nPos, BitmapEx* pBmpEx = 0); + void SelectEntryByList(const XBitmapList* pList, const String& rStr); private: VirtualDevice maVD; @@ -268,7 +269,7 @@ private: XBitmapListRef mpList; bool mbUserDraw; - SVX_DLLPRIVATE void SetVirtualDevice(); + SVX_DLLPRIVATE void SetVirtualDevice(const Size& rSize); }; /************************************************************************/ @@ -279,7 +280,7 @@ private: VirtualDevice maVD; BitmapEx maBitmapEx; - void SetVirtualDevice(); + void SetVirtualDevice(const Size& rSize); public: FillAttrLB( Window* pParent, WinBits aWB ); @@ -313,9 +314,8 @@ public: virtual void Fill( const XDashListRef &pList ); - void Append( XDashEntry* pEntry, Bitmap* pBmp = NULL ); - void Modify( XDashEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp = NULL ); - void FillStyles(); + void Append( XDashEntry* pEntry, const Bitmap* pBmp = NULL ); + void Modify( XDashEntry* pEntry, sal_uInt16 nPos, const Bitmap* pBmp = NULL ); }; /************************************************************************/ @@ -324,14 +324,15 @@ class SVX_DLLPUBLIC LineEndLB : public ListBox { public: - LineEndLB( Window* pParent, ResId Id ) : ListBox( pParent, Id ) {} - LineEndLB( Window* pParent, WinBits aWB ) : ListBox( pParent, aWB ) {} + LineEndLB( Window* pParent, ResId Id ); + LineEndLB( Window* pParent, WinBits aWB ); + virtual ~LineEndLB (void); virtual void Fill( const XLineEndListRef &pList, sal_Bool bStart = sal_True ); - void Append( XLineEndEntry* pEntry, Bitmap* pBmp = NULL, + void Append( XLineEndEntry* pEntry, const Bitmap* pBmp = NULL, sal_Bool bStart = sal_True ); - void Modify( XLineEndEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp = NULL, + void Modify( XLineEndEntry* pEntry, sal_uInt16 nPos, const Bitmap* pBmp = NULL, sal_Bool bStart = sal_True ); }; diff --git a/include/svx/dlgutil.hxx b/include/svx/dlgutil.hxx index 238a90dd121a..859d4c764c79 100644 --- a/include/svx/dlgutil.hxx +++ b/include/svx/dlgutil.hxx @@ -30,6 +30,7 @@ class SfxItemSet; SVX_DLLPUBLIC FieldUnit GetModuleFieldUnit( const SfxItemSet& ); +SVX_DLLPUBLIC FieldUnit GetModuleFieldUnit(); SVX_DLLPUBLIC bool GetApplyCharUnit( const SfxItemSet& ); static const int OUTPUT_DRAWMODE_COLOR = (DRAWMODE_DEFAULT); diff --git a/include/svx/galbrws.hxx b/include/svx/galbrws.hxx index 0269643c658b..3eebaf685f75 100644 --- a/include/svx/galbrws.hxx +++ b/include/svx/galbrws.hxx @@ -43,7 +43,7 @@ class GalleryBrowser2; class GallerySplitter; class Gallery; -class GalleryBrowser : public SfxDockingWindow +class SVX_DLLPUBLIC GalleryBrowser : public SfxDockingWindow { friend class GalleryBrowser1; friend class GalleryBrowser2; @@ -51,16 +51,16 @@ class GalleryBrowser : public SfxDockingWindow using Window::KeyInput; private: - Size maLastSize; GallerySplitter* mpSplitter; GalleryBrowser1* mpBrowser1; GalleryBrowser2* mpBrowser2; Gallery* mpGallery; + /// bitfield void InitSettings(); - virtual sal_Bool Close(); + virtual sal_Bool Close(); virtual void Resize(); virtual void GetFocus(); diff --git a/include/svx/svdedtv.hxx b/include/svx/svdedtv.hxx index 39e75ad18738..78340c74569c 100644 --- a/include/svx/svdedtv.hxx +++ b/include/svx/svdedtv.hxx @@ -235,6 +235,7 @@ public: void SetMarkedObjRect(const Rectangle& rRect, sal_Bool bCopy=sal_False); void MoveMarkedObj(const Size& rSiz, bool bCopy=false); void ResizeMarkedObj(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bCopy=false); + void ResizeMultMarkedObj(const Point& rRef, const Fraction& xFact, const Fraction& yFact, const bool bCopy, const bool bWdh, const bool bHgt); long GetMarkedObjRotate() const; void RotateMarkedObj(const Point& rRef, long nWink, bool bCopy=false); void MirrorMarkedObj(const Point& rRef1, const Point& rRef2, bool bCopy=false); diff --git a/include/svx/svdedxv.hxx b/include/svx/svdedxv.hxx index 13cf6f05b5ef..f1ec6296b3f2 100644 --- a/include/svx/svdedxv.hxx +++ b/include/svx/svdedxv.hxx @@ -242,6 +242,9 @@ public: virtual void AddWindowToPaintView(OutputDevice* pNewWin); virtual void DeleteWindowFromPaintView(OutputDevice* pOldWin); + sal_uInt16 GetSelectionLevel() const; + + //************************************************************************ // Object-MacroModus (z.B. Rect als Button oder sowas): //************************************************************************ diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx index 5d4f76d0b804..d3047b897e2f 100644 --- a/include/svx/svdobj.hxx +++ b/include/svx/svdobj.hxx @@ -37,6 +37,7 @@ #include <svx/sdrobjectuser.hxx> #include "svx/svxdllapi.h" #include "svx/shapeproperty.hxx" +#include <svl/poolitem.hxx> #include <boost/optional.hpp> #include <boost/ptr_container/ptr_vector.hpp> @@ -800,6 +801,9 @@ protected: void SetObjectItemSet(const SfxItemSet& rSet); const SfxPoolItem& GetObjectItem(const sal_uInt16 nWhich) const; + // get SfxMapUnit the object is using + SfxMapUnit GetObjectMapUnit() const; + public: // syntactical sugar for ItemSet accesses void SetMergedItemSetAndBroadcast(const SfxItemSet& rSet, bool bClearAllItems = false); diff --git a/include/svx/svdogrp.hxx b/include/svx/svdogrp.hxx index 57842579b54e..d12f3809ae86 100644 --- a/include/svx/svdogrp.hxx +++ b/include/svx/svdogrp.hxx @@ -43,9 +43,6 @@ protected: virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); SdrObjList* pSub; // Subliste (Kinder) - long nDrehWink; - long nShearWink; - Point aRefPoint; // Referenzpunkt innerhalb der Objektgruppe bool bRefPoint; // Ist ein RefPoint gesetzt? diff --git a/include/svx/svdstr.hrc b/include/svx/svdstr.hrc index a78d88dfdb2d..d7b19fe56c04 100644 --- a/include/svx/svdstr.hrc +++ b/include/svx/svdstr.hrc @@ -714,5 +714,6 @@ #define STR_TABLE_STYLE (SIP_Begin + 274) #define STR_TABLE_STYLE_SETTINGS (SIP_Begin + 275) #define SIP_SA_CROP_MARKERS (SIP_Begin + 276) +#define IMG_DIALCONTROL (SIP_Begin + 277) /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc index 9971dcc2eb2d..0820a3e1c9c5 100644 --- a/include/svx/svxids.hrc +++ b/include/svx/svxids.hrc @@ -239,6 +239,8 @@ #define FN_NUM_BULLET_OFF (FN_EDIT + 37) /* Numerierung aus */ #define FN_NUM_BULLET_ON (FN_EDIT + 38) /* Numerierung mit Bullets an */ #define FN_NUM_NUMBERING_ON (FN_EDIT + 44) /* Numerierung an */ +#define FN_BUL_NUM_RULE_INDEX (FN_EDIT + 120) /* Achieving num rule index */ +#define FN_NUM_NUM_RULE_INDEX (FN_EDIT + 121) #define FN_INSERT (SID_SW_START + 300) #define FN_DELETE_BOOKMARK (FN_INSERT + 1) @@ -476,6 +478,9 @@ #define SID_TWAIN_TRANSFER ( SID_SVX_START + 332 ) #define SID_CONTOUR_DLG ( SID_SVX_START + 334 ) #define SID_CONTOUR_EXEC ( SID_SVX_START + 335 ) + +//#define SID_SIDEBAR ( SID_SVX_START + 336 ) -> sfxsids.hrc + #define SID_BORDER_OBJECT ( SID_SVX_START + 340 ) #define SID_SB_CONNECTIONPOOLING ( SID_SVX_START + 348 ) #define SID_SB_DBREGISTEROPTIONS ( SID_SVX_START + 349 ) @@ -922,18 +927,37 @@ #define SID_INSERT_FORM_HSCROLL (SID_SVX_START+1112) #define SID_EXTERNAL_EDIT (SID_SVX_START+1113) #define SID_ATTR_PAGE_SHARED_FIRST (SID_SVX_START+1114) +#define SID_CHANGE_PICTURE (SID_SVX_START+1115) #define SID_SAVE_GRAPHIC (SID_SVX_START+1116) #define SID_COMPRESS_GRAPHIC (SID_SVX_START+1117) #define SID_FRAME_UP (SID_SVX_START+1118) #define SID_FRAME_DOWN (SID_SVX_START+1119) #define SID_ATTR_SPECIALCHAR (SID_SVX_START+1120) -#define SID_CHANGE_PICTURE (SID_SVX_START+1125) -#define SID_ROTATE_GRAPHIC_LEFT (SID_SVX_START+1126) -#define SID_ROTATE_GRAPHIC_RIGHT (SID_SVX_START+1127) -#define SID_MENU_MANAGE_GRAPHIC (SID_SVX_START+1128) +#define SID_ROTATE_GRAPHIC_LEFT (SID_SVX_START+1121) +#define SID_ROTATE_GRAPHIC_RIGHT (SID_SVX_START+1122) +#define SID_MENU_MANAGE_GRAPHIC (SID_SVX_START+1123) + +// new slots for panels +#define SID_ATTR_FILL_TRANSPARENCE (SID_SVX_START+1124) +#define SID_ATTR_FILL_FLOATTRANSPARENCE (SID_SVX_START+1125) +#define SID_ATTR_LINE_TRANSPARENCE (SID_SVX_START+1126) +#define SID_FLIP_HORIZONTAL (SID_SVX_START+1127) +#define SID_FLIP_VERTICAL (SID_SVX_START+1128) +#define SID_ATTR_LINE_JOINT (SID_SVX_START+1129) +#define SID_ATTR_LINE_CAP (SID_SVX_START+1130) +#define SID_ATTR_TRANSFORM_MATRIX (SID_SVX_START+1131) + +#define SID_CELL_FORMAT_BORDER (SID_SVX_START+1132) +#define SID_CHAR_DLG_EFFECT (SID_SVX_START+1133) +#define SID_ATTR_PARA_LEFT (SID_SVX_START+1134) +#define SID_ATTR_PARA_RIGHT (SID_SVX_START+1135) + +#define FN_SVX_SET_NUMBER (SID_SVX_START+1136) +#define FN_SVX_SET_BULLET (SID_SVX_START+1137) + // IMPORTANT NOTE: adjust SID_SVX_FIRSTFREE, when adding new slot id -#define SID_SVX_FIRSTFREE (SID_MENU_MANAGE_GRAPHIC + 1) +#define SID_SVX_FIRSTFREE (FN_SVX_SET_BULLET + 1) // -------------------------------------------------------------------------- // Overflow check for slot IDs diff --git a/include/svx/xenum.hxx b/include/svx/xenum.hxx index df0b629d5980..38f414c03fc8 100644 --- a/include/svx/xenum.hxx +++ b/include/svx/xenum.hxx @@ -21,14 +21,6 @@ #define _XENUM_HXX enum XLineStyle { XLINE_NONE, XLINE_SOLID, XLINE_DASH }; -enum XLineJoint -{ - XLINEJOINT_NONE, // no rounding - XLINEJOINT_MIDDLE, // calc middle value between joints - XLINEJOINT_BEVEL, // join edges with line - XLINEJOINT_MITER, // extend till cut - XLINEJOINT_ROUND // create arc -}; enum XDashStyle { XDASH_RECT, XDASH_ROUND, XDASH_RECTRELATIVE, XDASH_ROUNDRELATIVE }; enum XFillStyle { XFILL_NONE, XFILL_SOLID, XFILL_GRADIENT, XFILL_HATCH, diff --git a/include/svx/xlinjoit.hxx b/include/svx/xlinjoit.hxx index 321656d9ed72..40030551e3c9 100644 --- a/include/svx/xlinjoit.hxx +++ b/include/svx/xlinjoit.hxx @@ -23,16 +23,17 @@ #include <svl/eitem.hxx> #include <svx/xenum.hxx> #include "svx/svxdllapi.h" +#include <com/sun/star/drawing/LineJoint.hpp> //--------------------- -// class LineStyleItem +// class XLineJointItem //--------------------- class SVX_DLLPUBLIC XLineJointItem : public SfxEnumItem { public: TYPEINFO(); - XLineJointItem( XLineJoint eLineJoint = XLINEJOINT_ROUND ); + XLineJointItem( com::sun::star::drawing::LineJoint eLineJoint = com::sun::star::drawing::LineJoint_ROUND ); XLineJointItem( SvStream& rIn ); virtual sal_uInt16 GetVersion( sal_uInt16 nFileFormatVersion ) const; @@ -45,8 +46,8 @@ public: SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, OUString &rText, const IntlWrapper * = 0 ) const; - virtual sal_uInt16 GetValueCount() const; - XLineJoint GetValue() const { return (XLineJoint) SfxEnumItem::GetValue(); } + virtual sal_uInt16 GetValueCount() const; + com::sun::star::drawing::LineJoint GetValue() const { return (com::sun::star::drawing::LineJoint) SfxEnumItem::GetValue(); } }; #endif // _SVX_XLINJOIT_HXX diff --git a/include/svx/xlncapit.hxx b/include/svx/xlncapit.hxx index 620a7adfc4b3..16b011b53104 100644 --- a/include/svx/xlncapit.hxx +++ b/include/svx/xlncapit.hxx @@ -26,7 +26,7 @@ #include <com/sun/star/drawing/LineCap.hpp> //--------------------- -// class LineStyleItem +// class XLineCapItem //--------------------- class SVX_DLLPUBLIC XLineCapItem : public SfxEnumItem diff --git a/include/svx/xtable.hxx b/include/svx/xtable.hxx index 93ad230ea75f..32c4619dd2c2 100644 --- a/include/svx/xtable.hxx +++ b/include/svx/xtable.hxx @@ -33,21 +33,18 @@ #include <cppuhelper/weak.hxx> -#include "svx/svxdllapi.h" +#include <svx/svxdllapi.h> #include <com/sun/star/embed/XStorage.hpp> #include <basegfx/polygon/b2dpolypolygon.hxx> #include <com/sun/star/container/XNameContainer.hpp> #include <svtools/grfmgr.hxx> +#include <svx/XPropertyEntry.hxx> class Color; class Bitmap; class VirtualDevice; class XOutdevItemPool; -// Breite und Hoehe der LB-Bitmaps -#define BITMAP_WIDTH 32 -#define BITMAP_HEIGHT 12 - // Standard-Vergleichsstring extern sal_Unicode pszStandard[]; // "standard" @@ -55,24 +52,6 @@ extern sal_Unicode pszStandard[]; // "standard" // enum COL_NAME nicht verglichen werden kann. SVX_DLLPUBLIC Color RGB_Color( ColorData nColorName ); -// --------------------- -// class XPropertyEntry -// --------------------- - -class XPropertyEntry -{ -protected: - String aName; - - XPropertyEntry(const String& rName) : aName(rName) {} - XPropertyEntry(const XPropertyEntry& rOther): aName(rOther.aName) {} -public: - - virtual ~XPropertyEntry() {} - void SetName(const String& rName) { aName = rName; } - String& GetName() { return aName; } -}; - // ------------------ // class XColorEntry // ------------------ @@ -230,26 +209,25 @@ protected: typedef ::std::vector< XPropertyEntry* > XPropertyEntryList_impl; typedef ::std::vector< Bitmap* > BitmapList_impl; - XPropertyListType eType; - String aName; // not persistent - String aPath; - XOutdevItemPool* pXPool; + XPropertyListType meType; + String maName; // not persistent + String maPath; + XOutdevItemPool* mpXPool; - XPropertyEntryList_impl aList; - BitmapList_impl* pBmpList; + XPropertyEntryList_impl maList; - bool bListDirty; - bool bBitmapsDirty; - bool bOwnPool; - bool bEmbedInDocument; + bool mbListDirty; + bool mbEmbedInDocument; XPropertyList( XPropertyListType t, const String& rPath, XOutdevItemPool* pXPool = NULL ); + virtual Bitmap CreateBitmapForUI( long nIndex ) = 0; + public: virtual ~XPropertyList(); - XPropertyListType Type() const { return eType; } + XPropertyListType Type() const { return meType; } long Count() const; void Insert( XPropertyEntry* pEntry, long nIndex = CONTAINER_APPEND ); @@ -259,22 +237,21 @@ public: // Note: Get(long) & Get( String& ) are ambiguous XPropertyEntry* Get( long nIndex, sal_uInt16 nDummy ) const; long Get(const String& rName); + Bitmap GetUiBitmap( long nIndex ) const; - Bitmap* GetBitmap( long nIndex ) const; - - const String& GetName() const { return aName; } + const String& GetName() const { return maName; } void SetName( const String& rString ); - const String& GetPath() const { return aPath; } - void SetPath( const String& rString ) { aPath = rString; } - sal_Bool IsDirty() const { return bListDirty && bBitmapsDirty; } - void SetDirty( sal_Bool bDirty = sal_True ) - { bListDirty = bDirty; bBitmapsDirty = bDirty; } - bool IsEmbedInDocument() const { return bEmbedInDocument; } - void SetEmbedInDocument(bool b) { bEmbedInDocument = b; } + const String& GetPath() const { return maPath; } + void SetPath( const String& rString ) { maPath = rString; } + bool IsDirty() const { return mbListDirty; } + void SetDirty( bool bDirty = sal_True ) + { mbListDirty = bDirty; } + bool IsEmbedInDocument() const { return mbEmbedInDocument; } + void SetEmbedInDocument(bool b) { mbEmbedInDocument = b; } static OUString GetDefaultExt(XPropertyListType t); static OUString GetDefaultExtFilter(XPropertyListType t); - OUString GetDefaultExt() const { return GetDefaultExt( eType ); } + OUString GetDefaultExt() const { return GetDefaultExt( meType ); } virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > createInstance() = 0; @@ -288,8 +265,6 @@ public: const OUString &rURL, OUString *pOptName ); virtual sal_Bool Create() = 0; - virtual sal_Bool CreateBitmapsForUI() = 0; - virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True ) = 0; // Factory method for sub-classes static XPropertyListRef CreatePropertyList( XPropertyListType t, @@ -307,6 +282,10 @@ public: inline XBitmapListRef AsBitmapList(); inline XLineEndListRef AsLineEndList(); inline XGradientListRef AsGradientList(); + + sal_uInt32 getUiBitmapWidth() const; + sal_uInt32 getUiBitmapHeight() const; + sal_uInt32 getUiBitmapLineWidth() const; }; // ------------------ @@ -315,6 +294,9 @@ public: class SVX_DLLPUBLIC XColorList : public XPropertyList { +protected: + virtual Bitmap CreateBitmapForUI( long nIndex ); + public: explicit XColorList( const String& rPath, XOutdevItemPool* pXInPool = NULL ) : @@ -329,8 +311,6 @@ public: XColorEntry* GetColor(long nIndex) const; virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > createInstance(); virtual sal_Bool Create(); - virtual sal_Bool CreateBitmapsForUI(); - virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True ); static XColorListRef CreateStdColorList(); static XColorListRef GetStdColorList(); // returns a singleton @@ -349,6 +329,9 @@ private: void impCreate(); void impDestroy(); +protected: + virtual Bitmap CreateBitmapForUI(long nIndex); + public: explicit XLineEndList( const String& rPath, @@ -363,8 +346,6 @@ public: virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > createInstance(); virtual sal_Bool Create(); - virtual sal_Bool CreateBitmapsForUI(); - virtual Bitmap* CreateBitmapForUI(long nIndex, sal_Bool bDelete = sal_True); }; // ------------------- @@ -376,10 +357,17 @@ class SVX_DLLPUBLIC XDashList : public XPropertyList { private: impXDashList* mpData; + Bitmap maBitmapSolidLine; + String maStringSolidLine; + String maStringNoLine; void impCreate(); void impDestroy(); +protected: + Bitmap ImpCreateBitmapForXDash(const XDash* pDash); + virtual Bitmap CreateBitmapForUI(long nIndex); + public: explicit XDashList( const String& rPath, @@ -396,8 +384,16 @@ public: virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > createInstance(); virtual sal_Bool Create(); - virtual sal_Bool CreateBitmapsForUI(); - virtual Bitmap* CreateBitmapForUI(long nIndex, sal_Bool bDelete = sal_True); + + // Special call to get a bitmap for the solid line representation. It + // creates a bitmap fitting in size and style to the ones you get by + // using GetUiBitmap for existing entries. + Bitmap GetBitmapForUISolidLine() const; + + // Special calls to get the translated strings for the UI entry for no + // line style (XLINE_NONE) and solid line style (XLINE_SOLID) for dialogs + String GetStringForUiSolidLine() const; + String GetStringForUiNoLine() const; }; // ------------------- @@ -413,6 +409,9 @@ private: void impCreate(); void impDestroy(); +protected: + virtual Bitmap CreateBitmapForUI(long nIndex); + public: explicit XHatchList( const String& rPath, XOutdevItemPool* pXPool = 0 ); @@ -427,8 +426,6 @@ public: virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > createInstance(); virtual sal_Bool Create(); - virtual sal_Bool CreateBitmapsForUI(); - virtual Bitmap* CreateBitmapForUI(long nIndex, sal_Bool bDelete = sal_True); }; // ------------------- @@ -444,6 +441,9 @@ private: void impCreate(); void impDestroy(); +protected: + virtual Bitmap CreateBitmapForUI(long nIndex); + public: explicit XGradientList( const String& rPath, @@ -460,8 +460,6 @@ public: virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > createInstance(); virtual sal_Bool Create(); - virtual sal_Bool CreateBitmapsForUI(); - virtual Bitmap* CreateBitmapForUI(long nIndex, sal_Bool bDelete = sal_True); }; // ------------------- @@ -470,6 +468,9 @@ public: class SVX_DLLPUBLIC XBitmapList : public XPropertyList { +protected: + virtual Bitmap CreateBitmapForUI( long nIndex ); + public: explicit XBitmapList( const String& rPath, XOutdevItemPool* pXInPool = NULL ) @@ -483,8 +484,6 @@ public: virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > createInstance(); virtual sal_Bool Create(); - virtual sal_Bool CreateBitmapsForUI(); - virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True ); }; diff --git a/include/vcl/button.hxx b/include/vcl/button.hxx index e57ea3cbed26..3d330ba17f98 100644 --- a/include/vcl/button.hxx +++ b/include/vcl/button.hxx @@ -446,13 +446,11 @@ protected: using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); - SAL_DLLPRIVATE virtual void FillLayoutData() const; - SAL_DLLPRIVATE virtual const Font& - GetCanonicalFont( const StyleSettings& _rStyle ) const; - SAL_DLLPRIVATE virtual const Color& - GetCanonicalTextColor( const StyleSettings& _rStyle ) const; + virtual void FillLayoutData() const; + virtual const Font& GetCanonicalFont( const StyleSettings& _rStyle ) const; + virtual const Color& GetCanonicalTextColor( const StyleSettings& _rStyle ) const; - SAL_DLLPRIVATE virtual void ImplDrawCheckBoxState(); + virtual void ImplDrawCheckBoxState(); SAL_DLLPRIVATE const Rectangle& GetStateRect() const { return maStateRect; } SAL_DLLPRIVATE const Rectangle& GetMouseRect() const { return maMouseRect; } diff --git a/include/vcl/split.hxx b/include/vcl/split.hxx index 937ef7d2ab38..a279fd24181f 100644 --- a/include/vcl/split.hxx +++ b/include/vcl/split.hxx @@ -56,6 +56,7 @@ private: SAL_DLLPRIVATE sal_Bool ImplSplitterActive(); SAL_DLLPRIVATE Splitter* ImplFindSibling(); SAL_DLLPRIVATE void ImplRestoreSplitter(); + SAL_DLLPRIVATE void ImplInitHorVer(bool bNew); // Copy assignment is forbidden and not implemented. SAL_DLLPRIVATE Splitter (const Splitter &); @@ -97,7 +98,8 @@ public: virtual void SetSplitPosPixel( long nPos ); long GetSplitPosPixel() const { return mnSplitPos; } - sal_Bool IsHorizontal() const { return mbHorzSplit; } + sal_Bool IsHorizontal() const { return mbHorzSplit; } + void SetHorizontal(bool bNew); // set the stepsize of the splitter for cursor movement // the default is 10% of the reference window's width/height diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx index d1c783bc0e69..381b3e61fda5 100644 --- a/include/vcl/window.hxx +++ b/include/vcl/window.hxx @@ -1273,6 +1273,14 @@ public: virtual OUString GetSurroundingText() const; virtual Selection GetSurroundingTextSelection() const; + + void EnableThemeSupport (void); + void DisableThemeSupport (void); + + virtual ImplBorderWindow* CreateBorderWindow ( + Window* pParent, + const WinBits nStyle, + const sal_uInt16 nTypeStyle); }; diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index a3772e08104d..6c5c6f4a7a38 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -3939,6 +3939,8 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/ucb,\ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/ui,\ ActionTriggerSeparatorType \ ConfigurationEvent \ + ContextChangeEventMultiplexer \ + ContextChangeEventObject \ ContextMenuExecuteEvent \ ContextMenuInterceptorAction \ DockingArea \ @@ -3946,14 +3948,19 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/ui,\ ImageType \ ItemStyle \ ItemType \ + LayoutSize \ UIElementType \ XAcceleratorConfiguration \ + XContextChangeEventListener \ + XContextChangeEventMultiplexer \ XContextMenuInterception \ XContextMenuInterceptor \ XDockingAreaAcceptor \ XImageManager \ XModuleUIConfigurationManager \ XModuleUIConfigurationManagerSupplier \ + XSidebar \ + XSidebarPanel \ XToolPanel \ XUIConfiguration \ XUIConfigurationListener \ diff --git a/offapi/com/sun/star/ui/ContextChangeEventMultiplexer.idl b/offapi/com/sun/star/ui/ContextChangeEventMultiplexer.idl new file mode 100644 index 000000000000..874e7968a35b --- /dev/null +++ b/offapi/com/sun/star/ui/ContextChangeEventMultiplexer.idl @@ -0,0 +1,35 @@ +/* + * 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 __com_sun_star_ui_ContextChangeEventMultiplexer_idl__ +#define __com_sun_star_ui_ContextChangeEventMultiplexer_idl__ + +#ifndef __com_sun_star_ui_XContextChangeEventMultiplexer_idl__ +#include <com/sun/star/ui/XContextChangeEventMultiplexer.idl> +#endif + +module com { module sun { module star { module ui { + +/** Multiplex events for context changes. + + A typical listener for context changes is the sidebar. +*/ +singleton ContextChangeEventMultiplexer : com::sun::star::ui::XContextChangeEventMultiplexer; + +}; }; }; }; // com.sun.star.ui + +#endif diff --git a/offapi/com/sun/star/ui/ContextChangeEventObject.idl b/offapi/com/sun/star/ui/ContextChangeEventObject.idl new file mode 100644 index 000000000000..944ed224d0c7 --- /dev/null +++ b/offapi/com/sun/star/ui/ContextChangeEventObject.idl @@ -0,0 +1,47 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef __com_sun_star_ui_ContextChangeEventObject_idl__ +#define __com_sun_star_ui_ContextChangeEventObject_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include <com/sun/star/uno/XInterface.idl> +#endif + +#ifndef __com_sun_star_lang_EventObject_idl__ +#include <com/sun/star/lang/EventObject.idl> +#endif + + +module com { module sun { module star { module ui { + +struct ContextChangeEventObject : com::sun::star::lang::EventObject +{ + /** Return the name of the application. + */ + string ApplicationName; + + /** Return the application specific context name. + */ + string ContextName; +}; + +}; }; }; }; + +//============================================================================= + +#endif diff --git a/offapi/com/sun/star/ui/LayoutSize.idl b/offapi/com/sun/star/ui/LayoutSize.idl new file mode 100644 index 000000000000..42d76ab7898a --- /dev/null +++ b/offapi/com/sun/star/ui/LayoutSize.idl @@ -0,0 +1,46 @@ +/* + * 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 __com_sun_star_ui_LayoutSize_idl__ +#define __com_sun_star_ui_LayoutSize_idl__ + +module com { module sun { module star { module ui { + +/** Size used for layouting windows. + It specifies a range of valid values and a preferred value. + The values must not violate the relation 0 <= Minimum <= Preferred <= Maximum. + + @param Minimum + Zero or positive. The value itself is included in the valid + range. + @param Maximum + A value larger than or equal to Minimum. + The special value -1 means that there is no upper bound. Every value larger than or + equal to Minimum is valid. + @param Preferred + The preferred size inside the valid range. +*/ +struct LayoutSize +{ + long Minimum; + long Maximum; + long Preferred; +}; + +}; }; }; }; + +#endif diff --git a/offapi/com/sun/star/ui/XContextChangeEventListener.idl b/offapi/com/sun/star/ui/XContextChangeEventListener.idl new file mode 100644 index 000000000000..d969b5904f03 --- /dev/null +++ b/offapi/com/sun/star/ui/XContextChangeEventListener.idl @@ -0,0 +1,43 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef __com_sun_star_ui_XContextChangeEventListener_idl__ +#define __com_sun_star_ui_XContextChangeEventListener_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include <com/sun/star/uno/XInterface.idl> +#endif + +#ifndef __com_sun_star_lang_XEventListener_idl__ +#include <com/sun/star/lang/XEventListener.idl> +#endif + +#ifndef __com_sun_star_ui_ContextChangeEventObject_idl__ +#include <com/sun/star/ui/ContextChangeEventObject.idl> +#endif + +module com { module sun { module star { module ui { + +interface XContextChangeEventListener : ::com::sun::star::lang::XEventListener +{ + void notifyContextChangeEvent ( + [in] com::sun::star::ui::ContextChangeEventObject event); +} ; + +} ; } ; } ; } ; + +#endif diff --git a/offapi/com/sun/star/ui/XContextChangeEventMultiplexer.idl b/offapi/com/sun/star/ui/XContextChangeEventMultiplexer.idl new file mode 100644 index 000000000000..989f5f0c0708 --- /dev/null +++ b/offapi/com/sun/star/ui/XContextChangeEventMultiplexer.idl @@ -0,0 +1,125 @@ +/* + * 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 __com_sun_star_ui_XContextChangeEventMultiplexer_idl__ +#define __com_sun_star_ui_XContextChangeEventMultiplexer_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include <com/sun/star/uno/XInterface.idl> +#endif + +#ifndef __com_sun_star_ui_XContextChangeEventListener_idl__ +#include <com/sun/star/ui/XContextChangeEventListener.idl> +#endif + +#ifndef __com_sun_star_ui_ContextChangeEventObject_idl__ +#include <com/sun/star/ui/ContextChangeEventObject.idl> +#endif + +#ifndef __com_sun_star_lang_IllegalArgumentException_idl__ +#include <com/sun/star/lang/IllegalArgumentException.idl> +#endif + + +module com { module sun { module star { module ui { + +/** Provide a central access point for a group of events. + + Listeners can be added with a simple restriction on the event source. + They are only called for events that originate at the specified source. + + Event providers can broadcast an event to all interested listeners. + + The XEventMultiplexer interface is typically implemented as a singleton +*/ +interface XContextChangeEventMultiplexer : ::com::sun::star::uno::XInterface +{ + /** Add an event listener that is called only when events are broadcast for the specified + event focus. + + @param xListener + An empty reference results in an InvalidArgumentException. + + One listener may be added more than once for different + event foci. Adding a listener a second time for the same + event focus results in an InvalidArgumentException. + + @param xEventFocus + An empty reference is a valid value. In this case the + registered listener will be called for every event + broadcast, regardless of its event focus. + + The event focus may or may not be the source of the event. + + A typical example for an event focus is the XController of + a view. Using an XController restricts events passed to + a listener to events that belong to one view. + + @throws com::sun::star::lang::IllegalArgumentException + + */ + void addContextChangeEventListener ( + [in] com::sun::star::ui::XContextChangeEventListener xListener, + [in] com::sun::star::uno::XInterface xEventFocus) + raises (com::sun::star::lang::IllegalArgumentException); + + /** Remove an event listener for the specified event focus. + + When the same listener was added for other event foci then + these associations remain unmodified. + + @param xListener + An empty reference results in an InvalidArgumentException. + + When the listener is not registered for the given event + focus then an InvalidArgumentException is thrown. + + @param xEventFocus + The listener is only removed for this event focus. + An empty reference is a valid value. + + @throws com::sun::star::lang::IllegalArgumentException + */ + void removeContextChangeEventListener ( + [in] com::sun::star::ui::XContextChangeEventListener xListener, + [in] com::sun::star::uno::XInterface xEventFocus) + raises (com::sun::star::lang::IllegalArgumentException); + + /** Remove an event listener for all event foci. + + @param xListener + An empty reference results in an InvalidArgumentException. + + It is not an error when the listener is not registered for any event focus. + + @throws com::sun::star::lang::IllegalArgumentException + */ + void removeAllContextChangeEventListeners ( + [in] com::sun::star::ui::XContextChangeEventListener xListener) + raises (com::sun::star::lang::IllegalArgumentException); + + + /** Call all event listeners that where added for the specified event focus. + */ + void broadcastContextChangeEvent ( + [in] com::sun::star::ui::ContextChangeEventObject aEvent, + [in] com::sun::star::uno::XInterface xEventFocus); +} ; + +} ; } ; } ; } ; + +#endif diff --git a/offapi/com/sun/star/ui/XContextChangeListener.idl b/offapi/com/sun/star/ui/XContextChangeListener.idl new file mode 100644 index 000000000000..204a0c6a0e5d --- /dev/null +++ b/offapi/com/sun/star/ui/XContextChangeListener.idl @@ -0,0 +1,45 @@ +/* + * 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 __com_sun_star_util_XEventListener_idl__ +#define __com_sun_star_util_XEventListener_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include <com/sun/star/uno/XInterface.idl> +#endif + +#ifndef __com_sun_star_lang_XEventListener_idl__ +#include <com/sun/star/lang/XEventListener.idl> +#endif + +#ifndef __com_sun_star_lang_EventObject_idl__ +#include <com/sun/star/lang/EventObject.idl> +#endif + +module com { module sun { module star { module util { + +/** Generic event listener. +*/ +interface XEventListener : ::com::sun::star::lang::XEventListener +{ + void notifyEvent ( + [in] com::sun::star::lang::EventObject event); +} ; + +} ; } ; } ; } ; + +#endif diff --git a/offapi/com/sun/star/ui/XSidebar.idl b/offapi/com/sun/star/ui/XSidebar.idl new file mode 100644 index 000000000000..c47a0d42c9da --- /dev/null +++ b/offapi/com/sun/star/ui/XSidebar.idl @@ -0,0 +1,40 @@ +/* + * 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 __com_sun_star_ui_XSidebar_idl__ +#define __com_sun_star_ui_XSidebar_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include <com/sun/star/uno/XInterface.idl> +#endif + +module com { module sun { module star { module ui { + +/** Interface of the sidebar that allows its elements like panels to eg request layouts. +*/ +interface XSidebar +{ + /** Request layout of the sidebar. + Call this method when one of the panels wants to change its size due to + late initilization or different content after a context change. + */ + void requestLayout (); +} ; + +} ; } ; } ; } ; + +#endif diff --git a/offapi/com/sun/star/ui/XSidebarPanel.idl b/offapi/com/sun/star/ui/XSidebarPanel.idl new file mode 100644 index 000000000000..1852c97b1f76 --- /dev/null +++ b/offapi/com/sun/star/ui/XSidebarPanel.idl @@ -0,0 +1,58 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef __com_sun_star_ui_XSidebarPanel_idl__ +#define __com_sun_star_ui_XSidebarPanel_idl__ + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include <com/sun/star/uno/XInterface.idl> +#endif + +#ifndef __com_sun_star_rendering_XCanvas_idl__ +#include <com/sun/star/rendering/XCanvas.idl> +#endif + +#ifndef __com_sun_star_awt_Point_idl__ +#include <com/sun/star/awt/Point.idl> +#endif + +#ifndef __com_sun_star_beans_XPropertySet_idl__ +#include <com/sun/star/beans/XPropertySet.idl> +#endif +#ifndef __com_sun_star_ui_LayoutSize_idl__ +#include <com/sun/star/ui/LayoutSize.idl> +#endif + +module com { module sun { module star { module ui { + +/** Optional interface of sidebar panels. +*/ +interface XSidebarPanel +{ + /** For a given width of the container the layouter asks every ui element for its + optimal height. + + The height to which a ui element is set may differ from the returned value. + + The height is set via the XWindow interface. + */ + LayoutSize getHeightForWidth ( [in] long nWidth); +} ; + +} ; } ; } ; } ; + +#endif diff --git a/offapi/com/sun/star/util/EventMultiplexer.idl b/offapi/com/sun/star/util/EventMultiplexer.idl new file mode 100644 index 000000000000..db8d128086ba --- /dev/null +++ b/offapi/com/sun/star/util/EventMultiplexer.idl @@ -0,0 +1,35 @@ +/* + * 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 __com_sun_star_util_EventMultiplexer_idl__ +#define __com_sun_star_util_EventMultiplexer_idl__ + +#ifndef __com_sun_star_util_XEventMultiplexer_idl__ +#include <com/sun/star/util/XEventMultiplexer.idl> +#endif + +module com { module sun { module star { module util { + +/** Multiplex generic events. +*/ +service EventMultiplexer : com::sun::star::util::XEventMultiplexer +{ +}; + +}; }; }; }; // com.sun.star.util + +#endif diff --git a/officecfg/Configuration_officecfg.mk b/officecfg/Configuration_officecfg.mk index 3a0bae3495df..70cc15b9de46 100644 --- a/officecfg/Configuration_officecfg.mk +++ b/officecfg/Configuration_officecfg.mk @@ -173,6 +173,7 @@ $(eval $(call gb_Configuration_add_localized_datas,registry,officecfg/registry/d org/openoffice/Office/UI/DrawWindowState.xcu \ org/openoffice/Office/UI/ImpressWindowState.xcu \ org/openoffice/Office/UI/MathWindowState.xcu \ + org/openoffice/Office/UI/Sidebar.xcu \ org/openoffice/Office/UI/StartModuleWindowState.xcu \ org/openoffice/Office/UI/WriterWindowState.xcu \ org/openoffice/Office/UI/XFormsWindowState.xcu \ diff --git a/officecfg/files.mk b/officecfg/files.mk index 7a2deb85dea9..20237c123e1d 100644 --- a/officecfg/files.mk +++ b/officecfg/files.mk @@ -82,6 +82,7 @@ officecfg_XCSFILES := \ Office/UI/MathCommands \ Office/UI/MathWindowState \ Office/UI/ReportCommands \ + Office/UI/Sidebar \ Office/UI/StartModuleCommands \ Office/UI/StartModuleWindowState \ Office/UI/WindowContentFactories \ diff --git a/officecfg/registry/data/org/openoffice/Office/Impress.xcu b/officecfg/registry/data/org/openoffice/Office/Impress.xcu index d5353593a7e8..2310cc2a6b36 100644 --- a/officecfg/registry/data/org/openoffice/Office/Impress.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Impress.xcu @@ -82,11 +82,6 @@ <value>private:resource/pane/LeftDrawPane</value> </prop> </node> - <node oor:name="R3" oor:op="replace"> - <prop oor:name="URL"> - <value>private:resource/pane/RightPane</value> - </prop> - </node> </node> </node> <node oor:name="F1" oor:op="replace"> @@ -126,11 +121,6 @@ </node> <node oor:name="R6" oor:op="replace"> <prop oor:name="URL"> - <value>private:resource/view/TaskPane</value> - </prop> - </node> - <node oor:name="R7" oor:op="replace"> - <prop oor:name="URL"> <value>private:resource/view/PresentationView</value> </prop> </node> @@ -150,43 +140,53 @@ </node> <node oor:name="F3" oor:op="replace"> <prop oor:name="ServiceName"> - <value>com.sun.star.drawing.framework.TaskPanelFactory</value> + <value>com.sun.star.comp.Draw.framework.TaskPanelFactory</value> </prop> <node oor:name="ResourceList"> - <node oor:name="R0" oor:op="replace"> + <node oor:name="R0a" oor:op="replace"> + <prop oor:name="URL"> + <value>private:resource/toolpanel/AllMasterPages</value> + </prop> + </node> + <node oor:name="R0b" oor:op="replace"> + <prop oor:name="URL"> + <value>private:resource/toolpanel/RecentMasterPages</value> + </prop> + </node> + <node oor:name="R0c" oor:op="replace"> <prop oor:name="URL"> - <value>private:resource/toolpanel/DrawingFramework/MasterPages</value> + <value>private:resource/toolpanel/UsedMasterPages</value> </prop> </node> <node oor:name="R1" oor:op="replace"> <prop oor:name="URL"> - <value>private:resource/toolpanel/DrawingFramework/Layouts</value> + <value>private:resource/toolpanel/Layouts</value> </prop> </node> <node oor:name="R2" oor:op="replace"> <prop oor:name="URL"> - <value>private:resource/toolpanel/DrawingFramework/TableDesign</value> + <value>private:resource/toolpanel/TableDesign</value> </prop> </node> <node oor:name="R3" oor:op="replace"> <prop oor:name="URL"> - <value>private:resource/toolpanel/DrawingFramework/CustomAnimations</value> + <value>private:resource/toolpanel/CustomAnimations</value> </prop> </node> <node oor:name="R4" oor:op="replace"> <prop oor:name="URL"> - <value>private:resource/toolpanel/DrawingFramework/SlideTransitions</value> + <value>private:resource/toolpanel/SlideTransitions</value> </prop> </node> </node> </node> </node> <node oor:name="StartupServices"> - <node oor:name="S0" oor:op="replace"> - <prop oor:name="ServiceName"> - <value>com.sun.star.drawing.framework.PresentationFactoryProvider</value> - </prop> - </node> + <node oor:name="S0" oor:op="replace"> + <prop oor:name="ServiceName"> + <value>com.sun.star.drawing.framework.PresentationFactoryProvider</value> + </prop> + </node> </node> </node> </node> diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Factories.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Factories.xcu index 943f13a5d78e..15c0a04bc072 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/Factories.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/Factories.xcu @@ -76,18 +76,60 @@ <value>com.sun.star.comp.framework.StatusBarFactory</value> </prop> </node> - <node oor:name="org.openoffice.Office.Impress.ImpressToolPanelFactory" oor:op="replace"> + <node oor:name="SvxPanelFactory" oor:op="replace"> <prop oor:name="Type"> <value>toolpanel</value> </prop> <prop oor:name="Name"> - <value>DrawingFramework</value> + <value>SvxPanelFactory</value> </prop> <prop oor:name="Module"> - <value>com.sun.star.presentation.PresentationDocument</value> + <value/> + </prop> + <prop oor:name="FactoryImplementation"> + <value>org.apache.openoffice.comp.svx.sidebar.PanelFactory</value> + </prop> + </node> + <node oor:name="SdPanelFactory" oor:op="replace"> + <prop oor:name="Type"> + <value>toolpanel</value> + </prop> + <prop oor:name="Name"> + <value>SdPanelFactory</value> + </prop> + <prop oor:name="Module"> + <value></value> + </prop> + <prop oor:name="FactoryImplementation"> + <value>org.openoffice.comp.Draw.framework.PanelFactory</value> + </prop> + </node> + <node oor:name="ScPanelFactory" oor:op="replace"> + <prop oor:name="Type"> + <value>toolpanel</value> + </prop> + <prop oor:name="Name"> + <value>ScPanelFactory</value> + </prop> + <prop oor:name="Module"> + <value></value> + </prop> + <prop oor:name="FactoryImplementation"> + <value>org.apache.openoffice.comp.sc.sidebar.ScPanelFactory</value> + </prop> + </node> + <node oor:name="SwPanelFactory" oor:op="replace"> + <prop oor:name="Type"> + <value>toolpanel</value> + </prop> + <prop oor:name="Name"> + <value>SwPanelFactory</value> + </prop> + <prop oor:name="Module"> + <value></value> </prop> <prop oor:name="FactoryImplementation"> - <value>com.sun.star.drawing.DefaultToolPanelFactory</value> + <value>org.apache.openoffice.comp.sw.sidebar.SwPanelFactory</value> </prop> </node> </node> diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu index 8ff9b7426d72..fbe3de530be7 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu @@ -3501,6 +3501,11 @@ <value xml:lang="en-US">Task Pane</value> </prop> </node> + <node oor:name=".uno:Sidebar" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Sidebar</value> + </prop> + </node> <node oor:name=".uno:RestoreEditingView" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> <value xml:lang="en-US">Restore Editing View</value> diff --git a/officecfg/registry/data/org/openoffice/Office/UI/ImpressWindowState.xcu b/officecfg/registry/data/org/openoffice/Office/UI/ImpressWindowState.xcu index 5aa630a4d618..c72079b3bc0a 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/ImpressWindowState.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/ImpressWindowState.xcu @@ -825,61 +825,6 @@ <value>true</value> </prop> </node> - <node oor:name="private:resource/toolpanel/DrawingFramework/MasterPages" oor:op="replace"> - <prop oor:name="Visible" oor:type="xs:boolean"> - <value>false</value> - </prop> - <prop oor:name="UIName" oor:type="xs:string"> - <value xml:lang="en-US">Master Pages</value> - </prop> - <prop oor:name="ImageURL" oor:type="xs:string"> - <value>private:commandimage/PresentationLayout</value> - </prop> - </node> - <node oor:name="private:resource/toolpanel/DrawingFramework/Layouts" oor:op="replace"> - <prop oor:name="Visible" oor:type="xs:boolean"> - <value>false</value> - </prop> - <prop oor:name="UIName" oor:type="xs:string"> - <value xml:lang="en-US">Layouts</value> - </prop> - <prop oor:name="ImageURL" oor:type="xs:string"> - <value>private:commandimage/ModifyPage</value> - </prop> - </node> - <node oor:name="private:resource/toolpanel/DrawingFramework/TableDesign" oor:op="replace"> - <prop oor:name="Visible" oor:type="xs:boolean"> - <value>false</value> - </prop> - <prop oor:name="UIName" oor:type="xs:string"> - <value xml:lang="en-US">Table Design</value> - </prop> - <prop oor:name="ImageURL" oor:type="xs:string"> - <value>private:commandimage/InsertTable</value> - </prop> - </node> - <node oor:name="private:resource/toolpanel/DrawingFramework/CustomAnimations" oor:op="replace"> - <prop oor:name="Visible" oor:type="xs:boolean"> - <value>false</value> - </prop> - <prop oor:name="UIName" oor:type="xs:string"> - <value xml:lang="en-US">Custom Animation</value> - </prop> - <prop oor:name="ImageURL" oor:type="xs:string"> - <value>private:commandimage/CustomAnimation</value> - </prop> - </node> - <node oor:name="private:resource/toolpanel/DrawingFramework/SlideTransitions" oor:op="replace"> - <prop oor:name="Visible" oor:type="xs:boolean"> - <value>false</value> - </prop> - <prop oor:name="UIName" oor:type="xs:string"> - <value xml:lang="en-US">Slide Transition</value> - </prop> - <prop oor:name="ImageURL" oor:type="xs:string"> - <value>private:commandimage/RehearseTimings</value> - </prop> - </node> <node oor:name="private:resource/toolbar/optimizetablebar" oor:op="replace"> <prop oor:name="Docked" oor:type="xs:boolean"> <value>false</value> diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu new file mode 100644 index 000000000000..f6ba25566f1b --- /dev/null +++ b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu @@ -0,0 +1,959 @@ +<?xml version='1.0' encoding='UTF-8'?> +<!-- + * 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 . + --> +<!DOCTYPE oor:component-data SYSTEM "../../../../../component-update.dtd"> +<oor:component-data oor:name="Sidebar" oor:package="org.openoffice.Office.UI" xmlns:install="http://openoffice.org/2004/installation" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <node oor:name="Content"> + <node oor:name="DeckList"> + + <node oor:name="PropertyDeck" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Properties</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>PropertyDeck</value> + </prop> + <prop oor:name="IconURL" oor:type="xs:string"> + <value>private:graphicrepository/sfx2/res/symphony/sidebar-property-large.png</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + any, any, visible ; + </value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>100</value> + </prop> + </node> + + <node oor:name="GalleryDeck" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Gallery</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>GalleryDeck</value> + </prop> + <prop oor:name="IconURL" oor:type="xs:string"> + <value>private:graphicrepository/sfx2/res/symphony/sidebar-gallery-large.png</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + any, any, visible ; + </value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>300</value> + </prop> + </node> + + <node oor:name="ImpressMasterPagesDeck" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Master Pages</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>MasterPagesDeck</value> + </prop> + <prop oor:name="IconURL" oor:type="xs:string"> + <value>private:graphicrepository/sfx2/res/symphony/sidebar-template-large.png</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + Impress, any, visible ; + </value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>120</value> + </prop> + </node> + + <node oor:name="ImpressAnimationEffects" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Custom Animation</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>CustomAnimationDeck</value> + </prop> + <prop oor:name="IconURL" oor:type="xs:string"> + <value>private:graphicrepository/sfx2/res/symphony/sidebar-animation-large.png</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + Impress, any, visible ; + </value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>140</value> + </prop> + </node> + + <node oor:name="SlideTransitionDeck" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Slide Transition</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>SlideTransitionDeck</value> + </prop> + <prop oor:name="IconURL" oor:type="xs:string"> + <value>private:graphicrepository/sfx2/res/symphony/sidebar-transition-large.png</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + Impress, any, visible ; + </value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>160</value> + </prop> + </node> + + <node oor:name="NavigatorDeck" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Navigator</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>NavigatorDeck</value> + </prop> + <prop oor:name="IconURL" oor:type="xs:string"> + <value>private:graphicrepository/sfx2/res/symphony/sidebar-navigator-large.png</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + any, any, visible ; + </value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>400</value> + </prop> + </node> + + <node oor:name="StyleListDeck" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Styles and Formatting</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>StyleListDeck</value> + </prop> + <prop oor:name="IconURL" oor:type="xs:string"> + <value>private:graphicrepository/sfx2/res/symphony/sidebar-style-large.png</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + any, any, visible ; + </value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>200</value> + </prop> + </node> + + <node oor:name="FunctionsDeck" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Functions</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>FunctionsDeck</value> + </prop> + <prop oor:name="IconURL" oor:type="xs:string"> + <value>private:graphicrepository/sfx2/res/symphony/sidebar-functions-large.png</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + Calc, any, visible ; + </value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>500</value> + </prop> + </node> + + </node> + <node oor:name="PanelList"> + + <node oor:name="TextPropertyPanel" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Text</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>TextPropertyPanel</value> + </prop> + <prop oor:name="DeckId" oor:type="xs:string"> + <value>PropertyDeck</value> + </prop> + <prop oor:name="DefaultMenuCommand"> + <value>.uno:FontDialog</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + Calc, Auditing, visible, .uno:CellTextDlg ; + Calc, Cell, visible, .uno:CellTextDlg ; + Calc, default, visible, .uno:CellTextDlg ; + Calc, DrawText, visible ; + Calc, EditCell, visible ; + Calc, Pivot, visible, .uno:CellTextDlg ; + DrawImpress, 3DObject, visible ; + DrawImpress, Draw, hidden ; + DrawImpress, DrawText, visible ; + DrawImpress, Graphic, hidden ; + DrawImpress, OutlineText, visible ; + DrawImpress, Table, visible ; + DrawImpress, TextObject, visible ; + WriterAndWeb, Annotation, visible ; + WriterAndWeb, DrawText, visible ; + WriterAndWeb, Table, visible ; + WriterAndWeb, Text, visible ; + WriterAndWeb, default, visible ; + </value> + </prop> + <prop oor:name="ImplementationURL" oor:type="xs:string"> + <value>private:resource/toolpanel/SvxPanelFactory/TextPropertyPanel</value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>100</value> + </prop> + </node> + + <node oor:name="ContextPanel" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Current Context (only for debugging)</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>Context</value> + </prop> + <prop oor:name="DeckId" oor:type="xs:string"> + <value>PropertyDeck</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + none, none, visible ; + </value> + </prop> + <prop oor:name="ImplementationURL" oor:type="xs:string"> + <value>private:resource/toolpanel/SvxPanelFactory/Debug_ContextPanel</value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>10</value> + </prop> + </node> + + <node oor:name="PagePropertyPanel" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Page</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>PagePropertyPanel</value> + </prop> + <prop oor:name="DeckId" oor:type="xs:string"> + <value>PropertyDeck</value> + </prop> + <prop oor:name="DefaultMenuCommand"> + <value>.uno:PageDialog</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + Writer, Table, hidden ; + Writer, Text, hidden ; + Writer, default, hidden ; + </value> + </prop> + <prop oor:name="ImplementationURL" oor:type="xs:string"> + <value>private:resource/toolpanel/SwPanelFactory/PagePropertyPanel</value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>300</value> + </prop> + </node> + + <node oor:name="ColorPanel" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Colors (only for debugging)</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>ColorPanel</value> + </prop> + <prop oor:name="DeckId" oor:type="xs:string"> + <value>PropertyDeck</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + none, any, visible ; + </value> + </prop> + <prop oor:name="ImplementationURL" oor:type="xs:string"> + <value>private:resource/toolpanel/SvxPanelFactory/Debug_ColorPanel</value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>110</value> + </prop> + </node> + + <node oor:name="AreaPropertyPanel" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Area</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>AreaPropertyPanel</value> + </prop> + <prop oor:name="DeckId" oor:type="xs:string"> + <value>PropertyDeck</value> + </prop> + <prop oor:name="DefaultMenuCommand"> + <value>.uno:FormatArea</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + Calc, Draw, visible ; + DrawImpress, 3DObject, visible ; + DrawImpress, Draw, visible ; + DrawImpress, TextObject, hidden ; + WriterAndWeb, Draw, visible ; + </value> + </prop> + <prop oor:name="ImplementationURL" oor:type="xs:string"> + <value>private:resource/toolpanel/SvxPanelFactory/AreaPropertyPanel</value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>300</value> + </prop> + </node> + + <node oor:name="LinePropertyPanel" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Line</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>LinePropertyPanel</value> + </prop> + <prop oor:name="DeckId" oor:type="xs:string"> + <value>PropertyDeck</value> + </prop> + <prop oor:name="DefaultMenuCommand"> + <value>.uno:FormatLine</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + Calc, Draw, visible ; + Calc, Graphic, visible ; + DrawImpress, 3DObject, visible ; + DrawImpress, Draw, visible ; + DrawImpress, Graphic, visible ; + DrawImpress, TextObject, hidden ; + WriterAndWeb, Draw, visible ; + </value> + </prop> + <prop oor:name="ImplementationURL" oor:type="xs:string"> + <value>private:resource/toolpanel/SvxPanelFactory/LinePropertyPanel</value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>400</value> + </prop> + </node> + + <node oor:name="GalleryPanel" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Gallery</value> + </prop> + <prop oor:name="TitleBarIsOptional" oor:type="xs:boolean"> + <value>true</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>GalleryPanel</value> + </prop> + <prop oor:name="DeckId" oor:type="xs:string"> + <value>GalleryDeck</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + any, any, visible ; + </value> + </prop> + <prop oor:name="ImplementationURL" oor:type="xs:string"> + <value>private:resource/toolpanel/SvxPanelFactory/GalleryPanel</value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>100</value> + </prop> + </node> + + <node oor:name="PosSizePropertyPanel" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Position and Size</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>PosSizePropertyPanel</value> + </prop> + <prop oor:name="DeckId" oor:type="xs:string"> + <value>PropertyDeck</value> + </prop> + <prop oor:name="DefaultMenuCommand"> + <value>.uno:TransformDialog</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + Calc, Chart, visible ; + Calc, Draw, hidden ; + Calc, Form, visible ; + Calc, Graphic, hidden ; + Calc, Media, visible ; + Calc, MultiObject, visible ; + Calc, OLE, visible ; + DrawImpress, 3DObject, visible ; + DrawImpress, Draw, hidden ; + DrawImpress, Form, visible ; + DrawImpress, Graphic, hidden ; + DrawImpress, Media, visible ; + DrawImpress, MultiObject, visible ; + DrawImpress, OLE, visible ; + DrawImpress, TextObject, hidden ; + WriterAndWeb, Draw, hidden ; + WriterAndWeb, Form, visible ; + WriterAndWeb, Graphic, visible, .uno:GraphicDialog ; + WriterAndWeb, Media, visible ; + WriterAndWeb, OLE, visible, .uno:FrameDialog ; + </value> + </prop> + <prop oor:name="ImplementationURL" oor:type="xs:string"> + <value>private:resource/toolpanel/SvxPanelFactory/PosSizePropertyPanel</value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>500</value> + </prop> + </node> + + <node oor:name="GraphicPropertyPanel" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Graphic</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>GraphicPropertyPanel</value> + </prop> + <prop oor:name="DeckId" oor:type="xs:string"> + <value>PropertyDeck</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + Calc, Graphic, visible ; + DrawImpress, Graphic, visible ; + WriterAndWeb, Graphic, visible ; + </value> + </prop> + <prop oor:name="ImplementationURL" oor:type="xs:string"> + <value>private:resource/toolpanel/SvxPanelFactory/GraphicPropertyPanel</value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>300</value> + </prop> + </node> + + <node oor:name="Impress1" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Layouts</value> + </prop> + <prop oor:name="TitleBarIsOptional" oor:type="xs:boolean"> + <value>false</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>ImpressLayoutsPanel</value> + </prop> + <prop oor:name="DeckId" oor:type="xs:string"> + <value>PropertyDeck</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + Impress, DrawPage, visible ; + Impress, default, visible ; + Impress, HandoutPage, visible ; + Impress, NotesPage, visible ; + Impress, SlidesorterPage, visible ; + </value> + </prop> + <prop oor:name="ImplementationURL" oor:type="xs:string"> + <value>private:resource/toolpanel/SdPanelFactory/Layouts</value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>100</value> + </prop> + </node> + + <node oor:name="Impress2" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Used in This Presentation</value> + </prop> + <prop oor:name="TitleBarIsOptional" oor:type="xs:boolean"> + <value>false</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>UsedMasterPagesPanel</value> + </prop> + <prop oor:name="DeckId" oor:type="xs:string"> + <value>MasterPagesDeck</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + Impress, any, visible ; + </value> + </prop> + <prop oor:name="ImplementationURL" oor:type="xs:string"> + <value>private:resource/toolpanel/SdPanelFactory/UsedMasterPages</value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>100</value> + </prop> + </node> + + <node oor:name="Impress3" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Recently Used</value> + </prop> + <prop oor:name="TitleBarIsOptional" oor:type="xs:boolean"> + <value>false</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>RecentMasterPagesPanel</value> + </prop> + <prop oor:name="DeckId" oor:type="xs:string"> + <value>MasterPagesDeck</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + Impress, any, visible ; + </value> + </prop> + <prop oor:name="ImplementationURL" oor:type="xs:string"> + <value>private:resource/toolpanel/SdPanelFactory/RecentMasterPages</value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>200</value> + </prop> + </node> + + <node oor:name="Impress4" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Available for Use</value> + </prop> + <prop oor:name="TitleBarIsOptional" oor:type="xs:boolean"> + <value>false</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>AllMasterPagesPanel</value> + </prop> + <prop oor:name="DeckId" oor:type="xs:string"> + <value>MasterPagesDeck</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + Impress, any, visible ; + </value> + </prop> + <prop oor:name="ImplementationURL" oor:type="xs:string"> + <value>private:resource/toolpanel/SdPanelFactory/AllMasterPages</value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>300</value> + </prop> + </node> + + <node oor:name="Impress5" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Custom Animation</value> + </prop> + <prop oor:name="TitleBarIsOptional" oor:type="xs:boolean"> + <value>true</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>CustomAnimationPanel</value> + </prop> + <prop oor:name="DeckId" oor:type="xs:string"> + <value>CustomAnimationDeck</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + Impress, any, visible ; + </value> + </prop> + <prop oor:name="ImplementationURL" oor:type="xs:string"> + <value>private:resource/toolpanel/SdPanelFactory/CustomAnimations</value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>100</value> + </prop> + </node> + + <node oor:name="Impress6" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Slide Transition</value> + </prop> + <prop oor:name="TitleBarIsOptional" oor:type="xs:boolean"> + <value>true</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>SlideTransitionPanel</value> + </prop> + <prop oor:name="DeckId" oor:type="xs:string"> + <value>SlideTransitionDeck</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + Impress, any, visible ; + </value> + </prop> + <prop oor:name="ImplementationURL" oor:type="xs:string"> + <value>private:resource/toolpanel/SdPanelFactory/SlideTransitions</value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>100</value> + </prop> + </node> + + <node oor:name="Impress7" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Table Design</value> + </prop> + <prop oor:name="TitleBarIsOptional" oor:type="xs:boolean"> + <value>false</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>ImpressTableDesignPanel</value> + </prop> + <prop oor:name="DeckId" oor:type="xs:string"> + <value>PropertyDeck</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + Impress, Table, visible ; + </value> + </prop> + <prop oor:name="ImplementationURL" oor:type="xs:string"> + <value>private:resource/toolpanel/SdPanelFactory/TableDesign</value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>300</value> + </prop> + </node> + + <node oor:name="EmptyPanel" oor:op="replace"> + <prop oor:name="TitleBarIsOptional" oor:type="xs:boolean"> + <value>true</value> + </prop> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Empty</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>EmptyPanel</value> + </prop> + <prop oor:name="DeckId" oor:type="xs:string"> + <value>PropertyDeck</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + any, empty, visible ; + </value> + </prop> + <prop oor:name="ImplementationURL" oor:type="xs:string"> + <value>private:resource/toolpanel/SvxPanelFactory/EmptyPanel</value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>100</value> + </prop> + </node> + + <node oor:name="AlignmentPropertyPanel" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Alignment</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>AlignmentPropertyPanel</value> + </prop> + <prop oor:name="DeckId" oor:type="xs:string"> + <value>PropertyDeck</value> + </prop> + <prop oor:name="DefaultMenuCommand"> + <value>.uno:Hyphenate</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + Calc, Auditing, visible ; + Calc, Cell, visible ; + Calc, default, visible ; + Calc, EditCell, visible ; + Calc, Pivot, visible ; + </value> + </prop> + <prop oor:name="ImplementationURL" oor:type="xs:string"> + <value>private:resource/toolpanel/ScPanelFactory/AlignmentPropertyPanel</value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>200</value> + </prop> + </node> + + <node oor:name="CellAppearancePropertyPanel" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Cell Appearance</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>CellAppearancePropertyPanel</value> + </prop> + <prop oor:name="DeckId" oor:type="xs:string"> + <value>PropertyDeck</value> + </prop> + <prop oor:name="DefaultMenuCommand"> + <value>.uno:FormatCellDialg</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + Calc, Auditing, visible ; + Calc, Cell, visible ; + Calc, default, visible ; + Calc, Pivot, visible ; + </value> + </prop> + <prop oor:name="ImplementationURL" oor:type="xs:string"> + <value>private:resource/toolpanel/ScPanelFactory/CellAppearancePropertyPanel</value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>300</value> + </prop> + </node> + + <node oor:name="NumberFormatPropertyPanel" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Number Format</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>NumberFormatPropertyPanel</value> + </prop> + <prop oor:name="DeckId" oor:type="xs:string"> + <value>PropertyDeck</value> + </prop> + <prop oor:name="DefaultMenuCommand"> + <value>.uno:FormatCellDialog</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + Calc, Auditing, hidden ; + Calc, Cell, hidden ; + Calc, default, hidden ; + Calc, Pivot, hidden ; + </value> + </prop> + <prop oor:name="ImplementationURL" oor:type="xs:string"> + <value>private:resource/toolpanel/ScPanelFactory/NumberFormatPropertyPanel</value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>400</value> + </prop> + </node> + + <node oor:name="ParaPropertyPanel" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Paragraph</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>ParaPropertyPanel</value> + </prop> + <prop oor:name="DeckId" oor:type="xs:string"> + <value>PropertyDeck</value> + </prop> + <prop oor:name="DefaultMenuCommand"> + <value>.uno:ParagraphDialog</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + Calc, DrawText, visible ; + DrawImpress, 3DObject, hidden ; + DrawImpress, Draw, hidden ; + DrawImpress, DrawText, visible ; + DrawImpress, Graphic, hidden ; + DrawImpress, Table, visible ; + DrawImpress, TextObject, visible ; + WriterAndWeb, Annotation, visible ; + WriterAndWeb, DrawText, visible ; + WriterAndWeb, Table, visible ; + WriterAndWeb, Text, visible ; + WriterAndWeb, default, visible ; + </value> + </prop> + <prop oor:name="ImplementationURL" oor:type="xs:string"> + <value>private:resource/toolpanel/SvxPanelFactory/ParaPropertyPanel</value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>200</value> + </prop> + </node> + + <node oor:name="WrapPropertyPanel" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Wrap</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>WrapPropertyPanel</value> + </prop> + <prop oor:name="DeckId" oor:type="xs:string"> + <value>PropertyDeck</value> + </prop> + <prop oor:name="DefaultMenuCommand"> + <value>.uno:ObjectWrapDialog</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + Writer, Graphic, visible ; + Writer, OLE, visible ; + Writer, Frame, visible ; + </value> + </prop> + <prop oor:name="ImplementationURL" oor:type="xs:string"> + <value>private:resource/toolpanel/SwPanelFactory/WrapPropertyPanel</value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>500</value> + </prop> + </node> + + <node oor:name="SwNavigatorPanel" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Navigator</value> + </prop> + <prop oor:name="TitleBarIsOptional" oor:type="xs:boolean"> + <value>true</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>SwNavigatorPanel</value> + </prop> + <prop oor:name="DeckId" oor:type="xs:string"> + <value>NavigatorDeck</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + WriterAndWeb, any, visible ; + </value> + </prop> + <prop oor:name="ImplementationURL" oor:type="xs:string"> + <value>private:resource/toolpanel/SwPanelFactory/NavigatorPanel</value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>100</value> + </prop> + </node> + + <node oor:name="ScNavigatorPanel" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Navigator</value> + </prop> + <prop oor:name="TitleBarIsOptional" oor:type="xs:boolean"> + <value>true</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>ScNavigatorPanel</value> + </prop> + <prop oor:name="DeckId" oor:type="xs:string"> + <value>NavigatorDeck</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + Calc, any, visible ; + </value> + </prop> + <prop oor:name="ImplementationURL" oor:type="xs:string"> + <value>private:resource/toolpanel/ScPanelFactory/NavigatorPanel</value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>100</value> + </prop> + </node> + + <node oor:name="SdNavigatorPanel" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Navigator</value> + </prop> + <prop oor:name="TitleBarIsOptional" oor:type="xs:boolean"> + <value>true</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>SdNavigatorPanel</value> + </prop> + <prop oor:name="DeckId" oor:type="xs:string"> + <value>NavigatorDeck</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + DrawImpress, any, visible ; + </value> + </prop> + <prop oor:name="ImplementationURL" oor:type="xs:string"> + <value>private:resource/toolpanel/SdPanelFactory/NavigatorPanel</value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>100</value> + </prop> + </node> + + <node oor:name="StyleListPanel" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Styles and Formatting</value> + </prop> + <prop oor:name="TitleBarIsOptional" oor:type="xs:boolean"> + <value>true</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>StyleListPanel</value> + </prop> + <prop oor:name="DeckId" oor:type="xs:string"> + <value>StyleListDeck</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + any, any, visible ; + </value> + </prop> + <prop oor:name="ImplementationURL" oor:type="xs:string"> + <value>private:resource/toolpanel/SvxPanelFactory/StyleListPanel</value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>100</value> + </prop> + </node> + + <node oor:name="FunctionsPanel" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Functions</value> + </prop> + <prop oor:name="TitleBarIsOptional" oor:type="xs:boolean"> + <value>true</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>FunctionsPanel</value> + </prop> + <prop oor:name="DeckId" oor:type="xs:string"> + <value>FunctionsDeck</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + Calc, any, visible ; + </value> + </prop> + <prop oor:name="ImplementationURL" oor:type="xs:string"> + <value>private:resource/toolpanel/ScPanelFactory/FunctionsPanel</value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>100</value> + </prop> + </node> + + </node> + </node> +</oor:component-data> diff --git a/officecfg/registry/data/org/openoffice/Office/Views.xcu b/officecfg/registry/data/org/openoffice/Office/Views.xcu index bd3a06b093c4..81f56d26c983 100644 --- a/officecfg/registry/data/org/openoffice/Office/Views.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Views.xcu @@ -24,5 +24,11 @@ <value>false</value> </prop> </node> + <!-- show Sidebar child window by default - oor:name == SID_SIDEBAR --> + <node oor:name="10336" oor:op="replace"> + <prop oor:name="Visible" oor:type="xs:boolean"> + <value>true</value> + </prop> + </node> </node> </oor:component-data> diff --git a/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs b/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs new file mode 100644 index 000000000000..dc76c5975f89 --- /dev/null +++ b/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs @@ -0,0 +1,203 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * 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 . + --> +<!DOCTYPE oor:component-schema SYSTEM "../../../../../component-schema.dtd"> +<oor:component-schema + xmlns:oor="http://openoffice.org/2001/registry" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + oor:name="Sidebar" + oor:package="org.openoffice.Office.UI" + xml:lang="en-US"> + <info> + <author>Andre Fischer</author> + <desc>Specification of decks and content panels of the sidebar.</desc> + </info> + <templates> + <group oor:name="Deck"> + <info> + <desc>Specification of a sidebar deck which is a container of content panels.</desc> + </info> + <prop oor:name="Title" oor:type="xs:string" oor:localized="true"> + <info> + <desc>The deck title is displayed above the content panels.</desc> + </info> + <value></value> + </prop> + <prop oor:name="Id" oor:type="xs:string" oor:localized="false"> + <info> + <desc>Internally used to identify the deck. Not displayed in the UI.</desc> + </info> + <value></value> + </prop> + <prop oor:name="IconURL" oor:type="xs:string"> + <info> + <desc>This icon is displayed in the sidebar tab bar. + Any URL scheme supported by the com.sun.star.graphic.GraphicProvider service is suitable here.</desc> + </info> + <value></value> + </prop> + <prop oor:name="HighContrastIconURL" oor:type="xs:string"> + <info> + <desc>This icon is displayed in the sidebar tab bar when high contrast mode is active. + Any URL scheme supported by the com.sun.star.graphic.GraphicProvider service is suitable here.</desc> + </info> + <value></value> + </prop> + <prop oor:name="HelpURL" oor:type="xs:string"> + <info> + <desc>Help about the sidebar deck.</desc> + </info> + <value></value> + </prop> + <prop oor:name="ContextList" oor:type="oor:string-list"> + <info><desc> + List of context descriptors. Each context descriptor is a string that contains four comma + separated values (note that values are case sensitive): + 1 Application name. Valid values are + com.sun.star.text.TextDocument + com.sun.star.sheet.SpreadsheetDocument + com.sun.star.presentation.PresentationDocument + com.sun.star.drawing.DrawingDocument + + Recognized shortcuts: + Writer + Calc + Impress + Draw + + Shortcuts for multiple applications: + DrawImpress + WriterAndWeb + These shortcuts exist for even more convenience and handle the frequent case of Draw + and Impress as well as Writer and WriterWeb having otherwise identical context descriptions. + + Special values: + any + none + + 2 Context name + Know context names are 3DObject, Annotation, Auditing, Cell, Chart, Draw, DrawPage, DrawText, + EditCell, Form, Frame, Graphic, HandoutPage, MasterPage, Media, Multiobj, OLE, OutlineText, + Pivot, SlidesorterPage, Table, Text, TextObject, + default + + Special values: + any + + 3 Panel state. One of + visible Panel is initially visible and expanded + hidden Panel is initially collapsed, ie only its title bar is visible + + 4 (Optional, only used for panels) UNO command that overrides the DefaultMenuCommand. Use + the special value none to override the DefaultMenuCommand to the empty string and thereby + disable the showing of a) the menu button in the panel titlebar and b) the showing of a dialog. + </desc></info> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <info> + <desc>Index used for ordering decks in the tab bar. Smaller values correspond to positions nearer to the top of the tab bar.</desc> + </info> + <value>10000</value> + </prop> + </group> + <group oor:name="Panel"> + <info> + <desc>Specification of a sidebar content panel.</desc> + </info> + <prop oor:name="Title" oor:type="xs:string" oor:localized="true"> + <info> + <desc>The panel title is displayed above the content panel.</desc> + </info> + <value></value> + </prop> + <prop oor:name="TitleBarIsOptional" oor:type="xs:boolean"> + <info> + <desc>When true then the title bar can be ommitted when the panel is the only panel in a deck.</desc> + </info> + <value>false</value> + </prop> + <prop oor:name="Id" oor:type="xs:string" oor:localized="false"> + <info> + <desc>Internally used to identify the panel.</desc> + </info> + <value></value> + </prop> + <prop oor:name="DeckId" oor:type="xs:string" oor:localized="false"> + <info> + <desc>Id of the deck to which the panel belongs.</desc> + </info> + <value></value> + </prop> + <prop oor:name="HelpURL" oor:type="xs:string"> + <info> + <desc>Help about the sidebar content panel.</desc> + </info> + <value></value> + </prop> + <prop oor:name="DefaultMenuCommand" oor:type="xs:string"> + <info><desc> + The default UNO command to execute when the user clicks on the menu button in the panel title bar. + Can be overriden in the ContextList to provide context dependent menu dialogs. + When empty then the menu icon is not shown in the panel title bar. + </desc></info> + <value></value> + </prop> + <prop oor:name="ContextList" oor:type="oor:string-list"> + <info> + <desc>For documentation, please see the Deck/ContextList.</desc> + </info> + </prop> + <prop oor:name="ImplementationURL" oor:type="xs:string"> + <info> + <desc>URL by which the implementation of the panel is known by its factory.</desc> + </info> + <value></value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <info> + <desc>Index used for ordering panels inside a deck. Smaller values correspond to positions nearer to the top of the deck.</desc> + </info> + <value>10000</value> + </prop> + <prop oor:name="WantsCanvas" oor:type="xs:boolean"> + <info> + <desc>Experimental: Set to true when panel wants to paint its content via a XCanvas.</desc> + </info> + <value>false</value> + </prop> + </group> + </templates> + <component> + <group oor:name="Content"> + <info> + <desc>Description of the decks and panels that can be displayed in the content area of the sidebar.</desc> + </info> + <set oor:name="DeckList" oor:node-type="Deck"> + <info> + <desc>Contains all registered sidebar decks.</desc> + </info> + </set> + <set oor:name="PanelList" oor:node-type="Panel"> + <info> + <desc>Contains all registered sidebar content panels.</desc> + </info> + </set> + </group> + </component> +</oor:component-schema> diff --git a/postprocess/CustomTarget_registry.mk b/postprocess/CustomTarget_registry.mk index b84859bcd934..fa2b1399848c 100644 --- a/postprocess/CustomTarget_registry.mk +++ b/postprocess/CustomTarget_registry.mk @@ -194,6 +194,7 @@ postprocess_FILES_main := \ $(postprocess_XCS)/Office/UI/GenericCategories.xcs \ $(postprocess_XCS)/Office/UI/GenericCommands.xcs \ $(postprocess_XCS)/Office/UI/GlobalSettings.xcs \ + $(postprocess_XCS)/Office/UI/Sidebar.xcs \ $(postprocess_XCS)/Office/UI/StartModuleCommands.xcs \ $(postprocess_XCS)/Office/UI/StartModuleWindowState.xcs \ $(postprocess_XCS)/Office/UI/WindowContentFactories.xcs \ @@ -257,6 +258,7 @@ postprocess_FILES_main := \ $(postprocess_XCU)/Office/UI/Factories.xcu \ $(postprocess_XCU)/Office/UI/GenericCategories.xcu \ $(postprocess_XCU)/Office/UI/GenericCommands.xcu \ + $(postprocess_XCU)/Office/UI/Sidebar.xcu \ $(postprocess_XCU)/Office/UI/StartModuleCommands.xcu \ $(postprocess_XCU)/Office/UI/StartModuleWindowState.xcu \ $(postprocess_XCU)/Office/UI.xcu \ diff --git a/sc/AllLangResTarget_sc.mk b/sc/AllLangResTarget_sc.mk index 8a486378b580..dbfcd2b4e555 100644 --- a/sc/AllLangResTarget_sc.mk +++ b/sc/AllLangResTarget_sc.mk @@ -84,6 +84,9 @@ $(eval $(call gb_SrsTarget_add_files,sc/res,\ sc/source/ui/miscdlgs/acredlin.src \ sc/source/ui/formdlg/formdlgs.src \ sc/source/ui/formdlg/dwfunctr.src \ + sc/source/ui/sidebar/AlignmentPropertyPanel.src \ + sc/source/ui/sidebar/CellAppearancePropertyPanel.src \ + sc/source/ui/sidebar/NumberFormatPropertyPanel.src \ sc/source/core/src/compiler.src \ )) diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk index 2903aa67525d..9383e30b721c 100644 --- a/sc/Library_sc.mk +++ b/sc/Library_sc.mk @@ -439,6 +439,16 @@ $(eval $(call gb_Library_add_exception_objects,sc,\ sc/source/ui/navipi/scenwnd \ sc/source/ui/pagedlg/areasdlg \ sc/source/ui/pagedlg/tphfedit \ + sc/source/ui/sidebar/AlignmentPropertyPanel \ + sc/source/ui/sidebar/CellLineStyleControl \ + sc/source/ui/sidebar/CellLineStylePopup \ + sc/source/ui/sidebar/CellLineStyleValueSet \ + sc/source/ui/sidebar/CellBorderUpdater \ + sc/source/ui/sidebar/CellAppearancePropertyPanel \ + sc/source/ui/sidebar/CellBorderStyleControl \ + sc/source/ui/sidebar/CellBorderStylePopup \ + sc/source/ui/sidebar/NumberFormatPropertyPanel \ + sc/source/ui/sidebar/ScPanelFactory \ sc/source/ui/undo/areasave \ sc/source/ui/undo/refundo \ sc/source/ui/undo/target \ diff --git a/sc/inc/ScPanelFactory.hxx b/sc/inc/ScPanelFactory.hxx new file mode 100644 index 000000000000..bb84705f8d5b --- /dev/null +++ b/sc/inc/ScPanelFactory.hxx @@ -0,0 +1,66 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SC_SIDEBAR_PANEL_FACTORY_HXX +#define SC_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 sc { namespace sidebar { + +namespace +{ + typedef ::cppu::WeakComponentImplHelper1 < + css::ui::XUIElementFactory + > PanelFactoryInterfaceBase; +} + + +class ScPanelFactory + : 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); + + ScPanelFactory(void); + virtual ~ScPanelFactory(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 sc::sidebar + +#endif diff --git a/sc/inc/helpids.h b/sc/inc/helpids.h index 5a3d02894615..3eff53e0dad1 100644 --- a/sc/inc/helpids.h +++ b/sc/inc/helpids.h @@ -313,6 +313,74 @@ #define HID_MN_FORMAT_ALGN "SC_HID_MN_FORMAT_ALGN" #define HID_MN_FORMAT_LINESPACE "SC_HID_MN_FORMAT_LINESPACE" +// sidebar ----------------------------------------- +// AlignmentPropertyPanel ----------------------------------------- +#define HID_PROPERTYPANEL_SC_ALIGN_SECTION "SC_HID_PROPERTYPANEL_SC_ALIGN_SECTION" +#define HID_PROPERTY_PANEL_ALIGN_TBX_HOR "SC_HID_PROPERTY_PANEL_ALIGN_TBX_HOR" +#define HID_PROPERTY_PANEL_ALIGN_TBI_HOR_L "SC_HID_PROPERTY_PANEL_ALIGN_TBI_HOR_L" +#define HID_PROPERTY_PANEL_ALIGN_TBI_HOR_C "SC_HID_PROPERTY_PANEL_ALIGN_TBI_HOR_C" +#define HID_PROPERTY_PANEL_ALIGN_TBI_HOR_R "SC_HID_PROPERTY_PANEL_ALIGN_TBI_HOR_R" +#define HID_PROPERTY_PANEL_ALIGN_TBI_HOR_J "SC_HID_PROPERTY_PANEL_ALIGN_TBI_HOR_J" +#define HID_PROPERTY_PANEL_ALIGN_TBX_VER "SC_HID_PROPERTY_PANEL_ALIGN_TBX_VER" +#define HID_PROPERTY_PANEL_ALIGN_TBI_VER_T "SC_HID_PROPERTY_PANEL_ALIGN_TBI_VER_T" +#define HID_PROPERTY_PANEL_ALIGN_TBI_VER_C "SC_HID_PROPERTY_PANEL_ALIGN_TBI_VER_C" +#define HID_PROPERTY_PANEL_ALIGN_TBI_VER_B "SC_HID_PROPERTY_PANEL_ALIGN_TBI_VER_B" +#define HID_PROPERTY_PANEL_ALIGN_MBX_INDENT "SC_HID_PROPERTY_PANEL_ALIGN_MBX_INDENT" +#define HID_PROPERTY_PANEL_ALIGN_CBX_WRAP "SC_HID_PROPERTY_PANEL_ALIGN_CBX_WRAP" +#define HID_PROPERTY_PANEL_ALIGN_CBX_MERGE "SC_HID_PROPERTY_PANEL_ALIGN_CBX_MERGE" +#define HID_PROPERTY_PANEL_ALIGN_MBX_ANGLE "SC_HID_PROPERTY_PANEL_ALIGN_MBX_ANGLE" +#define HID_PROPERTY_PANEL_ALIGN_DIAL_CONTROL "SC_HID_PROPERTY_PANEL_ALIGN_DIAL_CONTROL" +#define HID_PROPERTY_PANEL_ALIGN_CBX_VERT "SC_HID_PROPERTY_PANEL_ALIGN_CBX_VERT" + +// CellAppearancePropertyPanel ----------------------------------------- +#define HID_PROPERTYPANEL_SC_CELL_SECTION "SC_HID_PROPERTYPANEL_SC_CELL_SECTION" +#define HID_PROPERTYPANEL_SC_TBX_BKCOLOR "SC_HID_PROPERTYPANEL_SC_TBX_BKCOLOR" +#define HID_PROPERTYPANEL_SC_TBI_BKCOLOR "SC_HID_PROPERTYPANEL_SC_TBI_BKCOLOR" +#define HID_PROPERTYPANEL_SC_TBX_BORDER "SC_HID_PROPERTYPANEL_SC_TBX_BORDER" +#define HID_PROPERTYPANEL_SC_TBI_BORDER "SC_HID_PROPERTYPANEL_SC_TBI_BORDER" +#define HID_PROPERTYPANEL_SC_TBX_STYLE "SC_HID_PROPERTYPANEL_SC_TBX_STYLE" +#define HID_PROPERTYPANEL_SC_TBI_STYLE "SC_HID_PROPERTYPANEL_SC_TBI_STYLE" +#define HID_PROPERTYPANEL_SC_TBX_LINECOLOR "SC_HID_PROPERTYPANEL_SC_TBX_LINECOLOR" +#define HID_PROPERTYPANEL_SC_TBI_LINECOLOR "SC_HID_PROPERTYPANEL_SC_TBI_LINECOLOR" +#define HID_PROPERTYPANEL_SC_CBOX_SHOWGRID "SC_HID_PROPERTYPANEL_SC_CBOX_SHOWGRID" +#define HID_PROPERTYPANEL_FILL_COLOR_VS "SC_HID_PROPERTYPANEL_FILL_COLOR_VS" +#define HID_PROPERTYPANEL_LINE_COLOR_VS "SC_HID_PROPERTYPANEL_LINE_COLOR_VS" +#define HID_PROPERTYPANEL_SC_STYLE_VS "SC_HID_PROPERTYPANEL_SC_STYLE_VS" +#define HID_PROPERTYPANEL_SC_STYLE_PB "SC_HID_PROPERTYPANEL_SC_STYLE_PB" +#define HID_PROPERTYPANEL_SC_BORDER1_TBX "SC_HID_PROPERTYPANEL_SC_BORDER1_TBX" +#define HID_PROPERTYPANEL_SC_BORDER_TBI_NONE "SC_HID_PROPERTYPANEL_SC_BORDER_TBI_NONE" +#define HID_PROPERTYPANEL_SC_BORDER_TBI_ALL "SC_HID_PROPERTYPANEL_SC_BORDER_TBI_ALL" +#define HID_PROPERTYPANEL_SC_BORDER_TBI_OUTER "SC_HID_PROPERTYPANEL_SC_BORDER_TBI_OUTER" +#define HID_PROPERTYPANEL_SC_BORDER_TBI_OUTERBOLD "SC_HID_PROPERTYPANEL_SC_BORDER_TBI_OUTERBOLD" +#define HID_PROPERTYPANEL_SC_BORDER2_TBX "SC_HID_PROPERTYPANEL_SC_BORDER2_TBX" +#define HID_PROPERTYPANEL_SC_BORDER3_TBX "SC_HID_PROPERTYPANEL_SC_BORDER3_TBX" +#define HID_PROPERTYPANEL_SC_BORDER_TBI_S1 "SC_HID_PROPERTYPANEL_SC_BORDER_TBI_S1" +#define HID_PROPERTYPANEL_SC_BORDER_TBI_S2 "SC_HID_PROPERTYPANEL_SC_BORDER_TBI_S2" +#define HID_PROPERTYPANEL_SC_BORDER_TBI_S3 "SC_HID_PROPERTYPANEL_SC_BORDER_TBI_S3" +#define HID_PROPERTYPANEL_SC_BORDER_TBI_S4 "SC_HID_PROPERTYPANEL_SC_BORDER_TBI_S4" +#define HID_PROPERTYPANEL_SC_BORDER_TBI_LEFT "SC_HID_PROPERTYPANEL_SC_BORDER_TBI_LEFT" +#define HID_PROPERTYPANEL_SC_BORDER_TBI_RIGHT "SC_HID_PROPERTYPANEL_SC_BORDER_TBI_RIGHT" +#define HID_PROPERTYPANEL_SC_BORDER_TBI_TOP "SC_HID_PROPERTYPANEL_SC_BORDER_TBI_TOP" +#define HID_PROPERTYPANEL_SC_BORDER_TBI_BOT "SC_HID_PROPERTYPANEL_SC_BORDER_TBI_BOT" +#define HID_PROPERTYPANEL_SC_BORDER_TBI_BLTR "SC_HID_PROPERTYPANEL_SC_BORDER_TBI_BLTR" +#define HID_PROPERTYPANEL_SC_BORDER_TBI_TLBR "SC_HID_PROPERTYPANEL_SC_BORDER_TBI_TLBR" +#define HID_PROPERTYPANEL_SC_BORDER_TBI_TOPBOT "SC_HID_PROPERTYPANEL_SC_BORDER_TBI_TOPBOT" +#define HID_PROPERTYPANEL_SC_BORDER_TBI_LEFTRIGHT "SC_HID_PROPERTYPANEL_SC_BORDER_TBI_LEFTRIGHT" + +// NumberFormatPropertyPanel ----------------------------------------- +#define HID_PROPERTYPANEL_SC_NUM_SECTION "SC_HID_PROPERTYPANEL_SC_NUM_SECTION" +#define HID_PROPERTY_PANEL_NUMFMT_LB_CATEGORY "SC_HID_PROPERTY_PANEL_NUMFMT_LB_CATEGORY" +#define HID_PROPERTY_PANEL_NUMFMT_TBX_CATEGORY "SC_HID_PROPERTY_PANEL_NUMFMT_TBX_CATEGORY" +#define HID_PROPERTY_PANEL_NUMFMT_ID_NUMBER "SC_HID_PROPERTY_PANEL_NUMFMT_ID_NUMBER" +#define HID_PROPERTY_PANEL_NUMFMT_ID_PERCENT "SC_HID_PROPERTY_PANEL_NUMFMT_ID_PERCENT" +#define HID_PROPERTY_PANEL_NUMFMT_ID_CURRENCY "SC_HID_PROPERTY_PANEL_NUMFMT_ID_CURRENCY" +#define HID_PROPERTY_PANEL_NUMFMT_ID_DATE "SC_HID_PROPERTY_PANEL_NUMFMT_ID_DATE" +#define HID_PROPERTY_PANEL_NUMFMT_ID_TEXT "SC_HID_PROPERTY_PANEL_NUMFMT_ID_TEXT" +#define HID_PROPERTY_PANEL_NUMFMT_ED_DECIMALS "SC_HID_PROPERTY_PANEL_NUMFMT_ED_DECIMALS" +#define HID_PROPERTY_PANEL_NUMFMT_ED_LEADZEROES "SC_HID_PROPERTY_PANEL_NUMFMT_ED_LEADZEROES" +#define HID_PROPERTY_PANEL_NUMFMT_BTN_NEGRED "SC_HID_PROPERTY_PANEL_NUMFMT_BTN_NEGRED" +#define HID_PROPERTY_PANEL_NUMFMT_BTN_THOUSAND "SC_HID_PROPERTY_PANEL_NUMFMT_BTN_THOUSAND" + // Ende Hilfe IDs ------------------------------------------------------------ #define HID_FUNC_DBANZAHL "SC_HID_FUNC_DBANZAHL" diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc index 23a5088df562..c18cbcdc1d5e 100644 --- a/sc/inc/sc.hrc +++ b/sc/inc/sc.hrc @@ -41,6 +41,8 @@ // SC_FUNCTION_END (SID_SC_START + 299) #define SC_PARAM_START (SID_SC_START + 300) // SC_PARAM_END (SID_SC_START + 399) +#define SC_SIDEBAR_PROPERTY_BEGIN (SID_SC_START + 400) +// SC_SIDEBAR_PROPERTY_END (SID_SC_START + 499) // stay compatible to the past #define SC_RESOURCE_START (RID_APP_START+5000) @@ -654,6 +656,11 @@ #define SID_SORT_USERDEF (SC_PARAM_START+4) #define SID_SORT_NATURALSORT (SC_PARAM_START+5) +// Sidebar ------------------------------------------------------------- + +#define SID_SCGRIDSHOW (SC_SIDEBAR_PROPERTY_BEGIN+1) +#define SID_NUMBER_TYPE_FORMAT (SC_SIDEBAR_PROPERTY_BEGIN+2) + // resources #define RID_OBJECTBAR_APP (SC_RESOURCE_START) @@ -1089,7 +1096,18 @@ #define RID_SCDLG_COND_FORMAT_MANAGER (SC_DIALOGS_START + 159) #define RID_SCDLG_XML_SOURCE (SC_DIALOGS_START + 160) -#define SC_DIALOGS_END (SC_DIALOGS_START + 161) +// defines for AlignmentPropertyPanel +#define RID_PROPERTYPANEL_SC_ALIGNMENT (SC_DIALOGS_START + 161) + +// defines for CellAppearancePropertyPanel +#define RID_PROPERTYPANEL_SC_APPEAR (SC_DIALOGS_START + 162) +#define RID_POPUPPANEL_CELLAPPEARANCE_FILLCOLOR (SC_DIALOGS_START + 163) +#define RID_POPUPPANEL_CELLAPPEARANCE_LINECOLOR (SC_DIALOGS_START + 164) +#define RID_POPUPPANEL_APPEARANCE_CELL_LINESTYLE (SC_DIALOGS_START + 165) +#define RID_POPUPPANEL_APPEARANCE_CELL_BORDERSTYLE (SC_DIALOGS_START + 166) +#define RID_PROPERTYPANEL_SC_NUMBERFORMAT (SC_DIALOGS_START + 167) + +#define SC_DIALOGS_END (RID_PROPERTYPANEL_SC_NUMBERFORMAT+1) #ifndef STD_MASKCOLOR #define STD_MASKCOLOR Color { Red = 0xFF00; Green = 0x0000; Blue = 0xFF00; } diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi index 7d8bfb14b8ab..4f9fe32f9f60 100644 --- a/sc/sdi/cellsh.sdi +++ b/sc/sdi/cellsh.sdi @@ -87,6 +87,8 @@ interface CellSelection SID_SELECT_SCENARIO [ ExecMethod = ExecuteEdit; StateMethod = GetState; ] FID_CELL_FORMAT [ ExecMethod = Execute; StateMethod = GetBlockState; ] SID_ENABLE_HYPHENATION [ ExecMethod = Execute; StateMethod = GetBlockState; ] + SID_CELL_FORMAT_BORDER [ ExecMethod = Execute; ] + SID_CHAR_DLG_EFFECT [ ExecMethod = Execute; ] FID_ROW_HEIGHT [ ExecMethod = Execute; StateMethod = GetState; ] FID_ROW_OPT_HEIGHT [ ExecMethod = Execute; StateMethod = GetState; ] FID_ROW_HIDE [ ExecMethod = Execute; StateMethod = GetState; ] diff --git a/sc/sdi/drawsh.sdi b/sc/sdi/drawsh.sdi index ff8cd359d722..444e2d0cac97 100644 --- a/sc/sdi/drawsh.sdi +++ b/sc/sdi/drawsh.sdi @@ -61,6 +61,7 @@ interface TableDraw SID_BITMAP_LIST [ StateMethod = GetDrawAttrState; Export = FALSE; ] SID_DASH_LIST [ StateMethod = GetDrawAttrState; Export = FALSE; ] SID_LINEEND_LIST [ StateMethod = GetDrawAttrState; Export = FALSE; ] + // Flaechen-Attribute SID_ATTR_FILL_STYLE [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawAttrState; Export = FALSE; ] @@ -76,15 +77,37 @@ interface TableDraw SID_ATTR_FILL_GRADIENT [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawAttrState; Export = FALSE; ] SID_ATTR_FILL_HATCH [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawAttrState; Export = FALSE; ] SID_ATTR_FILL_BITMAP [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawAttrState; Export = FALSE; ] + SID_ATTR_FILL_TRANSPARENCE [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawAttrState; Export = FALSE; ] + SID_ATTR_FILL_FLOATTRANSPARENCE [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawAttrState; Export = FALSE; ] + // ---- Linien-Attribute: SID_ATTR_LINE_STYLE [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawAttrState; Export = FALSE; ] SID_ATTR_LINEEND_STYLE [ ExecMethod = ExecDrawAttr; StateMethod = GetAttrFuncState; Export = FALSE; ] + SID_ATTR_LINE_START [ ExecMethod = ExecDrawAttr; StateMethod = GetAttrFuncState; Export = FALSE; ] + SID_ATTR_LINE_END [ ExecMethod = ExecDrawAttr; StateMethod = GetAttrFuncState; Export = FALSE; ] SID_ATTR_LINE_DASH [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawAttrState; Export = FALSE; ] SID_ATTR_LINE_WIDTH [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawAttrState; Export = FALSE; ] SID_ATTR_LINE_COLOR [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawAttrState; Export = FALSE; ] + SID_ATTR_LINE_TRANSPARENCE [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawAttrState; Export = FALSE; ] + SID_ATTR_LINE_JOINT [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawAttrState; Export = FALSE; ] + SID_ATTR_LINE_CAP [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawAttrState; Export = FALSE; ] SID_ATTRIBUTES_AREA [ ExecMethod = ExecDrawAttr; StateMethod = GetAttrFuncState; Export = FALSE; ] SID_ATTRIBUTES_LINE [ ExecMethod = ExecDrawAttr; StateMethod = GetAttrFuncState; Export = FALSE; ] SID_ATTR_TRANSFORM [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawFuncState; Export = FALSE; ] + + // For the sidebar + SID_ATTR_TRANSFORM_WIDTH [ StateMethod = GetDrawAttrStateForIFBX; Export = FALSE; ] + SID_ATTR_TRANSFORM_HEIGHT [ StateMethod = GetDrawAttrStateForIFBX; Export = FALSE; ] + SID_ATTR_TRANSFORM_POS_X [ StateMethod = GetDrawAttrStateForIFBX; Export = FALSE; ] + SID_ATTR_TRANSFORM_POS_Y [ StateMethod = GetDrawAttrStateForIFBX; Export = FALSE; ] + SID_ATTR_TRANSFORM_ANGLE [ StateMethod = GetDrawAttrStateForIFBX; Export = FALSE; ] + SID_ATTR_TRANSFORM_ROT_X [ StateMethod = GetDrawAttrStateForIFBX; Export = FALSE; ] + SID_ATTR_TRANSFORM_ROT_Y [ StateMethod = GetDrawAttrStateForIFBX; Export = FALSE; ] + SID_ATTR_TRANSFORM_PROTECT_POS [ StateMethod = GetDrawAttrStateForIFBX; Export = FALSE; ] + SID_ATTR_TRANSFORM_PROTECT_SIZE [ StateMethod = GetDrawAttrStateForIFBX; Export = FALSE; ] + SID_ATTR_TRANSFORM_AUTOWIDTH [ StateMethod = GetDrawAttrStateForIFBX; Export = FALSE; ] + SID_ATTR_TRANSFORM_AUTOHEIGHT [ StateMethod = GetDrawAttrStateForIFBX; Export = FALSE; ] + // ---- Ausrichtungs - Funktionen: //! PseudoSlots gibt Aerger mit Referenz-Dialogen ??? SID_OBJECT_ALIGN @@ -159,6 +182,8 @@ interface TableDraw ] */ SID_MIRROR_VERTICAL [ ExecMethod = ExecDrawFunc; StateMethod = GetDrawFuncState; Export = FALSE; ] + SID_FLIP_HORIZONTAL [ ExecMethod = ExecDrawFunc; StateMethod = GetDrawFuncState; Export = FALSE; ] + SID_FLIP_VERTICAL [ ExecMethod = ExecDrawFunc; StateMethod = GetDrawFuncState; Export = FALSE; ] SID_ANCHOR_PAGE [ ExecMethod = ExecDrawFunc; StateMethod = GetState; Export = FALSE; ] SID_ANCHOR_TOGGLE [ ExecMethod = ExecDrawFunc; StateMethod = GetDrawFuncState; Export = FALSE; ] SID_ANCHOR_CELL [ ExecMethod = ExecDrawFunc; StateMethod = GetState; Export = FALSE; ] diff --git a/sc/sdi/drtxtob.sdi b/sc/sdi/drtxtob.sdi index ebc091264133..41854b947052 100644 --- a/sc/sdi/drtxtob.sdi +++ b/sc/sdi/drtxtob.sdi @@ -80,12 +80,23 @@ interface TableDrawText SID_ALIGNCENTERHOR [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ] SID_ALIGNRIGHT [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ] SID_ALIGNBLOCK [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ] + + SID_ATTR_PARA_ADJUST_LEFT [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ] + SID_ATTR_PARA_ADJUST_CENTER [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ] + SID_ATTR_PARA_ADJUST_RIGHT [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ] + SID_ATTR_PARA_ADJUST_BLOCK [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ] + SID_ATTR_PARA_LRSPACE [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ] + SID_ATTR_PARA_LINESPACE [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ] + SID_ATTR_PARA_ULSPACE [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ] + SID_ATTR_PARA_LINESPACE_10 [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ] SID_ATTR_PARA_LINESPACE_15 [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ] SID_ATTR_PARA_LINESPACE_20 [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ] SID_SET_SUPER_SCRIPT [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ] SID_SET_SUB_SCRIPT [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ] + SID_ATTR_CHAR_KERNING [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ] SID_CHAR_DLG [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ] + SID_CHAR_DLG_EFFECT [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ] SID_PARA_DLG [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ] // ---- FontWork: SID_FONTWORK [ ExecMethod = ExecuteExtra; StateMethod = GetState; Export = FALSE; ] @@ -130,6 +141,10 @@ interface TableDrawText SID_TRANSLITERATE_FULLWIDTH [ ExecMethod = ExecuteTrans; StateMethod = GetState; Export = FALSE; ] SID_TRANSLITERATE_HIRAGANA [ ExecMethod = ExecuteTrans; StateMethod = GetState; Export = FALSE; ] SID_TRANSLITERATE_KATAGANA [ ExecMethod = ExecuteTrans; StateMethod = GetState; Export = FALSE; ] + + SID_TABLE_VERT_NONE [ExecMethod = ExecuteAttr ;StateMethod = GetStatePropPanelAttr ;] + SID_TABLE_VERT_CENTER [ExecMethod = ExecuteAttr ;StateMethod = GetStatePropPanelAttr ;] + SID_TABLE_VERT_BOTTOM [ExecMethod = ExecuteAttr ;StateMethod = GetStatePropPanelAttr ;] } diff --git a/sc/sdi/editsh.sdi b/sc/sdi/editsh.sdi index adfb8f7240b3..33e297ae1dfe 100644 --- a/sc/sdi/editsh.sdi +++ b/sc/sdi/editsh.sdi @@ -64,8 +64,10 @@ interface TableText SID_ATTR_CHAR_CONTOUR [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ] SID_SET_SUPER_SCRIPT [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ] SID_SET_SUB_SCRIPT [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ] + SID_ATTR_CHAR_KERNING [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ] SID_CELL_FORMAT_RESET [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] SID_CHAR_DLG [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] + SID_CHAR_DLG_EFFECT [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] SID_TOGGLE_REL [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] SID_HYPERLINK_SETLINK [ ExecMethod = Execute; Export = FALSE; ] diff --git a/sc/sdi/formatsh.sdi b/sc/sdi/formatsh.sdi index abdd5e79d2e8..bbdf09942170 100644 --- a/sc/sdi/formatsh.sdi +++ b/sc/sdi/formatsh.sdi @@ -69,6 +69,7 @@ interface FormatForSelection SID_ATTR_ALIGN_INDENT [ ExecMethod = ExecuteAlignment; StateMethod = GetAttrState; ] SID_ATTR_ALIGN_HYPHENATION [ ExecMethod = ExecuteAlignment; StateMethod = GetAttrState; ] SID_ATTR_ALIGN_DEGREES [ ExecMethod = ExecuteAlignment; StateMethod = GetAttrState; ] + SID_ATTR_ALIGN_STACKED [ ExecMethod = ExecuteAlignment; StateMethod = GetAttrState; ] SID_ATTR_ALIGN_LOCKPOS [ ExecMethod = ExecuteAlignment; StateMethod = GetAttrState; ] SID_ATTR_ALIGN_MARGIN [ ExecMethod = ExecuteAlignment; StateMethod = GetAttrState; ] @@ -98,6 +99,7 @@ interface FormatForSelection SID_ALIGNCENTERVER [ ExecMethod = ExecuteTextAttr; StateMethod = GetTextAttrState; ] SID_ALIGNBLOCK [ ExecMethod = ExecuteTextAttr; StateMethod = GetTextAttrState; ] SID_ALIGNCENTERHOR [ ExecMethod = ExecuteTextAttr; StateMethod = GetTextAttrState; ] + SID_SCGRIDSHOW [ ExecMethod = ExecViewOptions; StateMethod = GetViewOptions; ] SID_V_ALIGNCELL [ ExecMethod = ExecuteAlignment; StateMethod = GetAlignState; ] SID_H_ALIGNCELL [ ExecMethod = ExecuteAlignment; StateMethod = GetAlignState; ] @@ -121,6 +123,8 @@ interface FormatForSelection SID_NUMBER_INCDEC [ ExecMethod = ExecuteNumFormat;] SID_NUMBER_DECDEC [ ExecMethod = ExecuteNumFormat;] + SID_NUMBER_TYPE_FORMAT [ ExecMethod = ExecuteNumFormat;StateMethod = GetNumFormatState; ] + SID_ATTR_BORDER [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; ] //XXX SID_ATTR_BORDER_INNER [ StateMethod = GetBorderState; ] // status() SID_ATTR_BORDER_OUTER [ ExecMethod = ExecuteAttr; StateMethod = GetBorderState; ] @@ -128,6 +132,8 @@ interface FormatForSelection SID_ATTR_ALIGN_LINEBREAK [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; ] SID_FRAME_LINESTYLE [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; ] SID_FRAME_LINECOLOR [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; ] + SID_ATTR_BORDER_DIAG_TLBR [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; ] + SID_ATTR_BORDER_DIAG_BLTR [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; ] SID_FORMATPAINTBRUSH [ ExecMethod = ExecFormatPaintbrush; StateMethod = StateFormatPaintbrush; ] } diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi index 27803019b573..7328e86f07c3 100644 --- a/sc/sdi/scalc.sdi +++ b/sc/sdi/scalc.sdi @@ -8487,3 +8487,54 @@ SfxVoidItem ExportAsGraphic SID_EXPORT_AS_GRAPHIC ToolBoxConfig = TRUE, GroupId = GID_CHART; ] + +//-------------------------------------------------------------------------- +SfxBoolItem ViewOption SID_SCGRIDSHOW +[ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, //TRUE + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config */ + AccelConfig = FALSE, //TRUE + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, //FALSE + GroupId = GID_DATA; +] + +//-------------------------------------------------------------------------- +SfxUInt16Item NumberType SID_NUMBER_TYPE_FORMAT +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = TRUE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_VIEW; +] diff --git a/sc/source/core/data/docpool.cxx b/sc/source/core/data/docpool.cxx index 00ce7349d062..4954ac0e4412 100644 --- a/sc/source/core/data/docpool.cxx +++ b/sc/source/core/data/docpool.cxx @@ -179,7 +179,8 @@ static SfxItemInfo const aItemInfos[] = { SID_ATTR_PAGE_FOOTERSET, SFX_ITEM_POOLABLE }, // ATTR_PAGE_FOOTERSET { SID_SCATTR_PAGE_FORMULAS, SFX_ITEM_POOLABLE }, // ATTR_PAGE_FORMULAS { SID_SCATTR_PAGE_NULLVALS, SFX_ITEM_POOLABLE }, // ATTR_PAGE_NULLVALS - { SID_SCATTR_PAGE_SCALETO, SFX_ITEM_POOLABLE } // ATTR_PAGE_SCALETO + { SID_SCATTR_PAGE_SCALETO, SFX_ITEM_POOLABLE }, // ATTR_PAGE_SCALETO + { SID_SCGRIDSHOW, SFX_ITEM_POOLABLE } }; // ----------------------------------------------------------------------- diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx index bfdd175f62ce..7acd77e754e4 100644 --- a/sc/source/filter/excel/xiescher.cxx +++ b/sc/source/filter/excel/xiescher.cxx @@ -569,7 +569,7 @@ void XclImpDrawObjBase::ConvertLineStyle( SdrObject& rSdrObj, const XclObjLineDa long nLineWidth = 35 * ::std::min( rLineData.mnWidth, EXC_OBJ_LINE_THICK ); rSdrObj.SetMergedItem( XLineWidthItem( nLineWidth ) ); rSdrObj.SetMergedItem( XLineColorItem( EMPTY_STRING, GetPalette().GetColor( rLineData.mnColorIdx ) ) ); - rSdrObj.SetMergedItem( XLineJointItem( XLINEJOINT_MITER ) ); + rSdrObj.SetMergedItem( XLineJointItem( com::sun::star::drawing::LineJoint_MITER ) ); sal_uLong nDotLen = ::std::max< sal_uLong >( 70 * rLineData.mnWidth, 35 ); sal_uLong nDashLen = 3 * nDotLen; diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 9baa6cc36eda..0f6ce7228342 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -2367,6 +2367,12 @@ void ScInputHandler::InvalidateAttribs() rBindings.Invalidate( SID_ULINE_VAL_DOTTED ); rBindings.Invalidate( SID_HYPERLINK_GETLINK ); + + rBindings.Invalidate( SID_ATTR_CHAR_KERNING ); + rBindings.Invalidate( SID_SET_SUPER_SCRIPT ); + rBindings.Invalidate( SID_SET_SUB_SCRIPT ); + rBindings.Invalidate( SID_ATTR_CHAR_STRIKEOUT ); + rBindings.Invalidate( SID_ATTR_CHAR_SHADOWED ); } } diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx index 9ed0e3ac069b..897a59f2e077 100644 --- a/sc/source/ui/app/scdll.cxx +++ b/sc/source/ui/app/scdll.cxx @@ -26,6 +26,7 @@ #include <comphelper/classids.hxx> #include <sfx2/taskpane.hxx> +#include <sfx2/sidebar/SidebarChildWindow.hxx> #include <sfx2/docfilt.hxx> #include <sfx2/fcontnr.hxx> #include <sfx2/docfile.hxx> @@ -228,6 +229,7 @@ void ScDLL::Init() // common SFX controller ::sfx2::TaskPaneWrapper::RegisterChildWindow( false, pMod ); + ::sfx2::sidebar::SidebarChildWindow::RegisterChildWindow(false, pMod); // Svx-StatusBar-Controller SvxInsertStatusBarControl ::RegisterControl(SID_ATTR_INSERT, pMod); diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index ac3daadc55fa..5a5747965646 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -1108,7 +1108,10 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet ) } SetViewOptions( rNewOpt ); if (pBindings) + { pBindings->Invalidate(SID_HELPLINES_MOVE); + pBindings->Invalidate(SID_SCGRIDSHOW); + } } //============================================ diff --git a/sc/source/ui/app/typemap.cxx b/sc/source/ui/app/typemap.cxx index 01f0ba78bf8e..12e20053b23a 100644 --- a/sc/source/ui/app/typemap.cxx +++ b/sc/source/ui/app/typemap.cxx @@ -75,12 +75,20 @@ #include <editeng/crossedoutitem.hxx> #include <editeng/formatbreakitem.hxx> #include <editeng/charreliefitem.hxx> +#include <editeng/lrspitem.hxx> +#include <editeng/lspcitem.hxx> +#include <editeng/ulspitem.hxx> +#include <editeng/kernitem.hxx> #include <svx/rotmodit.hxx> #include <svx/drawitem.hxx> #include <svl/ilstitem.hxx> #include <svl/globalnameitem.hxx> #include <svx/chrtitem.hxx> #include <svx/zoomslideritem.hxx> +#include <svx/xflftrit.hxx> +#include <svx/xlncapit.hxx> +#include <svx/xlinjoit.hxx> +#include <svx/AffineMatrixItem.hxx> // #i25616# #include <svx/sdshitm.hxx> diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 815dd1563fde..6e8cd1c81173 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -3898,6 +3898,11 @@ sal_Bool ScDocFunc::ChangeIndent( const ScMarkData& rMark, sal_Bool bIncrement, pBindings->Invalidate( SID_ALIGNRIGHT ); pBindings->Invalidate( SID_ALIGNBLOCK ); pBindings->Invalidate( SID_ALIGNCENTERHOR ); + pBindings->Invalidate( SID_ATTR_LRSPACE ); + pBindings->Invalidate( SID_ATTR_PARA_ADJUST_LEFT ); + pBindings->Invalidate( SID_ATTR_PARA_ADJUST_RIGHT ); + pBindings->Invalidate( SID_ATTR_PARA_ADJUST_BLOCK ); + pBindings->Invalidate( SID_ATTR_PARA_ADJUST_CENTER); // pseudo slots for Format menu pBindings->Invalidate( SID_ALIGN_ANY_HDEFAULT ); pBindings->Invalidate( SID_ALIGN_ANY_LEFT ); diff --git a/sc/source/ui/drawfunc/chartsh.cxx b/sc/source/ui/drawfunc/chartsh.cxx index c20f0ad0acd7..e84b1be9fd40 100644 --- a/sc/source/ui/drawfunc/chartsh.cxx +++ b/sc/source/ui/drawfunc/chartsh.cxx @@ -25,6 +25,7 @@ #include <sfx2/app.hxx> #include <sfx2/objface.hxx> #include <sfx2/request.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include <svl/whiter.hxx> #include <vcl/msgbox.hxx> @@ -58,6 +59,7 @@ ScChartShell::ScChartShell(ScViewData* pData) : { SetHelpId( HID_SCSHELL_CHARTSH ); SetName( OUString("ChartObject") ); + SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Chart)); } ScChartShell::~ScChartShell() @@ -100,5 +102,10 @@ void ScChartShell::ExecuteExportAsGraphic( SfxRequest& ) Invalidate(); } +void ScChartShell::HandleSelectionChange (void) +{ + // Do not call the implementation in the base class. Let + // Activate()/Deactivate() handle context switches. +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx index 3e8605c70827..5a675be518f6 100644 --- a/sc/source/ui/drawfunc/drawsh.cxx +++ b/sc/source/ui/drawfunc/drawsh.cxx @@ -46,6 +46,8 @@ #include <svx/svdobj.hxx> #include <svx/drawitem.hxx> #include <svx/xtable.hxx> +#include "tabvwsh.hxx" +#include <sfx2/bindings.hxx> #define ScDrawShell #include "scslots.hxx" @@ -125,14 +127,21 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq ) case SID_ATTR_LINE_STYLE: case SID_ATTR_LINEEND_STYLE: + case SID_ATTR_LINE_START: + case SID_ATTR_LINE_END: 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: case SID_ATTR_FILL_STYLE: case SID_ATTR_FILL_COLOR: 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: // #i25616# case SID_ATTR_FILL_SHADOW: @@ -146,6 +155,9 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq ) 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: ExecuteLineDlg( rReq ); break; @@ -154,6 +166,8 @@ void ScDrawShell::ExecDrawAttr( 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: // #i25616# case SID_ATTR_FILL_SHADOW: @@ -219,6 +233,7 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq ) break; case SID_ATTR_TRANSFORM: + { { if ( pView->AreObjectsMarked() ) { @@ -282,7 +297,20 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq ) pView->SetGeoAttrToMarked( *pArgs ); } } + + ScTabViewShell* pViewShell = pViewData->GetViewShell(); + SfxBindings& rBindings=pViewShell->GetViewFrame()->GetBindings(); + rBindings.Invalidate(SID_ATTR_TRANSFORM_WIDTH); + rBindings.Invalidate(SID_ATTR_TRANSFORM_HEIGHT); + rBindings.Invalidate(SID_ATTR_TRANSFORM_POS_X); + rBindings.Invalidate(SID_ATTR_TRANSFORM_POS_Y); + rBindings.Invalidate(SID_ATTR_TRANSFORM_ANGLE); + rBindings.Invalidate(SID_ATTR_TRANSFORM_ROT_X); + rBindings.Invalidate(SID_ATTR_TRANSFORM_ROT_Y); + rBindings.Invalidate(SID_ATTR_TRANSFORM_AUTOWIDTH); + rBindings.Invalidate(SID_ATTR_TRANSFORM_AUTOHEIGHT); break; + } default: break; diff --git a/sc/source/ui/drawfunc/drawsh2.cxx b/sc/source/ui/drawfunc/drawsh2.cxx index b161aeafa9d4..b63732ad792e 100644 --- a/sc/source/ui/drawfunc/drawsh2.cxx +++ b/sc/source/ui/drawfunc/drawsh2.cxx @@ -33,6 +33,8 @@ #include <svx/svdouno.hxx> #include <svx/extrusionbar.hxx> #include <svx/fontworkbar.hxx> +#include <svx/sidebar/SelectionChangeHandler.hxx> +#include <svx/sidebar/SelectionAnalyzer.hxx> #include "drawsh.hxx" #include "drawview.hxx" @@ -45,15 +47,23 @@ #include <svx/svdoole2.hxx> #include <svx/svdocapt.hxx> +#include <boost/bind.hpp> + + sal_uInt16 ScGetFontWorkId(); // in drtxtob using namespace com::sun::star; + //------------------------------------------------------------------ ScDrawShell::ScDrawShell( ScViewData* pData ) : SfxShell(pData->GetViewShell()), - pViewData( pData ) + pViewData( pData ), + mpSelectionChangeHandler(new svx::sidebar::SelectionChangeHandler( + ::boost::bind(&ScDrawShell::GetContextForSelection, this), + GetFrame()->GetFrame().GetController(), + sfx2::sidebar::EnumContext::Context_Cell)) { SetPool( &pViewData->GetScDrawView()->GetModel()->GetItemPool() ); ::svl::IUndoManager* pMgr = pViewData->GetSfxDocShell()->GetUndoManager(); @@ -64,10 +74,13 @@ ScDrawShell::ScDrawShell( ScViewData* pData ) : } SetHelpId( HID_SCSHELL_DRAWSH ); SetName(OUString("Drawing")); + + mpSelectionChangeHandler->Connect(); } ScDrawShell::~ScDrawShell() { + mpSelectionChangeHandler->Disconnect(); } void ScDrawShell::GetState( SfxItemSet& rSet ) // Zustaende / Toggles @@ -130,6 +143,8 @@ void ScDrawShell::GetDrawFuncState( SfxItemSet& rSet ) // Funktionen disabl { rSet.DisableItem( SID_MIRROR_HORIZONTAL ); rSet.DisableItem( SID_MIRROR_VERTICAL ); + rSet.DisableItem( SID_FLIP_HORIZONTAL ); + rSet.DisableItem( SID_FLIP_VERTICAL ); } const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); @@ -380,5 +395,22 @@ sal_Bool ScDrawShell::AreAllObjectsOnLayer(sal_uInt16 nLayerNo,const SdrMarkList return bResult; } +void ScDrawShell::GetDrawAttrStateForIFBX( SfxItemSet& rSet ) +{ + ScDrawView* pView = pViewData->GetScDrawView(); + const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); + + if( rMarkList.GetMark(0) != 0 ) + { + SfxItemSet aNewAttr(pView->GetGeoAttrFromMarked()); + rSet.Put(aNewAttr, sal_False); + } +} + +sfx2::sidebar::EnumContext::Context ScDrawShell::GetContextForSelection (void) +{ + return ::svx::sidebar::SelectionAnalyzer::GetContextForSelection_SC( + GetDrawView()->GetMarkedObjectList()); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/drawfunc/drawsh5.cxx b/sc/source/ui/drawfunc/drawsh5.cxx index 8a82fda696fc..61cc2358ad26 100644 --- a/sc/source/ui/drawfunc/drawsh5.cxx +++ b/sc/source/ui/drawfunc/drawsh5.cxx @@ -305,10 +305,14 @@ void ScDrawShell::ExecDrawFunc( SfxRequest& rReq ) break; case SID_MIRROR_HORIZONTAL: + case SID_FLIP_HORIZONTAL: pView->MirrorAllMarkedHorizontal(); + rBindings.Invalidate( SID_ATTR_TRANSFORM_ANGLE ); break; case SID_MIRROR_VERTICAL: + case SID_FLIP_VERTICAL: pView->MirrorAllMarkedVertical(); + rBindings.Invalidate( SID_ATTR_TRANSFORM_ANGLE ); break; case SID_OBJECT_ALIGN_LEFT: diff --git a/sc/source/ui/drawfunc/drformsh.cxx b/sc/source/ui/drawfunc/drformsh.cxx index 6355ef5e8d9d..02cf369c3498 100644 --- a/sc/source/ui/drawfunc/drformsh.cxx +++ b/sc/source/ui/drawfunc/drformsh.cxx @@ -35,6 +35,7 @@ #include "drawview.hxx" #include "scresid.hxx" #include <svx/svdobj.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #define ScDrawFormShell #include "scslots.hxx" @@ -54,12 +55,11 @@ ScDrawFormShell::ScDrawFormShell(ScViewData* pData) : { SetHelpId(HID_SCSHELL_DRAWFORMSH); SetName(OUString("DrawForm")); + SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Form)); } ScDrawFormShell::~ScDrawFormShell() { } - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx index 9e0891e540a4..8e97dd2bc6e6 100644 --- a/sc/source/ui/drawfunc/drtxtob.cxx +++ b/sc/source/ui/drawfunc/drtxtob.cxx @@ -31,6 +31,9 @@ #include <editeng/flditem.hxx> #include <editeng/fontitem.hxx> #include <editeng/frmdiritem.hxx> +#include <editeng/lrspitem.hxx> +#include <editeng/lspcitem.hxx> +#include <editeng/ulspitem.hxx> #include <svx/hlnkitem.hxx> #include <editeng/lspcitem.hxx> #include <svx/svdoutl.hxx> @@ -57,6 +60,7 @@ #include <svx/svxdlg.hxx> #include <svx/dialogs.hrc> +#include <sfx2/sidebar/EnumContext.hxx> #include "sc.hrc" #include "globstr.hrc" @@ -121,6 +125,7 @@ ScDrawTextObjectBar::ScDrawTextObjectBar(ScViewData* pData) : SetHelpId( HID_SCSHELL_DRTXTOB ); SetName(OUString("DrawText")); + SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_DrawText)); } ScDrawTextObjectBar::~ScDrawTextObjectBar() @@ -698,10 +703,11 @@ void ScDrawTextObjectBar::ExecuteAttr( SfxRequest &rReq ) } break; + case SID_CHAR_DLG_EFFECT: case SID_CHAR_DLG: // Dialog-Button case SID_ATTR_CHAR_FONT: // Controller nicht angezeigt case SID_ATTR_CHAR_FONTHEIGHT: - bDone = ExecuteCharDlg( aEditAttr, aNewAttr ); + bDone = ExecuteCharDlg( aEditAttr, aNewAttr , nSlot); break; case SID_PARA_DLG: @@ -818,6 +824,11 @@ void ScDrawTextObjectBar::ExecuteAttr( SfxRequest &rReq ) aNewAttr.Put( *pDlg->GetOutputItemSet() ); delete pDlg; + + SfxBindings& rBindings = pViewData->GetBindings(); + rBindings.Invalidate( SID_TABLE_VERT_NONE ); + rBindings.Invalidate( SID_TABLE_VERT_CENTER ); + rBindings.Invalidate( SID_TABLE_VERT_BOTTOM ); } break; } @@ -849,6 +860,120 @@ void ScDrawTextObjectBar::ExecuteAttr( SfxRequest &rReq ) pView->SetAttributes( aSetItem.GetItemSet() ); } + else if( nSlot == SID_ATTR_PARA_LRSPACE ) + { + sal_uInt16 nId = SID_ATTR_PARA_LRSPACE; + const SvxLRSpaceItem& rItem = (const SvxLRSpaceItem&) + pArgs->Get( nId ); + SfxItemSet aEditAttr( GetPool(), EE_PARA_LRSPACE, EE_PARA_LRSPACE ); + nId = EE_PARA_LRSPACE; + SvxLRSpaceItem aLRSpaceItem( rItem.GetLeft(), + rItem.GetRight(), rItem.GetTxtLeft(), + rItem.GetTxtFirstLineOfst(), nId ); + aEditAttr.Put( aLRSpaceItem ); +// rReq.Done( aEditAttr ); +// pArgs = rReq.GetArgs(); +// pView->SetAttributes( *pArgs ); + pView->SetAttributes( aEditAttr ); +// Invalidate(SID_ATTR_PARA_LRSPACE); + } + else if( nSlot == SID_ATTR_PARA_LINESPACE ) + { + SvxLineSpacingItem aLineSpaceItem = (const SvxLineSpacingItem&)pArgs->Get( + GetPool().GetWhich(nSlot)); + SfxItemSet aEditAttr( GetPool(), EE_PARA_SBL, EE_PARA_SBL ); + aEditAttr.Put( aLineSpaceItem ); +// rReq.Done( aEditAttr ); +// pArgs = rReq.GetArgs(); +// pView->SetAttributes( *pArgs ); + pView->SetAttributes( aEditAttr ); +// Invalidate(SID_ATTR_PARA_LINESPACE); + } + else if( nSlot == SID_ATTR_PARA_ULSPACE ) + { + SvxULSpaceItem aULSpaceItem = (const SvxULSpaceItem&)pArgs->Get( + GetPool().GetWhich(nSlot)); + SfxItemSet aEditAttr( GetPool(), EE_PARA_ULSPACE, EE_PARA_ULSPACE ); + aULSpaceItem.SetWhich(EE_PARA_ULSPACE); + aEditAttr.Put( aULSpaceItem ); +// rReq.Done( aEditAttr ); +// pArgs = rReq.GetArgs(); +// pView->SetAttributes( *pArgs ); + pView->SetAttributes( aEditAttr ); +// Invalidate(SID_ATTR_PARA_ULSPACE); + } + else if(nSlot == SID_SET_SUPER_SCRIPT ) + { + SfxItemSet aEditAttr(pView->GetModel()->GetItemPool()); + pView->GetAttributes(aEditAttr); + SfxItemSet aNewAttr( *aEditAttr.GetPool(), aEditAttr.GetRanges() ); + + SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT); + SvxEscapement eEsc = (SvxEscapement) ( (const SvxEscapementItem&) + aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue(); + + if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT ) + aItem.SetEscapement( SVX_ESCAPEMENT_OFF ); + else + aItem.SetEscapement( SVX_ESCAPEMENT_SUPERSCRIPT ); + aNewAttr.Put( aItem ); + pView->SetAttributes( aNewAttr ); + } + else if( nSlot == SID_SET_SUB_SCRIPT ) + { + SfxItemSet aEditAttr(pView->GetModel()->GetItemPool()); + pView->GetAttributes(aEditAttr); + SfxItemSet aNewAttr( *aEditAttr.GetPool(), aEditAttr.GetRanges() ); + + SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT); + SvxEscapement eEsc = (SvxEscapement) ( (const SvxEscapementItem&) + aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue(); + + if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT ) + aItem.SetEscapement( SVX_ESCAPEMENT_OFF ); + else + aItem.SetEscapement( SVX_ESCAPEMENT_SUBSCRIPT ); + aNewAttr.Put( aItem ); + pView->SetAttributes( aNewAttr ); + } + + else if (bArgsInReq && + ( nSlot == SID_TABLE_VERT_NONE || nSlot == SID_TABLE_VERT_CENTER || + nSlot == SID_TABLE_VERT_BOTTOM ) ) + { + SdrTextVertAdjust eTVA = SDRTEXTVERTADJUST_TOP; + if (nSlot == SID_TABLE_VERT_CENTER) + eTVA = SDRTEXTVERTADJUST_CENTER; + else if (nSlot == SID_TABLE_VERT_BOTTOM) + eTVA = SDRTEXTVERTADJUST_BOTTOM; + + SfxItemSet aEditAttr(pView->GetModel()->GetItemPool()); + SfxItemSet aNewAttr( *aEditAttr.GetPool(), aEditAttr.GetRanges() ); + aNewAttr.Put(SdrTextVertAdjustItem(eTVA)); + pView->SetAttributes(aNewAttr); + } + else if (bArgsInReq && + (nSlot == SID_ATTR_PARA_ADJUST_LEFT || nSlot == SID_ATTR_PARA_ADJUST_CENTER || nSlot == SID_ATTR_PARA_ADJUST_RIGHT || nSlot == SID_ATTR_PARA_ADJUST_BLOCK )) + { + SfxItemSet aEditAttr(pView->GetModel()->GetItemPool()); + SfxItemSet aNewAttr( *aEditAttr.GetPool(), aEditAttr.GetRanges() ); + switch ( nSlot ) + { + case SID_ATTR_PARA_ADJUST_LEFT: + aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_LEFT, EE_PARA_JUST ) ); + break; + case SID_ATTR_PARA_ADJUST_CENTER: + aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_CENTER, EE_PARA_JUST ) ); + break; + case SID_ATTR_PARA_ADJUST_RIGHT: + aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_RIGHT, EE_PARA_JUST ) ); + break; + case SID_ATTR_PARA_ADJUST_BLOCK: + aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_BLOCK, EE_PARA_JUST ) ); + break; + } + pView->SetAttributes(aNewAttr); + } else { // use args directly @@ -901,24 +1026,35 @@ void ScDrawTextObjectBar::GetAttrState( SfxItemSet& rDestSet ) ScViewUtil::PutItemScript( rDestSet, aAttrSet, EE_CHAR_WEIGHT, nScript ); if ( rDestSet.GetItemState( EE_CHAR_ITALIC ) != SFX_ITEM_UNKNOWN ) ScViewUtil::PutItemScript( rDestSet, aAttrSet, EE_CHAR_ITALIC, nScript ); - // Ausrichtung SvxAdjust eAdj = ((const SvxAdjustItem&)aAttrSet.Get(EE_PARA_JUST)).GetAdjust(); switch( eAdj ) { - case SVX_ADJUST_LEFT: + case SVX_ADJUST_LEFT: + { rDestSet.Put( SfxBoolItem( SID_ALIGNLEFT, sal_True ) ); - break; - case SVX_ADJUST_CENTER: + rDestSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_LEFT, sal_True ) ); + } + break; + case SVX_ADJUST_CENTER: + { rDestSet.Put( SfxBoolItem( SID_ALIGNCENTERHOR, sal_True ) ); - break; - case SVX_ADJUST_RIGHT: + rDestSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_CENTER, sal_True ) ); + } + break; + case SVX_ADJUST_RIGHT: + { rDestSet.Put( SfxBoolItem( SID_ALIGNRIGHT, sal_True ) ); - break; - case SVX_ADJUST_BLOCK: + rDestSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_RIGHT, sal_True ) ); + } + break; + case SVX_ADJUST_BLOCK: + { rDestSet.Put( SfxBoolItem( SID_ALIGNBLOCK, sal_True ) ); - break; + rDestSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_BLOCK, sal_True ) ); + } + break; default: { // added to avoid warnings @@ -930,6 +1066,32 @@ void ScDrawTextObjectBar::GetAttrState( SfxItemSet& rDestSet ) rDestSet.Put( SfxBoolItem( SID_ALIGN_ANY_RIGHT, eAdj == SVX_ADJUST_RIGHT ) ); rDestSet.Put( SfxBoolItem( SID_ALIGN_ANY_JUSTIFIED, eAdj == SVX_ADJUST_BLOCK ) ); + SvxLRSpaceItem aLR = ((const SvxLRSpaceItem&)aAttrSet.Get( EE_PARA_LRSPACE )); + aLR.SetWhich(SID_ATTR_PARA_LRSPACE); + rDestSet.Put(aLR); + Invalidate( SID_ATTR_PARA_LRSPACE ); + SfxItemState eState = aAttrSet.GetItemState( EE_PARA_LRSPACE ); + if ( eState == SFX_ITEM_DONTCARE ) + rDestSet.InvalidateItem(SID_ATTR_PARA_LRSPACE); + //xuxu for Line Space + SvxLineSpacingItem aLineSP = ((const SvxLineSpacingItem&)aAttrSet. + Get( EE_PARA_SBL )); + aLineSP.SetWhich(SID_ATTR_PARA_LINESPACE); + rDestSet.Put(aLineSP); + Invalidate(SID_ATTR_PARA_LINESPACE); + eState = aAttrSet.GetItemState( EE_PARA_SBL ); + if ( eState == SFX_ITEM_DONTCARE ) + rDestSet.InvalidateItem(SID_ATTR_PARA_LINESPACE); + //xuxu for UL Space + SvxULSpaceItem aULSP = ((const SvxULSpaceItem&)aAttrSet. + Get( EE_PARA_ULSPACE )); + aULSP.SetWhich(SID_ATTR_PARA_ULSPACE); + rDestSet.Put(aULSP); + Invalidate(SID_ATTR_PARA_ULSPACE); + eState = aAttrSet.GetItemState( EE_PARA_ULSPACE ); + if ( eState == SFX_ITEM_DONTCARE ) + rDestSet.InvalidateItem(SID_ATTR_PARA_ULSPACE); + // Zeilenabstand sal_uInt16 nLineSpace = (sal_uInt16) @@ -959,7 +1121,7 @@ void ScDrawTextObjectBar::GetAttrState( SfxItemSet& rDestSet ) // Unterstreichung - SfxItemState eState = aAttrSet.GetItemState( EE_CHAR_UNDERLINE, sal_True ); + eState = aAttrSet.GetItemState( EE_CHAR_UNDERLINE, sal_True ); if ( eState == SFX_ITEM_DONTCARE ) { rDestSet.InvalidateItem( SID_ULINE_VAL_NONE ); @@ -1056,4 +1218,55 @@ void ScDrawTextObjectBar::ExecuteTrans( SfxRequest& rReq ) } } +void ScDrawTextObjectBar::GetStatePropPanelAttr(SfxItemSet &rSet) +{ + SfxWhichIter aIter( rSet ); + sal_uInt16 nWhich = aIter.FirstWhich(); + + SdrView* pView = pViewData->GetScDrawView(); + + SfxItemSet aEditAttr(pView->GetModel()->GetItemPool()); + pView->GetAttributes(aEditAttr); + //SfxItemSet aAttrs( *aEditAttr.GetPool(), aEditAttr.GetRanges() ); + + 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 = aEditAttr.GetItemState( SDRATTR_TEXT_CONTOURFRAME ); + if( eConState != SFX_ITEM_DONTCARE ) + { + bContour = ( ( const SdrTextContourFrameItem& )aEditAttr.Get( SDRATTR_TEXT_CONTOURFRAME ) ).GetValue(); + } + if (bContour) break; + + SfxItemState eVState = aEditAttr.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&)aEditAttr.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/sc/source/ui/drawfunc/drtxtob1.cxx b/sc/source/ui/drawfunc/drtxtob1.cxx index 37c9a2512329..a3f5445d5f49 100644 --- a/sc/source/ui/drawfunc/drtxtob1.cxx +++ b/sc/source/ui/drawfunc/drtxtob1.cxx @@ -41,7 +41,7 @@ //------------------------------------------------------------------------ sal_Bool ScDrawTextObjectBar::ExecuteCharDlg( const SfxItemSet& rArgs, - SfxItemSet& rOutSet ) + SfxItemSet& rOutSet , sal_uInt16 nSlot) { ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "ScAbstractFactory create fail!"); @@ -49,6 +49,10 @@ sal_Bool ScDrawTextObjectBar::ExecuteCharDlg( const SfxItemSet& rArgs, SfxAbstractTabDialog* pDlg = pFact->CreateScCharDlg( pViewData->GetDialogParent(), &rArgs, pViewData->GetSfxDocShell(),RID_SCDLG_CHAR ); OSL_ENSURE(pDlg, "Dialog create fail!"); + if (nSlot == SID_CHAR_DLG_EFFECT) + { + pDlg->SetCurPageId(RID_SVXPAGE_CHAR_EFFECTS); + } sal_Bool bRet = ( pDlg->Execute() == RET_OK ); if ( bRet ) diff --git a/sc/source/ui/drawfunc/futext.cxx b/sc/source/ui/drawfunc/futext.cxx index 5b6e0b124b7c..8ea5fc2d90b3 100644 --- a/sc/source/ui/drawfunc/futext.cxx +++ b/sc/source/ui/drawfunc/futext.cxx @@ -61,6 +61,10 @@ static void lcl_InvalidateAttribs( SfxBindings& rBindings ) rBindings.Invalidate( SID_ATTR_CHAR_COLOR ); rBindings.Invalidate( SID_ATTR_CHAR_FONT ); rBindings.Invalidate( SID_ATTR_CHAR_FONTHEIGHT ); + rBindings.Invalidate( SID_ATTR_PARA_ADJUST_LEFT ); + rBindings.Invalidate( SID_ATTR_PARA_ADJUST_RIGHT ); + rBindings.Invalidate( SID_ATTR_PARA_ADJUST_BLOCK ); + rBindings.Invalidate( SID_ATTR_PARA_ADJUST_CENTER); rBindings.Invalidate( SID_ALIGNLEFT ); rBindings.Invalidate( SID_ALIGNCENTERHOR ); rBindings.Invalidate( SID_ALIGNRIGHT ); @@ -80,6 +84,11 @@ static void lcl_InvalidateAttribs( SfxBindings& rBindings ) rBindings.Invalidate( SID_ALIGN_ANY_HCENTER ); rBindings.Invalidate( SID_ALIGN_ANY_RIGHT ); rBindings.Invalidate( SID_ALIGN_ANY_JUSTIFIED ); + rBindings.Invalidate( SID_ATTR_CHAR_KERNING ); + rBindings.Invalidate( SID_SET_SUPER_SCRIPT ); + rBindings.Invalidate( SID_SET_SUB_SCRIPT ); + rBindings.Invalidate( SID_ATTR_CHAR_STRIKEOUT ); + rBindings.Invalidate( SID_ATTR_CHAR_SHADOWED ); } static void lcl_UpdateHyphenator( Outliner& rOutliner, SdrObject* pObj ) diff --git a/sc/source/ui/drawfunc/graphsh.cxx b/sc/source/ui/drawfunc/graphsh.cxx index 45666e6f6999..6276575cd712 100644 --- a/sc/source/ui/drawfunc/graphsh.cxx +++ b/sc/source/ui/drawfunc/graphsh.cxx @@ -20,6 +20,7 @@ #include <sfx2/app.hxx> #include <sfx2/objface.hxx> #include <sfx2/request.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include <svl/whiter.hxx> #include <svx/svdograf.hxx> #include <svx/grfflt.hxx> @@ -79,6 +80,7 @@ ScGraphicShell::ScGraphicShell(ScViewData* pData) : { SetHelpId(HID_SCSHELL_GRAPHIC); SetName(OUString("GraphicObject")); + SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Graphic)); } ScGraphicShell::~ScGraphicShell() @@ -241,4 +243,5 @@ void ScGraphicShell::ExecuteCompressGraphic( SfxRequest& ) Invalidate(); } + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/drawfunc/mediash.cxx b/sc/source/ui/drawfunc/mediash.cxx index 79185a965e31..9537f376876d 100644 --- a/sc/source/ui/drawfunc/mediash.cxx +++ b/sc/source/ui/drawfunc/mediash.cxx @@ -25,6 +25,7 @@ #include <svl/whiter.hxx> #include <svx/svdomedia.hxx> #include <svx/sdr/contact/viewcontactofsdrmediaobj.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include "mediash.hxx" #include "sc.hrc" @@ -48,6 +49,7 @@ ScMediaShell::ScMediaShell(ScViewData* pData) : { SetHelpId(HID_SCSHELL_MEDIA); SetName( String( ScResId( SCSTR_MEDIASHELL ) ) ); + SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Media)); } ScMediaShell::~ScMediaShell() diff --git a/sc/source/ui/drawfunc/oleobjsh.cxx b/sc/source/ui/drawfunc/oleobjsh.cxx index 6cb1db567ce5..9add3117d3df 100644 --- a/sc/source/ui/drawfunc/oleobjsh.cxx +++ b/sc/source/ui/drawfunc/oleobjsh.cxx @@ -35,6 +35,7 @@ #include "drawview.hxx" #include "scresid.hxx" #include <svx/svdobj.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #define ScOleObjectShell #include "scslots.hxx" @@ -54,12 +55,17 @@ ScOleObjectShell::ScOleObjectShell(ScViewData* pData) : { SetHelpId(HID_SCSHELL_OLEOBEJCTSH); SetName(OUString("OleObject")); + SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_OLE)); } ScOleObjectShell::~ScOleObjectShell() { } - +void ScOleObjectShell::HandleSelectionChange (void) +{ + // Do not call the implementation in the base class. Let + // Activate()/Deactivate() handle context switches. +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/formdlg/dwfunctr.cxx b/sc/source/ui/formdlg/dwfunctr.cxx index 58ac2464246d..bb5cb9a77ef0 100644 --- a/sc/source/ui/formdlg/dwfunctr.cxx +++ b/sc/source/ui/formdlg/dwfunctr.cxx @@ -108,7 +108,10 @@ ScFunctionDockWin::ScFunctionDockWin( SfxBindings* pBindingsP, aTimer.SetTimeout(200); aTimer.SetTimeoutHdl(LINK( this, ScFunctionDockWin, TimerHdl)); - eSfxNewAlignment=GetAlignment(); + if (pCW != NULL) + eSfxNewAlignment=GetAlignment(); + else + eSfxNewAlignment=SFX_ALIGN_RIGHT; eSfxOldAlignment=eSfxNewAlignment; aFiFuncDesc.SetUpdateMode(sal_True); pAllFuncList=&aFuncList; diff --git a/sc/source/ui/inc/chartsh.hxx b/sc/source/ui/inc/chartsh.hxx index 3e2eddfb787b..9a3719af1a96 100644 --- a/sc/source/ui/inc/chartsh.hxx +++ b/sc/source/ui/inc/chartsh.hxx @@ -40,6 +40,8 @@ public: void ExecuteExportAsGraphic(SfxRequest& rReq); void GetExportAsGraphicState(SfxItemSet &rSet); + + virtual void HandleSelectionChange (void); }; #endif diff --git a/sc/source/ui/inc/drawsh.hxx b/sc/source/ui/inc/drawsh.hxx index 307bcac4abbb..d251eee63d77 100644 --- a/sc/source/ui/inc/drawsh.hxx +++ b/sc/source/ui/inc/drawsh.hxx @@ -23,16 +23,22 @@ #include <sfx2/shell.hxx> #include "shellids.hxx" #include <sfx2/module.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include <svx/svdmark.hxx> #include <tools/link.hxx> +#include <rtl/ref.hxx> class AbstractSvxNameDialog; class ScViewData; class ScDrawView; +namespace svx { namespace sidebar { +class SelectionChangeHandler; +} } class ScDrawShell : public SfxShell { ScViewData* pViewData; + ::rtl::Reference<svx::sidebar::SelectionChangeHandler> mpSelectionChangeHandler; DECL_LINK( NameObjectHdl, AbstractSvxNameDialog* ); @@ -75,6 +81,9 @@ public: ScDrawView* GetDrawView(); sal_Bool AreAllObjectsOnLayer(sal_uInt16 nLayerNo,const SdrMarkList& rMark); + + void GetDrawAttrStateForIFBX( SfxItemSet& rSet ); + ::sfx2::sidebar::EnumContext::Context GetContextForSelection (void); }; diff --git a/sc/source/ui/inc/drformsh.hxx b/sc/source/ui/inc/drformsh.hxx index 4947d3ebb6b9..ba72981621b3 100644 --- a/sc/source/ui/inc/drformsh.hxx +++ b/sc/source/ui/inc/drformsh.hxx @@ -39,9 +39,6 @@ public: ScDrawFormShell(ScViewData* pData); virtual ~ScDrawFormShell(); - -// void Execute(SfxRequest &); -// void GetState(SfxItemSet &); }; #endif diff --git a/sc/source/ui/inc/drtxtob.hxx b/sc/source/ui/inc/drtxtob.hxx index ee61c02ba328..4838c64e3072 100644 --- a/sc/source/ui/inc/drtxtob.hxx +++ b/sc/source/ui/inc/drtxtob.hxx @@ -57,8 +57,9 @@ public: void ExecuteAttr( SfxRequest &rReq ); void GetAttrState( SfxItemSet& rSet ); void ExecuteToggle( SfxRequest &rReq ); + void GetStatePropPanelAttr(SfxItemSet &); - sal_Bool ExecuteCharDlg( const SfxItemSet& rArgs, SfxItemSet& rOutSet ); + sal_Bool ExecuteCharDlg( const SfxItemSet& rArgs, SfxItemSet& rOutSet , sal_uInt16 nSlot); sal_Bool ExecuteParaDlg( const SfxItemSet& rArgs, SfxItemSet& rOutSet ); void ExecuteExtra( SfxRequest &rReq ); diff --git a/sc/source/ui/inc/formatsh.hxx b/sc/source/ui/inc/formatsh.hxx index 975e2ad63597..ccf69ca153b9 100644 --- a/sc/source/ui/inc/formatsh.hxx +++ b/sc/source/ui/inc/formatsh.hxx @@ -67,6 +67,9 @@ public: void ExecFormatPaintbrush( SfxRequest& rReq ); void StateFormatPaintbrush( SfxItemSet& rSet ); + void ExecViewOptions( SfxRequest& rReq ); + void GetViewOptions( SfxItemSet& rSet ); + private: short GetCurrentNumberFormatType(); }; diff --git a/sc/source/ui/inc/navipi.hxx b/sc/source/ui/inc/navipi.hxx index 9eb57004c38c..c62f534c62a9 100644 --- a/sc/source/ui/inc/navipi.hxx +++ b/sc/source/ui/inc/navipi.hxx @@ -267,6 +267,7 @@ private: SCROW nCurRow; SCTAB nCurTab; sal_Bool bFirstBig; + bool mbUseStyleSettingsBackground; ScNavigatorControllerItem** ppBoundItems; @@ -319,7 +320,8 @@ protected: virtual void Resizing( Size& rSize ); public: - ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, Window* pParent ); + ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, Window* pParent, + const bool bUseStyleSettingsBackground); ~ScNavigatorDlg(); using Window::Notify; diff --git a/sc/source/ui/inc/oleobjsh.hxx b/sc/source/ui/inc/oleobjsh.hxx index 73b1fcc32110..2de3f6882549 100644 --- a/sc/source/ui/inc/oleobjsh.hxx +++ b/sc/source/ui/inc/oleobjsh.hxx @@ -39,6 +39,7 @@ public: ScOleObjectShell(ScViewData* pData); virtual ~ScOleObjectShell(); + virtual void HandleSelectionChange (void); }; #endif diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx index 5d32ee48dbf7..5c5d7583476e 100644 --- a/sc/source/ui/navipi/navipi.cxx +++ b/sc/source/ui/navipi/navipi.cxx @@ -547,7 +547,7 @@ ScNavigatorDialogWrapper::ScNavigatorDialogWrapper( SfxChildWinInfo* /* pInfo */ ) : SfxChildWindowContext( nId ) { - pNavigator = new ScNavigatorDlg( pBind, this, pParent ); + pNavigator = new ScNavigatorDlg( pBind, this, pParent, true ); SetWindow( pNavigator ); // Einstellungen muessen anderswo gemerkt werden, @@ -615,7 +615,8 @@ void ScNavigatorDialogWrapper::Resizing( Size& rSize ) #define REGISTER_SLOT(i,id) \ ppBoundItems[i]=new ScNavigatorControllerItem(id,*this,rBindings); -ScNavigatorDlg::ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, Window* pParent ) : +ScNavigatorDlg::ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, Window* pParent, + const bool bUseStyleSettingsBackground) : Window( pParent, ScResId(RID_SCDLG_NAVIGATOR) ), rBindings ( *pB ), // is used in CommandToolBox ctor aCmdImageList( ScResId( IL_CMD ) ), @@ -640,7 +641,8 @@ ScNavigatorDlg::ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, Win nCurCol ( 0 ), nCurRow ( 0 ), nCurTab ( 0 ), - bFirstBig ( false ) + bFirstBig ( false ), + mbUseStyleSettingsBackground(bUseStyleSettingsBackground) { ScNavipiCfg& rCfg = SC_MOD()->GetNavipiCfg(); nDropMode = rCfg.GetDragMode(); @@ -725,6 +727,16 @@ ScNavigatorDlg::ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, Win aLbEntries.SetAccessibleRelationLabeledBy(&aLbEntries); aTbxCmd.SetAccessibleRelationLabeledBy(&aTbxCmd); aLbDocuments.SetAccessibleName(aStrActiveWin); + + if (pContextWin == NULL) + { + // When the context window is missing then the navigator is + // displayed in the sidebar and has the whole deck to fill. + // Therefore hide the button that hides all controls below the + // top two rows of buttons. + aTbxCmd.Select(IID_ZOOMOUT); + aTbxCmd.RemoveItem(aTbxCmd.GetItemPos(IID_ZOOMOUT)); + } } //------------------------------------------------------------------------ @@ -748,7 +760,7 @@ ScNavigatorDlg::~ScNavigatorDlg() void ScNavigatorDlg::Resizing( Size& rNewSize ) // Size = Outputsize? { - FloatingWindow* pFloat = pContextWin->GetFloatingWindow(); + FloatingWindow* pFloat = pContextWin!=NULL ? pContextWin->GetFloatingWindow() : NULL; if ( pFloat ) { Size aMinOut = pFloat->GetMinOutputSizePixel(); @@ -770,13 +782,21 @@ void ScNavigatorDlg::Resizing( Size& rNewSize ) // Size = Outputsize? void ScNavigatorDlg::Paint( const Rectangle& rRect ) { - const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - Color aBgColor = rStyleSettings.GetFaceColor(); - Wallpaper aBack( aBgColor ); + if (mbUseStyleSettingsBackground) + { + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + Color aBgColor = rStyleSettings.GetFaceColor(); + Wallpaper aBack( aBgColor ); - SetBackground( aBack ); - aFtCol.SetBackground( aBack ); - aFtRow.SetBackground( aBack ); + SetBackground( aBack ); + aFtCol.SetBackground( aBack ); + aFtRow.SetBackground( aBack ); + } + else + { + aFtCol.SetBackground(Wallpaper()); + aFtRow.SetBackground(Wallpaper()); + } Window::Paint( rRect ); } @@ -850,9 +870,12 @@ void ScNavigatorDlg::DoResize() aLbDocuments.SetSizePixel( aDocSize ); sal_Bool bListMode = (eListMode != NAV_LMODE_NONE); - FloatingWindow* pFloat = pContextWin->GetFloatingWindow(); - if ( pFloat && bListMode ) - nListModeHeight = nTotalHeight; + if (pContextWin != NULL) + { + FloatingWindow* pFloat = pContextWin->GetFloatingWindow(); + if ( pFloat && bListMode ) + nListModeHeight = nTotalHeight; + } } //------------------------------------------------------------------------ @@ -1183,7 +1206,7 @@ void ScNavigatorDlg::SetListMode( NavListMode eMode, sal_Bool bSetSize ) void ScNavigatorDlg::ShowList( sal_Bool bShow, sal_Bool bSetSize ) { - FloatingWindow* pFloat = pContextWin->GetFloatingWindow(); + FloatingWindow* pFloat = pContextWin!=NULL ? pContextWin->GetFloatingWindow() : NULL; Size aSize = GetParent()->GetOutputSizePixel(); if ( bShow ) @@ -1217,10 +1240,13 @@ void ScNavigatorDlg::ShowList( sal_Bool bShow, sal_Bool bSetSize ) } else { - SfxNavigator* pNav = (SfxNavigator*)GetParent(); - Size aFloating = pNav->GetFloatingSize(); - aFloating.Height() = aSize.Height(); - pNav->SetFloatingSize( aFloating ); + SfxNavigator* pNav = dynamic_cast<SfxNavigator*>(GetParent()); + if (pNav != NULL) + { + Size aFloating = pNav->GetFloatingSize(); + aFloating.Height() = aSize.Height(); + pNav->SetFloatingSize( aFloating ); + } } } @@ -1228,7 +1254,7 @@ void ScNavigatorDlg::ShowList( sal_Bool bShow, sal_Bool bSetSize ) void ScNavigatorDlg::ShowScenarios( sal_Bool bShow, sal_Bool bSetSize ) { - FloatingWindow* pFloat = pContextWin->GetFloatingWindow(); + FloatingWindow* pFloat = pContextWin!=NULL ? pContextWin->GetFloatingWindow() : NULL; Size aSize = GetParent()->GetOutputSizePixel(); if ( bShow ) diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx new file mode 100644 index 000000000000..3fb7bb278bb8 --- /dev/null +++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx @@ -0,0 +1,632 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include <sfx2/sidebar/Theme.hxx> +#include <sfx2/sidebar/ControlFactory.hxx> +#include <AlignmentPropertyPanel.hxx> +#include <AlignmentPropertyPanel.hrc> +#include <editeng/justifyitem.hxx> +#include <svx/dialmgr.hxx> +#include "sc.hrc" +#include "scresid.hxx" +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <svx/algitem.hxx> +#include <svx/dlgutil.hxx> +#include <vcl/toolbox.hxx> +#include <svx/sidebar/SidebarDialControl.hxx> + +using namespace css; +using namespace cssu; +using ::sfx2::sidebar::ControlFactory; + +#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) + +////////////////////////////////////////////////////////////////////////////// +// namespace open + +namespace sc { namespace sidebar { + +////////////////////////////////////////////////////////////////////////////// + +AlignmentPropertyPanel::AlignmentPropertyPanel( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings) + : Control( + pParent, + ScResId(RID_PROPERTYPANEL_SC_ALIGNMENT)), + mpTBHorizontalBackground(ControlFactory::CreateToolBoxBackground(this)), + mpTBHorizontal(ControlFactory::CreateToolBox( + mpTBHorizontalBackground.get(), + ScResId(TBX_HORIZONTAL_ALIGNMENT))), + mpTBVerticalBackground(ControlFactory::CreateToolBoxBackground(this)), + mpTBVertical(ControlFactory::CreateToolBox( + mpTBVerticalBackground.get(), + ScResId(TBX_VERTICAL_ALIGN))), + mpFTLeftIndent(new FixedText(this, ScResId(FT_LEFT_INDENT))), + mpMFLeftIndent(new MetricField(this, ScResId(MF_LEFT_INDENT))), + mpCBXWrapText(new CheckBox(this, ScResId(CBX_WRAP))), + mpCBXMergeCell(new CheckBox(this, ScResId(CBX_MERGE))), + mpFtRotate(new FixedText(this, ScResId(FT_ORIENT))), + mpCtrlDial(new svx::sidebar::SidebarDialControl(this, ScResId(DIAL_CONTROL))), // , true)), + mpMtrAngle(new MetricBox(this, ScResId(CBOX_ANGLE))), + mpCbStacked(new CheckBox(this, ScResId(CBX_VERT))), + maAlignHorControl(SID_H_ALIGNCELL, *pBindings, *this), + maAlignVerControl(SID_V_ALIGNCELL, *pBindings, *this), + maLeftIndentControl(SID_ATTR_ALIGN_INDENT, *pBindings, *this), + maMergeCellControl(FID_MERGE_TOGGLE, *pBindings, *this), + maWrapTextControl(SID_ATTR_ALIGN_LINEBREAK, *pBindings, *this), + maAngleControl(SID_ATTR_ALIGN_DEGREES, *pBindings, *this), + maStackControl(SID_ATTR_ALIGN_STACKED, *pBindings, *this), + maIMGAlignLeft(ScResId(IMG_ALIGN_LEFT)), + maIMGAlignCenter(ScResId(IMG_ALIGN_CENTER)), + maIMGAlignRight(ScResId(IMG_ALIGN_RIGHT)), + maIMGAlignJust(ScResId(IMG_ALIGN_JUST)), + maIMGAlignTop(ScResId(IMG_ALIGN_TOP)), + maIMGAlignCenterV(ScResId(IMG_ALIGN_CENTER_V)), + maIMGAlignBottom(ScResId(IMG_ALIGN_BOTTOM)), + meHorAlignState(SVX_HOR_JUSTIFY_STANDARD), + meVerAlignState(SVX_VER_JUSTIFY_STANDARD), + mbMultiDisable(false), + mxFrame(rxFrame), + maContext(), + mpBindings(pBindings) +{ + Initialize(); + FreeResource(); + + mpFTLeftIndent->SetBackground(Wallpaper()); + mpFtRotate->SetBackground(Wallpaper()); +} + +////////////////////////////////////////////////////////////////////////////// + +AlignmentPropertyPanel::~AlignmentPropertyPanel() +{ +} + +////////////////////////////////////////////////////////////////////////////// + +void AlignmentPropertyPanel::Initialize() +{ + mpTBHorizontal->SetItemImage(ID_SUBSTLEFT, maIMGAlignLeft); + mpTBHorizontal->SetItemImage(ID_SUBSTCENTER, maIMGAlignCenter); + mpTBHorizontal->SetItemImage(ID_SUBSTRIGHT, maIMGAlignRight); + mpTBHorizontal->SetItemImage(ID_SUBSTJUSTIFY, maIMGAlignJust); + Size aTbxSize( mpTBHorizontal->CalcWindowSizePixel() ); + mpTBHorizontal->SetOutputSizePixel( aTbxSize ); + mpTBHorizontal->SetBackground(Wallpaper()); + mpTBHorizontal->SetPaintTransparent(true); + Link aLink = LINK(this, AlignmentPropertyPanel, TbxHorAlignSelectHdl); + mpTBHorizontal->SetSelectHdl ( aLink ); + + mpTBVertical->SetItemImage(IID_VERT_TOP, maIMGAlignTop); + mpTBVertical->SetItemImage(IID_VERT_CENTER, maIMGAlignCenterV); + mpTBVertical->SetItemImage(IID_VERT_BOTTOM, maIMGAlignBottom); + Size aTbxSize2( mpTBVertical->CalcWindowSizePixel() ); + mpTBVertical->SetOutputSizePixel( aTbxSize2 ); + mpTBVertical->SetBackground(Wallpaper()); + mpTBVertical->SetPaintTransparent(true); + aLink = LINK(this, AlignmentPropertyPanel, TbxVerAlignSelectHdl); + mpTBVertical->SetSelectHdl ( aLink ); + + mpFTLeftIndent->Disable(); + mpMFLeftIndent->Disable(); + mpMFLeftIndent->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Left Indent"))); //wj acc + aLink = LINK(this, AlignmentPropertyPanel, MFLeftIndentMdyHdl); + mpMFLeftIndent->SetModifyHdl ( aLink ); + + aLink = LINK(this, AlignmentPropertyPanel, CBOXMergnCellClkHdl); + mpCBXMergeCell->SetClickHdl ( aLink ); + + aLink = LINK(this, AlignmentPropertyPanel, CBOXWrapTextClkHdl); + mpCBXWrapText->SetClickHdl ( aLink ); + + //rotation control + mpCtrlDial->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Text Orientation"))); //wj acc + mpCtrlDial->SetModifyHdl(LINK( this, AlignmentPropertyPanel, RotationHdl)); + + //rotation + mpMtrAngle->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Text Orientation"))); //wj acc + mpMtrAngle->SetModifyHdl(LINK( this, AlignmentPropertyPanel, AngleModifiedHdl)); + mpMtrAngle->EnableAutocomplete( false ); + + //Vertical stacked + mpCbStacked->SetClickHdl( LINK( this, AlignmentPropertyPanel, ClickStackHdl ) ); + + mpMtrAngle->InsertValue(0, FUNIT_CUSTOM); + mpMtrAngle->InsertValue(45, FUNIT_CUSTOM); + mpMtrAngle->InsertValue(90, FUNIT_CUSTOM); + mpMtrAngle->InsertValue(135, FUNIT_CUSTOM); + mpMtrAngle->InsertValue(180, FUNIT_CUSTOM); + mpMtrAngle->InsertValue(225, FUNIT_CUSTOM); + mpMtrAngle->InsertValue(270, FUNIT_CUSTOM); + mpMtrAngle->InsertValue(315, FUNIT_CUSTOM); + mpMtrAngle->SetDropDownLineCount(mpMtrAngle->GetEntryCount()); + + mpTBHorizontal->SetAccessibleRelationLabeledBy(mpTBHorizontal.get()); + mpTBVertical->SetAccessibleRelationLabeledBy(mpTBVertical.get()); + mpMFLeftIndent->SetAccessibleRelationLabeledBy(mpFTLeftIndent.get()); + mpMtrAngle->SetAccessibleRelationLabeledBy(mpFtRotate.get()); +#ifdef HAS_IA2 + mpMtrAngle->SetMpSubEditAccLableBy(mpFtRotate.get()); +#endif +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK( AlignmentPropertyPanel, AngleModifiedHdl, void *, EMPTYARG ) +{ + OUString sTmp = mpMtrAngle->GetText(); + + sal_Unicode nChar = sTmp.isEmpty() ? 0 : sTmp[0]; + if((sTmp.getLength()== 1 && nChar == '-') || + (nChar != '-' && ((nChar < '0') || (nChar > '9') ) )) ////modify + return 0; + + double dTmp = sTmp.toDouble(); + FormatDegrees(dTmp); + + sal_Int64 nTmp = (sal_Int64)dTmp*100; + SfxInt32Item aAngleItem( SID_ATTR_ALIGN_DEGREES,(sal_uInt32) nTmp); + + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_ALIGN_DEGREES, SFX_CALLMODE_RECORD, &aAngleItem, 0L ); + return 0; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK( AlignmentPropertyPanel, RotationHdl, void *, EMPTYARG ) +{ + sal_Int32 nTmp = mpCtrlDial->GetRotation(); + SfxInt32Item aAngleItem( SID_ATTR_ALIGN_DEGREES,(sal_uInt32) nTmp); + + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_ALIGN_DEGREES, SFX_CALLMODE_RECORD, &aAngleItem, 0L ); + + return 0; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK( AlignmentPropertyPanel, ClickStackHdl, void *, EMPTYARG ) +{ + bool bVertical = mpCbStacked->IsChecked() ? true : false; + SfxBoolItem aStackItem( SID_ATTR_ALIGN_STACKED, bVertical ); + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_ALIGN_STACKED, SFX_CALLMODE_RECORD, &aStackItem, 0L ); + return 0; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK(AlignmentPropertyPanel, TbxHorAlignSelectHdl, ToolBox*, pToolBox) +{ + sal_uInt16 nId = pToolBox->GetCurItemId(); + + if(nId == ID_SUBSTLEFT) + { + if(meHorAlignState != SVX_HOR_JUSTIFY_LEFT) + meHorAlignState = SVX_HOR_JUSTIFY_LEFT; + else + meHorAlignState = SVX_HOR_JUSTIFY_STANDARD; + } + else if( nId == ID_SUBSTCENTER ) + { + if(meHorAlignState != SVX_HOR_JUSTIFY_CENTER) + meHorAlignState = SVX_HOR_JUSTIFY_CENTER; + else + meHorAlignState = SVX_HOR_JUSTIFY_STANDARD; + } + else if( nId == ID_SUBSTRIGHT ) + { + if(meHorAlignState != SVX_HOR_JUSTIFY_RIGHT) + meHorAlignState = SVX_HOR_JUSTIFY_RIGHT; + else + meHorAlignState = SVX_HOR_JUSTIFY_STANDARD; + } + else if( nId == ID_SUBSTJUSTIFY ) + { + if(meHorAlignState != SVX_HOR_JUSTIFY_BLOCK) + meHorAlignState = SVX_HOR_JUSTIFY_BLOCK; + else + meHorAlignState = SVX_HOR_JUSTIFY_STANDARD; + } + SvxHorJustifyItem aHorItem(meHorAlignState, SID_H_ALIGNCELL); + GetBindings()->GetDispatcher()->Execute(SID_H_ALIGNCELL, SFX_CALLMODE_RECORD, &aHorItem, 0L); + UpdateHorAlign(); + return 0; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK(AlignmentPropertyPanel, TbxVerAlignSelectHdl, ToolBox*, pToolBox) +{ + sal_uInt16 nId = pToolBox->GetCurItemId(); + + //Bold + if(nId == IID_VERT_TOP) + { + if(meVerAlignState != SVX_VER_JUSTIFY_TOP) + meVerAlignState = SVX_VER_JUSTIFY_TOP; + else + meVerAlignState = SVX_VER_JUSTIFY_STANDARD; + } + else if( nId == IID_VERT_CENTER ) + { + if(meVerAlignState != SVX_VER_JUSTIFY_CENTER) + meVerAlignState = SVX_VER_JUSTIFY_CENTER; + else + meVerAlignState = SVX_VER_JUSTIFY_STANDARD; + } + else if( nId == IID_VERT_BOTTOM ) + { + if(meVerAlignState != SVX_VER_JUSTIFY_BOTTOM) + meVerAlignState = SVX_VER_JUSTIFY_BOTTOM; + else + meVerAlignState = SVX_VER_JUSTIFY_STANDARD; + } + SvxVerJustifyItem aVerItem(meVerAlignState, SID_V_ALIGNCELL); + GetBindings()->GetDispatcher()->Execute(SID_V_ALIGNCELL, SFX_CALLMODE_RECORD, &aVerItem, 0L); + UpdateVerAlign(); + return 0; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK(AlignmentPropertyPanel, MFLeftIndentMdyHdl, void*, EMPTYARG) +{ + mpCBXWrapText->EnableTriState(false); + sal_uInt16 nVal = (sal_uInt16)mpMFLeftIndent->GetValue(); + SfxUInt16Item aItem( SID_ATTR_ALIGN_INDENT, (sal_uInt16)CalcToUnit( nVal, SFX_MAPUNIT_TWIP ) ); + + GetBindings()->GetDispatcher()->Execute(SID_ATTR_ALIGN_INDENT, SFX_CALLMODE_RECORD, &aItem, 0L); + return( 0L ); +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK(AlignmentPropertyPanel, CBOXMergnCellClkHdl, void*, EMPTYARG) +{ + bool bState = mpCBXMergeCell->IsChecked(); + + //Modified + //SfxBoolItem aItem( FID_MERGE_TOGGLE , bState); + //GetBindings()->GetDispatcher()->Execute(FID_MERGE_TOGGLE, SFX_CALLMODE_RECORD, &aItem, false, 0L); + if(bState) + GetBindings()->GetDispatcher()->Execute(FID_MERGE_ON, SFX_CALLMODE_RECORD); + else + GetBindings()->GetDispatcher()->Execute(FID_MERGE_OFF, SFX_CALLMODE_RECORD); + GetBindings()->Invalidate(FID_MERGE_TOGGLE,true,false); + //modified end + + return 0; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK(AlignmentPropertyPanel, CBOXWrapTextClkHdl, void*, EMPTYARG) +{ + bool bState = mpCBXWrapText->IsChecked(); + SfxBoolItem aItem( SID_ATTR_ALIGN_LINEBREAK , bState); + GetBindings()->GetDispatcher()->Execute(SID_ATTR_ALIGN_LINEBREAK, SFX_CALLMODE_RECORD, &aItem, 0L); + return 0; +} + +////////////////////////////////////////////////////////////////////////////// + +AlignmentPropertyPanel* AlignmentPropertyPanel::Create ( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings) +{ + if (pParent == NULL) + throw lang::IllegalArgumentException(A2S("no parent Window given to AlignmentPropertyPanel::Create"), NULL, 0); + if ( ! rxFrame.is()) + throw lang::IllegalArgumentException(A2S("no XFrame given to AlignmentPropertyPanel::Create"), NULL, 1); + if (pBindings == NULL) + throw lang::IllegalArgumentException(A2S("no SfxBindings given to AlignmentPropertyPanel::Create"), NULL, 2); + + return new AlignmentPropertyPanel( + pParent, + rxFrame, + pBindings); +} + +////////////////////////////////////////////////////////////////////////////// + +void AlignmentPropertyPanel::DataChanged( + const DataChangedEvent& rEvent) +{ + (void)rEvent; +} + +////////////////////////////////////////////////////////////////////////////// + +void AlignmentPropertyPanel::HandleContextChange( + const ::sfx2::sidebar::EnumContext aContext) +{ + if(maContext == aContext) + { + // Nothing to do. + return; + } + + maContext = aContext; + + + + // todo +} + +////////////////////////////////////////////////////////////////////////////// + +void AlignmentPropertyPanel::NotifyItemUpdate( + sal_uInt16 nSID, + SfxItemState eState, + const SfxPoolItem* pState) +{ + switch(nSID) + { + case SID_H_ALIGNCELL: + if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SvxHorJustifyItem) ) + { + const SvxHorJustifyItem* pItem = (const SvxHorJustifyItem*)pState; + meHorAlignState = (SvxCellHorJustify)pItem->GetValue(); + } + else + { + meHorAlignState = SVX_HOR_JUSTIFY_STANDARD; + } + UpdateHorAlign(); + break; + case SID_V_ALIGNCELL: + if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SvxVerJustifyItem) ) + { + const SvxVerJustifyItem* pItem = (const SvxVerJustifyItem*)pState; + meVerAlignState = (SvxCellVerJustify)pItem->GetValue(); + } + else + { + meVerAlignState = SVX_VER_JUSTIFY_STANDARD; + } + UpdateVerAlign(); + break; + case SID_ATTR_ALIGN_INDENT: + if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SfxUInt16Item) ) + { + const SfxUInt16Item* pItem = (const SfxUInt16Item*)pState; + sal_uInt16 nVal = pItem->GetValue(); + mpMFLeftIndent->SetValue( CalcToPoint(nVal, SFX_MAPUNIT_TWIP, 1) ); + } + else + { + mpMFLeftIndent->SetValue(0); + mpMFLeftIndent->SetText(String()); + } + break; + case FID_MERGE_TOGGLE: + if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SfxBoolItem) ) + { + mpCBXMergeCell->Enable(); + const SfxBoolItem* pItem = (const SfxBoolItem*)pState; + bool bVal = pItem->GetValue(); + if(bVal) + mpCBXMergeCell->Check(true); + else + mpCBXMergeCell->Check(false); + } + else + { + mpCBXMergeCell->Check(false); + mpCBXMergeCell->Disable(); + } + break; + + case SID_ATTR_ALIGN_LINEBREAK: + if(eState == SFX_ITEM_DISABLED) + { + mpCBXWrapText->EnableTriState(false); + mpCBXWrapText->Check(false); + mpCBXWrapText->Disable(); + } + else + { + mpCBXWrapText->Enable(); + if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SfxBoolItem) ) + { + mpCBXWrapText->EnableTriState(false); + const SfxBoolItem* pItem = (const SfxBoolItem*)pState; + bool bVal = pItem->GetValue(); + if(bVal) + mpCBXWrapText->Check(true); + else + mpCBXWrapText->Check(false); + } + else if(eState == SFX_ITEM_DONTCARE) + { + mpCBXWrapText->EnableTriState(true); + mpCBXWrapText->SetState(STATE_DONTKNOW); + } + } + break; + case SID_ATTR_ALIGN_DEGREES: + if (eState >= SFX_ITEM_AVAILABLE) + { + long nTmp = ((const SfxInt32Item*)pState)->GetValue(); + mpMtrAngle->SetValue( nTmp / 100); //wj + mpCtrlDial->SetRotation( nTmp ); + switch(nTmp) + { + case 0: + mpMtrAngle->SelectEntryPos(0); + break; + case 4500: + mpMtrAngle->SelectEntryPos(1); + break; + case 9000: + mpMtrAngle->SelectEntryPos(2); + break; + case 13500: + mpMtrAngle->SelectEntryPos(3); + break; + case 18000: + mpMtrAngle->SelectEntryPos(4); + break; + case 22500: + mpMtrAngle->SelectEntryPos(5); + break; + case 27000: + mpMtrAngle->SelectEntryPos(6); + break; + case 31500: + mpMtrAngle->SelectEntryPos(7); + } + } + else + { + mpMtrAngle->SetText( String() ); + mpCtrlDial->SetRotation( 0 ); + } + break; + case SID_ATTR_ALIGN_STACKED: + if (eState >= SFX_ITEM_AVAILABLE) + { + mpCbStacked->EnableTriState(false); + const SfxBoolItem* aStackItem = (const SfxBoolItem*)pState; + bool IsChecked = (bool)aStackItem->GetValue(); + if(IsChecked) + { + mpCbStacked->Check(IsChecked); + mpFtRotate->Disable(); + mpMtrAngle->Disable(); + mpCtrlDial->Disable(); + mbMultiDisable = true; + } + else + { + mpCbStacked->Check(IsChecked); + mpFtRotate->Enable(); + mpMtrAngle->Enable(); + mpCtrlDial->Enable(); + mbMultiDisable = false; + } + } + else + { + mbMultiDisable = true; + mpFtRotate->Disable(); + mpMtrAngle->Disable(); + mpCtrlDial->Disable(); + mpCbStacked->EnableTriState(true); + mpCbStacked->SetState(STATE_DONTKNOW); + } + } +} + +////////////////////////////////////////////////////////////////////////////// + +SfxBindings* AlignmentPropertyPanel::GetBindings() +{ + return mpBindings; +} + +////////////////////////////////////////////////////////////////////////////// + +void AlignmentPropertyPanel::FormatDegrees(double& dTmp) +{ + while(dTmp<0) + dTmp += 360; + while (dTmp > 359) //modify + dTmp = 359; +} + +////////////////////////////////////////////////////////////////////////////// + +void AlignmentPropertyPanel::UpdateHorAlign() +{ + mpTBHorizontal->SetItemState(ID_SUBSTLEFT, STATE_NOCHECK); + mpTBHorizontal->SetItemState(ID_SUBSTCENTER, STATE_NOCHECK); + mpTBHorizontal->SetItemState(ID_SUBSTRIGHT, STATE_NOCHECK); + mpTBHorizontal->SetItemState(ID_SUBSTJUSTIFY,STATE_NOCHECK); + mpFTLeftIndent->Disable(); + mpMFLeftIndent->Disable(); + if(meHorAlignState==SVX_HOR_JUSTIFY_REPEAT) + { + mpFtRotate->Disable(); + mpCtrlDial->Disable(); + mpMtrAngle->Disable(); + mpCbStacked->Disable(); + } + else + { + if(!mbMultiDisable) + { + mpFtRotate->Enable(); + mpCtrlDial->Enable(); + mpMtrAngle->Enable(); + } + else + { + mpFtRotate->Disable(); + mpCtrlDial->Disable(); + mpMtrAngle->Disable(); + } + mpCbStacked->Enable(); + } + switch(meHorAlignState) + { + case SVX_HOR_JUSTIFY_LEFT: + mpTBHorizontal->SetItemState(ID_SUBSTLEFT, STATE_CHECK); + mpFTLeftIndent->Enable(); + mpMFLeftIndent->Enable(); + break; + case SVX_HOR_JUSTIFY_CENTER:mpTBHorizontal->SetItemState(ID_SUBSTCENTER, STATE_CHECK);break; + case SVX_HOR_JUSTIFY_RIGHT: mpTBHorizontal->SetItemState(ID_SUBSTRIGHT, STATE_CHECK);break; + case SVX_HOR_JUSTIFY_BLOCK: mpTBHorizontal->SetItemState(ID_SUBSTJUSTIFY,STATE_CHECK);break; + default:; + } +} + +////////////////////////////////////////////////////////////////////////////// + +void AlignmentPropertyPanel::UpdateVerAlign() +{ + mpTBVertical->SetItemState(IID_VERT_TOP, STATE_NOCHECK); + mpTBVertical->SetItemState(IID_VERT_CENTER, STATE_NOCHECK); + mpTBVertical->SetItemState(IID_VERT_BOTTOM, STATE_NOCHECK); + + switch(meVerAlignState) + { + case SVX_VER_JUSTIFY_TOP: mpTBVertical->SetItemState(IID_VERT_TOP, STATE_CHECK);break; + case SVX_VER_JUSTIFY_CENTER:mpTBVertical->SetItemState(IID_VERT_CENTER, STATE_CHECK);break; + case SVX_VER_JUSTIFY_BOTTOM: mpTBVertical->SetItemState(IID_VERT_BOTTOM, STATE_CHECK);break; + default:; + } +} + +////////////////////////////////////////////////////////////////////////////// +// namespace close + +}} // end of namespace ::sc::sidebar + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.hrc b/sc/source/ui/sidebar/AlignmentPropertyPanel.hrc new file mode 100644 index 000000000000..96b795f06fac --- /dev/null +++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.hrc @@ -0,0 +1,84 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +// RID_PROPERTYPANEL_SC_ALIGNMENT-------------------------------------------------------------- +#define FT_ORIENT 1 +#define CBX_WRAP 5 +#define FT_LEFT_INDENT 7 +#define MF_LEFT_INDENT 8 +#define CBX_MERGE 9 +#define CBX_VERT 10 +#define CTL_SBSHAPE_POSREFERENCE 12 +#define CBOX_ANGLE 14 +#define TBX_HORIZONTAL_ALIGNMENT 15 +#define TBX_VERTICAL_ALIGN 16 +#define DIAL_CONTROL 17 +#define ID_SUBSTLEFT 20 +#define ID_SUBSTCENTER 21 +#define ID_SUBSTRIGHT 22 +#define ID_SUBSTJUSTIFY 23 +#define IID_VERT_TOP 24 +#define IID_VERT_CENTER 25 +#define IID_VERT_BOTTOM 26 + +#define MBOX_WIDTH 45 +#define TEXT_WIDTH 40 +#define FLIP_BUTTON_SIZE 13 +#define ALIGNMENT_TBX_HEIGHT 17 +#define ALIGNMENT_TBX_WIDTH 13 + +#define IMG_ALIGN_LEFT 50 +#define IMG_ALIGN_CENTER 51 +#define IMG_ALIGN_RIGHT 52 +#define IMG_ALIGN_JUST 53 +#define IMG_ALIGN_TOP 54 +#define IMG_ALIGN_CENTER_V 55 +#define IMG_ALIGN_BOTTOM 56 + +//---------------position----------------- + +#define ALIGNMENT_X SECTIONPAGE_MARGIN_HORIZONTAL +#define ALIGNMENT_Y SECTIONPAGE_MARGIN_VERTICAL_TOP +#define ALIGNMENT_VERT_X (ALIGNMENT_X + TBX_OUT_BORDER_OFFSET_X*2 + TOOLBOX_ITEM_WIDTH * 4 + CONTROL_SPACING_HORIZONTAL) +#define ALIGNMENT_VERT_Y ALIGNMENT_Y + +#define FT_LEFTINDENT_X ALIGNMENT_X +#define FT_LEFTINDENT_Y (ALIGNMENT_Y + TOOLBOX_ITEM_HEIGHT + TBX_OUT_BORDER_OFFSET_Y + CONTROL_SPACING_VERTICAL) +#define MTR_LEFTINDENT_X ALIGNMENT_X +#define MTR_LEFTINDENT_Y (FT_LEFTINDENT_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL) + +#define CBX_WRAP_X (ALIGNMENT_X + TEXT_WIDTH + 10 + CONTROL_SPACING_HORIZONTAL) +#define CBX_WRAP_Y (FT_LEFTINDENT_Y + 2) + +#define CBX_MERGE_X CBX_WRAP_X +#define CBX_MERGE_Y CBX_WRAP_Y + CBOX_HEIGHT + 2 + +#define FT_ORIENT_X ALIGNMENT_X +#define FT_ORIENT_Y MTR_LEFTINDENT_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL + +#define COMOBX_ROTATION_X FT_ORIENT_X + 30 + CONTROL_SPACING_HORIZONTAL +#define COMOBX_ROTATION_Y FT_ORIENT_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + 5 + +#define ROTATE_CONTROL_X FT_ORIENT_X +#define ROTATE_CONTROL_Y COMOBX_ROTATION_Y - 3 + +#define CBX_VERT_X COMOBX_ROTATION_X +#define CBX_VERT_Y COMOBX_ROTATION_Y + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL + 2 + +#define PANEL_HEIGHT CBX_VERT_Y + 6 + SECTIONPAGE_MARGIN_VERTICAL_BOT + +// eof diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx new file mode 100644 index 000000000000..07d3e06540b0 --- /dev/null +++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx @@ -0,0 +1,126 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SC_PROPERTYPANEL_ALIGNMENT_HXX +#define SC_PROPERTYPANEL_ALIGNMENT_HXX + +#include <sfx2/sidebar/SidebarPanelBase.hxx> +#include <sfx2/sidebar/ControllerItem.hxx> +#include <sfx2/sidebar/IContextChangeReceiver.hxx> +#include <vcl/fixed.hxx> +#include <boost/scoped_ptr.hpp> +#include <editeng/svxenum.hxx> + +class ToolBox; +class MetricField; +class MetricBox; +class CheckBox; +namespace svx { namespace sidebar { class SidebarDialControl; }} + +namespace sc { namespace sidebar { + +class AlignmentPropertyPanel +: public Control, + public ::sfx2::sidebar::IContextChangeReceiver, + public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface +{ +public: + static AlignmentPropertyPanel* Create( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings); + + virtual void DataChanged( + const DataChangedEvent& rEvent); + + virtual void HandleContextChange( + const ::sfx2::sidebar::EnumContext aContext); + + virtual void NotifyItemUpdate( + const sal_uInt16 nSId, + const SfxItemState eState, + const SfxPoolItem* pState); + + SfxBindings* GetBindings(); + +private: + //ui controls + ::boost::scoped_ptr<Window> mpTBHorizontalBackground; + ::boost::scoped_ptr< ToolBox > mpTBHorizontal; + ::boost::scoped_ptr<Window> mpTBVerticalBackground; + ::boost::scoped_ptr< ToolBox > mpTBVertical; + ::boost::scoped_ptr< FixedText > mpFTLeftIndent; + ::boost::scoped_ptr< MetricField > mpMFLeftIndent; + ::boost::scoped_ptr< CheckBox > mpCBXWrapText; + ::boost::scoped_ptr< CheckBox > mpCBXMergeCell; + ::boost::scoped_ptr< FixedText > mpFtRotate; + ::boost::scoped_ptr< svx::sidebar::SidebarDialControl > mpCtrlDial; + ::boost::scoped_ptr< MetricBox > mpMtrAngle; + ::boost::scoped_ptr< CheckBox > mpCbStacked; + + ::sfx2::sidebar::ControllerItem maAlignHorControl; + ::sfx2::sidebar::ControllerItem maAlignVerControl; + ::sfx2::sidebar::ControllerItem maLeftIndentControl; + ::sfx2::sidebar::ControllerItem maMergeCellControl; + ::sfx2::sidebar::ControllerItem maWrapTextControl; + ::sfx2::sidebar::ControllerItem maAngleControl; + ::sfx2::sidebar::ControllerItem maStackControl; + + Image maIMGAlignLeft; + Image maIMGAlignCenter; + Image maIMGAlignRight; + Image maIMGAlignJust; + Image maIMGAlignTop; + Image maIMGAlignCenterV; + Image maIMGAlignBottom; + + SvxCellHorJustify meHorAlignState; + SvxCellVerJustify meVerAlignState; + + /// bitfield + bool mbMultiDisable : 1; + + cssu::Reference<css::frame::XFrame> mxFrame; + ::sfx2::sidebar::EnumContext maContext; + SfxBindings* mpBindings; + + DECL_LINK( TbxHorAlignSelectHdl, ToolBox* ); + DECL_LINK( TbxVerAlignSelectHdl, ToolBox* ); + DECL_LINK( MFLeftIndentMdyHdl, void * ); + DECL_LINK( CBOXMergnCellClkHdl, void * ); + DECL_LINK( CBOXWrapTextClkHdl, void * ); + DECL_LINK( AngleModifiedHdl, void * ); + DECL_LINK( RotationHdl, void * ); + DECL_LINK( ClickStackHdl, void * ); + + // constructor/destuctor + AlignmentPropertyPanel( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings); + virtual ~AlignmentPropertyPanel(); + + void Initialize(); + void UpdateHorAlign(); + void UpdateVerAlign(); + void FormatDegrees(double& dTmp); +}; + +} } // end of namespace ::sc::sidebar + +#endif +// eof diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.src b/sc/source/ui/sidebar/AlignmentPropertyPanel.src new file mode 100644 index 000000000000..5a5501295524 --- /dev/null +++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.src @@ -0,0 +1,213 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "AlignmentPropertyPanel.hrc" +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include "sc.hrc" +#include "helpids.h" + +Control RID_PROPERTYPANEL_SC_ALIGNMENT +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + + Size = MAP_APPFONT( PROPERTYPAGE_WIDTH, PANEL_HEIGHT ); + HelpID = HID_PROPERTYPANEL_SC_ALIGN_SECTION; + Text [ en-US ] = "Alignment"; + + //------------ Alignment ------------- + ToolBox TBX_HORIZONTAL_ALIGNMENT + { + Pos = MAP_APPFONT ( ALIGNMENT_X , ALIGNMENT_Y ); + Size = MAP_APPFONT ( ALIGNMENT_TBX_WIDTH*4 ,ALIGNMENT_TBX_HEIGHT); + SVLook = TRUE ; + Border = FALSE ; + HelpID = HID_PROPERTY_PANEL_ALIGN_TBX_HOR; + Text [ en-US ] = "Horizontal Alignment" ; + ItemList = + { + ToolBoxItem + { + Identifier = ID_SUBSTLEFT ; + Text [ en-US ] = "Align Left" ; + HelpID = HID_PROPERTY_PANEL_ALIGN_TBI_HOR_L; + }; + ToolBoxItem + { + Identifier = ID_SUBSTCENTER ; + Text [ en-US ] = "Align Center" ; + HelpID = HID_PROPERTY_PANEL_ALIGN_TBI_HOR_C; + }; + ToolBoxItem + { + Identifier = ID_SUBSTRIGHT ; + Text [ en-US ] = "Align Right" ; + HelpID = HID_PROPERTY_PANEL_ALIGN_TBI_HOR_R; + }; + ToolBoxItem + { + Identifier = ID_SUBSTJUSTIFY ; + Text [ en-US ] = "Align Justified" ; + HelpID = HID_PROPERTY_PANEL_ALIGN_TBI_HOR_J; + }; + }; + }; + ToolBox TBX_VERTICAL_ALIGN + { + SVLook = TRUE ; + Border = FALSE ; + Pos = MAP_APPFONT ( ALIGNMENT_VERT_X, ALIGNMENT_VERT_Y ) ; + Size = MAP_APPFONT ( TOOLBOX_ITEM_WIDTH * 3 , TOOLBOX_ITEM_HEIGHT) ; + TabStop = TRUE ; + HelpID = HID_PROPERTY_PANEL_ALIGN_TBX_VER; + Text [ en-US ] = "Vertical Alignment" ; + ItemList = + { + ToolBoxItem + { + Identifier = IID_VERT_TOP ; + Text [ en-US ] = "Align Top" ; + HelpID = HID_PROPERTY_PANEL_ALIGN_TBI_VER_T; + }; + + ToolBoxItem + { + Identifier = IID_VERT_CENTER ; + Text [ en-US ] = "Align Center Vertically" ; + HelpID = HID_PROPERTY_PANEL_ALIGN_TBI_VER_C; + }; + + ToolBoxItem + { + Identifier = IID_VERT_BOTTOM ; + Text [ en-US ] = "Align Bottom" ; + HelpID = HID_PROPERTY_PANEL_ALIGN_TBI_VER_B; + }; + }; + }; + //------------ Left indent ------------ + FixedText FT_LEFT_INDENT + { + Pos = MAP_APPFONT ( FT_LEFTINDENT_X, FT_LEFTINDENT_Y ); + Size = MAP_APPFONT (CBX_WRAP_X - FT_LEFTINDENT_X - 1 , TEXT_HEIGHT) ; //MBOX_WIDTH + Text [ en-US ] = "Left ~indent:"; + }; + MetricField MF_LEFT_INDENT + { + Border = TRUE; + Pos = MAP_APPFONT ( MTR_LEFTINDENT_X , MTR_LEFTINDENT_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH, MBOX_HEIGHT ) ; + TabStop = TRUE; + Repeat = TRUE; + Spin = TRUE; + Minimum = 0; + Maximum = 990; + Unit = FUNIT_POINT; + SpinSize = 10; + QuickHelpText [ en-US ] = "Indents from the left edge."; + HelpID = HID_PROPERTY_PANEL_ALIGN_MBX_INDENT; + }; + CheckBox CBX_WRAP + { + Pos = MAP_APPFONT ( CBX_WRAP_X , CBX_WRAP_Y ) ; + Size = MAP_APPFONT (PROPERTYPAGE_WIDTH - CBX_WRAP_X - 1 , CBOX_HEIGHT ) ;// + TabStop = TRUE ; + Text [ en-US ] = "~Wrap text" ; + QuickHelpText [ en-US ] = "Wrap texts automatically."; + HelpID = HID_PROPERTY_PANEL_ALIGN_CBX_WRAP; + }; + CheckBox CBX_MERGE + { + Pos = MAP_APPFONT ( CBX_MERGE_X , CBX_MERGE_Y ) ; + Size = MAP_APPFONT ( PROPERTYPAGE_WIDTH - CBX_WRAP_X - 1 , CBOX_HEIGHT ) ;// + TabStop = TRUE ; + Text [ en-US ] = "~Merge cells" ; + QuickHelpText [ en-US ] = "Joins the selected cells into one."; + HelpID = HID_PROPERTY_PANEL_ALIGN_CBX_MERGE; + }; + //------------ Text orientation ------------ + FixedText FT_ORIENT + { + Pos = MAP_APPFONT ( FT_ORIENT_X, FT_ORIENT_Y ); + Size = MAP_APPFONT ( TEXT_WIDTH + 50, TEXT_HEIGHT) ; + Text [ en-US ] = "Text ~orientation:"; + }; + MetricBox CBOX_ANGLE + { + Border = TRUE ; + Pos = MAP_APPFONT ( COMOBX_ROTATION_X , COMOBX_ROTATION_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH + 20, MBOX_HEIGHT ) ; + Unit = FUNIT_CUSTOM ; + CustomUnitText [ en-US ] = " degrees"; + DecimalDigits = 0; + Minimum = 0; + Maximum = 359; + TabStop = TRUE ; + DropDown = TRUE ; + QuickHelpText [ en-US ] = "Select the angle for rotation."; + HelpID = HID_PROPERTY_PANEL_ALIGN_MBX_ANGLE; + }; + + Control DIAL_CONTROL + { + Pos = MAP_APPFONT ( ROTATE_CONTROL_X , ROTATE_CONTROL_Y ); + Size = MAP_PIXEL( 50, 50 ); + HelpID = HID_PROPERTY_PANEL_ALIGN_DIAL_CONTROL; + QuickHelpText [ en-US ] = "Drag to change the rotation value."; + }; + CheckBox CBX_VERT + { + Pos = MAP_APPFONT ( CBX_VERT_X , CBX_VERT_Y ) ; + Size = MAP_APPFONT ( MBOX_WIDTH + 20 , CBOX_HEIGHT + 5 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Vertically stacked" ; + QuickHelpText [ en-US ] = "Aligns text vertically."; + HelpID = HID_PROPERTY_PANEL_ALIGN_CBX_VERT; + }; + + Image IMG_ALIGN_LEFT + { + ImageBitmap = Bitmap{File = "sidebar/sc_alignleft.png";}; + }; + Image IMG_ALIGN_CENTER + { + ImageBitmap = Bitmap{File = "sidebar/sc_aligncenter.png";}; + }; + Image IMG_ALIGN_RIGHT + { + ImageBitmap = Bitmap{File = "sidebar/sc_alignright.png";}; + }; + Image IMG_ALIGN_JUST + { + ImageBitmap = Bitmap{File = "sidebar/sc_alignjust.png";}; + }; + Image IMG_ALIGN_TOP + { + ImageBitmap = Bitmap{File = "sidebar/sc_aligntop.png";}; + }; + Image IMG_ALIGN_CENTER_V + { + ImageBitmap = Bitmap{File = "sidebar/sc_aligncenter_v.png";}; + }; + Image IMG_ALIGN_BOTTOM + { + ImageBitmap = Bitmap{File = "sidebar/sc_alignbottom.png";}; + }; +}; + +// eof diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx new file mode 100644 index 000000000000..fe48df6ccf03 --- /dev/null +++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx @@ -0,0 +1,865 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include <sfx2/sidebar/Theme.hxx> +#include <sfx2/sidebar/ControlFactory.hxx> +#include <CellAppearancePropertyPanel.hxx> +#include <CellAppearancePropertyPanel.hrc> +#include "sc.hrc" +#include "scresid.hxx" +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <vcl/fixed.hxx> +#include <svx/tbxcolorupdate.hxx> +#include <svl/eitem.hxx> +#include <editeng/borderline.hxx> +#include <editeng/boxitem.hxx> +#include <editeng/colritem.hxx> +#include <editeng/lineitem.hxx> +#include <vcl/svapp.hxx> +#include <svx/sidebar/ColorControl.hxx> +#include <boost/bind.hpp> +#include <svx/sidebar/PopupContainer.hxx> +#include <CellLineStyleControl.hxx> +#include <CellLineStylePopup.hxx> +#include <CellBorderUpdater.hxx> +#include <CellBorderStyleControl.hxx> +#include <CellBorderStylePopup.hxx> + +using namespace css; +using namespace cssu; + +#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) + +////////////////////////////////////////////////////////////////////////////// +// helpers + +namespace +{ + Color GetTransparentColor(void) + { + return COL_TRANSPARENT; + } +} // end of anonymous namespace + +////////////////////////////////////////////////////////////////////////////// +// namespace open + +namespace sc { namespace sidebar { + +////////////////////////////////////////////////////////////////////////////// + +svx::sidebar::PopupControl* CellAppearancePropertyPanel::CreateFillColorPopupControl(svx::sidebar::PopupContainer* pParent) +{ + const ScResId aResId(VS_NOFILLCOLOR); + + return new svx::sidebar::ColorControl( + pParent, + mpBindings, + ScResId(RID_POPUPPANEL_CELLAPPEARANCE_FILLCOLOR), + ScResId(VS_FILLCOLOR), + ::boost::bind(GetTransparentColor), + ::boost::bind(&CellAppearancePropertyPanel::SetFillColor, this, _1, _2), + pParent, + &aResId); +} + +void CellAppearancePropertyPanel::SetFillColor( + const String& /*rsColorName*/, + const Color aColor) +{ + const SvxColorItem aColorItem(aColor, SID_BACKGROUND_COLOR); + mpBindings->GetDispatcher()->Execute(SID_BACKGROUND_COLOR, SFX_CALLMODE_RECORD, &aColorItem, 0L); + maBackColor = aColor; +} + +////////////////////////////////////////////////////////////////////////////// + +svx::sidebar::PopupControl* CellAppearancePropertyPanel::CreateLineColorPopupControl(svx::sidebar::PopupContainer* pParent) +{ + return new svx::sidebar::ColorControl( + pParent, + mpBindings, + ScResId(RID_POPUPPANEL_CELLAPPEARANCE_LINECOLOR), + ScResId(VS_LINECOLOR), + ::boost::bind(GetTransparentColor), + ::boost::bind(&CellAppearancePropertyPanel::SetLineColor, this, _1, _2), + pParent, + 0); +} + +void CellAppearancePropertyPanel::SetLineColor( + const String& /*rsColorName*/, + const Color aColor) +{ + const SvxColorItem aColorItem(aColor, SID_FRAME_LINECOLOR); + mpBindings->GetDispatcher()->Execute(SID_FRAME_LINECOLOR, SFX_CALLMODE_RECORD, &aColorItem, 0L); + maLineColor = aColor; +} + +////////////////////////////////////////////////////////////////////////////// + +svx::sidebar::PopupControl* CellAppearancePropertyPanel::CreateCellLineStylePopupControl(svx::sidebar::PopupContainer* pParent) +{ + return new CellLineStyleControl(pParent, *this); +} + +void CellAppearancePropertyPanel::EndCellLineStylePopupMode(void) +{ + if(mpCellLineStylePopup.get()) + { + mpCellLineStylePopup->Hide(); + } +} + +////////////////////////////////////////////////////////////////////////////// + +svx::sidebar::PopupControl* CellAppearancePropertyPanel::CreateCellBorderStylePopupControl(svx::sidebar::PopupContainer* pParent) +{ + return new CellBorderStyleControl(pParent, *this); +} + +void CellAppearancePropertyPanel::EndCellBorderStylePopupMode(void) +{ + if(mpCellBorderStylePopup.get()) + { + mpCellBorderStylePopup->Hide(); + } +} + +////////////////////////////////////////////////////////////////////////////// + +CellAppearancePropertyPanel::CellAppearancePropertyPanel( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings) +: Control( + pParent, + ScResId(RID_PROPERTYPANEL_SC_APPEAR)), + + mpFTFillColor(new FixedText(this, ScResId(FT_BK_COLOR))), + mpTBFillColorBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), + mpTBFillColor(sfx2::sidebar::ControlFactory::CreateToolBox(mpTBFillColorBackground.get(), ScResId(TB_BK_COLOR))), + mpFillColorUpdater(new ::svx::ToolboxButtonColorUpdater(SID_ATTR_BRUSH, TBI_BK_COLOR, mpTBFillColor.get(), TBX_UPDATER_MODE_CHAR_COLOR_NEW)), + + mpFTCellBorder(new FixedText(this, ScResId(FT_BORDER))), + mpTBCellBorderBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), + mpTBCellBorder(sfx2::sidebar::ControlFactory::CreateToolBox(mpTBCellBorderBackground.get(), ScResId(TB_APP_BORDER))), + mpCellBorderUpdater(new CellBorderUpdater(TBI_BORDER, *mpTBCellBorder)), + + mpTBLineStyleBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), + mpTBLineStyle(sfx2::sidebar::ControlFactory::CreateToolBox(mpTBLineStyleBackground.get(), ScResId(TB_BORDER_LINE_STYLE))), + + mpTBLineColorBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), + mpTBLineColor(sfx2::sidebar::ControlFactory::CreateToolBox(mpTBLineColorBackground.get(), ScResId(TB_BORDER_LINE_COLOR))), + mpLineColorUpdater(new ::svx::ToolboxButtonColorUpdater(SID_FRAME_LINECOLOR, TBI_LINE_COLOR, mpTBLineColor.get(), TBX_UPDATER_MODE_CHAR_COLOR_NEW)), + + mpCBXShowGrid(new CheckBox(this, ScResId(CBX_SHOW_GRID))), + + maBackColorControl(SID_BACKGROUND_COLOR, *pBindings, *this), + maLineColorControl(SID_FRAME_LINECOLOR, *pBindings, *this), + maLineStyleControl(SID_FRAME_LINESTYLE, *pBindings, *this), + maBorderOuterControl(SID_ATTR_BORDER_OUTER, *pBindings, *this), + maBorderInnerControl(SID_ATTR_BORDER_INNER, *pBindings, *this), + maGridShowControl(SID_SCGRIDSHOW, *pBindings, *this), + maBorderTLBRControl(SID_ATTR_BORDER_DIAG_TLBR, *pBindings, *this), + maBorderBLTRControl(SID_ATTR_BORDER_DIAG_BLTR, *pBindings, *this), + + maIMGBKColor(ScResId(IMG_BK_COLOR)), + maIMGCellBorder(ScResId(IMG_CELL_BORDER)), + maIMGLineColor(ScResId(IMG_LINE_COLOR)), + maIMGLineStyle1(ScResId(IMG_LINE_STYLE1)), + maIMGLineStyle2(ScResId(IMG_LINE_STYLE2)), + maIMGLineStyle3(ScResId(IMG_LINE_STYLE3)), + maIMGLineStyle4(ScResId(IMG_LINE_STYLE4)), + maIMGLineStyle5(ScResId(IMG_LINE_STYLE5)), + maIMGLineStyle6(ScResId(IMG_LINE_STYLE6)), + maIMGLineStyle7(ScResId(IMG_LINE_STYLE7)), + maIMGLineStyle8(ScResId(IMG_LINE_STYLE8)), + maIMGLineStyle9(ScResId(IMG_LINE_STYLE9)), + + maBackColor(COL_TRANSPARENT), + maLineColor(COL_BLACK), + maTLBRColor(COL_BLACK), + maBLTRColor(COL_BLACK), + mnIn(0), + mnOut(0), + mnDis(0), + mnTLBRIn(0), + mnTLBROut(0), + mnTLBRDis(0), + mnBLTRIn(0), + mnBLTROut(0), + mnBLTRDis(0), + mbBackColorAvailable(true), + mbLineColorAvailable(true), + mbBorderStyleAvailable(true), + mbLeft(false), + mbRight(false), + mbTop(false), + mbBottom(false), + mbVer(false), + mbHor(false), + mbOuterBorder(false), + mbInnerBorder(false), + mbTLBR(false), + mbBLTR(false), + + maFillColorPopup(this, ::boost::bind(&CellAppearancePropertyPanel::CreateFillColorPopupControl, this, _1)), + maLineColorPopup(this, ::boost::bind(&CellAppearancePropertyPanel::CreateLineColorPopupControl, this, _1)), + mpCellLineStylePopup(), + mpCellBorderStylePopup(), + + mxFrame(rxFrame), + maContext(), + mpBindings(pBindings) +{ + Initialize(); + FreeResource(); +} + +////////////////////////////////////////////////////////////////////////////// + +CellAppearancePropertyPanel::~CellAppearancePropertyPanel() +{ + // Destroy the toolboxes, then their background windows. + mpTBFillColor.reset(); + mpTBCellBorder.reset(); + mpTBLineStyle.reset(); + mpTBLineColor.reset(); + + mpTBFillColorBackground.reset(); + mpTBCellBorderBackground.reset(); + mpTBLineStyleBackground.reset(); + mpTBLineColorBackground.reset(); +} + +////////////////////////////////////////////////////////////////////////////// + +void CellAppearancePropertyPanel::Initialize() +{ + mpTBFillColor->SetItemImage(TBI_BK_COLOR, maIMGBKColor); + mpTBFillColor->SetItemBits( TBI_BK_COLOR, mpTBFillColor->GetItemBits( TBI_BK_COLOR ) | TIB_DROPDOWNONLY ); + mpTBFillColor->SetQuickHelpText(TBI_BK_COLOR,String(ScResId(STR_QH_BK_COLOR))); //Add + Size aTbxSize1( mpTBFillColor->CalcWindowSizePixel() ); + mpTBFillColor->SetOutputSizePixel( aTbxSize1 ); + mpTBFillColor->SetBackground(Wallpaper()); + mpTBFillColor->SetPaintTransparent(true); + Link aLink = LINK(this, CellAppearancePropertyPanel, TbxBKColorSelectHdl); + mpTBFillColor->SetDropdownClickHdl ( aLink ); + mpTBFillColor->SetSelectHdl ( aLink ); + + mpTBCellBorder->SetItemImage(TBI_BORDER, maIMGCellBorder); + mpTBCellBorder->SetItemBits( TBI_BORDER, mpTBCellBorder->GetItemBits( TBI_BORDER ) | TIB_DROPDOWNONLY ); + mpTBCellBorder->SetQuickHelpText(TBI_BORDER,String(ScResId(STR_QH_BORDER))); //Add + Size aTbxSize2( mpTBCellBorder->CalcWindowSizePixel() ); + mpTBCellBorder->SetOutputSizePixel( aTbxSize2 ); + mpTBCellBorder->SetBackground(Wallpaper()); + mpTBCellBorder->SetPaintTransparent(true); + aLink = LINK(this, CellAppearancePropertyPanel, TbxCellBorderSelectHdl); + mpTBCellBorder->SetDropdownClickHdl ( aLink ); + mpTBCellBorder->SetSelectHdl ( aLink ); + + mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, maIMGLineStyle1); + mpTBLineStyle->SetItemBits( TBI_LINE_STYLE, mpTBLineStyle->GetItemBits( TBI_LINE_STYLE ) | TIB_DROPDOWNONLY ); + mpTBLineStyle->SetQuickHelpText(TBI_LINE_STYLE,String(ScResId(STR_QH_BORDER_LINE_STYLE))); //Add + Size aTbxSize3( mpTBLineStyle->CalcWindowSizePixel() ); + mpTBLineStyle->SetOutputSizePixel( aTbxSize3 ); + mpTBLineStyle->SetBackground(Wallpaper()); + mpTBLineStyle->SetPaintTransparent(true); + aLink = LINK(this, CellAppearancePropertyPanel, TbxLineStyleSelectHdl); + mpTBLineStyle->SetDropdownClickHdl ( aLink ); + mpTBLineStyle->SetSelectHdl ( aLink ); + mpTBLineStyle->Disable(); + + mpTBLineColor->SetItemImage(TBI_LINE_COLOR, maIMGLineColor); + mpTBLineColor->SetItemBits( TBI_LINE_COLOR, mpTBLineColor->GetItemBits( TBI_LINE_COLOR ) | TIB_DROPDOWNONLY ); + mpTBLineColor->SetQuickHelpText(TBI_LINE_COLOR,String(ScResId(STR_QH_BORDER_LINE_COLOR))); //Add + Size aTbxSize4( mpTBLineColor->CalcWindowSizePixel() ); + mpTBLineColor->SetOutputSizePixel( aTbxSize4 ); + mpTBLineColor->SetBackground(Wallpaper()); + mpTBLineColor->SetPaintTransparent(true); + aLink = LINK(this, CellAppearancePropertyPanel, TbxLineColorSelectHdl); + mpTBLineColor->SetDropdownClickHdl ( aLink ); + mpTBLineColor->SetSelectHdl ( aLink ); + mpTBLineColor->Disable(); + + aLink = LINK(this, CellAppearancePropertyPanel, CBOXGridShowClkHdl); + mpCBXShowGrid->SetClickHdl ( aLink ); + + mpTBFillColor->SetAccessibleRelationLabeledBy(mpFTFillColor.get()); + mpTBLineColor->SetAccessibleRelationLabeledBy(mpTBLineColor.get()); + mpTBCellBorder->SetAccessibleRelationLabeledBy(mpFTCellBorder.get()); + mpTBLineStyle->SetAccessibleRelationLabeledBy(mpTBLineStyle.get()); +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK(CellAppearancePropertyPanel, TbxBKColorSelectHdl, ToolBox*, pToolBox) +{ + sal_uInt16 nId = pToolBox->GetCurItemId(); + if(nId == TBI_BK_COLOR) + { + maFillColorPopup.Show(*pToolBox); + maFillColorPopup.SetCurrentColor(maBackColor, mbBackColorAvailable); + } + return 0; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK(CellAppearancePropertyPanel, TbxLineColorSelectHdl, ToolBox*, pToolBox) +{ + sal_uInt16 nId = pToolBox->GetCurItemId(); + if(nId == TBI_LINE_COLOR) + { + maLineColorPopup.Show(*pToolBox); + maLineColorPopup.SetCurrentColor(maLineColor, mbLineColorAvailable); + } + return 0; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK(CellAppearancePropertyPanel, TbxCellBorderSelectHdl, ToolBox*, pToolBox) +{ + sal_uInt16 nId = pToolBox->GetCurItemId(); + + if(nId == TBI_BORDER) + { + // create popup on demand + if(!mpCellBorderStylePopup.get()) + { + mpCellBorderStylePopup.reset( + new CellBorderStylePopup( + this, + ::boost::bind(&CellAppearancePropertyPanel::CreateCellBorderStylePopupControl, this, _1))); + } + + if(mpCellBorderStylePopup.get()) + { + mpCellBorderStylePopup->Show(*pToolBox); + } + } + return 0; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK(CellAppearancePropertyPanel, TbxLineStyleSelectHdl, ToolBox*, pToolBox) +{ + sal_uInt16 nId = pToolBox->GetCurItemId(); + if(nId == TBI_LINE_STYLE) + { + // create popup on demand + if(!mpCellLineStylePopup.get()) + { + mpCellLineStylePopup.reset( + new CellLineStylePopup( + this, + ::boost::bind(&CellAppearancePropertyPanel::CreateCellLineStylePopupControl, this, _1))); + } + + if(mpCellLineStylePopup.get()) + { + mpCellLineStylePopup->SetLineStyleSelect(mnOut, mnIn, mnDis); + mpCellLineStylePopup->Show(*pToolBox); + } + } + return 0; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK(CellAppearancePropertyPanel, CBOXGridShowClkHdl, void*, EMPTYARG) +{ + bool bState = mpCBXShowGrid->IsChecked(); + SfxBoolItem aItem( SID_SCGRIDSHOW , bState); + GetBindings()->GetDispatcher()->Execute(SID_SCGRIDSHOW, SFX_CALLMODE_RECORD, &aItem, false, 0L); + return 0; +} + +////////////////////////////////////////////////////////////////////////////// + +CellAppearancePropertyPanel* CellAppearancePropertyPanel::Create ( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings) +{ + if (pParent == NULL) + throw lang::IllegalArgumentException(A2S("no parent Window given to CellAppearancePropertyPanel::Create"), NULL, 0); + if ( ! rxFrame.is()) + throw lang::IllegalArgumentException(A2S("no XFrame given to CellAppearancePropertyPanel::Create"), NULL, 1); + if (pBindings == NULL) + throw lang::IllegalArgumentException(A2S("no SfxBindings given to CellAppearancePropertyPanel::Create"), NULL, 2); + + return new CellAppearancePropertyPanel( + pParent, + rxFrame, + pBindings); +} + +////////////////////////////////////////////////////////////////////////////// + +void CellAppearancePropertyPanel::DataChanged( + const DataChangedEvent& rEvent) +{ + (void)rEvent; +} + +////////////////////////////////////////////////////////////////////////////// + +void CellAppearancePropertyPanel::HandleContextChange( + const ::sfx2::sidebar::EnumContext aContext) +{ + if(maContext == aContext) + { + // Nothing to do. + return; + } + + maContext = aContext; + + + + // todo +} + +////////////////////////////////////////////////////////////////////////////// + +void CellAppearancePropertyPanel::NotifyItemUpdate( + sal_uInt16 nSID, + SfxItemState eState, + const SfxPoolItem* pState) +{ + switch(nSID) + { + case SID_BACKGROUND_COLOR: + if(eState >= SFX_ITEM_DEFAULT) + { + const SvxColorItem* pSvxColorItem = dynamic_cast< const SvxColorItem* >(pState); + + if(pSvxColorItem) + { + maBackColor = ((const SvxColorItem*)pState)->GetValue(); + mbBackColorAvailable = true; + mpFillColorUpdater->Update(maBackColor); + break; + } + } + + mbBackColorAvailable = false; + maBackColor.SetColor(COL_TRANSPARENT); + mpFillColorUpdater->Update(COL_TRANSPARENT); + break; + case SID_FRAME_LINECOLOR: + if( eState == SFX_ITEM_DONTCARE) + { + mbLineColorAvailable = true; + maLineColor.SetColor( COL_TRANSPARENT ); + UpdateControlState(); + break; + } + + if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SvxColorItem) ) + { + const SvxColorItem* pSvxColorItem = dynamic_cast< const SvxColorItem* >(pState); + + if(pSvxColorItem) + { + maLineColor = ((const SvxColorItem*)pState)->GetValue(); + if(maLineColor == COL_AUTO) + mbLineColorAvailable = false; + else + { + mbLineColorAvailable = true; + // mpLineColorUpdater->Update(maLineColor); + } + + UpdateControlState(); + break; + } + } + + mbLineColorAvailable = false; + maLineColor.SetColor(COL_AUTO); + // mpLineColorUpdater->Update(maLineColor); + UpdateControlState(); + break; + case SID_FRAME_LINESTYLE: + if( eState == SFX_ITEM_DONTCARE ) + { + mbBorderStyleAvailable = true; + mnIn = 0; + mnOut = 0; + mnDis = 0; + SetStyleIcon(); + break; + } + + if(eState >= SFX_ITEM_DEFAULT) + { + const SvxLineItem* pSvxLineItem = dynamic_cast< const SvxLineItem* >(pState); + + if(pSvxLineItem) + { + const editeng::SvxBorderLine* mbLineItem = pSvxLineItem->GetLine(); + mnIn = mbLineItem->GetInWidth(); + mnOut = mbLineItem->GetOutWidth(); + mnDis = mbLineItem->GetDistance(); + + if(mnIn == 0 && mnOut == 0 && mnDis == 0) + mbBorderStyleAvailable = false; + else + mbBorderStyleAvailable = true; + + SetStyleIcon(); + break; + } + } + + mbBorderStyleAvailable = false; + SetStyleIcon(); + break; + case SID_ATTR_BORDER_OUTER: + if(eState >= SFX_ITEM_DEFAULT) + { + const SvxBoxItem* pBoxItem = dynamic_cast< const SvxBoxItem* >(pState); + + if(pBoxItem) + { + mbLeft=false, mbRight=false, mbTop=false, mbBottom=false; + + if(pBoxItem->GetLeft()) + mbLeft = true; + + if(pBoxItem->GetRight()) + mbRight = true; + + if(pBoxItem->GetTop()) + mbTop = true; + + if(pBoxItem->GetBottom()) + mbBottom = true; + + if(!Application::GetSettings().GetLayoutRTL()) + mpCellBorderUpdater->UpdateCellBorder(mbTop, mbBottom, mbLeft, mbRight, maIMGCellBorder, mbVer, mbHor); + else + mpCellBorderUpdater->UpdateCellBorder(mbTop, mbBottom, mbRight, mbLeft, maIMGCellBorder, mbVer, mbHor); + + if(mbLeft || mbRight || mbTop || mbBottom) + mbOuterBorder = true; + else + mbOuterBorder = false; + + UpdateControlState(); + } + } + break; + case SID_ATTR_BORDER_INNER: + if(eState >= SFX_ITEM_DEFAULT) + { + const SvxBoxInfoItem* pBoxInfoItem = dynamic_cast< const SvxBoxInfoItem* >(pState); + + if(pBoxInfoItem) + { + bool bLeft(false), bRight(false), bTop(false), bBottom(false); + + mbVer = false, mbHor = false; + + if(!pBoxInfoItem->IsValid( VALID_VERT ) || pBoxInfoItem->GetVert()) + mbVer = true; + + if(!pBoxInfoItem->IsValid( VALID_HORI ) || pBoxInfoItem->GetHori()) + mbHor = true; + + if(!pBoxInfoItem->IsValid( VALID_LEFT ) || mbLeft) + bLeft = true; + + if(!pBoxInfoItem->IsValid( VALID_RIGHT ) || mbRight) + bRight = true; + + if(!pBoxInfoItem->IsValid( VALID_TOP ) || mbTop) + bTop = true; + + if(!pBoxInfoItem->IsValid( VALID_BOTTOM ) || mbBottom) + bBottom = true; + + if(!Application::GetSettings().GetLayoutRTL()) + mpCellBorderUpdater->UpdateCellBorder(bTop, bBottom, bLeft, bRight, maIMGCellBorder, mbVer, mbHor); + else + mpCellBorderUpdater->UpdateCellBorder(bTop, bBottom, bRight, bLeft, maIMGCellBorder, mbVer, mbHor); + + if(mbVer || mbHor || bLeft || bRight || bTop || bBottom) + mbInnerBorder = true; + else + mbInnerBorder = false; + + UpdateControlState(); + } + } + break; + case SID_ATTR_BORDER_DIAG_TLBR: + if( eState == SFX_ITEM_DONTCARE ) + { + mbTLBR = true; + maTLBRColor.SetColor(COL_TRANSPARENT); + mnTLBRIn = mnTLBROut = mnTLBRDis = 0; + UpdateControlState(); + break; + } + + if(eState >= SFX_ITEM_DEFAULT) + { + const SvxLineItem* pItem = dynamic_cast< const SvxLineItem* >(pState); + + if(pItem) + { + const editeng::SvxBorderLine* aLine = pItem->GetLine(); + + if(!aLine) + { + mbTLBR = false; + } + else + { + mbTLBR = true; + maTLBRColor = aLine->GetColor(); + mnTLBRIn = aLine->GetInWidth(); + mnTLBROut = aLine->GetOutWidth(); + mnTLBRDis = aLine->GetDistance(); + + if(mnTLBRIn == 0 && mnTLBROut == 0 && mnTLBRDis == 0) + mbTLBR = false; + } + + UpdateControlState(); + break; + } + } + + mbTLBR = false; + UpdateControlState(); + break; + case SID_ATTR_BORDER_DIAG_BLTR: + if( eState == SFX_ITEM_DONTCARE ) + { + mbBLTR = true; + maBLTRColor.SetColor( COL_TRANSPARENT ); + mnBLTRIn = mnBLTROut = mnBLTRDis = 0; + UpdateControlState(); + break; + } + + if(eState >= SFX_ITEM_DEFAULT) + { + const SvxLineItem* pItem = dynamic_cast< const SvxLineItem* >(pState); + + if(pItem) + { + const editeng::SvxBorderLine* aLine = pItem->GetLine(); + + if(!aLine) + { + mbBLTR = false; + } + else + { + mbBLTR = true; + maBLTRColor = aLine->GetColor(); + mnBLTRIn = aLine->GetInWidth(); + mnBLTROut = aLine->GetOutWidth(); + mnBLTRDis = aLine->GetDistance(); + + if(mnBLTRIn == 0 && mnBLTROut == 0 && mnBLTRDis == 0) + mbBLTR = false; + } + + UpdateControlState(); + } + break; + } + + mbBLTR = false; + UpdateControlState(); + break; + case SID_SCGRIDSHOW: + if(eState >= SFX_ITEM_DEFAULT) + { + const SfxBoolItem* pItem = dynamic_cast< const SfxBoolItem* >(pState); + + if(pItem) + { + const bool bVal = pItem->GetValue(); + + if(bVal) + mpCBXShowGrid->Check(true); + else + mpCBXShowGrid->Check(false); + } + } + break; + } +} + +////////////////////////////////////////////////////////////////////////////// + +SfxBindings* CellAppearancePropertyPanel::GetBindings() +{ + return mpBindings; +} + +////////////////////////////////////////////////////////////////////////////// + +void CellAppearancePropertyPanel::SetStyleIcon() +{ + //FIXME: update for new line border possibilities + if(mnOut == DEF_LINE_WIDTH_0 && mnIn == 0 && mnDis == 0) //1 + mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, maIMGLineStyle1); + else if(mnOut == DEF_LINE_WIDTH_2 && mnIn == 0 && mnDis == 0) //2 + mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, maIMGLineStyle2); + else if(mnOut == DEF_LINE_WIDTH_3 && mnIn == 0 && mnDis == 0) //3 + mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, maIMGLineStyle3); + else if(mnOut == DEF_LINE_WIDTH_4 && mnIn == 0 && mnDis == 0) //4 + mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, maIMGLineStyle4); + else if(mnOut == DEF_LINE_WIDTH_0 && mnIn == DEF_LINE_WIDTH_0 && mnDis == DEF_LINE_WIDTH_1) //5 + mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, maIMGLineStyle5); + else if(mnOut == DEF_LINE_WIDTH_0 && mnIn == DEF_LINE_WIDTH_0 && mnDis == DEF_LINE_WIDTH_2) //6 + mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, maIMGLineStyle6); + else if(mnOut == DEF_LINE_WIDTH_1 && mnIn == DEF_LINE_WIDTH_2 && mnDis == DEF_LINE_WIDTH_1) //7 + mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, maIMGLineStyle7); + else if(mnOut == DEF_LINE_WIDTH_2 && mnIn == DEF_LINE_WIDTH_0 && mnDis == DEF_LINE_WIDTH_2) //8 + mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, maIMGLineStyle8); + else if(mnOut == DEF_LINE_WIDTH_2 && mnIn == DEF_LINE_WIDTH_2 && mnDis == DEF_LINE_WIDTH_2) //9 + mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, maIMGLineStyle9); + else + mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, maIMGLineStyle1); +} + +////////////////////////////////////////////////////////////////////////////// + +void CellAppearancePropertyPanel::UpdateControlState() +{ + if(mbOuterBorder || mbInnerBorder || mbTLBR || mbBLTR) + { + mpTBLineColor->Enable(); + mpTBLineStyle->Enable(); + + //set line color state + if( mbLineColorAvailable && !mbTLBR && !mbBLTR ) + mpLineColorUpdater->Update(maLineColor); + else if( !mbLineColorAvailable && mbTLBR && !mbBLTR ) + mpLineColorUpdater->Update(maTLBRColor); + else if ( !mbLineColorAvailable && !mbTLBR && mbBLTR ) + mpLineColorUpdater->Update(maBLTRColor); + else if( !mbLineColorAvailable && mbTLBR && mbBLTR) + { + if( maTLBRColor == maBLTRColor) + mpLineColorUpdater->Update(maBLTRColor); + else + mpLineColorUpdater->Update(COL_TRANSPARENT); + } + else if( mbLineColorAvailable && mbTLBR && !mbBLTR ) + { + if( maTLBRColor == maLineColor) + mpLineColorUpdater->Update(maLineColor); + else + mpLineColorUpdater->Update(COL_TRANSPARENT); + } + else if( mbLineColorAvailable && !mbTLBR && mbBLTR ) + { + if( maBLTRColor == maLineColor) + mpLineColorUpdater->Update(maLineColor); + else + mpLineColorUpdater->Update(COL_TRANSPARENT); + } + else + mpLineColorUpdater->Update(COL_TRANSPARENT); + + //set line style state + if( mbBorderStyleAvailable && !mbTLBR && !mbBLTR ) + { + } + else if( !mbBorderStyleAvailable && mbTLBR && !mbBLTR ) + { + mnIn = mnTLBRIn; + mnOut = mnTLBROut; + mnDis = mnTLBRDis; + } + else if ( !mbBorderStyleAvailable && !mbTLBR && mbBLTR ) + { + mnIn = mnBLTRIn; + mnOut = mnBLTROut; + mnDis = mnBLTRDis; + } + else if( !mbBorderStyleAvailable && mbTLBR && mbBLTR) + { + if( mnTLBRIn == mnBLTRIn && mnTLBROut == mnBLTROut && mnTLBRDis == mnBLTRDis) + { + mnIn = mnTLBRIn; + mnOut = mnTLBROut; + mnDis = mnTLBRDis; + } + else + { + mnIn = 0; + mnOut = 0; + mnDis = 0; + } + } + else if( mbBorderStyleAvailable && mbTLBR && !mbBLTR ) + { + if( mnTLBRIn != mnIn || mnTLBROut != mnOut || mnTLBRDis != mnDis) + { + mnIn = 0; + mnOut = 0; + mnDis = 0; + } + } + else if( mbBorderStyleAvailable && !mbTLBR && mbBLTR ) + { + if( mnBLTRIn != mnIn || mnBLTROut != mnOut || mnBLTRDis != mnDis ) + { + mnIn = 0; + mnOut = 0; + mnDis = 0; + } + } + else + { + mnIn = 0; + mnOut = 0; + mnDis = 0; + } + SetStyleIcon(); + } + else + { + mpTBLineColor->Disable(); + mpTBLineStyle->Disable(); + } +} + +////////////////////////////////////////////////////////////////////////////// +// namespace close + +}} // end of namespace ::sc::sidebar + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.hrc b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hrc new file mode 100644 index 000000000000..a0a3b9e2c16f --- /dev/null +++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hrc @@ -0,0 +1,114 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#define FT_BK_COLOR 1 +#define TB_BK_COLOR 2 +#define TBI_BK_COLOR 3 +#define FT_BORDER 4 +#define TB_APP_BORDER 5 +#define TBI_BORDER 6 +#define TB_BORDER_LINE_STYLE 7 +#define TBI_LINE_STYLE 8 +#define TB_BORDER_LINE_COLOR 9 +#define TBI_LINE_COLOR 10 +#define CBX_SHOW_GRID 11 + +#define STR_QH_BK_COLOR 12 +#define STR_QH_BORDER 13 +#define STR_QH_BORDER_LINE_STYLE 14 +#define STR_QH_BORDER_LINE_COLOR 15 + +#define IMG_BK_COLOR 21 +#define IMG_CELL_BORDER 22 +#define IMG_LINE_COLOR 23 +#define IMG_LINE_STYLE1 25 +#define IMG_LINE_STYLE2 26 +#define IMG_LINE_STYLE3 27 +#define IMG_LINE_STYLE4 28 +#define IMG_LINE_STYLE5 29 +#define IMG_LINE_STYLE6 30 +#define IMG_LINE_STYLE7 31 +#define IMG_LINE_STYLE8 32 +#define IMG_LINE_STYLE9 33 + +//BACK_COLOR PAGE +#define VS_BACK_COLOR 1 +#define STR_AUTOMATICE 2 + +//LINE COLOR PAGE +#define VS_LINE_COLOR 1 + +//line style page +#define VS_STYLE 1 +#define PB_OPTIONS 2 +#define BMP_UNDERLINE_MORE 3 + +//line border page +#define TB_BORDER1 1 +#define TB_BORDER2 2 +#define TB_BORDER3 3 + +#define TBI_BORDER1_NONE 7 +#define TBI_BORDER1_ALL 8 +#define TBI_BORDER1_OUTER 9 +#define TBI_BORDER1_OUTERBOLD 10 +#define TBI_BORDER2_LEFT 11 +#define TBI_BORDER2_RIGHT 12 +#define TBI_BORDER2_TOP 13 +#define TBI_BORDER2_BOT 14 +#define TBI_BORDER2_BLTR 15 +#define TBI_BORDER2_TLBR 16 +#define TBI_BORDER2_TOPBOT 17 +#define TBI_BORDER2_LEFTRIGHT 18 +#define TBI_BORDER3_S1 19 +#define TBI_BORDER3_S2 20 +#define TBI_BORDER3_S3 21 +#define TBI_BORDER3_S4 22 +#define FL_1 23 +#define FL_2 24 + +#define IMG_BORDER1 25 +#define IMG_BORDER2 26 +#define IMG_BORDER3 27 +#define IMG_BORDER4 28 +#define IMG_BORDER5 29 +#define IMG_BORDER6 30 +#define IMG_BORDER7 31 +#define IMG_BORDER8 32 +#define IMG_BORDER9 33 +#define IMG_BORDER10 34 +#define IMG_BORDER11 35 +#define IMG_BORDER12 36 +#define IMG_BORDER13 37 +#define IMG_BORDER14 38 +#define IMG_BORDER15 39 +#define IMG_BORDER16 40 + +#define STR_BORDER_1 41 +#define STR_BORDER_2 42 +#define STR_BORDER_3 43 +#define STR_BORDER_4 44 +#define STR_BORDER_5 45 +#define STR_BORDER_6 46 +#define STR_BORDER_7 47 +#define STR_BORDER_8 48 + +#define VS_FILLCOLOR 1 +#define VS_NOFILLCOLOR 2 +#define VS_LINECOLOR 1 + +// eof diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx new file mode 100644 index 000000000000..184cd9580588 --- /dev/null +++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx @@ -0,0 +1,197 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SC_PROPERTYPANEL_APPEARANCE_HXX +#define SC_PROPERTYPANEL_APPEARANCE_HXX + +#include <sfx2/sidebar/SidebarPanelBase.hxx> +#include <sfx2/sidebar/ControllerItem.hxx> +#include <sfx2/sidebar/IContextChangeReceiver.hxx> +#include <boost/scoped_ptr.hpp> +#include <svx/sidebar/ColorPopup.hxx> + +class FixedText; +namespace svx { class ToolboxButtonColorUpdater; } +namespace sc { namespace sidebar { + class CellLineStylePopup; + class CellBorderStylePopup; + class CellLineStyleControl; + class CellBorderUpdater; +}} +class ToolBox; +class CheckBox; + +namespace sc { namespace sidebar { + +class CellAppearancePropertyPanel +: public Control, + public ::sfx2::sidebar::IContextChangeReceiver, + public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface +{ +private: + friend class CellLineStyleControl; + friend class CellBorderStyleControl; + +public: + static CellAppearancePropertyPanel* Create( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings); + + virtual void DataChanged( + const DataChangedEvent& rEvent); + + virtual void HandleContextChange( + const ::sfx2::sidebar::EnumContext aContext); + + virtual void NotifyItemUpdate( + const sal_uInt16 nSId, + const SfxItemState eState, + const SfxPoolItem* pState); + + SfxBindings* GetBindings(); + +private: + //ui controls + ::boost::scoped_ptr< FixedText > mpFTFillColor; + ::boost::scoped_ptr< Window > mpTBFillColorBackground; + ::boost::scoped_ptr< ToolBox > mpTBFillColor; + ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpFillColorUpdater; + + ::boost::scoped_ptr< FixedText > mpFTCellBorder; + ::boost::scoped_ptr< Window > mpTBCellBorderBackground; + ::boost::scoped_ptr< ToolBox > mpTBCellBorder; + ::boost::scoped_ptr< CellBorderUpdater > mpCellBorderUpdater; + + ::boost::scoped_ptr< Window > mpTBLineStyleBackground; + ::boost::scoped_ptr< ToolBox > mpTBLineStyle; + + ::boost::scoped_ptr< Window > mpTBLineColorBackground; + ::boost::scoped_ptr< ToolBox > mpTBLineColor; + ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpLineColorUpdater; + + ::boost::scoped_ptr< CheckBox > mpCBXShowGrid; + + ::sfx2::sidebar::ControllerItem maBackColorControl; + ::sfx2::sidebar::ControllerItem maLineColorControl; + ::sfx2::sidebar::ControllerItem maLineStyleControl; + ::sfx2::sidebar::ControllerItem maBorderOuterControl; + ::sfx2::sidebar::ControllerItem maBorderInnerControl; + ::sfx2::sidebar::ControllerItem maGridShowControl; + ::sfx2::sidebar::ControllerItem maBorderTLBRControl; + ::sfx2::sidebar::ControllerItem maBorderBLTRControl; + + // images + Image maIMGBKColor; + Image maIMGCellBorder; + Image maIMGLineColor; + Image maIMGLineStyle1; + Image maIMGLineStyle2; + Image maIMGLineStyle3; + Image maIMGLineStyle4; + Image maIMGLineStyle5; + Image maIMGLineStyle6; + Image maIMGLineStyle7; + Image maIMGLineStyle8; + Image maIMGLineStyle9; + + // cell background color + Color maBackColor; + + // cell line color(s) + Color maLineColor; + Color maTLBRColor; + Color maBLTRColor; + + // BorderStyle defines + sal_uInt16 mnIn; + sal_uInt16 mnOut; + sal_uInt16 mnDis; + sal_uInt16 mnTLBRIn; + sal_uInt16 mnTLBROut; + sal_uInt16 mnTLBRDis; + sal_uInt16 mnBLTRIn; + sal_uInt16 mnBLTROut; + sal_uInt16 mnBLTRDis; + + /// bitfield + bool mbBackColorAvailable : 1; + bool mbLineColorAvailable : 1; + bool mbBorderStyleAvailable : 1; + + // CellBorder defines + bool mbLeft : 1; + bool mbRight : 1; + bool mbTop : 1; + bool mbBottom : 1; + bool mbVer : 1; + bool mbHor : 1; + + bool mbOuterBorder : 1; // mbLeft || mbRight || mbTop || mbBottom + bool mbInnerBorder : 1; // mbVer || mbHor || bLeft || bRight || bTop || bBottom + + bool mbTLBR : 1; + bool mbBLTR : 1; + + // popups + svx::sidebar::ColorPopup maFillColorPopup; + svx::sidebar::ColorPopup maLineColorPopup; + ::boost::scoped_ptr< CellLineStylePopup > mpCellLineStylePopup; + ::boost::scoped_ptr< CellBorderStylePopup > mpCellBorderStylePopup; + + cssu::Reference<css::frame::XFrame> mxFrame; + ::sfx2::sidebar::EnumContext maContext; + SfxBindings* mpBindings; + + DECL_LINK(TbxBKColorSelectHdl, ToolBox*); + DECL_LINK(TbxLineColorSelectHdl, ToolBox*); + DECL_LINK(TbxCellBorderSelectHdl, ToolBox*); + DECL_LINK(TbxLineStyleSelectHdl, ToolBox*); + DECL_LINK(CBOXGridShowClkHdl, void*); + + // for fill color picker + svx::sidebar::PopupControl* CreateFillColorPopupControl(svx::sidebar::PopupContainer* pParent); + void SetFillColor(const String& rsColorName, const Color aColor); + + // for line color picker + svx::sidebar::PopupControl* CreateLineColorPopupControl(svx::sidebar::PopupContainer* pParent); + void SetLineColor(const String& rsColorName, const Color aColor); + + // for CellLineStyle popup + svx::sidebar::PopupControl* CreateCellLineStylePopupControl(svx::sidebar::PopupContainer* pParent); + void EndCellLineStylePopupMode(void); + + // for CellBorderStyle popup + svx::sidebar::PopupControl* CreateCellBorderStylePopupControl(svx::sidebar::PopupContainer* pParent); + void EndCellBorderStylePopupMode(void); + + // constructor/destuctor + CellAppearancePropertyPanel( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings); + virtual ~CellAppearancePropertyPanel(); + + void Initialize(); + void SetStyleIcon(); + void UpdateControlState(); +}; + +} } // end of namespace ::sc::sidebar + +#endif +// eof diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.src b/sc/source/ui/sidebar/CellAppearancePropertyPanel.src new file mode 100644 index 000000000000..cb870818bfd3 --- /dev/null +++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.src @@ -0,0 +1,495 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "CellAppearancePropertyPanel.hrc" +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include "sc.hrc" +#include "helpids.h" + +#define TOOLBOX_WIDTH 50 +#define TOOLBOX_HEIGHT 15 + +#define TOOLBOX_WIDTH_2 34 +#define TOOLBOX_HEIGHT_2 30 + +#define TOOLBOX_BORDER_WIDTH 107 +#define PB_BORDER_MOREBTN 57 +#define POPUPPANEL_MARGIN_SMALL_PIXEL 8 + +////////////////////////////////////////////////////////////////////////////// +// the basic propertypanel + +Control RID_PROPERTYPANEL_SC_APPEAR +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + + Size = MAP_APPFONT( PROPERTYPAGE_WIDTH, SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT * 2 + TEXT_CONTROL_SPACING_VERTICAL * 2 + TOOLBOX_HEIGHT + CONTROL_SPACING_VERTICAL * 2 + TOOLBOX_HEIGHT_2 + CBOX_HEIGHT + SECTIONPAGE_MARGIN_VERTICAL_BOT - 2); + HelpID = HID_PROPERTYPANEL_SC_CELL_SECTION ; + Text [ en-US ] = "Cell Appearance"; + + FixedText FT_BK_COLOR + { + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL, SECTIONPAGE_MARGIN_VERTICAL_TOP ); + Size = MAP_APPFONT ( PROPERTYPAGE_WIDTH - SECTIONPAGE_MARGIN_HORIZONTAL * 2 , TEXT_HEIGHT) ; + Text [ en-US ] = "~Cell background:"; + }; + ToolBox TB_BK_COLOR + { + SVLook = TRUE ; + Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL, SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL) ; + Size = MAP_APPFONT (TOOLBOX_WIDTH ,TOOLBOX_HEIGHT ) ; + TabStop = TRUE ; + HelpID = HID_PROPERTYPANEL_SC_TBX_BKCOLOR ; + Text [ en-US ] = "Cell Background"; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_BK_COLOR ; + DropDown = TRUE ; + Text [ en-US ] = "Cell background" ; + HelpID = HID_PROPERTYPANEL_SC_TBI_BKCOLOR; + }; + }; + }; + String STR_QH_BK_COLOR + { + Text [ en-US ] = "Select the background color of the selected cells." ; + }; + FixedText FT_BORDER + { + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL, SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + TOOLBOX_HEIGHT + CONTROL_SPACING_VERTICAL); + Size = MAP_APPFONT ( PROPERTYPAGE_WIDTH - SECTIONPAGE_MARGIN_HORIZONTAL * 2 , TEXT_HEIGHT) ; + Text [ en-US ] = "Cell ~border:"; + }; + ToolBox TB_APP_BORDER + { + SVLook = TRUE ; + Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL, SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT * 2 + TEXT_CONTROL_SPACING_VERTICAL * 2 + TOOLBOX_HEIGHT + CONTROL_SPACING_VERTICAL) ; + Size = MAP_APPFONT (TOOLBOX_WIDTH_2 ,TOOLBOX_HEIGHT_2 ) ; + TabStop = TRUE ; + HelpID = HID_PROPERTYPANEL_SC_TBX_BORDER ; + Text [ en-US ] = "Cell Border"; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_BORDER ; + DropDown = TRUE ; + Text [ en-US ] = "Cell border" ; + HelpID = HID_PROPERTYPANEL_SC_TBI_BORDER; + }; + }; + }; + String STR_QH_BORDER + { + Text [ en-US ] = "Specify the borders of the selected cells." ; + }; + ToolBox TB_BORDER_LINE_STYLE + { + SVLook = TRUE ; + Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL + TOOLBOX_WIDTH_2 + 3, SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT * 2 + TEXT_CONTROL_SPACING_VERTICAL * 2 + TOOLBOX_HEIGHT + CONTROL_SPACING_VERTICAL ) ; + Size = MAP_APPFONT (TOOLBOX_WIDTH ,TOOLBOX_HEIGHT) ; + TabStop = TRUE ; + HelpID = HID_PROPERTYPANEL_SC_TBX_STYLE ; + Text [ en-US ] = "Line Style"; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_LINE_STYLE ; + DropDown = TRUE ; + Text [ en-US ] = "Line style" ; + HelpID = HID_PROPERTYPANEL_SC_TBI_STYLE; + }; + }; + }; + String STR_QH_BORDER_LINE_STYLE + { + Text [ en-US ] = "Select the line style of the borders." ; + }; + ToolBox TB_BORDER_LINE_COLOR + { + SVLook = TRUE ; + Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL + TOOLBOX_WIDTH_2 + 3, SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT * 2 + TEXT_CONTROL_SPACING_VERTICAL * 2 + TOOLBOX_HEIGHT * 2 + CONTROL_SPACING_VERTICAL + 3) ; + Size = MAP_APPFONT (TOOLBOX_WIDTH ,TOOLBOX_HEIGHT ) ; + TabStop = TRUE ; + HelpID = HID_PROPERTYPANEL_SC_TBX_LINECOLOR ; + Text [ en-US ] = "Line Color"; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_LINE_COLOR ; + DropDown = TRUE ; + Text [ en-US ] = "Line color" ; + HelpID = HID_PROPERTYPANEL_SC_TBI_LINECOLOR; + }; + }; + }; + String STR_QH_BORDER_LINE_COLOR + { + Text [ en-US ] = "Select the line color of the borders." ; + }; + CheckBox CBX_SHOW_GRID + { + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL , SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT * 2 + TEXT_CONTROL_SPACING_VERTICAL * 2 + TOOLBOX_HEIGHT + CONTROL_SPACING_VERTICAL * 2 + TOOLBOX_HEIGHT_2 + 2) ; + Size = MAP_APPFONT ( 90 , CBOX_HEIGHT ) ; + TabStop = TRUE ; + Text [ en-US ] = "Show cell ~grid lines" ; + QuickHelpText [ en-US ] = "Show the grid lines of the cells in the entire spreadsheet."; + HelpID = HID_PROPERTYPANEL_SC_CBOX_SHOWGRID; + }; + + Image IMG_BK_COLOR + { + ImageBitmap = Bitmap{File = "sidebar/fill_color.png";}; + }; + Image IMG_CELL_BORDER + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder.png";}; + //MaskColor = STD_MASKCOLOR ; + }; + Image IMG_LINE_COLOR + { + ImageBitmap = Bitmap{File = "sidebar/Line_color.png";}; + }; + Image IMG_LINE_STYLE1 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_005.png";}; + }; + Image IMG_LINE_STYLE2 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_250.png";}; + }; + Image IMG_LINE_STYLE3 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_400.png";}; + }; + Image IMG_LINE_STYLE4 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_500.png";}; + }; + Image IMG_LINE_STYLE5 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_110.png";}; + }; + Image IMG_LINE_STYLE6 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_260.png";}; + }; + Image IMG_LINE_STYLE7 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_450.png";}; + }; + Image IMG_LINE_STYLE8 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_505.png";}; + }; + Image IMG_LINE_STYLE9 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_750.png";}; + }; +}; + +////////////////////////////////////////////////////////////////////////////// +// fill color popup + +Control RID_POPUPPANEL_CELLAPPEARANCE_FILLCOLOR +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + Size = MAP_APPFONT( POPUP_COLOR_PICKER_WIDTH , POPUP_COLOR_PICKER_HEIGHT ); + + Control VS_FILLCOLOR + { + HelpID = HID_PROPERTYPANEL_FILL_COLOR_VS; + Hide = TRUE ; + Pos = MAP_APPFONT ( OFFSET_X , OFFSET_Y ); + Size = MAP_APPFONT ( POPUP_COLOR_PICKER_WIDTH - OFFSET_X * 2, POPUP_COLOR_PICKER_HEIGHT - OFFSET_Y * 2); + TabStop = TRUE ; + Text [ en-US ] = "Color"; + }; + + String VS_NOFILLCOLOR + { + Text [ en-US ] = "No Color" ; + }; +}; + +////////////////////////////////////////////////////////////////////////////// +// line color popup + +Control RID_POPUPPANEL_CELLAPPEARANCE_LINECOLOR +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + Size = MAP_APPFONT( POPUP_COLOR_PICKER_WIDTH , POPUP_COLOR_PICKER_HEIGHT ); + + Control VS_LINECOLOR + { + HelpID = HID_PROPERTYPANEL_LINE_COLOR_VS; + Hide = TRUE ; + Pos = MAP_APPFONT ( OFFSET_X , OFFSET_Y ); + Size = MAP_APPFONT ( POPUP_COLOR_PICKER_WIDTH - OFFSET_X * 2, POPUP_COLOR_PICKER_HEIGHT - OFFSET_Y * 2); + TabStop = TRUE ; + Text [ en-US ] = "Color"; + }; +}; + +////////////////////////////////////////////////////////////////////////////// +// cell line style popup + +Control RID_POPUPPANEL_APPEARANCE_CELL_LINESTYLE +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + + Size = MAP_APPFONT( + POPUPPANEL_MARGIN_SMALL * 2 + POPUP_BORDER_WIDTH + 80, + 13 + POPUP_BORDER_HEIGHT + POPUPPANEL_MARGIN_SMALL * 2 + POPUPPANEL_MARGIN_LARGE + 12*9); + + Control VS_STYLE + { + HelpID = HID_PROPERTYPANEL_SC_STYLE_VS ; + Hide = TRUE ; + Pos = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL + OFFSET_X , POPUPPANEL_MARGIN_SMALL + OFFSET_Y ); + Size = MAP_APPFONT ( 80 , 12 * 9); + TabStop = TRUE ; + Text [ en-US ] = "Line Style"; + }; + PushButton PB_OPTIONS + { + HelpID = HID_PROPERTYPANEL_SC_STYLE_PB; + Pos = MAP_APPFONT ( POPUPPANEL_MARGIN_LARGE + OFFSET_X , POPUPPANEL_MARGIN_SMALL * 2 + OFFSET_Y + 12 * 9); + Size = MAP_APPFONT ( 75 , 12 ); + TabStop = TRUE; + Text [ en-US ] = "~More Options..."; + }; + Bitmap BMP_UNDERLINE_MORE + { + File = "sidebar/morebutton.png"; + }; +}; + +////////////////////////////////////////////////////////////////////////////// +// cell border style popup + +Control RID_POPUPPANEL_APPEARANCE_CELL_BORDERSTYLE +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + + Size = MAP_PIXEL( POPUPPANEL_MARGIN_SMALL_PIXEL * 2 + 108, POPUPPANEL_MARGIN_SMALL_PIXEL * 2 + 138); + + ToolBox TB_BORDER1 + { + SVLook = TRUE ; + Pos = MAP_PIXEL(POPUPPANEL_MARGIN_SMALL_PIXEL, POPUPPANEL_MARGIN_SMALL_PIXEL); //MAP_APPFONT (POPUPPANEL_MARGIN_SMALL + OFFSET_X + 1, POPUPPANEL_MARGIN_SMALL + OFFSET_Y + 1) ; + Size = MAP_PIXEL(TOOLBOX_BORDER_WIDTH, 31); //MAP_APPFONT (TOOLBOX_BORDER_WIDTH ,20) ; + TabStop = TRUE ; + HelpID = HID_PROPERTYPANEL_SC_BORDER1_TBX; + Text [ en-US ] = "Cell Border 1"; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_BORDER1_NONE ; + HelpID = HID_PROPERTYPANEL_SC_BORDER_TBI_NONE; + Text [ en-US ] = "No Border" ; + }; + ToolBoxItem + { + Identifier = TBI_BORDER1_ALL ; + HelpID = HID_PROPERTYPANEL_SC_BORDER_TBI_ALL; + Text [ en-US ] = "All Borders" ; + }; + ToolBoxItem + { + Identifier = TBI_BORDER1_OUTER ; + HelpID = HID_PROPERTYPANEL_SC_BORDER_TBI_OUTER; + Text [ en-US ] = "Outside Borders" ; + }; + ToolBoxItem + { + Identifier = TBI_BORDER1_OUTERBOLD ; + HelpID = HID_PROPERTYPANEL_SC_BORDER_TBI_OUTERBOLD; + Text [ en-US ] = "Thick Box Border" ; + }; + }; + }; + FixedLine FL_1 + { + Pos = MAP_PIXEL(POPUPPANEL_MARGIN_SMALL_PIXEL, POPUPPANEL_MARGIN_SMALL_PIXEL + 31); //MAP_APPFONT ( POPUPPANEL_MARGIN_SMALL + OFFSET_X + 1 , POPUPPANEL_MARGIN_SMALL + OFFSET_Y + 20 + 1) ; + Size = MAP_PIXEL(TOOLBOX_BORDER_WIDTH, 8); // MAP_APPFONT ( TOOLBOX_BORDER_WIDTH , 5 ) ; + }; + ToolBox TB_BORDER2 + { + SVLook = TRUE ; + Pos = MAP_PIXEL(POPUPPANEL_MARGIN_SMALL_PIXEL, POPUPPANEL_MARGIN_SMALL_PIXEL + 31 + 8); // MAP_APPFONT (POPUPPANEL_MARGIN_SMALL + OFFSET_X + 1, POPUPPANEL_MARGIN_SMALL + OFFSET_Y + 20 + 5 + 1) ; + Size = MAP_PIXEL (TOOLBOX_BORDER_WIDTH ,61) ; + TabStop = TRUE ; + HelpID = HID_PROPERTYPANEL_SC_BORDER2_TBX; + Text [ en-US ] = "Cell Border 2"; + }; + FixedLine FL_2 + { + Pos = MAP_PIXEL(POPUPPANEL_MARGIN_SMALL_PIXEL, POPUPPANEL_MARGIN_SMALL_PIXEL + 31 + 8 + 61); // MAP_APPFONT ( POPUPPANEL_MARGIN_SMALL + OFFSET_X + 1 , POPUPPANEL_MARGIN_SMALL + OFFSET_Y + 20 + 38 + 5 + 1) ; + Size = MAP_PIXEL ( TOOLBOX_BORDER_WIDTH , 8 ) ; + }; + ToolBox TB_BORDER3 + { + SVLook = TRUE ; + Pos = MAP_PIXEL(POPUPPANEL_MARGIN_SMALL_PIXEL, POPUPPANEL_MARGIN_SMALL_PIXEL + 31 +8 + 61 + 8); // MAP_APPFONT (POPUPPANEL_MARGIN_SMALL + OFFSET_X + 1, POPUPPANEL_MARGIN_SMALL + OFFSET_Y + 20 + 38 + 10 + 1) ; + Size = MAP_PIXEL (TOOLBOX_BORDER_WIDTH ,31) ; + TabStop = TRUE ; + HelpID = HID_PROPERTYPANEL_SC_BORDER3_TBX; + Text [ en-US ] = "Cell Border 3"; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_BORDER3_S1; + HelpID = HID_PROPERTYPANEL_SC_BORDER_TBI_S1; + Text [ en-US ] = "Thick Bottom Border" ; + }; + ToolBoxItem + { + Identifier = TBI_BORDER3_S2 ; + HelpID = HID_PROPERTYPANEL_SC_BORDER_TBI_S2; + Text [ en-US ] = "Double Bottom Border" ; + }; + ToolBoxItem + { + Identifier = TBI_BORDER3_S3 ; + HelpID = HID_PROPERTYPANEL_SC_BORDER_TBI_S3; + Text [ en-US ] = "Top and Thick Bottom Borders" ; + }; + ToolBoxItem + { + Identifier = TBI_BORDER3_S4 ; + HelpID = HID_PROPERTYPANEL_SC_BORDER_TBI_S4; + Text [ en-US ] = "Top and Double Bottom Borders" ; + }; + }; + }; + + Image IMG_BORDER1 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_Empty_18x18.png";}; + }; + Image IMG_BORDER2 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_All_18x18.png";}; + }; + Image IMG_BORDER3 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_FourBorders_18x18.png";}; + }; + Image IMG_BORDER4 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_FourBorders_Thick_18x18.png";}; + }; + Image IMG_BORDER5 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_Left_18x18.png";}; + }; + Image IMG_BORDER6 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_Right_18x18.png";}; + }; + Image IMG_BORDER7 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_Top_18x18.png";}; + }; + Image IMG_BORDER8 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_Bottom_18x18.png";}; + }; + Image IMG_BORDER9 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_RightDiagonal_18x18.png";}; + }; + Image IMG_BORDER10 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_LeftDiagonal_18x18.png";}; + }; + Image IMG_BORDER11 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_TopAndBottom_18x18.png";}; + }; + Image IMG_BORDER12 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_LeftAndRight_18x18.png";}; + }; + Image IMG_BORDER13 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_Bottom_Thick_18x18.png";}; + }; + Image IMG_BORDER14 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_Bottom_Double_18x18.png";}; + }; + Image IMG_BORDER15 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_TopThin_BottomThick_18x18.png";}; + }; + Image IMG_BORDER16 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_TopSingle_BottomDouble_18x18.png";}; + }; + String STR_BORDER_1 + { + Text [ en-US ] = "Left Border"; + }; + String STR_BORDER_2 + { + Text [ en-US ] = "Right Border"; + }; + String STR_BORDER_3 + { + Text [ en-US ] = "Top Border"; + }; + String STR_BORDER_4 + { + Text [ en-US ] = "Bottom Border"; + }; + String STR_BORDER_5 + { + Text [ en-US ] = "Diagonal Up Border"; + }; + String STR_BORDER_6 + { + Text [ en-US ] = "Diagonal Down Border"; + }; + String STR_BORDER_7 + { + Text [ en-US ] = "Top and Bottom Borders"; + }; + String STR_BORDER_8 + { + Text [ en-US ] = "Left and Right Borders"; + }; +}; + +// eof diff --git a/sc/source/ui/sidebar/CellBorderStyleControl.cxx b/sc/source/ui/sidebar/CellBorderStyleControl.cxx new file mode 100644 index 000000000000..867d1c0308cf --- /dev/null +++ b/sc/source/ui/sidebar/CellBorderStyleControl.cxx @@ -0,0 +1,344 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <CellBorderStyleControl.hxx> +#include "sc.hrc" +#include "scresid.hxx" +#include <CellAppearancePropertyPanel.hrc> +#include <editeng/boxitem.hxx> +#include <editeng/borderline.hxx> +#include <CellAppearancePropertyPanel.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <vcl/svapp.hxx> +#include <editeng/lineitem.hxx> + +namespace sc { namespace sidebar { + +#define FRM_VALID_LEFT 0x01 +#define FRM_VALID_RIGHT 0x02 +#define FRM_VALID_TOP 0x04 +#define FRM_VALID_BOTTOM 0x08 +#define FRM_VALID_HINNER 0x10 +#define FRM_VALID_VINNER 0x20 +#define FRM_VALID_OUTER 0x0f +#define FRM_VALID_ALL 0xff + +CellBorderStyleControl::CellBorderStyleControl(Window* pParent, CellAppearancePropertyPanel& rPanel) +: svx::sidebar::PopupControl(pParent, ScResId(RID_POPUPPANEL_APPEARANCE_CELL_BORDERSTYLE)), + mrCellAppearancePropertyPanel(rPanel), + maTBBorder1(this, ScResId(TB_BORDER1)), + maTBBorder2(this, ScResId(TB_BORDER2)), + maTBBorder3(this, ScResId(TB_BORDER3)), + maFL1(this, ScResId(FL_1)), + maFL2(this, ScResId(FL_2)), + mpImageList(0) +{ + Initialize(); + FreeResource(); +} + +CellBorderStyleControl::~CellBorderStyleControl(void) +{ + delete[] mpImageList; +} + +void CellBorderStyleControl::Initialize() +{ + mpImageList = new Image[16]; + mpImageList[0] = Image(ScResId(IMG_BORDER1)); + mpImageList[1] = Image(ScResId(IMG_BORDER2)); + mpImageList[2] = Image(ScResId(IMG_BORDER3)); + mpImageList[3] = Image(ScResId(IMG_BORDER4)); + mpImageList[4] = Image(ScResId(IMG_BORDER5)); + mpImageList[5] = Image(ScResId(IMG_BORDER6)); + mpImageList[6] = Image(ScResId(IMG_BORDER7)); + mpImageList[7] = Image(ScResId(IMG_BORDER8)); + mpImageList[8] = Image(ScResId(IMG_BORDER9)); + mpImageList[9] = Image(ScResId(IMG_BORDER10)); + mpImageList[10] = Image(ScResId(IMG_BORDER11)); + mpImageList[11] = Image(ScResId(IMG_BORDER12)); + mpImageList[12] = Image(ScResId(IMG_BORDER13)); + mpImageList[13] = Image(ScResId(IMG_BORDER14)); + mpImageList[14] = Image(ScResId(IMG_BORDER15)); + mpImageList[15] = Image(ScResId(IMG_BORDER16)); + + maTBBorder1.SetItemImage(TBI_BORDER1_NONE, mpImageList[0]); + maTBBorder1.SetItemImage(TBI_BORDER1_ALL, mpImageList[1]); + maTBBorder1.SetItemImage(TBI_BORDER1_OUTER, mpImageList[2]); + maTBBorder1.SetItemImage(TBI_BORDER1_OUTERBOLD, mpImageList[3]); + maTBBorder1.SetBackground(Wallpaper()); + maTBBorder1.SetPaintTransparent(true); + Size aTbxSize( maTBBorder1.CalcWindowSizePixel() ); + maTBBorder1.SetOutputSizePixel( aTbxSize ); + Link aLink = LINK(this, CellBorderStyleControl, TB1SelectHdl); + maTBBorder1.SetSelectHdl ( aLink ); + + maTBBorder2.SetLineCount(2); + maTBBorder2.InsertItem(TBI_BORDER2_LEFT, mpImageList[4]); + maTBBorder2.InsertItem(TBI_BORDER2_RIGHT, mpImageList[5]); + maTBBorder2.InsertItem(TBI_BORDER2_TOP, mpImageList[6]); + maTBBorder2.InsertItem(TBI_BORDER2_BOT, mpImageList[7]); + maTBBorder2.InsertBreak(); + maTBBorder2.InsertItem(TBI_BORDER2_BLTR, mpImageList[8]); + maTBBorder2.InsertItem(TBI_BORDER2_TLBR, mpImageList[9]); + maTBBorder2.InsertItem(TBI_BORDER2_TOPBOT, mpImageList[10]); + maTBBorder2.InsertItem(TBI_BORDER2_LEFTRIGHT, mpImageList[11]); + maTBBorder2.SetBackground(Wallpaper()); + maTBBorder2.SetPaintTransparent(true); + aTbxSize = maTBBorder2.CalcWindowSizePixel() ; + maTBBorder2.SetOutputSizePixel( aTbxSize ); + maTBBorder2.SetHelpId(TBI_BORDER2_LEFT, HID_PROPERTYPANEL_SC_BORDER_TBI_LEFT); + maTBBorder2.SetHelpId(TBI_BORDER2_RIGHT, HID_PROPERTYPANEL_SC_BORDER_TBI_RIGHT); + maTBBorder2.SetHelpId(TBI_BORDER2_TOP, HID_PROPERTYPANEL_SC_BORDER_TBI_TOP); + maTBBorder2.SetHelpId(TBI_BORDER2_BOT, HID_PROPERTYPANEL_SC_BORDER_TBI_BOT); + maTBBorder2.SetHelpId(TBI_BORDER2_BLTR, HID_PROPERTYPANEL_SC_BORDER_TBI_BLTR); + maTBBorder2.SetHelpId(TBI_BORDER2_TLBR, HID_PROPERTYPANEL_SC_BORDER_TBI_TLBR); + maTBBorder2.SetHelpId(TBI_BORDER2_TOPBOT, HID_PROPERTYPANEL_SC_BORDER_TBI_TOPBOT); + maTBBorder2.SetHelpId(TBI_BORDER2_LEFTRIGHT, HID_PROPERTYPANEL_SC_BORDER_TBI_LEFTRIGHT); + maTBBorder2.SetItemText(TBI_BORDER2_LEFT, ScResId(STR_BORDER_1)); + maTBBorder2.SetItemText(TBI_BORDER2_RIGHT, ScResId(STR_BORDER_2)); + maTBBorder2.SetItemText(TBI_BORDER2_TOP, ScResId(STR_BORDER_3)); + maTBBorder2.SetItemText(TBI_BORDER2_BOT, ScResId(STR_BORDER_4)); + maTBBorder2.SetItemText(TBI_BORDER2_BLTR, ScResId(STR_BORDER_5)); + maTBBorder2.SetItemText(TBI_BORDER2_TLBR, ScResId(STR_BORDER_6)); + maTBBorder2.SetItemText(TBI_BORDER2_TOPBOT, ScResId(STR_BORDER_7)); + maTBBorder2.SetItemText(TBI_BORDER2_LEFTRIGHT, ScResId(STR_BORDER_8)); + aLink = LINK(this, CellBorderStyleControl, TB2SelectHdl); + maTBBorder2.SetSelectHdl ( aLink ); + + maTBBorder3.SetItemImage(TBI_BORDER3_S1, mpImageList[12]); + maTBBorder3.SetItemImage(TBI_BORDER3_S2, mpImageList[13]); + maTBBorder3.SetItemImage(TBI_BORDER3_S3, mpImageList[14]); + maTBBorder3.SetItemImage(TBI_BORDER3_S4, mpImageList[15]); + maTBBorder3.SetBackground(Wallpaper()); + maTBBorder3.SetPaintTransparent(true); + aTbxSize = maTBBorder3.CalcWindowSizePixel() ; + maTBBorder3.SetOutputSizePixel( aTbxSize ); + aLink = LINK(this, CellBorderStyleControl, TB3SelectHdl); + maTBBorder3.SetSelectHdl ( aLink ); +} + +IMPL_LINK(CellBorderStyleControl, TB1SelectHdl, ToolBox*, pToolBox) +{ + sal_uInt16 nId = pToolBox->GetCurItemId(); + ::Color aColBlack( COL_BLACK ); + SvxBoxItem aBorderOuter( SID_ATTR_BORDER_OUTER ); + SvxBoxInfoItem aBorderInner( SID_ATTR_BORDER_INNER ); + editeng::SvxBorderLine theDefLine(NULL, 1); + editeng::SvxBorderLine *pLeft = 0, *pRight = 0, *pTop = 0, *pBottom = 0; + sal_uInt8 nValidFlags = 0; + switch ( nId ) + { + case TBI_BORDER1_NONE: + { + nValidFlags |= FRM_VALID_ALL; + SvxLineItem aLineItem1( SID_ATTR_BORDER_DIAG_BLTR ); + SvxLineItem aLineItem2( SID_ATTR_BORDER_DIAG_TLBR ); + aLineItem1.SetLine( NULL ); //modify + aLineItem2.SetLine( NULL ); //modify + mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_ATTR_BORDER_DIAG_BLTR, SFX_CALLMODE_RECORD, &aLineItem1, 0L); + mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_ATTR_BORDER_DIAG_TLBR, SFX_CALLMODE_RECORD, &aLineItem2, 0L); + } + break; + case TBI_BORDER1_ALL: + pLeft = pRight = pTop = pBottom = &theDefLine; + aBorderInner.SetLine( &theDefLine, BOXINFO_LINE_HORI ); + aBorderInner.SetLine( &theDefLine, BOXINFO_LINE_VERT ); + nValidFlags |= FRM_VALID_ALL; + break; + case TBI_BORDER1_OUTER: + pLeft = pRight = pTop = pBottom = &theDefLine; + nValidFlags |= FRM_VALID_OUTER; + break; + case TBI_BORDER1_OUTERBOLD: + theDefLine.SetWidth(DEF_LINE_WIDTH_2); + pLeft = pRight = pTop = pBottom = &theDefLine; + nValidFlags |= FRM_VALID_OUTER; + break; + } + + aBorderOuter.SetLine( pLeft, BOX_LINE_LEFT ); + aBorderOuter.SetLine( pRight, BOX_LINE_RIGHT ); + aBorderOuter.SetLine( pTop, BOX_LINE_TOP ); + aBorderOuter.SetLine( pBottom, BOX_LINE_BOTTOM ); + + aBorderInner.SetValid( VALID_TOP, 0 != (nValidFlags&FRM_VALID_TOP )); + aBorderInner.SetValid( VALID_BOTTOM, 0 != (nValidFlags&FRM_VALID_BOTTOM )); + aBorderInner.SetValid( VALID_LEFT, 0 != (nValidFlags&FRM_VALID_LEFT)); + aBorderInner.SetValid( VALID_RIGHT, 0 != (nValidFlags&FRM_VALID_RIGHT )); + aBorderInner.SetValid( VALID_HORI, 0 != (nValidFlags&FRM_VALID_HINNER )); + aBorderInner.SetValid( VALID_VERT, 0 != (nValidFlags&FRM_VALID_VINNER)); + aBorderInner.SetValid( VALID_DISTANCE, true ); + aBorderInner.SetValid( VALID_DISABLE, false ); + + mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_ATTR_BORDER, SFX_CALLMODE_RECORD, &aBorderOuter, &aBorderInner, 0L); + mrCellAppearancePropertyPanel.EndCellBorderStylePopupMode(); + return 0; +} + +IMPL_LINK(CellBorderStyleControl, TB2SelectHdl, ToolBox *, pToolBox) +{ + sal_uInt16 nId = pToolBox->GetCurItemId(); + + if( nId != TBI_BORDER2_BLTR && nId != TBI_BORDER2_TLBR ) + { + ::Color aColBlack( COL_BLACK ); + SvxBoxItem aBorderOuter( SID_ATTR_BORDER_OUTER ); + SvxBoxInfoItem aBorderInner( SID_ATTR_BORDER_INNER ); + editeng::SvxBorderLine theDefLine(NULL, 1); + editeng::SvxBorderLine *pLeft = 0, + *pRight = 0, + *pTop = 0, + *pBottom = 0; + sal_uInt8 nValidFlags = 0; + switch ( nId ) + { + case TBI_BORDER2_LEFT: + pLeft = &theDefLine; + nValidFlags |= FRM_VALID_LEFT; + break; + case TBI_BORDER2_RIGHT: + // + if(!Application::GetSettings().GetLayoutRTL()) + { + pRight = &theDefLine; + nValidFlags |= FRM_VALID_RIGHT; + } + else + { + pLeft = &theDefLine; + nValidFlags |= FRM_VALID_LEFT; + } + break; + case TBI_BORDER2_TOP: + pTop = &theDefLine; + nValidFlags |= FRM_VALID_TOP; + break; + case TBI_BORDER2_BOT: + pBottom = &theDefLine; + nValidFlags |= FRM_VALID_BOTTOM; + break; + case TBI_BORDER2_TOPBOT: + pTop = pBottom = &theDefLine; + nValidFlags |= FRM_VALID_BOTTOM|FRM_VALID_TOP; + break; + case TBI_BORDER2_LEFTRIGHT: + pLeft = pRight = &theDefLine; + nValidFlags |= FRM_VALID_RIGHT|FRM_VALID_LEFT; + break; + } + aBorderOuter.SetLine( pLeft, BOX_LINE_LEFT ); + aBorderOuter.SetLine( pRight, BOX_LINE_RIGHT ); + aBorderOuter.SetLine( pTop, BOX_LINE_TOP ); + aBorderOuter.SetLine( pBottom, BOX_LINE_BOTTOM ); + + aBorderInner.SetValid( VALID_TOP, 0 != (nValidFlags&FRM_VALID_TOP )); + aBorderInner.SetValid( VALID_BOTTOM, 0 != (nValidFlags&FRM_VALID_BOTTOM )); + aBorderInner.SetValid( VALID_LEFT, 0 != (nValidFlags&FRM_VALID_LEFT)); + aBorderInner.SetValid( VALID_RIGHT, 0 != (nValidFlags&FRM_VALID_RIGHT )); + aBorderInner.SetValid( VALID_HORI, 0 != (nValidFlags&FRM_VALID_HINNER )); + aBorderInner.SetValid( VALID_VERT, 0 != (nValidFlags&FRM_VALID_VINNER)); + aBorderInner.SetValid( VALID_DISTANCE, true ); + aBorderInner.SetValid( VALID_DISABLE, false ); + + mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_ATTR_BORDER, SFX_CALLMODE_RECORD, &aBorderOuter, &aBorderInner, 0L); + } + else if(nId == TBI_BORDER2_BLTR) + { + editeng::SvxBorderLine aTmp( NULL, 1 ); + SvxLineItem aLineItem( SID_ATTR_BORDER_DIAG_BLTR ); + aLineItem.SetLine( &aTmp ); + mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_ATTR_BORDER_DIAG_BLTR, SFX_CALLMODE_RECORD, &aLineItem, 0L); + } + else if(nId == TBI_BORDER2_TLBR) + { + editeng::SvxBorderLine aTmp( NULL, 1 ); + SvxLineItem aLineItem( SID_ATTR_BORDER_DIAG_TLBR ); + aLineItem.SetLine( &aTmp ); + mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_ATTR_BORDER_DIAG_TLBR, SFX_CALLMODE_RECORD, &aLineItem, 0L); + } + + mrCellAppearancePropertyPanel.EndCellBorderStylePopupMode(); + return 0; +} + +IMPL_LINK(CellBorderStyleControl, TB3SelectHdl, ToolBox *, pToolBox) +{ + sal_uInt16 nId = pToolBox->GetCurItemId(); + + ::Color aColBlack( COL_BLACK ); + SvxBoxItem aBorderOuter( SID_ATTR_BORDER_OUTER ); + SvxBoxInfoItem aBorderInner( SID_ATTR_BORDER_INNER ); + editeng::SvxBorderLine *pTop = 0 , + *pBottom = 0 ; + sal_uInt8 nValidFlags = 0; + using namespace ::com::sun::star::table::BorderLineStyle; + + //FIXME: properly adapt to new line border model + + switch ( nId ) + { + case TBI_BORDER3_S1: + pBottom = new editeng::SvxBorderLine(NULL, DEF_LINE_WIDTH_2 ); + nValidFlags |= FRM_VALID_BOTTOM; + break; + case TBI_BORDER3_S2: + pBottom = new editeng::SvxBorderLine(NULL); + pBottom->GuessLinesWidths(DOUBLE, DEF_LINE_WIDTH_0, DEF_LINE_WIDTH_0, DEF_LINE_WIDTH_1); + nValidFlags |= FRM_VALID_BOTTOM; + break; + case TBI_BORDER3_S3: + pBottom = new editeng::SvxBorderLine(NULL, DEF_LINE_WIDTH_2 ); + pTop = new editeng::SvxBorderLine(NULL, 1); + nValidFlags |= FRM_VALID_BOTTOM|FRM_VALID_TOP; + break; + case TBI_BORDER3_S4: + pBottom = new editeng::SvxBorderLine(NULL); + pBottom->GuessLinesWidths(DOUBLE, DEF_LINE_WIDTH_0, DEF_LINE_WIDTH_0, DEF_LINE_WIDTH_1); + pTop = new editeng::SvxBorderLine(NULL, 1); + nValidFlags |= FRM_VALID_BOTTOM|FRM_VALID_TOP; + break; + } + + aBorderOuter.SetLine( pTop, BOX_LINE_TOP ); + aBorderOuter.SetLine( pBottom, BOX_LINE_BOTTOM ); + aBorderOuter.SetLine( NULL, BOX_LINE_LEFT ); + aBorderOuter.SetLine( NULL, BOX_LINE_RIGHT ); + + aBorderInner.SetValid( VALID_TOP, 0 != (nValidFlags&FRM_VALID_TOP )); + aBorderInner.SetValid( VALID_BOTTOM, 0 != (nValidFlags&FRM_VALID_BOTTOM )); + aBorderInner.SetValid( VALID_LEFT, 0 != (nValidFlags&FRM_VALID_LEFT )); + aBorderInner.SetValid( VALID_RIGHT, 0 != (nValidFlags&FRM_VALID_RIGHT )); + aBorderInner.SetValid( VALID_HORI, 0 != (nValidFlags&FRM_VALID_HINNER )); + aBorderInner.SetValid( VALID_VERT, 0 != (nValidFlags&FRM_VALID_VINNER)); + aBorderInner.SetValid( VALID_DISTANCE, true ); + aBorderInner.SetValid( VALID_DISABLE, false ); + + mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_ATTR_BORDER, SFX_CALLMODE_RECORD, &aBorderOuter, &aBorderInner, 0L); + + delete pTop; + delete pBottom; + + mrCellAppearancePropertyPanel.EndCellBorderStylePopupMode(); + return 0; +} + +} } // end of namespace svx::sidebar + +// eof diff --git a/sc/source/ui/sidebar/CellBorderStyleControl.hxx b/sc/source/ui/sidebar/CellBorderStyleControl.hxx new file mode 100644 index 000000000000..8dd594094717 --- /dev/null +++ b/sc/source/ui/sidebar/CellBorderStyleControl.hxx @@ -0,0 +1,56 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SC_SIDEBAR_CELL_BORDER_STYLE_CONTROL_HXX +#define SC_SIDEBAR_CELL_BORDER_STYLE_CONTROL_HXX + +#include <svx/sidebar/PopupControl.hxx> +#include <vcl/button.hxx> +#include <vcl/toolbox.hxx> +#include <vcl/fixed.hxx> + +namespace sc { namespace sidebar { + +class CellAppearancePropertyPanel; + +class CellBorderStyleControl : public svx::sidebar::PopupControl +{ +private: + CellAppearancePropertyPanel& mrCellAppearancePropertyPanel; + ToolBox maTBBorder1; + ToolBox maTBBorder2; + ToolBox maTBBorder3; + FixedLine maFL1; + FixedLine maFL2; + Image* mpImageList; + + void Initialize(); + + DECL_LINK(TB1SelectHdl, ToolBox *); + DECL_LINK(TB2SelectHdl, ToolBox *); + DECL_LINK(TB3SelectHdl, ToolBox *); + +public: + CellBorderStyleControl(Window* pParent, CellAppearancePropertyPanel& rPanel); + virtual ~CellBorderStyleControl(void); +}; + +} } // end of namespace svx::sidebar + +#endif // SC_SIDEBAR_CELL_BORDER_STYLE_CONTROL_HXX + +// eof diff --git a/sc/source/ui/sidebar/CellBorderStylePopup.cxx b/sc/source/ui/sidebar/CellBorderStylePopup.cxx new file mode 100644 index 000000000000..f3dd43aa9196 --- /dev/null +++ b/sc/source/ui/sidebar/CellBorderStylePopup.cxx @@ -0,0 +1,37 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "CellBorderStylePopup.hxx" +#include "CellLineStyleControl.hxx" + +namespace sc { namespace sidebar { + +CellBorderStylePopup::CellBorderStylePopup ( + Window* pParent, + const ::boost::function<svx::sidebar::PopupControl*(svx::sidebar::PopupContainer*)>& rControlCreator) +: Popup(pParent, rControlCreator, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CellBorderStyle"))) +{ +} + +CellBorderStylePopup::~CellBorderStylePopup (void) +{ +} + +} } // end of namespace sc::sidebar + +// eof diff --git a/sc/source/ui/sidebar/CellBorderStylePopup.hxx b/sc/source/ui/sidebar/CellBorderStylePopup.hxx new file mode 100644 index 000000000000..1443a9682137 --- /dev/null +++ b/sc/source/ui/sidebar/CellBorderStylePopup.hxx @@ -0,0 +1,39 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SC_SIDEBAR_CELL_BORDER_STYLE_POPUP_HXX_ +#define _SC_SIDEBAR_CELL_BORDER_STYLE_POPUP_HXX_ + +#include <svx/sidebar/Popup.hxx> +#include <boost/function.hpp> + +namespace sc { namespace sidebar { + +class CellBorderStylePopup : public svx::sidebar::Popup +{ +public : + CellBorderStylePopup( + Window* pParent, + const ::boost::function<svx::sidebar::PopupControl*(svx::sidebar::PopupContainer*)>& rControlCreator); + virtual ~CellBorderStylePopup(void); +}; + +} } // end of namespace sc::sidebar + +#endif // _SC_SIDEBAR_CELL_BORDER_STYLE_POPUP_HXX_ + +// eof diff --git a/sc/source/ui/sidebar/CellBorderUpdater.cxx b/sc/source/ui/sidebar/CellBorderUpdater.cxx new file mode 100644 index 000000000000..e3182611e7ae --- /dev/null +++ b/sc/source/ui/sidebar/CellBorderUpdater.cxx @@ -0,0 +1,122 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <CellBorderUpdater.hxx> +#include <vcl/bmpacc.hxx> +#include <vcl/svapp.hxx> + +namespace sc { namespace sidebar { + +CellBorderUpdater::CellBorderUpdater( + sal_uInt16 nTbxBtnId, + ToolBox& rTbx) +: mnBtnId(nTbxBtnId), + mrTbx(rTbx) +{ +} + +CellBorderUpdater::~CellBorderUpdater() +{ +} + +void CellBorderUpdater::UpdateCellBorder(bool bTop, bool bBot, bool bLeft, bool bRight, Image aImg, bool bVer, bool bHor) +{ + BitmapEx aBmpEx( aImg.GetBitmapEx() ); + Bitmap aBmp( aBmpEx.GetBitmap() ); + BitmapWriteAccess* pBmpAcc = aBmp.AcquireWriteAccess(); + const Size maBmpSize = aBmp.GetSizePixel(); + + if( pBmpAcc ) + { + Bitmap aMsk; + BitmapWriteAccess* pMskAcc; + + if( aBmpEx.IsAlpha() ) + pMskAcc = ( aMsk = aBmpEx.GetAlpha().GetBitmap() ).AcquireWriteAccess(); + else if( aBmpEx.IsTransparent() ) + pMskAcc = ( aMsk = aBmpEx.GetMask() ).AcquireWriteAccess(); + else + pMskAcc = NULL; + + pBmpAcc->SetLineColor( ::Application::GetSettings().GetStyleSettings().GetFieldTextColor() ) ; + pBmpAcc->SetFillColor( COL_BLACK); + + if(maBmpSize.Width() == 43 && maBmpSize.Height() == 43) + { + Point aTL(2, 1), aTR(42,1), aBL(2, 41), aBR(42, 41), aHL(2,21), aHR(42, 21), aVT(22,1), aVB(22, 41); + if( pMskAcc ) + { + pMskAcc->SetLineColor( COL_BLACK ); + pMskAcc->SetFillColor( COL_BLACK ); + } + if(bLeft) + { + pBmpAcc->DrawLine( aTL,aBL ); + if( pMskAcc ) + pMskAcc->DrawLine( aTL,aBL ); + } + if(bRight) + { + pBmpAcc->DrawLine( aTR,aBR ); + if( pMskAcc ) + pMskAcc->DrawLine( aTR,aBR ); + } + if(bTop) + { + pBmpAcc->DrawLine( aTL,aTR ); + if( pMskAcc ) + pMskAcc->DrawLine( aTL,aTR ); + } + if(bBot) + { + pBmpAcc->DrawLine( aBL,aBR ); + if( pMskAcc ) + pMskAcc->DrawLine( aBL,aBR ); + } + if(bVer) + { + pBmpAcc->DrawLine( aVT,aVB ); + if( pMskAcc ) + pMskAcc->DrawLine( aVT,aVB ); + } + if(bHor) + { + pBmpAcc->DrawLine( aHL,aHR ); + if( pMskAcc ) + pMskAcc->DrawLine( aHL,aHR ); + } + } + + aBmp.ReleaseAccess( pBmpAcc ); + if( pMskAcc ) + aMsk.ReleaseAccess( pMskAcc ); + + if( aBmpEx.IsAlpha() ) + aBmpEx = BitmapEx( aBmp, AlphaMask( aMsk ) ); + else if( aBmpEx.IsTransparent() ) + aBmpEx = BitmapEx( aBmp, aMsk ); + else + aBmpEx = aBmp; + + mrTbx.SetItemImage( mnBtnId, Image( aBmpEx ) ); + } +} + +} } // end of namespace svx::sidebar + +// eof diff --git a/sc/source/ui/sidebar/CellBorderUpdater.hxx b/sc/source/ui/sidebar/CellBorderUpdater.hxx new file mode 100644 index 000000000000..fcb02447c4fe --- /dev/null +++ b/sc/source/ui/sidebar/CellBorderUpdater.hxx @@ -0,0 +1,42 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SC_SIDEBAR_CELL_BORDER_UPDATER_HXX +#define SC_SIDEBAR_CELL_BORDER_UPDATER_HXX + +#include <vcl/toolbox.hxx> + +namespace sc { namespace sidebar { + +class CellBorderUpdater +{ +private: + sal_uInt16 mnBtnId; + ToolBox& mrTbx; + +public: + CellBorderUpdater(sal_uInt16 nTbxBtnId, ToolBox& rTbx); + ~CellBorderUpdater(); + + void UpdateCellBorder(bool bTop, bool bBot, bool bLeft, bool bRight, Image aImg, bool bVer, bool bHor); +}; + +} } // end of namespace svx::sidebar + +#endif // SC_SIDEBAR_CELL_BORDER_UPDATER_HXX + +// eof diff --git a/sc/source/ui/sidebar/CellLineStyleControl.cxx b/sc/source/ui/sidebar/CellLineStyleControl.cxx new file mode 100644 index 000000000000..339eff356dfb --- /dev/null +++ b/sc/source/ui/sidebar/CellLineStyleControl.cxx @@ -0,0 +1,254 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <CellLineStyleControl.hxx> +#include "sc.hrc" +#include "scresid.hxx" +#include <CellAppearancePropertyPanel.hrc> +#include <CellLineStyleValueSet.hxx> +#include <vcl/i18nhelp.hxx> +#include <editeng/boxitem.hxx> +#include <editeng/borderline.hxx> +#include <editeng/lineitem.hxx> +#include <CellAppearancePropertyPanel.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> + +namespace sc { namespace sidebar { + +CellLineStyleControl::CellLineStyleControl(Window* pParent, CellAppearancePropertyPanel& rPanel) +: svx::sidebar::PopupControl(pParent, ScResId(RID_POPUPPANEL_APPEARANCE_CELL_LINESTYLE)), + mrCellAppearancePropertyPanel(rPanel), + maPushButtonMoreOptions(this, ScResId(PB_OPTIONS)), + maCellLineStyleValueSet(this, ScResId(VS_STYLE)), + mpStr(0), + mbVSfocus(true) +{ + Initialize(); + FreeResource(); +} + +CellLineStyleControl::~CellLineStyleControl(void) +{ + delete[] mpStr; +} + +void CellLineStyleControl::Initialize() +{ + //maPushButtonMoreOptions.SetIcoPosX(2); + Link aLink = LINK(this, CellLineStyleControl, PBClickHdl); + maPushButtonMoreOptions.SetClickHdl(aLink); + + maCellLineStyleValueSet.SetStyle(maCellLineStyleValueSet.GetStyle()| WB_3DLOOK | WB_NO_DIRECTSELECT); + maCellLineStyleValueSet.SetControlBackground(GetSettings().GetStyleSettings().GetMenuColor()); + maCellLineStyleValueSet.SetColor(GetSettings().GetStyleSettings().GetMenuColor()); + + for(sal_uInt16 i = 1 ; i <= 9 ; i++) + { + maCellLineStyleValueSet.InsertItem(i); + } + + mpStr = new XubString[9]; + mpStr[0] = GetSettings().GetLocaleI18nHelper().GetNum( 5, 2 ).AppendAscii("pt"); + mpStr[1] = GetSettings().GetLocaleI18nHelper().GetNum( 250, 2 ).AppendAscii("pt"); + mpStr[2] = GetSettings().GetLocaleI18nHelper().GetNum( 400, 2 ).AppendAscii("pt"); + mpStr[3] = GetSettings().GetLocaleI18nHelper().GetNum( 500, 2 ).AppendAscii("pt"); + mpStr[4] = GetSettings().GetLocaleI18nHelper().GetNum( 110, 2 ).AppendAscii("pt"); + mpStr[5] = GetSettings().GetLocaleI18nHelper().GetNum( 260, 2 ).AppendAscii("pt"); + mpStr[6] = GetSettings().GetLocaleI18nHelper().GetNum( 450, 2 ).AppendAscii("pt"); + mpStr[7] = GetSettings().GetLocaleI18nHelper().GetNum( 505, 2 ).AppendAscii("pt"); + mpStr[8] = GetSettings().GetLocaleI18nHelper().GetNum( 750, 2 ).AppendAscii("pt"); + maCellLineStyleValueSet.SetUnit(mpStr); + + for(sal_uInt16 i = 1 ; i <= 9 ; i++) + { + maCellLineStyleValueSet.SetItemText(i, mpStr[i-1]); + } + + SetAllNoSel(); + aLink = LINK(this, CellLineStyleControl, VSSelectHdl); + maCellLineStyleValueSet.SetSelectHdl(aLink); + maCellLineStyleValueSet.StartSelection(); + maCellLineStyleValueSet.Show(); +} + +void CellLineStyleControl::GetFocus() +{ + if(!mbVSfocus) + { + maPushButtonMoreOptions.GrabFocus(); + } + else + { + maCellLineStyleValueSet.GrabFocus(); + } +} + +void CellLineStyleControl::SetAllNoSel() +{ + maCellLineStyleValueSet.SelectItem(0); + maCellLineStyleValueSet.SetNoSelection(); + maCellLineStyleValueSet.Format(); + Invalidate(); + maCellLineStyleValueSet.StartSelection(); +} + +IMPL_LINK(CellLineStyleControl, VSSelectHdl, void *, pControl) +{ + if(pControl == &maCellLineStyleValueSet) + { + const sal_uInt16 iPos(maCellLineStyleValueSet.GetSelectItemId()); + SvxLineItem aLineItem(SID_FRAME_LINESTYLE); + using namespace ::com::sun::star::table::BorderLineStyle; + editeng::SvxBorderStyle nStyle = SOLID; + sal_uInt16 n1 = 0; + sal_uInt16 n2 = 0; + sal_uInt16 n3 = 0; + + //FIXME: fully for new border line possibilities + + switch(iPos) + { + case 1: + n1 = DEF_LINE_WIDTH_0; + break; + case 2: + n1 = DEF_LINE_WIDTH_2; + break; + case 3: + n1 = DEF_LINE_WIDTH_3; + break; + case 4: + n1 = DEF_LINE_WIDTH_4; + break; + case 5: + n1 = DEF_LINE_WIDTH_0; + n2 = DEF_LINE_WIDTH_0; + n3 = DEF_LINE_WIDTH_1; + nStyle = DOUBLE; + break; + case 6: + n1 = DEF_LINE_WIDTH_0; + n2 = DEF_LINE_WIDTH_0; + n3 = DEF_LINE_WIDTH_2; + nStyle = DOUBLE; + break; + case 7: + n1 = DEF_LINE_WIDTH_1; + n2 = DEF_LINE_WIDTH_2; + n3 = DEF_LINE_WIDTH_1; + nStyle = DOUBLE; + break; + case 8: + n1 = DEF_LINE_WIDTH_2; + n2 = DEF_LINE_WIDTH_0; + n3 = DEF_LINE_WIDTH_2; + nStyle = DOUBLE; + break; + case 9: + n1 = DEF_LINE_WIDTH_2; + n2 = DEF_LINE_WIDTH_2; + n3 = DEF_LINE_WIDTH_2; + nStyle = DOUBLE; + break; + default: + break; + } + + editeng::SvxBorderLine aTmp; + aTmp.GuessLinesWidths(nStyle, n1, n2, n3); + aLineItem.SetLine( &aTmp ); + mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_FRAME_LINESTYLE, SFX_CALLMODE_RECORD, &aLineItem, 0L); + SetAllNoSel(); + mrCellAppearancePropertyPanel.EndCellLineStylePopupMode(); + } + + return(0L); +} + +IMPL_LINK(CellLineStyleControl, PBClickHdl, PushButton *, pPBtn) +{ + if(pPBtn == &maPushButtonMoreOptions) + { + if(mrCellAppearancePropertyPanel.GetBindings()) + { + mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_CELL_FORMAT_BORDER, SFX_CALLMODE_ASYNCHRON); + } + + mrCellAppearancePropertyPanel.EndCellLineStylePopupMode(); + } + + return 0; +} + +void CellLineStyleControl::SetLineStyleSelect(sal_uInt16 out, sal_uInt16 in, sal_uInt16 dis) +{ + SetAllNoSel(); + mbVSfocus = true; + + //FIXME: fully for new border line possibilities + + if(out == DEF_LINE_WIDTH_0 && in == 0 && dis == 0) //1 + { + maCellLineStyleValueSet.SetSelItem(1); + } + else if(out == DEF_LINE_WIDTH_2 && in == 0 && dis == 0) //2 + { + maCellLineStyleValueSet.SetSelItem(2); + } + else if(out == DEF_LINE_WIDTH_3 && in == 0 && dis == 0) //3 + { + maCellLineStyleValueSet.SetSelItem(3); + } + else if(out == DEF_LINE_WIDTH_4 && in == 0 && dis == 0) //4 + { + maCellLineStyleValueSet.SetSelItem(4); + } + else if(out == DEF_LINE_WIDTH_0 && in == DEF_LINE_WIDTH_0 && dis == DEF_LINE_WIDTH_1) //5 + { + maCellLineStyleValueSet.SetSelItem(5); + } + else if(out == DEF_LINE_WIDTH_0 && in == DEF_LINE_WIDTH_0 && dis == DEF_LINE_WIDTH_2) //6 + { + maCellLineStyleValueSet.SetSelItem(6); + } + else if(out == DEF_LINE_WIDTH_1 && in == DEF_LINE_WIDTH_2 && dis == DEF_LINE_WIDTH_1) //7 + { + maCellLineStyleValueSet.SetSelItem(7); + } + else if(out == DEF_LINE_WIDTH_2 && in == DEF_LINE_WIDTH_0 && dis == DEF_LINE_WIDTH_2) //8 + { + maCellLineStyleValueSet.SetSelItem(8); + } + else if(out == DEF_LINE_WIDTH_2 && in == DEF_LINE_WIDTH_2 && dis == DEF_LINE_WIDTH_2) //9 + { + maCellLineStyleValueSet.SetSelItem(9); + } + else + { + maCellLineStyleValueSet.SetSelItem(0); + mbVSfocus = false; + } + + maCellLineStyleValueSet.Format(); + maCellLineStyleValueSet.StartSelection(); +} + +} } // end of namespace svx::sidebar + +// eof diff --git a/sc/source/ui/sidebar/CellLineStyleControl.hxx b/sc/source/ui/sidebar/CellLineStyleControl.hxx new file mode 100644 index 000000000000..d7d47dad1f18 --- /dev/null +++ b/sc/source/ui/sidebar/CellLineStyleControl.hxx @@ -0,0 +1,68 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SC_SIDEBAR_CELL_LINE_STYLE_CONTROL_HXX +#define SC_SIDEBAR_CELL_LINE_STYLE_CONTROL_HXX + +#include <svx/sidebar/PopupControl.hxx> +#include <vcl/button.hxx> +#include <CellLineStyleValueSet.hxx> + +namespace sc { namespace sidebar { + +class CellAppearancePropertyPanel; + +class CellLineStyleControl : public svx::sidebar::PopupControl +{ +private: + CellAppearancePropertyPanel& mrCellAppearancePropertyPanel; + PushButton maPushButtonMoreOptions; + CellLineStyleValueSet maCellLineStyleValueSet; + XubString* mpStr; + + /// bitfield + bool mbVSfocus : 1; + + void Initialize(); + void SetAllNoSel(); + + DECL_LINK(VSSelectHdl, void*); + DECL_LINK(PBClickHdl, PushButton*); + +public: + CellLineStyleControl(Window* pParent, CellAppearancePropertyPanel& rPanel); + virtual ~CellLineStyleControl(void); + + void GetFocus(); + void SetLineStyleSelect(sal_uInt16 out, sal_uInt16 in, sal_uInt16 dis); + + ValueSet& GetValueSet() + { + return maCellLineStyleValueSet; + } + + Control& GetPushButton() + { + return maPushButtonMoreOptions; + } +}; + +} } // end of namespace svx::sidebar + +#endif // SC_SIDEBAR_CELL_LINE_STYLE_CONTROL_HXX + +// eof diff --git a/sc/source/ui/sidebar/CellLineStylePopup.cxx b/sc/source/ui/sidebar/CellLineStylePopup.cxx new file mode 100644 index 000000000000..23f80d9a44e3 --- /dev/null +++ b/sc/source/ui/sidebar/CellLineStylePopup.cxx @@ -0,0 +1,49 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "CellLineStylePopup.hxx" +#include "CellLineStyleControl.hxx" + +namespace sc { namespace sidebar { + +CellLineStylePopup::CellLineStylePopup ( + Window* pParent, + const ::boost::function<svx::sidebar::PopupControl*(svx::sidebar::PopupContainer*)>& rControlCreator) +: Popup(pParent, rControlCreator, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CellLineStyle"))) +{ +} + +CellLineStylePopup::~CellLineStylePopup (void) +{ +} + +void CellLineStylePopup::SetLineStyleSelect(sal_uInt16 out, sal_uInt16 in, sal_uInt16 dis) +{ + ProvideContainerAndControl(); + + CellLineStyleControl* pControl = dynamic_cast< CellLineStyleControl* >(mpControl.get()); + + if(pControl) + { + pControl->SetLineStyleSelect(out, in, dis); + } +} + +} } // end of namespace sc::sidebar + +// eof diff --git a/sc/source/ui/sidebar/CellLineStylePopup.hxx b/sc/source/ui/sidebar/CellLineStylePopup.hxx new file mode 100644 index 000000000000..8401dee217dc --- /dev/null +++ b/sc/source/ui/sidebar/CellLineStylePopup.hxx @@ -0,0 +1,41 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SC_SIDEBAR_CELL_LINE_STYLE_POPUP_HXX_ +#define _SC_SIDEBAR_CELL_LINE_STYLE_POPUP_HXX_ + +#include <svx/sidebar/Popup.hxx> +#include <boost/function.hpp> + +namespace sc { namespace sidebar { + +class CellLineStylePopup : public svx::sidebar::Popup +{ +public : + CellLineStylePopup( + Window* pParent, + const ::boost::function<svx::sidebar::PopupControl*(svx::sidebar::PopupContainer*)>& rControlCreator); + virtual ~CellLineStylePopup(void); + + void SetLineStyleSelect(sal_uInt16 out, sal_uInt16 in, sal_uInt16 dis); +}; + +} } // end of namespace sc::sidebar + +#endif // _SC_SIDEBAR_CELL_LINE_STYLE_POPUP_HXX_ + +// eof diff --git a/sc/source/ui/sidebar/CellLineStyleValueSet.cxx b/sc/source/ui/sidebar/CellLineStyleValueSet.cxx new file mode 100644 index 000000000000..4f823f029841 --- /dev/null +++ b/sc/source/ui/sidebar/CellLineStyleValueSet.cxx @@ -0,0 +1,179 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <CellLineStyleValueSet.hxx> +#include <i18nlangtag/mslangid.hxx> + +namespace sc { namespace sidebar { + +CellLineStyleValueSet::CellLineStyleValueSet( Window* pParent, const ResId& rResId) +: ValueSet( pParent, rResId ), + pVDev(NULL), + nSelItem(0), + bCusEnable(false) +{ + strUnit = new XubString[9]; + SetColCount( 1 ); + SetLineCount( 9); +} + +CellLineStyleValueSet::~CellLineStyleValueSet() +{ + delete pVDev; + delete[] strUnit; +} + +void CellLineStyleValueSet::SetUnit(XubString* str) +{ + for(int i = 0; i < 9; i++) + { + strUnit[i] = str[i]; + } +} + +void CellLineStyleValueSet::SetSelItem(sal_uInt16 nSel) +{ + nSelItem = nSel; + if(nSel == 0) + { + SelectItem(1); + SetNoSelection(); + } + else + { + SelectItem(nSelItem); + GrabFocus(); + } +} + +sal_uInt16 CellLineStyleValueSet::GetSelItem() +{ + return nSelItem; +} + +void CellLineStyleValueSet::SetImage(Image img) +{ + imgCus = img; +} + +void CellLineStyleValueSet::SetCusEnable(bool bEnable) +{ + bCusEnable = bEnable; +} + +void CellLineStyleValueSet::UserDraw( const UserDrawEvent& rUDEvt ) +{ + Rectangle aRect = rUDEvt.GetRect(); + OutputDevice* pDev = rUDEvt.GetDevice(); + sal_uInt16 nItemId = rUDEvt.GetItemId(); + + long nRectHeight = aRect.GetHeight(); + long nRectWidth = aRect.GetWidth(); + Point aBLPos = aRect.TopLeft(); + + Font aOldFont = pDev->GetFont(); + Color aOldColor = pDev->GetLineColor(); + Color aOldFillColor = pDev->GetFillColor(); + + Font aFont(OutputDevice::GetDefaultFont(DEFAULTFONT_UI_SANS, MsLangId::getSystemLanguage(), DEFAULTFONT_FLAGS_ONLYONE)); + Size aSize = aFont.GetSize(); + aSize.Height() = nRectHeight*3/5; + aFont.SetSize( aSize ); + + Point aLineStart(aBLPos.X() + 5, aBLPos.Y() + ( nRectHeight - nItemId )/2); + Point aLineEnd(aBLPos.X() + nRectWidth * 7 / 9 - 15, aBLPos.Y() + ( nRectHeight - nItemId )/2); + long nTLX = aBLPos.X() + 5, nTLY = aBLPos.Y() + ( nRectHeight - nItemId )/2; + long nTRX = aBLPos.X() + nRectWidth * 7 / 9 - 15, nTRY = aBLPos.Y() + ( nRectHeight - nItemId )/2; + + if( nSelItem == nItemId ) + { + Color aBackColor(50,107,197); + Rectangle aBackRect = aRect; + aBackRect.Top() += 3; + aBackRect.Bottom() -= 2; + pDev->SetFillColor(aBackColor); + pDev->DrawRect(aBackRect); + } + else + { + pDev->SetFillColor( COL_TRANSPARENT ); + pDev->DrawRect(aRect); + } + + //draw text + if(nSelItem == nItemId ) + aFont.SetColor(COL_WHITE); + else + aFont.SetColor(GetSettings().GetStyleSettings().GetFieldTextColor()); //high contrast + + pDev->SetFont(aFont); + Point aStart(aBLPos.X() + nRectWidth * 7 / 9 - 5 , aBLPos.Y() + nRectHeight/6); + pDev->DrawText(aStart, strUnit[ nItemId - 1 ]); //can't set TEXT_DRAW_ENDELLIPSIS here, or the text will disapear + + //draw line + if( nSelItem == nItemId ) + { + pDev->SetFillColor(COL_WHITE); + pDev->SetLineColor(COL_WHITE); + } + else + { + pDev->SetFillColor(GetSettings().GetStyleSettings().GetFieldTextColor()); //high contrast + pDev->SetLineColor(GetSettings().GetStyleSettings().GetFieldTextColor()); //high contrast + } + + switch( nItemId ) + { + case 1: + case 2: + case 3: + case 4: + pDev->DrawRect(Rectangle(nTLX, nTLY , nTRX, nTRY + nItemId * 2 - 1 )); + break; + case 5: + pDev->DrawRect(Rectangle(nTLX, nTLY , nTRX, nTRY + 1 )); + pDev->DrawRect(Rectangle(nTLX, nTLY + 3 , nTRX, nTRY + 4 )); + break; + case 6: + pDev->DrawRect(Rectangle(nTLX, nTLY , nTRX, nTRY + 1 )); + pDev->DrawRect(Rectangle(nTLX, nTLY + 5 , nTRX, nTRY + 6 )); + break; + case 7: + pDev->DrawRect(Rectangle(nTLX, nTLY , nTRX, nTRY + 1 )); + pDev->DrawRect(Rectangle(nTLX, nTLY + 3 , nTRX, nTRY + 6 )); + break; + case 8: + pDev->DrawRect(Rectangle(nTLX, nTLY , nTRX, nTRY + 3 )); + pDev->DrawRect(Rectangle(nTLX, nTLY + 5 , nTRX, nTRY + 6 )); + break; + case 9: + pDev->DrawRect(Rectangle(nTLX, nTLY , nTRX, nTRY + 3 )); + pDev->DrawRect(Rectangle(nTLX, nTLY + 5 , nTRX, nTRY + 8 )); + break; + } + + Invalidate( aRect ); + pDev->SetLineColor(aOldColor); + pDev->SetFillColor(aOldFillColor); + pDev->SetFont(aOldFont); + +} + +} } // end of namespace svx::sidebar + +// eof diff --git a/sc/source/ui/sidebar/CellLineStyleValueSet.hxx b/sc/source/ui/sidebar/CellLineStyleValueSet.hxx new file mode 100644 index 000000000000..ebdfa53f2956 --- /dev/null +++ b/sc/source/ui/sidebar/CellLineStyleValueSet.hxx @@ -0,0 +1,50 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SC_SIDEBAR_CELL_LINE_STYLE_VALUE_SET_HXX +#define SC_SIDEBAR_CELL_LINE_STYLE_VALUE_SET_HXX + +#include <svtools/valueset.hxx> +#include <vcl/image.hxx> + +namespace sc { namespace sidebar { + +class CellLineStyleValueSet : public ValueSet +{ +private: + VirtualDevice* pVDev; + sal_uInt16 nSelItem; + XubString* strUnit; + Image imgCus; + bool bCusEnable; +public: + CellLineStyleValueSet( Window* pParent, const ResId& rResId); + virtual ~CellLineStyleValueSet(); + + void SetUnit(XubString* str); + void SetSelItem(sal_uInt16 nSel); + sal_uInt16 GetSelItem(); + void SetImage(Image img); + void SetCusEnable(bool bEnable); + virtual void UserDraw( const UserDrawEvent& rUDEvt ); +}; + +} } // end of namespace svx::sidebar + +#endif // SC_SIDEBAR_CELL_LINE_STYLE_VALUE_SET_HXX + +// eof diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx new file mode 100644 index 000000000000..2f5a805b3043 --- /dev/null +++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx @@ -0,0 +1,384 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include <sfx2/sidebar/Theme.hxx> +#include <sfx2/sidebar/ControlFactory.hxx> +#include <NumberFormatPropertyPanel.hxx> +#include <NumberFormatPropertyPanel.hrc> +#include "sc.hrc" +#include "scresid.hxx" +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <vcl/fixed.hxx> +#include <vcl/lstbox.hxx> +#include <vcl/field.hxx> +#include <vcl/toolbox.hxx> +#include <svl/intitem.hxx> +#include <svl/stritem.hxx> + +using namespace css; +using namespace cssu; + +#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) + +////////////////////////////////////////////////////////////////////////////// +// namespace open + +namespace sc { namespace sidebar { + +////////////////////////////////////////////////////////////////////////////// + +NumberFormatPropertyPanel::NumberFormatPropertyPanel( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings) +: Control( + pParent, + ScResId(RID_PROPERTYPANEL_SC_NUMBERFORMAT)), + mpFtCategory(new FixedText(this, ScResId(FT_CATEGORY))), + mpLbCategory(new ListBox(this, ScResId(LB_CATEGORY))), + mpTBCategoryBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), + mpTBCategory(sfx2::sidebar::ControlFactory::CreateToolBox(mpTBCategoryBackground.get(), ScResId(TBX_CATEGORY))), + mpFtDecimals(new FixedText(this, ScResId(FT_DECIMALS))), + mpEdDecimals(new NumericField(this, ScResId(ED_DECIMALS))), + mpFtLeadZeroes(new FixedText(this, ScResId(FT_LEADZEROES))), + mpEdLeadZeroes(new NumericField(this, ScResId(ED_LEADZEROES))), + mpBtnNegRed(new CheckBox(this, ScResId(BTN_NEGRED))), + mpBtnThousand(new CheckBox(this, ScResId(BTN_THOUSAND))), + maNumFormatControl(SID_NUMBER_TYPE_FORMAT, *pBindings, *this), + + // Caution! SID_NUMBER_FORMAT is reworked in symphony code, may be needed (!) If + // yes, grep for it in SC and symphony (!) + maFormatControl(SID_NUMBER_FORMAT, *pBindings, *this), + + maImgNumber(ScResId(IMG_NUMBER)), + maImgPercent(ScResId(IMG_PERCENT)), + maImgCurrency(ScResId(IMG_CURRENCY)), + maImgDate(ScResId(IMG_DATE)), + maImgText(ScResId(IMG_TEXT)), + mnCategorySelected(0), + mxFrame(rxFrame), + maContext(), + mpBindings(pBindings) +{ + Initialize(); + FreeResource(); +} + +////////////////////////////////////////////////////////////////////////////// + +NumberFormatPropertyPanel::~NumberFormatPropertyPanel() +{ + // Destroy the toolboxes, then their background windows. + mpTBCategory.reset(); + mpTBCategoryBackground.reset(); +} + +////////////////////////////////////////////////////////////////////////////// + +void NumberFormatPropertyPanel::Initialize() +{ + Link aLink = LINK(this, NumberFormatPropertyPanel, NumFormatSelectHdl); + mpLbCategory->SetSelectHdl ( aLink ); + mpLbCategory->SelectEntryPos(0); + mpLbCategory->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Category"))); //wj acc + mpLbCategory->SetDropDownLineCount(mpLbCategory->GetEntryCount()); + + mpTBCategory->SetItemImage(ID_NUMBER, maImgNumber); + mpTBCategory->SetItemImage(ID_PERCENT, maImgPercent); + mpTBCategory->SetItemImage(ID_CURRENCY, maImgCurrency); + mpTBCategory->SetItemImage(ID_DATE, maImgDate); + mpTBCategory->SetItemImage(ID_TEXT, maImgText); + Size aTbxSize( mpTBCategory->CalcWindowSizePixel() ); + mpTBCategory->SetOutputSizePixel( aTbxSize ); + mpTBCategory->SetBackground(Wallpaper()); + mpTBCategory->SetPaintTransparent(true); + aLink = LINK(this, NumberFormatPropertyPanel, NumFormatHdl); + mpTBCategory->SetSelectHdl ( aLink ); + + aLink = LINK(this, NumberFormatPropertyPanel, NumFormatValueHdl); + + mpEdDecimals->SetModifyHdl( aLink ); + mpEdLeadZeroes->SetModifyHdl( aLink ); + mpEdDecimals->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Decimal Places"))); //wj acc + mpEdLeadZeroes->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Leading Zeroes"))); //wj acc + mpBtnNegRed->SetClickHdl( aLink ); + mpBtnThousand->SetClickHdl( aLink ); + + mpLbCategory->SetAccessibleRelationLabeledBy(mpFtCategory.get()); + mpTBCategory->SetAccessibleRelationLabeledBy(mpTBCategory.get()); + mpEdDecimals->SetAccessibleRelationLabeledBy(mpFtDecimals.get()); + mpEdLeadZeroes->SetAccessibleRelationLabeledBy(mpFtLeadZeroes.get()); +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK( NumberFormatPropertyPanel, NumFormatHdl, ToolBox*, pBox ) +{ + sal_uInt16 nVal = pBox->GetCurItemId(); + sal_uInt16 nId = 0; + switch(nVal) + { + case ID_NUMBER: + nId = 1; + break; + case ID_PERCENT: + nId = 2; + break; + case ID_CURRENCY: + nId = 3; + break; + case ID_DATE: + nId = 4; + break; + case ID_TEXT: + nId = 9; + break; + default: + ; + } + if( nId != mnCategorySelected ) + { + SfxUInt16Item aItem( SID_NUMBER_TYPE_FORMAT, nId ); + GetBindings()->GetDispatcher()->Execute(SID_NUMBER_TYPE_FORMAT, SFX_CALLMODE_RECORD, &aItem, 0L); + } + return 0L; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK( NumberFormatPropertyPanel, NumFormatSelectHdl, ListBox*, pBox ) +{ + sal_uInt16 nVal = pBox->GetSelectEntryPos(); + if( nVal != mnCategorySelected ) + { + SfxUInt16Item aItem( SID_NUMBER_TYPE_FORMAT, nVal ); + GetBindings()->GetDispatcher()->Execute(SID_NUMBER_TYPE_FORMAT, SFX_CALLMODE_RECORD, &aItem, 0L); + mnCategorySelected = nVal; + } + return 0L; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK( NumberFormatPropertyPanel, NumFormatValueHdl, void*, EMPTYARG ) +{ + String aFormat; + String sBreak = OUString(","); + bool bThousand = mpBtnThousand->IsEnabled() + && mpBtnThousand->IsChecked(); + bool bNegRed = mpBtnNegRed->IsEnabled() + && mpBtnNegRed->IsChecked(); + sal_uInt16 nPrecision = (mpEdDecimals->IsEnabled()) + ? (sal_uInt16)mpEdDecimals->GetValue() + : (sal_uInt16)0; + sal_uInt16 nLeadZeroes = (mpEdLeadZeroes->IsEnabled()) + ? (sal_uInt16)mpEdLeadZeroes->GetValue() + : (sal_uInt16)0; + + String sThousand = OUString::number(static_cast<sal_Int32>(bThousand)); + String sNegRed = OUString::number(static_cast<sal_Int32>(bNegRed)); + String sPrecision = OUString::number(nPrecision); + String sLeadZeroes = OUString::number(nLeadZeroes); + + aFormat += sThousand; + aFormat += sBreak; + aFormat += sNegRed; + aFormat += sBreak; + aFormat += sPrecision; + aFormat += sBreak; + aFormat += sLeadZeroes; + aFormat += sBreak; + + SfxStringItem aItem( SID_NUMBER_FORMAT, aFormat ); + GetBindings()->GetDispatcher()->Execute(SID_NUMBER_FORMAT, SFX_CALLMODE_RECORD, &aItem, 0L); + return 0L; +} + +////////////////////////////////////////////////////////////////////////////// + +NumberFormatPropertyPanel* NumberFormatPropertyPanel::Create ( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings) +{ + if (pParent == NULL) + throw lang::IllegalArgumentException(A2S("no parent Window given to NumberFormatPropertyPanel::Create"), NULL, 0); + if ( ! rxFrame.is()) + throw lang::IllegalArgumentException(A2S("no XFrame given to NumberFormatPropertyPanel::Create"), NULL, 1); + if (pBindings == NULL) + throw lang::IllegalArgumentException(A2S("no SfxBindings given to NumberFormatPropertyPanel::Create"), NULL, 2); + + return new NumberFormatPropertyPanel( + pParent, + rxFrame, + pBindings); +} + +////////////////////////////////////////////////////////////////////////////// + +void NumberFormatPropertyPanel::DataChanged( + const DataChangedEvent& rEvent) +{ + (void)rEvent; +} + +////////////////////////////////////////////////////////////////////////////// + +void NumberFormatPropertyPanel::HandleContextChange( + const ::sfx2::sidebar::EnumContext aContext) +{ + if(maContext == aContext) + { + // Nothing to do. + return; + } + + maContext = aContext; + + + + // todo +} + +////////////////////////////////////////////////////////////////////////////// + +void NumberFormatPropertyPanel::NotifyItemUpdate( + sal_uInt16 nSID, + SfxItemState eState, + const SfxPoolItem* pState) +{ + switch(nSID) + { + case SID_NUMBER_TYPE_FORMAT: + { + if( eState >= SFX_ITEM_AVAILABLE) + { + const SfxInt16Item* pItem = (const SfxInt16Item*)pState; + sal_uInt16 nVal = pItem->GetValue(); + mnCategorySelected = nVal; + mpLbCategory->SelectEntryPos(nVal); + if( nVal < 4 ) + { + mpBtnThousand->Enable(); + mpBtnNegRed->Enable(); + mpEdDecimals->Enable(); + mpEdLeadZeroes->Enable(); + } + else + { + mpBtnThousand->Disable(); + mpBtnNegRed->Disable(); + mpEdDecimals->Disable(); + mpEdLeadZeroes->Disable(); + } + } + else + { + mpLbCategory->SetNoSelection(); + mnCategorySelected = 0; + mpBtnThousand->Disable(); + mpBtnNegRed->Disable(); + mpEdDecimals->Disable(); + mpEdLeadZeroes->Disable(); + } + } + break; + case SID_NUMBER_FORMAT: + { + bool bThousand = 0; + bool bNegRed = 0; + sal_uInt16 nPrecision = 0; + sal_uInt16 nLeadZeroes = 0; + if( eState >= SFX_ITEM_AVAILABLE) + { + const SfxStringItem* pItem = (const SfxStringItem*)pState; + String aCode = pItem->GetValue(); + /* if(aCode.Equals(String::CreateFromAscii("General"))) + { + mnCategorySelected = 0; + mpLbCategory->SelectEntryPos(0); + mpBtnThousand->Check(0); + mpBtnNegRed->Check(0); + mpEdDecimals->SetValue(0); + mpEdLeadZeroes->SetValue(1); + break; + } + else if( mpLbCategory->GetSelectEntryPos() == 0 ) + { + mnCategorySelected = 1; + mpLbCategory->SelectEntryPos(1); + }*/ + sal_uInt16 aLen = aCode.Len(); + String* sFormat = new String[4]; + String sTmpStr = OUString(); + sal_uInt16 nCount = 0; + sal_uInt16 nStrCount = 0; + while( nCount < aLen ) + { + sal_Unicode cChar = aCode.GetChar(nCount); + if(cChar == sal_Unicode(',')) + { + sFormat[nStrCount] = sTmpStr; + sTmpStr = OUString(); + nStrCount++; + } + else + { + sTmpStr += cChar; + } + nCount++; + } + bThousand = sFormat[0].ToInt32(); + bNegRed = sFormat[1].ToInt32(); + nPrecision = (sal_uInt16)sFormat[2].ToInt32(); + nLeadZeroes = (sal_uInt16)sFormat[3].ToInt32(); + delete[] sFormat; + } + else + { + bThousand = 0; + bNegRed = 0; + nPrecision = 0; + nLeadZeroes = 1; + } + mpBtnThousand->Check(bThousand); + mpBtnNegRed->Check(bNegRed); + mpEdDecimals->SetValue(nPrecision); + mpEdLeadZeroes->SetValue(nLeadZeroes); + } + default: + ; + } +} + +////////////////////////////////////////////////////////////////////////////// + +SfxBindings* NumberFormatPropertyPanel::GetBindings() +{ + return mpBindings; +} + +////////////////////////////////////////////////////////////////////////////// +// namespace close + +}} // end of namespace ::sc::sidebar + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.hrc b/sc/source/ui/sidebar/NumberFormatPropertyPanel.hrc new file mode 100644 index 000000000000..13b17c32ef71 --- /dev/null +++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.hrc @@ -0,0 +1,70 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#define FT_CATEGORY 1 +#define LB_CATEGORY 2 +#define FT_DECIMALS 3 +#define ED_DECIMALS 4 +#define FT_LEADZEROES 5 +#define ED_LEADZEROES 6 +#define BTN_NEGRED 7 +#define BTN_THOUSAND 8 +#define TBX_CATEGORY 9 +#define ID_NUMBER 10 +#define ID_PERCENT 11 +#define ID_CURRENCY 12 +#define ID_DATE 13 +#define ID_TEXT 14 +#define IMG_NUMBER 15 +#define IMG_PERCENT 16 +#define IMG_CURRENCY 17 +#define IMG_DATE 18 +#define IMG_TEXT 19 + +//===============================================================position============================================= + +#define MBOX_WIDTH 28 +#define NF_TOOLBOX_ITEM_HEIGHT 12 +#define CHECKBOX_HEIGHT 10 + +#define FT_CATEGORY_X SECTIONPAGE_MARGIN_HORIZONTAL +#define FT_CATEGORY_Y SECTIONPAGE_MARGIN_VERTICAL_TOP +#define LB_CATEGORY_X FT_CATEGORY_X +#define LB_CATEGORY_Y FT_CATEGORY_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + +#define TBX_CATEGORY_X SECTIONPAGE_MARGIN_HORIZONTAL + 1 +#define TBX_CATEGORY_Y LB_CATEGORY_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL + +#define FT_DECIMALS_X SECTIONPAGE_MARGIN_HORIZONTAL +#define FT_DECIMALS_Y TBX_CATEGORY_Y + NF_TOOLBOX_ITEM_HEIGHT + 4 + CONTROL_SPACING_VERTICAL +#define LB_DECIMALS_X FT_CATEGORY_X +#define LB_DECIMALS_Y FT_DECIMALS_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + +#define FT_LEADZEROES_X SECTIONPAGE_MARGIN_HORIZONTAL + MBOX_WIDTH*2 + CONTROL_SPACING_HORIZONTAL +#define FT_LEADZEROES_Y FT_DECIMALS_Y +#define LB_LEADZEROES_X FT_LEADZEROES_X +#define LB_LEADZEROES_Y FT_LEADZEROES_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + +#define BTN_NEGRED_X SECTIONPAGE_MARGIN_HORIZONTAL +#define BTN_NEGRED_Y LB_LEADZEROES_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL + +#define BTN_THOUSAND_X SECTIONPAGE_MARGIN_HORIZONTAL +#define BTN_THOUSAND_Y BTN_NEGRED_Y + CHECKBOX_HEIGHT + CONTROL_SPACING_VERTICAL - 3 + +#define PROPERTYPAGE_HEIGHT BTN_THOUSAND_Y + CHECKBOX_HEIGHT + 2 + +// eof diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx b/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx new file mode 100644 index 000000000000..98102f476297 --- /dev/null +++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx @@ -0,0 +1,104 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SC_PROPERTYPANEL_NUMFORMAT_HXX +#define SC_PROPERTYPANEL_NUMFORMAT_HXX + +#include <sfx2/sidebar/SidebarPanelBase.hxx> +#include <sfx2/sidebar/ControllerItem.hxx> +#include <sfx2/sidebar/IContextChangeReceiver.hxx> +#include <boost/scoped_ptr.hpp> + +class FixedText; +class ListBox; +class NumericField; + +namespace sc { namespace sidebar { + +class NumberFormatPropertyPanel +: public Control, + public ::sfx2::sidebar::IContextChangeReceiver, + public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface +{ +public: +public: + static NumberFormatPropertyPanel* Create( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings); + + virtual void DataChanged( + const DataChangedEvent& rEvent); + + virtual void HandleContextChange( + const ::sfx2::sidebar::EnumContext aContext); + + virtual void NotifyItemUpdate( + const sal_uInt16 nSId, + const SfxItemState eState, + const SfxPoolItem* pState); + + SfxBindings* GetBindings(); + +private: + //ui controls + ::boost::scoped_ptr< FixedText > mpFtCategory; + ::boost::scoped_ptr< ListBox > mpLbCategory; + ::boost::scoped_ptr< Window > mpTBCategoryBackground; + ::boost::scoped_ptr< ToolBox > mpTBCategory; + ::boost::scoped_ptr< FixedText > mpFtDecimals; + ::boost::scoped_ptr< NumericField > mpEdDecimals; + ::boost::scoped_ptr< FixedText > mpFtLeadZeroes; + ::boost::scoped_ptr< NumericField > mpEdLeadZeroes; + ::boost::scoped_ptr< CheckBox > mpBtnNegRed; + ::boost::scoped_ptr< CheckBox > mpBtnThousand; + + ::sfx2::sidebar::ControllerItem maNumFormatControl; + ::sfx2::sidebar::ControllerItem maFormatControl; + + // images + Image maImgNumber; + Image maImgPercent; + Image maImgCurrency; + Image maImgDate; + Image maImgText; + + sal_uInt16 mnCategorySelected; + + cssu::Reference<css::frame::XFrame> mxFrame; + ::sfx2::sidebar::EnumContext maContext; + SfxBindings* mpBindings; + + DECL_LINK(NumFormatHdl, ToolBox*); + DECL_LINK(NumFormatSelectHdl, ListBox*); + DECL_LINK(NumFormatValueHdl, void*); + + // constructor/destuctor + NumberFormatPropertyPanel( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings); + virtual ~NumberFormatPropertyPanel(); + + void Initialize(); +}; + +} } // end of namespace ::sc::sidebar + +#endif + +// eof diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.src b/sc/source/ui/sidebar/NumberFormatPropertyPanel.src new file mode 100644 index 000000000000..2111a5ca233f --- /dev/null +++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.src @@ -0,0 +1,183 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "NumberFormatPropertyPanel.hrc" +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include "sc.hrc" +#include "helpids.h" + +Control RID_PROPERTYPANEL_SC_NUMBERFORMAT +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + + Size = MAP_APPFONT( PROPERTYPAGE_WIDTH, PROPERTYPAGE_HEIGHT ); + HelpID = HID_PROPERTYPANEL_SC_NUM_SECTION ; + Text = "Number Format"; + + FixedText FT_CATEGORY + { + Pos = MAP_APPFONT ( FT_CATEGORY_X , FT_CATEGORY_Y ) ; + Size = MAP_APPFONT ( MBOX_WIDTH*4 , TEXT_HEIGHT ) ; + Text [ en-US ] = "~Category:" ; + }; + ListBox LB_CATEGORY + { + Border = TRUE ; + Pos = MAP_APPFONT ( LB_CATEGORY_X , LB_CATEGORY_Y ) ; + Size = MAP_APPFONT ( MBOX_WIDTH *2 , MBOX_HEIGHT ) ; + HelpID = HID_PROPERTY_PANEL_NUMFMT_LB_CATEGORY; + QuickHelpText [ en-US ] = "Select a category of contents."; + TabStop = TRUE ; + DropDown = TRUE ; + StringList [ en-US ] = + { + < "General" ; Default ; > ; + < "Number" ;> ; + < "Percent" ;> ; + < "Currency" ;> ; + < "Date" ;> ; + < "Time" ;> ; + < "Scientific" ;> ; + < "Fraction" ;> ; + < "Boolean Value" ;> ; + < "Text" ;> ; + }; + }; + ToolBox TBX_CATEGORY + { + Pos = MAP_APPFONT ( TBX_CATEGORY_X , TBX_CATEGORY_Y ); + SVLook = TRUE ; + Border = FALSE ; + HelpID = HID_PROPERTY_PANEL_NUMFMT_TBX_CATEGORY; + Text = "Format"; + ItemList = + { + ToolBoxItem + { + Identifier = ID_NUMBER ; + Text [ en-US ] = "Number" ; + HelpID = HID_PROPERTY_PANEL_NUMFMT_ID_NUMBER; + }; + ToolBoxItem + { + Identifier = ID_PERCENT ; + Text [ en-US ] = "Percent" ; + HelpID = HID_PROPERTY_PANEL_NUMFMT_ID_PERCENT; + }; + ToolBoxItem + { + Identifier = ID_CURRENCY ; + Text [ en-US ] = "Currency" ; + HelpID = HID_PROPERTY_PANEL_NUMFMT_ID_CURRENCY; + }; + ToolBoxItem + { + Identifier = ID_DATE ; + Text [ en-US ] = "Date" ; + HelpID = HID_PROPERTY_PANEL_NUMFMT_ID_DATE; + }; + ToolBoxItem + { + Identifier = ID_TEXT ; + Text [ en-US ] = "Text" ; + HelpID = HID_PROPERTY_PANEL_NUMFMT_ID_TEXT; + }; + }; + }; + FixedText FT_DECIMALS + { + Pos = MAP_APPFONT ( FT_DECIMALS_X , FT_DECIMALS_Y ) ; + Size = MAP_APPFONT ( MBOX_WIDTH *2, TEXT_HEIGHT ) ; + Text [ en-US ] = "~Decimal places:" ; + }; + NumericField ED_DECIMALS + { + Border = TRUE ; + Pos = MAP_APPFONT ( LB_DECIMALS_X , LB_DECIMALS_Y ) ; + Size = MAP_APPFONT ( MBOX_WIDTH , MBOX_HEIGHT ) ; + HelpID = HID_PROPERTY_PANEL_NUMFMT_ED_DECIMALS; + QuickHelpText [ en-US ] = "Enter the number of decimal places that you want to display."; + Spin = TRUE ; + Maximum = 20 ; + Last = 15 ; + First = 0 ; + StrictFormat = TRUE ; + SpinSize = 1 ; + Repeat = TRUE ; + }; + FixedText FT_LEADZEROES + { + Pos = MAP_APPFONT ( FT_LEADZEROES_X , FT_LEADZEROES_Y ) ; + Size = MAP_APPFONT (PROPERTYPAGE_WIDTH - MBOX_WIDTH *2 - SECTIONPAGE_MARGIN_HORIZONTAL * 2, TEXT_HEIGHT ) ; // + Text [ en-US ] = "Leading ~zeroes:" ; + }; + NumericField ED_LEADZEROES + { + Border = TRUE ; + Pos = MAP_APPFONT ( LB_LEADZEROES_X , LB_LEADZEROES_Y ) ; + Size = MAP_APPFONT ( MBOX_WIDTH , MBOX_HEIGHT ) ; + HelpID = HID_PROPERTY_PANEL_NUMFMT_ED_LEADZEROES; + QuickHelpText [ en-US ] = "Enter the maximum number of zeroes to display before the decimal point."; + Spin = TRUE ; + Maximum = 20 ; + Last = 15 ; + First = 0 ; + StrictFormat = TRUE ; + SpinSize = 1 ; + Repeat = TRUE ; + }; + CheckBox BTN_NEGRED + { + Pos = MAP_APPFONT ( BTN_NEGRED_X , BTN_NEGRED_Y ) ; + Size = MAP_APPFONT ( 100 , CHECKBOX_HEIGHT ) ; + HelpID = HID_PROPERTY_PANEL_NUMFMT_BTN_NEGRED; + QuickHelpText [ en-US ] = "Changes the font color of negative numbers to red."; + Text [ en-US ] = "~Negative numbers red" ; + }; + CheckBox BTN_THOUSAND + { + Pos = MAP_APPFONT ( BTN_THOUSAND_X , BTN_THOUSAND_Y ) ; + Size = MAP_APPFONT ( 100 , CHECKBOX_HEIGHT ) ; + HelpID = HID_PROPERTY_PANEL_NUMFMT_BTN_THOUSAND; + QuickHelpText [ en-US ] = "Inserts a separator between thousands."; + Text [ en-US ] = "~Thousands separator" ; + }; + Image IMG_NUMBER + { + ImageBitmap = Bitmap{File = "sidebar/123.png";}; + }; + Image IMG_PERCENT + { + ImageBitmap = Bitmap{File = "sidebar/percent.png";}; + }; + Image IMG_CURRENCY + { + ImageBitmap = Bitmap{File = "sidebar/money.png";}; + }; + Image IMG_DATE + { + ImageBitmap = Bitmap{File = "sidebar/canlendar.png";}; + }; + Image IMG_TEXT + { + ImageBitmap = Bitmap{File = "sidebar/ABC.png";}; + }; +}; + +// eof diff --git a/sc/source/ui/sidebar/ScPanelFactory.cxx b/sc/source/ui/sidebar/ScPanelFactory.cxx new file mode 100644 index 000000000000..ce97a8994cf5 --- /dev/null +++ b/sc/source/ui/sidebar/ScPanelFactory.cxx @@ -0,0 +1,168 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "ScPanelFactory.hxx" + +#include <AlignmentPropertyPanel.hxx> +#include <CellAppearancePropertyPanel.hxx> +#include <NumberFormatPropertyPanel.hxx> +#include <navipi.hxx> +#include <dwfunctr.hxx> +#include "sc.hrc" + +#include <sfx2/sidebar/SidebarPanelBase.hxx> +#include <sfx2/sfxbasecontroller.hxx> +#include <toolkit/helper/vclunohelper.hxx> +#include <vcl/window.hxx> +#include <rtl/ref.hxx> +#include <comphelper/namedvaluecollection.hxx> + +#include <boost/bind.hpp> + + +using namespace css; +using namespace cssu; +using ::rtl::OUString; + + +namespace sc { namespace sidebar { + +#define A2S(s) ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)) +#define IMPLEMENTATION_NAME "org.apache.openoffice.comp.sc.sidebar.ScPanelFactory" +#define SERVICE_NAME "com.sun.star.ui.UIElementFactory" + + +::rtl::OUString SAL_CALL ScPanelFactory::getImplementationName (void) +{ + return A2S(IMPLEMENTATION_NAME); +} + + +cssu::Reference<cssu::XInterface> SAL_CALL ScPanelFactory::createInstance( + const uno::Reference<lang::XMultiServiceFactory>& ) +{ + ::rtl::Reference<ScPanelFactory> pPanelFactory (new ScPanelFactory()); + cssu::Reference<cssu::XInterface> xService (static_cast<XWeak*>(pPanelFactory.get()), cssu::UNO_QUERY); + return xService; +} + + +cssu::Sequence<OUString> SAL_CALL ScPanelFactory::getSupportedServiceNames (void) +{ + cssu::Sequence<OUString> aServiceNames (1); + aServiceNames[0] = A2S(SERVICE_NAME); + return aServiceNames; + +} + + +ScPanelFactory::ScPanelFactory (void) + : PanelFactoryInterfaceBase(m_aMutex) +{ +} + + +ScPanelFactory::~ScPanelFactory (void) +{ +} + + +Reference<ui::XUIElement> SAL_CALL ScPanelFactory::createUIElement ( + const ::rtl::OUString& rsResourceURL, + const ::cssu::Sequence<css::beans::PropertyValue>& rArguments) + throw( + container::NoSuchElementException, + lang::IllegalArgumentException, + RuntimeException) +{ + Reference<ui::XUIElement> xElement; + + const ::comphelper::NamedValueCollection aArguments (rArguments); + Reference<frame::XFrame> xFrame (aArguments.getOrDefault("Frame", Reference<frame::XFrame>())); + Reference<awt::XWindow> xParentWindow (aArguments.getOrDefault("ParentWindow", Reference<awt::XWindow>())); + const sal_uInt64 nBindingsValue (aArguments.getOrDefault("SfxBindings", sal_uInt64(0))); + SfxBindings* pBindings = reinterpret_cast<SfxBindings*>(nBindingsValue); + + ::Window* pParentWindow = VCLUnoHelper::GetWindow(xParentWindow); + if ( ! xParentWindow.is() || pParentWindow==NULL) + throw RuntimeException( + A2S("PanelFactory::createUIElement called without ParentWindow"), + NULL); + if ( ! xFrame.is()) + throw RuntimeException( + A2S("PanelFactory::createUIElement called without Frame"), + NULL); + if (pBindings == NULL) + throw RuntimeException( + A2S("PanelFactory::createUIElement called without SfxBindings"), + NULL); + +#define DoesResourceEndWith(s) rsResourceURL.endsWithAsciiL(s,strlen(s)) + if (DoesResourceEndWith("/AlignmentPropertyPanel")) + { + AlignmentPropertyPanel* pPanel = AlignmentPropertyPanel::Create( pParentWindow, xFrame, pBindings ); + xElement = sfx2::sidebar::SidebarPanelBase::Create( + rsResourceURL, + xFrame, + pPanel, + ui::LayoutSize(-1,-1,-1)); + } + else if (DoesResourceEndWith("/CellAppearancePropertyPanel")) + { + CellAppearancePropertyPanel* pPanel = CellAppearancePropertyPanel::Create( pParentWindow, xFrame, pBindings ); + xElement = sfx2::sidebar::SidebarPanelBase::Create( + rsResourceURL, + xFrame, + pPanel, + ui::LayoutSize(-1,-1,-1)); + } + else if (DoesResourceEndWith("/NumberFormatPropertyPanel")) + { + NumberFormatPropertyPanel* pPanel = NumberFormatPropertyPanel::Create( pParentWindow, xFrame, pBindings ); + xElement = sfx2::sidebar::SidebarPanelBase::Create( + rsResourceURL, + xFrame, + pPanel, + ui::LayoutSize(-1,-1,-1)); + } + else if (DoesResourceEndWith("/NavigatorPanel")) + { + Window* pPanel = new ScNavigatorDlg(pBindings, NULL, pParentWindow, false); + xElement = sfx2::sidebar::SidebarPanelBase::Create( + rsResourceURL, + xFrame, + pPanel, + ui::LayoutSize(0,-1,-1)); + } + else if (DoesResourceEndWith("/FunctionsPanel")) + { + Window* pPanel = new ScFunctionDockWin(pBindings, NULL, pParentWindow, ScResId(FID_FUNCTION_BOX)); + xElement = sfx2::sidebar::SidebarPanelBase::Create( + rsResourceURL, + xFrame, + pPanel, + ui::LayoutSize(0,-1,-1)); + } +#undef DoesResourceEndWith + + return xElement; +} + +} } // end of namespace sc::sidebar + +// eof diff --git a/sc/source/ui/unoobj/appluno.cxx b/sc/source/ui/unoobj/appluno.cxx index 3783fb17f98e..2f4263892431 100644 --- a/sc/source/ui/unoobj/appluno.cxx +++ b/sc/source/ui/unoobj/appluno.cxx @@ -38,6 +38,7 @@ #include "unonames.hxx" #include "funcdesc.hxx" #include <com/sun/star/sheet/FunctionArgument.hpp> +#include "ScPanelFactory.hxx" using namespace com::sun::star; @@ -185,154 +186,189 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL sc_component_getFactory( OUString aImpl(OUString::createFromAscii(pImplName)); if ( aImpl == ScSpreadsheetSettings::getImplementationName_Static() ) + { xFactory.set(cppu::createOneInstanceFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScSpreadsheetSettings::getImplementationName_Static(), ScSpreadsheetSettings_CreateInstance, ScSpreadsheetSettings::getSupportedServiceNames_Static() )); - - if ( aImpl == ScRecentFunctionsObj::getImplementationName_Static() ) + } + else if ( aImpl == ScRecentFunctionsObj::getImplementationName_Static() ) + { xFactory.set(cppu::createOneInstanceFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScRecentFunctionsObj::getImplementationName_Static(), ScRecentFunctionsObj_CreateInstance, ScRecentFunctionsObj::getSupportedServiceNames_Static() )); - - if ( aImpl == ScFunctionListObj::getImplementationName_Static() ) + } + else if ( aImpl == ScFunctionListObj::getImplementationName_Static() ) + { xFactory.set(cppu::createOneInstanceFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScFunctionListObj::getImplementationName_Static(), ScFunctionListObj_CreateInstance, ScFunctionListObj::getSupportedServiceNames_Static() )); - - if ( aImpl == ScAutoFormatsObj::getImplementationName_Static() ) + } + else if ( aImpl == ScAutoFormatsObj::getImplementationName_Static() ) + { xFactory.set(cppu::createOneInstanceFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScAutoFormatsObj::getImplementationName_Static(), ScAutoFormatsObj_CreateInstance, ScAutoFormatsObj::getSupportedServiceNames_Static() )); - - if ( aImpl == ScFunctionAccess::getImplementationName_Static() ) + } + else if ( aImpl == ScFunctionAccess::getImplementationName_Static() ) + { xFactory.set(cppu::createOneInstanceFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScFunctionAccess::getImplementationName_Static(), ScFunctionAccess_CreateInstance, ScFunctionAccess::getSupportedServiceNames_Static() )); - - if ( aImpl == ScFilterOptionsObj::getImplementationName_Static() ) + } + else if ( aImpl == ScFilterOptionsObj::getImplementationName_Static() ) + { xFactory.set(cppu::createSingleFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScFilterOptionsObj::getImplementationName_Static(), ScFilterOptionsObj_CreateInstance, ScFilterOptionsObj::getSupportedServiceNames_Static() )); - - if ( aImpl == ScXMLImport_getImplementationName() ) + } + else if ( aImpl == ScXMLImport_getImplementationName() ) + { xFactory.set(cppu::createSingleFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScXMLImport_getImplementationName(), ScXMLImport_createInstance, ScXMLImport_getSupportedServiceNames() )); - - if ( aImpl == ScXMLImport_Meta_getImplementationName() ) + } + else if ( aImpl == ScXMLImport_Meta_getImplementationName() ) + { xFactory.set(cppu::createSingleFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScXMLImport_Meta_getImplementationName(), ScXMLImport_Meta_createInstance, ScXMLImport_Meta_getSupportedServiceNames() )); - - if ( aImpl == ScXMLImport_Styles_getImplementationName() ) + } + else if ( aImpl == ScXMLImport_Styles_getImplementationName() ) + { xFactory.set(cppu::createSingleFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScXMLImport_Styles_getImplementationName(), ScXMLImport_Styles_createInstance, ScXMLImport_Styles_getSupportedServiceNames() )); - - if ( aImpl == ScXMLImport_Content_getImplementationName() ) + } + else if ( aImpl == ScXMLImport_Content_getImplementationName() ) + { xFactory.set(cppu::createSingleFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScXMLImport_Content_getImplementationName(), ScXMLImport_Content_createInstance, ScXMLImport_Content_getSupportedServiceNames() )); - - if ( aImpl == ScXMLImport_Settings_getImplementationName() ) + } + else if ( aImpl == ScXMLImport_Settings_getImplementationName() ) + { xFactory.set(cppu::createSingleFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScXMLImport_Settings_getImplementationName(), ScXMLImport_Settings_createInstance, ScXMLImport_Settings_getSupportedServiceNames() )); - - if ( aImpl == ScXMLOOoExport_getImplementationName() ) + } + else if ( aImpl == ScXMLOOoExport_getImplementationName() ) + { xFactory = cppu::createSingleFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScXMLOOoExport_getImplementationName(), ScXMLOOoExport_createInstance, ScXMLOOoExport_getSupportedServiceNames() ); - - if ( aImpl == ScXMLOOoExport_Meta_getImplementationName() ) + } + else if ( aImpl == ScXMLOOoExport_Meta_getImplementationName() ) + { xFactory = cppu::createSingleFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScXMLOOoExport_Meta_getImplementationName(), ScXMLOOoExport_Meta_createInstance, ScXMLOOoExport_Meta_getSupportedServiceNames() ); - - if ( aImpl == ScXMLOOoExport_Styles_getImplementationName() ) + } + else if ( aImpl == ScXMLOOoExport_Styles_getImplementationName() ) + { xFactory = cppu::createSingleFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScXMLOOoExport_Styles_getImplementationName(), ScXMLOOoExport_Styles_createInstance, ScXMLOOoExport_Styles_getSupportedServiceNames() ); - - if ( aImpl == ScXMLOOoExport_Content_getImplementationName() ) + } + else if ( aImpl == ScXMLOOoExport_Content_getImplementationName() ) + { xFactory = cppu::createSingleFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScXMLOOoExport_Content_getImplementationName(), ScXMLOOoExport_Content_createInstance, ScXMLOOoExport_Content_getSupportedServiceNames() ); - - if ( aImpl == ScXMLOOoExport_Settings_getImplementationName() ) + } + else if ( aImpl == ScXMLOOoExport_Settings_getImplementationName() ) + { xFactory = cppu::createSingleFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScXMLOOoExport_Settings_getImplementationName(), ScXMLOOoExport_Settings_createInstance, ScXMLOOoExport_Settings_getSupportedServiceNames() ); - - if ( aImpl == ScXMLOasisExport_getImplementationName() ) + } + else if ( aImpl == ScXMLOasisExport_getImplementationName() ) + { xFactory = cppu::createSingleFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScXMLOasisExport_getImplementationName(), ScXMLOasisExport_createInstance, ScXMLOasisExport_getSupportedServiceNames() ); - if ( aImpl == ScXMLOasisExport_Meta_getImplementationName() ) + } + else if ( aImpl == ScXMLOasisExport_Meta_getImplementationName() ) + { xFactory = cppu::createSingleFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScXMLOasisExport_Meta_getImplementationName(), ScXMLOasisExport_Meta_createInstance, ScXMLOasisExport_Meta_getSupportedServiceNames() ); - if ( aImpl == ScXMLOasisExport_Styles_getImplementationName() ) + } + else if ( aImpl == ScXMLOasisExport_Styles_getImplementationName() ) + { xFactory = cppu::createSingleFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScXMLOasisExport_Styles_getImplementationName(), ScXMLOasisExport_Styles_createInstance, ScXMLOasisExport_Styles_getSupportedServiceNames() ); - if ( aImpl == ScXMLOasisExport_Content_getImplementationName() ) + } + else if ( aImpl == ScXMLOasisExport_Content_getImplementationName() ) + { xFactory = cppu::createSingleFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScXMLOasisExport_Content_getImplementationName(), ScXMLOasisExport_Content_createInstance, ScXMLOasisExport_Content_getSupportedServiceNames() ); - if ( aImpl == ScXMLOasisExport_Settings_getImplementationName() ) + } + else if ( aImpl == ScXMLOasisExport_Settings_getImplementationName() ) + { xFactory = cppu::createSingleFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScXMLOasisExport_Settings_getImplementationName(), ScXMLOasisExport_Settings_createInstance, ScXMLOasisExport_Settings_getSupportedServiceNames() ); - - if ( aImpl == ScDocument_getImplementationName() ) + } + else if ( aImpl == ScDocument_getImplementationName() ) + { xFactory.set(sfx2::createSfxModelFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScDocument_getImplementationName(), ScDocument_createInstance, ScDocument_getSupportedServiceNames() )); + } + else if ( aImpl == ::sc::sidebar::ScPanelFactory::getImplementationName() ) + { + xFactory = ::cppu::createSingleFactory( + reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), + ::sc::sidebar::ScPanelFactory::getImplementationName(), + ::sc::sidebar::ScPanelFactory::createInstance, + ::sc::sidebar::ScPanelFactory::getSupportedServiceNames() ); + } void* pRet = NULL; if (xFactory.is()) diff --git a/sc/source/ui/view/auditsh.cxx b/sc/source/ui/view/auditsh.cxx index ea6d75cda660..136f15523203 100644 --- a/sc/source/ui/view/auditsh.cxx +++ b/sc/source/ui/view/auditsh.cxx @@ -23,6 +23,7 @@ #include <sfx2/objface.hxx> #include <sfx2/objsh.hxx> #include <sfx2/request.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include "auditsh.hxx" #include "tabvwsh.hxx" @@ -61,6 +62,7 @@ ScAuditingShell::ScAuditingShell(ScViewData* pData) : } SetHelpId( HID_SCSHELL_AUDIT ); SetName(OUString("Auditing")); + SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Auditing)); } //------------------------------------------------------------------------ @@ -137,5 +139,4 @@ void ScAuditingShell::GetState( SfxItemSet& rSet ) rSet.Put( SfxBoolItem( nFunction, sal_True ) ); // aktive Funktion markieren } - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx index 47dc5ed61128..06856778bbf9 100644 --- a/sc/source/ui/view/cellsh.cxx +++ b/sc/source/ui/view/cellsh.cxx @@ -33,7 +33,9 @@ #include <sfx2/objface.hxx> #include <sfx2/request.hxx> #include <sfx2/viewfrm.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include <svx/clipfmtitem.hxx> +#include <svx/sidebar/ContextChangeEventMultiplexer.hxx> #include <editeng/langitem.hxx> #include "cellsh.hxx" @@ -79,6 +81,7 @@ ScCellShell::ScCellShell(ScViewData* pData) : { SetHelpId(HID_SCSHELL_CELLSH); SetName(OUString("Cell")); + SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Cell)); } ScCellShell::~ScCellShell() diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx index cf82d0eb70f9..81c58f6a6401 100644 --- a/sc/source/ui/view/cellsh3.cxx +++ b/sc/source/ui/view/cellsh3.cxx @@ -357,6 +357,14 @@ void ScCellShell::Execute( SfxRequest& rReq ) pTabViewShell->ExecuteCellFormatDlg(rReq, "alignment"); break; + case SID_CELL_FORMAT_BORDER: + pTabViewShell->ExecuteCellFormatDlg( rReq, "borders" ); + break; + + case SID_CHAR_DLG_EFFECT: + pTabViewShell->ExecuteCellFormatDlg( rReq, "fonteffects" ); + break; + case SID_OPENDLG_SOLVE: { sal_uInt16 nId = ScSolverDlgWrapper::GetChildWindowId(); diff --git a/sc/source/ui/view/drawview.cxx b/sc/source/ui/view/drawview.cxx index e249e8c884dc..c664cbde1515 100644 --- a/sc/source/ui/view/drawview.cxx +++ b/sc/source/ui/view/drawview.cxx @@ -177,6 +177,10 @@ void ScDrawView::InvalidateDrawTextAttrs() rBindings.Invalidate( SID_ULINE_VAL_DOTTED ); rBindings.Invalidate( SID_ATTR_CHAR_OVERLINE ); rBindings.Invalidate( SID_ATTR_CHAR_COLOR ); + rBindings.Invalidate( SID_ATTR_PARA_ADJUST_LEFT ); + rBindings.Invalidate( SID_ATTR_PARA_ADJUST_RIGHT ); + rBindings.Invalidate( SID_ATTR_PARA_ADJUST_BLOCK ); + rBindings.Invalidate( SID_ATTR_PARA_ADJUST_CENTER); rBindings.Invalidate( SID_ALIGNLEFT ); rBindings.Invalidate( SID_ALIGNCENTERHOR ); rBindings.Invalidate( SID_ALIGNRIGHT ); @@ -186,6 +190,9 @@ void ScDrawView::InvalidateDrawTextAttrs() rBindings.Invalidate( SID_ATTR_PARA_LINESPACE_20 ); rBindings.Invalidate( SID_SET_SUPER_SCRIPT ); rBindings.Invalidate( SID_SET_SUB_SCRIPT ); + rBindings.Invalidate( SID_ATTR_CHAR_KERNING ); + rBindings.Invalidate( SID_ATTR_CHAR_STRIKEOUT ); + rBindings.Invalidate( SID_ATTR_CHAR_SHADOWED ); rBindings.Invalidate( SID_TEXTDIRECTION_LEFT_TO_RIGHT ); rBindings.Invalidate( SID_TEXTDIRECTION_TOP_TO_BOTTOM ); rBindings.Invalidate( SID_ATTR_PARA_LEFT_TO_RIGHT ); diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx index aade068f089c..fd3418811b5c 100644 --- a/sc/source/ui/view/editsh.cxx +++ b/sc/source/ui/view/editsh.cxx @@ -34,6 +34,7 @@ #include <editeng/flditem.hxx> #include <editeng/fontitem.hxx> #include <svx/hlnkitem.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include <editeng/postitem.hxx> #include <editeng/scripttypeitem.hxx> #include <editeng/shdditem.hxx> @@ -96,6 +97,7 @@ ScEditShell::ScEditShell(EditView* pView, ScViewData* pData) : SetPool( pEditView->GetEditEngine()->GetEmptyItemSet().GetPool() ); SetUndoManager( &pEditView->GetEditEngine()->GetUndoManager() ); SetName(OUString("EditCell")); + SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_EditCell)); } ScEditShell::~ScEditShell() @@ -311,6 +313,17 @@ void ScEditShell::Execute( SfxRequest& rReq ) pTableView->SetSelection(ESelection(0,0,nPar-1,nLen)); if (pTopView) pTopView->SetSelection(ESelection(0,0,nPar-1,nLen)); + rBindings.Invalidate( SID_ATTR_CHAR_FONT ); + rBindings.Invalidate( SID_ATTR_CHAR_FONTHEIGHT ); + rBindings.Invalidate( SID_ATTR_CHAR_WEIGHT ); + rBindings.Invalidate( SID_ATTR_CHAR_POSTURE ); + rBindings.Invalidate( SID_ATTR_CHAR_UNDERLINE ); + rBindings.Invalidate( SID_ATTR_CHAR_STRIKEOUT ); + rBindings.Invalidate( SID_ATTR_CHAR_SHADOWED ); + rBindings.Invalidate( SID_ATTR_CHAR_KERNING ); + rBindings.Invalidate( SID_ATTR_CHAR_COLOR ); + rBindings.Invalidate( SID_SET_SUPER_SCRIPT ); + rBindings.Invalidate( SID_SET_SUB_SCRIPT ); } bSetModified = sal_False; } @@ -434,6 +447,7 @@ void ScEditShell::Execute( SfxRequest& rReq ) } break; + case SID_CHAR_DLG_EFFECT: case SID_CHAR_DLG: { SfxItemSet aAttrs( pTableView->GetAttribs() ); @@ -446,6 +460,10 @@ void ScEditShell::Execute( SfxRequest& rReq ) SfxAbstractTabDialog* pDlg = pFact->CreateScCharDlg( pViewData->GetDialogParent(), &aAttrs, pObjSh, RID_SCDLG_CHAR ); OSL_ENSURE(pDlg, "Dialog create fail!"); + if (nSlot == SID_CHAR_DLG_EFFECT) + { + pDlg->SetCurPageId(RID_SVXPAGE_CHAR_EFFECTS); + } short nRet = pDlg->Execute(); // pDlg is needed below @@ -987,6 +1005,15 @@ void ScEditShell::ExecuteAttr(SfxRequest& rReq) rBindings.Invalidate( nSlot ); } break; + case SID_ATTR_CHAR_KERNING: + { + if(pArgs) + { + aSet.Put ( pArgs->Get(pArgs->GetPool()->GetWhich(nSlot))); + rBindings.Invalidate( nSlot ); + } + } + break; } // @@ -1073,6 +1100,27 @@ void ScEditShell::GetAttrState(SfxItemSet &rSet) ScInputHandler* pHdl = GetMyInputHdl(); if ( pHdl && pHdl->IsFormulaMode() ) rSet.ClearItem( EE_CHAR_WEIGHT ); // hervorgehobene Klammern hier nicht + + SvxEscapement eEsc = (SvxEscapement) ( (const SvxEscapementItem&) + aAttribs.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue(); + if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT ) + { + rSet.Put( SfxBoolItem( SID_SET_SUPER_SCRIPT, sal_True ) ); + } + else if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT ) + { + rSet.Put( SfxBoolItem( SID_SET_SUB_SCRIPT, sal_True ) ); + } + pViewData->GetBindings().Invalidate( SID_SET_SUPER_SCRIPT ); + pViewData->GetBindings().Invalidate( SID_SET_SUB_SCRIPT ); + + eState = aAttribs.GetItemState( EE_CHAR_KERNING, sal_True ); + pViewData->GetBindings().Invalidate( SID_ATTR_CHAR_KERNING ); + if ( eState == SFX_ITEM_DONTCARE ) + { + // rSet.InvalidateItem( SID_ATTR_CHAR_KERNING ); + rSet.InvalidateItem(EE_CHAR_KERNING); + } } String ScEditShell::GetSelectionText( sal_Bool bWholeWord ) diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index 656f6080be47..398075107cd2 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -22,6 +22,7 @@ #include <com/sun/star/container/XNameAccess.hpp> #include "scitems.hxx" +#include <editeng/borderline.hxx> #include <editeng/eeitem.hxx> #include <sfx2/app.hxx> @@ -1016,13 +1017,96 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq ) break; case SID_NUMBER_FORMAT: - if ( pReqArgs ) + //if ( pReqArgs ) + //{ + // const SfxPoolItem* pItem; + // if(pReqArgs->GetItemState(nSlot, sal_True, &pItem) == SFX_ITEM_SET) + // { + // String aCode = ((const SfxStringItem*)pItem)->GetValue(); + // pTabViewShell->SetNumFmtByStr( aCode ); + // } + //} + + // symphony version with format interpretation + if(pReqArgs) { const SfxPoolItem* pItem; - if(pReqArgs->GetItemState(nSlot, sal_True, &pItem) == SFX_ITEM_SET) + ScDocument* pDoc = pViewData->GetDocument(); + SvNumberFormatter* pFormatter = pDoc->GetFormatTable(); + LanguageType eLanguage = ScGlobal::eLnge; + sal_Int16 eType = -1; + sal_uInt32 nCurrentNumberFormat; + + pDoc->GetNumberFormat(pViewData->GetCurX(), pViewData->GetCurY(), pViewData->GetTabNo(), nCurrentNumberFormat); + const SvNumberformat* pEntry = pFormatter->GetEntry(nCurrentNumberFormat); + + if(pEntry) + { + eLanguage = pEntry->GetLanguage(); + eType = pEntry->GetType(); + } + + //Just use eType to judge whether the command is fired for NUMBER/PERCENT/CURRENCY + //In sidebar, users can fire SID_NUMBER_FORMAT command by operating the related UI controls before they are disable + switch(eType) + { + case NUMBERFORMAT_ALL: + case NUMBERFORMAT_NUMBER: + case NUMBERFORMAT_NUMBER| NUMBERFORMAT_DEFINED: + case NUMBERFORMAT_PERCENT: + case NUMBERFORMAT_PERCENT| NUMBERFORMAT_DEFINED: + case NUMBERFORMAT_CURRENCY: + case NUMBERFORMAT_CURRENCY|NUMBERFORMAT_DEFINED: + eType = 0; + break; + default: + eType =-1; + } + + if(SFX_ITEM_SET == pReqArgs->GetItemState(nSlot, true, &pItem) && eType != -1) { String aCode = ((const SfxStringItem*)pItem)->GetValue(); - pTabViewShell->SetNumFmtByStr( aCode ); + sal_uInt16 aLen = aCode.Len(); + String* sFormat = new String[4]; + String sTmpStr = OUString(); + sal_uInt16 nCount(0); + sal_uInt16 nStrCount(0); + + while(nCount < aLen) + { + sal_Unicode cChar = aCode.GetChar(nCount); + + if(cChar == sal_Unicode(',')) + { + sFormat[nStrCount] = sTmpStr; + sTmpStr = OUString(); + nStrCount++; + } + else + { + sTmpStr += cChar; + } + + nCount++; + + if(nStrCount > 3) + break; + } + + const sal_Bool bThousand = (sal_Bool)sFormat[0].ToInt32(); + const sal_Bool bNegRed = (sal_Bool)sFormat[1].ToInt32(); + const sal_uInt16 nPrecision = (sal_uInt16)sFormat[2].ToInt32(); + const sal_uInt16 nLeadZeroes = (sal_uInt16)sFormat[3].ToInt32(); + + aCode = pFormatter->GenerateFormat( + nCurrentNumberFormat,//modify + eLanguage, + bThousand, + bNegRed, + nPrecision, + nLeadZeroes); + pTabViewShell->SetNumFmtByStr(aCode); + delete[] sFormat; } } break; @@ -1046,6 +1130,49 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq ) } break; + case SID_NUMBER_TYPE_FORMAT: + { + SfxInt16Item aFormatItem((const SfxInt16Item&)rReq.GetArgs()->Get(nSlot)); + sal_uInt16 nFormat = aFormatItem.GetValue(); + switch(nFormat) + { + case 0: + pTabViewShell->SetNumberFormat( NUMBERFORMAT_NUMBER); //Modify + break; + case 1: + pTabViewShell->SetNumberFormat( NUMBERFORMAT_NUMBER, 2 ); //Modify + break; + case 2: + pTabViewShell->SetNumberFormat( NUMBERFORMAT_PERCENT ); + break; + case 3: + pTabViewShell->SetNumberFormat( NUMBERFORMAT_CURRENCY ); + break; + case 4: + pTabViewShell->SetNumberFormat( NUMBERFORMAT_DATE ); + break; + case 5: + pTabViewShell->SetNumberFormat( NUMBERFORMAT_TIME ); + break; + case 6: + pTabViewShell->SetNumberFormat( NUMBERFORMAT_SCIENTIFIC ); + break; + case 7: + pTabViewShell->SetNumberFormat( NUMBERFORMAT_FRACTION ); + break; + case 8: + pTabViewShell->SetNumberFormat( NUMBERFORMAT_LOGICAL ); + break; + case 9: + pTabViewShell->SetNumberFormat( NUMBERFORMAT_TEXT ); + break; + default: + ; + } + rReq.Done(); + } + break; + default: OSL_FAIL("falscher Slot bei ExecuteEdit"); break; @@ -1119,7 +1246,10 @@ void ScFormatShell::ExecuteAlignment( SfxRequest& rReq ) } } } - + rBindings.Invalidate( SID_ATTR_PARA_ADJUST_LEFT ); + rBindings.Invalidate( SID_ATTR_PARA_ADJUST_RIGHT ); + rBindings.Invalidate( SID_ATTR_PARA_ADJUST_BLOCK ); + rBindings.Invalidate( SID_ATTR_PARA_ADJUST_CENTER); rBindings.Invalidate( SID_ALIGNLEFT ); rBindings.Invalidate( SID_ALIGNRIGHT ); rBindings.Invalidate( SID_ALIGNCENTERHOR ); @@ -1647,6 +1777,43 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq ) } break; + case SID_ATTR_BORDER_DIAG_TLBR: + case SID_ATTR_BORDER_DIAG_BLTR: + { + const ScPatternAttr* pOldAttrs = pTabViewShell->GetSelectionPattern(); + SfxItemSet* pOldSet = new SfxItemSet(pOldAttrs->GetItemSet()); + SfxItemSet* pNewSet = new SfxItemSet(pOldAttrs->GetItemSet()); + const SfxPoolItem* pItem = 0; + + if(SID_ATTR_BORDER_DIAG_TLBR == nSlot) + { + if(SFX_ITEM_SET == pNewAttrs->GetItemState(ATTR_BORDER_TLBR, true, &pItem)) + { + SvxLineItem aItem(ATTR_BORDER_TLBR); + aItem.SetLine(((const SvxLineItem&)pNewAttrs->Get(ATTR_BORDER_TLBR)).GetLine()); + pNewSet->Put(aItem); + rReq.AppendItem(aItem); + pTabViewShell->ApplyAttributes(pNewSet, pOldSet); + } + } + else // if( nSlot == SID_ATTR_BORDER_DIAG_BLTR ) + { + if(SFX_ITEM_SET == pNewAttrs->GetItemState(ATTR_BORDER_BLTR, true, &pItem )) + { + SvxLineItem aItem(ATTR_BORDER_BLTR); + aItem.SetLine(((const SvxLineItem&)pNewAttrs->Get(ATTR_BORDER_BLTR)).GetLine()); + pNewSet->Put(aItem); + rReq.AppendItem(aItem); + pTabViewShell->ApplyAttributes(pNewSet, pOldSet); + } + } + + delete pOldSet; + delete pNewSet; + rBindings.Invalidate(nSlot); + } + break; + // ATTR_BACKGROUND (=SID_ATTR_BRUSH) muss ueber zwei IDs // gesetzt werden: case SID_BACKGROUND_COLOR: @@ -1698,7 +1865,7 @@ void ScFormatShell::GetAttrState( SfxItemSet& rSet ) { ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet(); - const ::editeng::SvxBorderLine* pLine = pTabViewShell->GetDefaultFrameLine(); + //const ::editeng::SvxBorderLine* pLine = pTabViewShell->GetDefaultFrameLine(); const SvxBrushItem& rBrushItem = (const SvxBrushItem&)rAttrSet.Get( ATTR_BACKGROUND ); SfxWhichIter aIter( rSet ); sal_uInt16 nWhich = aIter.FirstWhich(); @@ -1725,11 +1892,175 @@ void ScFormatShell::GetAttrState( SfxItemSet& rSet ) case SID_BACKGROUND_COLOR: { rSet.Put( SvxColorItem( rBrushItem.GetColor(), SID_BACKGROUND_COLOR ) ); + + if(SFX_ITEM_DONTCARE == rAttrSet.GetItemState(ATTR_BACKGROUND)) + { + rSet.InvalidateItem(SID_BACKGROUND_COLOR); + } } break; + case SID_FRAME_LINESTYLE: case SID_FRAME_LINECOLOR: { - rSet.Put( SvxColorItem( pLine ? pLine->GetColor() : Color(), SID_FRAME_LINECOLOR ) ); + // handled together because both need the cell border information for decisions + // rSet.Put( SvxColorItem( pLine ? pLine->GetColor() : Color(), SID_FRAME_LINECOLOR ) ); + Color aCol = 0; + editeng::SvxBorderLine aLine(0,0,0,0); + bool bCol = 0; + bool bColDisable = 0, bStyleDisable = 0; + SvxBoxItem aBoxItem(ATTR_BORDER); + SvxBoxInfoItem aInfoItem(ATTR_BORDER_INNER); + + pTabViewShell->GetSelectionFrame(aBoxItem, aInfoItem); + + if( aBoxItem.GetTop() ) + { + bCol = 1; + aCol = aBoxItem.GetTop()->GetColor() ; + aLine.SetColor(aCol); + aLine.SetWidth( aBoxItem.GetTop()->GetWidth()); + aLine.SetBorderLineStyle( aBoxItem.GetTop()->GetBorderLineStyle()); + } + + if( aBoxItem.GetBottom() ) + { + if(bCol == 0) + { + bCol = 1; + aCol = aBoxItem.GetBottom()->GetColor() ; + aLine.SetColor(aCol); + aLine.SetWidth( aBoxItem.GetBottom()->GetWidth()); + aLine.SetBorderLineStyle( aBoxItem.GetBottom()->GetBorderLineStyle()); + } + else + { + if(aCol != aBoxItem.GetBottom()->GetColor() ) + bColDisable = 1; + if(!( aLine == *(aBoxItem.GetBottom())) ) + bStyleDisable = 1; + } + } + + if( aBoxItem.GetLeft() ) + { + if(bCol == 0) + { + bCol = 1; + aCol = aBoxItem.GetLeft()->GetColor() ; + aLine.SetColor(aCol); + aLine.SetWidth( aBoxItem.GetLeft()->GetWidth()); + aLine.SetBorderLineStyle( aBoxItem.GetLeft()->GetBorderLineStyle()); + } + else + { + if(aCol != aBoxItem.GetLeft()->GetColor() ) + bColDisable = 1; + if(!( aLine == *(aBoxItem.GetLeft())) ) + bStyleDisable = 1; + } + } + + if( aBoxItem.GetRight() ) + { + if(bCol == 0) + { + bCol = 1; + aCol = aBoxItem.GetRight()->GetColor() ; + aLine.SetColor(aCol); + aLine.SetWidth( aBoxItem.GetRight()->GetWidth()); + aLine.SetBorderLineStyle( aBoxItem.GetRight()->GetBorderLineStyle()); + } + else + { + if(aCol != aBoxItem.GetRight()->GetColor() ) + bColDisable = 1; + if(!( aLine == *(aBoxItem.GetRight())) ) + bStyleDisable = 1; + } + } + + if( aInfoItem.GetVert()) + { + if(bCol == 0) + { + bCol = 1; + aCol = aInfoItem.GetVert()->GetColor() ; + aLine.SetColor(aCol); + aLine.SetWidth( aInfoItem.GetVert()->GetWidth()); + aLine.SetBorderLineStyle( aInfoItem.GetVert()->GetBorderLineStyle()); + } + else + { + if(aCol != aInfoItem.GetVert()->GetColor() ) + bColDisable = 1; + if(!( aLine == *(aInfoItem.GetVert())) ) + bStyleDisable = 1; + } + } + + if( aInfoItem.GetHori()) + { + if(bCol == 0) + { + bCol = 1; + aCol = aInfoItem.GetHori()->GetColor() ; + aLine.SetColor(aCol); + aLine.SetWidth( aInfoItem.GetHori()->GetWidth()); + aLine.SetBorderLineStyle( aInfoItem.GetHori()->GetBorderLineStyle()); + } + else + { + if(aCol != aInfoItem.GetHori()->GetColor() ) + bColDisable = 1; + if(!( aLine == *(aInfoItem.GetHori())) ) + bStyleDisable = 1; + } + } + + if( !aInfoItem.IsValid( VALID_VERT ) + || !aInfoItem.IsValid( VALID_HORI ) + || !aInfoItem.IsValid( VALID_LEFT ) + || !aInfoItem.IsValid( VALID_RIGHT ) + || !aInfoItem.IsValid( VALID_TOP ) + || !aInfoItem.IsValid( VALID_BOTTOM ) ) + { + bColDisable = 1; + bStyleDisable = 1; + } + + if(SID_FRAME_LINECOLOR == nWhich) + { + if(bColDisable) // if different lines have differernt colors + { + aCol = COL_TRANSPARENT; + rSet.Put( SvxColorItem(aCol, SID_FRAME_LINECOLOR ) ); + rSet.InvalidateItem(SID_FRAME_LINECOLOR); + } + else if( bCol == 0 && bColDisable == 0) // if no line available + { + aCol = COL_AUTO; + rSet.Put( SvxColorItem(aCol, SID_FRAME_LINECOLOR ) ); + } + else + rSet.Put( SvxColorItem(aCol, SID_FRAME_LINECOLOR ) ); + } + else // if( nWhich == SID_FRAME_LINESTYLE) + { + if(bStyleDisable) // if have several lines but don't have same style + { + aLine.SetWidth( 1 ); + SvxLineItem aItem(SID_FRAME_LINESTYLE); + aItem.SetLine(&aLine); + rSet.Put( aItem ); + rSet.InvalidateItem(SID_FRAME_LINESTYLE); + } + else // all the lines have same style or no line availavle, use initial value (0,0,0,0) + { + SvxLineItem aItem(SID_FRAME_LINESTYLE); + aItem.SetLine(&aLine); + rSet.Put( aItem ); + } + } } break; case SID_ATTR_BRUSH: @@ -1740,6 +2071,13 @@ void ScFormatShell::GetAttrState( SfxItemSet& rSet ) } nWhich = aIter.NextWhich(); } + + if(nWhich) + { + // stuff for sidebar panels + Invalidate(SID_ATTR_ALIGN_DEGREES); + Invalidate(SID_ATTR_ALIGN_STACKED); + } } //------------------------------------------------------------------ @@ -2013,22 +2351,139 @@ void ScFormatShell::GetNumFormatState( SfxItemSet& rSet ) switch ( nWhich ) { case SID_NUMBER_FORMAT: + //{ + // String aFormatCode; // bleibt leer, wenn dont-care + // + // const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet(); + // if ( rAttrSet.GetItemState( ATTR_VALUE_FORMAT ) != SFX_ITEM_DONTCARE ) + // { + // sal_uLong nNumberFormat = ((const SfxUInt32Item&)rAttrSet.Get( + // ATTR_VALUE_FORMAT )).GetValue(); + // + // SvNumberFormatter* pFormatter = pDoc->GetFormatTable(); + // const SvNumberformat* pFormatEntry = pFormatter->GetEntry( nNumberFormat ); + // if ( pFormatEntry ) + // aFormatCode = pFormatEntry->GetFormatstring(); + // } + // + // rSet.Put( SfxStringItem( nWhich, aFormatCode ) ); + //} + + // symphony version with format interpretation { - String aFormatCode; // bleibt leer, wenn dont-care + const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet(); - const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet(); - if ( rAttrSet.GetItemState( ATTR_VALUE_FORMAT ) != SFX_ITEM_DONTCARE ) + if(SFX_ITEM_DONTCARE != rAttrSet.GetItemState(ATTR_VALUE_FORMAT)) { - sal_uLong nNumberFormat = ((const SfxUInt32Item&)rAttrSet.Get( - ATTR_VALUE_FORMAT )).GetValue(); + SvNumberFormatter* pFormatter = pDoc->GetFormatTable(); + sal_uInt32 nNumberFormat = ((const SfxUInt32Item&)rAttrSet.Get(ATTR_VALUE_FORMAT)).GetValue(); + bool bThousand(false); + bool bNegRed(false); + sal_uInt16 nPrecision(0); + sal_uInt16 nLeadZeroes(0); + + pFormatter->GetFormatSpecialInfo(nNumberFormat,bThousand, bNegRed, nPrecision, nLeadZeroes); + String aFormat; + static String sBreak = OUString(","); + const String sThousand = OUString::number(static_cast<sal_Int32>(bThousand)); + const String sNegRed = OUString::number(static_cast<sal_Int32>(bNegRed)); + const String sPrecision = OUString::number(nPrecision); + const String sLeadZeroes = OUString::number(nLeadZeroes); + + aFormat += sThousand; + aFormat += sBreak; + aFormat += sNegRed; + aFormat += sBreak; + aFormat += sPrecision; + aFormat += sBreak; + aFormat += sLeadZeroes; + aFormat += sBreak; + + rSet.Put(SfxStringItem(nWhich, aFormat)); + } + else + { + rSet.InvalidateItem( nWhich ); + } + } + break; + case SID_NUMBER_TYPE_FORMAT: + { + sal_Int16 aFormatCode = -1; + const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet(); + if ( rAttrSet.GetItemState( ATTR_VALUE_FORMAT ) >= SFX_ITEM_AVAILABLE ) //Modify for more robust + { SvNumberFormatter* pFormatter = pDoc->GetFormatTable(); + sal_uInt32 nNumberFormat = pTabViewShell->GetSelectionPattern()->GetNumberFormat( pFormatter ); const SvNumberformat* pFormatEntry = pFormatter->GetEntry( nNumberFormat ); + bool bStandard = false; + if ( pFormatEntry ) - aFormatCode = pFormatEntry->GetFormatstring(); + { + aFormatCode = pFormatEntry->GetType(); + bStandard = pFormatEntry->IsStandard(); + } + + switch(aFormatCode) + { + case NUMBERFORMAT_NUMBER: + case NUMBERFORMAT_NUMBER| NUMBERFORMAT_DEFINED: + //use format code and standard format code to judge whether it is General, + //if (nNumberFormat == nStandardNumberFormat) + if (bStandard) + aFormatCode = 0; + else + aFormatCode = 1; + break; + case NUMBERFORMAT_PERCENT: + case NUMBERFORMAT_PERCENT| NUMBERFORMAT_DEFINED: + aFormatCode = 2; + break; + case NUMBERFORMAT_CURRENCY: + case NUMBERFORMAT_CURRENCY| NUMBERFORMAT_DEFINED: + aFormatCode = 3; + break; + case NUMBERFORMAT_DATE: + case NUMBERFORMAT_DATE| NUMBERFORMAT_DEFINED: + //Add + case NUMBERFORMAT_DATETIME: + case NUMBERFORMAT_DATETIME | NUMBERFORMAT_DEFINED: + aFormatCode = 4; + break; + case NUMBERFORMAT_TIME: + case NUMBERFORMAT_TIME| NUMBERFORMAT_DEFINED: + aFormatCode = 5; + break; + case NUMBERFORMAT_SCIENTIFIC: + case NUMBERFORMAT_SCIENTIFIC| NUMBERFORMAT_DEFINED: + aFormatCode = 6; + break; + case NUMBERFORMAT_FRACTION: + case NUMBERFORMAT_FRACTION| NUMBERFORMAT_DEFINED: + aFormatCode = 7; + break; + case NUMBERFORMAT_LOGICAL: + case NUMBERFORMAT_LOGICAL| NUMBERFORMAT_DEFINED: + aFormatCode = 8; + break; + case NUMBERFORMAT_TEXT: + case NUMBERFORMAT_TEXT| NUMBERFORMAT_DEFINED: + aFormatCode = 9; + break; + default: + aFormatCode = -1; //for more roburst + } + if( aFormatCode == -1 ) + rSet.InvalidateItem( nWhich ); + else + rSet.Put( SfxInt16Item( nWhich, aFormatCode ) ); + } + else + { + rSet.InvalidateItem( nWhich ); } - rSet.Put( SfxStringItem( nWhich, aFormatCode ) ); } break; case SID_NUMBER_SCIENTIFIC: @@ -2323,4 +2778,52 @@ short ScFormatShell::GetCurrentNumberFormatType() return nType; } +void ScFormatShell::ExecViewOptions( SfxRequest& rReq ) +{ + ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); + SfxBindings& rBindings = pViewData->GetBindings(); + const SfxItemSet* pNewAttrs = rReq.GetArgs(); + + if ( pNewAttrs ) + { + sal_uInt16 nSlot = rReq.GetSlot(); + + if( nSlot == SID_SCGRIDSHOW) + { + + ScViewData* pLclViewData = pTabViewShell->GetViewData(); + const ScViewOptions& rOldOpt = pLclViewData->GetOptions(); + ScDocShell* pDocSh = PTR_CAST(ScDocShell, SfxObjectShell::Current()); + bool bState = ((const SfxBoolItem &)pNewAttrs->Get( pNewAttrs->GetPool()->GetWhich( nSlot ) )).GetValue(); + + if ( (bool)rOldOpt.GetOption( VOPT_GRID ) != bState) + { + ScViewOptions rNewOpt(rOldOpt); + rNewOpt.SetOption( VOPT_GRID, bState); + pLclViewData->SetOptions( rNewOpt ); + pLclViewData->GetDocument()->SetViewOptions( rNewOpt ); + pDocSh->SetDocumentModified(); + //add , write the change to sc view config + ScModule* pScMod = SC_MOD(); + pScMod->SetViewOptions( rNewOpt ); + //add end + rBindings.Invalidate( nSlot ); + } + } + } + +} + +void ScFormatShell::GetViewOptions( SfxItemSet& rSet ) +{ + ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); + if( pTabViewShell ) + { + ScViewOptions aViewOpt = pTabViewShell->GetViewData()->GetOptions(); + rSet.ClearItem(SID_SCGRIDSHOW); + SfxBoolItem aItem( SID_SCGRIDSHOW, aViewOpt.GetOption( VOPT_GRID ) ); + rSet.Put(aItem); + } +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 86cddf2526c9..4a5c9b522947 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -2038,7 +2038,20 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) } if (DrawMouseButtonUp(rMEvt)) // includes format paint brush handling for drawing objects + { + ScTabViewShell* pViewShell = pViewData->GetViewShell(); + SfxBindings& rFrmBindings=pViewShell->GetViewFrame()->GetBindings(); + rFrmBindings.Invalidate(SID_ATTR_TRANSFORM_WIDTH); + rFrmBindings.Invalidate(SID_ATTR_TRANSFORM_HEIGHT); + rFrmBindings.Invalidate(SID_ATTR_TRANSFORM_POS_X); + rFrmBindings.Invalidate(SID_ATTR_TRANSFORM_POS_Y); + rFrmBindings.Invalidate(SID_ATTR_TRANSFORM_ANGLE); + rFrmBindings.Invalidate(SID_ATTR_TRANSFORM_ROT_X); + rFrmBindings.Invalidate(SID_ATTR_TRANSFORM_ROT_Y); + rFrmBindings.Invalidate(SID_ATTR_TRANSFORM_AUTOWIDTH); + rFrmBindings.Invalidate(SID_ATTR_TRANSFORM_AUTOHEIGHT); return; + } rMark.SetMarking(false); @@ -3245,7 +3258,20 @@ void ScGridWindow::KeyInput(const KeyEvent& rKEvt) return; if (DrawKeyInput(rKEvt)) + { + const KeyCode& rLclKeyCode = rKEvt.GetKeyCode(); + if (rLclKeyCode.GetCode() == KEY_DOWN + || rLclKeyCode.GetCode() == KEY_UP + || rLclKeyCode.GetCode() == KEY_LEFT + || rLclKeyCode.GetCode() == KEY_RIGHT) + { + ScTabViewShell* pViewShell = pViewData->GetViewShell(); + SfxBindings& rBindings = pViewShell->GetViewFrame()->GetBindings(); + rBindings.Invalidate(SID_ATTR_TRANSFORM_POS_X); + rBindings.Invalidate(SID_ATTR_TRANSFORM_POS_Y); + } return; + } if (!pViewData->GetView()->IsDrawSelMode() && !DrawHasMarkedObj()) // keine Eingaben im Zeichenmodus { //! DrawShell abfragen !!! diff --git a/sc/source/ui/view/pivotsh.cxx b/sc/source/ui/view/pivotsh.cxx index 57a7b56ad33d..40f278699022 100644 --- a/sc/source/ui/view/pivotsh.cxx +++ b/sc/source/ui/view/pivotsh.cxx @@ -25,6 +25,7 @@ #include <sfx2/request.hxx> #include <svl/whiter.hxx> #include <vcl/msgbox.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include "sc.hrc" #include "pivotsh.hxx" @@ -68,6 +69,7 @@ ScPivotShell::ScPivotShell( ScTabViewShell* pViewSh ) : } SetHelpId( HID_SCSHELL_PIVOTSH ); SetName(OUString("Pivot")); + SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Pivot)); } //------------------------------------------------------------------------ diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index 0124f6a0f795..30750750a697 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -212,6 +212,18 @@ void ScTabView::InvalidateAttribs() rBindings.Invalidate( SID_ATTR_CHAR_OVERLINE ); + rBindings.Invalidate( SID_ATTR_CHAR_KERNING ); + rBindings.Invalidate( SID_SET_SUPER_SCRIPT ); + rBindings.Invalidate( SID_SET_SUB_SCRIPT ); + rBindings.Invalidate( SID_ATTR_CHAR_STRIKEOUT ); + rBindings.Invalidate( SID_ATTR_CHAR_SHADOWED ); + + rBindings.Invalidate( SID_ATTR_PARA_ADJUST_LEFT ); + rBindings.Invalidate( SID_ATTR_PARA_ADJUST_RIGHT ); + rBindings.Invalidate( SID_ATTR_PARA_ADJUST_BLOCK ); + rBindings.Invalidate( SID_ATTR_PARA_ADJUST_CENTER); + rBindings.Invalidate( SID_NUMBER_TYPE_FORMAT); + rBindings.Invalidate( SID_ALIGNLEFT ); rBindings.Invalidate( SID_ALIGNRIGHT ); rBindings.Invalidate( SID_ALIGNBLOCK ); @@ -221,6 +233,21 @@ void ScTabView::InvalidateAttribs() rBindings.Invalidate( SID_ALIGNBOTTOM ); rBindings.Invalidate( SID_ALIGNCENTERVER ); + // stuff for sidebar panels + { + rBindings.Invalidate( SID_H_ALIGNCELL ); + rBindings.Invalidate( SID_V_ALIGNCELL ); + rBindings.Invalidate( SID_ATTR_ALIGN_INDENT ); + rBindings.Invalidate( SID_FRAME_LINECOLOR ); + rBindings.Invalidate( SID_FRAME_LINESTYLE ); + rBindings.Invalidate( SID_ATTR_BORDER_OUTER ); + rBindings.Invalidate( SID_ATTR_BORDER_INNER ); + rBindings.Invalidate( SID_SCGRIDSHOW ); + rBindings.Invalidate( SID_ATTR_BORDER_DIAG_TLBR ); + rBindings.Invalidate( SID_ATTR_BORDER_DIAG_BLTR ); + rBindings.Invalidate( SID_NUMBER_TYPE_FORMAT ); + } + rBindings.Invalidate( SID_BACKGROUND_COLOR ); rBindings.Invalidate( SID_ATTR_ALIGN_LINEBREAK ); diff --git a/sc/source/ui/view/tabvwsh.cxx b/sc/source/ui/view/tabvwsh.cxx index f4d277fac4e2..537499b528ee 100644 --- a/sc/source/ui/view/tabvwsh.cxx +++ b/sc/source/ui/view/tabvwsh.cxx @@ -27,6 +27,7 @@ #include <sfx2/bindings.hxx> #include <sfx2/app.hxx> #include <sfx2/infobar.hxx> +#include <sfx2/sidebar/SidebarChildWindow.hxx> #include "tabvwsh.hxx" #include "docsh.hxx" @@ -54,6 +55,7 @@ SFX_IMPL_INTERFACE(ScTabViewShell,SfxViewShell,ScResId(SCSTR_TABVIEWSHELL)) SFX_CHILDWINDOW_REGISTRATION(SfxInfoBarContainerChild::GetChildWindowId()); SFX_CHILDWINDOW_CONTEXT_REGISTRATION(SID_NAVIGATOR); SFX_CHILDWINDOW_REGISTRATION(SID_TASKPANE); + SFX_CHILDWINDOW_REGISTRATION(::sfx2::sidebar::SidebarChildWindow::GetChildWindowId()); SFX_CHILDWINDOW_REGISTRATION(ScNameDlgWrapper::GetChildWindowId()); SFX_CHILDWINDOW_REGISTRATION(ScNameDefDlgWrapper::GetChildWindowId()); SFX_CHILDWINDOW_REGISTRATION(ScSolverDlgWrapper::GetChildWindowId()); diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index ecc73952b53a..377546fb9120 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -27,6 +27,7 @@ #include <svx/fmshell.hxx> #include <editeng/sizeitem.hxx> #include <svx/prtqry.hxx> +#include <svx/sidebar/ContextChangeEventMultiplexer.hxx> #include <sfx2/request.hxx> #include <sfx2/printer.hxx> #include <sfx2/dispatch.hxx> @@ -212,6 +213,10 @@ void ScTabViewShell::Activate(sal_Bool bMDI) // Wenn Referenzeingabe-Tip-Hilfe hier wieder angezeigt werden soll (ShowRefTip), // muss sie beim Verschieben der View angepasst werden (gibt sonst Probleme unter OS/2 // beim Umschalten zwischen Dokumenten) + + ContextChangeEventMultiplexer::NotifyContextChange( + GetController(), + ::sfx2::sidebar::EnumContext::Context_Default); } void ScTabViewShell::Deactivate(sal_Bool bMDI) diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index 49f8533a482f..e114c99bfbb2 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -2758,6 +2758,11 @@ void ScViewFunc::ChangeIndent( sal_Bool bIncrement ) { pDocSh->UpdateOle(pViewData); StartFormatArea(); + + // stuff for sidebar panels + SfxBindings& rBindings = GetViewData()->GetBindings(); + rBindings.Invalidate( SID_H_ALIGNCELL ); + rBindings.Invalidate( SID_ATTR_ALIGN_INDENT ); } } diff --git a/sc/uiconfig/scalc/menubar/menubar.xml b/sc/uiconfig/scalc/menubar/menubar.xml index e461fce444db..ca8d8ba943c5 100644 --- a/sc/uiconfig/scalc/menubar/menubar.xml +++ b/sc/uiconfig/scalc/menubar/menubar.xml @@ -140,6 +140,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/sc/util/sc.component b/sc/util/sc.component index beedd198c9c5..9d58d6a350b7 100644 --- a/sc/util/sc.component +++ b/sc/util/sc.component @@ -85,4 +85,7 @@ <implementation name="stardiv.StarCalc.ScSpreadsheetSettings"> <service name="com.sun.star.sheet.GlobalSheetSettings"/> </implementation> + <implementation name="org.apache.openoffice.comp.sc.sidebar.ScPanelFactory"> + <service name="com.sun.star.ui.UIElementFactory"/> + </implementation> </component> diff --git a/sd/Library_sd.mk b/sd/Library_sd.mk index 2efd42acdff5..6c57b4b76157 100644 --- a/sd/Library_sd.mk +++ b/sd/Library_sd.mk @@ -318,6 +318,24 @@ $(eval $(call gb_Library_add_exception_objects,sd,\ sd/source/ui/presenter/PresenterPreviewCache \ sd/source/ui/presenter/PresenterTextView \ sd/source/ui/presenter/SlideRenderer \ + sd/source/ui/sidebar/AllMasterPagesSelector \ + sd/source/ui/sidebar/CurrentMasterPagesSelector \ + sd/source/ui/sidebar/CustomAnimationPanel \ + sd/source/ui/sidebar/DocumentHelper \ + sd/source/ui/sidebar/LayoutMenu \ + sd/source/ui/sidebar/MasterPageContainer \ + sd/source/ui/sidebar/MasterPageContainerFiller \ + sd/source/ui/sidebar/MasterPageContainerProviders \ + sd/source/ui/sidebar/MasterPageContainerQueue \ + sd/source/ui/sidebar/MasterPageDescriptor \ + sd/source/ui/sidebar/MasterPagesSelector \ + sd/source/ui/sidebar/NavigatorWrapper \ + sd/source/ui/sidebar/PanelBase \ + sd/source/ui/sidebar/PanelFactory \ + sd/source/ui/sidebar/PreviewValueSet \ + sd/source/ui/sidebar/RecentlyUsedMasterPages \ + sd/source/ui/sidebar/RecentMasterPagesSelector \ + sd/source/ui/sidebar/SlideTransitionPanel \ sd/source/ui/slideshow/PaneHider \ sd/source/ui/slideshow/SlideShowRestarter \ sd/source/ui/slideshow/showwin \ diff --git a/sd/inc/glob.hrc b/sd/inc/glob.hrc index afbb483d06ff..3bf45eedbb78 100644 --- a/sd/inc/glob.hrc +++ b/sd/inc/glob.hrc @@ -119,9 +119,9 @@ #define STR_3DOBJECTBARSHELL RID_GLOB_START+104 #define STR_FONTWORKOBJECTBARSHELL RID_GLOB_START+105 #define STR_SLIDESORTERVIEWSHELL RID_GLOB_START+106 -#define STR_TASKPANEVIEWSHELL RID_GLOB_START+107 +#define STR_SIDEBARVIEWSHELL RID_GLOB_START+107 #define STR_MASTERPAGESSELECTOR RID_GLOB_START+108 -#define STR_TASKPANELAYOUTMENU RID_GLOB_START+109 +#define STR_SIDEBAR_LAYOUTMENU RID_GLOB_START+109 #define STR_MEDIAOBJECTBARSHELL RID_GLOB_START+110 #define STR_PAGE_NAME RID_GLOB_START+111 #define STR_SLIDE_NAME RID_GLOB_START+112 @@ -129,6 +129,10 @@ #define STR_LEFT_DRAW_PANE_SHELL RID_GLOB_START+114 #define STR_TOOL_PANEL_SHELL RID_GLOB_START+116 +#define STR_TASKPANEVIEWSHELL RID_GLOB_START+117 +#define STR_TASKPANELAYOUTMENU RID_GLOB_START+118 + + #define RID_CUSTOMANIMATION_START RID_GLOB_START+120 // RID_CUSTOMANIMATION_END RID_GLOB_START+199 #define RID_ANNOTATIONS_START RID_GLOB_START+200 diff --git a/sd/inc/glob.hxx b/sd/inc/glob.hxx index a88c280d9646..4223294fa339 100644 --- a/sd/inc/glob.hxx +++ b/sd/inc/glob.hxx @@ -45,7 +45,7 @@ #define SD_IF_SD3DOBJECTBAR SFX_INTERFACE_SD_START + 17 #define SD_IF_SDFONTWORKOBJECTBAR SFX_INTERFACE_SD_START + 18 #define SD_IF_SDSLIDESORTERVIEWSHELL SFX_INTERFACE_SD_START + 19 -#define SD_IF_SDTASKPANEVIEWSHELL SFX_INTERFACE_SD_START + 20 +#define SD_IF_SDSIDEBARVIEWSHELL SFX_INTERFACE_SD_START + 20 #define SD_IF_SDMASTERPAGESSELECTOR SFX_INTERFACE_SD_START + 21 #define SD_IF_SDLAYOUTMENU SFX_INTERFACE_SD_START + 22 #define SD_IF_SDDRAWMEDIAOBJECTBAR SFX_INTERFACE_SD_START + 23 @@ -57,6 +57,8 @@ #define SD_IF_SDTOOLPANELPANESHELL SFX_INTERFACE_SD_START + 29 #define SD_IF_SDTOOLPANELSHELL SFX_INTERFACE_SD_START + 30 +#define SD_IF_SDTASKPANEVIEWSHELL SFX_INTERFACE_SD_START + 31 + // Inventor-Id for StarDraw UserData const sal_uInt32 SdUDInventor=sal_uInt32('S')*0x00000001+ sal_uInt32('D')*0x00000100+ diff --git a/sd/sdi/_drvwsh.sdi b/sd/sdi/_drvwsh.sdi index a67acf1bae57..29c436249561 100644 --- a/sd/sdi/_drvwsh.sdi +++ b/sd/sdi/_drvwsh.sdi @@ -209,12 +209,72 @@ interface DrawView ExecMethod = FuTemporary ; StateMethod = GetMenuState ; ] + + SID_ATTR_TRANSFORM_WIDTH // ole : no, status : ? + [ + ExecMethod = FuTemporary ; + StateMethod = GetDrawAttrState ; + ] + SID_ATTR_TRANSFORM_HEIGHT // ole : no, status : ? + [ + ExecMethod = FuTemporary ; + StateMethod = GetDrawAttrState ; + ] + SID_ATTR_TRANSFORM_POS_X // ole : no, status : ? + [ + ExecMethod = FuTemporary ; + StateMethod = GetDrawAttrState ; + ] + SID_ATTR_TRANSFORM_POS_Y // ole : no, status : ? + [ + ExecMethod = FuTemporary ; + StateMethod = GetDrawAttrState ; + ] + SID_ATTR_TRANSFORM_ANGLE + [ + ExecMethod = FuTemporary ; + StateMethod = GetDrawAttrState ; + ] + SID_ATTR_TRANSFORM_ROT_X + [ + ExecMethod = FuTemporary ; + StateMethod = GetDrawAttrState ; + ] + SID_ATTR_TRANSFORM_ROT_Y + [ + ExecMethod = FuTemporary ; + StateMethod = GetDrawAttrState ; + ] + SID_ATTR_TRANSFORM_PROTECT_POS + [ + ExecMethod = FuTemporary ; + StateMethod = GetDrawAttrState ; + ] + SID_ATTR_TRANSFORM_PROTECT_SIZE + [ + ExecMethod = FuTemporary ; + StateMethod = GetDrawAttrState ; + ] + SID_ATTR_TRANSFORM_AUTOWIDTH + [ + StateMethod = GetDrawAttrState ; + ] + SID_ATTR_TRANSFORM_AUTOHEIGHT + [ + StateMethod = GetDrawAttrState ; + ] + /// !? SID_CHAR_DLG // ole : no, status : ? [ ExecMethod = FuTemporary ; StateMethod = GetMenuState ; ] + SID_CHAR_DLG_EFFECT // ole : no, status : ? + [ + ExecMethod = FuTemporary ; + StateMethod = GetMenuState ; + ] /* -> SVX SID_PARA_DLG // ole : no, status : ? [ @@ -637,12 +697,42 @@ interface DrawView ExecMethod = FuTemporary ; StateMethod = GetMenuState ; ] + FN_NUM_BULLET_ON + [ + ExecMethod = FuTemporary; + StateMethod = GetAttrState; + ] + FN_NUM_NUMBERING_ON + [ + ExecMethod = FuTemporary; + StateMethod = GetAttrState; + ] SID_OUTLINE_BULLET // ole : no, status : ? [ ExecMethod = FuTemporary ; StateMethod = GetMenuState ; MenuConfig = TRUE; ] + FN_SVX_SET_BULLET + [ + ExecMethod = FuTemporary ; + ] + FN_SVX_SET_NUMBER + [ + ExecMethod = FuTemporary ; + ] + FN_BUL_NUM_RULE_INDEX + [ + ExecMethod = FuTemporary; + StateMethod = GetAttrState; + Asynchron , AutoUpdate ; + ] + FN_NUM_NUM_RULE_INDEX + [ + ExecMethod = FuTemporary; + StateMethod = GetAttrState; + Asynchron , AutoUpdate ; + ] SID_ATTR_CHAR // ole : no, status : ? [ ExecMethod = FuPermanent ; @@ -1270,11 +1360,36 @@ interface DrawView ExecMethod = FuTemporary ; StateMethod = GetAttrState ; ] + SID_ATTR_FILL_TRANSPARENCE // ole : no, status : ? + [ + ExecMethod = FuTemporary ; + StateMethod = GetAttrState ; + ] + SID_ATTR_FILL_FLOATTRANSPARENCE // ole : no, status : ? + [ + ExecMethod = FuTemporary ; + StateMethod = GetAttrState ; + ] SID_ATTR_LINE_STYLE // ole : no, status : ? [ ExecMethod = FuTemporary ; StateMethod = GetAttrState ; ] + SID_ATTR_LINE_JOINT // ole : no, status : ? + [ + ExecMethod = FuTemporary ; + StateMethod = GetAttrState ; + ] + SID_ATTR_LINE_CAP // ole : no, status : ? + [ + ExecMethod = FuTemporary ; + StateMethod = GetAttrState ; + ] + SID_ATTR_LINE_TRANSPARENCE // ole : no, status : ? + [ + ExecMethod = FuTemporary ; + StateMethod = GetAttrState ; + ] SID_ATTR_LINE_DASH // ole : no, status : ? [ ExecMethod = FuTemporary ; @@ -1319,6 +1434,16 @@ interface DrawView ExecMethod = FuTemporary ; StateMethod = GetAttrState ; ] + SID_ATTR_LINE_START // ole : no, status : play rec + [ + ExecMethod = FuTemporary ; + StateMethod = GetAttrState ; + ] + SID_ATTR_LINE_END // ole : no, status : play rec + [ + ExecMethod = FuTemporary ; + StateMethod = GetAttrState ; + ] SID_DELETE_PAGE // ole : no, status : play rec [ ExecMethod = FuTemporary ; @@ -1468,7 +1593,37 @@ interface DrawView SID_ATTR_PARA_LRSPACE // ole : no, status : ? [ ExecMethod = ExecRuler ; - StateMethod = GetRulerState ; + StateMethod = GetAttrState ; + ] + SID_ATTR_PARA_LINESPACE + [ + ExecMethod = ExecRuler ; + StateMethod = GetAttrState ; + ] + SID_ATTR_PARA_ULSPACE + [ + ExecMethod = ExecRuler ; + StateMethod = GetAttrState ; + ] + SID_ATTR_PARA_ADJUST_LEFT + [ + ExecMethod = ExecRuler ; + StateMethod = GetAttrState ; + ] + SID_ATTR_PARA_ADJUST_CENTER + [ + ExecMethod = ExecRuler ; + StateMethod = GetAttrState ; + ] + SID_ATTR_PARA_ADJUST_RIGHT + [ + ExecMethod = ExecRuler ; + StateMethod = GetAttrState ; + ] + SID_ATTR_PARA_ADJUST_BLOCK + [ + ExecMethod = ExecRuler ; + StateMethod = GetAttrState ; ] SID_ATTR_POSITION // ole : no, status : ? [ @@ -1661,11 +1816,21 @@ interface DrawView ExecMethod = FuTemporary ; StateMethod = GetMenuState ; ] + SID_FLIP_HORIZONTAL + [ + ExecMethod = FuTemporary ; + StateMethod = GetMenuState ; + ] SID_VERTICAL // ole : no, status : ? [ ExecMethod = FuTemporary ; StateMethod = GetMenuState ; ] + SID_FLIP_VERTICAL + [ + ExecMethod = FuTemporary ; + StateMethod = GetMenuState ; + ] SID_ATTR_FILL_SHADOW // ole : no, status : ? [ ExecMethod = FuTemporary ; @@ -2499,4 +2664,84 @@ interface DrawView ExecMethod = FuTable ; StateMethod = GetTableMenuState ; ] + SID_ATTR_CHAR_FONT + [ + ExecMethod = ExecChar ; + StateMethod = GetAttrState ; + ] + SID_ATTR_CHAR_FONTHEIGHT + [ + ExecMethod = ExecChar ; + StateMethod = GetAttrState ; + ] + SID_ATTR_CHAR_WEIGHT + [ + ExecMethod = ExecChar ; + StateMethod = GetAttrState ; + ] + SID_ATTR_CHAR_POSTURE + [ + ExecMethod = ExecChar ; + StateMethod = GetAttrState ; + ] + SID_ATTR_CHAR_UNDERLINE + [ + ExecMethod = ExecChar ; + StateMethod = GetAttrState ; + ] + SID_ATTR_CHAR_SHADOWED + [ + ExecMethod = ExecChar ; + StateMethod = GetAttrState ; + ] + SID_ATTR_CHAR_STRIKEOUT + [ + ExecMethod = ExecChar ; + StateMethod = GetAttrState ; + ] + SID_ATTR_CHAR_COLOR + [ + ExecMethod = ExecChar ; + StateMethod = GetAttrState ; + ] + SID_ATTR_CHAR_KERNING + [ + ExecMethod = ExecChar ; + StateMethod = GetAttrState ; + ] + SID_SET_SUB_SCRIPT + [ + ExecMethod = ExecChar ; + StateMethod = GetAttrState ; + ] + SID_SET_SUPER_SCRIPT + [ + ExecMethod = ExecChar ; + StateMethod = GetAttrState ; + ] + SID_SHRINK_FONT_SIZE + [ + ExecMethod = ExecChar ; + StateMethod = GetAttrState ; + ] + SID_GROW_FONT_SIZE + [ + ExecMethod = ExecChar ; + StateMethod = GetAttrState ; + ] + SID_TABLE_VERT_NONE + [ + ExecMethod = ExecutePropPanelAttr ; + StateMethod = GetStatePropPanelAttr ; + ] + SID_TABLE_VERT_CENTER + [ + ExecMethod = ExecutePropPanelAttr ; + StateMethod = GetStatePropPanelAttr ; + ] + SID_TABLE_VERT_BOTTOM + [ + ExecMethod = ExecutePropPanelAttr ; + StateMethod = GetStatePropPanelAttr ; + ] } diff --git a/sd/sdi/drtxtob.sdi b/sd/sdi/drtxtob.sdi index ded76af11296..9941d6341d75 100644 --- a/sd/sdi/drtxtob.sdi +++ b/sd/sdi/drtxtob.sdi @@ -161,6 +161,12 @@ shell TextObjectBar StateMethod = GetAttrState; ] + SID_ATTR_CHAR_KERNING + [ + ExecMethod = Execute; + StateMethod = GetCharState; + ] + SID_PARASPACE_INCREASE // ole : ?, status : ? [ ExecMethod = Execute; @@ -173,6 +179,20 @@ shell TextObjectBar StateMethod = GetAttrState; ] + SID_ATTR_PARA_LRSPACE + [ + ExecMethod = Execute ; + StateMethod = GetAttrState; + ] + SID_ATTR_PARA_RIGHT + [ + ExecMethod = Execute ; + ] + SID_ATTR_PARA_LEFT + [ + ExecMethod = Execute ; + ] + SID_OUTLINE_LEFT // ole : no, status : ? [ ExecMethod = Execute ; diff --git a/sd/sdi/outlnvsh.sdi b/sd/sdi/outlnvsh.sdi index 1e8991f03262..72169349ffb9 100644 --- a/sd/sdi/outlnvsh.sdi +++ b/sd/sdi/outlnvsh.sdi @@ -169,7 +169,14 @@ interface OutlineView ExecMethod = FuTemporaryModify ; StateMethod = GetMenuState ; ] - + FN_SVX_SET_BULLET + [ + ExecMethod = FuTemporaryModify ; + ] + FN_SVX_SET_NUMBER + [ + ExecMethod = FuTemporaryModify ; + ] SID_OUTLINE_BULLET // ole : no, status : ? [ ExecMethod = FuTemporaryModify ; @@ -182,6 +189,12 @@ interface OutlineView StateMethod = GetMenuState ; // Cachable , HasDialog , Export ; ] + SID_CHAR_DLG_EFFECT // wj for sym2_1876 + [ + ExecMethod = FuTemporaryModify ; + StateMethod = GetMenuState ; + // Cachable , HasDialog , Export ; + ] SID_SELECTALL // ole : no, status : ? [ ExecMethod = FuTemporary ; diff --git a/sd/sdi/sdslots.sdi b/sd/sdi/sdslots.sdi index 7070cff8482f..4176f6f469c0 100644 --- a/sd/sdi/sdslots.sdi +++ b/sd/sdi/sdslots.sdi @@ -96,4 +96,4 @@ ModulePrefix( "Sd" ) include "mediaob.sdi" include "tables.sdi" include "ToolPanelViewShell.sdi" -} + } diff --git a/sd/source/core/glob.src b/sd/source/core/glob.src index 5dfe3dc8f715..c2c12753c7b8 100644 --- a/sd/source/core/glob.src +++ b/sd/source/core/glob.src @@ -370,14 +370,14 @@ String STR_TASKPANEVIEWSHELL Text [ en-US ] = "Tasks" ; }; -String STR_MASTERPAGESSELECTOR +String STR_TASKPANELAYOUTMENU { - Text [ en-US ] = "Master Pages" ; + Text [ en-US ] = "Layout" ; }; -String STR_TASKPANELAYOUTMENU +String STR_MASTERPAGESSELECTOR { - Text [ en-US ] = "Layout" ; + Text [ en-US ] = "Master Pages" ; }; String STR_POWERPOINT_IMPORT diff --git a/sd/source/core/typemap.cxx b/sd/source/core/typemap.cxx index bb7cad78e5df..7e5277e55c79 100644 --- a/sd/source/core/typemap.cxx +++ b/sd/source/core/typemap.cxx @@ -32,6 +32,9 @@ #include <editeng/fontitem.hxx> #include <svl/poolitem.hxx> #include <editeng/tstpitem.hxx> +#include <editeng/kernitem.hxx> +#include <editeng/lspcitem.hxx> +#include <editeng/ulspitem.hxx> #include <editeng/lrspitem.hxx> #include <editeng/protitem.hxx> #include <svx/chrtitem.hxx> @@ -92,6 +95,10 @@ #include <svl/rectitem.hxx> #include <sfx2/frame.hxx> +#include <svx/xlncapit.hxx> +#include <svx/xflftrit.hxx> +#include <svx/xlinjoit.hxx> +#include <svx/AffineMatrixItem.hxx> #define SFX_TYPEMAP #include "sdslots.hxx" diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx index 31cf222e00bb..267feea6eaa8 100644 --- a/sd/source/ui/animations/CustomAnimationPane.cxx +++ b/sd/source/ui/animations/CustomAnimationPane.cxx @@ -54,6 +54,7 @@ #include <comphelper/sequence.hxx> #include <sfx2/frame.hxx> +#include <sfx2/sidebar/Theme.hxx> #include <svx/unoapi.hxx> #include <svx/svxids.hrc> @@ -239,6 +240,8 @@ CustomAnimationPane::CustomAnimationPane( ::Window* pParent, ViewShellBase& rBas maLateInitTimer.SetTimeout(100); maLateInitTimer.SetTimeoutHdl(LINK(this, CustomAnimationPane, lateInitCallback)); maLateInitTimer.Start(); + + UpdateLook(); } CustomAnimationPane::~CustomAnimationPane() @@ -1059,6 +1062,42 @@ void CustomAnimationPane::onContextMenu( sal_uInt16 nSelectedPopupEntry ) updateControls(); } + + + +void CustomAnimationPane::DataChanged (const DataChangedEvent& rEvent) +{ + (void)rEvent; + UpdateLook(); +} + + + + +void CustomAnimationPane::UpdateLook (void) +{ + SetBackground(::sfx2::sidebar::Theme::GetWallpaper(::sfx2::sidebar::Theme::Paint_PanelBackground)); + if (mpFLModify != NULL) + mpFLModify->SetBackground(Wallpaper()); + if (mpFLEffect != NULL) + mpFLEffect->SetBackground(Wallpaper()); + if (mpFTStart != NULL) + mpFTStart->SetBackground(Wallpaper()); + if (mpFTProperty != NULL) + mpFTProperty->SetBackground(Wallpaper()); + if (mpFTSpeed != NULL) + mpFTSpeed->SetBackground(Wallpaper()); + if (mpFTChangeOrder != NULL) + mpFTChangeOrder->SetBackground(Wallpaper()); + if (mpFLSeperator1 != NULL) + mpFLSeperator1->SetBackground(Wallpaper()); + if (mpFLSeperator2 != NULL) + mpFLSeperator2->SetBackground(Wallpaper()); +} + + + + void addValue( STLPropertySet* pSet, sal_Int32 nHandle, const Any& rValue ) { switch( pSet->getPropertyState( nHandle ) ) @@ -2457,8 +2496,10 @@ void CustomAnimationPane::updatePathFromMotionPathTag( const rtl::Reference< Mot if( pDocSh ) { pWindow = new DialogListBox( pParent, WB_CLIPCHILDREN|WB_TABSTOP|WB_AUTOHSCROLL ); + const Size aMinSize( pWindow->LogicToPixel( Size( 80, 256 ), MAP_APPFONT ) ); + pWindow->SetSizePixel(aMinSize); + pWindow->SetBackground(Wallpaper(Color(COL_BLUE))); - Size aMinSize( pWindow->LogicToPixel( Size( 80, 256 ), MAP_APPFONT ) ); ::Window* pPaneWindow = new CustomAnimationPane( pWindow, rBase, aMinSize ); pWindow->SetChildWindow( pPaneWindow, aMinSize ); pWindow->SetText( pPaneWindow->GetText() ); @@ -2469,6 +2510,15 @@ void CustomAnimationPane::updatePathFromMotionPathTag( const rtl::Reference< Mot + +sal_Int32 getCustomAnimationPanelMinimumHeight (::Window* pDialog) +{ + if (pDialog != NULL) + return pDialog->LogicToPixel(Size( 80, 256 ), MAP_APPFONT).Height(); + else + return 0; +} + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/animations/CustomAnimationPane.hxx b/sd/source/ui/animations/CustomAnimationPane.hxx index 9e4d5c514da2..a95b14e3e64c 100644 --- a/sd/source/ui/animations/CustomAnimationPane.hxx +++ b/sd/source/ui/animations/CustomAnimationPane.hxx @@ -88,6 +88,9 @@ public: virtual void onDoubleClick(); virtual void onContextMenu( sal_uInt16 nSelectedPopupEntry ); + // Window + virtual void DataChanged (const DataChangedEvent& rEvent); + void addUndo(); void updatePathFromMotionPathTag( const rtl::Reference< MotionPathTag >& xTag ); @@ -111,6 +114,7 @@ private: ::com::sun::star::uno::Any getProperty1Value( sal_Int32 nType, CustomAnimationEffectPtr pEffect ); bool setProperty1Value( sal_Int32 nType, CustomAnimationEffectPtr pEffect, const ::com::sun::star::uno::Any& rValue ); + void UpdateLook (void); DECL_LINK( implControlHdl, Control* ); DECL_LINK(implPropertyHdl, void *); diff --git a/sd/source/ui/animations/SlideTransitionPane.cxx b/sd/source/ui/animations/SlideTransitionPane.cxx index 05ac403eaa07..20334b3477f9 100644 --- a/sd/source/ui/animations/SlideTransitionPane.cxx +++ b/sd/source/ui/animations/SlideTransitionPane.cxx @@ -49,6 +49,7 @@ #include "framework/FrameworkHelper.hxx" #include "DialogListBox.hxx" +#include <sfx2/sidebar/Theme.hxx> #include <algorithm> #include <memory> @@ -511,6 +512,8 @@ SlideTransitionPane::SlideTransitionPane( maLateInitTimer.SetTimeout(200); maLateInitTimer.SetTimeoutHdl(LINK(this, SlideTransitionPane, LateInitCallback)); maLateInitTimer.Start(); + + UpdateLook(); } SlideTransitionPane::~SlideTransitionPane() @@ -524,6 +527,33 @@ void SlideTransitionPane::Resize() updateLayout(); } + + + +void SlideTransitionPane::DataChanged (const DataChangedEvent& rEvent) +{ + (void)rEvent; + UpdateLook(); +} + + + + +void SlideTransitionPane::UpdateLook (void) +{ + SetBackground(::sfx2::sidebar::Theme::GetWallpaper(::sfx2::sidebar::Theme::Paint_PanelBackground)); + maFL_APPLY_TRANSITION.SetBackground(Wallpaper()); + maFL_MODIFY_TRANSITION.SetBackground(Wallpaper());; + maFT_SPEED.SetBackground(Wallpaper()); + maFT_SOUND.SetBackground(Wallpaper()); + maFL_ADVANCE_SLIDE.SetBackground(Wallpaper()); + maFL_EMPTY1.SetBackground(Wallpaper()); + maFL_EMPTY2.SetBackground(Wallpaper()); +} + + + + void SlideTransitionPane::onSelectionChanged() { updateControls(); @@ -1300,6 +1330,17 @@ IMPL_LINK_NOARG(SlideTransitionPane, LateInitCallback) } + + +sal_Int32 getSlideTransitionPanelMinimumHeight (::Window* pDialog) +{ + if (pDialog != NULL) + return pDialog->LogicToPixel(Size( 72, 216 ), MAP_APPFONT).Height(); + else + return 0; +} + + } // namespace sd /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/animations/SlideTransitionPane.hxx b/sd/source/ui/animations/SlideTransitionPane.hxx index e0c9ddd4a443..102d005417ba 100644 --- a/sd/source/ui/animations/SlideTransitionPane.hxx +++ b/sd/source/ui/animations/SlideTransitionPane.hxx @@ -56,7 +56,9 @@ public: SdDrawDocument* pDoc ); virtual ~SlideTransitionPane(); + // Window virtual void Resize(); + virtual void DataChanged (const DataChangedEvent& rEvent); void onSelectionChanged(); void onChangeCurrentPage(); @@ -79,6 +81,8 @@ private: ::sd::slidesorter::SharedPageSelection getSelectedPages (void) const; + void UpdateLook (void); + DECL_LINK( ApplyToAllButtonClicked, void * ); DECL_LINK( PlayButtonClicked, void * ); DECL_LINK( SlideShowButtonClicked, void * ); @@ -93,7 +97,6 @@ private: DECL_LINK(EventMultiplexerListener, tools::EventMultiplexerEvent*); DECL_LINK(LateInitCallback, void *); -private: ViewShellBase & mrBase; SdDrawDocument * mpDrawDoc; Size maMinSize; diff --git a/sd/source/ui/app/sddll1.cxx b/sd/source/ui/app/sddll1.cxx index 5fecbce7b4ee..09a7346bc33d 100644 --- a/sd/source/ui/app/sddll1.cxx +++ b/sd/source/ui/app/sddll1.cxx @@ -37,7 +37,6 @@ #include "DrawDocShell.hxx" #include "GraphicDocShell.hxx" #include "SlideSorterViewShell.hxx" -#include "taskpane/ToolPanelViewShell.hxx" #include "FactoryIds.hxx" #include "sdmod.hxx" #include "app.hrc" @@ -115,10 +114,6 @@ void SdDLL::RegisterInterfaces() // View shells for the side panes. ::sd::slidesorter::SlideSorterViewShell::RegisterInterface (pMod); - ::sd::toolpanel::ToolPanelViewShell::RegisterInterface(pMod); - // Tell the tool panel view shell to register the interfaces of its - // controls. - ::sd::toolpanel::ToolPanelViewShell::RegisterControls(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/app/sddll2.cxx b/sd/source/ui/app/sddll2.cxx index dbd6d3d0e1a4..e961cbf06c6e 100644 --- a/sd/source/ui/app/sddll2.cxx +++ b/sd/source/ui/app/sddll2.cxx @@ -53,6 +53,7 @@ #include <svx/layctrl.hxx> #include <svx/subtoolboxcontrol.hxx> +#include <sfx2/sidebar/SidebarChildWindow.hxx> #include "sddll.hxx" #include "sdmod.hxx" @@ -125,7 +126,7 @@ void SdDLL::RegisterControllers() ::avmedia::MediaPlayer::RegisterChildWindow(0, pMod); ::sd::LeftPaneImpressChildWindow::RegisterChildWindow(0, pMod); ::sd::LeftPaneDrawChildWindow::RegisterChildWindow(0, pMod); - ::sd::ToolPanelChildWindow::RegisterChildWindow(0, pMod); + ::sfx2::sidebar::SidebarChildWindow::RegisterChildWindow(0, pMod); SvxFillToolBoxControl::RegisterControl(0, pMod); SvxLineStyleToolBoxControl::RegisterControl(0, pMod); diff --git a/sd/source/ui/app/sdmod1.cxx b/sd/source/ui/app/sdmod1.cxx index ec2c033c5911..61cfa61ff08b 100644 --- a/sd/source/ui/app/sdmod1.cxx +++ b/sd/source/ui/app/sdmod1.cxx @@ -729,7 +729,7 @@ SfxFrame* SdModule::ExecuteNewDocument( SfxRequest& rReq ) ::sd::ViewShellBase* pBase = ::sd::ViewShellBase::GetViewShellBase(pViewFrame); if (pBase != NULL) { - FrameworkHelper::Instance(*pBase)->RequestTaskPanel( + FrameworkHelper::Instance(*pBase)->RequestSidebarPanel( FrameworkHelper::msLayoutTaskPanelURL); } } diff --git a/sd/source/ui/dlg/NavigatorChildWindow.cxx b/sd/source/ui/dlg/NavigatorChildWindow.cxx index 2135eb8ec3b9..09b129617986 100644 --- a/sd/source/ui/dlg/NavigatorChildWindow.cxx +++ b/sd/source/ui/dlg/NavigatorChildWindow.cxx @@ -23,11 +23,31 @@ #include "app.hrc" #include "navigatr.hrc" #include <sfx2/app.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <svl/eitem.hxx> +#include <boost/bind.hpp> + namespace sd { SFX_IMPL_CHILDWINDOWCONTEXT(NavigatorChildWindow, SID_NAVIGATOR) +void RequestNavigatorUpdate (SfxBindings* pBindings) +{ + if (pBindings != NULL + && pBindings->GetDispatcher() != NULL) + { + SfxBoolItem aItem (SID_NAVIGATOR_INIT, sal_True); + pBindings->GetDispatcher()->Execute( + SID_NAVIGATOR_INIT, + SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, + &aItem, + 0L); + } +} + + NavigatorChildWindow::NavigatorChildWindow ( ::Window* pParent, sal_uInt16 nId, @@ -35,8 +55,12 @@ NavigatorChildWindow::NavigatorChildWindow ( SfxChildWinInfo* ) : SfxChildWindowContext( nId ) { - SdNavigatorWin* pNavWin = new SdNavigatorWin( pParent, this, - SdResId( FLT_NAVIGATOR ), pBindings ); + SdNavigatorWin* pNavWin = new SdNavigatorWin( + pParent, + this, + SdResId( FLT_NAVIGATOR ), + pBindings, + ::boost::bind(RequestNavigatorUpdate, pBindings)); SetWindow( pNavWin ); } diff --git a/sd/source/ui/dlg/PaneChildWindows.cxx b/sd/source/ui/dlg/PaneChildWindows.cxx index 67edc11a9f7b..3b12bf101e36 100644 --- a/sd/source/ui/dlg/PaneChildWindows.cxx +++ b/sd/source/ui/dlg/PaneChildWindows.cxx @@ -46,7 +46,7 @@ using ::com::sun::star::drawing::framework::ResourceActivationMode_REPLACE; SFX_IMPL_DOCKINGWINDOW_WITHID(LeftPaneImpressChildWindow, SID_LEFT_PANE_IMPRESS) SFX_IMPL_DOCKINGWINDOW_WITHID(LeftPaneDrawChildWindow, SID_LEFT_PANE_DRAW) -SFX_IMPL_DOCKINGWINDOW_WITHID( ToolPanelChildWindow, SID_TASKPANE) +SFX_IMPL_DOCKINGWINDOW_WITHID(ToolPanelChildWindow, SID_TASKPANE) //===== PaneChildWindow ======================================================= @@ -136,12 +136,6 @@ LeftPaneDrawChildWindow::LeftPaneDrawChildWindow ( } - - -//====================================================================================================================== -//= ToolPanelChildWindow -//====================================================================================================================== -//---------------------------------------------------------------------------------------------------------------------- ToolPanelChildWindow::ToolPanelChildWindow( ::Window* i_pParentWindow, sal_uInt16 i_nId, SfxBindings* i_pBindings, SfxChildWinInfo* i_pChildWindowInfo ) :PaneChildWindow( i_pParentWindow, i_nId, i_pBindings, i_pChildWindowInfo, @@ -200,7 +194,7 @@ void ToolPanelChildWindow::ActivateToolPanel( const OUString& i_rPanelURL ) if ( i_rPanelURL.indexOf( framework::FrameworkHelper::msTaskPanelURLPrefix ) == 0 ) { // it's one of our standard panels known to the drawing framework - pFrameworkHelper->RequestTaskPanel( i_rPanelURL ); + pFrameworkHelper->RequestSidebarPanel( i_rPanelURL ); // MMeeks } else { diff --git a/sd/source/ui/dlg/PaneShells.cxx b/sd/source/ui/dlg/PaneShells.cxx index 668d7abd9b09..023dbcc810a4 100644 --- a/sd/source/ui/dlg/PaneShells.cxx +++ b/sd/source/ui/dlg/PaneShells.cxx @@ -93,32 +93,6 @@ LeftDrawPaneShell::~LeftDrawPaneShell (void) } - - -//===== ToolPanelPaneShell ======================================================== - -SFX_SLOTMAP( ToolPanelPaneShell ) -{ - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } -}; - -SFX_IMPL_INTERFACE( ToolPanelPaneShell, SfxShell, SdResId( STR_TOOL_PANEL_SHELL ) ) -{ - SFX_CHILDWINDOW_REGISTRATION( ::sd::ToolPanelChildWindow::GetChildWindowId() ); -} - -TYPEINIT1( ToolPanelPaneShell, SfxShell ); - -ToolPanelPaneShell::ToolPanelPaneShell() - :SfxShell() -{ - SetName(OUString("ToolPanel")); -} - -ToolPanelPaneShell::~ToolPanelPaneShell(void) -{ -} - } // end of namespace ::sd /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/navigatr.cxx b/sd/source/ui/dlg/navigatr.cxx index b80f7e385ddf..88262d7668f0 100644 --- a/sd/source/ui/dlg/navigatr.cxx +++ b/sd/source/ui/dlg/navigatr.cxx @@ -63,17 +63,18 @@ SdNavigatorWin::SdNavigatorWin( ::Window* pParent, ::sd::NavigatorChildWindow* pChWinCtxt, const SdResId& rSdResId, - SfxBindings* pInBindings ) -: ::Window( pParent, rSdResId ) -, maToolbox ( this, SdResId( 1 ) ) -, maTlbObjects( this, SdResId( TLB_OBJECTS ) ) -, maLbDocs ( this, SdResId( LB_DOCS ) ) -, mpChildWinContext( pChWinCtxt ) -, mbDocImported ( sal_False ) - // On changes of the DragType: adjust SelectionMode of TLB! -, meDragType ( NAVIGATOR_DRAGTYPE_EMBEDDED ) -, mpBindings ( pInBindings ) -, maImageList ( SdResId( IL_NAVIGATR ) ) + SfxBindings* pInBindings, + const UpdateRequestFunctor& rUpdateRequest) + : ::Window( pParent, rSdResId ) + , maToolbox ( this, SdResId( 1 ) ) + , maTlbObjects( this, SdResId( TLB_OBJECTS ) ) + , maLbDocs ( this, SdResId( LB_DOCS ) ) + , mpChildWinContext( pChWinCtxt ) + , mbDocImported ( sal_False ) + // On changes of the DragType: adjust SelectionMode of TLB! + , meDragType ( NAVIGATOR_DRAGTYPE_EMBEDDED ) + , mpBindings ( pInBindings ) + , maImageList ( SdResId( IL_NAVIGATR ) ) { maTlbObjects.SetViewFrame( mpBindings->GetDispatcher()->GetFrame() ); @@ -81,8 +82,8 @@ SdNavigatorWin::SdNavigatorWin( maTlbObjects.SetAccessibleName(String(SdResId(STR_OBJECTS_TREE))); - mpNavigatorCtrlItem = new SdNavigatorControllerItem( SID_NAVIGATOR_STATE, this, mpBindings ); - mpPageNameCtrlItem = new SdPageNameControllerItem( SID_NAVIGATOR_PAGENAME, this, mpBindings ); + mpNavigatorCtrlItem = new SdNavigatorControllerItem( SID_NAVIGATOR_STATE, this, mpBindings, rUpdateRequest); + mpPageNameCtrlItem = new SdPageNameControllerItem( SID_NAVIGATOR_PAGENAME, this, mpBindings, rUpdateRequest); ApplyImageList(); // load images *before* calculating sizes to get something useful !!! @@ -126,13 +127,13 @@ SdNavigatorWin::SdNavigatorWin( if( nMinWidth > maMinSize.Width() ) maMinSize.Width() = nMinWidth; maMinSize.Height() -= 40; - ((SfxDockingWindow*)GetParent())->SetMinOutputSizePixel( maMinSize ); + SfxDockingWindow* pDockingParent = dynamic_cast<SfxDockingWindow*>(GetParent()); + if (pDockingParent != NULL) + pDockingParent->SetMinOutputSizePixel( maMinSize ); // InitTlb; is initiated over Slot - SfxBoolItem aItem( SID_NAVIGATOR_INIT, sal_True ); - mpBindings->GetDispatcher()->Execute( - SID_NAVIGATOR_INIT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L ); - + if (rUpdateRequest) + rUpdateRequest(); } // ----------------------------------------------------------------------- @@ -836,11 +837,14 @@ void SdNavigatorWin::ApplyImageList() /** * ControllerItem for Navigator */ -SdNavigatorControllerItem::SdNavigatorControllerItem( sal_uInt16 _nId, - SdNavigatorWin* pNavWin, - SfxBindings* _pBindings) : - SfxControllerItem( _nId, *_pBindings ), - pNavigatorWin( pNavWin ) +SdNavigatorControllerItem::SdNavigatorControllerItem( + sal_uInt16 _nId, + SdNavigatorWin* pNavWin, + SfxBindings* _pBindings, + const SdNavigatorWin::UpdateRequestFunctor& rUpdateRequest) + : SfxControllerItem( _nId, *_pBindings ), + pNavigatorWin( pNavWin ), + maUpdateRequest(rUpdateRequest) { } @@ -908,9 +912,8 @@ void SdNavigatorControllerItem::StateChanged( sal_uInt16 nSId, if( nState & NAVTLB_UPDATE ) { // InitTlb; is initiated by Slot - SfxBoolItem aItem( SID_NAVIGATOR_INIT, sal_True ); - GetBindings().GetDispatcher()->Execute( - SID_NAVIGATOR_INIT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L ); + if (maUpdateRequest) + maUpdateRequest(); } } } @@ -919,11 +922,14 @@ void SdNavigatorControllerItem::StateChanged( sal_uInt16 nSId, /** * ControllerItem for Navigator to show page in TreeLB */ -SdPageNameControllerItem::SdPageNameControllerItem( sal_uInt16 _nId, - SdNavigatorWin* pNavWin, - SfxBindings* _pBindings) : - SfxControllerItem( _nId, *_pBindings ), - pNavigatorWin( pNavWin ) +SdPageNameControllerItem::SdPageNameControllerItem( + sal_uInt16 _nId, + SdNavigatorWin* pNavWin, + SfxBindings* _pBindings, + const SdNavigatorWin::UpdateRequestFunctor& rUpdateRequest) + : SfxControllerItem( _nId, *_pBindings ), + pNavigatorWin( pNavWin ), + maUpdateRequest(rUpdateRequest) { } diff --git a/sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.cxx b/sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.cxx index 4b9f3e8b7adb..16a96f2ecca0 100644 --- a/sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.cxx +++ b/sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.cxx @@ -150,9 +150,9 @@ void ConfigurationControllerResourceManager::ActivateResource ( // of registered factories. mpResourceFactoryContainer->RemoveFactoryForReference(xFactory); } - catch(Exception&) + catch (Exception& e) { - DBG_UNHANDLED_EXCEPTION(); + (void)e; } if (xResource.is()) @@ -187,9 +187,10 @@ void ConfigurationControllerResourceManager::ActivateResource ( /* In this method we do following steps. 1. Remove the resource from the URL->Object map of the configuration controller. - 2. Notify listeners. + 2. Notify listeners that deactivation has started. 3. Remove the resource id from the current configuration. 4. Release the resource. + 5. Notify listeners about that deactivation is completed. */ void ConfigurationControllerResourceManager::DeactivateResource ( const Reference<XResourceId>& rxResourceId, @@ -244,6 +245,12 @@ void ConfigurationControllerResourceManager::DeactivateResource ( DBG_UNHANDLED_EXCEPTION(); } + // 5. Notifiy listeners that the resource is being deactivated. + mpBroadcaster->NotifyListeners( + FrameworkHelper::msResourceDeactivationEndEvent, + rxResourceId, + NULL); + #if OSL_DEBUG_LEVEL >= 1 if (bSuccess) SAL_INFO("sd.fwk", OSL_THIS_FUNC << ": successfully deactivated " << OUStringToOString( diff --git a/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx b/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx index f059efdb8c81..90b1d4359508 100644 --- a/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx +++ b/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx @@ -32,6 +32,9 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::drawing::framework; +#undef VERBOSE +//#define VERBOSE 1 + namespace sd { namespace framework { ResourceFactoryManager::ResourceFactoryManager (const Reference<XControllerManager>& rxManager) @@ -75,10 +78,22 @@ void ResourceFactoryManager::AddFactory ( { // The URL is a URL pattern not an single URL. maFactoryPatternList.push_back(FactoryPatternList::value_type(rsURL, rxFactory)); + +#if defined VERBOSE && VERBOSE>=1 + OSL_TRACE("ResourceFactoryManager::AddFactory pattern %s %x\n", + OUStringToOString(rsURL, RTL_TEXTENCODING_UTF8).getStr(), + rxFactory.get()); +#endif } else { maFactoryMap[rsURL] = rxFactory; + +#if defined VERBOSE && VERBOSE>=1 + OSL_TRACE("ResourceFactoryManager::AddFactory fixed %s %x\n", + OUStringToOString(rsURL, RTL_TEXTENCODING_UTF8).getStr(), + rxFactory.get()); +#endif } } diff --git a/sd/source/ui/framework/factories/BasicPaneFactory.cxx b/sd/source/ui/framework/factories/BasicPaneFactory.cxx index 4d2651dff923..5c5a043d41c7 100644 --- a/sd/source/ui/framework/factories/BasicPaneFactory.cxx +++ b/sd/source/ui/framework/factories/BasicPaneFactory.cxx @@ -45,8 +45,7 @@ namespace { CenterPaneId, FullScreenPaneId, LeftImpressPaneId, - LeftDrawPaneId, - RightPaneId + LeftDrawPaneId }; static const sal_Int32 gnConfigurationUpdateStartEvent(0); @@ -194,7 +193,7 @@ void SAL_CALL BasicPaneFactory::initialize (const Sequence<Any>& aArguments) mxConfigurationControllerWeak = xCC; // Add pane factories for the two left panes (one for Impress and one for - // Draw), the center pane, and the right pane. + // Draw) and the center pane. if (xController.is() && xCC.is()) { PaneDescriptor aDescriptor; @@ -220,11 +219,6 @@ void SAL_CALL BasicPaneFactory::initialize (const Sequence<Any>& aArguments) aDescriptor.mePaneId = LeftDrawPaneId; mpPaneContainer->push_back(aDescriptor); xCC->addResourceFactory(aDescriptor.msPaneURL, this); - - aDescriptor.msPaneURL = FrameworkHelper::msRightPaneURL; - aDescriptor.mePaneId = RightPaneId; - mpPaneContainer->push_back(aDescriptor); - xCC->addResourceFactory(aDescriptor.msPaneURL, this); } // Register as configuration change listener. @@ -293,7 +287,6 @@ Reference<XResource> SAL_CALL BasicPaneFactory::createResource ( case LeftImpressPaneId: case LeftDrawPaneId: - case RightPaneId: xPane = CreateChildWindowPane( rxPaneId, *iDescriptor); @@ -479,11 +472,6 @@ Reference<XResource> BasicPaneFactory::CreateChildWindowPane ( nChildWindowId = ::sd::LeftPaneDrawChildWindow::GetChildWindowId(); break; - case RightPaneId: - pShell.reset(new ToolPanelPaneShell()); - nChildWindowId = ::sd::ToolPanelChildWindow::GetChildWindowId(); - break; - default: break; } diff --git a/sd/source/ui/framework/factories/BasicPaneFactory.hxx b/sd/source/ui/framework/factories/BasicPaneFactory.hxx index 472609a17677..de9c81b9d564 100644 --- a/sd/source/ui/framework/factories/BasicPaneFactory.hxx +++ b/sd/source/ui/framework/factories/BasicPaneFactory.hxx @@ -59,7 +59,6 @@ namespace sd { namespace framework { private:resource/pane/FullScreenPane private:resource/pane/LeftImpressPane private:resource/pane/LeftDrawPane - private:resource/pane/RightPane There are two left panes because this is (seems to be) the only way to show different titles for the left pane in Draw and Impress. */ diff --git a/sd/source/ui/framework/factories/BasicViewFactory.cxx b/sd/source/ui/framework/factories/BasicViewFactory.cxx index 927a26159cd4..78d79888a9bc 100644 --- a/sd/source/ui/framework/factories/BasicViewFactory.cxx +++ b/sd/source/ui/framework/factories/BasicViewFactory.cxx @@ -33,7 +33,6 @@ #include "DrawViewShell.hxx" #include "GraphicViewShell.hxx" #include "OutlineViewShell.hxx" -#include "taskpane/ToolPanelViewShell.hxx" #include "PresentationViewShell.hxx" #include "SlideSorterViewShell.hxx" #include "FrameView.hxx" @@ -319,7 +318,6 @@ void SAL_CALL BasicViewFactory::initialize (const Sequence<Any>& aArguments) mxConfigurationController->addResourceFactory(FrameworkHelper::msNotesViewURL, this); mxConfigurationController->addResourceFactory(FrameworkHelper::msHandoutViewURL, this); mxConfigurationController->addResourceFactory(FrameworkHelper::msPresentationViewURL, this); - mxConfigurationController->addResourceFactory(FrameworkHelper::msTaskPaneURL, this); mxConfigurationController->addResourceFactory(FrameworkHelper::msSlideSorterURL, this); } catch (RuntimeException&) @@ -449,15 +447,6 @@ void SAL_CALL BasicViewFactory::initialize (const Sequence<Any>& aArguments) &rWindow, pFrameView)); } - else if (rsViewURL.equals(FrameworkHelper::msTaskPaneURL)) - { - pViewShell.reset( - new ::sd::toolpanel::ToolPanelViewShell( - &rFrame, - *mpBase, - &rWindow, - pFrameView)); - } else if (rsViewURL.equals(FrameworkHelper::msSlideSorterURL)) { pViewShell = ::sd::slidesorter::SlideSorterViewShell::Create ( @@ -533,8 +522,6 @@ bool BasicViewFactory::IsCacheable (const ::boost::shared_ptr<ViewDescriptor>& r FrameworkHelper::msSlideSorterURL, FrameworkHelper::msLeftDrawPaneURL)); maCacheableResources.push_back(pHelper->CreateResourceId( FrameworkHelper::msSlideSorterURL, FrameworkHelper::msLeftImpressPaneURL)); - maCacheableResources.push_back(pHelper->CreateResourceId( - FrameworkHelper::msTaskPaneURL, FrameworkHelper::msRightPaneURL)); } ::std::vector<Reference<XResourceId> >::const_iterator iId; diff --git a/sd/source/ui/framework/factories/Pane.cxx b/sd/source/ui/framework/factories/Pane.cxx index 4eeb5c5f3e0c..30bcaa0f9c9f 100644 --- a/sd/source/ui/framework/factories/Pane.cxx +++ b/sd/source/ui/framework/factories/Pane.cxx @@ -75,6 +75,16 @@ void Pane::disposing (void) +void Pane::SetWindow (::Window* pWindow) +{ + OSL_TRACE("setting Pane::mpWindow to %x", pWindow); + mpWindow = pWindow; + mxWindow = VCLUnoHelper::GetInterface(mpWindow); +} + + + + //----- XPane ----------------------------------------------------------------- Reference<awt::XWindow> SAL_CALL Pane::getWindow (void) diff --git a/sd/source/ui/framework/factories/TaskPanelResource.cxx b/sd/source/ui/framework/factories/TaskPanelResource.cxx new file mode 100644 index 000000000000..f3201adea23d --- /dev/null +++ b/sd/source/ui/framework/factories/TaskPanelResource.cxx @@ -0,0 +1,129 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "precompiled_sd.hxx" + +#include "framework/TaskPanelResource.hxx" + +#include <vcl/window.hxx> +#include <toolkit/helper/vclunohelper.hxx> + + +using namespace css; +using namespace cssu; +using namespace cssdf; + + +namespace sd { namespace framework { + +namespace { + ::Window* GetWindowForResource ( + ViewShellBase& rViewShellBase, + const cssu::Reference<cssdf::XResourceId>& rxResourceId) + { + ::Window* pWindow = NULL; + if (rxResourceId.is() && rxResourceId->getAnchor().is()) + { + ::boost::shared_ptr<FrameworkHelper> pFrameworkHelper (FrameworkHelper::Instance(rViewShellBase)); + Reference<awt::XWindow> xWindow ( + pFrameworkHelper->GetPaneWindow(rxResourceId->getAnchor()->getAnchor())); + pWindow = VCLUnoHelper::GetWindow(xWindow); + } + return pWindow; + } +} + + + + +TaskPanelResource::TaskPanelResource ( + sidebar::SidebarViewShell& rSidebarViewShell, + sidebar::PanelId ePanelId, + const Reference<XResourceId>& rxResourceId) + : TaskPanelResourceInterfaceBase(m_aMutex), + mxResourceId(rxResourceId), + mpControl(rSidebarViewShell.CreatePanel( + GetWindowForResource(rSidebarViewShell.GetViewShellBase(), rxResourceId), + ePanelId)) +{ + if (mpControl.get() != NULL) + { + mpControl->Show(); + mpControl->GetParent()->Show(); + mpControl->AddEventListener(LINK(this,TaskPanelResource,WindowEventHandler)); + } +} + + + + +TaskPanelResource::~TaskPanelResource (void) +{ + mpControl.reset(); +} + + + + +void SAL_CALL TaskPanelResource::disposing () +{ + mpControl.reset(); +} + + + + +Reference<XResourceId> SAL_CALL TaskPanelResource::getResourceId () + throw (css::uno::RuntimeException) +{ + return mxResourceId; +} + + + + +sal_Bool SAL_CALL TaskPanelResource::isAnchorOnly (void) + throw (RuntimeException) +{ + return false; +} + + + + +::Window* TaskPanelResource::GetControl (void) const +{ + return mpControl.get(); +} + + + + +IMPL_LINK(TaskPanelResource,WindowEventHandler,VclWindowEvent*,pEvent) +{ + if (pEvent!=NULL && pEvent->GetId()==SFX_HINT_DYING) + { + // Somebody else deleted the window. Release our reference so + // that we do not delete it again. + mpControl.release(); + return sal_True; + } + else + return sal_False; +} + +} } // end of namespace sd::framework diff --git a/sd/source/ui/framework/factories/ViewShellWrapper.cxx b/sd/source/ui/framework/factories/ViewShellWrapper.cxx index e017cbf21566..1ff46da11d48 100644 --- a/sd/source/ui/framework/factories/ViewShellWrapper.cxx +++ b/sd/source/ui/framework/factories/ViewShellWrapper.cxx @@ -20,7 +20,6 @@ #include "framework/ViewShellWrapper.hxx" #include "framework/Pane.hxx" -#include "taskpane/ToolPanelViewShell.hxx" #include "sdpage.hxx" #include "ViewShell.hxx" #include "Window.hxx" @@ -55,7 +54,6 @@ using ::com::sun::star::awt::XWindow; using ::com::sun::star::rendering::XCanvas; using ::com::sun::star::lang::DisposedException; -using ::sd::toolpanel::ToolPanelViewShell; namespace sd { namespace framework { diff --git a/sd/source/ui/framework/module/ImpressModule.cxx b/sd/source/ui/framework/module/ImpressModule.cxx index 50e9cfb67f45..240a94a23cf3 100644 --- a/sd/source/ui/framework/module/ImpressModule.cxx +++ b/sd/source/ui/framework/module/ImpressModule.cxx @@ -47,7 +47,7 @@ void ImpressModule::Initialize (Reference<frame::XController>& rxController) FrameworkHelper::msLeftImpressPaneURL); new ToolPanelModule( rxController, - FrameworkHelper::msRightPaneURL); + FrameworkHelper::msSidebarViewURL); new ToolBarModule(rxController); new ShellStackGuard(rxController); } diff --git a/sd/source/ui/framework/module/ModuleController.cxx b/sd/source/ui/framework/module/ModuleController.cxx index 25abb78d2df9..1406d6e14d5a 100644 --- a/sd/source/ui/framework/module/ModuleController.cxx +++ b/sd/source/ui/framework/module/ModuleController.cxx @@ -282,10 +282,19 @@ void SAL_CALL ModuleController::requestResource (const OUString& rsResourceURL) // Create the factory service. Sequence<Any> aArguments(1); aArguments[0] <<= mxController; - xFactory = xContext->getServiceManager()->createInstanceWithArgumentsAndContext( - iFactory->second, - aArguments, - xContext); + OSL_TRACE("creating resource %s", + OUStringToOString(iFactory->second, RTL_TEXTENCODING_ASCII_US).getStr()); + try + { + xFactory = xContext->getServiceManager()->createInstanceWithArgumentsAndContext( + iFactory->second, + aArguments, + xContext); + } + catch (const Exception&) + { + OSL_TRACE("caught exception while creating factory."); + } // Remember that this factory has been instanced. (*mpLoadedFactories)[iFactory->second] = xFactory; diff --git a/sd/source/ui/framework/module/ToolPanelModule.cxx b/sd/source/ui/framework/module/ToolPanelModule.cxx index aa2c9e8a9e24..c607fbd3820a 100644 --- a/sd/source/ui/framework/module/ToolPanelModule.cxx +++ b/sd/source/ui/framework/module/ToolPanelModule.cxx @@ -42,9 +42,9 @@ namespace sd { namespace framework { ToolPanelModule::ToolPanelModule ( const Reference<frame::XController>& rxController, - const OUString& rsRightPaneURL) + const OUString& rsSidebarPaneURL) : ResourceManager(rxController, - FrameworkHelper::CreateResourceId(FrameworkHelper::msTaskPaneURL, rsRightPaneURL)), + FrameworkHelper::CreateResourceId(FrameworkHelper::msSidebarViewURL, rsSidebarPaneURL)), mxControllerManager(rxController,UNO_QUERY) { if (mxConfigurationController.is()) diff --git a/sd/source/ui/framework/tools/FrameworkHelper.cxx b/sd/source/ui/framework/tools/FrameworkHelper.cxx index fb7fa1a2a328..f3ed52523c39 100644 --- a/sd/source/ui/framework/tools/FrameworkHelper.cxx +++ b/sd/source/ui/framework/tools/FrameworkHelper.cxx @@ -17,7 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - #include <osl/time.h> #include "framework/FrameworkHelper.hxx" @@ -32,6 +31,7 @@ #include "DrawController.hxx" #include "app.hrc" #include <com/sun/star/drawing/framework/XControllerManager.hpp> +#include <com/sun/star/drawing/framework/XPane.hpp> #include <cppuhelper/compbase1.hxx> #include <svl/lstner.hxx> @@ -97,8 +97,10 @@ public: virtual ~CallbackCaller (void); virtual void SAL_CALL disposing (void); + // XEventListener virtual void SAL_CALL disposing (const lang::EventObject& rEvent) throw (RuntimeException); + // XConfigurationChangeListener virtual void SAL_CALL notifyConfigurationChange (const ConfigurationChangeEvent& rEvent) throw (RuntimeException); @@ -169,7 +171,7 @@ const OUString FrameworkHelper::msCenterPaneURL( msPaneURLPrefix + "CenterPane") const OUString FrameworkHelper::msFullScreenPaneURL( msPaneURLPrefix + "FullScreenPane"); const OUString FrameworkHelper::msLeftImpressPaneURL( msPaneURLPrefix + "LeftImpressPane"); const OUString FrameworkHelper::msLeftDrawPaneURL( msPaneURLPrefix + "LeftDrawPane"); -const OUString FrameworkHelper::msRightPaneURL( msPaneURLPrefix + "RightPane"); +const OUString FrameworkHelper::msSidebarPaneURL( msPaneURLPrefix + "SidebarPane"); // View URLs. @@ -182,7 +184,7 @@ const OUString FrameworkHelper::msNotesViewURL( msViewURLPrefix + "NotesView"); const OUString FrameworkHelper::msHandoutViewURL( msViewURLPrefix + "HandoutView"); const OUString FrameworkHelper::msSlideSorterURL( msViewURLPrefix + "SlideSorter"); const OUString FrameworkHelper::msPresentationViewURL( msViewURLPrefix + "PresentationView"); -const OUString FrameworkHelper::msTaskPaneURL( msViewURLPrefix + "TaskPane"); +const OUString FrameworkHelper::msSidebarViewURL( msViewURLPrefix + "SidebarView"); // Tool bar URLs. @@ -192,21 +194,25 @@ const OUString FrameworkHelper::msViewTabBarURL( msToolBarURLPrefix + "ViewTabBa // Task panel URLs. -const OUString FrameworkHelper::msTaskPanelURLPrefix("private:resource/toolpanel/DrawingFramework/"); +const OUString FrameworkHelper::msTaskPanelURLPrefix( "private:resource/toolpanel/" ); const OUString FrameworkHelper::msMasterPagesTaskPanelURL( msTaskPanelURLPrefix + "MasterPages"); -const OUString FrameworkHelper::msLayoutTaskPanelURL( msTaskPanelURLPrefix + "Layouts"); -const OUString FrameworkHelper::msTableDesignPanelURL( msTaskPanelURLPrefix + "TableDesign"); -const OUString FrameworkHelper::msCustomAnimationTaskPanelURL( msTaskPanelURLPrefix + "CustomAnimations"); -const OUString FrameworkHelper::msSlideTransitionTaskPanelURL( msTaskPanelURLPrefix + "SlideTransitions"); +const OUString FrameworkHelper::msAllMasterPagesTaskPanelURL( msTaskPanelURLPrefix + "AllMasterPages" ); +const OUString FrameworkHelper::msRecentMasterPagesTaskPanelURL( msTaskPanelURLPrefix + "RecentMasterPages" ); +const OUString FrameworkHelper::msUsedMasterPagesTaskPanelURL( msTaskPanelURLPrefix + "UsedMasterPages" ); +const OUString FrameworkHelper::msLayoutTaskPanelURL( msTaskPanelURLPrefix + "Layouts" ); +const OUString FrameworkHelper::msTableDesignPanelURL( msTaskPanelURLPrefix + "TableDesign" ); +const OUString FrameworkHelper::msCustomAnimationTaskPanelURL( msTaskPanelURLPrefix + "CustomAnimations" ); +const OUString FrameworkHelper::msSlideTransitionTaskPanelURL( msTaskPanelURLPrefix + "SlideTransitions" ); // Event URLs. -const OUString FrameworkHelper::msResourceActivationRequestEvent("ResourceActivationRequested"); -const OUString FrameworkHelper::msResourceDeactivationRequestEvent("ResourceDeactivationRequest"); -const OUString FrameworkHelper::msResourceActivationEvent("ResourceActivation"); -const OUString FrameworkHelper::msResourceDeactivationEvent("ResourceDeactivation"); -const OUString FrameworkHelper::msConfigurationUpdateStartEvent("ConfigurationUpdateStart"); -const OUString FrameworkHelper::msConfigurationUpdateEndEvent("ConfigurationUpdateEnd"); +const OUString FrameworkHelper::msResourceActivationRequestEvent( "ResourceActivationRequested" ); +const OUString FrameworkHelper::msResourceDeactivationRequestEvent( "ResourceDeactivationRequest" ); +const OUString FrameworkHelper::msResourceActivationEvent( "ResourceActivation" ); +const OUString FrameworkHelper::msResourceDeactivationEvent( "ResourceDeactivation" ); +const OUString FrameworkHelper::msResourceDeactivationEndEvent( "ResourceDeactivationEnd" ); +const OUString FrameworkHelper::msConfigurationUpdateStartEvent( "ConfigurationUpdateStart" ); +const OUString FrameworkHelper::msConfigurationUpdateEndEvent( "ConfigurationUpdateEnd" ); // Service names of controllers. @@ -301,6 +307,20 @@ private: +//----- FrameworkHelper::Deleter ---------------------------------------------- + +class FrameworkHelper::Deleter +{ +public: + void operator()(FrameworkHelper* pObject) + { + delete pObject; + } +}; + + + + //----- FrameworkHelper ------------------------------------------------------- ::boost::scoped_ptr<FrameworkHelper::ViewURLMap> FrameworkHelper::mpViewURLMap(new ViewURLMap()); @@ -345,7 +365,9 @@ FrameworkHelper::InstanceMap FrameworkHelper::maInstanceMap; ::osl::MutexGuard aGuard (aMutexFunctor()); if (iHelper == maInstanceMap.end()) { - pHelper = ::boost::shared_ptr<FrameworkHelper>(new FrameworkHelper(rBase)); + pHelper = ::boost::shared_ptr<FrameworkHelper>( + new FrameworkHelper(rBase), + FrameworkHelper::Deleter()); pHelper->Initialize(); OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER(); SdGlobalResourceContainer::Instance().AddResource(pHelper); @@ -489,6 +511,61 @@ Reference<XView> FrameworkHelper::GetView (const Reference<XResourceId>& rxPaneO +Reference<awt::XWindow> FrameworkHelper::GetPaneWindow (const Reference<XResourceId>& rxPaneId) +{ + Reference<awt::XWindow> xWindow; + + if (rxPaneId.is() && mxConfigurationController.is()) + { + try + { + if (rxPaneId->getResourceURL().match(msPaneURLPrefix)) + { + Reference<XPane> xPane (mxConfigurationController->getResource(rxPaneId), UNO_QUERY); + if (xPane.is()) + xWindow = xPane->getWindow(); + } + } + catch (lang::DisposedException&) + { + Dispose(); + } + catch (RuntimeException&) + { + } + } + + return xWindow; +} + + + + +Reference<XResource> FrameworkHelper::GetResource (const Reference<XResourceId>& rxResourceId) +{ + Reference<XResource> xResource; + + if (rxResourceId.is() && mxConfigurationController.is()) + { + try + { + return mxConfigurationController->getResource(rxResourceId); + } + catch (lang::DisposedException&) + { + Dispose(); + } + catch (RuntimeException&) + { + } + } + + return NULL; +} + + + + Reference<XResourceId> FrameworkHelper::RequestView ( const OUString& rsResourceURL, const OUString& rsAnchorURL) @@ -524,7 +601,7 @@ Reference<XResourceId> FrameworkHelper::RequestView ( -void FrameworkHelper::RequestTaskPanel ( +Reference<XResourceId> FrameworkHelper::RequestSidebarPanel ( const OUString& rsTaskPanelURL, const bool bEnsureTaskPaneIsVisible) { @@ -537,26 +614,29 @@ void FrameworkHelper::RequestTaskPanel ( { Reference<XConfiguration> xConfiguration ( mxConfigurationController->getCurrentConfiguration()); - if (xConfiguration.is()) - if ( ! xConfiguration->hasResource( - CreateResourceId(msTaskPaneURL, msRightPaneURL))) - { - // Task pane does is not active. Do not force it. - return; - } + if (xConfiguration.is()) + if ( ! xConfiguration->hasResource( + CreateResourceId(msSidebarViewURL, msSidebarPaneURL))) + { + // Task pane is not active. Do not force it. + return NULL; + } } - // Create the resource id from URLs for the pane, the task pane - // view, and the task panel. + // Create the resource id from URLs for the sidebar pane + // and view and the requested panel. mxConfigurationController->requestResourceActivation( - CreateResourceId(msRightPaneURL), + CreateResourceId(msSidebarPaneURL), ResourceActivationMode_ADD); mxConfigurationController->requestResourceActivation( - CreateResourceId(msTaskPaneURL, msRightPaneURL), + CreateResourceId(msSidebarViewURL, msSidebarPaneURL), ResourceActivationMode_REPLACE); + Reference<XResourceId> xPanelId (CreateResourceId(rsTaskPanelURL, msSidebarViewURL, msSidebarPaneURL)); mxConfigurationController->requestResourceActivation( - CreateResourceId(rsTaskPanelURL, msTaskPaneURL, msRightPaneURL), + xPanelId, ResourceActivationMode_REPLACE); + + return xPanelId; } } catch (lang::DisposedException&) @@ -565,6 +645,26 @@ void FrameworkHelper::RequestTaskPanel ( } catch (RuntimeException&) {} + + return NULL; +} + + + + +void FrameworkHelper::RequestResourceDeactivation (const cssu::Reference<cssdf::XResourceId>& rxResourceId) +{ + try + { + if (mxConfigurationController.is() && rxResourceId.is()) + mxConfigurationController->requestResourceDeactivation(rxResourceId); + } + catch (lang::DisposedException&) + { + Dispose(); + } + catch (RuntimeException&) + {} } @@ -582,6 +682,7 @@ ViewShell::ShellType FrameworkHelper::GetViewId (const OUString& rsViewURL) (*mpViewURLMap)[msSlideSorterURL] = ViewShell::ST_SLIDE_SORTER; (*mpViewURLMap)[msPresentationViewURL] = ViewShell::ST_PRESENTATION; (*mpViewURLMap)[msTaskPaneURL] = ViewShell::ST_TASK_PANE; + (*mpViewURLMap)[msSidebarViewURL] = ViewShell::ST_SIDEBAR; } ViewURLMap::const_iterator iView (mpViewURLMap->find(rsViewURL)); if (iView != mpViewURLMap->end()) @@ -605,6 +706,7 @@ OUString FrameworkHelper::GetViewURL (ViewShell::ShellType eType) case ViewShell::ST_SLIDE_SORTER : return msSlideSorterURL; case ViewShell::ST_PRESENTATION : return msPresentationViewURL; case ViewShell::ST_TASK_PANE : return msTaskPaneURL; + case ViewShell::ST_SIDEBAR : return msSidebarViewURL; default: return OUString(); } @@ -753,6 +855,30 @@ void FrameworkHelper::RunOnResourceActivation( +void FrameworkHelper::RunOnResourceDeactivation( + const css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId, + const Callback& rCallback, + const bool bRunOnDeactivationEnd) +{ + if (mxConfigurationController.is() + && ! mxConfigurationController->getResource(rxResourceId).is()) + { + rCallback(false); + } + else + { + RunOnEvent( + bRunOnDeactivationEnd + ? msResourceDeactivationEndEvent + : msResourceDeactivationEvent, + FrameworkHelperResourceIdFilter(rxResourceId), + rCallback); + } +} + + + + /** A callback that sets a flag to a specified value when the callback is called. */ diff --git a/sd/source/ui/func/fuarea.cxx b/sd/source/ui/func/fuarea.cxx index bf1727480388..a4a35c81364a 100644 --- a/sd/source/ui/func/fuarea.cxx +++ b/sd/source/ui/func/fuarea.cxx @@ -77,6 +77,8 @@ void FuArea::DoExecute( SfxRequest& rReq ) SID_ATTR_FILL_GRADIENT, SID_ATTR_FILL_HATCH, SID_ATTR_FILL_BITMAP, + SID_ATTR_FILL_TRANSPARENCE, + SID_ATTR_FILL_FLOATTRANSPARENCE, 0 }; mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray ); diff --git a/sd/source/ui/func/fuchar.cxx b/sd/source/ui/func/fuchar.cxx index c288767a55a6..0b2750e7eff7 100644 --- a/sd/source/ui/func/fuchar.cxx +++ b/sd/source/ui/func/fuchar.cxx @@ -18,7 +18,7 @@ */ #include "fuchar.hxx" - +#include <svx/dialogs.hrc> #include <sfx2/viewfrm.hxx> #include <editeng/editdata.hxx> @@ -74,6 +74,10 @@ void FuChar::DoExecute( SfxRequest& rReq ) SfxAbstractTabDialog* pDlg = pFact ? pFact->CreateSdTabCharDialog( NULL, &aNewAttr, mpDoc->GetDocSh() ) : 0; if( pDlg ) { + if (rReq.GetSlot() == SID_CHAR_DLG_EFFECT) + { + pDlg->SetCurPageId(RID_SVXPAGE_CHAR_EFFECTS); + } sal_uInt16 nResult = pDlg->Execute(); if( nResult == RET_OK ) @@ -97,9 +101,12 @@ void FuChar::DoExecute( SfxRequest& rReq ) SID_ATTR_CHAR_FONT, SID_ATTR_CHAR_POSTURE, SID_ATTR_CHAR_WEIGHT, + SID_ATTR_CHAR_SHADOWED, + SID_ATTR_CHAR_STRIKEOUT, SID_ATTR_CHAR_UNDERLINE, SID_ATTR_CHAR_FONTHEIGHT, SID_ATTR_CHAR_COLOR, + SID_ATTR_CHAR_KERNING, SID_SET_SUPER_SCRIPT, SID_SET_SUB_SCRIPT, 0 }; diff --git a/sd/source/ui/func/fuline.cxx b/sd/source/ui/func/fuline.cxx index 3e1d9d02ed7f..cd33f409ffa9 100644 --- a/sd/source/ui/func/fuline.cxx +++ b/sd/source/ui/func/fuline.cxx @@ -84,11 +84,16 @@ void FuLine::DoExecute( SfxRequest& rReq ) // some attributes are changed, we have to update the listboxes in the objectbars static sal_uInt16 SidArray[] = { - SID_ATTR_LINE_STYLE, - SID_ATTR_LINE_DASH, - 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 }; mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray ); diff --git a/sd/source/ui/func/fuolbull.cxx b/sd/source/ui/func/fuolbull.cxx index ae290329fbff..c029edabac7a 100644 --- a/sd/source/ui/func/fuolbull.cxx +++ b/sd/source/ui/func/fuolbull.cxx @@ -23,6 +23,9 @@ #include <editeng/outliner.hxx> #include <editeng/eeitem.hxx> #include <sfx2/request.hxx> +#include <editeng/numitem.hxx> +#include "sdresid.hxx" +#include "glob.hrc" #include <editeng/editdata.hxx> #include <svx/svxids.hrc> @@ -32,7 +35,11 @@ #include "Window.hxx" #include "drawdoc.hxx" #include "sdabstdlg.hxx" - +#include <svx/nbdtmg.hxx> +#include <svx/nbdtmgfact.hxx> +#include <svx/svdoutl.hxx> +#include <boost/scoped_ptr.hpp> +using namespace svx::sidebar; namespace sd { TYPEINIT1( FuOutlineBullet, FuPoor ); @@ -54,6 +61,16 @@ FunctionReference FuOutlineBullet::Create( ViewShell* pViewSh, ::sd::Window* pWi void FuOutlineBullet::DoExecute( SfxRequest& rReq ) { + sal_uInt16 nSId = rReq.GetSlot(); + if (nSId == FN_SVX_SET_BULLET){ + SetCurrentBullet(rReq); + return; + } + else if (nSId == FN_SVX_SET_NUMBER){ + SetCurrentNumbering(rReq); + return; + } + const SfxItemSet* pArgs = rReq.GetArgs(); if( !pArgs ) @@ -81,9 +98,7 @@ void FuOutlineBullet::DoExecute( SfxRequest& rReq ) OutlinerView* pOLV = mpView->GetTextEditOutlinerView(); - SAL_WNODEPRECATED_DECLARATIONS_PUSH - std::auto_ptr< OutlineViewModelChangeGuard > aGuard; - SAL_WNODEPRECATED_DECLARATIONS_POP + boost::scoped_ptr< OutlineViewModelChangeGuard > aGuard; if (mpView->ISA(OutlineView)) { @@ -122,7 +137,391 @@ void FuOutlineBullet::DoExecute( SfxRequest& rReq ) */ } +void FuOutlineBullet::SetCurrentNumbering(SfxRequest& rReq) +{ + if (!mpDoc || !mpView) + return; + + SfxItemSet aEditAttr( mpDoc->GetPool() ); + mpView->GetAttributes( aEditAttr ); + + SfxItemSet aNewAttr( mpViewShell->GetPool(), + EE_ITEMS_START, EE_ITEMS_END ); + aNewAttr.Put( aEditAttr, sal_False ); + + SfxItemSet aSetAttr( mpViewShell->GetPool(), + EE_ITEMS_START, EE_ITEMS_END ); + + //Init bullet level in "Customize" tab page in bullet dialog in master page view + if( mpView && mpViewShell && mpViewShell->ISA(DrawViewShell) + && ((DrawViewShell *)mpViewShell)->GetEditMode() == EM_MASTERPAGE ) + { + SdrObject* pObj = mpView->GetTextEditObject(); + if( pObj && pObj->GetObjIdentifier() == OBJ_OUTLINETEXT ) + { + sal_uInt16 nLevel = mpView->GetSelectionLevel(); + if( nLevel != 0xFFFF ) + { + + SfxItemSet aStoreSet( aNewAttr ); + aNewAttr.ClearItem(); + //extend range + aNewAttr.MergeRange( SID_PARAM_NUM_PRESET, SID_PARAM_CUR_NUM_LEVEL ); + aNewAttr.Put( aStoreSet ); + //put current level user selected + aNewAttr.Put( SfxUInt16Item( SID_PARAM_CUR_NUM_LEVEL, nLevel ) ); + } + } + } + //End of add + + sal_uInt16 nActNumLvl = (sal_uInt16)0xFFFF; + SvxNumRule* pNumRule = NULL; + const SfxPoolItem* pTmpItem=NULL; + sal_uInt32 nNumItemId = SID_ATTR_NUMBERING_RULE; + + if(SFX_ITEM_SET == aNewAttr.GetItemState(SID_PARAM_CUR_NUM_LEVEL, sal_False, &pTmpItem)) + nActNumLvl = ((const SfxUInt16Item*)pTmpItem)->GetValue(); + + pTmpItem=GetNumBulletItem(aNewAttr, nNumItemId); + + if (pTmpItem) + pNumRule = new SvxNumRule(*((SvxNumBulletItem*)pTmpItem)->GetNumRule()); + + SFX_REQUEST_ARG( rReq, pItem, SfxUInt16Item, FN_SVX_SET_NUMBER , sal_False ); + if (pItem && pNumRule) + { + sal_uInt16 nIdx = pItem->GetValue(); + // If the nIdx is (sal_uInt16)0xFFFF, means set bullet status to on/off + // And the bullet default status is 1. + bool bBulletSwitch = false; + sal_Bool isRemoveNum =false; + if( nIdx == (sal_uInt16)0xFFFF ) + { + nIdx = 1; + bBulletSwitch = true; + } + if (nIdx == DEFAULT_NONE) + { + bBulletSwitch = false; + isRemoveNum = true; + } + nIdx--; + + NBOTypeMgrBase* pNumbering = NBOutlineTypeMgrFact::CreateInstance(eNBOType::NUMBERING); + if ( pNumbering ) + { + //Sym3_2508, set unit attribute to NB Manager + pNumbering->SetItems(&aNewAttr); + SvxNumRule aTmpRule( *pNumRule ); + pNumbering->ApplyNumRule(aTmpRule,nIdx,nActNumLvl); + sal_uInt16 nMask = 1; + for(sal_uInt16 i = 0; i < pNumRule->GetLevelCount(); i++) + { + if(nActNumLvl & nMask) + { + SvxNumberFormat aFmt(aTmpRule.GetLevel(i)); + pNumRule->SetLevel(i, aFmt); + } + nMask <<= 1 ; + } + aSetAttr.Put(SvxNumBulletItem( *pNumRule ), nNumItemId); + OutlinerView* pOLV = mpView->GetTextEditOutlinerView(); + + boost::scoped_ptr< OutlineViewModelChangeGuard > aGuard; + + if (mpView->ISA(OutlineView)) + { + pOLV = static_cast<OutlineView*>(mpView) + ->GetViewByWindow(mpViewShell->GetActiveWindow()); + + aGuard.reset( new OutlineViewModelChangeGuard( static_cast<OutlineView&>(*mpView) ) ); + } + + SdrOutliner* pOwner = mpView->GetTextEditOutliner(); + bool bMasterView = false; + + DrawViewShell* pDrawViewShell = static_cast< DrawViewShell* >(mpViewShell); + + if ( pOwner && pDrawViewShell && pDrawViewShell->GetEditMode() == EM_MASTERPAGE ) + bMasterView = !pOwner->IsInUndo() && pOwner->IsUndoEnabled(); + + if( bMasterView ) + { + pOwner->UndoActionStart( OLUNDO_ATTR ); + pOLV->ToggleBullets( bBulletSwitch, sal_False, bMasterView, pNumRule,isRemoveNum); + mpView->SetAttributes(aSetAttr); //Modify for Sym2_3151 + pOwner->UndoActionEnd( OLUNDO_ATTR ); + } + else if( pOLV ) + pOLV->ToggleBullets( bBulletSwitch, sal_False, bMasterView, pNumRule ,isRemoveNum); + else + { + sal_Bool bInMasterView = pDrawViewShell && pDrawViewShell->GetEditMode() == EM_MASTERPAGE; + SdrModel* pSdrModel = mpView->GetModel(); + sal_Bool bModelUndoEnabled = pSdrModel ? pSdrModel->IsUndoEnabled() : sal_False; + if (bInMasterView && bModelUndoEnabled) + { + pSdrModel->BegUndo(); + } + mpView->ToggleMarkedObjectsBullets(bBulletSwitch, sal_False, bInMasterView, pNumRule,isRemoveNum); + if (bInMasterView) + { + mpView->SetAttributes(aSetAttr); + } + if (bInMasterView && bModelUndoEnabled) + { + pSdrModel->EndUndo(); + } + } + } + //End + } + delete pNumRule; + rReq.Done(); +} + +void FuOutlineBullet::SetCurrentBullet(SfxRequest& rReq) +{ + if (!mpDoc || !mpView) + return; + + SfxItemSet aEditAttr( mpDoc->GetPool() ); + mpView->GetAttributes( aEditAttr ); + + SfxItemSet aNewAttr( mpViewShell->GetPool(), + EE_ITEMS_START, EE_ITEMS_END ); + aNewAttr.Put( aEditAttr, sal_False ); + + //Add for Sym2_3151, should add new attributes in an empty item set, then use this item set as parameter in SetAttributes() + SfxItemSet aSetAttr( mpViewShell->GetPool(), + EE_ITEMS_START, EE_ITEMS_END ); + + //Init bullet level in "Customize" tab page in bullet dialog in master page view + if( mpView && mpViewShell && mpViewShell->ISA(DrawViewShell) + && ((DrawViewShell *)mpViewShell)->GetEditMode() == EM_MASTERPAGE ) + { + SdrObject* pObj = mpView->GetTextEditObject(); + if( pObj && pObj->GetObjIdentifier() == OBJ_OUTLINETEXT ) + { + sal_uInt16 nLevel = mpView->GetSelectionLevel(); + if( nLevel != 0xFFFF ) + { + //aNewAttr.MergeRange( SID_ATTR_NUMBERING_RULE, SID_PARAM_CUR_NUM_LEVEL ); + //aNewAttr.Put( SfxUInt16Item( SID_PARAM_CUR_NUM_LEVEL, nLevel ) ); + //save the itemset value + SfxItemSet aStoreSet( aNewAttr ); + aNewAttr.ClearItem(); + //extend range + aNewAttr.MergeRange( SID_PARAM_NUM_PRESET, SID_PARAM_CUR_NUM_LEVEL ); + aNewAttr.Put( aStoreSet ); + //put current level user selected + aNewAttr.Put( SfxUInt16Item( SID_PARAM_CUR_NUM_LEVEL, nLevel ) ); + } + } + } + //End of add + + sal_uInt16 nActNumLvl = (sal_uInt16)0xFFFF; + SvxNumRule* pNumRule = NULL; + const SfxPoolItem* pTmpItem=NULL; + sal_uInt32 nNumItemId = SID_ATTR_NUMBERING_RULE; + + if(SFX_ITEM_SET == aNewAttr.GetItemState(SID_PARAM_CUR_NUM_LEVEL, sal_False, &pTmpItem)) + nActNumLvl = ((const SfxUInt16Item*)pTmpItem)->GetValue(); + + pTmpItem=GetNumBulletItem(aNewAttr, nNumItemId); + + if (pTmpItem) + pNumRule = new SvxNumRule(*((SvxNumBulletItem*)pTmpItem)->GetNumRule()); + + SFX_REQUEST_ARG( rReq, pItem, SfxUInt16Item, FN_SVX_SET_BULLET , sal_False ); + if (pItem && pNumRule) + { + sal_uInt16 nIdx = pItem->GetValue(); + // If the nIdx is (sal_uInt16)0xFFFF, means set bullet status to on/off + // And the bullet default status is 2. + bool bBulletSwitch = false; + sal_Bool isRemoveNum =false; + if( nIdx == (sal_uInt16)0xFFFF ) + { + nIdx = 1; + bBulletSwitch = true; + } + if (nIdx == DEFAULT_NONE) + { + bBulletSwitch = false; + isRemoveNum = true; + } + + nIdx--; + //Modified for Numbering&Bullets Dialog UX Enh(Story 992) by chengjh,2011.8.7 + + NBOTypeMgrBase* pBullets = NBOutlineTypeMgrFact::CreateInstance(eNBOType::MIXBULLETS); + if ( pBullets ) + { + //Sym3_2508, set unit attribute to NB Manager + pBullets->SetItems(&aNewAttr); + SvxNumRule aTmpRule( *pNumRule ); + //Sym3_3423 Always apply the "." if wants a default numbering rule + if (bBulletSwitch==true && nIdx==0) //want to reset bullet + { + pBullets->ApplyNumRule(aTmpRule,nIdx,nActNumLvl,true); + } + else { + pBullets->ApplyNumRule(aTmpRule,nIdx,nActNumLvl); + } + sal_uInt16 nMask = 1; + for(sal_uInt16 i = 0; i < pNumRule->GetLevelCount(); i++) + { + if(nActNumLvl & nMask) + { + SvxNumberFormat aFmt(aTmpRule.GetLevel(i)); + pNumRule->SetLevel(i, aFmt); + } + nMask <<= 1; + } + aSetAttr.Put(SvxNumBulletItem( *pNumRule ), nNumItemId); + + OutlinerView* pOLV = mpView->GetTextEditOutlinerView(); + + boost::scoped_ptr< OutlineViewModelChangeGuard > aGuard; + + if (mpView->ISA(OutlineView)) + { + pOLV = static_cast<OutlineView*>(mpView) + ->GetViewByWindow(mpViewShell->GetActiveWindow()); + + aGuard.reset( new OutlineViewModelChangeGuard( static_cast<OutlineView&>(*mpView) ) ); + } + + SdrOutliner* pOwner = mpView->GetTextEditOutliner(); + bool bMasterView = false; + + DrawViewShell* pDrawViewShell = static_cast< DrawViewShell* >(mpViewShell); + + if ( pOwner && pDrawViewShell && pDrawViewShell->GetEditMode() == EM_MASTERPAGE ) + bMasterView = !pOwner->IsInUndo() && pOwner->IsUndoEnabled(); + + if( bMasterView ) + { + pOwner->UndoActionStart( OLUNDO_ATTR ); + pOLV->ToggleBullets( bBulletSwitch, sal_True, bMasterView, pNumRule, isRemoveNum ); + mpView->SetAttributes(aSetAttr); //Modify for Sym2_3151 + pOwner->UndoActionEnd( OLUNDO_ATTR ); + } + else if( pOLV ) + pOLV->ToggleBullets( bBulletSwitch, sal_True, bMasterView, pNumRule, isRemoveNum ); + else + { + sal_Bool bInMasterView = pDrawViewShell && pDrawViewShell->GetEditMode() == EM_MASTERPAGE; + SdrModel* pSdrModel = mpView->GetModel(); + sal_Bool bModelUndoEnabled = pSdrModel ? pSdrModel->IsUndoEnabled() : sal_False; + if (bInMasterView && bModelUndoEnabled) + { + pSdrModel->BegUndo(); + } + mpView->ToggleMarkedObjectsBullets(bBulletSwitch, sal_True, bInMasterView, pNumRule, isRemoveNum ); + if (bInMasterView) + { + mpView->SetAttributes(aSetAttr); + } + if (bInMasterView && bModelUndoEnabled) + { + pSdrModel->EndUndo(); + } + } + } + //End + } + delete pNumRule; + rReq.Done(); +} + +const SfxPoolItem* FuOutlineBullet::GetNumBulletItem(SfxItemSet& aNewAttr, sal_uInt32& nNumItemId) +{ + //SvxNumBulletItem* pRetItem = NULL; + const SfxPoolItem* pTmpItem = NULL; + + if(aNewAttr.GetItemState(nNumItemId, sal_False, &pTmpItem) == SFX_ITEM_SET) + { + return pTmpItem; + } + else + { + nNumItemId = aNewAttr.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE); + SfxItemState eState = aNewAttr.GetItemState(nNumItemId, sal_False, &pTmpItem); + if (eState == SFX_ITEM_SET) + return pTmpItem; + else + { + sal_Bool bOutliner = sal_False; + sal_Bool bTitle = sal_False; + + if( mpView ) + { + const SdrMarkList& rMarkList = mpView->GetMarkedObjectList(); + const sal_uInt32 nCount = rMarkList.GetMarkCount(); + + for(sal_uInt32 nNum = 0; nNum < nCount; nNum++) + { + SdrObject* pObj = rMarkList.GetMark(nNum)->GetMarkedSdrObj(); + if( pObj->GetObjInventor() == SdrInventor ) + { + switch(pObj->GetObjIdentifier()) + { + case OBJ_TITLETEXT: + bTitle = sal_True; + break; + case OBJ_OUTLINETEXT: + bOutliner = sal_True; + break; + } + } + } + } + + const SvxNumBulletItem *pItem = NULL; + if(bOutliner) + { + SfxStyleSheetBasePool* pSSPool = mpView->GetDocSh()->GetStyleSheetPool(); + String aStyleName((SdResId((sal_uInt16)STR_LAYOUT_OUTLINE))); + aStyleName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " 1" ) ); + SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find( aStyleName, SD_STYLE_FAMILY_PSEUDO); + if( pFirstStyleSheet ) + pFirstStyleSheet->GetItemSet().GetItemState(EE_PARA_NUMBULLET, sal_False, (const SfxPoolItem**)&pItem); + } + + if( pItem == NULL ) + pItem = (SvxNumBulletItem*) aNewAttr.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET); + + //DBG_ASSERT( pItem, "Kein EE_PARA_NUMBULLET im Pool! [CL]" ); + + aNewAttr.Put(*pItem, EE_PARA_NUMBULLET); + + if(bTitle && aNewAttr.GetItemState(EE_PARA_NUMBULLET,sal_True) == SFX_ITEM_ON ) + { + SvxNumBulletItem* pBulletItem = (SvxNumBulletItem*)aNewAttr.GetItem(EE_PARA_NUMBULLET,sal_True); + SvxNumRule* pLclRule = pBulletItem->GetNumRule(); + if(pLclRule) + { + SvxNumRule aNewRule( *pLclRule ); + aNewRule.SetFeatureFlag( NUM_NO_NUMBERS, sal_True ); + + SvxNumBulletItem aNewItem( aNewRule, EE_PARA_NUMBULLET ); + aNewAttr.Put(aNewItem); + } + } + SfxItemState eItemState = aNewAttr.GetItemState(nNumItemId, sal_False, &pTmpItem); + if (eItemState == SFX_ITEM_SET) + return pTmpItem; + + } + //DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!") + } + return pTmpItem; +} } // end of namespace sd diff --git a/sd/source/ui/func/fuoltext.cxx b/sd/source/ui/func/fuoltext.cxx index 250319e63e88..c1f259f4bfc4 100644 --- a/sd/source/ui/func/fuoltext.cxx +++ b/sd/source/ui/func/fuoltext.cxx @@ -51,9 +51,12 @@ static sal_uInt16 SidArray[] = { SID_ATTR_CHAR_FONT, SID_ATTR_CHAR_POSTURE, SID_ATTR_CHAR_WEIGHT, + SID_ATTR_CHAR_SHADOWED, + SID_ATTR_CHAR_STRIKEOUT, SID_ATTR_CHAR_UNDERLINE, SID_ATTR_CHAR_FONTHEIGHT, SID_ATTR_CHAR_COLOR, + SID_ATTR_CHAR_KERNING, SID_OUTLINE_UP, SID_OUTLINE_DOWN, SID_OUTLINE_LEFT, diff --git a/sd/source/ui/func/fuparagr.cxx b/sd/source/ui/func/fuparagr.cxx index 0c903f2e1f2f..7a0056a5ca06 100644 --- a/sd/source/ui/func/fuparagr.cxx +++ b/sd/source/ui/func/fuparagr.cxx @@ -138,6 +138,8 @@ void FuParagraph::DoExecute( SfxRequest& rReq ) // invalidate slots static sal_uInt16 SidArray[] = { SID_ATTR_TABSTOP, + SID_ATTR_PARA_LINESPACE, + SID_ATTR_PARA_ULSPACE, SID_ATTR_PARA_ADJUST_LEFT, SID_ATTR_PARA_ADJUST_RIGHT, SID_ATTR_PARA_ADJUST_CENTER, diff --git a/sd/source/ui/func/futext.cxx b/sd/source/ui/func/futext.cxx index a6c04a596925..6784daa67140 100644 --- a/sd/source/ui/func/futext.cxx +++ b/sd/source/ui/func/futext.cxx @@ -85,9 +85,12 @@ static sal_uInt16 SidArray[] = { SID_ATTR_CHAR_FONT, // 10007 SID_ATTR_CHAR_POSTURE, // 10008 SID_ATTR_CHAR_WEIGHT, // 10009 + SID_ATTR_CHAR_SHADOWED, //10010 + SID_ATTR_CHAR_STRIKEOUT, //10013 SID_ATTR_CHAR_UNDERLINE, // 10014 SID_ATTR_CHAR_FONTHEIGHT, // 10015 SID_ATTR_CHAR_COLOR, // 10017 + SID_ATTR_CHAR_KERNING, //10018 SID_ATTR_PARA_ADJUST_LEFT, // 10028 SID_ATTR_PARA_ADJUST_RIGHT, // 10029 SID_ATTR_PARA_ADJUST_CENTER, // 10030 @@ -95,14 +98,26 @@ static sal_uInt16 SidArray[] = { SID_ATTR_PARA_LINESPACE_10, // 10034 SID_ATTR_PARA_LINESPACE_15, // 10035 SID_ATTR_PARA_LINESPACE_20, // 10036 + SID_ATTR_PARA_ULSPACE, // 10042 SID_ATTR_PARA_LRSPACE, // 10043 + SID_ATTR_TRANSFORM_POS_X, // 10088 + SID_ATTR_TRANSFORM_POS_Y, // 10089 + SID_ATTR_TRANSFORM_WIDTH, // 10090 + SID_ATTR_TRANSFORM_HEIGHT,// 10091 + SID_ATTR_TRANSFORM_ROT_X, // 10093 + SID_ATTR_TRANSFORM_ROT_Y, // 10094 + SID_ATTR_TRANSFORM_ANGLE, // 10095 //Added SID_OUTLINE_UP, // 10150 SID_OUTLINE_DOWN, // 10151 SID_OUTLINE_LEFT, // 10152 SID_OUTLINE_RIGHT, // 10153 + SID_ATTR_TRANSFORM_PROTECT_POS,// 10236 + SID_ATTR_TRANSFORM_PROTECT_SIZE,// 10237 //Added SID_FORMTEXT_STYLE, // 10257 SID_SET_SUPER_SCRIPT, // 10294 SID_SET_SUB_SCRIPT, // 10295 + SID_ATTR_TRANSFORM_AUTOWIDTH,// 10310 + SID_ATTR_TRANSFORM_AUTOHEIGHT,// 10311 //Added SID_HYPERLINK_GETLINK, // 10361 SID_CHARMAP, // 10503 SID_TEXTDIRECTION_LEFT_TO_RIGHT, // 10907 @@ -1089,7 +1104,8 @@ void FuText::SetInEditMode(const MouseEvent& rMEvt, sal_Bool bQuickDrag) { // Move cursor to end of text ESelection aNewSelection(EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND, EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND); - pOLV->SetSelection(aNewSelection); + if (pOLV != NULL) + pOLV->SetSelection(aNewSelection); } } else diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx index 9fd205ff8516..6d91b187e81f 100644 --- a/sd/source/ui/inc/DrawViewShell.hxx +++ b/sd/source/ui/inc/DrawViewShell.hxx @@ -24,8 +24,10 @@ #include "tools/AsynchronousCall.hxx" #include <sfx2/viewfac.hxx> #include <sfx2/viewsh.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include "TabControl.hxx" #include "pres.hxx" +#include <svx/sidebar/SelectionChangeHandler.hxx> #include <com/sun/star/lang/XEventListener.hpp> #include <com/sun/star/scanner/XScannerManager2.hpp> #include <unotools/caserotate.hxx> @@ -158,6 +160,7 @@ public: void ExecCtrl(SfxRequest& rReq); void GetCtrlState(SfxItemSet& rSet); + void GetDrawAttrState(SfxItemSet& rSet); void GetMenuState(SfxItemSet& rSet); void GetTableMenuState(SfxItemSet& rSet); /** Set the items of the given item set that are related to @@ -190,6 +193,9 @@ public: void ExecNavigatorWin(SfxRequest& rReq); void GetNavigatorWinState(SfxItemSet& rSet); + void ExecutePropPanelAttr (SfxRequest& rReq); + void GetStatePropPanelAttr(SfxItemSet& rSet); + void ExecEffectWin(SfxRequest& rReq); void Update3DWindow(); @@ -213,6 +219,8 @@ public: void AttrExec (SfxRequest& rReq); void AttrState (SfxItemSet& rSet); + void ExecChar(SfxRequest& rReq); + void ExecuteAnnotation (SfxRequest& rRequest); void GetAnnotationState (SfxItemSet& rItemSet); @@ -422,6 +430,10 @@ private: RotateTransliteration m_aRotateCase; + /** Listen for selection changes and broadcast context changes for the sidebar. + */ + ::rtl::Reference<svx::sidebar::SelectionChangeHandler> mpSelectionChangeHandler; + void Construct (DrawDocShell* pDocSh, PageKind ePageKind); /** Depending on the given request create a new page or duplicate an @@ -475,6 +487,8 @@ private: const sal_uInt16 nSnapLineIndex, const Point& rMouseLocation); + ::sfx2::sidebar::EnumContext::Context GetContextForSelection (void) const; + using ViewShell::Notify; ::std::auto_ptr< AnnotationManager > mpAnnotationManager; diff --git a/sd/source/ui/inc/PaneChildWindows.hxx b/sd/source/ui/inc/PaneChildWindows.hxx index 9c1c04e63c7d..6da8cf18412f 100644 --- a/sd/source/ui/inc/PaneChildWindows.hxx +++ b/sd/source/ui/inc/PaneChildWindows.hxx @@ -65,28 +65,6 @@ public: }; - - -//====================================================================================================================== -//= ToolPanelChildWindow -//====================================================================================================================== -class ToolPanelChildWindow :public PaneChildWindow - ,public ::sfx2::ITaskPaneToolPanelAccess -{ -public: - ToolPanelChildWindow( - ::Window* i_pParentWindow, - sal_uInt16 i_nId, - SfxBindings* i_pBindings, - SfxChildWinInfo* i_pChildWindowInfo ); - - SFX_DECL_CHILDWINDOW_WITHID( ToolPanelChildWindow ); - - // ::sfx2::ITaskPaneToolPanelAccess - virtual void ActivateToolPanel( const OUString& i_rPanelURL ); -}; - - } // end of namespace ::sd #endif diff --git a/sd/source/ui/inc/SidebarPanelId.hxx b/sd/source/ui/inc/SidebarPanelId.hxx new file mode 100644 index 000000000000..f315914aeeb5 --- /dev/null +++ b/sd/source/ui/inc/SidebarPanelId.hxx @@ -0,0 +1,49 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SD_SIDEBAR_PANEL_ID_HXX +#define SD_SIDEBAR_PANEL_ID_HXX + +namespace rtl +{ + class OUString; +} + + +namespace sd { namespace sidebar { + +/** List of top level panels that can be shown in the task pane. +*/ +enum PanelId +{ + PID__START = 0, + PID_UNKNOWN = PID__START, + PID_MASTER_PAGES_ALL, + PID_MASTER_PAGES_RECENT, + PID_MASTER_PAGES_USED, + PID_LAYOUT, + PID_TABLE_DESIGN, + PID_ANIMATION_SCHEMES, + PID_CUSTOM_ANIMATION, + PID_SLIDE_TRANSITION, + PID__END = PID_SLIDE_TRANSITION +}; + +} } // namespace sd::sidebar + + +#endif diff --git a/sd/source/ui/inc/SlideSorterViewShell.hxx b/sd/source/ui/inc/SlideSorterViewShell.hxx index 4f72343f430f..32c3cc068d31 100644 --- a/sd/source/ui/inc/SlideSorterViewShell.hxx +++ b/sd/source/ui/inc/SlideSorterViewShell.hxx @@ -111,6 +111,7 @@ public: virtual void ArrangeGUIElements (void); virtual void Activate (sal_Bool IsMDIActivate); + virtual void Deactivate (sal_Bool IsMDIActivate); //===== Drag and Drop ===================================================== diff --git a/sd/source/ui/inc/TextObjectBar.hxx b/sd/source/ui/inc/TextObjectBar.hxx index c7421dd30c56..0b11a14b04df 100644 --- a/sd/source/ui/inc/TextObjectBar.hxx +++ b/sd/source/ui/inc/TextObjectBar.hxx @@ -46,6 +46,7 @@ public: virtual ~TextObjectBar (void); void GetAttrState( SfxItemSet& rSet ); + void GetCharState( SfxItemSet& rSet ); void Execute( SfxRequest &rReq ); virtual void Command( const CommandEvent& rCEvt ); diff --git a/sd/source/ui/inc/View.hxx b/sd/source/ui/inc/View.hxx index 3dee2a95a310..6fc9dd178e09 100644 --- a/sd/source/ui/inc/View.hxx +++ b/sd/source/ui/inc/View.hxx @@ -31,6 +31,7 @@ #include "fupoor.hxx" #include "smarttag.hxx" +#include <editeng/numitem.hxx> class SdDrawDocument; class SdPage; @@ -193,6 +194,8 @@ public: virtual void CheckPossibilities(); virtual sal_Bool MarkPoints(const ::Rectangle* pRect, sal_Bool bUnmark); using SdrMarkView::MarkPoints; + sal_Bool ShouldToggleOn(sal_Bool bBulletOnOffMode, sal_Bool bNormalBullet); + void ToggleMarkedObjectsBullets(sal_Bool bBulletOnOffMode, sal_Bool bNormalBullet, sal_Bool bMasterView, SvxNumRule* pNumRule = NULL, sal_Bool bForceBulletOnOff = false); void SetPossibilitiesDirty() { bPossibilitiesDirty = true; } void SetMoveAllowed( bool bSet ) { bMoveAllowed = bSet; } diff --git a/sd/source/ui/inc/ViewShell.hxx b/sd/source/ui/inc/ViewShell.hxx index 125229bcb9f2..94f5d7238a31 100644 --- a/sd/source/ui/inc/ViewShell.hxx +++ b/sd/source/ui/inc/ViewShell.hxx @@ -93,7 +93,8 @@ public: ST_OUTLINE, ST_SLIDE_SORTER, ST_PRESENTATION, - ST_TASK_PANE + ST_TASK_PANE, + ST_SIDEBAR }; static const int MAX_HSPLIT_CNT = 1; static const int MAX_VSPLIT_CNT = 1; @@ -194,6 +195,8 @@ public: virtual void SetUIUnit(FieldUnit eUnit); virtual void SetDefTabHRuler( sal_uInt16 nDefTab ); + const SfxPoolItem* GetNumBulletItem(SfxItemSet& aNewAttr, sal_uInt16& nNumItemId); + sal_Bool HasRuler (void); void SetRuler(sal_Bool bRuler); diff --git a/sd/source/ui/inc/framework/FrameworkHelper.hxx b/sd/source/ui/inc/framework/FrameworkHelper.hxx index 1b81f6870a74..4aac1861bd5d 100644 --- a/sd/source/ui/inc/framework/FrameworkHelper.hxx +++ b/sd/source/ui/inc/framework/FrameworkHelper.hxx @@ -39,6 +39,9 @@ class ViewShell; class ViewShellBase; } +namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; +namespace cssdf = ::com::sun::star::drawing::framework; namespace sd { namespace framework { @@ -47,10 +50,10 @@ namespace sd { namespace framework { It has three main tasks: 1. Provide frequently used strings of resource URLs and event names. 2. Provide shortcuts for accessing the sd framework. - 3. Easy the migration to the drawing framwork. + 3. Ease the migration to the drawing framwork. Note that a FrameworkHelper disposes itself when one of the resource - controllers called by it throw a DisposedException. + controllers called by it throws a DisposedException. */ class FrameworkHelper : public ::boost::enable_shared_from_this<FrameworkHelper>, @@ -63,7 +66,7 @@ public: static const OUString msFullScreenPaneURL; static const OUString msLeftImpressPaneURL; static const OUString msLeftDrawPaneURL; - static const OUString msRightPaneURL; + static const OUString msSidebarPaneURL; // URLs of frequently used views. static const OUString msViewURLPrefix; @@ -74,7 +77,7 @@ public: static const OUString msHandoutViewURL; static const OUString msSlideSorterURL; static const OUString msPresentationViewURL; - static const OUString msTaskPaneURL; + static const OUString msSidebarViewURL; // URLs of frequently used tool bars. static const OUString msToolBarURLPrefix; @@ -82,7 +85,9 @@ public: // URLs of task panels. static const OUString msTaskPanelURLPrefix; - static const OUString msMasterPagesTaskPanelURL; + static const OUString msAllMasterPagesTaskPanelURL; + static const OUString msRecentMasterPagesTaskPanelURL; + static const OUString msUsedMasterPagesTaskPanelURL; static const OUString msLayoutTaskPanelURL; static const OUString msTableDesignPanelURL; static const OUString msCustomAnimationTaskPanelURL; @@ -93,6 +98,7 @@ public: static const OUString msResourceDeactivationRequestEvent; static const OUString msResourceActivationEvent; static const OUString msResourceDeactivationEvent; + static const OUString msResourceDeactivationEndEvent; static const OUString msConfigurationUpdateStartEvent; static const OUString msConfigurationUpdateEndEvent; @@ -107,7 +113,7 @@ public: static ::boost::shared_ptr<FrameworkHelper> Instance (ViewShellBase& rBase); static ::boost::shared_ptr<FrameworkHelper> Instance ( - const css::uno::Reference<css::frame::XController>& rxController); + const cssu::Reference<css::frame::XController>& rxController); /** Mark the FrameworkHelper object for the given ViewShellBase as disposed. A following ReleaseInstance() call will destroy the @@ -144,17 +150,15 @@ public: reference then an empty pointer is returned. */ static ::boost::shared_ptr<ViewShell> GetViewShell ( - const css::uno::Reference<css::drawing::framework::XView>& rxView); + const cssu::Reference<cssdf::XView>& rxView); - ~FrameworkHelper (void); - - typedef ::boost::function<bool(const css::drawing::framework::ConfigurationChangeEvent&)> + typedef ::boost::function<bool(const cssdf::ConfigurationChangeEvent&)> ConfigurationChangeEventFilter; typedef ::boost::function<void(bool bEventSeen)> Callback; typedef ::boost::function< void( - const css::uno::Reference< - css::drawing::framework::XResourceId>&) + const cssu::Reference< + cssdf::XResourceId>&) > ResourceFunctor; /** Test whether the called FrameworkHelper object is valid. @@ -187,10 +191,19 @@ public: of the involved objects does not support XTunnel (where necessary). */ - css::uno::Reference<css::drawing::framework::XView> - GetView ( - const css::uno::Reference< - css::drawing::framework::XResourceId>& rxPaneOrViewId); + cssu::Reference<cssdf::XView> GetView ( + const cssu::Reference<cssdf::XResourceId>& rxPaneOrViewId); + + /** Return the XWindow that is represented by the pane with the + given resource id. + */ + cssu::Reference<css::awt::XWindow> GetPaneWindow ( + const cssu::Reference<cssdf::XResourceId>& rxPaneId); + + /** Return the XResource object with the given resource id. + */ + cssu::Reference<cssdf::XResource> GetResource ( + const cssu::Reference<cssdf::XResourceId>& rxResourceId); /** Request the specified view to be displayed in the specified pane. When the pane is not visible its creation is also requested. The @@ -204,25 +217,34 @@ public: the caller can, for example, call RunOnResourceActivation() to do some initialization after the requested view becomes active. */ - css::uno::Reference<css::drawing::framework::XResourceId> RequestView ( + cssu::Reference<cssdf::XResourceId> RequestView ( const OUString& rsResourceURL, const OUString& rsAnchorURL); - /** Request the activation of the specified task panel in the standard - task pane. - @param rsTaskPanelURL + /** Request the activation of the specified panel in the + sidebar. + @param rsSidebarPanelURL The panel that is to be activated. - @param bEnsureTaskPaneIsVisible - When this is <TRUE/> then the task pane is activated when not + @param bEnsurePaneIsVisible + When this is <TRUE/> then the sidebar pane is activated when not yet active. When this flag is <FALSE/> then the requested panel is activated only when the task pane is already active. When it is not active then this call is silently ignored. + @return + The resource id of the requested sidebar panel is returned. With that + the caller can, for example, call RunOnResourceActivation() to + do some initialization after the requested view becomes active. */ - void RequestTaskPanel ( - const OUString& rsTaskPanelURL, + cssu::Reference<cssdf::XResourceId> RequestSidebarPanel ( + const OUString& rsSidebarPanelURL, const bool bEnsureTaskPaneIsVisible = true); + /** Request the deactivation of the specified resource. + */ + void RequestResourceDeactivation ( + const cssu::Reference<cssdf::XResourceId>& rxResourceId); + /** Process a slot call that requests a view shell change. */ void HandleModeChangeSlot ( @@ -251,9 +273,30 @@ public: */ void RunOnResourceActivation( - const css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId, + const cssu::Reference<cssdf::XResourceId>& rxResourceId, const Callback& rCallback); + /** Run the given callback when the specified resource has been + deactivated. When the resource is not active already when + this method is called then rCallback is called before this + method returns. + @param rxResourceId + Wait for the deactivation of this resource before calling + rCallback. + @param rCallback + The callback to be called when the resource is + deactivated. + @param bRunOnDeactivationEnd + The callback is run either when the deactivation starts + and the callback can still access the resource or when the + deactivatio is complete and the resource is no longer available. + + */ + void RunOnResourceDeactivation( + const cssu::Reference<cssdf::XResourceId>& rxResourceId, + const Callback& rCallback, + const bool bRunOnDeactivationEnd); + /** Normally the requested changes of the configuration are executed asynchronously. However, there is at least one situation (searching with the Outliner) where the surrounding code does not cope with @@ -287,21 +330,21 @@ public: /** Return a string representation of the given XResourceId object. */ static OUString ResourceIdToString ( - const css::uno::Reference< - css::drawing::framework::XResourceId>& rxResourceId); + const cssu::Reference< + cssdf::XResourceId>& rxResourceId); /** Create a new XResourceId object for the given resource URL. */ - static css::uno::Reference< - css::drawing::framework::XResourceId> + static cssu::Reference< + cssdf::XResourceId> CreateResourceId ( const OUString& rsResourceURL); /** Create a new XResourceId object for the given resource URL and a single anchor URL. */ - static css::uno::Reference< - css::drawing::framework::XResourceId> + static cssu::Reference< + cssdf::XResourceId> CreateResourceId ( const OUString& rsResourceURL, const OUString& rsAnchorURL); @@ -309,8 +352,8 @@ public: /** Create a new XResourceId object for the given resource URL and the two given anchor URLs. */ - static css::uno::Reference< - css::drawing::framework::XResourceId> + static cssu::Reference< + cssdf::XResourceId> CreateResourceId ( const OUString& rsResourceURL, const OUString& rsFirstAnchorURL, @@ -318,14 +361,14 @@ public: /** Create a new XResourceId object for the given resource URL. */ - static css::uno::Reference< - css::drawing::framework::XResourceId> + static cssu::Reference< + cssdf::XResourceId> CreateResourceId ( const OUString& rsResourceURL, - const css::uno::Reference< - css::drawing::framework::XResourceId>& rxAnchor); + const cssu::Reference< + cssdf::XResourceId>& rxAnchor); - css::uno::Reference<css::drawing::framework::XConfigurationController> + cssu::Reference<cssdf::XConfigurationController> GetConfigurationController (void) const; @@ -341,16 +384,18 @@ private: static ::boost::scoped_ptr<ViewURLMap> mpViewURLMap; ViewShellBase& mrBase; - css::uno::Reference<css::drawing::framework::XConfigurationController> + cssu::Reference<cssdf::XConfigurationController> mxConfigurationController; class DisposeListener; friend class DisposeListener; - css::uno::Reference<css::lang::XComponent> + cssu::Reference<css::lang::XComponent> mxDisposeListener; FrameworkHelper (ViewShellBase& rBase); FrameworkHelper (const FrameworkHelper& rHelper); // Not implemented. + ~FrameworkHelper (void); + class Deleter; friend class Deleter; FrameworkHelper& operator= (const FrameworkHelper& rHelper); // Not implemented. void Initialize (void); @@ -390,7 +435,7 @@ namespace { class FrameworkHelperAllPassFilter { public: - bool operator() (const css::drawing::framework::ConfigurationChangeEvent&) { return true; } + bool operator() (const cssdf::ConfigurationChangeEvent&) { return true; } }; @@ -398,12 +443,12 @@ namespace { { public: FrameworkHelperResourceIdFilter ( - const css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId); - bool operator() (const css::drawing::framework::ConfigurationChangeEvent& rEvent) + const cssu::Reference<cssdf::XResourceId>& rxResourceId); + bool operator() (const cssdf::ConfigurationChangeEvent& rEvent) { return mxResourceId.is() && rEvent.ResourceId.is() && mxResourceId->compareTo(rEvent.ResourceId) == 0; } private: - css::uno::Reference<css::drawing::framework::XResourceId> mxResourceId; + cssu::Reference<cssdf::XResourceId> mxResourceId; }; } // end of anonymous namespace diff --git a/sd/source/ui/inc/framework/Pane.hxx b/sd/source/ui/inc/framework/Pane.hxx index 49a99ce1e38d..de6e36015e26 100644 --- a/sd/source/ui/inc/framework/Pane.hxx +++ b/sd/source/ui/inc/framework/Pane.hxx @@ -88,6 +88,7 @@ public: */ virtual ::Window* GetWindow (void); + void SetWindow (::Window* pWindow); //----- XPane ------------------------------------------------------------- diff --git a/sd/source/ui/inc/framework/TaskPanelResource.hxx b/sd/source/ui/inc/framework/TaskPanelResource.hxx new file mode 100644 index 000000000000..36eecf6b1c9b --- /dev/null +++ b/sd/source/ui/inc/framework/TaskPanelResource.hxx @@ -0,0 +1,81 @@ +/* + * 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 <cppuhelper/compbase1.hxx> +#include <cppuhelper/basemutex.hxx> + +#include "SidebarPanelId.hxx" + +#include <com/sun/star/drawing/framework/XResource.hpp> +#include <boost/scoped_ptr.hpp> + + +namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; +namespace cssdf = ::com::sun::star::drawing::framework; + +class Window; + +namespace sd { namespace sidebar { + class SidebarViewShell; +} } + + +namespace sd { namespace framework { + +typedef ::cppu::WeakComponentImplHelper1 < + cssdf::XResource + > TaskPanelResourceInterfaceBase; + + +/** A simple wrapper around a legacy task pane control that gives + access to that control (via GetControl()). +*/ +class TaskPanelResource + : private ::cppu::BaseMutex, + public TaskPanelResourceInterfaceBase +{ +public: + /** Create a resource object that represents the legacy taskpane + panel. + @param rxResourceId + drawing framework resource id + @param pControl + The new TaskPanelResource object takes ownership for this control. + */ + TaskPanelResource ( + sidebar::SidebarViewShell& rSidebarViewShell, + sidebar::PanelId ePanelId, + const cssu::Reference<cssdf::XResourceId>& rxResourceId); + virtual ~TaskPanelResource (void); + virtual void SAL_CALL disposing (void); + + // XResource + virtual cssu::Reference<cssdf::XResourceId> SAL_CALL getResourceId (void) throw (cssu::RuntimeException); + virtual sal_Bool SAL_CALL isAnchorOnly () throw (cssu::RuntimeException); + + ::Window* GetControl (void) const; + +private: + const cssu::Reference<cssdf::XResourceId> mxResourceId; + // Using auto_ptr because it has release(), what scoped_ptr doesn't. + ::std::auto_ptr< ::Window> mpControl; + + DECL_LINK(WindowEventHandler,VclWindowEvent*); +}; + +} } // end of namespace sd::framework diff --git a/sd/source/ui/inc/fuolbull.hxx b/sd/source/ui/inc/fuolbull.hxx index 797c4da40b1a..995cda6b9e86 100644 --- a/sd/source/ui/inc/fuolbull.hxx +++ b/sd/source/ui/inc/fuolbull.hxx @@ -24,6 +24,8 @@ class SdDrawDocument; class SfxRequest; +class SfxItemSet; +class SfxPoolItem; namespace sd { @@ -42,6 +44,8 @@ public: static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ); virtual void DoExecute( SfxRequest& rReq ); + void SetCurrentBullet(SfxRequest& rReq); + void SetCurrentNumbering(SfxRequest& rReq); private: FuOutlineBullet ( @@ -50,8 +54,11 @@ private: ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq); + + const SfxPoolItem* GetNumBulletItem(SfxItemSet& aNewAttr, sal_uInt32& nNumItemId); }; + } // end of namespace sd #endif diff --git a/sd/source/ui/inc/navigatr.hxx b/sd/source/ui/inc/navigatr.hxx index ca6bdf418b8d..4c5b8250bf46 100644 --- a/sd/source/ui/inc/navigatr.hxx +++ b/sd/source/ui/inc/navigatr.hxx @@ -81,11 +81,21 @@ class SdNavigatorWin : public Window { public: + typedef ::boost::function<void(void)> UpdateRequestFunctor; + + /** Create a new instance of the navigator. + @param bUseActiveUpdate + When <TRUE/>, the default, then the SdNavigatorWin object + will make a SID_NAVIGATOR_INIT call whenever it thinks an + update is necessary. When <FALSE/> the navigator will + rely on others to trigger updates. + */ SdNavigatorWin( ::Window* pParent, ::sd::NavigatorChildWindow* pChildWinContext, const SdResId& rSdResId, - SfxBindings* pBindings ); + SfxBindings* pBindings, + const UpdateRequestFunctor& rUpdateRequest); virtual ~SdNavigatorWin(); virtual void KeyInput( const KeyEvent& rKEvt ); @@ -128,7 +138,7 @@ private: /** This flag controls whether all shapes or only the named shapes are shown. */ - bool mbShowAllShapes; + // bool mbShowAllShapes; sal_uInt16 GetDragTypeSdResId( NavigatorDragType eDT, sal_Bool bImage = sal_False ); NavDocInfo* GetDocInfo(); @@ -157,7 +167,8 @@ private: class SdNavigatorControllerItem : public SfxControllerItem { public: - SdNavigatorControllerItem( sal_uInt16, SdNavigatorWin*, SfxBindings* ); + SdNavigatorControllerItem( sal_uInt16, SdNavigatorWin*, SfxBindings*, + const SdNavigatorWin::UpdateRequestFunctor& rUpdateRequest); protected: virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState, @@ -165,6 +176,7 @@ protected: private: SdNavigatorWin* pNavigatorWin; + const SdNavigatorWin::UpdateRequestFunctor maUpdateRequest; }; @@ -175,7 +187,8 @@ private: class SdPageNameControllerItem : public SfxControllerItem { public: - SdPageNameControllerItem( sal_uInt16, SdNavigatorWin*, SfxBindings* ); + SdPageNameControllerItem( sal_uInt16, SdNavigatorWin*, SfxBindings*, + const SdNavigatorWin::UpdateRequestFunctor& rUpdateRequest); protected: virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState, @@ -183,6 +196,7 @@ protected: private: SdNavigatorWin* pNavigatorWin; + const SdNavigatorWin::UpdateRequestFunctor maUpdateRequest; }; #endif diff --git a/sd/source/ui/presenter/PresenterHelper.hxx b/sd/source/ui/presenter/PresenterHelper.hxx index 053b1e69d136..c9173b249627 100644 --- a/sd/source/ui/presenter/PresenterHelper.hxx +++ b/sd/source/ui/presenter/PresenterHelper.hxx @@ -39,7 +39,7 @@ namespace { /** Implementation of the XPresenterHelper interface: functionality that can not be implemented in an extension. */ - class PresenterHelper +class PresenterHelper : private ::boost::noncopyable, private ::cppu::BaseMutex, public PresenterHelperInterfaceBase diff --git a/sd/source/ui/sidebar/AllMasterPagesSelector.cxx b/sd/source/ui/sidebar/AllMasterPagesSelector.cxx new file mode 100644 index 000000000000..6e83aa23768b --- /dev/null +++ b/sd/source/ui/sidebar/AllMasterPagesSelector.cxx @@ -0,0 +1,229 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "AllMasterPagesSelector.hxx" +#include "PreviewValueSet.hxx" +#include "ViewShellBase.hxx" +#include "SidebarShellManager.hxx" +#include "MasterPageContainer.hxx" +#include "MasterPageDescriptor.hxx" +#include "app.hrc" +#include "helpids.h" + +#include <tools/link.hxx> +#include <set> + +namespace { + +using namespace sd::sidebar; + +int GetURLPriority (const SharedMasterPageDescriptor& rpDescriptor) +{ + int nPriority (0); + switch (rpDescriptor->GetURLClassification()) + { + case MasterPageDescriptor::URLCLASS_USER: nPriority = 0; break; + case MasterPageDescriptor::URLCLASS_LAYOUT: nPriority = 1; break; + case MasterPageDescriptor::URLCLASS_PRESENTATION: nPriority = 2; break; + case MasterPageDescriptor::URLCLASS_OTHER: nPriority = 3; break; + case MasterPageDescriptor::URLCLASS_UNKNOWN: nPriority = 4; break; + default: + case MasterPageDescriptor::URLCLASS_UNDETERMINED: nPriority = 5; break; + } + return nPriority; +} + + +class MasterPageDescriptorOrder +{ +public: + bool operator() ( + const SharedMasterPageDescriptor& rp1, + const SharedMasterPageDescriptor& rp2) + { + if (rp1->meOrigin == MasterPageContainer::DEFAULT) + return true; + else if (rp2->meOrigin == MasterPageContainer::DEFAULT) + return false; + else if (rp1->GetURLClassification() == rp2->GetURLClassification()) + return rp1->mnTemplateIndex < rp2->mnTemplateIndex; + else + return GetURLPriority(rp1) < GetURLPriority(rp2); + } +}; + +} // end of anonymous namespace + + + +namespace sd { namespace sidebar { + +class AllMasterPagesSelector::SortedMasterPageDescriptorList + : public ::std::set<SharedMasterPageDescriptor,MasterPageDescriptorOrder> +{ +public: + SortedMasterPageDescriptorList (void) {} +}; + + + + +MasterPagesSelector* AllMasterPagesSelector::Create ( + ::Window* pParent, + ViewShellBase& rViewShellBase, + const cssu::Reference<css::ui::XSidebar>& rxSidebar) +{ + SdDrawDocument* pDocument = rViewShellBase.GetDocument(); + if (pDocument == NULL) + return NULL; + + ::boost::shared_ptr<MasterPageContainer> pContainer (new MasterPageContainer()); + + MasterPagesSelector* pSelector( + new AllMasterPagesSelector ( + pParent, + *pDocument, + rViewShellBase, + pContainer, + rxSidebar)); + pSelector->LateInit(); + pSelector->SetHelpId(HID_SD_TASK_PANE_PREVIEW_ALL); + + return pSelector; +} + + + + +AllMasterPagesSelector::AllMasterPagesSelector ( + ::Window* pParent, + SdDrawDocument& rDocument, + ViewShellBase& rBase, + const ::boost::shared_ptr<MasterPageContainer>& rpContainer, + const cssu::Reference<css::ui::XSidebar>& rxSidebar) + : MasterPagesSelector(pParent, rDocument, rBase, rpContainer, rxSidebar), + mpSortedMasterPages(new SortedMasterPageDescriptorList()) +{ + MasterPagesSelector::Fill(); +} + + + + +AllMasterPagesSelector::~AllMasterPagesSelector (void) +{ +} + + + + +void AllMasterPagesSelector::Fill (ItemList& rItemList) +{ + if (mpSortedMasterPages->empty()) + UpdateMasterPageList(); + UpdatePageSet(rItemList); +} + + + + +void AllMasterPagesSelector::NotifyContainerChangeEvent ( + const MasterPageContainerChangeEvent& rEvent) +{ + switch (rEvent.meEventType) + { + case MasterPageContainerChangeEvent::CHILD_ADDED: + AddItem(rEvent.maChildToken); + MasterPagesSelector::Fill(); + break; + + case MasterPageContainerChangeEvent::INDEX_CHANGED: + case MasterPageContainerChangeEvent::INDEXES_CHANGED: + mpSortedMasterPages->clear(); + MasterPagesSelector::Fill(); + break; + + default: + MasterPagesSelector::NotifyContainerChangeEvent(rEvent); + break; + } +} + + + + +void AllMasterPagesSelector::UpdateMasterPageList (void) +{ + mpSortedMasterPages->clear(); + int nTokenCount = mpContainer->GetTokenCount(); + for (int i=0; i<nTokenCount; i++) + AddItem(mpContainer->GetTokenForIndex(i)); +} + + + + +void AllMasterPagesSelector::AddItem (MasterPageContainer::Token aToken) +{ + switch (mpContainer->GetOriginForToken(aToken)) + { + case MasterPageContainer::DEFAULT: + case MasterPageContainer::TEMPLATE: + // Templates are added only when coming from the + // MasterPageContainerFiller so that they have an id which + // defines their place in the list. Templates (pre) loaded from + // RecentlyUsedMasterPages are ignored (they will be loaded + // later by the MasterPageContainerFiller.) + if (mpContainer->GetTemplateIndexForToken(aToken) >= 0) + mpSortedMasterPages->insert(mpContainer->GetDescriptorForToken(aToken)); + break; + + default: + break; + } +} + + + + +void AllMasterPagesSelector::UpdatePageSet (ItemList& rItemList) +{ + SortedMasterPageDescriptorList::const_iterator iDescriptor; + SortedMasterPageDescriptorList::const_iterator iEnd (mpSortedMasterPages->end()); + for (iDescriptor=mpSortedMasterPages->begin(); iDescriptor!=iEnd; ++iDescriptor) + rItemList.push_back((*iDescriptor)->maToken); +} + + + + +void AllMasterPagesSelector::GetState (SfxItemSet& rItemSet) +{ + // MasterPagesSelector::GetState(rItemSet); + + if (rItemSet.GetItemState(SID_TP_EDIT_MASTER) == SFX_ITEM_AVAILABLE) + rItemSet.DisableItem(SID_TP_EDIT_MASTER); +} + + + + +} } // end of namespace sd::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/sidebar/AllMasterPagesSelector.hxx b/sd/source/ui/sidebar/AllMasterPagesSelector.hxx new file mode 100644 index 000000000000..c6e2494b82cb --- /dev/null +++ b/sd/source/ui/sidebar/AllMasterPagesSelector.hxx @@ -0,0 +1,95 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef SD_SIDEBAR_PANELS_ALL_MASTER_PAGES_SELECTOR_HXX +#define SD_SIDEBAR_PANELS_ALL_MASTER_PAGES_SELECTOR_HXX + +#include "MasterPagesSelector.hxx" + +#include <memory> + +namespace sd { +class TemplateEntry; +} + +namespace sd { namespace sidebar { + + +/** Show a list of all available master pages so that the user can assign + them to the document. +*/ +class AllMasterPagesSelector + : public MasterPagesSelector +{ +public: + static MasterPagesSelector* Create ( + ::Window* pParent, + ViewShellBase& rViewShellBase, + const cssu::Reference<css::ui::XSidebar>& rxSidebar); + + /** Scan the set of templates for the ones whose first master pages are + shown by this control and store them in the MasterPageContainer. + */ + virtual void Fill (ItemList& rItemList); + + virtual void GetState (SfxItemSet& rItemSet); + +protected: + virtual void NotifyContainerChangeEvent (const MasterPageContainerChangeEvent& rEvent); + +private: + /** The list of master pages displayed by this class. + */ + class SortedMasterPageDescriptorList; + ::std::auto_ptr<SortedMasterPageDescriptorList> mpSortedMasterPages; + + AllMasterPagesSelector ( + ::Window* pParent, + SdDrawDocument& rDocument, + ViewShellBase& rBase, + const ::boost::shared_ptr<MasterPageContainer>& rpContainer, + const cssu::Reference<css::ui::XSidebar>& rxSidebar); + virtual ~AllMasterPagesSelector (void); + + void AddTemplate (const TemplateEntry& rEntry); + + /** This filter returns <TRUE/> when the master page specified by the + given file name belongs to the set of Impress master pages. + */ + bool FileFilter (const String& sFileName); + + void AddItem (MasterPageContainer::Token aToken); + + /** Add all items in the internal master page list into the given list. + */ + void UpdatePageSet (ItemList& rItemList); + + /** Update the internal list of master pages that are to show in the + control. + */ + void UpdateMasterPageList (void); + + using MasterPagesSelector::Fill; +}; + +} } // end of namespace sd::sidebar + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx b/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx new file mode 100644 index 000000000000..a5fc7ed9b21c --- /dev/null +++ b/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx @@ -0,0 +1,352 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "CurrentMasterPagesSelector.hxx" +#include "PreviewValueSet.hxx" +#include "ViewShellBase.hxx" +#include "SidebarShellManager.hxx" +#include "DrawViewShell.hxx" +#include "drawdoc.hxx" +#include "sdpage.hxx" +#include "MasterPageContainer.hxx" +#include "MasterPageDescriptor.hxx" +#include "EventMultiplexer.hxx" +#include "app.hrc" +#include "DrawDocShell.hxx" +#include "res_bmp.hrc" +#include "sdresid.hxx" +#include "helpids.h" + +#include <vcl/image.hxx> +#include <svx/svdmodel.hxx> +#include <sfx2/request.hxx> + +#include <set> + + +using namespace ::com::sun::star; + +namespace sd { namespace sidebar { + +MasterPagesSelector* CurrentMasterPagesSelector::Create ( + ::Window* pParent, + ViewShellBase& rViewShellBase, + const cssu::Reference<css::ui::XSidebar>& rxSidebar) +{ + SdDrawDocument* pDocument = rViewShellBase.GetDocument(); + if (pDocument == NULL) + return NULL; + + ::boost::shared_ptr<MasterPageContainer> pContainer (new MasterPageContainer()); + + MasterPagesSelector* pSelector( + new CurrentMasterPagesSelector ( + pParent, + *pDocument, + rViewShellBase, + pContainer, + rxSidebar)); + pSelector->LateInit(); + pSelector->SetHelpId( HID_SD_TASK_PANE_PREVIEW_CURRENT ); + + return pSelector; +} + + + + +CurrentMasterPagesSelector::CurrentMasterPagesSelector ( + ::Window* pParent, + SdDrawDocument& rDocument, + ViewShellBase& rBase, + const ::boost::shared_ptr<MasterPageContainer>& rpContainer, + const cssu::Reference<css::ui::XSidebar>& rxSidebar) + : MasterPagesSelector (pParent, rDocument, rBase, rpContainer, rxSidebar) +{ + // For this master page selector only we change the default action for + // left clicks. + mnDefaultClickAction = SID_TP_APPLY_TO_SELECTED_SLIDES; + + Link aLink (LINK(this,CurrentMasterPagesSelector,EventMultiplexerListener)); + rBase.GetEventMultiplexer()->AddEventListener(aLink, + sd::tools::EventMultiplexerEvent::EID_CURRENT_PAGE + | sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_NORMAL + | sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_MASTER + | sd::tools::EventMultiplexerEvent::EID_PAGE_ORDER + | sd::tools::EventMultiplexerEvent::EID_SHAPE_CHANGED + | sd::tools::EventMultiplexerEvent::EID_SHAPE_INSERTED + | sd::tools::EventMultiplexerEvent::EID_SHAPE_REMOVED); +} + + + + +CurrentMasterPagesSelector::~CurrentMasterPagesSelector (void) +{ + if (mrDocument.GetDocSh() != NULL) + { + EndListening(*mrDocument.GetDocSh()); + } + else + { + OSL_ASSERT(mrDocument.GetDocSh() != NULL); + } + + Link aLink (LINK(this,CurrentMasterPagesSelector,EventMultiplexerListener)); + mrBase.GetEventMultiplexer()->RemoveEventListener(aLink); +} + + + + +void CurrentMasterPagesSelector::LateInit (void) +{ + MasterPagesSelector::LateInit(); + MasterPagesSelector::Fill(); + if (mrDocument.GetDocSh() != NULL) + { + StartListening(*mrDocument.GetDocSh()); + } + else + { + OSL_ASSERT(mrDocument.GetDocSh() != NULL); + } +} + + + + +void CurrentMasterPagesSelector::Fill (ItemList& rItemList) +{ + sal_uInt16 nPageCount = mrDocument.GetMasterSdPageCount(PK_STANDARD); + SdPage* pMasterPage; + // Remember the names of the master pages that have been inserted to + // avoid double insertion. + ::std::set<String> aMasterPageNames; + for (sal_uInt16 nIndex=0; nIndex<nPageCount; nIndex++) + { + pMasterPage = mrDocument.GetMasterSdPage (nIndex, PK_STANDARD); + if (pMasterPage == NULL) + continue; + + // Use the name of the master page to avoid duplicate entries. + String sName (pMasterPage->GetName()); + if (aMasterPageNames.find(sName)!=aMasterPageNames.end()) + continue; + aMasterPageNames.insert (sName); + + // Look up the master page in the container and, when it is not yet + // in it, insert it. + MasterPageContainer::Token aToken = mpContainer->GetTokenForPageObject(pMasterPage); + if (aToken == MasterPageContainer::NIL_TOKEN) + { + SharedMasterPageDescriptor pDescriptor (new MasterPageDescriptor( + MasterPageContainer::MASTERPAGE, + nIndex, + String(), + pMasterPage->GetName(), + String(), + pMasterPage->IsPrecious(), + ::boost::shared_ptr<PageObjectProvider>(new ExistingPageProvider(pMasterPage)), + ::boost::shared_ptr<PreviewProvider>(new PagePreviewProvider()))); + aToken = mpContainer->PutMasterPage(pDescriptor); + } + + rItemList.push_back(aToken); + } +} + + + + +ResId CurrentMasterPagesSelector::GetContextMenuResId (void) const +{ + return SdResId(RID_TASKPANE_CURRENT_MASTERPAGESSELECTOR_POPUP); +} + + + + +void CurrentMasterPagesSelector::UpdateSelection (void) +{ + // Iterate over all pages and for the selected ones put the name of + // their master page into a set. + sal_uInt16 nPageCount = mrDocument.GetSdPageCount(PK_STANDARD); + SdPage* pPage; + ::std::set<String> aNames; + sal_uInt16 nIndex; + bool bLoop (true); + for (nIndex=0; nIndex<nPageCount && bLoop; nIndex++) + { + pPage = mrDocument.GetSdPage (nIndex, PK_STANDARD); + if (pPage != NULL && pPage->IsSelected()) + { + if ( ! pPage->TRG_HasMasterPage()) + { + // One of the pages has no master page. This is an + // indicator for that this method is called in the middle of + // a document change and that the model is not in a valid + // state. Therefore we stop update the selection and wait + // for another call to UpdateSelection when the model is + // valid again. + bLoop = false; + } + else + { + SdrPage& rMasterPage (pPage->TRG_GetMasterPage()); + SdPage* pMasterPage = static_cast<SdPage*>(&rMasterPage); + if (pMasterPage != NULL) + aNames.insert (pMasterPage->GetName()); + } + } + } + + // Find the items for the master pages in the set. + sal_uInt16 nItemCount (PreviewValueSet::GetItemCount()); + for (nIndex=1; nIndex<=nItemCount && bLoop; nIndex++) + { + String sName (PreviewValueSet::GetItemText (nIndex)); + if (aNames.find(sName) != aNames.end()) + { + PreviewValueSet::SelectItem (nIndex); + } + } +} + + + + +void CurrentMasterPagesSelector::ExecuteCommand (const sal_Int32 nCommandId) +{ + if (nCommandId == SID_DELETE_MASTER_PAGE) + { + // Check once again that the master page can safely be deleted, + // i.e. is not used. + SdPage* pMasterPage = GetSelectedMasterPage(); + if (pMasterPage != NULL + && mrDocument.GetMasterPageUserCount(pMasterPage) == 0) + { + // Removing the precious flag so that the following call to + // RemoveUnnessesaryMasterPages() will remove this master page. + pMasterPage->SetPrecious(false); + mrDocument.RemoveUnnecessaryMasterPages(pMasterPage, sal_False, sal_True); + } + } + else + MasterPagesSelector::ExecuteCommand(nCommandId); +} + + + + +void CurrentMasterPagesSelector::ProcessPopupMenu (Menu& rMenu) +{ + // Disable the SID_DELTE_MASTER slot when there is only one master page. + if (mrDocument.GetMasterPageUserCount(GetSelectedMasterPage()) > 0) + { + if (rMenu.GetItemPos(SID_DELETE_MASTER_PAGE) != MENU_ITEM_NOTFOUND) + rMenu.EnableItem(SID_DELETE_MASTER_PAGE, sal_False); + } + + ::boost::shared_ptr<DrawViewShell> pDrawViewShell ( + ::boost::dynamic_pointer_cast<DrawViewShell>(mrBase.GetMainViewShell())); + if (pDrawViewShell + && pDrawViewShell->GetEditMode() == EM_MASTERPAGE) + { + if (rMenu.GetItemPos(SID_TP_EDIT_MASTER) != MENU_ITEM_NOTFOUND) + rMenu.EnableItem(SID_TP_EDIT_MASTER, sal_False); + } + + MasterPagesSelector::ProcessPopupMenu(rMenu); +} + + + + + + +IMPL_LINK(CurrentMasterPagesSelector,EventMultiplexerListener, + sd::tools::EventMultiplexerEvent*,pEvent) +{ + if (pEvent != NULL) + { + switch (pEvent->meEventId) + { + case sd::tools::EventMultiplexerEvent::EID_CURRENT_PAGE: + case sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_NORMAL: + case sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_MASTER: + case sd::tools::EventMultiplexerEvent::EID_SLIDE_SORTER_SELECTION: + UpdateSelection(); + break; + + case sd::tools::EventMultiplexerEvent::EID_PAGE_ORDER: + // This is tricky. If a master page is removed, moved, or + // added we have to wait until both the notes master page + // and the standard master page have been removed, moved, + // or added. We do this by looking at the number of master + // pages which has to be odd in the consistent state (the + // handout master page is always present). If the number is + // even we ignore the hint. + if (mrBase.GetDocument()->GetMasterPageCount()%2 == 1) + MasterPagesSelector::Fill(); + break; + + case sd::tools::EventMultiplexerEvent::EID_SHAPE_CHANGED: + case sd::tools::EventMultiplexerEvent::EID_SHAPE_INSERTED: + case sd::tools::EventMultiplexerEvent::EID_SHAPE_REMOVED: + InvalidatePreview((const SdPage*)pEvent->mpUserData); + break; + } + } + + return 0; +} + + + + +void CurrentMasterPagesSelector::NotifyHint (SfxBroadcaster&, const SfxHint& rHint) +{ + const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); + if (pSimpleHint != NULL) + { + if (pSimpleHint->GetId() == SFX_HINT_DOCCHANGED) + { + // Is the edit view visible in the center pane? + ::boost::shared_ptr<DrawViewShell> pDrawViewShell ( + ::boost::dynamic_pointer_cast<DrawViewShell>(mrBase.GetMainViewShell())); + if (pDrawViewShell.get() != NULL) + { + // Is the edit view in master page mode? + if (pDrawViewShell->GetEditMode() == EM_MASTERPAGE) + { + // Mark the currently edited master page as precious. + SdPage* pCurrentMasterPage = pDrawViewShell->getCurrentPage(); + if (pCurrentMasterPage != NULL) + pCurrentMasterPage->SetPrecious(true); + } + } + } + } +} + + +} } // end of namespace sd::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx b/sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx new file mode 100644 index 000000000000..37b228c9b49f --- /dev/null +++ b/sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx @@ -0,0 +1,88 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef SD_SIDEBAR_PANELS_CURRENT_MASTER_PAGES_SELECTOR_HXX +#define SD_SIDEBAR_PANELS_CURRENT_MASTER_PAGES_SELECTOR_HXX + +#include "MasterPagesSelector.hxx" +#include <com/sun/star/lang/XComponent.hpp> + + +namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; + + +namespace sd { namespace tools { class EventMultiplexerEvent; } } + + +namespace sd { namespace sidebar { + + +/** Show the master pages currently used by a SdDrawDocument. +*/ +class CurrentMasterPagesSelector + : public MasterPagesSelector, + public SfxListener +{ +public: + static MasterPagesSelector* Create ( + ::Window* pParent, + ViewShellBase& rViewShellBase, + const cssu::Reference<css::ui::XSidebar>& rxSidebar); + + /** Set the selection so that the master page is selected that is + used by the currently selected page of the document in the + center pane. + */ + virtual void UpdateSelection (void); + + /** Copy all master pages that are to be shown into the given list. + */ + virtual void Fill (ItemList& rItemList); + + using MasterPagesSelector::Fill; + +protected: + virtual ResId GetContextMenuResId (void) const; + + virtual void ProcessPopupMenu (Menu& rMenu); + virtual void ExecuteCommand (const sal_Int32 nCommandId); + +private: + cssu::Reference<css::lang::XComponent> mxListener; + + CurrentMasterPagesSelector ( + ::Window* pParent, + SdDrawDocument& rDocument, + ViewShellBase& rBase, + const ::boost::shared_ptr<MasterPageContainer>& rpContainer, + const cssu::Reference<css::ui::XSidebar>& rxSidebar); + virtual ~CurrentMasterPagesSelector (void); + + virtual void LateInit (void); + + DECL_LINK(EventMultiplexerListener,sd::tools::EventMultiplexerEvent*); + void NotifyHint (SfxBroadcaster&, const SfxHint& rHint); +}; + +} } // end of namespace sd::sidebar + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/sidebar/CustomAnimationPanel.cxx b/sd/source/ui/sidebar/CustomAnimationPanel.cxx new file mode 100644 index 000000000000..04d0009967c2 --- /dev/null +++ b/sd/source/ui/sidebar/CustomAnimationPanel.cxx @@ -0,0 +1,74 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "CustomAnimationPanel.hxx" + +#include "ViewShellBase.hxx" + + +namespace sd { + extern ::Window * createCustomAnimationPanel (::Window* pParent, ViewShellBase& rBase); + extern sal_Int32 getCustomAnimationPanelMinimumHeight (::Window* pParent); +} + + + + +namespace sd { namespace sidebar { + + +CustomAnimationPanel::CustomAnimationPanel ( + ::Window* pParentWindow, + ViewShellBase& rViewShellBase) + : PanelBase( + pParentWindow, + rViewShellBase) +{ +#ifdef DEBUG + SetText(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sd:CustomAnimationPanel"))); +#endif +} + + + + +CustomAnimationPanel::~CustomAnimationPanel (void) +{ +} + + + + +::Window* CustomAnimationPanel::CreateWrappedControl ( + ::Window* pParentWindow, + ViewShellBase& rViewShellBase) +{ + return createCustomAnimationPanel(pParentWindow, rViewShellBase); +} + + + + +css::ui::LayoutSize CustomAnimationPanel::GetHeightForWidth (const sal_Int32 /*nWidth*/) +{ + const sal_Int32 nMinimumHeight(getCustomAnimationPanelMinimumHeight(mpWrappedControl.get())); + return css::ui::LayoutSize(nMinimumHeight,-1, nMinimumHeight); +} + + +} } // end of namespace sd::sidebar diff --git a/sd/source/ui/sidebar/CustomAnimationPanel.hxx b/sd/source/ui/sidebar/CustomAnimationPanel.hxx new file mode 100644 index 000000000000..2fb71c1b4ec6 --- /dev/null +++ b/sd/source/ui/sidebar/CustomAnimationPanel.hxx @@ -0,0 +1,46 @@ +/* + * 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 SD_SIDEBAR_CUSTOM_ANIMATION_PANEL_HXX +#define SD_SIDEBAR_CUSTOM_ANIMATION_PANEL_HXX + +#include "PanelBase.hxx" + + +namespace sd { namespace sidebar { + +class CustomAnimationPanel + : public PanelBase +{ +public: + CustomAnimationPanel ( + ::Window* pParentWindow, + ViewShellBase& rViewShellBase); + virtual ~CustomAnimationPanel (void); + + // ILayoutableWindow + virtual css::ui::LayoutSize GetHeightForWidth (const sal_Int32 nWidth); + +protected: + virtual ::Window* CreateWrappedControl ( + ::Window* pParentWindow, + ViewShellBase& rViewShellBase); +}; + +} } // end of namespace sd::sidebar + +#endif diff --git a/sd/source/ui/sidebar/DocumentHelper.cxx b/sd/source/ui/sidebar/DocumentHelper.cxx new file mode 100644 index 000000000000..4cdbb0e3f480 --- /dev/null +++ b/sd/source/ui/sidebar/DocumentHelper.cxx @@ -0,0 +1,570 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "DocumentHelper.hxx" + +#include "drawdoc.hxx" +#include "DrawDocShell.hxx" +#include "sdpage.hxx" +#include "glob.hxx" +#include "unmovss.hxx" +#include "strings.hrc" +#include "sdresid.hxx" +#include "undoback.hxx" +#include <com/sun/star/drawing/XDrawPagesSupplier.hpp> +#include <com/sun/star/drawing/XDrawPages.hpp> +#include <com/sun/star/frame/XComponentLoader.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include "stlpool.hxx" +#include <svx/xfillit0.hxx> +#include <tools/diagnose_ex.h> + +using namespace ::com::sun::star; + +namespace sd { namespace sidebar { + +SdPage* DocumentHelper::CopyMasterPageToLocalDocument ( + SdDrawDocument& rTargetDocument, + SdPage* pMasterPage) +{ + SdPage* pNewMasterPage = NULL; + + do + { + if (pMasterPage == NULL) + break; + + // Check the presence of the source document. + SdDrawDocument* pSourceDocument = static_cast<SdDrawDocument*>( + pMasterPage->GetModel()); + if (pSourceDocument == NULL) + break; + + // When the given master page already belongs to the target document + // then there is nothing more to do. + if (pSourceDocument == &rTargetDocument) + { + pNewMasterPage = pMasterPage; + break; + } + + // Test if the master pages of both the slide and its notes page are + // present. This is not the case when we are called during the + // creation of the slide master page because then the notes master + // page is not there. + sal_uInt16 nSourceMasterPageCount = pSourceDocument->GetMasterPageCount(); + if (nSourceMasterPageCount%2 == 0) + // There should be 1 handout page + n slide masters + n notes + // masters = 2*n+1. An even value indicates that a new slide + // master but not yet the notes master has been inserted. + break; + sal_uInt16 nIndex = pMasterPage->GetPageNum(); + if (nSourceMasterPageCount <= nIndex+1) + break; + // Get the slide master page. + if (pMasterPage != static_cast<SdPage*>( + pSourceDocument->GetMasterPage(nIndex))) + break; + // Get the notes master page. + SdPage* pNotesMasterPage = static_cast<SdPage*>( + pSourceDocument->GetMasterPage(nIndex+1)); + if (pNotesMasterPage == NULL) + break; + + + // Check if a master page with the same name as that of the given + // master page already exists. + bool bPageExists (false); + sal_uInt16 nMasterPageCount(rTargetDocument.GetMasterSdPageCount(PK_STANDARD)); + for (sal_uInt16 nMaster=0; nMaster<nMasterPageCount; nMaster++) + { + SdPage* pCandidate = static_cast<SdPage*>( + rTargetDocument.GetMasterSdPage (nMaster, PK_STANDARD)); + if (pMasterPage!=NULL + && pCandidate->GetName().CompareTo(pMasterPage->GetName())==0) + { + bPageExists = true; + pNewMasterPage = pCandidate; + break; + } + } + if (bPageExists) + break; + + // Create a new slide (and its notes page.) + uno::Reference<drawing::XDrawPagesSupplier> xSlideSupplier ( + rTargetDocument.getUnoModel(), uno::UNO_QUERY); + if ( ! xSlideSupplier.is()) + break; + uno::Reference<drawing::XDrawPages> xSlides ( + xSlideSupplier->getDrawPages(), uno::UNO_QUERY); + if ( ! xSlides.is()) + break; + xSlides->insertNewByIndex (xSlides->getCount()); + + // Set a layout. + SdPage* pSlide = rTargetDocument.GetSdPage( + rTargetDocument.GetSdPageCount(PK_STANDARD)-1, + PK_STANDARD); + if (pSlide == NULL) + break; + pSlide->SetAutoLayout(AUTOLAYOUT_TITLE, sal_True); + + // Create a copy of the master page and the associated notes + // master page and insert them into our document. + pNewMasterPage = AddMasterPage(rTargetDocument, pMasterPage); + if (pNewMasterPage==NULL) + break; + SdPage* pNewNotesMasterPage + = AddMasterPage(rTargetDocument, pNotesMasterPage); + if (pNewNotesMasterPage==NULL) + break; + + // Make the connection from the new slide to the master page + // (and do the same for the notes page.) + rTargetDocument.SetMasterPage ( + rTargetDocument.GetSdPageCount(PK_STANDARD)-1, + pNewMasterPage->GetName(), + &rTargetDocument, + sal_False, // Connect the new master page with the new slide but + // do not modify other (master) pages. + sal_True); + } + while (false); + + // We are not interested in any automatisms for our modified internal + // document. + rTargetDocument.SetChanged (sal_False); + + return pNewMasterPage; +} + + + + +SdPage* DocumentHelper::GetSlideForMasterPage (SdPage* pMasterPage) +{ + SdPage* pCandidate = NULL; + + SdDrawDocument* pDocument = NULL; + if (pMasterPage != NULL) + pDocument = dynamic_cast<SdDrawDocument*>(pMasterPage->GetModel()); + + // Iterate over all pages and check if it references the given master + // page. + if (pDocument!=NULL && pDocument->GetSdPageCount(PK_STANDARD) > 0) + { + // In most cases a new slide has just been inserted so start with + // the last page. + sal_uInt16 nPageIndex (pDocument->GetSdPageCount(PK_STANDARD)-1); + bool bFound (false); + while ( ! bFound) + { + pCandidate = pDocument->GetSdPage( + nPageIndex, + PK_STANDARD); + if (pCandidate != NULL) + { + if (static_cast<SdPage*>(&pCandidate->TRG_GetMasterPage()) + == pMasterPage) + { + bFound = true; + break; + } + } + + if (nPageIndex == 0) + break; + else + nPageIndex --; + } + + // If no page was found that refernced the given master page reset + // the pointer that is returned. + if ( ! bFound) + pCandidate = NULL; + } + + return pCandidate; +} + + + + +SdPage* DocumentHelper::AddMasterPage ( + SdDrawDocument& rTargetDocument, + SdPage* pMasterPage) +{ + SdPage* pClonedMasterPage = NULL; + + if (pMasterPage!=NULL) + { + try + { + // Duplicate the master page. + pClonedMasterPage = static_cast<SdPage*>(pMasterPage->Clone()); + + // Copy the necessary styles. + SdDrawDocument* pSourceDocument + = static_cast<SdDrawDocument*>(pMasterPage->GetModel()); + if (pSourceDocument != NULL) + ProvideStyles (*pSourceDocument, rTargetDocument, pClonedMasterPage); + + // Copy the precious flag. + pClonedMasterPage->SetPrecious(pMasterPage->IsPrecious()); + + // Now that the styles are available we can insert the cloned + // master page. + rTargetDocument.InsertMasterPage (pClonedMasterPage); + } + catch(const uno::Exception&) + { + pClonedMasterPage = NULL; + DBG_UNHANDLED_EXCEPTION(); + } + catch(const ::std::exception&) + { + pClonedMasterPage = NULL; + OSL_TRACE ("caught general exception"); + } + catch(...) + { + pClonedMasterPage = NULL; + OSL_TRACE ("caught general exception"); + } + } + + return pClonedMasterPage; +} + + + + +void DocumentHelper::ProvideStyles ( + SdDrawDocument& rSourceDocument, + SdDrawDocument& rTargetDocument, + SdPage* pPage) +{ + // Get the layout name of the given page. + String sLayoutName (pPage->GetLayoutName()); + sLayoutName.Erase (sLayoutName.SearchAscii (SD_LT_SEPARATOR)); + + // Copy the style sheet from source to target document. + SdStyleSheetPool* pSourceStyleSheetPool = + static_cast<SdStyleSheetPool*>(rSourceDocument.GetStyleSheetPool()); + SdStyleSheetPool* pTargetStyleSheetPool = + static_cast<SdStyleSheetPool*>(rTargetDocument.GetStyleSheetPool()); + SdStyleSheetVector aCreatedStyles; + pTargetStyleSheetPool->CopyLayoutSheets ( + sLayoutName, + *pSourceStyleSheetPool, + aCreatedStyles); + + // Add an undo action for the copied style sheets. + if( !aCreatedStyles.empty() ) + { + ::svl::IUndoManager* pUndoManager = rTargetDocument.GetDocSh()->GetUndoManager(); + if (pUndoManager != NULL) + { + SdMoveStyleSheetsUndoAction* pMovStyles = + new SdMoveStyleSheetsUndoAction ( + &rTargetDocument, + aCreatedStyles, + sal_True); + pUndoManager->AddUndoAction (pMovStyles); + } + } +} + + + + +void DocumentHelper::AssignMasterPageToPageList ( + SdDrawDocument& rTargetDocument, + SdPage* pMasterPage, + const ::boost::shared_ptr<std::vector<SdPage*> >& rpPageList) +{ + if (pMasterPage == NULL || !pMasterPage->IsMasterPage()) + return; + + // Make the layout name by stripping ouf the layout postfix from the + // layout name of the given master page. + OUString sFullLayoutName(pMasterPage->GetLayoutName()); + String sBaseLayoutName (sFullLayoutName); + sBaseLayoutName.Erase (sBaseLayoutName.SearchAscii (SD_LT_SEPARATOR)); + + if (rpPageList->empty()) + return; + + // Create a second list that contains only the valid pointers to + // pages for which an assignment is necessary. + ::std::vector<SdPage*>::const_iterator iPage; + ::std::vector<SdPage*> aCleanedList; + for (iPage=rpPageList->begin(); iPage!=rpPageList->end(); ++iPage) + { + OSL_ASSERT(*iPage!=NULL && (*iPage)->GetModel() == &rTargetDocument); + if (*iPage != NULL && (*iPage)->GetLayoutName() != sFullLayoutName) + { + aCleanedList.push_back(*iPage); + } + } + if (aCleanedList.empty() ) + return; + + ::svl::IUndoManager* pUndoMgr = rTargetDocument.GetDocSh()->GetUndoManager(); + if( pUndoMgr ) + pUndoMgr->EnterListAction(String(SdResId(STR_UNDO_SET_PRESLAYOUT)), String()); + + SdPage* pMasterPageInDocument = ProvideMasterPage(rTargetDocument,pMasterPage,rpPageList); + if (pMasterPageInDocument == NULL) + return; + + // Assign the master pages to the given list of pages. + for (iPage=aCleanedList.begin(); + iPage!=aCleanedList.end(); + ++iPage) + { + AssignMasterPageToPage ( + pMasterPageInDocument, + sBaseLayoutName, + *iPage); + } + + if( pUndoMgr ) + pUndoMgr->LeaveListAction(); +} + + + + +SdPage* DocumentHelper::AddMasterPage ( + SdDrawDocument& rTargetDocument, + SdPage* pMasterPage, + sal_uInt16 nInsertionIndex) +{ + SdPage* pClonedMasterPage = NULL; + + if (pMasterPage!=NULL) + { + // Duplicate the master page. + pClonedMasterPage = static_cast<SdPage*>(pMasterPage->Clone()); + + // Copy the precious flag. + pClonedMasterPage->SetPrecious(pMasterPage->IsPrecious()); + + // Copy the necessary styles. + SdDrawDocument* pSourceDocument + = static_cast<SdDrawDocument*>(pMasterPage->GetModel()); + if (pSourceDocument != NULL) + { + ProvideStyles (*pSourceDocument, rTargetDocument, pClonedMasterPage); + + // Now that the styles are available we can insert the cloned + // master page. + rTargetDocument.InsertMasterPage (pClonedMasterPage, nInsertionIndex); + + // Adapt the size of the new master page to that of the pages in + // the document. + Size aNewSize (rTargetDocument.GetSdPage(0, pMasterPage->GetPageKind())->GetSize()); + Rectangle aBorders ( + pClonedMasterPage->GetLftBorder(), + pClonedMasterPage->GetUppBorder(), + pClonedMasterPage->GetRgtBorder(), + pClonedMasterPage->GetLwrBorder()); + pClonedMasterPage->ScaleObjects(aNewSize, aBorders, sal_True); + pClonedMasterPage->SetSize(aNewSize); + pClonedMasterPage->CreateTitleAndLayout(sal_True); + } + } + + return pClonedMasterPage; +} + + + + +/** In here we have to handle three cases: + 1. pPage is a normal slide. We can use SetMasterPage to assign the + master pages to it. + 2. pPage is a master page that is used by at least one slide. We can + assign the master page to these slides. + 3. pPage is a master page that is currently not used by any slide. + We can delete that page and add copies of the given master pages + instead. + + For points 2 and 3 where one master page A is assigned to another B we have + to keep in mind that the master page that page A has already been + inserted into the target document. +*/ +void DocumentHelper::AssignMasterPageToPage ( + SdPage* pMasterPage, + const String& rsBaseLayoutName, + SdPage* pPage) +{ + // Leave early when the parameters are invalid. + if (pPage == NULL || pMasterPage == NULL) + return; + SdDrawDocument* pDocument = dynamic_cast<SdDrawDocument*>(pPage->GetModel()); + if (pDocument == NULL) + return; + + if ( ! pPage->IsMasterPage()) + { + // 1. Remove the background object (so that that, if it exists, does + // not override the new master page) and assign the master page to + // the regular slide. + pDocument->GetDocSh()->GetUndoManager()->AddUndoAction( + new SdBackgroundObjUndoAction( + *pDocument, *pPage, pPage->getSdrPageProperties().GetItemSet()), + sal_True); + pPage->getSdrPageProperties().PutItem(XFillStyleItem(XFILL_NONE)); + + pDocument->SetMasterPage ( + (pPage->GetPageNum()-1)/2, + rsBaseLayoutName, + pDocument, + sal_False, + sal_False); + } + else + { + // Find first slide that uses the master page. + SdPage* pSlide = NULL; + sal_uInt16 nPageCount = pDocument->GetSdPageCount(PK_STANDARD); + for (sal_uInt16 nPage=0; nPage<nPageCount&&pSlide==NULL; nPage++) + { + SdrPage* pCandidate = pDocument->GetSdPage(nPage,PK_STANDARD); + if (pCandidate != NULL + && pCandidate->TRG_HasMasterPage() + && &(pCandidate->TRG_GetMasterPage()) == pPage) + { + pSlide = static_cast<SdPage*>(pCandidate); + } + } + + if (pSlide != NULL) + { + // 2. Assign the given master pages to the first slide that was + // found above that uses the master page. + pDocument->SetMasterPage ( + (pSlide->GetPageNum()-1)/2, + rsBaseLayoutName, + pDocument, + sal_False, + sal_False); + } + else + { + // 3. Replace the master page A by a copy of the given master + // page B. + pDocument->RemoveUnnecessaryMasterPages ( + pPage, sal_False); + } + } +} + + + + +SdPage* DocumentHelper::ProvideMasterPage ( + SdDrawDocument& rTargetDocument, + SdPage* pMasterPage, + const ::boost::shared_ptr<std::vector<SdPage*> >& rpPageList) +{ + // Make sure that both the master page and its notes master exist + // in the source document. If one is missing then return without + // making any changes. + if (pMasterPage == NULL) + { + // The caller should make sure that the master page is valid. + OSL_ASSERT(pMasterPage != NULL); + return NULL; + } + SdDrawDocument* pSourceDocument = static_cast<SdDrawDocument*>(pMasterPage->GetModel()); + if (pSourceDocument == NULL) + return NULL; + SdPage* pNotesMasterPage = static_cast<SdPage*>( + pSourceDocument->GetMasterPage(pMasterPage->GetPageNum()+1)); + if (pNotesMasterPage == NULL) + { + // The model is not in a valid state. Maybe a new master page + // is being (not finished yet) created? Return without making + // any changes. + return NULL; + } + + SdPage* pMasterPageInDocument = NULL; + // Search for a master page with the same name as the given one in + // the target document. + const OUString sMasterPageLayoutName (pMasterPage->GetLayoutName()); + for (sal_uInt16 nIndex=0,nCount=rTargetDocument.GetMasterPageCount(); nIndex<nCount; ++nIndex) + { + SdPage* pCandidate = static_cast<SdPage*>(rTargetDocument.GetMasterPage(nIndex)); + if (pCandidate && sMasterPageLayoutName.equals(pCandidate->GetLayoutName())) + { + // The requested master page does already exist in the + // target document, return it. + return pCandidate; + } + } + + // The given master page does not already belong to the target + // document so we have to create copies and insert them into the + // targer document. + + // Determine the position where the new master pages are inserted. + // By default they are inserted at the end. When we assign to a + // master page then insert after the last of the (selected) pages. + sal_uInt16 nInsertionIndex = rTargetDocument.GetMasterPageCount(); + if (rpPageList->front()->IsMasterPage()) + { + nInsertionIndex = rpPageList->back()->GetPageNum(); + } + + // Clone the master page. + if (pMasterPage->GetModel() != &rTargetDocument) + { + pMasterPageInDocument = AddMasterPage (rTargetDocument, pMasterPage, nInsertionIndex); + if( rTargetDocument.IsUndoEnabled() ) + rTargetDocument.AddUndo( + rTargetDocument.GetSdrUndoFactory().CreateUndoNewPage(*pMasterPageInDocument)); + } + else + pMasterPageInDocument = pMasterPage; + + // Clone the notes master. + if (pNotesMasterPage->GetModel() != &rTargetDocument) + { + SdPage* pClonedNotesMasterPage + = AddMasterPage (rTargetDocument, pNotesMasterPage, nInsertionIndex+1); + if( rTargetDocument.IsUndoEnabled() ) + rTargetDocument.AddUndo( + rTargetDocument.GetSdrUndoFactory().CreateUndoNewPage(*pClonedNotesMasterPage)); + } + + return pMasterPageInDocument; +} + + + + + +} } // end of namespace sd::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/sidebar/DocumentHelper.hxx b/sd/source/ui/sidebar/DocumentHelper.hxx new file mode 100644 index 000000000000..b0b1d1550a3f --- /dev/null +++ b/sd/source/ui/sidebar/DocumentHelper.hxx @@ -0,0 +1,110 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef SD_SIDEBAR_PANELS_DCUMENT_HELPER_HXX +#define SD_SIDEBAR_PANELS_DCUMENT_HELPER_HXX + +#include <tools/solar.h> +#include <boost/shared_ptr.hpp> +#include <vector> + +class SdDrawDocument; +class SdPage; +class String; + +namespace sd { namespace sidebar { + +/** A collection of methods supporting the handling of master pages. +*/ +class DocumentHelper +{ +public: + /** Return a copy of the given master page in the given document. + */ + static SdPage* CopyMasterPageToLocalDocument ( + SdDrawDocument& rTargetDocument, + SdPage* pMasterPage); + + /** Return and, when not yet present, create a slide that uses the given + masster page. + */ + static SdPage* GetSlideForMasterPage (SdPage* pMasterPage); + + /** Copy the styles used by the given page from the source document to + the target document. + */ + static void ProvideStyles ( + SdDrawDocument& rSourceDocument, + SdDrawDocument& rTargetDocument, + SdPage* pPage); + + /** Assign the given master page to the list of pages. + @param rTargetDocument + The document that is the owner of the pages in rPageList. + @param pMasterPage + This master page will usually be a member of the list of all + available master pages as provided by the MasterPageContainer. + @param rPageList + The pages to which to assign the master page. These pages may + be slides or master pages themselves. + */ + static void AssignMasterPageToPageList ( + SdDrawDocument& rTargetDocument, + SdPage* pMasterPage, + const ::boost::shared_ptr<std::vector<SdPage*> >& rPageList); + +private: + static SdPage* AddMasterPage ( + SdDrawDocument& rTargetDocument, + SdPage* pMasterPage); + static SdPage* AddMasterPage ( + SdDrawDocument& rTargetDocument, + SdPage* pMasterPage, + sal_uInt16 nInsertionIndex); + static SdPage* ProvideMasterPage ( + SdDrawDocument& rTargetDocument, + SdPage* pMasterPage, + const ::boost::shared_ptr<std::vector<SdPage*> >& rpPageList); + + /** Assign the given master page to the given page. + @param pMasterPage + In contrast to AssignMasterPageToPageList() this page is assumed + to be in the target document, i.e. the same document that pPage + is in. The caller will usually call AddMasterPage() to create a + clone of a master page in a another document to create it. + @param rsBaseLayoutName + The layout name of the given master page. It is given so that + it has not to be created on every call. It could be generated + from the given master page, though. + @param pPage + The page to which to assign the master page. It can be a slide + or a master page itself. + */ + static void AssignMasterPageToPage ( + SdPage* pMasterPage, + const String& rsBaseLayoutName, + SdPage* pPage); +}; + + +} } // end of namespace sd::sidebar + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/sidebar/IDisposable.hxx b/sd/source/ui/sidebar/IDisposable.hxx new file mode 100644 index 000000000000..d5dfc1d440e7 --- /dev/null +++ b/sd/source/ui/sidebar/IDisposable.hxx @@ -0,0 +1,39 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SD_SIDEBAR_DISPOSABLE_INTERFACE_HXX +#define SD_SIDEBAR_DISPOSABLE_INTERFACE_HXX + +#include <tools/gen.hxx> +#include <sal/types.h> + +class Window; + +namespace sd { namespace sidebar { + + +class IDisposable +{ +public: + virtual void Dispose (void) = 0; + virtual ~IDisposable(); +}; + + +} } // end of namespace ::sd::sidebar + +#endif diff --git a/sd/source/ui/sidebar/ISidebarReceiver.hxx b/sd/source/ui/sidebar/ISidebarReceiver.hxx new file mode 100644 index 000000000000..3725363da830 --- /dev/null +++ b/sd/source/ui/sidebar/ISidebarReceiver.hxx @@ -0,0 +1,37 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SD_SIDEBAR_RECEIVER_INTERFACE_HXX +#define SD_SIDEBAR_RECEIVER_INTERFACE_HXX + +#include <com/sun/star/ui/XSidebar.hpp> + +namespace sd { namespace sidebar { + + +class ISidebarReceiver +{ +public: + virtual void SetSidebar (const ::com::sun::star::uno::Reference< + ::com::sun::star::ui::XSidebar>& rxSidebar) = 0; + virtual ~ISidebarReceiver(); +}; + + +} } // end of namespace ::sd::sidebar + +#endif diff --git a/sd/source/ui/sidebar/LayoutMenu.cxx b/sd/source/ui/sidebar/LayoutMenu.cxx new file mode 100644 index 000000000000..5f347439503c --- /dev/null +++ b/sd/source/ui/sidebar/LayoutMenu.cxx @@ -0,0 +1,979 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "LayoutMenu.hxx" + +#include "SidebarShellManager.hxx" +#include "app.hrc" +#include "drawdoc.hxx" +#include "framework/FrameworkHelper.hxx" +#include "glob.hrc" +#include "glob.hxx" +#include "helpids.h" +#include "pres.hxx" +#include "res_bmp.hrc" +#include "sdpage.hxx" +#include "sdresid.hxx" +#include "strings.hrc" +#include "tools/SlotStateListener.hxx" +#include "DrawController.hxx" +#include "DrawDocShell.hxx" +#include "DrawViewShell.hxx" +#include "EventMultiplexer.hxx" +#include "SlideSorterViewShell.hxx" +#include "ViewShellBase.hxx" +#include <sfx2/sidebar/Theme.hxx> + +#include <comphelper/processfactory.hxx> +#include <sfx2/app.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/objface.hxx> +#include <sfx2/request.hxx> +#include <sfx2/viewfrm.hxx> +#include <svl/languageoptions.hxx> +#include <vcl/image.hxx> +#include <vcl/floatwin.hxx> + +#include <com/sun/star/frame/XController.hpp> +#include <com/sun/star/drawing/framework/XControllerManager.hpp> +#include <com/sun/star/drawing/framework/XView.hpp> +#include <com/sun/star/drawing/framework/ResourceId.hpp> + +#include <vector> +#include <memory> + +using namespace ::com::sun::star; +using namespace ::com::sun::star::text; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::drawing::framework; +using namespace ::sd::slidesorter; +using ::sd::framework::FrameworkHelper; + +namespace sd { namespace sidebar { + + + +struct snewfoil_value_info +{ + sal_uInt16 mnBmpResId; + sal_uInt16 mnStrResId; + WritingMode meWritingMode; + AutoLayout maAutoLayout; +}; + +static snewfoil_value_info notes[] = +{ + {BMP_FOILN_01, STR_AUTOLAYOUT_NOTES, WritingMode_LR_TB, + AUTOLAYOUT_NOTES}, + {0, 0, WritingMode_LR_TB, AUTOLAYOUT_NONE}, +}; + +static snewfoil_value_info handout[] = +{ + {BMP_FOILH_01, STR_AUTOLAYOUT_HANDOUT1, WritingMode_LR_TB, + AUTOLAYOUT_HANDOUT1}, + {BMP_FOILH_02, STR_AUTOLAYOUT_HANDOUT2, WritingMode_LR_TB, + AUTOLAYOUT_HANDOUT2}, + {BMP_FOILH_03, STR_AUTOLAYOUT_HANDOUT3, WritingMode_LR_TB, + AUTOLAYOUT_HANDOUT3}, + {BMP_FOILH_04, STR_AUTOLAYOUT_HANDOUT4, WritingMode_LR_TB, + AUTOLAYOUT_HANDOUT4}, + {BMP_FOILH_06, STR_AUTOLAYOUT_HANDOUT6, WritingMode_LR_TB, + AUTOLAYOUT_HANDOUT6}, + {BMP_FOILH_09, STR_AUTOLAYOUT_HANDOUT9, WritingMode_LR_TB, + AUTOLAYOUT_HANDOUT9}, + {0, 0, WritingMode_LR_TB, AUTOLAYOUT_NONE}, +}; + +static snewfoil_value_info standard[] = +{ + {BMP_LAYOUT_EMPTY, STR_AUTOLAYOUT_NONE, WritingMode_LR_TB, AUTOLAYOUT_NONE}, + {BMP_LAYOUT_HEAD03, STR_AUTOLAYOUT_TITLE, WritingMode_LR_TB, AUTOLAYOUT_TITLE}, + {BMP_LAYOUT_HEAD02, STR_AUTOLAYOUT_CONTENT, WritingMode_LR_TB, AUTOLAYOUT_ENUM}, + {BMP_LAYOUT_HEAD02A, STR_AUTOLAYOUT_2CONTENT, WritingMode_LR_TB, AUTOLAYOUT_2TEXT}, + {BMP_LAYOUT_HEAD01, STR_AUTOLAYOUT_ONLY_TITLE, WritingMode_LR_TB, AUTOLAYOUT_ONLY_TITLE}, + {BMP_LAYOUT_TEXTONLY, STR_AUTOLAYOUT_ONLY_TEXT, WritingMode_LR_TB, AUTOLAYOUT_ONLY_TEXT}, + {BMP_LAYOUT_HEAD03B, STR_AUTOLAYOUT_2CONTENT_CONTENT, WritingMode_LR_TB, AUTOLAYOUT_2OBJTEXT}, + {BMP_LAYOUT_HEAD03C, STR_AUTOLAYOUT_CONTENT_2CONTENT, WritingMode_LR_TB, AUTOLAYOUT_TEXT2OBJ}, + {BMP_LAYOUT_HEAD03A, STR_AUTOLAYOUT_2CONTENT_OVER_CONTENT,WritingMode_LR_TB, AUTOLAYOUT_2OBJOVERTEXT}, + {BMP_LAYOUT_HEAD02B, STR_AUTOLAYOUT_CONTENT_OVER_CONTENT, WritingMode_LR_TB, AUTOLAYOUT_OBJOVERTEXT}, + {BMP_LAYOUT_HEAD04, STR_AUTOLAYOUT_4CONTENT, WritingMode_LR_TB, AUTOLAYOUT_4OBJ}, + {BMP_LAYOUT_HEAD06, STR_AUTOLAYOUT_6CONTENT, WritingMode_LR_TB, AUTOLAYOUT_6CLIPART}, + + // vertical + {BMP_LAYOUT_VERTICAL02, STR_AL_VERT_TITLE_TEXT_CHART, WritingMode_TB_RL,AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART}, + {BMP_LAYOUT_VERTICAL01, STR_AL_VERT_TITLE_VERT_OUTLINE, WritingMode_TB_RL, AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE}, + {BMP_LAYOUT_HEAD02, STR_AL_TITLE_VERT_OUTLINE, WritingMode_TB_RL, AUTOLAYOUT_TITLE_VERTICAL_OUTLINE}, + {BMP_LAYOUT_HEAD02A, STR_AL_TITLE_VERT_OUTLINE_CLIPART, WritingMode_TB_RL, AUTOLAYOUT_TITLE_VERTICAL_OUTLINE_CLIPART}, + {0, 0, WritingMode_LR_TB, AUTOLAYOUT_NONE} +}; + + + + +LayoutMenu::LayoutMenu ( + ::Window* pParent, + ViewShellBase& rViewShellBase, + const cssu::Reference<css::ui::XSidebar>& rxSidebar) + : ValueSet (pParent, WB_ITEMBORDER), + DragSourceHelper(this), + DropTargetHelper(this), + mrBase(rViewShellBase), + mbUseOwnScrollBar(false), + mnPreferredColumnCount(3), + mxListener(NULL), + mbSelectionUpdatePending(true), + mbIsMainViewChangePending(false), + mxSidebar(rxSidebar), + mbIsDisposed(false) +{ + implConstruct( *mrBase.GetDocument()->GetDocSh() ); + OSL_TRACE("created LayoutMenu at %x", this); + + SetStyle(GetStyle() | WB_ITEMBORDER | WB_FLATVALUESET | WB_TABSTOP); + + SetBackground(sfx2::sidebar::Theme::GetWallpaper(sfx2::sidebar::Theme::Paint_PanelBackground)); + SetColor(sfx2::sidebar::Theme::GetColor(sfx2::sidebar::Theme::Paint_PanelBackground)); + +#ifdef DEBUG + SetText(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sd:LayoutMenu"))); +#endif +} + + + + +void LayoutMenu::implConstruct( DrawDocShell& rDocumentShell ) +{ + OSL_ENSURE( mrBase.GetDocument()->GetDocSh() == &rDocumentShell, + "LayoutMenu::implConstruct: hmm?" ); + // if this fires, then my assumption that the rDocumentShell parameter to our first ctor is superfluous ... + + SetStyle ( + ( GetStyle() & ~(WB_ITEMBORDER) ) + | WB_TABSTOP + | WB_MENUSTYLEVALUESET + | WB_NO_DIRECTSELECT + ); + if (mbUseOwnScrollBar) + SetStyle (GetStyle() | WB_VSCROLL); + SetExtraSpacing(2); + SetSelectHdl (LINK(this, LayoutMenu, ClickHandler)); + InvalidateContent(); + + Link aEventListenerLink (LINK(this,LayoutMenu,EventMultiplexerListener)); + mrBase.GetEventMultiplexer()->AddEventListener(aEventListenerLink, + ::sd::tools::EventMultiplexerEvent::EID_CURRENT_PAGE + | ::sd::tools::EventMultiplexerEvent::EID_SLIDE_SORTER_SELECTION + | ::sd::tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED + | ::sd::tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED + | ::sd::tools::EventMultiplexerEvent::EID_CONFIGURATION_UPDATED + | ::sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_NORMAL + | ::sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_MASTER); + + Window::SetHelpId(HID_SD_TASK_PANE_PREVIEW_LAYOUTS); + SetAccessibleName(SdResId(STR_TASKPANEL_LAYOUT_MENU_TITLE)); + + Link aStateChangeLink (LINK(this,LayoutMenu,StateChangeHandler)); + mxListener = new ::sd::tools::SlotStateListener( + aStateChangeLink, + Reference<frame::XDispatchProvider>(mrBase.GetController()->getFrame(), UNO_QUERY), + ".uno:VerticalTextState"); + + SetSizePixel(GetParent()->GetSizePixel()); + Link aWindowEventHandlerLink (LINK(this,LayoutMenu,WindowEventHandler)); + GetParent()->AddEventListener(aWindowEventHandlerLink); +} + + + + +LayoutMenu::~LayoutMenu (void) +{ + OSL_TRACE("destroying LayoutMenu at %x", this); + Dispose(); +} + + + + +void LayoutMenu::Dispose (void) +{ + if (mbIsDisposed) + return; + + OSL_TRACE("disposing LayoutMenu at %x", this); + + mbIsDisposed = true; + + Reference<lang::XComponent> xComponent (mxListener, UNO_QUERY); + if (xComponent.is()) + xComponent->dispose(); + + Clear(); + Link aLink (LINK(this,LayoutMenu,EventMultiplexerListener)); + mrBase.GetEventMultiplexer()->RemoveEventListener (aLink); + + Link aWindowEventHandlerLink (LINK(this,LayoutMenu,WindowEventHandler)); + GetParent()->RemoveEventListener(aWindowEventHandlerLink); +} + + + + +AutoLayout LayoutMenu::GetSelectedAutoLayout (void) +{ + AutoLayout aResult = AUTOLAYOUT_NONE; + + if ( ! IsNoSelection() && GetSelectItemId()!=0) + { + AutoLayout* pLayout = static_cast<AutoLayout*>(GetItemData(GetSelectItemId())); + if (pLayout != NULL) + aResult = *pLayout; + } + + return aResult; +} + + + + +/** The preferred size depends on the preferred number of columns, the + number of items, and the size of the items. +*/ +Size LayoutMenu::GetPreferredSize (void) +{ + Size aItemSize = CalcItemSizePixel (Size()); + Size aPreferredWindowSize = CalcWindowSizePixel ( + aItemSize, + (sal_uInt16)mnPreferredColumnCount, + (sal_uInt16)CalculateRowCount (aItemSize,mnPreferredColumnCount)); + return aPreferredWindowSize; +} + + + + +sal_Int32 LayoutMenu::GetPreferredWidth (sal_Int32 nHeight) +{ + sal_Int32 nPreferredWidth = 100; + if (GetItemCount() > 0) + { + Image aImage = GetItemImage(GetItemId(0)); + Size aItemSize = CalcItemSizePixel (aImage.GetSizePixel()); + if (nHeight>0 && aItemSize.Height()>0) + { + int nRowCount = nHeight / aItemSize.Height(); + if (nRowCount <= 0) + nRowCount = 1; + int nColumnCount = (GetItemCount() + nRowCount-1) / nRowCount; + nPreferredWidth = nColumnCount * aItemSize.Width(); + } + } + + return nPreferredWidth; +} + + + + +ui::LayoutSize LayoutMenu::GetHeightForWidth (const sal_Int32 nWidth) +{ + sal_Int32 nPreferredHeight = 200; + if ( ! mbUseOwnScrollBar && GetItemCount()>0) + { + Image aImage = GetItemImage(GetItemId(0)); + Size aItemSize = CalcItemSizePixel (aImage.GetSizePixel()); + if (nWidth>0 && aItemSize.Width()>0) + { + aItemSize.Width() += 8; + aItemSize.Height() += 8; + int nColumnCount = nWidth / aItemSize.Width(); + if (nColumnCount <= 0) + nColumnCount = 1; + else if (nColumnCount > 4) + nColumnCount = 4; + int nRowCount = (GetItemCount() + nColumnCount-1) / nColumnCount; + nPreferredHeight = nRowCount * aItemSize.Height(); + } + } + return ui::LayoutSize(nPreferredHeight,nPreferredHeight,nPreferredHeight); +} + + + + +sal_Int32 LayoutMenu::GetMinimumWidth (void) +{ + sal_Int32 nMinimumWidth = 0; + if (GetItemCount()>0) + { + Image aImage = GetItemImage(GetItemId(0)); + Size aItemSize = CalcItemSizePixel (aImage.GetSizePixel()); + nMinimumWidth = aItemSize.Width(); + } + return nMinimumWidth; +} + + + + +void LayoutMenu::UpdateEnabledState (const MasterMode eMode) +{ + bool bIsEnabled (false); + + ::boost::shared_ptr<ViewShell> pMainViewShell (mrBase.GetMainViewShell()); + if (pMainViewShell) + { + switch (pMainViewShell->GetShellType()) + { + case ViewShell::ST_NONE: + case ViewShell::ST_OUTLINE: + case ViewShell::ST_PRESENTATION: + case ViewShell::ST_SIDEBAR: + // The complete task pane is disabled for these values or + // not even visible. Disabling the LayoutMenu would be + // logical but unnecessary. The main disadvantage is that + // after re-enabling it (typically) another panel is + // expanded. + bIsEnabled = true; + break; + + case ViewShell::ST_DRAW: + case ViewShell::ST_IMPRESS: + { + switch (eMode) + { + case MM_UNKNOWN: + { + ::boost::shared_ptr<DrawViewShell> pDrawViewShell ( + ::boost::dynamic_pointer_cast<DrawViewShell>(pMainViewShell)); + if (pDrawViewShell) + bIsEnabled = pDrawViewShell->GetEditMode() != EM_MASTERPAGE; + break; + } + case MM_NORMAL: + bIsEnabled = true; + break; + + case MM_MASTER: + bIsEnabled = false; + break; + } + break; + } + + case ViewShell::ST_HANDOUT: + case ViewShell::ST_NOTES: + case ViewShell::ST_SLIDE_SORTER: + default: + bIsEnabled = true; + break; + } + } + (void)bIsEnabled; //FIXME either this method is a no-op or this should do something +} + + + + +void LayoutMenu::Paint (const Rectangle& rRect) +{ + if (mbSelectionUpdatePending) + { + mbSelectionUpdatePending = false; + UpdateSelection(); + } + ValueSet::Paint (rRect); +} + + + + +void LayoutMenu::Resize (void) +{ + Size aWindowSize = GetOutputSizePixel(); + if (IsVisible() && aWindowSize.Width() > 0) + { + // Calculate the number of rows and columns. + if (GetItemCount() > 0) + { + Image aImage = GetItemImage(GetItemId(0)); + Size aItemSize = CalcItemSizePixel ( + aImage.GetSizePixel()); + aItemSize.Width() += 8; + aItemSize.Height() += 8; + int nColumnCount = aWindowSize.Width() / aItemSize.Width(); + if (nColumnCount < 1) + nColumnCount = 1; + else if (nColumnCount > 4) + nColumnCount = 4; + + int nRowCount = CalculateRowCount (aItemSize, nColumnCount); + + SetColCount ((sal_uInt16)nColumnCount); + SetLineCount ((sal_uInt16)nRowCount); + } + } + + ValueSet::Resize (); +} + + + + +void LayoutMenu::MouseButtonDown (const MouseEvent& rEvent) +{ + // As a preparation for the context menu the item under the mouse is + // selected. + if (rEvent.IsRight()) + { + ReleaseMouse(); + sal_uInt16 nIndex = GetItemId (rEvent.GetPosPixel()); + if (nIndex > 0) + SelectItem(nIndex); + } + + ValueSet::MouseButtonDown (rEvent); +} + + + + +void LayoutMenu::InsertPageWithLayout (AutoLayout aLayout) +{ + ViewShell* pViewShell = mrBase.GetMainViewShell().get(); + if (pViewShell == NULL) + return; + + SfxViewFrame* pViewFrame = mrBase.GetViewFrame(); + if (pViewFrame == NULL) + return; + + SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher(); + if (pDispatcher == NULL) + return; + + // Call SID_INSERTPAGE with the right arguments. This is because + // the popup menu can not call this slot with arguments directly. + SfxRequest aRequest (CreateRequest(SID_INSERTPAGE, aLayout)); + if (aRequest.GetArgs() != NULL) + { + pDispatcher->Execute( + SID_INSERTPAGE, + SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, + *aRequest.GetArgs()); + } + UpdateSelection(); +} + + + + +void LayoutMenu::InvalidateContent (void) +{ + // Throw away the current set and fill the menu anew according to the + // current settings (this includes the support for vertical writing.) + Fill(); + + if (mxSidebar.is()) + mxSidebar->requestLayout(); +} + + + + +int LayoutMenu::CalculateRowCount (const Size&, int nColumnCount) +{ + int nRowCount = 0; + + if (GetItemCount() > 0 && nColumnCount > 0) + { + nRowCount = (GetItemCount() + nColumnCount - 1) / nColumnCount; + // nRowCount = GetOutputSizePixel().Height() / rItemSize.Height(); + if (nRowCount < 1) + nRowCount = 1; + } + + return nRowCount; +} + + + + +IMPL_LINK_NOARG(LayoutMenu, ClickHandler) +{ + AssignLayoutToSelectedSlides (GetSelectedAutoLayout()); + return 0; +} + + + + +/** The specified layout is assigned to the current page of the view shell + in the center pane. +*/ +void LayoutMenu::AssignLayoutToSelectedSlides (AutoLayout aLayout) +{ + using namespace ::sd::slidesorter; + using namespace ::sd::slidesorter::controller; + + do + { + // The view shell in the center pane has to be present. + ViewShell* pMainViewShell = mrBase.GetMainViewShell().get(); + if (pMainViewShell == NULL) + break; + + // Determine if the current view is in an invalid master page mode. + // The handout view is always in master page mode and therefore not + // invalid. + bool bMasterPageMode (false); + switch (pMainViewShell->GetShellType()) + { + case ViewShell::ST_NOTES: + case ViewShell::ST_IMPRESS: + { + DrawViewShell* pDrawViewShell = static_cast<DrawViewShell*>(pMainViewShell); + if (pDrawViewShell != NULL) + if (pDrawViewShell->GetEditMode() == EM_MASTERPAGE) + bMasterPageMode = true; + } + default: + break; + } + if (bMasterPageMode) + break; + + // Get a list of all selected slides and call the SID_MODIFYPAGE + // slot for all of them. + ::sd::slidesorter::SharedPageSelection pPageSelection; + + // Get a list of selected pages. + // First we try to obtain this list from a slide sorter. This is + // possible only some of the view shells in the center pane. When + // no valid slide sorter is available then ask the main view shell + // for its current page. + SlideSorterViewShell* pSlideSorter = NULL; + switch (pMainViewShell->GetShellType()) + { + case ViewShell::ST_IMPRESS: + case ViewShell::ST_NOTES: + case ViewShell::ST_SLIDE_SORTER: + pSlideSorter = SlideSorterViewShell::GetSlideSorter(mrBase); + break; + default: + break; + } + if (pSlideSorter != NULL) + { + // There is a slide sorter visible so get the list of selected pages from it. + pPageSelection = pSlideSorter->GetPageSelection(); + } + + if( (pSlideSorter == NULL) || (pPageSelection.get() == 0) || pPageSelection->empty() ) + { + // No valid slide sorter available. Ask the main view shell for + // its current page. + pPageSelection.reset(new ::sd::slidesorter::SlideSorterViewShell::PageSelection()); + pPageSelection->push_back(pMainViewShell->GetActualPage()); + } + + + if (pPageSelection->empty()) + break; + + ::std::vector<SdPage*>::iterator iPage; + for (iPage=pPageSelection->begin(); iPage!=pPageSelection->end(); ++iPage) + { + if ((*iPage) == NULL) + continue; + + // Call the SID_ASSIGN_LAYOUT slot with all the necessary parameters. + SfxRequest aRequest (mrBase.GetViewFrame(), SID_ASSIGN_LAYOUT); + aRequest.AppendItem(SfxUInt32Item (ID_VAL_WHATPAGE, ((*iPage)->GetPageNum()-1)/2)); + aRequest.AppendItem(SfxUInt32Item (ID_VAL_WHATLAYOUT, aLayout)); + pMainViewShell->ExecuteSlot (aRequest, sal_Bool(sal_False)); + } + } + while(false); +} + + + + +SfxRequest LayoutMenu::CreateRequest ( + sal_uInt16 nSlotId, + AutoLayout aLayout) +{ + SfxRequest aRequest (mrBase.GetViewFrame(), nSlotId); + + do + { + SdrLayerAdmin& rLayerAdmin (mrBase.GetDocument()->GetLayerAdmin()); + sal_uInt8 aBackground (rLayerAdmin.GetLayerID( + String(SdResId(STR_LAYER_BCKGRND)), sal_False)); + sal_uInt8 aBackgroundObject (rLayerAdmin.GetLayerID( + String(SdResId(STR_LAYER_BCKGRNDOBJ)), sal_False)); + ViewShell* pViewShell = mrBase.GetMainViewShell().get(); + if (pViewShell == NULL) + break; + SdPage* pPage = pViewShell->GetActualPage(); + if (pPage == NULL) + break; + + SetOfByte aVisibleLayers (pPage->TRG_GetMasterPageVisibleLayers()); + + aRequest.AppendItem( + SfxStringItem (ID_VAL_PAGENAME, String()));//pPage->GetName())); + aRequest.AppendItem(SfxUInt32Item (ID_VAL_WHATLAYOUT, aLayout)); + aRequest.AppendItem( + SfxBoolItem(ID_VAL_ISPAGEBACK, aVisibleLayers.IsSet(aBackground))); + aRequest.AppendItem( + SfxBoolItem( + ID_VAL_ISPAGEOBJ, + aVisibleLayers.IsSet(aBackgroundObject))); + } + while (false); + + return aRequest; +} + + + + +void LayoutMenu::Fill (void) +{ + SvtLanguageOptions aLanguageOptions; + sal_Bool bVertical = aLanguageOptions.IsVerticalTextEnabled(); + SdDrawDocument* pDocument = mrBase.GetDocument(); + sal_Bool bRightToLeft = (pDocument!=NULL + && pDocument->GetDefaultWritingMode() == WritingMode_RL_TB); + + // Get URL of the view in the center pane. + OUString sCenterPaneViewName; + try + { + Reference<XControllerManager> xControllerManager ( + Reference<XWeak>(&mrBase.GetDrawController()), UNO_QUERY_THROW); + Reference<XResourceId> xPaneId (ResourceId::create( + ::comphelper::getProcessComponentContext(), + FrameworkHelper::msCenterPaneURL)); + Reference<XView> xView (FrameworkHelper::Instance(mrBase)->GetView(xPaneId)); + if (xView.is()) + sCenterPaneViewName = xView->getResourceId()->getResourceURL(); + } + catch (RuntimeException&) + {} + + snewfoil_value_info* pInfo = NULL; + if (sCenterPaneViewName.equals(framework::FrameworkHelper::msNotesViewURL)) + { + pInfo = notes; + } + else if (sCenterPaneViewName.equals(framework::FrameworkHelper::msHandoutViewURL)) + { + pInfo = handout; + } + else if (sCenterPaneViewName.equals(framework::FrameworkHelper::msImpressViewURL) + || sCenterPaneViewName.equals(framework::FrameworkHelper::msSlideSorterURL)) + { + pInfo = standard; + } + else + { + pInfo = NULL; + } + + Clear(); + int n = 0; + for (sal_uInt16 i=1; pInfo!=NULL&&pInfo->mnBmpResId!=0; i++,pInfo++) + { + if ((WritingMode_TB_RL != pInfo->meWritingMode) || bVertical) + { + BitmapEx aBmp(SdResId(pInfo->mnBmpResId)); + + if (bRightToLeft && (WritingMode_TB_RL != pInfo->meWritingMode)) + aBmp.Mirror (BMP_MIRROR_HORZ); + + InsertItem (i, aBmp, String (SdResId (pInfo->mnStrResId))); + SetItemData (i, new AutoLayout(pInfo->maAutoLayout)); + n++; + } + } + + mbSelectionUpdatePending = true; +} + + + + +void LayoutMenu::Clear (void) +{ + for (sal_uInt16 nId=1; nId<=GetItemCount(); nId++) + delete static_cast<AutoLayout*>(GetItemData(nId)); + ValueSet::Clear(); +} + + + +void LayoutMenu::StartDrag (sal_Int8 , const Point& ) +{ +} + + + + +sal_Int8 LayoutMenu::AcceptDrop (const AcceptDropEvent& ) +{ + return 0; +} + + + + +sal_Int8 LayoutMenu::ExecuteDrop (const ExecuteDropEvent& ) +{ + return 0; +} + + + + +void LayoutMenu::Command (const CommandEvent& rEvent) +{ + switch (rEvent.GetCommand()) + { + case COMMAND_CONTEXTMENU: + if ( ! SD_MOD()->GetWaterCan()) + { + // Determine the position where to show the menu. + Point aMenuPosition; + if (rEvent.IsMouseEvent()) + { + if (GetItemId(rEvent.GetMousePosPixel()) <= 0) + return; + aMenuPosition = rEvent.GetMousePosPixel(); + } + else + { + if (GetSelectItemId() == (sal_uInt16)-1) + return; + Rectangle aBBox (GetItemRect(GetSelectItemId())); + aMenuPosition = aBBox.Center(); + } + + // Setup the menu. + ::boost::shared_ptr<PopupMenu> pMenu (new PopupMenu(SdResId(RID_TASKPANE_LAYOUTMENU_POPUP))); + FloatingWindow* pMenuWindow = dynamic_cast<FloatingWindow*>(pMenu->GetWindow()); + if (pMenuWindow != NULL) + pMenuWindow->SetPopupModeFlags( + pMenuWindow->GetPopupModeFlags() | FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE); + pMenu->SetSelectHdl(LINK(this, LayoutMenu, OnMenuItemSelected)); + + // Disable the SID_INSERTPAGE_LAYOUT_MENU item when + // the document is read-only. + const SfxPoolItem* pItem = NULL; + const SfxItemState aState ( + mrBase.GetViewFrame()->GetDispatcher()->QueryState(SID_INSERTPAGE, pItem)); + if (aState == SFX_ITEM_DISABLED) + pMenu->EnableItem(SID_INSERTPAGE_LAYOUT_MENU, sal_False); + + // Show the menu. + pMenu->Execute(this, Rectangle(aMenuPosition,Size(1,1)), POPUPMENU_EXECUTE_DOWN); + } + break; + + default: + ValueSet::Command(rEvent); + break; + } +} + + + + +IMPL_LINK_NOARG(LayoutMenu, StateChangeHandler) +{ + InvalidateContent(); + return 0; +} + + + + +IMPL_LINK(LayoutMenu, OnMenuItemSelected, Menu*, pMenu) +{ + if (pMenu == NULL) + { + OSL_ENSURE(pMenu!=NULL, "LayoutMenu::OnMenuItemSelected: illegal menu!"); + return 0; + } + + pMenu->Deactivate(); + const sal_Int32 nIndex (pMenu->GetCurItemId()); + + if (nIndex == SID_TP_APPLY_TO_SELECTED_SLIDES) + { + AssignLayoutToSelectedSlides(GetSelectedAutoLayout()); + } + else if (nIndex == SID_INSERTPAGE_LAYOUT_MENU) + { + // Add arguments to this slot and forward it to the main view + // shell. + InsertPageWithLayout(GetSelectedAutoLayout()); + } + + return 0; +} + + + + +void LayoutMenu::UpdateSelection (void) +{ + bool bItemSelected = false; + + do + { + // Get current page of main view. + ViewShell* pViewShell = mrBase.GetMainViewShell().get(); + if (pViewShell == NULL) + break; + + SdPage* pCurrentPage = pViewShell->getCurrentPage(); + if (pCurrentPage == NULL) + break; + + // Get layout of current page. + AutoLayout aLayout (pCurrentPage->GetAutoLayout()); + if (aLayout<AUTOLAYOUT__START || aLayout>AUTOLAYOUT__END) + break; + + // Find the entry of the menu for to the layout. + sal_uInt16 nItemCount (GetItemCount()); + for (sal_uInt16 nId=1; nId<=nItemCount; nId++) + { + if (*static_cast<AutoLayout*>(GetItemData(nId)) == aLayout) + { + SelectItem(nId); + bItemSelected = true; + break; + } + } + } + while (false); + + if ( ! bItemSelected) + SetNoSelection(); +} + + + + +IMPL_LINK(LayoutMenu, EventMultiplexerListener, ::sd::tools::EventMultiplexerEvent*, pEvent) +{ + switch (pEvent->meEventId) + { + case ::sd::tools::EventMultiplexerEvent::EID_CURRENT_PAGE: + case ::sd::tools::EventMultiplexerEvent::EID_SLIDE_SORTER_SELECTION: + if ( ! mbSelectionUpdatePending) + UpdateSelection(); + break; + + case ::sd::tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED: + mbIsMainViewChangePending = true; + UpdateEnabledState(MM_UNKNOWN); + break; + + case ::sd::tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED: + HideFocus(); + break; + + case ::sd::tools::EventMultiplexerEvent::EID_CONFIGURATION_UPDATED: + if (mbIsMainViewChangePending) + { + mbIsMainViewChangePending = false; + InvalidateContent(); + } + break; + + case ::sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_NORMAL: + UpdateEnabledState(MM_NORMAL); + break; + + case ::sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_MASTER: + UpdateEnabledState(MM_MASTER); + break; + + default: + /* Ignored */ + break; + } + + return 0; +} + + + + +IMPL_LINK(LayoutMenu, WindowEventHandler, VclWindowEvent*, pEvent) +{ + if (pEvent != NULL) + { + switch (pEvent->GetId()) + { + case VCLEVENT_WINDOW_SHOW: + case VCLEVENT_WINDOW_RESIZE: + SetSizePixel(GetParent()->GetSizePixel()); + return sal_True; + + default: + return sal_False; + } + + const SfxSimpleHint* pSimpleHint = PTR_CAST(SfxSimpleHint, pEvent); + if (pSimpleHint != NULL + && pSimpleHint->GetId() == SFX_HINT_DYING) + { + return sal_True; + } + } + + return sal_False; +} + + + + +void LayoutMenu::DataChanged (const DataChangedEvent& rEvent) +{ + Fill(); + ValueSet::DataChanged(rEvent); + SetBackground(sfx2::sidebar::Theme::GetWallpaper(sfx2::sidebar::Theme::Paint_PanelBackground)); + SetColor(sfx2::sidebar::Theme::GetColor(sfx2::sidebar::Theme::Paint_PanelBackground)); +} + + + + + +} } // end of namespace ::sd::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/sidebar/LayoutMenu.hxx b/sd/source/ui/sidebar/LayoutMenu.hxx new file mode 100644 index 000000000000..eb8025860258 --- /dev/null +++ b/sd/source/ui/sidebar/LayoutMenu.hxx @@ -0,0 +1,226 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef SD_SIDEBAR_LAYOUT_MENU_HXX +#define SD_SIDEBAR_LAYOUT_MENU_HXX + +#include "IDisposable.hxx" +#include "ISidebarReceiver.hxx" +#include <sfx2/sidebar/ILayoutableWindow.hxx> + +#include <com/sun/star/frame/XStatusListener.hpp> + +#include "glob.hxx" +#include "pres.hxx" + +#include <vcl/ctrl.hxx> +#include <svtools/valueset.hxx> +#include <svtools/transfer.hxx> +#include <sfx2/shell.hxx> + +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/ui/XSidebar.hpp> + + +class SfxModule; + +namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; + +namespace sd { +class DrawDocShell; +class ViewShellBase; +} + + +namespace sd { namespace tools { +class EventMultiplexerEvent; +} } + + +namespace sd { namespace sidebar { + +class ControlFactory; +class SidebarViewShell; +class SidebarShellManager; + + +class LayoutMenu + : public ValueSet, + public DragSourceHelper, + public DropTargetHelper, + public sfx2::sidebar::ILayoutableWindow +{ +public: + /** Create a new layout menu. Depending on the given flag it + displays its own scroll bar or lets a surrounding window + handle that. + @param i_pParent + the parent node in the control tree + @param i_rPanelViewShell + the view shell of the task pane. + */ + LayoutMenu ( + ::Window* pParent, + ViewShellBase& rViewShellBase, + const cssu::Reference<css::ui::XSidebar>& rxSidebar); + virtual ~LayoutMenu (void); + + virtual void Dispose (void); + + /** Return a numerical value representing the currently selected + layout. + */ + AutoLayout GetSelectedAutoLayout (void); + + Size GetPreferredSize (void); + sal_Int32 GetPreferredWidth (sal_Int32 nHeight); + sal_Int32 GetMinimumWidth (void); + + // From ILayoutableWindow + virtual css::ui::LayoutSize GetHeightForWidth (const sal_Int32 nWidth); + + // From ::Window + virtual void Paint (const Rectangle& rRect); + virtual void Resize (void); + + /** Show a context menu when the right mouse button is pressed. + */ + virtual void MouseButtonDown (const MouseEvent& rEvent); + + /** The LayoutMenu does not support some main views. In this case the + LayoutMenu is disabled. This state is updated in this method. + @param eMode + On some occasions the edit mode is being switched when this + method is called can not (yet) be reliably detected. Luckily, + in these cases the new value is provided by some broadcaster. + On other occasions the edit mode is not modified and is also not + provided. Therefore the Unknown value. + */ + enum MasterMode { MM_NORMAL, MM_MASTER, MM_UNKNOWN }; + void UpdateEnabledState (const MasterMode eMode); + + /** Call this method when the set of displayed layouts is not up-to-date + anymore. It will re-assemple this set according to the current + settings. + */ + void InvalidateContent (void); + + // DragSourceHelper + virtual void StartDrag (sal_Int8 nAction, const Point& rPosPixel); + + // DropTargetHelper + virtual sal_Int8 AcceptDrop (const AcceptDropEvent& rEvent); + virtual sal_Int8 ExecuteDrop (const ExecuteDropEvent& rEvent); + + /** The context menu is requested over this Command() method. + */ + virtual void Command (const CommandEvent& rEvent); + + /** Call Fill() when switching to or from high contrast mode so that the + correct set of icons is displayed. + */ + virtual void DataChanged (const DataChangedEvent& rEvent); + + using Window::GetWindow; + using ValueSet::StartDrag; + +private: + ViewShellBase& mrBase; + + /** Do we use our own scroll bar or is viewport handling done by + our parent? + */ + bool mbUseOwnScrollBar; + + /** If we are asked for the preferred window size, then use this + many columns for the calculation. + */ + const int mnPreferredColumnCount; + cssu::Reference<css::frame::XStatusListener> mxListener; + bool mbSelectionUpdatePending; + bool mbIsMainViewChangePending; + cssu::Reference<css::ui::XSidebar> mxSidebar; + bool mbIsDisposed; + + /** Calculate the number of displayed rows. This depends on the given + item size, the given number of columns, and the size of the + control. Note that this is not the number of rows managed by the + valueset. This number may be larger. In that case a vertical + scroll bar is displayed. + */ + int CalculateRowCount (const Size& rItemSize, int nColumnCount); + + /** Fill the value set with the layouts that are applicable to the + current main view shell. + */ + void Fill (void); + + /** Remove all items from the value set. + */ + void Clear (void); + + /** Assign the given layout to all selected slides of a slide sorter. + If no slide sorter is active then this call is ignored. The slide + sorter in the center pane is preferred if the choice exists. + */ + void AssignLayoutToSelectedSlides (AutoLayout aLayout); + + /** Insert a new page with the given layout. The page is inserted via + the main view shell, i.e. its SID_INSERTPAGE slot is called. It it + does not support this slot then inserting a new page does not take + place. The new page is inserted after the currently active one (the + one returned by ViewShell::GetActualPage().) + */ + void InsertPageWithLayout (AutoLayout aLayout); + + /** Create a request structure that can be used with the SID_INSERTPAGE + and SID_MODIFYPAGE slots. The parameters are set so that the given + layout is assigned to the current page of the main view shell. + @param nSlotId + Supported slots are SID_INSERTPAGE and SID_MODIFYPAGE. + @param aLayout + Layout of the page to insert or to assign. + */ + SfxRequest CreateRequest ( + sal_uInt16 nSlotId, + AutoLayout aLayout); + + /** Select the layout that is used by the current page. + */ + void UpdateSelection (void); + + // internal ctor + void implConstruct( DrawDocShell& rDocumentShell ); + + /** When clicked then set the current page of the view in the center pane. + */ + DECL_LINK(ClickHandler, void *); + DECL_LINK(RightClickHandler, MouseEvent*); + DECL_LINK(StateChangeHandler, void *); + DECL_LINK(EventMultiplexerListener, ::sd::tools::EventMultiplexerEvent*); + DECL_LINK(WindowEventHandler, VclWindowEvent*); + DECL_LINK(OnMenuItemSelected, Menu*); +}; + +} } // end of namespace ::sd::toolpanel + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/sidebar/MasterPageContainer.cxx b/sd/source/ui/sidebar/MasterPageContainer.cxx new file mode 100644 index 000000000000..582a3fed43e3 --- /dev/null +++ b/sd/source/ui/sidebar/MasterPageContainer.cxx @@ -0,0 +1,1211 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "MasterPageContainer.hxx" + +#include "MasterPageDescriptor.hxx" +#include "MasterPageContainerFiller.hxx" +#include "MasterPageContainerQueue.hxx" +#include "TemplateScanner.hxx" +#include "tools/AsynchronousTask.hxx" +#include "strings.hrc" +#include <algorithm> +#include <list> +#include <set> + +#include "unomodel.hxx" +#include <com/sun/star/frame/Desktop.hpp> +#include <com/sun/star/frame/XComponentLoader.hpp> +#include <com/sun/star/io/XStream.hpp> +#include <com/sun/star/io/XInputStream.hpp> +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/util/XCloseable.hpp> +#include <comphelper/processfactory.hxx> +#include <sfx2/app.hxx> +#include <svx/svdpage.hxx> +#include "DrawDocShell.hxx" +#include "drawdoc.hxx" +#include "sdpage.hxx" +#include <svl/itemset.hxx> +#include <svl/eitem.hxx> +#include "sdresid.hxx" +#include "tools/TimerBasedTaskExecution.hxx" +#include "pres.hxx" +#include <osl/mutex.hxx> +#include <boost/weak_ptr.hpp> + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; + +namespace { + +typedef ::std::vector<sd::sidebar::SharedMasterPageDescriptor> MasterPageContainerType; + +} // end of anonymous namespace + + +namespace sd { namespace sidebar { + + +/** Inner implementation class of the MasterPageContainer. +*/ +class MasterPageContainer::Implementation + : public SdGlobalResource, + public MasterPageContainerFiller::ContainerAdapter, + public MasterPageContainerQueue::ContainerAdapter +{ +public: + mutable ::osl::Mutex maMutex; + + static ::boost::weak_ptr<Implementation> mpInstance; + MasterPageContainerType maContainer; + + static ::boost::shared_ptr<Implementation> Instance (void); + + void LateInit (void); + void AddChangeListener (const Link& rLink); + void RemoveChangeListener (const Link& rLink); + void UpdatePreviewSizePixel (void); + Size GetPreviewSizePixel (PreviewSize eSize) const; + + bool HasToken (Token aToken) const; + const SharedMasterPageDescriptor GetDescriptor (MasterPageContainer::Token aToken) const; + SharedMasterPageDescriptor GetDescriptor (MasterPageContainer::Token aToken); + virtual Token PutMasterPage (const SharedMasterPageDescriptor& rDescriptor); + void InvalidatePreview (Token aToken); + Image GetPreviewForToken ( + Token aToken, + PreviewSize ePreviewSize); + PreviewState GetPreviewState (Token aToken) const; + bool RequestPreview (Token aToken); + + Reference<frame::XModel> GetModel (void); + SdDrawDocument* GetDocument (void); + + void FireContainerChange ( + MasterPageContainerChangeEvent::EventType eType, + Token aToken, + bool bNotifyAsynchronously = false); + + virtual bool UpdateDescriptor ( + const SharedMasterPageDescriptor& rpDescriptor, + bool bForcePageObject, + bool bForcePreview, + bool bSendEvents); + + void ReleaseDescriptor (Token aToken); + + /** Called by the MasterPageContainerFiller to notify that all master + pages from template documents have been added. + */ + virtual void FillingDone (void); + +private: + Implementation (void); + virtual ~Implementation (void); + + class Deleter { public: + void operator() (Implementation* pObject) { delete pObject; } + }; + friend class Deleter; + + enum InitializationState { NOT_INITIALIZED, INITIALIZING, INITIALIZED } meInitializationState; + + ::boost::scoped_ptr<MasterPageContainerQueue> mpRequestQueue; + ::com::sun::star::uno::Reference<com::sun::star::frame::XModel> mxModel; + SdDrawDocument* mpDocument; + PreviewRenderer maPreviewRenderer; + /** Remember whether the first page object has already been used to + determine the correct size ratio. + */ + bool mbFirstPageObjectSeen; + + // The widths for the previews contain two pixels for the border that is + // painted arround the preview. + static const int SMALL_PREVIEW_WIDTH = 72 + 2; + static const int LARGE_PREVIEW_WIDTH = 2*72 + 2; + + /** This substition of page preview shows "Preparing preview" and is + shown as long as the actual previews are not being present. + */ + Image maLargePreviewBeingCreated; + Image maSmallPreviewBeingCreated; + + /** This substition of page preview is shown when a preview can not be + created and thus is not available. + */ + Image maLargePreviewNotAvailable; + Image maSmallPreviewNotAvailable; + + ::std::vector<Link> maChangeListeners; + + // We have to remember the tasks for initialization and filling in case + // a MasterPageContainer object is destroyed before these tasks have + // been completed. + ::boost::weak_ptr<sd::tools::TimerBasedTaskExecution> mpFillerTask; + + Size maSmallPreviewSizePixel; + Size maLargePreviewSizePixel; + bool mbPageRatioKnown; + + bool mbContainerCleaningPending; + + typedef ::std::pair<MasterPageContainerChangeEvent::EventType,Token> EventData; + DECL_LINK(AsynchronousNotifyCallback, EventData*); + ::sd::DrawDocShell* LoadDocument ( + const String& sFileName, + SfxObjectShellLock& rxDocumentShell); + + Image GetPreviewSubstitution (sal_uInt16 nId, PreviewSize ePreviewSize); + + void CleanContainer (void); +}; + + + + +//===== MasterPageContainer =================================================== + +::boost::weak_ptr<MasterPageContainer::Implementation> + MasterPageContainer::Implementation::mpInstance; +static const MasterPageContainer::Token NIL_TOKEN (-1); + + + + +::boost::shared_ptr<MasterPageContainer::Implementation> + MasterPageContainer::Implementation::Instance (void) +{ + ::boost::shared_ptr<MasterPageContainer::Implementation> pInstance; + + if (Implementation::mpInstance.expired()) + { + ::osl::GetGlobalMutex aMutexFunctor; + ::osl::MutexGuard aGuard (aMutexFunctor()); + if (Implementation::mpInstance.expired()) + { + OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER(); + pInstance = ::boost::shared_ptr<MasterPageContainer::Implementation>( + new MasterPageContainer::Implementation(), + MasterPageContainer::Implementation::Deleter()); + SdGlobalResourceContainer::Instance().AddResource(pInstance); + Implementation::mpInstance = pInstance; + } + else + pInstance = ::boost::shared_ptr<MasterPageContainer::Implementation>( + Implementation::mpInstance); + } + else + { + OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER(); + pInstance = ::boost::shared_ptr<MasterPageContainer::Implementation>( + Implementation::mpInstance); + } + + DBG_ASSERT (pInstance.get()!=NULL, + "MasterPageContainer::Implementation::Instance(): instance is NULL"); + return pInstance; +} + + + + +MasterPageContainer::MasterPageContainer (void) + : mpImpl(Implementation::Instance()), + mePreviewSize(SMALL) +{ + mpImpl->LateInit(); +} + + + + +MasterPageContainer::~MasterPageContainer (void) +{ +} + + + + +void MasterPageContainer::AddChangeListener (const Link& rLink) +{ + mpImpl->AddChangeListener(rLink); +} + + + + +void MasterPageContainer::RemoveChangeListener (const Link& rLink) +{ + mpImpl->RemoveChangeListener(rLink); +} + + + + +void MasterPageContainer::SetPreviewSize (PreviewSize eSize) +{ + mePreviewSize = eSize; + mpImpl->FireContainerChange( + MasterPageContainerChangeEvent::SIZE_CHANGED, + NIL_TOKEN); +} + + + + +MasterPageContainer::PreviewSize MasterPageContainer::GetPreviewSize (void) const +{ + return mePreviewSize; +} + + + + +Size MasterPageContainer::GetPreviewSizePixel (void) const +{ + return mpImpl->GetPreviewSizePixel(mePreviewSize); +} + + + + +MasterPageContainer::Token MasterPageContainer::PutMasterPage ( + const SharedMasterPageDescriptor& rDescriptor) +{ + return mpImpl->PutMasterPage(rDescriptor); +} + + + + +void MasterPageContainer::AcquireToken (Token aToken) +{ + SharedMasterPageDescriptor pDescriptor = mpImpl->GetDescriptor(aToken); + if (pDescriptor.get() != NULL) + { + ++pDescriptor->mnUseCount; + } +} + + + + +void MasterPageContainer::ReleaseToken (Token aToken) +{ + SharedMasterPageDescriptor pDescriptor = mpImpl->GetDescriptor(aToken); + if (pDescriptor.get() != NULL) + { + OSL_ASSERT(pDescriptor->mnUseCount>0); + --pDescriptor->mnUseCount; + if (pDescriptor->mnUseCount <= 0) + { + switch (pDescriptor->meOrigin) + { + case DEFAULT: + case TEMPLATE: + default: + break; + + case MASTERPAGE: + mpImpl->ReleaseDescriptor(aToken); + break; + } + } + } +} + + + + +int MasterPageContainer::GetTokenCount (void) const +{ + const ::osl::MutexGuard aGuard (mpImpl->maMutex); + + return mpImpl->maContainer.size(); +} + + + + +bool MasterPageContainer::HasToken (Token aToken) const +{ + const ::osl::MutexGuard aGuard (mpImpl->maMutex); + + return mpImpl->HasToken(aToken); +} + + + + +MasterPageContainer::Token MasterPageContainer::GetTokenForIndex (int nIndex) +{ + const ::osl::MutexGuard aGuard (mpImpl->maMutex); + + Token aResult (NIL_TOKEN); + if (HasToken(nIndex)) + aResult = mpImpl->maContainer[nIndex]->maToken; + return aResult; +} + + + + +MasterPageContainer::Token MasterPageContainer::GetTokenForURL ( + const String& sURL) +{ + const ::osl::MutexGuard aGuard (mpImpl->maMutex); + + Token aResult (NIL_TOKEN); + if (sURL.Len() > 0) + { + MasterPageContainerType::iterator iEntry ( + ::std::find_if ( + mpImpl->maContainer.begin(), + mpImpl->maContainer.end(), + MasterPageDescriptor::URLComparator(sURL))); + if (iEntry != mpImpl->maContainer.end()) + aResult = (*iEntry)->maToken; + } + return aResult; +} + + + + +MasterPageContainer::Token MasterPageContainer::GetTokenForStyleName (const String& sStyleName) +{ + const ::osl::MutexGuard aGuard (mpImpl->maMutex); + + Token aResult (NIL_TOKEN); + if (sStyleName.Len() > 0) + { + MasterPageContainerType::iterator iEntry ( + ::std::find_if ( + mpImpl->maContainer.begin(), + mpImpl->maContainer.end(), + MasterPageDescriptor::StyleNameComparator(sStyleName))); + if (iEntry != mpImpl->maContainer.end()) + aResult = (*iEntry)->maToken; + } + return aResult; +} + + + + +MasterPageContainer::Token MasterPageContainer::GetTokenForPageObject ( + const SdPage* pPage) +{ + const ::osl::MutexGuard aGuard (mpImpl->maMutex); + + Token aResult (NIL_TOKEN); + if (pPage != NULL) + { + MasterPageContainerType::iterator iEntry ( + ::std::find_if ( + mpImpl->maContainer.begin(), + mpImpl->maContainer.end(), + MasterPageDescriptor::PageObjectComparator(pPage))); + if (iEntry != mpImpl->maContainer.end()) + aResult = (*iEntry)->maToken; + } + return aResult; +} + + + + +String MasterPageContainer::GetURLForToken ( + MasterPageContainer::Token aToken) +{ + const ::osl::MutexGuard aGuard (mpImpl->maMutex); + + SharedMasterPageDescriptor pDescriptor = mpImpl->GetDescriptor(aToken); + if (pDescriptor.get() != NULL) + return pDescriptor->msURL; + else + return String(); +} + + + + +String MasterPageContainer::GetPageNameForToken ( + MasterPageContainer::Token aToken) +{ + const ::osl::MutexGuard aGuard (mpImpl->maMutex); + + SharedMasterPageDescriptor pDescriptor = mpImpl->GetDescriptor(aToken); + if (pDescriptor.get() != NULL) + return pDescriptor->msPageName; + else + return String(); +} + + + + +String MasterPageContainer::GetStyleNameForToken ( + MasterPageContainer::Token aToken) +{ + const ::osl::MutexGuard aGuard (mpImpl->maMutex); + + SharedMasterPageDescriptor pDescriptor = mpImpl->GetDescriptor(aToken); + if (pDescriptor.get() != NULL) + return pDescriptor->msStyleName; + else + return String(); +} + + + + +SdPage* MasterPageContainer::GetPageObjectForToken ( + MasterPageContainer::Token aToken, + bool bLoad) +{ + const ::osl::MutexGuard aGuard (mpImpl->maMutex); + + SdPage* pPageObject = NULL; + SharedMasterPageDescriptor pDescriptor = mpImpl->GetDescriptor(aToken); + if (pDescriptor.get() != NULL) + { + pPageObject = pDescriptor->mpMasterPage; + if (pPageObject == NULL) + { + // The page object is not (yet) present. Call + // UpdateDescriptor() to trigger the PageObjectProvider() to + // provide it. + if (bLoad) + mpImpl->GetModel(); + if (mpImpl->UpdateDescriptor(pDescriptor,bLoad,false, true)) + pPageObject = pDescriptor->mpMasterPage; + } + } + return pPageObject; +} + + + + +MasterPageContainer::Origin MasterPageContainer::GetOriginForToken (Token aToken) +{ + const ::osl::MutexGuard aGuard (mpImpl->maMutex); + + SharedMasterPageDescriptor pDescriptor = mpImpl->GetDescriptor(aToken); + if (pDescriptor.get() != NULL) + return pDescriptor->meOrigin; + else + return UNKNOWN; +} + + + + +sal_Int32 MasterPageContainer::GetTemplateIndexForToken (Token aToken) +{ + const ::osl::MutexGuard aGuard (mpImpl->maMutex); + + SharedMasterPageDescriptor pDescriptor = mpImpl->GetDescriptor(aToken); + if (pDescriptor.get() != NULL) + return pDescriptor->mnTemplateIndex; + else + return -1; +} + + + + +SharedMasterPageDescriptor MasterPageContainer::GetDescriptorForToken ( + MasterPageContainer::Token aToken) +{ + const ::osl::MutexGuard aGuard (mpImpl->maMutex); + + return mpImpl->GetDescriptor(aToken); +} + + + +void MasterPageContainer::InvalidatePreview (MasterPageContainer::Token aToken) +{ + mpImpl->InvalidatePreview(aToken); +} + + + + +Image MasterPageContainer::GetPreviewForToken (MasterPageContainer::Token aToken) +{ + return mpImpl->GetPreviewForToken(aToken,mePreviewSize); +} + + + + +MasterPageContainer::PreviewState MasterPageContainer::GetPreviewState (Token aToken) +{ + return mpImpl->GetPreviewState(aToken); +} + + + + +bool MasterPageContainer::RequestPreview (Token aToken) +{ + return mpImpl->RequestPreview(aToken); +} + + + + +//==== Implementation ================================================ + +MasterPageContainer::Implementation::Implementation (void) + : maMutex(), + maContainer(), + meInitializationState(NOT_INITIALIZED), + mpRequestQueue(NULL), + mxModel(NULL), + mpDocument(NULL), + maPreviewRenderer(), + mbFirstPageObjectSeen(false), + maLargePreviewBeingCreated(), + maSmallPreviewBeingCreated(), + maLargePreviewNotAvailable(), + maSmallPreviewNotAvailable(), + maChangeListeners(), + maSmallPreviewSizePixel(), + maLargePreviewSizePixel(), + mbPageRatioKnown(false), + mbContainerCleaningPending(true) + +{ + UpdatePreviewSizePixel(); +} + + + + +MasterPageContainer::Implementation::~Implementation (void) +{ + // When the initializer or filler tasks are still running then we have + // to stop them now in order to prevent them from calling us back. + tools::TimerBasedTaskExecution::ReleaseTask(mpFillerTask); + + mpRequestQueue.reset(); + + uno::Reference<util::XCloseable> xCloseable (mxModel, uno::UNO_QUERY); + if (xCloseable.is()) + { + try + { + xCloseable->close(true); + } + catch (const ::com::sun::star::util::CloseVetoException&) + { + } + } + mxModel = NULL; +} + + + + +void MasterPageContainer::Implementation::LateInit (void) +{ + const ::osl::MutexGuard aGuard (maMutex); + + if (meInitializationState == NOT_INITIALIZED) + { + meInitializationState = INITIALIZING; + + OSL_ASSERT(Instance().get()==this); + mpRequestQueue.reset(MasterPageContainerQueue::Create( + ::boost::shared_ptr<MasterPageContainerQueue::ContainerAdapter>(Instance()))); + + mpFillerTask = ::sd::tools::TimerBasedTaskExecution::Create( + ::boost::shared_ptr<tools::AsynchronousTask>(new MasterPageContainerFiller(*this)), + 5, + 50); + + meInitializationState = INITIALIZED; + } +} + + + + +void MasterPageContainer::Implementation::AddChangeListener (const Link& rLink) +{ + const ::osl::MutexGuard aGuard (maMutex); + + ::std::vector<Link>::iterator iListener ( + ::std::find(maChangeListeners.begin(),maChangeListeners.end(),rLink)); + if (iListener == maChangeListeners.end()) + maChangeListeners.push_back(rLink); + +} + + + + +void MasterPageContainer::Implementation::RemoveChangeListener (const Link& rLink) +{ + const ::osl::MutexGuard aGuard (maMutex); + + ::std::vector<Link>::iterator iListener ( + ::std::find(maChangeListeners.begin(),maChangeListeners.end(),rLink)); + if (iListener != maChangeListeners.end()) + maChangeListeners.erase(iListener); +} + + + + +void MasterPageContainer::Implementation::UpdatePreviewSizePixel (void) +{ + const ::osl::MutexGuard aGuard (maMutex); + + // The default aspect ratio is 4:3 + int nWidth (4); + int nHeight (3); + + // Search for the first entry with an existing master page. + MasterPageContainerType::const_iterator iDescriptor; + MasterPageContainerType::const_iterator iContainerEnd(maContainer.end()); + for (iDescriptor=maContainer.begin(); iDescriptor!=iContainerEnd; ++iDescriptor) + if (*iDescriptor!=NULL && (*iDescriptor)->mpMasterPage != NULL) + { + Size aPageSize ((*iDescriptor)->mpMasterPage->GetSize()); + OSL_ASSERT(aPageSize.Width() > 0 && aPageSize.Height() > 0); + if (aPageSize.Width() > 0) + nWidth = aPageSize.Width(); + if (aPageSize.Height() > 0) + nHeight = aPageSize.Height(); + mbFirstPageObjectSeen = true; + break; + } + + maSmallPreviewSizePixel.Width() = SMALL_PREVIEW_WIDTH; + maLargePreviewSizePixel.Width() = LARGE_PREVIEW_WIDTH; + + int nNewSmallHeight ((maSmallPreviewSizePixel.Width()-2) * nHeight / nWidth + 2); + int nNewLargeHeight ((maLargePreviewSizePixel.Width()-2) * nHeight / nWidth + 2); + + if (nNewSmallHeight!=maSmallPreviewSizePixel.Height() + || nNewLargeHeight!=maLargePreviewSizePixel.Height()) + { + maSmallPreviewSizePixel.Height() = nNewSmallHeight; + maLargePreviewSizePixel.Height() = nNewLargeHeight; + FireContainerChange( + MasterPageContainerChangeEvent::SIZE_CHANGED, + NIL_TOKEN); + } +} + + + + +Size MasterPageContainer::Implementation::GetPreviewSizePixel (PreviewSize eSize) const +{ + if (eSize == SMALL) + return maSmallPreviewSizePixel; + else + return maLargePreviewSizePixel; +} + + + + +IMPL_LINK(MasterPageContainer::Implementation,AsynchronousNotifyCallback, EventData*, pData) +{ + const ::osl::MutexGuard aGuard (maMutex); + + if (pData != NULL) + { + FireContainerChange(pData->first, pData->second, false); + delete pData; + } + + return 0; +} + + + + +MasterPageContainer::Token MasterPageContainer::Implementation::PutMasterPage ( + const SharedMasterPageDescriptor& rpDescriptor) +{ + const ::osl::MutexGuard aGuard (maMutex); + + Token aResult (NIL_TOKEN); + + // Get page object and preview when that is inexpensive. + UpdateDescriptor(rpDescriptor,false,false, false); + + // Look up the new MasterPageDescriptor and either insert it or update + // an already existing one. + MasterPageContainerType::iterator aEntry ( + ::std::find_if ( + maContainer.begin(), + maContainer.end(), + MasterPageDescriptor::AllComparator(rpDescriptor))); + if (aEntry == maContainer.end()) + { + // Insert a new MasterPageDescriptor. + bool bIgnore (rpDescriptor->mpPageObjectProvider.get()==NULL + && rpDescriptor->msURL.isEmpty()); + + if ( ! bIgnore) + { + if (mbContainerCleaningPending) + CleanContainer(); + + aResult = maContainer.size(); + rpDescriptor->SetToken(aResult); + + // Templates are precious, i.e. we lock them so that they will + // not be destroyed when (temporarily) no one references them. + // They will only be deleted when the container is destroyed. + switch (rpDescriptor->meOrigin) + { + case TEMPLATE: + case DEFAULT: + ++rpDescriptor->mnUseCount; + break; + + default: + break; + } + + maContainer.push_back(rpDescriptor); + aEntry = maContainer.end()-1; + + FireContainerChange(MasterPageContainerChangeEvent::CHILD_ADDED,aResult); + } + } + else + { + // Update an existing MasterPageDescriptor. + aResult = (*aEntry)->maToken; + ::std::auto_ptr<std::vector<MasterPageContainerChangeEvent::EventType> > pEventTypes( + (*aEntry)->Update(*rpDescriptor)); + if (pEventTypes.get()!=NULL && pEventTypes->size()>0) + { + // One or more aspects of the descriptor have changed. Send + // appropriate events to the listeners. + UpdateDescriptor(*aEntry,false,false, true); + + std::vector<MasterPageContainerChangeEvent::EventType>::const_iterator iEventType; + for (iEventType=pEventTypes->begin(); iEventType!=pEventTypes->end(); ++iEventType) + { + FireContainerChange( + *iEventType, + (*aEntry)->maToken, + false); + } + } + } + + return aResult; +} + + + + +bool MasterPageContainer::Implementation::HasToken (Token aToken) const +{ + return aToken>=0 + && (unsigned)aToken<maContainer.size() + && maContainer[aToken].get()!=NULL; +} + + + + +const SharedMasterPageDescriptor MasterPageContainer::Implementation::GetDescriptor ( + Token aToken) const +{ + if (aToken>=0 && (unsigned)aToken<maContainer.size()) + return maContainer[aToken]; + else + return SharedMasterPageDescriptor(); +} + + + + +SharedMasterPageDescriptor MasterPageContainer::Implementation::GetDescriptor (Token aToken) +{ + if (aToken>=0 && (unsigned)aToken<maContainer.size()) + return maContainer[aToken]; + else + return SharedMasterPageDescriptor(); +} + + + + +void MasterPageContainer::Implementation::InvalidatePreview (Token aToken) +{ + const ::osl::MutexGuard aGuard (maMutex); + + SharedMasterPageDescriptor pDescriptor (GetDescriptor(aToken)); + if (pDescriptor.get() != NULL) + { + pDescriptor->maSmallPreview = Image(); + pDescriptor->maLargePreview = Image(); + RequestPreview(aToken); + } +} + + + + +Image MasterPageContainer::Implementation::GetPreviewForToken ( + MasterPageContainer::Token aToken, + PreviewSize ePreviewSize) +{ + const ::osl::MutexGuard aGuard (maMutex); + + Image aPreview; + PreviewState ePreviewState (GetPreviewState(aToken)); + + SharedMasterPageDescriptor pDescriptor = GetDescriptor(aToken); + + // When the preview is missing but inexpensively creatable then do that + // now. + if (pDescriptor.get()!=NULL) + { + if (ePreviewState == PS_CREATABLE) + if (UpdateDescriptor(pDescriptor, false,false, true)) + if (pDescriptor->maLargePreview.GetSizePixel().Width() != 0) + ePreviewState = PS_AVAILABLE; + + switch (ePreviewState) + { + case PS_AVAILABLE: + aPreview = pDescriptor->GetPreview(ePreviewSize); + break; + + case PS_PREPARING: + aPreview = GetPreviewSubstitution( + STR_TASKPANEL_PREPARING_PREVIEW_SUBSTITUTION, + ePreviewSize); + break; + + case PS_CREATABLE: + aPreview = GetPreviewSubstitution( + STR_TASKPANEL_PREPARING_PREVIEW_SUBSTITUTION, + ePreviewSize); + break; + + case PS_NOT_AVAILABLE: + aPreview = GetPreviewSubstitution( + STR_TASKPANEL_NOT_AVAILABLE_SUBSTITUTION, + ePreviewSize); + if (ePreviewSize == SMALL) + pDescriptor->maSmallPreview = aPreview; + else + pDescriptor->maLargePreview = aPreview; + break; + } + } + + return aPreview; +} + + + + +MasterPageContainer::PreviewState MasterPageContainer::Implementation::GetPreviewState ( + Token aToken) const +{ + const ::osl::MutexGuard aGuard (maMutex); + + PreviewState eState (PS_NOT_AVAILABLE); + + SharedMasterPageDescriptor pDescriptor = GetDescriptor(aToken); + if (pDescriptor.get() != NULL) + { + if (pDescriptor->maLargePreview.GetSizePixel().Width() != 0) + eState = PS_AVAILABLE; + else if (pDescriptor->mpPreviewProvider.get() != NULL) + { + // The preview does not exist but can be created. When that is + // not expensive then do it at once. + if (mpRequestQueue->HasRequest(aToken)) + eState = PS_PREPARING; + else + eState = PS_CREATABLE; + } + else + eState = PS_NOT_AVAILABLE; + } + + return eState; +} + + + + +bool MasterPageContainer::Implementation::RequestPreview (Token aToken) +{ + SharedMasterPageDescriptor pDescriptor = GetDescriptor(aToken); + if (pDescriptor.get() != NULL) + return mpRequestQueue->RequestPreview(pDescriptor); + else + return false; +} + + + + +Reference<frame::XModel> MasterPageContainer::Implementation::GetModel (void) +{ + const ::osl::MutexGuard aGuard (maMutex); + + if ( ! mxModel.is()) + { + // Get the desktop a s service factory. + uno::Reference<frame::XDesktop2> xDesktop = frame::Desktop::create( + ::comphelper::getProcessComponentContext() ); + + // Create a new model. + OUString sModelServiceName ( "com.sun.star.presentation.PresentationDocument"); + mxModel = uno::Reference<frame::XModel>( + ::comphelper::getProcessServiceFactory()->createInstance( + sModelServiceName), + uno::UNO_QUERY); + + // Initialize the model. + uno::Reference<frame::XLoadable> xLoadable (mxModel,uno::UNO_QUERY); + if (xLoadable.is()) + xLoadable->initNew(); + + // Use its tunnel to get a pointer to its core implementation. + uno::Reference<lang::XUnoTunnel> xUnoTunnel (mxModel, uno::UNO_QUERY); + if (xUnoTunnel.is()) + { + mpDocument = reinterpret_cast<SdXImpressDocument*>( + xUnoTunnel->getSomething( + SdXImpressDocument::getUnoTunnelId()))->GetDoc(); + } + + // Create a default page. + uno::Reference<drawing::XDrawPagesSupplier> xSlideSupplier (mxModel, uno::UNO_QUERY); + if (xSlideSupplier.is()) + { + uno::Reference<drawing::XDrawPages> xSlides ( + xSlideSupplier->getDrawPages(), uno::UNO_QUERY); + if (xSlides.is()) + { + sal_Int32 nIndex (0); + uno::Reference<drawing::XDrawPage> xNewPage (xSlides->insertNewByIndex(nIndex)); + uno::Reference<beans::XPropertySet> xProperties(xNewPage, uno::UNO_QUERY); + if (xProperties.is()) + xProperties->setPropertyValue( + "Layout", + makeAny((sal_Int16)AUTOLAYOUT_TITLE)); + } + } + } + return mxModel; +} + + + + +SdDrawDocument* MasterPageContainer::Implementation::GetDocument (void) +{ + GetModel(); + return mpDocument; +} + + + + +Image MasterPageContainer::Implementation::GetPreviewSubstitution ( + sal_uInt16 nId, + PreviewSize ePreviewSize) +{ + const ::osl::MutexGuard aGuard (maMutex); + + Image aPreview; + + switch (nId) + { + case STR_TASKPANEL_PREPARING_PREVIEW_SUBSTITUTION: + { + Image& rPreview (ePreviewSize==SMALL + ? maSmallPreviewBeingCreated + : maLargePreviewBeingCreated); + if (rPreview.GetSizePixel().Width() == 0) + { + rPreview = maPreviewRenderer.RenderSubstitution( + ePreviewSize==SMALL ? maSmallPreviewSizePixel : maLargePreviewSizePixel, + SdResId(STR_TASKPANEL_PREPARING_PREVIEW_SUBSTITUTION)); + } + aPreview = rPreview; + } + break; + + case STR_TASKPANEL_NOT_AVAILABLE_SUBSTITUTION: + { + Image& rPreview (ePreviewSize==SMALL + ? maSmallPreviewNotAvailable + : maLargePreviewNotAvailable); + if (rPreview.GetSizePixel().Width() == 0) + { + rPreview = maPreviewRenderer.RenderSubstitution( + ePreviewSize==SMALL ? maSmallPreviewSizePixel : maLargePreviewSizePixel, + SdResId(STR_TASKPANEL_NOT_AVAILABLE_SUBSTITUTION)); + } + aPreview = rPreview; + } + break; + } + + return aPreview; +} + + + + +void MasterPageContainer::Implementation::CleanContainer (void) +{ + // Remove the empty elements at the end of the container. The empty + // elements in the middle can not be removed because that would + // invalidate the references still held by others. + int nIndex (maContainer.size()-1); + while (nIndex>=0 && maContainer[nIndex].get()==NULL) + --nIndex; + maContainer.resize(++nIndex); +} + + + + +void MasterPageContainer::Implementation::FireContainerChange ( + MasterPageContainerChangeEvent::EventType eType, + Token aToken, + bool bNotifyAsynchronously) +{ + if (bNotifyAsynchronously) + { + Application::PostUserEvent( + LINK(this,Implementation,AsynchronousNotifyCallback), + new EventData(eType,aToken)); + } + else + { + ::std::vector<Link> aCopy(maChangeListeners.begin(),maChangeListeners.end()); + ::std::vector<Link>::iterator iListener; + MasterPageContainerChangeEvent aEvent; + aEvent.meEventType = eType; + aEvent.maChildToken = aToken; + for (iListener=aCopy.begin(); iListener!=aCopy.end(); ++iListener) + iListener->Call(&aEvent); + } +} + + + + +bool MasterPageContainer::Implementation::UpdateDescriptor ( + const SharedMasterPageDescriptor& rpDescriptor, + bool bForcePageObject, + bool bForcePreview, + bool bSendEvents) +{ + const ::osl::MutexGuard aGuard (maMutex); + + // We have to create the page object when the preview provider needs it + // and the caller needs the preview. + bForcePageObject |= (bForcePreview + && rpDescriptor->mpPreviewProvider->NeedsPageObject() + && rpDescriptor->mpMasterPage==NULL); + + // Define a cost threshold so that an update or page object or preview + // that is at least this cost are made at once. Updates with higher cost + // are scheduled for later. + sal_Int32 nCostThreshold (mpRequestQueue->IsEmpty() ? 5 : 0); + + // Update the page object (which may be used for the preview update). + if (bForcePageObject) + GetDocument(); + int nPageObjectModified (rpDescriptor->UpdatePageObject( + (bForcePageObject ? -1 : nCostThreshold), + mpDocument)); + if (nPageObjectModified == 1 && bSendEvents) + FireContainerChange( + MasterPageContainerChangeEvent::DATA_CHANGED, + rpDescriptor->maToken); + if (nPageObjectModified == -1 && bSendEvents) + FireContainerChange( + MasterPageContainerChangeEvent::CHILD_REMOVED, + rpDescriptor->maToken); + if (nPageObjectModified && ! mbFirstPageObjectSeen) + UpdatePreviewSizePixel(); + + // Update the preview. + bool bPreviewModified (rpDescriptor->UpdatePreview( + (bForcePreview ? -1 : nCostThreshold), + maSmallPreviewSizePixel, + maLargePreviewSizePixel, + maPreviewRenderer)); + + if (bPreviewModified && bSendEvents) + FireContainerChange( + MasterPageContainerChangeEvent::PREVIEW_CHANGED, + rpDescriptor->maToken); + + return nPageObjectModified || bPreviewModified; +} + + + + +void MasterPageContainer::Implementation::ReleaseDescriptor (Token aToken) +{ + if (aToken>=0 && (unsigned)aToken<maContainer.size()) + { + maContainer[aToken].reset(); + mbContainerCleaningPending = true; + } +} + + + + +void MasterPageContainer::Implementation::FillingDone (void) +{ + mpRequestQueue->ProcessAllRequests(); +} + + + +} } // end of namespace sd::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/sidebar/MasterPageContainer.hxx b/sd/source/ui/sidebar/MasterPageContainer.hxx new file mode 100644 index 000000000000..b67bf8a48b26 --- /dev/null +++ b/sd/source/ui/sidebar/MasterPageContainer.hxx @@ -0,0 +1,208 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef SD_SIDEBAR_PANELS_MASTER_PAGE_CONTAINER_HXX +#define SD_SIDEBAR_PANELS_MASTER_PAGE_CONTAINER_HXX + +#include "MasterPageContainerProviders.hxx" + +#include <osl/mutex.hxx> +#include <tools/string.hxx> +#include <vcl/image.hxx> +#include <memory> +#include "PreviewRenderer.hxx" +#include <com/sun/star/frame/XModel.hpp> +#include <vcl/timer.hxx> +#include "tools/SdGlobalResourceContainer.hxx" + +#include <boost/shared_ptr.hpp> + +class SdPage; + +namespace sd { namespace sidebar { + +class MasterPageDescriptor; + +/** This container manages the master pages used by the MasterPagesSelector + controls. It uses internally a singleton implementation object. + Therefore, all MasterPageContainer object operator on the same set of + master pages. Each MasterPageContainer, however, has its own + PreviewSize value and thus can independantly switch between large and + small previews. + + The container maintains its own document to store master page objects. + + For each master page container stores its URL, preview bitmap, page + name, and, if available, the page object. + + Entries are accessed via a Token, which is mostly a numerical index but + whose values do not necessarily have to be consecutive. +*/ +class MasterPageContainer +{ +public: + typedef int Token; + static const Token NIL_TOKEN = -1; + + MasterPageContainer (void); + virtual ~MasterPageContainer (void); + + void AddChangeListener (const Link& rLink); + void RemoveChangeListener (const Link& rLink); + + enum PreviewSize { SMALL, LARGE }; + /** There are two different preview sizes, a small one and a large one. + Which one is used by the called container can be changed with this + method. + When the preview size is changed then all change listeners are + notified of this. + */ + void SetPreviewSize (PreviewSize eSize); + + /** Returns the preview size. + */ + PreviewSize GetPreviewSize (void) const; + + /** Return the preview size in pixels. + */ + Size GetPreviewSizePixel (void) const; + + enum PreviewState { PS_AVAILABLE, PS_CREATABLE, PS_PREPARING, PS_NOT_AVAILABLE }; + PreviewState GetPreviewState (Token aToken); + + /** This method is typically called for entries in the container for + which GetPreviewState() returns OS_CREATABLE. The creation of the + preview is then scheduled to be executed asynchronously at a later + point in time. When the preview is available the change listeners + will be notified. + */ + bool RequestPreview (Token aToken); + + /** Each entry of the container is either the first page of a template + document or is a master page of an Impress document. + */ + enum Origin { + MASTERPAGE, // Master page of a document. + TEMPLATE, // First page of a template file. + DEFAULT, // Empty master page with default style. + UNKNOWN + }; + + /** Put the master page identified and described by the given parameters + into the container. When there already is a master page with the + given URL, page name, or object pointer (when that is not NULL) then + the existing entry is replaced/updated by the given one. Otherwise + a new entry is inserted. + */ + Token PutMasterPage (const ::boost::shared_ptr<MasterPageDescriptor>& rDescriptor); + void AcquireToken (Token aToken); + void ReleaseToken (Token aToken); + + /** This and the GetTokenForIndex() methods can be used to iterate over + all members of the container. + */ + int GetTokenCount (void) const; + + /** Determine whether the container has a member for the given token. + */ + bool HasToken (Token aToken) const; + + /** Return a token for an index in the range + 0 <= index < GetTokenCount(). + */ + Token GetTokenForIndex (int nIndex); + + Token GetTokenForURL (const String& sURL); + Token GetTokenForStyleName (const String& sStyleName); + Token GetTokenForPageObject (const SdPage* pPage); + + String GetURLForToken (Token aToken); + String GetPageNameForToken (Token aToken); + String GetStyleNameForToken (Token aToken); + SdPage* GetPageObjectForToken (Token aToken, bool bLoad=true); + Origin GetOriginForToken (Token aToken); + sal_Int32 GetTemplateIndexForToken (Token aToken); + ::boost::shared_ptr<MasterPageDescriptor> GetDescriptorForToken (Token aToken); + + void InvalidatePreview (Token aToken); + + /** Return a preview for the specified token. When the preview is not + present then the PreviewProvider associated with the token is + executed only when that is not expensive. It is the responsibility + of the caller to call RequestPreview() to do the same + (asynchronously) for expensive PreviewProviders. + Call GetPreviewState() to find out if that is necessary. + @param aToken + This token specifies for which master page to return the prview. + Tokens are returned for example by the GetTokenFor...() methods. + @return + The returned image is the requested preview or a substitution. + */ + Image GetPreviewForToken (Token aToken); + +private: + class Implementation; + ::boost::shared_ptr<Implementation> mpImpl; + PreviewSize mePreviewSize; + + /** Retrieve the preview of the document specified by the given URL. + */ + static BitmapEx LoadPreviewFromURL (const OUString& aURL); +}; + + + + +/** For some changes to the set of master pages in a MasterPageContainer or + to the data stored for each master page one or more events are sent to + registered listeners. + Each event has an event type and a token that tells the listener where + the change took place. +*/ +class MasterPageContainerChangeEvent +{ +public: + enum EventType { + // A master page was added to the container. + CHILD_ADDED, + // A master page was removed from the container. + CHILD_REMOVED, + // The preview of a master page has changed. + PREVIEW_CHANGED, + // The size of a preview has changed. + SIZE_CHANGED, + // Some of the data stored for a master page has changed. + DATA_CHANGED, + // The TemplateIndex of a master page has changed. + INDEX_CHANGED, + // More than one entries changed their TemplateIndex + INDEXES_CHANGED + } meEventType; + + // Token of the container entry whose data changed or which was added or + // removed. + MasterPageContainer::Token maChildToken; +}; + + +} } // end of namespace sd::sidebar + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/sidebar/MasterPageContainerFiller.cxx b/sd/source/ui/sidebar/MasterPageContainerFiller.cxx new file mode 100644 index 000000000000..cec5047fb05b --- /dev/null +++ b/sd/source/ui/sidebar/MasterPageContainerFiller.cxx @@ -0,0 +1,189 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "MasterPageContainerFiller.hxx" + +#include "MasterPageDescriptor.hxx" +#include "MasterPageContainerProviders.hxx" +#include "TemplateScanner.hxx" + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; + + +namespace sd { namespace sidebar { + +MasterPageContainerFiller::MasterPageContainerFiller (ContainerAdapter& rpAdapter) + : mrContainerAdapter(rpAdapter), + meState(INITIALIZE_TEMPLATE_SCANNER), + mpScannerTask(), + mpLastAddedEntry(NULL), + mnIndex(1) +{ + // Add one entry for the default master page. We use temporarily the + // DefaultPagePreviewProvider to prevent the rendering (and the + // expensive creation) of the default page. It is replaced later on by + // another. + SharedMasterPageDescriptor pDescriptor (new MasterPageDescriptor( + MasterPageContainer::DEFAULT, + 0, + String(), + String(), + String(), + false, + ::boost::shared_ptr<PageObjectProvider>(new DefaultPageObjectProvider()), + ::boost::shared_ptr<PreviewProvider>(new PagePreviewProvider()))); + mrContainerAdapter.PutMasterPage(pDescriptor); +} + + + + +MasterPageContainerFiller::~MasterPageContainerFiller (void) +{ +} + + + + +void MasterPageContainerFiller::RunNextStep (void) +{ + switch (meState) + { + case INITIALIZE_TEMPLATE_SCANNER: + mpScannerTask.reset(new TemplateScanner()); + meState = SCAN_TEMPLATE; + break; + + case SCAN_TEMPLATE: + meState = ScanTemplate(); + break; + + case ADD_TEMPLATE: + meState = AddTemplate(); + break; + + case DONE: + case ERROR: + default: + break; + } + + // When the state has just been set to DONE or ERROR then tell the + // container that no more templates will be coming and stop the + // scanning. + switch (meState) + { + case DONE: + case ERROR: + if (mpScannerTask.get() != NULL) + { + mrContainerAdapter.FillingDone(); + mpScannerTask.reset(); + } + default: + break; + } +} + + + + +bool MasterPageContainerFiller::HasNextStep (void) +{ + switch (meState) + { + case DONE: + case ERROR: + return false; + + default: + return true; + } +} + + + + +MasterPageContainerFiller::State MasterPageContainerFiller::ScanTemplate (void) +{ + State eState (ERROR); + + if (mpScannerTask.get() != NULL) + { + if (mpScannerTask->HasNextStep()) + { + mpScannerTask->RunNextStep(); + if (mpScannerTask->GetLastAddedEntry() != mpLastAddedEntry) + { + mpLastAddedEntry = mpScannerTask->GetLastAddedEntry(); + if (mpLastAddedEntry != NULL) + eState = ADD_TEMPLATE; + else + eState = SCAN_TEMPLATE; + } + else + eState = SCAN_TEMPLATE; + } + else + eState = DONE; + } + + return eState; +} + + + + +MasterPageContainerFiller::State MasterPageContainerFiller::AddTemplate (void) +{ + if (mpLastAddedEntry != NULL) + { + SharedMasterPageDescriptor pDescriptor (new MasterPageDescriptor( + MasterPageContainer::TEMPLATE, + mnIndex, + mpLastAddedEntry->msPath, + mpLastAddedEntry->msTitle, + String(), + false, + ::boost::shared_ptr<PageObjectProvider>( + new TemplatePageObjectProvider(mpLastAddedEntry->msPath)), + ::boost::shared_ptr<PreviewProvider>( + new TemplatePreviewProvider(mpLastAddedEntry->msPath)))); + // For user supplied templates we use a different preview provider: + // The preview in the document shows not only shapes on the master + // page but also shapes on the foreground. This is misleading and + // therefore these previews are discarded and created directly from + // the page objects. + if (pDescriptor->GetURLClassification() == MasterPageDescriptor::URLCLASS_USER) + pDescriptor->mpPreviewProvider = ::boost::shared_ptr<PreviewProvider>( + new PagePreviewProvider()); + + mrContainerAdapter.PutMasterPage(pDescriptor); + ++mnIndex; + } + + return SCAN_TEMPLATE; +} + + + +} } // end of namespace sd::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/sidebar/MasterPageContainerFiller.hxx b/sd/source/ui/sidebar/MasterPageContainerFiller.hxx new file mode 100644 index 000000000000..46b73b07da6c --- /dev/null +++ b/sd/source/ui/sidebar/MasterPageContainerFiller.hxx @@ -0,0 +1,92 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef SD_SIDEBAR_PANELS_MASTER_PAGE_CONTAINER_FILLER_HXX +#define SD_SIDEBAR_PANELS_MASTER_PAGE_CONTAINER_FILLER_HXX + +#include "MasterPageContainer.hxx" +#include "MasterPageDescriptor.hxx" +#include "tools/AsynchronousTask.hxx" + +namespace sd { +class TemplateScanner; +class TemplateEntry; +} + +namespace sd { namespace sidebar { + +/** Fill a MasterPageContainer with information about the available master + pages. These are provided by one default page and from the existing + Impress templates. This is done asynchronously. +*/ +class MasterPageContainerFiller + : public ::sd::tools::AsynchronousTask +{ +public: + class ContainerAdapter + { + public: + virtual MasterPageContainer::Token PutMasterPage ( + const SharedMasterPageDescriptor& rpDescriptor) = 0; + /** This method is called when all Impress templates have been added + to the container via the PutMasterPage() method. + */ + virtual void FillingDone (void) = 0; + + protected: + ~ContainerAdapter() {} + }; + + MasterPageContainerFiller (ContainerAdapter& rContainerAdapter); + virtual ~MasterPageContainerFiller (void); + + /** Run the next step of the task. After HasNextStep() returns false + this method should ignore further calls. + */ + virtual void RunNextStep (void); + + /** Return <TRUE/> when there is at least one more step to execute. + When the task has been executed completely then <FALSE/> is + returned. + */ + virtual bool HasNextStep (void); + +private: + ContainerAdapter& mrContainerAdapter; + // Remember what the next step has to do. + enum State { + INITIALIZE_TEMPLATE_SCANNER, + SCAN_TEMPLATE, + ADD_TEMPLATE, + ERROR, + DONE + } meState; + ::std::auto_ptr<TemplateScanner> mpScannerTask; + const TemplateEntry* mpLastAddedEntry; + int mnIndex; + + State ScanTemplate (void); + State AddTemplate (void); +}; + +} } // end of namespace sd::sidebar + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/sidebar/MasterPageContainerProviders.cxx b/sd/source/ui/sidebar/MasterPageContainerProviders.cxx new file mode 100644 index 000000000000..448b8c8d60c7 --- /dev/null +++ b/sd/source/ui/sidebar/MasterPageContainerProviders.cxx @@ -0,0 +1,403 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "MasterPageContainerProviders.hxx" + +#include "DrawDocShell.hxx" +#include "drawdoc.hxx" +#include "PreviewRenderer.hxx" +#include <comphelper/processfactory.hxx> +#include <sfx2/app.hxx> +#include <sfx2/sfxsids.hrc> +#include <unotools/ucbstreamhelper.hxx> +#include <vcl/image.hxx> +#include <vcl/pngread.hxx> +#include <com/sun/star/embed/ElementModes.hpp> +#include <com/sun/star/embed/StorageFactory.hpp> +#include <tools/diagnose_ex.h> + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; + +namespace sd { namespace sidebar { + + +//===== PagePreviewProvider =================================================== + +PagePreviewProvider::PagePreviewProvider (void) +{ +} + + + + +Image PagePreviewProvider::operator () ( + int nWidth, + SdPage* pPage, + ::sd::PreviewRenderer& rRenderer) +{ + Image aPreview; + + if (pPage != NULL) + { + // Use the given renderer to create a preview of the given page + // object. + aPreview = rRenderer.RenderPage( + pPage, + nWidth, + OUString(), + false); + } + + return aPreview; +} + + + + +int PagePreviewProvider::GetCostIndex (void) +{ + return 5; +} + + + + +bool PagePreviewProvider::NeedsPageObject (void) +{ + return true; +} + + + + +//===== TemplatePreviewProvider =============================================== + +TemplatePreviewProvider::TemplatePreviewProvider (const OUString& rsURL) + : msURL(rsURL) +{ +} + + + + +Image TemplatePreviewProvider::operator() ( + int nWidth, + SdPage* pPage, + ::sd::PreviewRenderer& rRenderer) +{ + // Unused parameters. + (void)nWidth; + (void)pPage; + (void)rRenderer; + + // Load the thumbnail from a template document. + uno::Reference<io::XInputStream> xIStream; + + uno::Reference< uno::XComponentContext > xContext(::comphelper::getProcessComponentContext()); + try + { + uno::Reference<lang::XSingleServiceFactory> xStorageFactory = embed::StorageFactory::create(xContext); + + uno::Sequence<uno::Any> aArgs (2); + aArgs[0] <<= msURL; + aArgs[1] <<= embed::ElementModes::READ; + uno::Reference<embed::XStorage> xDocStorage ( + xStorageFactory->createInstanceWithArguments(aArgs), + uno::UNO_QUERY); + + try + { + if (xDocStorage.is()) + { + uno::Reference<embed::XStorage> xStorage ( + xDocStorage->openStorageElement( + "Thumbnails", + embed::ElementModes::READ)); + if (xStorage.is()) + { + uno::Reference<io::XStream> xThumbnailCopy ( + xStorage->cloneStreamElement("thumbnail.png")); + if (xThumbnailCopy.is()) + xIStream = xThumbnailCopy->getInputStream(); + } + } + } + catch (const uno::Exception& rException) + { + OSL_TRACE ( + "caught exception while trying to access Thumbnail/thumbnail.png of %s: %s", + OUStringToOString(msURL, + RTL_TEXTENCODING_UTF8).getStr(), + OUStringToOString(rException.Message, + RTL_TEXTENCODING_UTF8).getStr()); + } + + try + { + // An (older) implementation had a bug - The storage + // name was "Thumbnail" instead of "Thumbnails". The + // old name is still used as fallback but this code can + // be removed soon. + if ( ! xIStream.is()) + { + uno::Reference<embed::XStorage> xStorage ( + xDocStorage->openStorageElement( "Thumbnail", + embed::ElementModes::READ)); + if (xStorage.is()) + { + uno::Reference<io::XStream> xThumbnailCopy ( + xStorage->cloneStreamElement("thumbnail.png")); + if (xThumbnailCopy.is()) + xIStream = xThumbnailCopy->getInputStream(); + } + } + } + catch (const uno::Exception& rException) + { + OSL_TRACE ( + "caught exception while trying to access Thumbnails/thumbnail.png of %s: %s", + OUStringToOString(msURL, + RTL_TEXTENCODING_UTF8).getStr(), + OUStringToOString(rException.Message, + RTL_TEXTENCODING_UTF8).getStr()); + } + } + catch (const uno::Exception& rException) + { + OSL_TRACE ( + "caught exception while trying to access tuhmbnail of %s: %s", + OUStringToOString(msURL, + RTL_TEXTENCODING_UTF8).getStr(), + OUStringToOString(rException.Message, + RTL_TEXTENCODING_UTF8).getStr()); + } + + // Extract the image from the stream. + BitmapEx aThumbnail; + if (xIStream.is()) + { + ::std::auto_ptr<SvStream> pStream ( + ::utl::UcbStreamHelper::CreateStream (xIStream)); + ::vcl::PNGReader aReader (*pStream); + aThumbnail = aReader.Read (); + } + + // Note that the preview is returned without scaling it to the desired + // width. This gives the caller the chance to take advantage of a + // possibly larger resolution then was asked for. + return aThumbnail; +} + + + + +int TemplatePreviewProvider::GetCostIndex (void) +{ + return 10; +} + + + + +bool TemplatePreviewProvider::NeedsPageObject (void) +{ + return false; +} + + + + +//===== TemplatePageObjectProvider ============================================= + +TemplatePageObjectProvider::TemplatePageObjectProvider (const OUString& rsURL) + : msURL(rsURL), + mxDocumentShell() +{ +} + + + + +SdPage* TemplatePageObjectProvider::operator() (SdDrawDocument* pContainerDocument) +{ + // Unused parameters. + (void)pContainerDocument; + + SdPage* pPage = NULL; + + mxDocumentShell = NULL; + ::sd::DrawDocShell* pDocumentShell = NULL; + try + { + // Load the template document and return its first page. + pDocumentShell = LoadDocument (msURL); + if (pDocumentShell != NULL) + { + SdDrawDocument* pDocument = pDocumentShell->GetDoc(); + if (pDocument != NULL) + { + pPage = pDocument->GetMasterSdPage(0, PK_STANDARD); + // In order to make the newly loaded master page deletable + // when copied into documents it is marked as no "precious". + // When it is modified then it is marked as "precious". + if (pPage != NULL) + pPage->SetPrecious(false); + } + } + } + catch (const uno::RuntimeException&) + { + DBG_UNHANDLED_EXCEPTION(); + pPage = NULL; + } + + return pPage; +} + + + + +::sd::DrawDocShell* TemplatePageObjectProvider::LoadDocument (const OUString& sFileName) +{ + SfxApplication* pSfxApp = SFX_APP(); + SfxItemSet* pSet = new SfxAllItemSet (pSfxApp->GetPool()); + pSet->Put (SfxBoolItem (SID_TEMPLATE, sal_True)); + pSet->Put (SfxBoolItem (SID_PREVIEW, sal_True)); + if (pSfxApp->LoadTemplate (mxDocumentShell, sFileName, sal_True, pSet)) + { + mxDocumentShell = NULL; + } + SfxObjectShell* pShell = mxDocumentShell; + return PTR_CAST(::sd::DrawDocShell,pShell); +} + + + + +int TemplatePageObjectProvider::GetCostIndex (void) +{ + return 20; +} + + + + +bool TemplatePageObjectProvider::operator== (const PageObjectProvider& rProvider) +{ + const TemplatePageObjectProvider* pTemplatePageObjectProvider + = dynamic_cast<const TemplatePageObjectProvider*>(&rProvider); + if (pTemplatePageObjectProvider != NULL) + return (msURL == pTemplatePageObjectProvider->msURL); + else + return false; +} + + + + +//===== DefaultPageObjectProvider ============================================== + +DefaultPageObjectProvider::DefaultPageObjectProvider (void) +{ +} + + + + +SdPage* DefaultPageObjectProvider::operator () (SdDrawDocument* pContainerDocument) +{ + SdPage* pLocalMasterPage = NULL; + if (pContainerDocument != NULL) + { + sal_Int32 nIndex (0); + SdPage* pLocalSlide = pContainerDocument->GetSdPage((sal_uInt16)nIndex, PK_STANDARD); + if (pLocalSlide!=NULL && pLocalSlide->TRG_HasMasterPage()) + pLocalMasterPage = dynamic_cast<SdPage*>(&pLocalSlide->TRG_GetMasterPage()); + } + + if (pLocalMasterPage == NULL) + { + DBG_ASSERT(false, "can not create master page for slide"); + } + + return pLocalMasterPage; +} + + + + +int DefaultPageObjectProvider::GetCostIndex (void) +{ + return 15; +} + + + + +bool DefaultPageObjectProvider::operator== (const PageObjectProvider& rProvider) +{ + return (dynamic_cast<const DefaultPageObjectProvider*>(&rProvider) != NULL); +} + + + + +//===== ExistingPageProvider ================================================== + +ExistingPageProvider::ExistingPageProvider (SdPage* pPage) + : mpPage(pPage) +{ +} + + + + +SdPage* ExistingPageProvider::operator() (SdDrawDocument* pDocument) +{ + (void)pDocument; // Unused parameter. + + return mpPage; +} + + + + +int ExistingPageProvider::GetCostIndex (void) +{ + return 0; +} + + + + +bool ExistingPageProvider::operator== (const PageObjectProvider& rProvider) +{ + const ExistingPageProvider* pExistingPageProvider + = dynamic_cast<const ExistingPageProvider*>(&rProvider); + if (pExistingPageProvider != NULL) + return (mpPage == pExistingPageProvider->mpPage); + else + return false; +} + + +} } // end of namespace sd::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/sidebar/MasterPageContainerProviders.hxx b/sd/source/ui/sidebar/MasterPageContainerProviders.hxx new file mode 100644 index 000000000000..18ecbee0c432 --- /dev/null +++ b/sd/source/ui/sidebar/MasterPageContainerProviders.hxx @@ -0,0 +1,192 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef SD_SIDEBAR_PANELS_MASTER_PAGE_CONTAINER_PROVIDERS_HXX +#define SD_SIDEBAR_PANELS_MASTER_PAGE_CONTAINER_PROVIDERS_HXX + +#include <rtl/ustring.hxx> +#include <sfx2/objsh.hxx> + +class Image; +class SdDrawDocument; +class SdPage; +namespace sd { class PreviewRenderer; } +namespace sd { class DrawDocShell; } + + +namespace sd { namespace sidebar { + + +/** Interface for a provider of page objects. It is used by the + MasterPageDescriptor to create master page objects on demand. +*/ +class PageObjectProvider +{ +public: + /** Return a master page either by returning an already existing one, by + creating a new page, or by loading a document. + @param pDocument + The document of the MasterPageContainer. It may be used to + create new pages. + */ + virtual SdPage* operator() (SdDrawDocument* pDocument) = 0; + + /** An abstract value for the expected cost of providing a master page + object. + @return + A value of 0 represents for the lowest cost, i.e. an almost + immediate return. Positive values stand for higher costs. + Negative values are not supported. + */ + virtual int GetCostIndex (void) = 0; + + virtual bool operator== (const PageObjectProvider& rProvider) = 0; + +protected: + ~PageObjectProvider() {} +}; + + + + +class PreviewProvider +{ +public: + /** Create a preview image in the specified width. + @param nWidth + Requested width of the preview. The calling method can cope + with other sizes as well but the resulting image quality is + better when the returned image has the requested size. + @param pPage + Page object for which a preview is requested. This may be NULL + when the page object is expensive to get and the PreviewProvider + does not need this object (NeedsPageObject() returns false.) + @param rRenderer + This PreviewRenderer may be used by the PreviewProvider to + create a preview image. + */ + virtual Image operator() (int nWidth, SdPage* pPage, ::sd::PreviewRenderer& rRenderer) = 0; + + /** Return a value that indicates how expensive the creation of a + preview image is. The higher the returned value the more expensive + is the preview creation. Return 0 when the preview is already + present and can be returned immediately. + */ + virtual int GetCostIndex (void) = 0; + + /** Return whether the page object passed is necessary to create a + preview. + */ + virtual bool NeedsPageObject (void) = 0; + +protected: + ~PreviewProvider() {} +}; + + + + +/** Provide previews of existing page objects by rendering them. +*/ +class PagePreviewProvider : public PreviewProvider +{ +public: + PagePreviewProvider (void); + virtual ~PagePreviewProvider() {} + virtual Image operator () (int nWidth, SdPage* pPage, ::sd::PreviewRenderer& rRenderer); + virtual int GetCostIndex (void); + virtual bool NeedsPageObject (void); +private: +}; + + + + +/** Provide master page objects for template documents for which only the + URL is given. +*/ +class TemplatePageObjectProvider : public PageObjectProvider +{ +public: + TemplatePageObjectProvider (const OUString& rsURL); + virtual ~TemplatePageObjectProvider (void) {}; + virtual SdPage* operator () (SdDrawDocument* pDocument); + virtual int GetCostIndex (void); + virtual bool operator== (const PageObjectProvider& rProvider); +private: + OUString msURL; + SfxObjectShellLock mxDocumentShell; + ::sd::DrawDocShell* LoadDocument (const OUString& sFileName); +}; + + + + +/** Provide previews for template documents by loading the thumbnails from + the documents. +*/ +class TemplatePreviewProvider : public PreviewProvider +{ +public: + TemplatePreviewProvider (const OUString& rsURL); + virtual ~TemplatePreviewProvider (void) {}; + virtual Image operator() (int nWidth, SdPage* pPage, ::sd::PreviewRenderer& rRenderer); + virtual int GetCostIndex (void); + virtual bool NeedsPageObject (void); +private: + OUString msURL; +}; + + + + +/** Create an empty default master page. +*/ +class DefaultPageObjectProvider : public PageObjectProvider +{ +public: + DefaultPageObjectProvider (void); + virtual ~DefaultPageObjectProvider() {} + virtual SdPage* operator () (SdDrawDocument* pDocument); + virtual int GetCostIndex (void); + virtual bool operator== (const PageObjectProvider& rProvider); +}; + + + +/** This implementation of the PageObjectProvider simply returns an already + existing master page object. +*/ +class ExistingPageProvider : public PageObjectProvider +{ +public: + ExistingPageProvider (SdPage* pPage); + virtual ~ExistingPageProvider() {} + virtual SdPage* operator() (SdDrawDocument* pDocument); + virtual int GetCostIndex (void); + virtual bool operator== (const PageObjectProvider& rProvider); +private: + SdPage* mpPage; +}; + +} } // end of namespace sd::sidebar + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/sidebar/MasterPageContainerQueue.cxx b/sd/source/ui/sidebar/MasterPageContainerQueue.cxx new file mode 100644 index 000000000000..36015378092f --- /dev/null +++ b/sd/source/ui/sidebar/MasterPageContainerQueue.cxx @@ -0,0 +1,299 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "MasterPageContainerQueue.hxx" + +#include "tools/IdleDetection.hxx" + +#include <set> + +namespace sd { namespace sidebar { + +const sal_Int32 MasterPageContainerQueue::snDelayedCreationTimeout (15); +const sal_Int32 MasterPageContainerQueue::snDelayedCreationTimeoutWhenNotIdle (100); +const sal_Int32 MasterPageContainerQueue::snMasterPagePriorityBoost (5); +const sal_Int32 MasterPageContainerQueue::snWaitForMoreRequestsPriorityThreshold (-10); +sal_uInt32 MasterPageContainerQueue::snWaitForMoreRequestsCount(15); + +//===== MasterPageContainerQueue::PreviewCreationRequest ====================== + +class MasterPageContainerQueue::PreviewCreationRequest +{ +public: + PreviewCreationRequest (const SharedMasterPageDescriptor& rpDescriptor, int nPriority) + : mpDescriptor(rpDescriptor), + mnPriority(nPriority) + {} + SharedMasterPageDescriptor mpDescriptor; + int mnPriority; + class Compare + { + public: + bool operator() (const PreviewCreationRequest& r1,const PreviewCreationRequest& r2) const + { + if (r1.mnPriority != r2.mnPriority) + { + // Prefer requests with higher priority. + return r1.mnPriority > r2.mnPriority; + } + else + { + // Prefer tokens that have been earlier created (those with lower + // value). + return r1.mpDescriptor->maToken < r2.mpDescriptor->maToken; + } + } + }; + class CompareToken + { + public: + MasterPageContainer::Token maToken; + CompareToken(MasterPageContainer::Token aToken) : maToken(aToken) {} + bool operator() (const PreviewCreationRequest& rRequest) const + { return maToken==rRequest.mpDescriptor->maToken; } + }; +}; + + + + +//===== MasterPageContainerQueue::RequestQueue ================================ + +class MasterPageContainerQueue::RequestQueue + : public ::std::set<PreviewCreationRequest,PreviewCreationRequest::Compare> +{ +public: + RequestQueue (void) {} +}; + + + + +//===== MasterPageContainerQueue ============================================== + +MasterPageContainerQueue* MasterPageContainerQueue::Create ( + const ::boost::weak_ptr<ContainerAdapter>& rpContainer) +{ + MasterPageContainerQueue* pQueue = new MasterPageContainerQueue(rpContainer); + pQueue->LateInit(); + return pQueue; +} + + + + +MasterPageContainerQueue::MasterPageContainerQueue ( + const ::boost::weak_ptr<ContainerAdapter>& rpContainer) + : mpWeakContainer(rpContainer), + mpRequestQueue(new RequestQueue()), + maDelayedPreviewCreationTimer(), + mnRequestsServedCount(0) +{ +} + + + + +MasterPageContainerQueue::~MasterPageContainerQueue (void) +{ + maDelayedPreviewCreationTimer.Stop(); + while ( ! mpRequestQueue->empty()) + mpRequestQueue->erase(mpRequestQueue->begin()); +} + + + + +void MasterPageContainerQueue::LateInit (void) +{ + // Set up the timer for the delayed creation of preview bitmaps. + maDelayedPreviewCreationTimer.SetTimeout (snDelayedCreationTimeout); + Link aLink (LINK(this,MasterPageContainerQueue,DelayedPreviewCreation)); + maDelayedPreviewCreationTimer.SetTimeoutHdl(aLink); +} + + + + +bool MasterPageContainerQueue::RequestPreview (const SharedMasterPageDescriptor& rpDescriptor) +{ + bool bSuccess (false); + if (rpDescriptor.get() != NULL + && rpDescriptor->maLargePreview.GetSizePixel().Width() == 0) + { + sal_Int32 nPriority (CalculatePriority(rpDescriptor)); + + // Add a new or replace an existing request. + RequestQueue::iterator iRequest (::std::find_if( + mpRequestQueue->begin(), + mpRequestQueue->end(), + PreviewCreationRequest::CompareToken(rpDescriptor->maToken))); + // When a request for the same token exists then the lowest of the + // two priorities is used. + if (iRequest != mpRequestQueue->end()) + if (iRequest->mnPriority < nPriority) + { + mpRequestQueue->erase(iRequest); + iRequest = mpRequestQueue->end(); + } + + // Add a new request when none exists (or has just been erased). + if (iRequest == mpRequestQueue->end()) + { + mpRequestQueue->insert(PreviewCreationRequest(rpDescriptor,nPriority)); + maDelayedPreviewCreationTimer.Start(); + bSuccess = true; + } + } + return bSuccess; +} + + + + +sal_Int32 MasterPageContainerQueue::CalculatePriority ( + const SharedMasterPageDescriptor& rpDescriptor) const +{ + sal_Int32 nPriority; + + // The cost is used as a starting value. + int nCost (0); + if (rpDescriptor->mpPreviewProvider.get() != NULL) + { + nCost = rpDescriptor->mpPreviewProvider->GetCostIndex(); + if (rpDescriptor->mpPreviewProvider->NeedsPageObject()) + if (rpDescriptor->mpPageObjectProvider.get() != NULL) + nCost += rpDescriptor->mpPageObjectProvider->GetCostIndex(); + } + + // Its negative value is used so that requests with a low cost are + // preferred over those with high costs. + nPriority = -nCost; + + // Add a term that introduces an order based on the appearance in the + // AllMasterPagesSelector. + nPriority -= rpDescriptor->maToken / 3; + + // Process requests for the CurrentMasterPagesSelector first. + if (rpDescriptor->meOrigin == MasterPageContainer::MASTERPAGE) + nPriority += snMasterPagePriorityBoost; + + return nPriority; +} + + + + +IMPL_LINK(MasterPageContainerQueue, DelayedPreviewCreation, Timer*, pTimer) +{ + bool bIsShowingFullScreenShow (false); + bool bWaitForMoreRequests (false); + + do + { + if (mpRequestQueue->empty()) + break; + + // First check whether the system is idle. + sal_Int32 nIdleState (tools::IdleDetection::GetIdleState()); + if (nIdleState != tools::IdleDetection::IDET_IDLE) + { + if ((nIdleState&tools::IdleDetection::IDET_FULL_SCREEN_SHOW_ACTIVE) != 0) + bIsShowingFullScreenShow = true; + break; + } + + PreviewCreationRequest aRequest (*mpRequestQueue->begin()); + + // Check if the request should really be processed right now. + // Reasons to not do it are when its cost is high and not many other + // requests have been inserted into the queue that would otherwise + // be processed first. + if (aRequest.mnPriority < snWaitForMoreRequestsPriorityThreshold + && (mnRequestsServedCount+mpRequestQueue->size() < snWaitForMoreRequestsCount)) + { + // Wait for more requests before this one is processed. Note + // that the queue processing is not started anew when this + // method is left. That is done when the next request is + // inserted. + bWaitForMoreRequests = true; + break; + } + + mpRequestQueue->erase(mpRequestQueue->begin()); + + if (aRequest.mpDescriptor.get() != NULL) + { + mnRequestsServedCount += 1; + if ( ! mpWeakContainer.expired()) + { + ::boost::shared_ptr<ContainerAdapter> pContainer (mpWeakContainer); + if (pContainer.get() != NULL) + pContainer->UpdateDescriptor(aRequest.mpDescriptor,false,true,true); + } + } + } + while (false); + + if (mpRequestQueue->size() > 0 && ! bWaitForMoreRequests) + { + int nTimeout (snDelayedCreationTimeout); + if (bIsShowingFullScreenShow) + nTimeout = snDelayedCreationTimeoutWhenNotIdle; + maDelayedPreviewCreationTimer.SetTimeout(nTimeout); + pTimer->Start(); + } + + return 0; +} + + + + +bool MasterPageContainerQueue::HasRequest (MasterPageContainer::Token aToken) const +{ + RequestQueue::iterator iRequest (::std::find_if( + mpRequestQueue->begin(), + mpRequestQueue->end(), + PreviewCreationRequest::CompareToken(aToken))); + return (iRequest != mpRequestQueue->end()); +} + + + + +bool MasterPageContainerQueue::IsEmpty (void) const +{ + return mpRequestQueue->empty(); +} + + + + +void MasterPageContainerQueue::ProcessAllRequests (void) +{ + snWaitForMoreRequestsCount = 0; + if (mpRequestQueue->size() > 0) + maDelayedPreviewCreationTimer.Start(); +} + + +} } // end of namespace sd::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/sidebar/MasterPageContainerQueue.hxx b/sd/source/ui/sidebar/MasterPageContainerQueue.hxx new file mode 100644 index 000000000000..4df6205f40a3 --- /dev/null +++ b/sd/source/ui/sidebar/MasterPageContainerQueue.hxx @@ -0,0 +1,134 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef SD_SIDEBAR_PANELS_MASTER_PAGE_CONTAINER_QUEUE_HXX +#define SD_SIDEBAR_PANELS_MASTER_PAGE_CONTAINER_QUEUE_HXX + +#include "MasterPageContainer.hxx" +#include "MasterPageDescriptor.hxx" + +#include <boost/scoped_ptr.hpp> +#include <boost/weak_ptr.hpp> + +namespace sd { namespace sidebar { + + +/** The queue stores and processes all requests from a MasterPageContainer + for the creation of previews. + The order of request processing and its timing is controlled by a + heuristic that uses values given with each request and which is + controlled by various parameters that are described below. +*/ +class MasterPageContainerQueue +{ +public: + class ContainerAdapter { + public: + virtual bool UpdateDescriptor ( + const SharedMasterPageDescriptor& rpDescriptor, + bool bForcePageObject, + bool bForcePreview, + bool bSendEvents) = 0; + + protected: + ~ContainerAdapter() {} + }; + + static MasterPageContainerQueue* Create ( + const ::boost::weak_ptr<ContainerAdapter>& rpContainer); + virtual ~MasterPageContainerQueue (void); + + /** This method is typically called for entries in the container for + which GetPreviewState() returns OS_CREATABLE. The creation of the + preview is then scheduled to be executed asynchronously at a later + point in time. When the preview is available the change listeners + will be notified. + */ + bool RequestPreview (const SharedMasterPageDescriptor& rDescriptor); + + /** Return <TRUE/> when there is a request currently in the queue for + the given token. + */ + bool HasRequest (MasterPageContainer::Token aToken) const; + + /** Return <TRUE/> when there is at least one request in the queue. + */ + bool IsEmpty (void) const; + + /** After this call the queue does not wait anymore for requests with + higher priority when only a small number of requests with lower + priority are present. This method should be called when all + templates are inserted into the MasterPageContainer. + */ + void ProcessAllRequests (void); + +private: + ::boost::weak_ptr<ContainerAdapter> mpWeakContainer; + class PreviewCreationRequest; + class RequestQueue; + ::boost::scoped_ptr<RequestQueue> mpRequestQueue; + Timer maDelayedPreviewCreationTimer; + sal_uInt32 mnRequestsServedCount; + + // There are a couple of values that define various aspects of the + // heuristic that defines the order and timing in which requests for + // preview creation are processed. + + /** The time to wait (in milliseconds) between the creation of previews. + */ + static const sal_Int32 snDelayedCreationTimeout; + + /** The time to wait when the system is not idle. + */ + static const sal_Int32 snDelayedCreationTimeoutWhenNotIdle; + + /** Requests for previews of master pages in a document have their + priority increased by this value. + */ + static const sal_Int32 snMasterPagePriorityBoost; + + /** When only requests which a priority lower than this threshold exist + and not many requests have been made yet then wait with processing + them until more requests are present. + */ + static const sal_Int32 snWaitForMoreRequestsPriorityThreshold; + + /** When only requests which a priority lower than a threshold exist + and not more requests than this number have been made or already + processed then wait with processing them until more requests are + present. + */ + static sal_uInt32 snWaitForMoreRequestsCount; + + MasterPageContainerQueue (const ::boost::weak_ptr<ContainerAdapter>& rpContainer); + void LateInit (void); + + /** Calculate the priority that defines the order in which requests + are processed. + */ + sal_Int32 CalculatePriority (const SharedMasterPageDescriptor& rDescriptor) const; + + DECL_LINK(DelayedPreviewCreation, Timer *); +}; + +} } // end of namespace sd::sidebar + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/sidebar/MasterPageDescriptor.cxx b/sd/source/ui/sidebar/MasterPageDescriptor.cxx new file mode 100644 index 000000000000..3e5117f9607f --- /dev/null +++ b/sd/source/ui/sidebar/MasterPageDescriptor.cxx @@ -0,0 +1,415 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "MasterPageDescriptor.hxx" + +#include "DocumentHelper.hxx" +#include "sdpage.hxx" +#include <tools/urlobj.hxx> + +namespace sd { namespace sidebar { + + +//===== MasterPageDescriptor ================================================== + +MasterPageDescriptor::MasterPageDescriptor ( + MasterPageContainer::Origin eOrigin, + const sal_Int32 nTemplateIndex, + const String& rsURL, + const String& rsPageName, + const String& rsStyleName, + const bool bIsPrecious, + const ::boost::shared_ptr<PageObjectProvider>& rpPageObjectProvider, + const ::boost::shared_ptr<PreviewProvider>& rpPreviewProvider) + : maToken(MasterPageContainer::NIL_TOKEN), + meOrigin(eOrigin), + msURL(INetURLObject(rsURL).GetMainURL(INetURLObject::DECODE_UNAMBIGUOUS)), + msPageName(rsPageName), + msStyleName(rsStyleName), + mbIsPrecious(bIsPrecious), + mpMasterPage(NULL), + mpSlide(NULL), + maSmallPreview(), + maLargePreview(), + mpPreviewProvider(rpPreviewProvider), + mpPageObjectProvider(rpPageObjectProvider), + mnTemplateIndex(nTemplateIndex), + meURLClassification(URLCLASS_UNDETERMINED), + mnUseCount(0) +{ +} + + + + +MasterPageDescriptor::MasterPageDescriptor (const MasterPageDescriptor& rDescriptor) + : maToken(rDescriptor.maToken), + meOrigin(rDescriptor.meOrigin), + msURL(rDescriptor.msURL), + msPageName(rDescriptor.msPageName), + msStyleName(rDescriptor.msStyleName), + mbIsPrecious(rDescriptor.mbIsPrecious), + mpMasterPage(rDescriptor.mpMasterPage), + mpSlide(rDescriptor.mpSlide), + maSmallPreview(rDescriptor.maSmallPreview), + maLargePreview(rDescriptor.maLargePreview), + mpPreviewProvider(rDescriptor.mpPreviewProvider), + mpPageObjectProvider(rDescriptor.mpPageObjectProvider), + mnTemplateIndex(rDescriptor.mnTemplateIndex), + meURLClassification(rDescriptor.meURLClassification), + mnUseCount(rDescriptor.mnUseCount) +{ +} + + + + +MasterPageDescriptor::~MasterPageDescriptor (void) +{ +} + + + + +void MasterPageDescriptor::SetToken (MasterPageContainer::Token aToken) +{ + maToken = aToken; +} + + + + +Image MasterPageDescriptor::GetPreview (MasterPageContainer::PreviewSize eSize) const +{ + if (eSize == MasterPageContainer::SMALL) + return maSmallPreview; + else + return maLargePreview; +} + + + +SAL_WNODEPRECATED_DECLARATIONS_PUSH +::std::auto_ptr<std::vector<MasterPageContainerChangeEvent::EventType> > + MasterPageDescriptor::Update ( + const MasterPageDescriptor& rDescriptor) +{ + bool bDataChanged (false); + bool bIndexChanged (false); + bool bPreviewChanged (false); + + if (meOrigin==MasterPageContainer::UNKNOWN + && rDescriptor.meOrigin!=MasterPageContainer::UNKNOWN) + { + meOrigin = rDescriptor.meOrigin; + bIndexChanged = true; + } + + if (msURL.isEmpty() && !rDescriptor.msURL.isEmpty()) + { + msURL = rDescriptor.msURL; + bDataChanged = true; + } + + if (msPageName.isEmpty() && !rDescriptor.msPageName.isEmpty()) + { + msPageName = rDescriptor.msPageName; + bDataChanged = true; + } + + if (msStyleName.isEmpty() && !rDescriptor.msStyleName.isEmpty()) + { + msStyleName = rDescriptor.msStyleName; + bDataChanged = true; + } + + if (mpPageObjectProvider.get()==NULL && rDescriptor.mpPageObjectProvider.get()!=NULL) + { + mpPageObjectProvider = rDescriptor.mpPageObjectProvider; + bDataChanged = true; + } + + if (mpPreviewProvider.get()==NULL && rDescriptor.mpPreviewProvider.get()!=NULL) + { + mpPreviewProvider = rDescriptor.mpPreviewProvider; + bPreviewChanged = true; + } + + if (mnTemplateIndex<0 && rDescriptor.mnTemplateIndex>=0) + { + mnTemplateIndex = rDescriptor.mnTemplateIndex; + bIndexChanged = true; + } + + // Prepare the list of event types that will be returned. + ::std::auto_ptr<std::vector<MasterPageContainerChangeEvent::EventType> > pResult; + if (bDataChanged || bIndexChanged || bPreviewChanged) + { + pResult.reset(new std::vector<MasterPageContainerChangeEvent::EventType>()); + if (bDataChanged) + pResult->push_back(MasterPageContainerChangeEvent::DATA_CHANGED); + if (bIndexChanged) + pResult->push_back(MasterPageContainerChangeEvent::INDEX_CHANGED); + if (bPreviewChanged) + pResult->push_back(MasterPageContainerChangeEvent::PREVIEW_CHANGED); + } + + return pResult; +} +SAL_WNODEPRECATED_DECLARATIONS_POP + + + +int MasterPageDescriptor::UpdatePageObject ( + sal_Int32 nCostThreshold, + SdDrawDocument* pDocument) +{ + int nModified = 0; + + // Update the page object when that is not yet known. + if (mpMasterPage == NULL + && mpPageObjectProvider.get()!=NULL + && (nCostThreshold<0 || mpPageObjectProvider->GetCostIndex()<=nCostThreshold)) + { + // Note that pDocument may be NULL. + + SdPage* pPage = (*mpPageObjectProvider)(pDocument); + if (meOrigin == MasterPageContainer::MASTERPAGE) + { + mpMasterPage = pPage; + if (mpMasterPage != NULL) + mpMasterPage->SetPrecious(mbIsPrecious); + } + else + { + // Master pages from templates are copied into the local document. + if (pDocument != NULL) + mpMasterPage = DocumentHelper::CopyMasterPageToLocalDocument(*pDocument,pPage); + mpSlide = DocumentHelper::GetSlideForMasterPage(mpMasterPage); + } + + if (mpMasterPage != NULL) + { + // Update page name and style name. + if (msPageName.isEmpty()) + msPageName = mpMasterPage->GetName(); + msStyleName = mpMasterPage->GetName(); + + // Delete an existing substitution. The next request for a preview + // will create the real one. + maSmallPreview = Image(); + maLargePreview = Image(); + mpPreviewProvider = ::boost::shared_ptr<PreviewProvider>(new PagePreviewProvider()); + } + else + { + DBG_ASSERT(false, "UpdatePageObject: master page is NULL"); + return -1; + } + + nModified = 1; + } + + return nModified; +} + + + + +bool MasterPageDescriptor::UpdatePreview ( + sal_Int32 nCostThreshold, + const Size& rSmallSize, + const Size& rLargeSize, + ::sd::PreviewRenderer& rRenderer) +{ + bool bModified (false); + + // Update the preview when that is not yet known. + if (maLargePreview.GetSizePixel().Width()==0 + && mpPreviewProvider.get()!=NULL + && (nCostThreshold<0 || mpPreviewProvider->GetCostIndex()<=nCostThreshold)) + { + SdPage* pPage = mpSlide; + if (pPage == NULL) + { + pPage = mpMasterPage; + } + maLargePreview = (*mpPreviewProvider)( + rLargeSize.Width(), + pPage, + rRenderer); + if (maLargePreview.GetSizePixel().Width() > 0) + { + // Create the small preview by scaling the large one down. + maSmallPreview = rRenderer.ScaleBitmap( + maLargePreview.GetBitmapEx(), + rSmallSize.Width()); + // The large preview may not have the desired width. Scale it + // accrodingly. + if (maLargePreview.GetSizePixel().Width() != rLargeSize.Width()) + maLargePreview = rRenderer.ScaleBitmap( + maLargePreview.GetBitmapEx(), + rLargeSize.Width()); + bModified = true; + } + } + + return bModified; +} + + + + +MasterPageDescriptor::URLClassification MasterPageDescriptor::GetURLClassification (void) +{ + if (meURLClassification == URLCLASS_UNDETERMINED) + { + if (msURL.isEmpty()) + meURLClassification = URLCLASS_UNKNOWN; + else if (msURL.indexOf("presnt")>=0) + { + meURLClassification = URLCLASS_PRESENTATION; + } + else if (msURL.indexOf("layout")>=0) + { + meURLClassification = URLCLASS_LAYOUT; + } + else if (msURL.indexOf("educate")>=0) + { + meURLClassification = URLCLASS_OTHER; + } + else + { + meURLClassification = URLCLASS_USER; + } + } + + return meURLClassification; +} + + + +//===== URLComparator ========================================================= + +MasterPageDescriptor::URLComparator::URLComparator (const OUString& sURL) + : msURL(sURL) +{ +} + + + + +bool MasterPageDescriptor::URLComparator::operator() ( + const SharedMasterPageDescriptor& rDescriptor) +{ + if (rDescriptor.get() == NULL) + return false; + else + return rDescriptor->msURL.equals(msURL); +} + + + + +// ===== StyleNameComparator ================================================== + +MasterPageDescriptor::StyleNameComparator::StyleNameComparator (const OUString& sStyleName) + : msStyleName(sStyleName) +{ +} + + + + +bool MasterPageDescriptor::StyleNameComparator::operator() ( + const SharedMasterPageDescriptor& rDescriptor) +{ + if (rDescriptor.get() == NULL) + return false; + else + return rDescriptor->msStyleName.equals(msStyleName); +} + + + + +//===== PageObjectComparator ================================================== + +MasterPageDescriptor::PageObjectComparator::PageObjectComparator (const SdPage* pPageObject) + : mpMasterPage(pPageObject) +{ +} + + + + +bool MasterPageDescriptor::PageObjectComparator::operator() ( + const SharedMasterPageDescriptor& rDescriptor) +{ + if (rDescriptor.get() == NULL) + return false; + else + return rDescriptor->mpMasterPage==mpMasterPage; +} + + + + +//===== AllComparator ========================================================= + +MasterPageDescriptor::AllComparator::AllComparator(const SharedMasterPageDescriptor& rDescriptor) + : mpDescriptor(rDescriptor) +{ +} + + + + +bool MasterPageDescriptor::AllComparator::operator() (const SharedMasterPageDescriptor&rDescriptor) +{ + if (rDescriptor.get() == NULL) + return false; + else + { + // Take URL, page name, style name, and page object into account + // when comparing two descriptors. When two descriptors are + // identical in any of these values then there are thought of as + // equivalent. Only the Origin has to be the same in both + // descriptors. + return + mpDescriptor->meOrigin == rDescriptor->meOrigin + && ( + (!mpDescriptor->msURL.isEmpty() + && mpDescriptor->msURL.equals(rDescriptor->msURL)) + || (!mpDescriptor->msPageName.isEmpty() + && mpDescriptor->msPageName.equals(rDescriptor->msPageName)) + || (!mpDescriptor->msStyleName.isEmpty() + && mpDescriptor->msStyleName.equals(rDescriptor->msStyleName)) + || (mpDescriptor->mpMasterPage!=NULL + && mpDescriptor->mpMasterPage==rDescriptor->mpMasterPage) + || (mpDescriptor->mpPageObjectProvider.get()!=NULL + && rDescriptor->mpPageObjectProvider.get()!=NULL + && mpDescriptor->mpPageObjectProvider==rDescriptor->mpPageObjectProvider)); + } +} + + +} } // end of namespace sd::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/sidebar/MasterPageDescriptor.hxx b/sd/source/ui/sidebar/MasterPageDescriptor.hxx new file mode 100644 index 000000000000..c1ddc2e0329f --- /dev/null +++ b/sd/source/ui/sidebar/MasterPageDescriptor.hxx @@ -0,0 +1,235 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef SD_SIDEBAR_PANELS_MASTER_PAGE_DESCRIPTOR_HXX +#define SD_SIDEBAR_PANELS_MASTER_PAGE_DESCRIPTOR_HXX + +#include "MasterPageContainer.hxx" +#include <boost/shared_ptr.hpp> + +namespace sd { namespace sidebar { + +class PageObjectProvider; +class PreviewProvider; + +class MasterPageDescriptor; +typedef ::boost::shared_ptr<MasterPageDescriptor> SharedMasterPageDescriptor; + +/** A collection of data that is stored for every master page in the + MasterpageContainer. +*/ +class MasterPageDescriptor +{ +public: + MasterPageDescriptor ( + MasterPageContainer::Origin eOrigin, + const sal_Int32 nTemplateIndex, + const String& rURL, + const String& rPageName, + const String& rStyleName, + const bool bIsPrecious, + const ::boost::shared_ptr<PageObjectProvider>& rpPageObjectProvider, + const ::boost::shared_ptr<PreviewProvider>& rpPreviewProvider); + MasterPageDescriptor (const MasterPageDescriptor& rDescriptor); + ~MasterPageDescriptor (void); + + void SetToken (MasterPageContainer::Token aToken); + + /** Update the called MasterPageDescriptor object with values from the + given one. Only those values are updated that have default values + in the called object and that have non-default values in the given + one. + @return + Returns a list of event types for which event notifications have + to be sent to listeners. The list may be empty or NULL. + */ + ::std::auto_ptr<std::vector<MasterPageContainerChangeEvent::EventType> > + Update ( + const MasterPageDescriptor& rDescriptor); + + /** This convenience method returns either a small or a large preview, + depending on the given size specifier. + Note that the previews are not created when they are not present. + @return + The returned preview may be empty. + */ + Image GetPreview (MasterPageContainer::PreviewSize ePreviewSize) const; + + /** Use the PreviewProvider to get access to a preview of the master + page. + + Note that this is only done, when either bForce is <TRUE/> or + the PreviewProvider::GetCostIndex() returns 0. + + The small preview is created by scaling the large one, not by + calling PreviewProvider::operator() a second time. + + It is the responsibility of the caller to call UpdatePageObject() + before calling this method when the PreviewProvider can only work + when the master page object is present, i.e. its NeedsPageObject() + method returns <TRUE/>. + + @param nCostThreshold + When this is zero or positive then the preview is created only + when the preview provider has a cost equal to or smaller than + this threshold. A negative value forces the preview to be + created, regardless of the cost. + @param rSmallSize + Size of the small preview. + @param rLargeSize + Size of the large preview. + @param rRenderer + A PreviewRenderer object that may be used to create a preview. + @return + When the previews are successfully provided then <TRUE/> is + returned. + */ + bool UpdatePreview ( + sal_Int32 nCostThreshold, + const Size& rSmallSize, + const Size& rLargeSize, + ::sd::PreviewRenderer& rRenderer); + + /** Use the PageObjectProvider to get access to the master page object. + + Note that this is only done, when either bForce is <TRUE/> or the + PreviewProvider::GetCostIndex() returns 0. + + @param nCostThreshold + When this is zero or positive then the page object is created + only when the page object provider has a cost equal to or + smaller than this threshold. A negative value forces the + page object be created, regardless of the cost. + @param pDocument + This document of the MasterPageContainer may be used to create + a page object with or store one in. + @return + When the master page object is successfully provided then + 1 is returned, on no change then a 0 is provided, + on a masterpage-error a -1 is provided. + */ + int UpdatePageObject ( + sal_Int32 nCostThreshold, + SdDrawDocument* pDocument); + + enum URLClassification { + URLCLASS_USER, + URLCLASS_LAYOUT, + URLCLASS_PRESENTATION, + URLCLASS_OTHER, + URLCLASS_UNKNOWN, + URLCLASS_UNDETERMINED + }; + + URLClassification GetURLClassification (void); + + /** The Token under which the MasterPageContainer gives access to the + object. + */ + MasterPageContainer::Token maToken; + + /** A rough specification of the origin of the master page. + */ + MasterPageContainer::Origin meOrigin; + + /** The URL is not empty for master pages loaded from a template + document. + */ + OUString msURL; + + /** Taken from the title of the template file. + */ + OUString msPageName; + + /** Taken from the master page object. + */ + OUString msStyleName; + + const bool mbIsPrecious; + + /** The actual master page. + */ + SdPage* mpMasterPage; + + /** A slide that uses the master page. + */ + SdPage* mpSlide; + + /** A small (the default size) preview of the master page. May be + empty. When this smaller preview is not empty then the larger one + is not empty, too. + */ + Image maSmallPreview; + + /** A large preview of the master page. May be empty. When this larger + preview is not empty then the smaller one is not empty, too. + */ + Image maLargePreview; + + /** The prewview provider. May be empty. May be replaced during the + lifetime of a MasterPageDescriptor object. + */ + ::boost::shared_ptr<PreviewProvider> mpPreviewProvider; + + /** The master page provider. May be empty. May be replaced during + the lifetime of a MasterPageDescriptor object. + */ + ::boost::shared_ptr<PageObjectProvider> mpPageObjectProvider; + + /** This index represents the order in which templates are provided via + the TemplateScanner. It defines the order in which the entries in + the AllMasterPagesSelector are displayed. The default value is -1. + */ + sal_Int32 mnTemplateIndex; + + URLClassification meURLClassification; + + sal_Int32 mnUseCount; + + class URLComparator { public: + OUString msURL; + URLComparator (const OUString& sURL); + bool operator() (const SharedMasterPageDescriptor& rDescriptor); + }; + class StyleNameComparator { public: + OUString msStyleName; + StyleNameComparator (const OUString& sStyleName); + bool operator() (const SharedMasterPageDescriptor& rDescriptor); + }; + class PageObjectComparator { public: + const SdPage* mpMasterPage; + PageObjectComparator (const SdPage* pPageObject); + bool operator() (const SharedMasterPageDescriptor& rDescriptor); + }; + class AllComparator { public: + AllComparator(const SharedMasterPageDescriptor& rDescriptor); + bool operator() (const SharedMasterPageDescriptor& rDescriptor); + private: + SharedMasterPageDescriptor mpDescriptor; + }; + + +}; + + +} } // end of namespace sd::sidebar + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/sidebar/MasterPagesSelector.cxx b/sd/source/ui/sidebar/MasterPagesSelector.cxx new file mode 100644 index 000000000000..38b9b5cf534c --- /dev/null +++ b/sd/source/ui/sidebar/MasterPagesSelector.cxx @@ -0,0 +1,845 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "MasterPagesSelector.hxx" + +#include "MasterPageContainer.hxx" +#include "DocumentHelper.hxx" +#include "SidebarShellManager.hxx" +#include "pres.hxx" +#include "drawdoc.hxx" +#include "DrawDocShell.hxx" +#include "sdpage.hxx" +#include "glob.hxx" +#include "glob.hrc" +#include "app.hrc" +#include "res_bmp.hrc" +#include "strings.hrc" +#include "DrawViewShell.hxx" +#include "DrawController.hxx" +#include "SlideSorterViewShell.hxx" +#include "PreviewValueSet.hxx" +#include "ViewShellBase.hxx" +#include <sfx2/objface.hxx> +#include "sdresid.hxx" +#include "drawview.hxx" +#include <vcl/image.hxx> +#include <vcl/floatwin.hxx> +#include <svl/languageoptions.hxx> +#include <sfx2/app.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/mnumgr.hxx> +#include <svl/itemset.hxx> +#include <svl/eitem.hxx> +#include <svx/dlgutil.hxx> +#include <svx/svdpagv.hxx> +#include <svx/svxids.hrc> +#include "FrameView.hxx" +#include "stlpool.hxx" +#include "unmovss.hxx" +#include <sfx2/request.hxx> +#include <svl/itempool.hxx> +#include <sfx2/sidebar/Theme.hxx> + + +using namespace ::com::sun::star::text; + + + +namespace sd { namespace sidebar { + + +MasterPagesSelector::MasterPagesSelector ( + ::Window* pParent, + SdDrawDocument& rDocument, + ViewShellBase& rBase, + const ::boost::shared_ptr<MasterPageContainer>& rpContainer, + const cssu::Reference<css::ui::XSidebar>& rxSidebar) + : PreviewValueSet(pParent), + maMutex(), + mpContainer(rpContainer), + mrDocument(rDocument), + mrBase(rBase), + mnDefaultClickAction(SID_TP_APPLY_TO_ALL_SLIDES), + maPreviewUpdateQueue(), + maCurrentItemList(), + maTokenToValueSetIndex(), + maLockedMasterPages(), + mxSidebar(rxSidebar) +{ + PreviewValueSet::SetSelectHdl ( + LINK(this, MasterPagesSelector, ClickHandler)); + PreviewValueSet::SetRightMouseClickHandler ( + LINK(this, MasterPagesSelector, RightClickHandler)); + PreviewValueSet::SetStyle(PreviewValueSet::GetStyle() | WB_NO_DIRECTSELECT); + PreviewValueSet::SetPreviewSize(mpContainer->GetPreviewSizePixel()); + PreviewValueSet::Show(); + + SetBackground(sfx2::sidebar::Theme::GetWallpaper(sfx2::sidebar::Theme::Paint_PanelBackground)); + SetColor(sfx2::sidebar::Theme::GetColor(sfx2::sidebar::Theme::Paint_PanelBackground)); + + Link aChangeListener (LINK(this,MasterPagesSelector,ContainerChangeListener)); + mpContainer->AddChangeListener(aChangeListener); +} + + + + +MasterPagesSelector::~MasterPagesSelector (void) +{ + Clear(); + UpdateLocks(ItemList()); + + Link aChangeListener (LINK(this,MasterPagesSelector,ContainerChangeListener)); + mpContainer->RemoveChangeListener(aChangeListener); +} + + + + +void MasterPagesSelector::LateInit (void) +{ +} + + + + +sal_Int32 MasterPagesSelector::GetPreferredWidth (sal_Int32 nHeight) +{ + const ::osl::MutexGuard aGuard (maMutex); + + return PreviewValueSet::GetPreferredWidth (nHeight); +} + + + + +sal_Int32 MasterPagesSelector::GetPreferredHeight (sal_Int32 nWidth) +{ + const ::osl::MutexGuard aGuard (maMutex); + + return PreviewValueSet::GetPreferredHeight (nWidth); +} + + + + +Size MasterPagesSelector::GetPreferredSize (void) +{ + int nPreferredWidth = GetPreferredWidth( + PreviewValueSet::GetOutputSizePixel().Height()); + int nPreferredHeight = GetPreferredHeight(nPreferredWidth); + return Size (nPreferredWidth, nPreferredHeight); + +} + + + + +void MasterPagesSelector::UpdateLocks (const ItemList& rItemList) +{ + ItemList aNewLockList; + + // In here we first lock the master pages in the given list and then + // release the locks acquired in a previous call to this method. When + // this were done the other way round the lock count of some master + // pages might drop temporarily to 0 and would lead to unnecessary + // deletion and re-creation of MasterPageDescriptor objects. + + // Lock the master pages in the given list. + ItemList::const_iterator iItem; + for (iItem=rItemList.begin(); iItem!=rItemList.end(); ++iItem) + { + mpContainer->AcquireToken(*iItem); + aNewLockList.push_back(*iItem); + } + + // Release the previously locked master pages. + ItemList::const_iterator iPage; + ItemList::const_iterator iEnd (maLockedMasterPages.end()); + for (iPage=maLockedMasterPages.begin(); iPage!=iEnd; ++iPage) + mpContainer->ReleaseToken(*iPage); + + maLockedMasterPages.swap(aNewLockList); +} + + + + +void MasterPagesSelector::Fill (void) +{ + ::std::auto_ptr<ItemList> pItemList (new ItemList()); + + Fill(*pItemList); + + UpdateLocks(*pItemList); + UpdateItemList(pItemList); +} + + + + +ResId MasterPagesSelector::GetContextMenuResId (void) const +{ + return SdResId(RID_TASKPANE_MASTERPAGESSELECTOR_POPUP); +} + + + + +IMPL_LINK_NOARG(MasterPagesSelector, ClickHandler) +{ + // We use the framework to assign the clicked-on master page because we + // so use the same mechanism as the context menu does (where we do not + // have the option to call the assignment method directly.) + ExecuteCommand(mnDefaultClickAction); + + return 0; +} + + + + +IMPL_LINK(MasterPagesSelector, RightClickHandler, MouseEvent*, pEvent) +{ + // Here we only prepare the display of the context menu: the item under + // the mouse is selected. The actual display of the context menu is + // done in ContextMenuCallback which is called indirectly through + // PreviewValueSet::Command(). + PreviewValueSet::GrabFocus (); + PreviewValueSet::ReleaseMouse(); + SfxViewFrame* pViewFrame = mrBase.GetViewFrame(); + if (pViewFrame != NULL) + { + SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher(); + if (pDispatcher != NULL && pEvent != NULL) + { + sal_uInt16 nIndex = PreviewValueSet::GetItemId (pEvent->GetPosPixel()); + if (nIndex > 0) + PreviewValueSet::SelectItem (nIndex); + } + } + return 0; +} + + + + +void MasterPagesSelector::Command (const CommandEvent& rEvent) +{ + switch (rEvent.GetCommand()) + { + case COMMAND_CONTEXTMENU: + { + // Use the currently selected item and show the popup menu in its + // center. + const sal_uInt16 nIndex = PreviewValueSet::GetSelectItemId(); + if (nIndex > 0) + { + // The position of the upper left corner of the context menu is + // taken either from the mouse position (when the command was sent + // as reaction to a right click) or in the center of the selected + // item (when the command was sent as reaction to Shift+F10.) + Point aPosition (rEvent.GetMousePosPixel()); + if ( ! rEvent.IsMouseEvent()) + { + Rectangle aBBox (PreviewValueSet::GetItemRect(nIndex)); + aPosition = aBBox.Center(); + } + + // Setup the menu. + ::boost::scoped_ptr<PopupMenu> pMenu (new PopupMenu(GetContextMenuResId())); + FloatingWindow* pMenuWindow = dynamic_cast<FloatingWindow*>(pMenu->GetWindow()); + if (pMenuWindow != NULL) + pMenuWindow->SetPopupModeFlags( + pMenuWindow->GetPopupModeFlags() | FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE); + pMenu->SetSelectHdl(LINK(this, MasterPagesSelector, OnMenuItemSelected)); + + ProcessPopupMenu(*pMenu); + + // Show the menu. + pMenu->Execute(this, Rectangle(aPosition,Size(1,1)), POPUPMENU_EXECUTE_DOWN); + } + break; + } + } +} + + + + +void MasterPagesSelector::ProcessPopupMenu (Menu& rMenu) +{ + // Disable some entries. + if (mpContainer->GetPreviewSize() == MasterPageContainer::SMALL) + rMenu.EnableItem(SID_TP_SHOW_SMALL_PREVIEW, sal_False); + else + rMenu.EnableItem(SID_TP_SHOW_LARGE_PREVIEW, sal_False); +} + + + + +IMPL_LINK(MasterPagesSelector, OnMenuItemSelected, Menu*, pMenu) +{ + if (pMenu == NULL) + { + OSL_ENSURE(pMenu!=NULL, "MasterPagesSelector::OnMenuItemSelected: illegal menu!"); + return 0; + } + + pMenu->Deactivate(); + ExecuteCommand(pMenu->GetCurItemId()); + return 0; +} + + + + +void MasterPagesSelector::ExecuteCommand (const sal_Int32 nCommandId) +{ + switch (nCommandId) + { + case SID_TP_APPLY_TO_ALL_SLIDES: + mrBase.SetBusyState (true); + AssignMasterPageToAllSlides (GetSelectedMasterPage()); + mrBase.SetBusyState (false); + break; + + case SID_TP_APPLY_TO_SELECTED_SLIDES: + mrBase.SetBusyState (true); + AssignMasterPageToSelectedSlides (GetSelectedMasterPage()); + mrBase.SetBusyState (false); + break; + + case SID_TP_USE_FOR_NEW_PRESENTATIONS: + DBG_ASSERT (false, + "Using slides as default for new presentations" + " is not yet implemented"); + break; + + case SID_TP_SHOW_SMALL_PREVIEW: + case SID_TP_SHOW_LARGE_PREVIEW: + { + mrBase.SetBusyState (true); + mpContainer->SetPreviewSize( + nCommandId==SID_TP_SHOW_SMALL_PREVIEW + ? MasterPageContainer::SMALL + : MasterPageContainer::LARGE); + mrBase.SetBusyState (false); + if (mxSidebar.is()) + mxSidebar->requestLayout(); + break; + } + + case SID_TP_EDIT_MASTER: + { + using namespace ::com::sun::star; + uno::Reference<drawing::XDrawPage> xSelectedMaster; + SdPage* pMasterPage = GetSelectedMasterPage(); + assert(pMasterPage); //rhbz#902884 + if (pMasterPage) + xSelectedMaster = uno::Reference<drawing::XDrawPage>(pMasterPage->getUnoPage(), uno::UNO_QUERY); + SfxViewFrame* pViewFrame = mrBase.GetViewFrame(); + if (pViewFrame != NULL && xSelectedMaster.is()) + { + SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher(); + if (pDispatcher != NULL) + { + sal_uInt16 nIndex = PreviewValueSet::GetSelectItemId(); + pDispatcher->Execute(SID_MASTERPAGE, SFX_CALLMODE_SYNCHRON); + PreviewValueSet::SelectItem (nIndex); + mrBase.GetDrawController().setCurrentPage(xSelectedMaster); + } + } + break; + } + + case SID_CUT: + case SID_COPY: + case SID_PASTE: + // Cut, copy, and paste are not supported and thus are ignored. + break; + } +} + + + + +IMPL_LINK(MasterPagesSelector, ContainerChangeListener, MasterPageContainerChangeEvent*, pEvent) +{ + if (pEvent) + NotifyContainerChangeEvent(*pEvent); + return 0; +} + + + + +SdPage* MasterPagesSelector::GetSelectedMasterPage (void) +{ + const ::osl::MutexGuard aGuard (maMutex); + + SdPage* pMasterPage = NULL; + sal_uInt16 nIndex = PreviewValueSet::GetSelectItemId(); + UserData* pData = GetUserData(nIndex); + if (pData != NULL) + { + pMasterPage = mpContainer->GetPageObjectForToken(pData->second); + } + return pMasterPage; +} + + + + +/** Assemble a list of all slides of the document and pass it to + AssignMasterPageToPageList(). +*/ +void MasterPagesSelector::AssignMasterPageToAllSlides (SdPage* pMasterPage) +{ + if (pMasterPage == NULL) + return; + + sal_uInt16 nPageCount = mrDocument.GetSdPageCount(PK_STANDARD); + if (nPageCount == 0) + return; + + // Get a list of all pages. As a little optimization we only + // include pages that do not already have the given master page + // assigned. + OUString sFullLayoutName(pMasterPage->GetLayoutName()); + ::sd::slidesorter::SharedPageSelection pPageList ( + new ::sd::slidesorter::SlideSorterViewShell::PageSelection()); + for (sal_uInt16 nPageIndex=0; nPageIndex<nPageCount; nPageIndex++) + { + SdPage* pPage = mrDocument.GetSdPage (nPageIndex, PK_STANDARD); + if (pPage != NULL && pPage->GetLayoutName() != sFullLayoutName) + { + pPageList->push_back (pPage); + } + } + + AssignMasterPageToPageList(pMasterPage, pPageList); +} + + + + +/** Assemble a list of the currently selected slides (selected in a visible + slide sorter) and pass it to AssignMasterPageToPageList(). +*/ +void MasterPagesSelector::AssignMasterPageToSelectedSlides ( + SdPage* pMasterPage) +{ + using namespace ::sd::slidesorter; + using namespace ::sd::slidesorter::controller; + + if (pMasterPage == NULL) + return; + + // Find a visible slide sorter. + SlideSorterViewShell* pSlideSorter = SlideSorterViewShell::GetSlideSorter(mrBase); + if (pSlideSorter == NULL) + return; + + // Get a list of selected pages. + SharedPageSelection pPageSelection = pSlideSorter->GetPageSelection(); + if (pPageSelection->empty()) + return; + + AssignMasterPageToPageList(pMasterPage, pPageSelection); + + // Restore the previous selection. + pSlideSorter->SetPageSelection(pPageSelection); +} + + + + +void MasterPagesSelector::AssignMasterPageToPageList ( + SdPage* pMasterPage, + const ::sd::slidesorter::SharedPageSelection& rPageList) +{ + DocumentHelper::AssignMasterPageToPageList(mrDocument, pMasterPage, rPageList); +} + + + + +void MasterPagesSelector::NotifyContainerChangeEvent (const MasterPageContainerChangeEvent& rEvent) +{ + const ::osl::MutexGuard aGuard (maMutex); + + switch (rEvent.meEventType) + { + case MasterPageContainerChangeEvent::SIZE_CHANGED: + PreviewValueSet::SetPreviewSize(mpContainer->GetPreviewSizePixel()); + UpdateAllPreviews(); + break; + + case MasterPageContainerChangeEvent::PREVIEW_CHANGED: + { + int nIndex (GetIndexForToken(rEvent.maChildToken)); + if (nIndex >= 0) + { + PreviewValueSet::SetItemImage ( + (sal_uInt16)nIndex, + mpContainer->GetPreviewForToken(rEvent.maChildToken)); + PreviewValueSet::Invalidate(PreviewValueSet::GetItemRect((sal_uInt16)nIndex)); + } + } + break; + + case MasterPageContainerChangeEvent::DATA_CHANGED: + { + InvalidateItem(rEvent.maChildToken); + Fill(); + } + break; + + case MasterPageContainerChangeEvent::CHILD_REMOVED: + { + int nIndex (GetIndexForToken(rEvent.maChildToken)); + SetItem(nIndex, MasterPageContainer::NIL_TOKEN); + } + + default: + break; + } +} + + + + +MasterPagesSelector::UserData* MasterPagesSelector::CreateUserData ( + int nIndex, + MasterPageContainer::Token aToken) const +{ + return new UserData(nIndex,aToken); +} + + + + +MasterPagesSelector::UserData* MasterPagesSelector::GetUserData (int nIndex) const +{ + const ::osl::MutexGuard aGuard (maMutex); + + if (nIndex>0 && static_cast<unsigned int>(nIndex)<=PreviewValueSet::GetItemCount()) + return reinterpret_cast<UserData*>(PreviewValueSet::GetItemData((sal_uInt16)nIndex)); + else + return NULL; +} + + + + +void MasterPagesSelector::SetUserData (int nIndex, UserData* pData) +{ + const ::osl::MutexGuard aGuard (maMutex); + + if (nIndex>0 && static_cast<unsigned int>(nIndex)<=PreviewValueSet::GetItemCount()) + { + UserData* pOldData = GetUserData(nIndex); + if (pOldData!=NULL && pOldData!=pData) + delete pOldData; + PreviewValueSet::SetItemData((sal_uInt16)nIndex, pData); + } +} + + + + +bool MasterPagesSelector::IsResizable (void) +{ + return false; +} + + + + +::Window* MasterPagesSelector::GetWindow (void) +{ + return this; +} + + + + +sal_Int32 MasterPagesSelector::GetMinimumWidth (void) +{ + return mpContainer->GetPreviewSizePixel().Width() + 2*3; +} + + + + +void MasterPagesSelector::UpdateSelection (void) +{ +} + + + + +void MasterPagesSelector::SetItem ( + sal_uInt16 nIndex, + MasterPageContainer::Token aToken) +{ + const ::osl::MutexGuard aGuard (maMutex); + + RemoveTokenToIndexEntry(nIndex,aToken); + + if (nIndex > 0) + { + if (aToken != MasterPageContainer::NIL_TOKEN) + { + Image aPreview (mpContainer->GetPreviewForToken(aToken)); + MasterPageContainer::PreviewState eState (mpContainer->GetPreviewState(aToken)); + + if (aPreview.GetSizePixel().Width()>0) + { + if (PreviewValueSet::GetItemPos(nIndex) != VALUESET_ITEM_NOTFOUND) + { + PreviewValueSet::SetItemImage(nIndex,aPreview); + PreviewValueSet::SetItemText(nIndex, mpContainer->GetPageNameForToken(aToken)); + } + else + { + PreviewValueSet::InsertItem ( + nIndex, + aPreview, + mpContainer->GetPageNameForToken(aToken), + nIndex); + } + SetUserData(nIndex, CreateUserData(nIndex,aToken)); + + AddTokenToIndexEntry(nIndex,aToken); + } + + if (eState == MasterPageContainer::PS_CREATABLE) + mpContainer->RequestPreview(aToken); + } + else + { + PreviewValueSet::RemoveItem(nIndex); + } + } + +} + + + + +void MasterPagesSelector::AddTokenToIndexEntry ( + sal_uInt16 nIndex, + MasterPageContainer::Token aToken) +{ + const ::osl::MutexGuard aGuard (maMutex); + + maTokenToValueSetIndex[aToken] = nIndex; +} + + + + +void MasterPagesSelector::RemoveTokenToIndexEntry ( + sal_uInt16 nIndex, + MasterPageContainer::Token aNewToken) +{ + const ::osl::MutexGuard aGuard (maMutex); + + UserData* pData = GetUserData(nIndex); + if (pData != NULL) + { + // Get the token that the index pointed to previously. + MasterPageContainer::Token aOldToken (pData->second); + + if (aNewToken != aOldToken + && nIndex == GetIndexForToken(aOldToken)) + { + maTokenToValueSetIndex[aOldToken] = 0; + } + } +} + + + + +void MasterPagesSelector::InvalidatePreview (const SdPage* pPage) +{ + const ::osl::MutexGuard aGuard (maMutex); + + for (sal_uInt16 nIndex=1; nIndex<=PreviewValueSet::GetItemCount(); nIndex++) + { + UserData* pData = GetUserData(nIndex); + if (pData != NULL) + { + MasterPageContainer::Token aToken (pData->second); + if (pPage == mpContainer->GetPageObjectForToken(aToken,false)) + { + mpContainer->InvalidatePreview(aToken); + mpContainer->RequestPreview(aToken); + break; + } + } + } +} + +void MasterPagesSelector::UpdateAllPreviews (void) +{ + const ::osl::MutexGuard aGuard (maMutex); + + for (sal_uInt16 nIndex=1; nIndex<=PreviewValueSet::GetItemCount(); nIndex++) + { + UserData* pData = GetUserData(nIndex); + if (pData != NULL) + { + MasterPageContainer::Token aToken (pData->second); + PreviewValueSet::SetItemImage( + nIndex, + mpContainer->GetPreviewForToken(aToken)); + if (mpContainer->GetPreviewState(aToken) == MasterPageContainer::PS_CREATABLE) + mpContainer->RequestPreview(aToken); + } + } + PreviewValueSet::Rearrange(true); +} + + + + +void MasterPagesSelector::ClearPageSet (void) +{ + const ::osl::MutexGuard aGuard (maMutex); + + for (sal_uInt16 nIndex=1; nIndex<=PreviewValueSet::GetItemCount(); nIndex++) + { + UserData* pData = GetUserData(nIndex); + if (pData != NULL) + delete pData; + } + PreviewValueSet::Clear(); +} + + + + +void MasterPagesSelector::SetHelpId( const OString& aId ) +{ + const ::osl::MutexGuard aGuard (maMutex); + + PreviewValueSet::SetHelpId( aId ); +} + + + + +sal_Int32 MasterPagesSelector::GetIndexForToken (MasterPageContainer::Token aToken) const +{ + const ::osl::MutexGuard aGuard (maMutex); + + TokenToValueSetIndex::const_iterator iIndex (maTokenToValueSetIndex.find(aToken)); + if (iIndex != maTokenToValueSetIndex.end()) + return iIndex->second; + else + return -1; +} + + + + +void MasterPagesSelector::Clear (void) +{ + const ::osl::MutexGuard aGuard (maMutex); + + ClearPageSet(); +} + + + + +void MasterPagesSelector::InvalidateItem (MasterPageContainer::Token aToken) +{ + const ::osl::MutexGuard aGuard (maMutex); + + ItemList::iterator iItem; + for (iItem=maCurrentItemList.begin(); iItem!=maCurrentItemList.end(); ++iItem) + { + if (*iItem == aToken) + { + *iItem = MasterPageContainer::NIL_TOKEN; + break; + } + } +} + + + +SAL_WNODEPRECATED_DECLARATIONS_PUSH +void MasterPagesSelector::UpdateItemList (::std::auto_ptr<ItemList> pNewItemList) +{ + const ::osl::MutexGuard aGuard (maMutex); + + ItemList::const_iterator iNewItem (pNewItemList->begin()); + ItemList::const_iterator iCurrentItem (maCurrentItemList.begin()); + ItemList::const_iterator iNewEnd (pNewItemList->end()); + ItemList::const_iterator iCurrentEnd (maCurrentItemList.end()); + sal_uInt16 nIndex (1); + + // Update existing items. + for ( ; iNewItem!=iNewEnd && iCurrentItem!=iCurrentEnd; ++iNewItem, ++iCurrentItem,++nIndex) + { + if (*iNewItem != *iCurrentItem) + { + SetItem(nIndex,*iNewItem); + } + } + + // Append new items. + for ( ; iNewItem!=iNewEnd; ++iNewItem,++nIndex) + { + SetItem(nIndex,*iNewItem); + } + + // Remove trailing items. + for ( ; iCurrentItem!=iCurrentEnd; ++iCurrentItem,++nIndex) + { + SetItem(nIndex,MasterPageContainer::NIL_TOKEN); + } + + maCurrentItemList.swap(*pNewItemList); + + PreviewValueSet::Rearrange(); + if (mxSidebar.is()) + mxSidebar->requestLayout(); +} +SAL_WNODEPRECATED_DECLARATIONS_POP + + + +css::ui::LayoutSize MasterPagesSelector::GetHeightForWidth (const sal_Int32 nWidth) +{ + const sal_Int32 nHeight (GetPreferredHeight(nWidth)); + return css::ui::LayoutSize(nHeight,nHeight,nHeight); +} + +} } // end of namespace sd::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/sidebar/MasterPagesSelector.hxx b/sd/source/ui/sidebar/MasterPagesSelector.hxx new file mode 100644 index 000000000000..83e8091a66e7 --- /dev/null +++ b/sd/source/ui/sidebar/MasterPagesSelector.hxx @@ -0,0 +1,238 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef SD_SIDEBAR_PANELS_MASTER_PAGES_SELECTOR_HXX +#define SD_SIDEBAR_PANELS_MASTER_PAGES_SELECTOR_HXX + +#include "MasterPageContainer.hxx" +#include "SlideSorterViewShell.hxx" +#include "PreviewValueSet.hxx" +#include "ISidebarReceiver.hxx" +#include <sfx2/sidebar/ILayoutableWindow.hxx> + +#include "pres.hxx" +#include <sfx2/shell.hxx> +#include <vcl/image.hxx> +#include "glob.hxx" +#include <osl/mutex.hxx> +#include <com/sun/star/ui/XSidebar.hpp> + +#include <queue> + +namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; + +class MouseEvent; +class SdDrawDocument; +class SdPage; + +namespace sd { +class ViewShellBase; +} + +namespace sd { namespace sidebar { + +class PreviewValueSet; +class SidebarShellManager; + + +/** Base class of a menu that lets the user select from a list of + templates or designs that are loaded from files. +*/ +class MasterPagesSelector + : public PreviewValueSet, + public sfx2::sidebar::ILayoutableWindow +{ +public: + MasterPagesSelector ( + ::Window* pParent, + SdDrawDocument& rDocument, + ViewShellBase& rBase, + const ::boost::shared_ptr<MasterPageContainer>& rpContainer, + const cssu::Reference<css::ui::XSidebar>& rxSidebar); + virtual ~MasterPagesSelector (void); + + virtual void LateInit (void); + + /** Return the height that this control needs to show all of its lines. + */ + long GetRequiredHeight (int nWidth) const; + + /** The given master page, either the master page of a slide or a notes + page, is cloned and inserted into mrDocument. The necessary styles + are copied as well. + */ + static SdPage* AddMasterPage ( + SdDrawDocument* pTargetDocument, + SdPage* pMasterPage, + sal_uInt16 nInsertionIndex); + + virtual Size GetPreferredSize (void); + virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeight); + virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth); + virtual bool IsResizable (void); + virtual ::Window* GetWindow (void); + virtual sal_Int32 GetMinimumWidth (void); + + /** Update the selection of previews according to whatever + influences them appart from mouse and keyboard. If, for + example, the current page of the main pane changes, then call + this method at the CurrentMasterPagesSelector to select the + previews of the master pages that are assigned to the new + current page. + + The default implementation of this method ignores the call. This is + used by e.g. the RecentMasterPagesSelector because it does not show + the currently used master pages by default and thus is not + influenced by its changes. + */ + virtual void UpdateSelection (void); + + void FillPageSet (void); + + /** Make the selector empty. This method clear the value set from any + entries. Overload this method to add functionality, especially to + destroy objects set as data items at the value set. + */ + void ClearPageSet (void); + + void SetHelpId( const OString& aId ); + + /** Mark the preview that belongs to the given index as not up-to-date + anymore with respect to page content or preview size. + The implementation of this method will either sunchronously or + asynchronously call UpdatePreview(). + @param nIndex + Index into the value set control that is used for displaying the + previews. + */ + void InvalidatePreview (const SdPage* pPage); + + void UpdateAllPreviews (void); + + // ILayoutableWindow + virtual css::ui::LayoutSize GetHeightForWidth (const sal_Int32 nWidth); + +protected: + mutable ::osl::Mutex maMutex; + ::boost::shared_ptr<MasterPageContainer> mpContainer; + + SdDrawDocument& mrDocument; + bool mbSmallPreviewSize; + ViewShellBase& mrBase; + /** Slot that is executed as default action when the left mouse button is + clicked over a master page. + */ + sal_uInt16 mnDefaultClickAction; + /** Pages with pointers in this queue have their previews updated + eventually. Filled by InvalidatePreview() and operated upon by + UpdatePreviews(). + */ + ::std::queue<sal_uInt16> maPreviewUpdateQueue; + + virtual SdPage* GetSelectedMasterPage (void); + + /** Assign the given master page to all slides of the document. + @param pMasterPage + The master page to assign to all slides. + */ + void AssignMasterPageToAllSlides (SdPage* pMasterPage); + + /** Assign the given master page to all slides that are selected in a + slide sorter that is displayed in the lef or center pane. When both + panes display a slide sorter then the one in the center pane is + used. + */ + void AssignMasterPageToSelectedSlides (SdPage* pMasterPage); + + virtual void AssignMasterPageToPageList ( + SdPage* pMasterPage, + const ::sd::slidesorter::SharedPageSelection& rPageList); + + virtual void NotifyContainerChangeEvent (const MasterPageContainerChangeEvent& rEvent); + + typedef ::std::pair<int, MasterPageContainer::Token> UserData; + UserData* CreateUserData (int nIndex, MasterPageContainer::Token aToken) const; + UserData* GetUserData (int nIndex) const; + void SetUserData (int nIndex, UserData* pData); + + virtual sal_Int32 GetIndexForToken (MasterPageContainer::Token aToken) const; + typedef ::std::vector<MasterPageContainer::Token> ItemList; + void UpdateItemList (::std::auto_ptr<ItemList> pList); + void Clear (void); + /** Invalidate the specified item so that on the next Fill() this item + is updated. + */ + void InvalidateItem (MasterPageContainer::Token aToken); + + // For every item in the ValueSet we store its associated token. This + // allows a faster access and easier change tracking. + ItemList maCurrentItemList; + typedef ::std::map<MasterPageContainer::Token,sal_Int32> TokenToValueSetIndex; + TokenToValueSetIndex maTokenToValueSetIndex; + + ItemList maLockedMasterPages; + /** Lock master pages in the given list and release locks that where + previously aquired. + */ + void UpdateLocks (const ItemList& rItemList); + + void Fill (void); + virtual void Fill (ItemList& rItemList) = 0; + + /** Give derived classes the oportunity to provide their own context + menu. If they do then they probably have to provide their own + Execute() and GetState() methods as well. + */ + virtual ResId GetContextMenuResId (void) const; + + virtual void Command (const CommandEvent& rEvent); + + virtual void ProcessPopupMenu (Menu& rMenu); + virtual void ExecuteCommand (const sal_Int32 nCommandId); + +private: + cssu::Reference<css::ui::XSidebar> mxSidebar; + + /** The offset between ValueSet index and MasterPageContainer::Token + last seen. This value is used heuristically to speed up the lookup + of an index for a token. + */ + DECL_LINK(ClickHandler, void *); + DECL_LINK(RightClickHandler, MouseEvent*); + DECL_LINK(ContextMenuCallback, CommandEvent*); + DECL_LINK(ContainerChangeListener, MasterPageContainerChangeEvent*); + DECL_LINK(OnMenuItemSelected, Menu*); + + void SetItem ( + sal_uInt16 nIndex, + MasterPageContainer::Token aToken); + void AddTokenToIndexEntry ( + sal_uInt16 nIndex, + MasterPageContainer::Token aToken); + void RemoveTokenToIndexEntry ( + sal_uInt16 nIndex, + MasterPageContainer::Token aToken); +}; + +} } // end of namespace sd::sidebar + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/sidebar/NavigatorWrapper.cxx b/sd/source/ui/sidebar/NavigatorWrapper.cxx new file mode 100644 index 000000000000..ad870fc43fe1 --- /dev/null +++ b/sd/source/ui/sidebar/NavigatorWrapper.cxx @@ -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 . + */ + +#include "NavigatorWrapper.hxx" +#include "navigatr.hrc" +#include "ViewShellBase.hxx" + +#include <sfx2/sidebar/Theme.hxx> + +#include <boost/bind.hpp> + + +namespace sd { namespace sidebar { + +NavigatorWrapper::NavigatorWrapper ( + ::Window* pParent, + sd::ViewShellBase& rViewShellBase, + SfxBindings* pBindings) + : Control(pParent, 0), + mrViewShellBase(rViewShellBase), + maNavigator( + this, + NULL, + SdResId(FLT_NAVIGATOR), + pBindings, + ::boost::bind(&NavigatorWrapper::UpdateNavigator, this)) +{ + maNavigator.SetPosSizePixel( + Point(0,0), + GetSizePixel()); + maNavigator.SetBackground(sfx2::sidebar::Theme::GetWallpaper(sfx2::sidebar::Theme::Paint_PanelBackground)); + maNavigator.Show(); +} + + + + +NavigatorWrapper::~NavigatorWrapper (void) +{ +} + + + + +void NavigatorWrapper::Resize (void) +{ + maNavigator.SetSizePixel(GetSizePixel()); +} + + + + +css::ui::LayoutSize NavigatorWrapper::GetHeightForWidth (const sal_Int32 nWidth) +{ + (void)nWidth; + + return css::ui::LayoutSize(-1,-1,-1); +} + + + + +void NavigatorWrapper::UpdateNavigator (void) +{ + maNavigator.InitTreeLB(mrViewShellBase.GetDocument()); +} + + +} } // end of namespace sd::sidebar diff --git a/sd/source/ui/sidebar/NavigatorWrapper.hxx b/sd/source/ui/sidebar/NavigatorWrapper.hxx new file mode 100644 index 000000000000..669628d0c073 --- /dev/null +++ b/sd/source/ui/sidebar/NavigatorWrapper.hxx @@ -0,0 +1,68 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SD_SIDEBAR_NAVIGATOR_WRAPPER_HXX +#define SD_SIDEBAR_NAVIGATOR_WRAPPER_HXX + +#include <sfx2/sidebar/ILayoutableWindow.hxx> +#include <vcl/ctrl.hxx> +#include "navigatr.hxx" + + +class SfxBindings; +namespace sd { class ViewShellBase; } + +namespace css = ::com::sun::star; + +namespace sd { namespace sidebar { + +/** Present the navigator as control that can be displayed inside the + sidebar. + This wrapper has two main responsibilities: + - Watch for document changes and update the navigator when one + happens. + - Forward size changes from sidebar to navigator. +*/ +class NavigatorWrapper + : public Control, + public sfx2::sidebar::ILayoutableWindow +{ +public: + NavigatorWrapper ( + ::Window* pParent, + sd::ViewShellBase& rViewShellBase, + SfxBindings* pBindings); + + virtual ~NavigatorWrapper (void); + + // Control + virtual void Resize (void); + + // From ILayoutableWindow + virtual css::ui::LayoutSize GetHeightForWidth (const sal_Int32 nWidth); + +private: + ViewShellBase& mrViewShellBase; + SdNavigatorWin maNavigator; + + void UpdateNavigator (void); +}; + + +} } // end of namespace sd::sidebar + +#endif diff --git a/sd/source/ui/sidebar/PanelBase.cxx b/sd/source/ui/sidebar/PanelBase.cxx new file mode 100644 index 000000000000..014ee8a4cde3 --- /dev/null +++ b/sd/source/ui/sidebar/PanelBase.cxx @@ -0,0 +1,133 @@ +/* + * 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 "TableDesignPanel.hxx" + + + +namespace sd { namespace sidebar { + + +PanelBase::PanelBase ( + ::Window* pParentWindow, + ViewShellBase& rViewShellBase) + : Control(pParentWindow), + mpWrappedControl(NULL), + mxSidebar(), + mrViewShellBase(rViewShellBase) +{ + OSL_TRACE("created PanelBase at %x for parent %x", this, pParentWindow); + +#ifdef DEBUG + SetText(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sd:PanelBase"))); +#endif +} + + + + +PanelBase::~PanelBase (void) +{ + OSL_TRACE("deleting wrapped control at %x", mpWrappedControl.get()); + mpWrappedControl.reset(); + OSL_TRACE("deleting PanelBase at %x from parent %x", this, GetParent()); +} + + + + + +void PanelBase::Dispose (void) +{ + OSL_TRACE("PanelBase::DisposeL: deleting wrapped control at %x", mpWrappedControl.get()); + mpWrappedControl.reset(); +} + + + + +css::ui::LayoutSize PanelBase::GetHeightForWidth (const sal_Int32 /*nWidth*/) +{ + sal_Int32 nHeight (0); + if (ProvideWrappedControl()) + nHeight = mpWrappedControl->GetSizePixel().Height(); + return css::ui::LayoutSize(nHeight,nHeight,nHeight); +} + + + + +void PanelBase::Resize (void) +{ + if (ProvideWrappedControl()) + { + Size aNewSize (GetSizePixel()); + mpWrappedControl->SetOutputSizePixel(aNewSize); + } +} + + + + +::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible> PanelBase::CreateAccessibleObject ( + const ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible>& ) +{ + if (ProvideWrappedControl()) + return mpWrappedControl->GetAccessible(); + else + return NULL; +} + + + + +void PanelBase::SetSidebar (const cssu::Reference<css::ui::XSidebar>& rxSidebar) +{ + mxSidebar = rxSidebar; + if (mxSidebar.is() && mpWrappedControl!=NULL) + mxSidebar->requestLayout(); +} + + + + +bool PanelBase::ProvideWrappedControl (void) +{ + if ( ! mpWrappedControl) + { + mpWrappedControl.reset(CreateWrappedControl(this, mrViewShellBase)); + OSL_TRACE("created wrapped control at %x for parent PanelBase at %x", mpWrappedControl.get(), this); + if (mpWrappedControl) + mpWrappedControl->Show(); + if (mxSidebar.is()) + mxSidebar->requestLayout(); + } + return mpWrappedControl.get() != NULL; +} + +ISidebarReceiver::~ISidebarReceiver() +{ +} + +IDisposable::~IDisposable() +{ +} + +} } // end of namespace sd::sidebar diff --git a/sd/source/ui/sidebar/PanelBase.hxx b/sd/source/ui/sidebar/PanelBase.hxx new file mode 100644 index 000000000000..242424b6130f --- /dev/null +++ b/sd/source/ui/sidebar/PanelBase.hxx @@ -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 . + */ +#ifndef SD_SIDEBAR_PANELS_PANEL_BASE_HXX +#define SD_SIDEBAR_PANELS_PANEL_BASE_HXX + +#include "IDisposable.hxx" +#include "ISidebarReceiver.hxx" +#include <sfx2/sidebar/ILayoutableWindow.hxx> + +#include <vcl/ctrl.hxx> + +#include <boost/scoped_ptr.hpp> + + +namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; + +namespace sd { + class ViewShellBase; +} + + + + +namespace sd { namespace sidebar { + + +class PanelBase + : public Control, + public sfx2::sidebar::ILayoutableWindow, + public IDisposable, + public ISidebarReceiver +{ +public: + PanelBase ( + ::Window* pParentWindow, + ViewShellBase& rViewShellBase); + virtual ~PanelBase (void); + + virtual void Resize (void); + + // IDisposable + virtual void Dispose (void); + + // ILayoutableWindow + virtual css::ui::LayoutSize GetHeightForWidth (const sal_Int32 nWidth); + + // ISidebarReceiver + virtual void SetSidebar (const cssu::Reference<css::ui::XSidebar>& rxSidebar); + + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > CreateAccessibleObject ( + const ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible>& rxParent); + +protected: + ::boost::scoped_ptr< ::Window> mpWrappedControl; + virtual ::Window* CreateWrappedControl ( + ::Window* pParentWindow, + ViewShellBase& rViewShellBase) = 0; + +private: + cssu::Reference<css::ui::XSidebar> mxSidebar; + ViewShellBase& mrViewShellBase; + + bool ProvideWrappedControl (void); +}; + +} } // end of namespace sd::sidebar + +#endif diff --git a/sd/source/ui/sidebar/PanelFactory.cxx b/sd/source/ui/sidebar/PanelFactory.cxx new file mode 100644 index 000000000000..193468a3ff43 --- /dev/null +++ b/sd/source/ui/sidebar/PanelFactory.cxx @@ -0,0 +1,207 @@ +/* + * 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 "PanelFactory.hxx" +#include "framework/Pane.hxx" +#include "ViewShellBase.hxx" +#include "DrawController.hxx" +#include "LayoutMenu.hxx" +#include "CurrentMasterPagesSelector.hxx" +#include "RecentMasterPagesSelector.hxx" +#include "AllMasterPagesSelector.hxx" +#include "CustomAnimationPanel.hxx" +#include "SlideTransitionPanel.hxx" +#include "NavigatorWrapper.hxx" + +#include <sfx2/viewfrm.hxx> +#include <sfx2/sidebar/SidebarPanelBase.hxx> +#include <comphelper/namedvaluecollection.hxx> +#include <vcl/window.hxx> +#include <toolkit/helper/vclunohelper.hxx> + +using namespace css; +using namespace cssu; +using namespace ::sd::framework; +using ::rtl::OUString; + +#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) + +namespace sd { + extern ::Window * createTableDesignPanel (::Window* pParent, ViewShellBase& rBase); +} + +namespace sd { namespace sidebar { + +namespace { + /** Note that these names have to be identical to (the tail of) + the entries in officecfg/registry/data/org/openoffice/Office/Impress.xcu + for the TaskPanelFactory. + */ + const static char* gsResourceNameCustomAnimations = "/CustomAnimations"; + const static char* gsResourceNameLayouts = "/Layouts"; + const static char* gsResourceNameAllMasterPages = "/AllMasterPages"; + const static char* gsResourceNameRecentMasterPages = "/RecentMasterPages"; + const static char* gsResourceNameUsedMasterPages = "/UsedMasterPages"; + const static char* gsResourceNameSlideTransitions = "/SlideTransitions"; + const static char* gsResourceNameTableDesign = "/TableDesign"; + const static char* gsResourceNameNavigator = "/NavigatorPanel"; +} + +Reference<lang::XEventListener> mxControllerDisposeListener; + + + +// ----- Service functions ---------------------------------------------------- + +Reference<XInterface> SAL_CALL PanelFactory_createInstance ( + const Reference<XComponentContext>& rxContext) +{ + return Reference<XInterface>(static_cast<XWeak*>(new PanelFactory(rxContext))); +} + + + + +::rtl::OUString PanelFactory_getImplementationName (void) throw(RuntimeException) +{ + return ::rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.Draw.framework.PanelFactory")); +} + + + + +Sequence<rtl::OUString> SAL_CALL PanelFactory_getSupportedServiceNames (void) + throw (RuntimeException) +{ + static const ::rtl::OUString sServiceName( + ::rtl::OUString::createFromAscii("com.sun.star.drawing.framework.PanelFactory")); + return Sequence<rtl::OUString>(&sServiceName, 1); +} + + + + +//----- PanelFactory -------------------------------------------------------- + +PanelFactory::PanelFactory( + const css::uno::Reference<css::uno::XComponentContext>& /*rxContext*/) + : PanelFactoryInterfaceBase(m_aMutex) +{ +} + + + + +PanelFactory::~PanelFactory (void) +{ +} + + + + +void SAL_CALL PanelFactory::disposing (void) +{ +} + + + + +// XUIElementFactory + +Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement ( + const ::rtl::OUString& rsUIElementResourceURL, + const ::cssu::Sequence<css::beans::PropertyValue>& rArguments) + throw( + css::container::NoSuchElementException, + css::lang::IllegalArgumentException, + cssu::RuntimeException) +{ + // Process arguments. + const ::comphelper::NamedValueCollection aArguments (rArguments); + Reference<frame::XFrame> xFrame (aArguments.getOrDefault("Frame", Reference<frame::XFrame>())); + Reference<awt::XWindow> xParentWindow (aArguments.getOrDefault("ParentWindow", Reference<awt::XWindow>())); + Reference<ui::XSidebar> xSidebar (aArguments.getOrDefault("Sidebar", Reference<ui::XSidebar>())); + + // Throw exceptions when the arguments are not as expected. + ::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 XFrame"), + NULL); + + // Tunnel through the controller to obtain a ViewShellBase. + ViewShellBase* pBase = NULL; + Reference<lang::XUnoTunnel> xTunnel (xFrame->getController(), UNO_QUERY); + if (xTunnel.is()) + { + ::sd::DrawController* pController = reinterpret_cast<sd::DrawController*>( + xTunnel->getSomething(sd::DrawController::getUnoTunnelId())); + if (pController != NULL) + pBase = pController->GetViewShellBase(); + } + if (pBase == NULL) + throw RuntimeException(A2S("can not get ViewShellBase for frame"), NULL); + + // Get bindings from given arguments. + const sal_uInt64 nBindingsValue (aArguments.getOrDefault("SfxBindings", sal_uInt64(0))); + SfxBindings* pBindings = reinterpret_cast<SfxBindings*>(nBindingsValue); + + // Create a framework view. + ::Window* pControl = NULL; + css::ui::LayoutSize aLayoutSize (-1,-1,-1); + +#define EndsWith(s,t) s.endsWithAsciiL(t,strlen(t)) + if (EndsWith(rsUIElementResourceURL, gsResourceNameCustomAnimations)) + pControl = new CustomAnimationPanel(pParentWindow, *pBase); + else if (EndsWith(rsUIElementResourceURL, gsResourceNameLayouts)) + pControl = new LayoutMenu(pParentWindow, *pBase, xSidebar); + else if (EndsWith(rsUIElementResourceURL, gsResourceNameAllMasterPages)) + pControl = AllMasterPagesSelector::Create(pParentWindow, *pBase, xSidebar); + else if (EndsWith(rsUIElementResourceURL, gsResourceNameRecentMasterPages)) + pControl = RecentMasterPagesSelector::Create(pParentWindow, *pBase, xSidebar); + else if (EndsWith(rsUIElementResourceURL, gsResourceNameUsedMasterPages)) + pControl = CurrentMasterPagesSelector::Create(pParentWindow, *pBase, xSidebar); + else if (EndsWith(rsUIElementResourceURL, gsResourceNameSlideTransitions)) + pControl = new SlideTransitionPanel(pParentWindow, *pBase); + else if (EndsWith(rsUIElementResourceURL, gsResourceNameTableDesign)) + pControl = createTableDesignPanel(pParentWindow, *pBase); + else if (EndsWith(rsUIElementResourceURL, gsResourceNameNavigator)) + pControl = new NavigatorWrapper(pParentWindow, *pBase, pBindings); +#undef EndsWith + + if (pControl == NULL) + throw lang::IllegalArgumentException(); + + // Create a wrapper around the control that implements the + // necessary UNO interfaces. + return sfx2::sidebar::SidebarPanelBase::Create( + rsUIElementResourceURL, + xFrame, + pControl, + aLayoutSize); +} + + + + +} } // end of namespace sd::sidebar diff --git a/sd/source/ui/sidebar/PanelFactory.hxx b/sd/source/ui/sidebar/PanelFactory.hxx new file mode 100644 index 000000000000..3cf4c629bc0a --- /dev/null +++ b/sd/source/ui/sidebar/PanelFactory.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 SD_SIDEBAR_PANEL_FACTORY_HXX +#define SD_SIDEBAR_PANEL_FACTORY_HXX + +#include <cppuhelper/compbase1.hxx> +#include <cppuhelper/basemutex.hxx> +#include <rtl/ref.hxx> +#include "framework/Pane.hxx" + +#include <com/sun/star/ui/XUIElementFactory.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/lang/XInitialization.hpp> + +#include <map> +#include <boost/noncopyable.hpp> +#include <boost/shared_ptr.hpp> + + +namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; + + +namespace sd { + class ViewShellBase; +} + +namespace sd { namespace sidebar { + +namespace +{ + typedef ::cppu::WeakComponentImplHelper1 < + css::ui::XUIElementFactory + > PanelFactoryInterfaceBase; +} + + +class PanelFactory + : private ::boost::noncopyable, + private ::cppu::BaseMutex, + public PanelFactoryInterfaceBase +{ +public: + static ::rtl::OUString SAL_CALL getImplementationName (void); + static cssu::Reference<cssu::XInterface> SAL_CALL createInstance ( + const cssu::Reference<css::lang::XMultiServiceFactory>& rxFactory); + static cssu::Sequence<rtl::OUString> SAL_CALL getSupportedServiceNames (void); + + PanelFactory (const cssu::Reference<cssu::XComponentContext>& rxContext); + virtual ~PanelFactory (void); + + virtual void SAL_CALL disposing (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 sd::sidebar + +#endif diff --git a/sd/source/ui/sidebar/PreviewValueSet.cxx b/sd/source/ui/sidebar/PreviewValueSet.cxx new file mode 100644 index 000000000000..ae3d7fbfbd5f --- /dev/null +++ b/sd/source/ui/sidebar/PreviewValueSet.cxx @@ -0,0 +1,180 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "PreviewValueSet.hxx" +#include <vcl/image.hxx> + + +namespace sd { namespace sidebar { + + +PreviewValueSet::PreviewValueSet (::Window* pParent) + : ValueSet (pParent, WB_TABSTOP), + maPreviewSize(10,10), + mnBorderWidth(3), + mnBorderHeight(3), + mnMaxColumnCount(-1) +{ + SetStyle ( + GetStyle() + & ~(WB_ITEMBORDER)// | WB_MENUSTYLEVALUESET) + // | WB_FLATVALUESET); + ); + SetColCount(2); + SetExtraSpacing (2); +} + + + + +PreviewValueSet::~PreviewValueSet (void) +{ +} + + + + +void PreviewValueSet::SetPreviewSize (const Size& rSize) +{ + maPreviewSize = rSize; +} + + + + +void PreviewValueSet::SetRightMouseClickHandler (const Link& rLink) +{ + maRightMouseClickHandler = rLink; +} + + + + +void PreviewValueSet::MouseButtonDown (const MouseEvent& rEvent) +{ + if (rEvent.IsRight()) + maRightMouseClickHandler.Call(reinterpret_cast<void*>( + &const_cast<MouseEvent&>(rEvent))); + else + ValueSet::MouseButtonDown (rEvent); + +} + + + + +void PreviewValueSet::Resize (void) +{ + ValueSet::Resize (); + + Size aWindowSize (GetOutputSizePixel()); + if (aWindowSize.Width()>0 && aWindowSize.Height()>0) + { + Rearrange(); + } +} + + + + +void PreviewValueSet::Rearrange (bool /*bForceRequestResize*/) +{ + sal_uInt16 nNewColumnCount (CalculateColumnCount ( + GetOutputSizePixel().Width())); + sal_uInt16 nNewRowCount (CalculateRowCount (nNewColumnCount)); + + SetColCount(nNewColumnCount); + SetLineCount(nNewRowCount); +} + + + + +sal_uInt16 PreviewValueSet::CalculateColumnCount (int nWidth) const +{ + int nColumnCount = 0; + if (nWidth > 0) + { + nColumnCount = nWidth / (maPreviewSize.Width() + 2*mnBorderWidth); + if (nColumnCount < 1) + nColumnCount = 1; + else if (mnMaxColumnCount>0 && nColumnCount>mnMaxColumnCount) + nColumnCount = mnMaxColumnCount; + } + return (sal_uInt16)nColumnCount; +} + + + + +sal_uInt16 PreviewValueSet::CalculateRowCount (sal_uInt16 nColumnCount) const +{ + int nRowCount = 0; + int nItemCount = GetItemCount(); + if (nColumnCount > 0) + { + nRowCount = (nItemCount+nColumnCount-1) / nColumnCount; + if (nRowCount < 1) + nRowCount = 1; + } + + return (sal_uInt16)nRowCount; +} + + + + +sal_Int32 PreviewValueSet::GetPreferredWidth (sal_Int32 nHeight) +{ + int nPreferredWidth (maPreviewSize.Width() + 2*mnBorderWidth); + + // Get height of each row. + int nItemHeight (maPreviewSize.Height() + 2*mnBorderHeight); + + // Calculate the row- and column count and from the later the preferred + // width. + int nRowCount = nHeight / nItemHeight; + if (nRowCount > 0) + { + int nColumnCount = (GetItemCount()+nRowCount-1) / nRowCount; + if (nColumnCount > 0) + nPreferredWidth = (maPreviewSize.Width() + 2*mnBorderWidth) + * nColumnCount; + } + + return nPreferredWidth; +} + + + + +sal_Int32 PreviewValueSet::GetPreferredHeight (sal_Int32 nWidth) +{ + int nRowCount (CalculateRowCount(CalculateColumnCount(nWidth))); + int nItemHeight (maPreviewSize.Height()); + + return nRowCount * (nItemHeight + 2*mnBorderHeight); +} + + + + +} } // end of namespace sd::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/sidebar/PreviewValueSet.hxx b/sd/source/ui/sidebar/PreviewValueSet.hxx new file mode 100644 index 000000000000..86fe8b198136 --- /dev/null +++ b/sd/source/ui/sidebar/PreviewValueSet.hxx @@ -0,0 +1,69 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef SD_SIDEBAR_PANELS_PREVIEW_VALUE_SET_HXX +#define SD_SIDEBAR_PANELS_PREVIEW_VALUE_SET_HXX + +#include <svtools/valueset.hxx> + + +namespace sd { namespace sidebar { + + +/** Adapt the svtools valueset to the needs of the master page controlls. +*/ +class PreviewValueSet + : public ValueSet +{ +public: + PreviewValueSet (::Window* pParent); + ~PreviewValueSet (void); + + void SetRightMouseClickHandler (const Link& rLink); + virtual void Resize (void); + + void SetPreviewSize (const Size& rSize); + + sal_Int32 GetPreferredWidth (sal_Int32 nHeight); + sal_Int32 GetPreferredHeight (sal_Int32 nWidth); + + /** Set the number of rows and columns according to the current number + of items. Call this method when new items have been inserted. + */ + void Rearrange (bool bForceRequestResize = false); + +protected: + virtual void MouseButtonDown (const MouseEvent& rEvent); + +private: + Link maRightMouseClickHandler; + Size maPreviewSize; + const int mnBorderWidth; + const int mnBorderHeight; + const int mnMaxColumnCount; + + sal_uInt16 CalculateColumnCount (int nWidth) const; + sal_uInt16 CalculateRowCount (sal_uInt16 nColumnCount) const; +}; + +} } // end of namespace sd::sidebar + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/sidebar/RecentMasterPagesSelector.cxx b/sd/source/ui/sidebar/RecentMasterPagesSelector.cxx new file mode 100644 index 000000000000..f556aff07044 --- /dev/null +++ b/sd/source/ui/sidebar/RecentMasterPagesSelector.cxx @@ -0,0 +1,178 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "RecentMasterPagesSelector.hxx" + +#include "ViewShellBase.hxx" +#include "RecentlyUsedMasterPages.hxx" +#include "MasterPageContainerProviders.hxx" +#include "MasterPageObserver.hxx" +#include "SidebarShellManager.hxx" +#include "sdpage.hxx" +#include "drawdoc.hxx" +#include "app.hrc" +#include "helpids.h" + +#include <vcl/bitmap.hxx> + +namespace sd { namespace sidebar { + + +MasterPagesSelector* RecentMasterPagesSelector::Create ( + ::Window* pParent, + ViewShellBase& rViewShellBase, + const cssu::Reference<css::ui::XSidebar>& rxSidebar) +{ + SdDrawDocument* pDocument = rViewShellBase.GetDocument(); + if (pDocument == NULL) + return NULL; + + ::boost::shared_ptr<MasterPageContainer> pContainer (new MasterPageContainer()); + + MasterPagesSelector* pSelector( + new RecentMasterPagesSelector ( + pParent, + *pDocument, + rViewShellBase, + pContainer, + rxSidebar)); + pSelector->LateInit(); + pSelector->SetHelpId(HID_SD_TASK_PANE_PREVIEW_RECENT); + + return pSelector; +} + + + + +RecentMasterPagesSelector::RecentMasterPagesSelector ( + ::Window* pParent, + SdDrawDocument& rDocument, + ViewShellBase& rBase, + const ::boost::shared_ptr<MasterPageContainer>& rpContainer, + const cssu::Reference<css::ui::XSidebar>& rxSidebar) + : MasterPagesSelector (pParent, rDocument, rBase, rpContainer, rxSidebar) +{ +} + + + + +RecentMasterPagesSelector::~RecentMasterPagesSelector (void) +{ + RecentlyUsedMasterPages::Instance().RemoveEventListener ( + LINK(this,RecentMasterPagesSelector,MasterPageListListener)); +} + + + + +void RecentMasterPagesSelector::LateInit (void) +{ + MasterPagesSelector::LateInit(); + + MasterPagesSelector::Fill(); + RecentlyUsedMasterPages::Instance().AddEventListener ( + LINK(this,RecentMasterPagesSelector,MasterPageListListener)); +} + + + + +IMPL_LINK_NOARG(RecentMasterPagesSelector, MasterPageListListener) +{ + MasterPagesSelector::Fill(); + return 0; +} + + + + +void RecentMasterPagesSelector::Fill (ItemList& rItemList) +{ + // Create a set of names of the master pages used by the document. + MasterPageObserver::MasterPageNameSet aCurrentNames; + sal_uInt16 nMasterPageCount = mrDocument.GetMasterSdPageCount(PK_STANDARD); + sal_uInt16 nIndex; + for (nIndex=0; nIndex<nMasterPageCount; nIndex++) + { + SdPage* pMasterPage = mrDocument.GetMasterSdPage (nIndex, PK_STANDARD); + if (pMasterPage != NULL) + aCurrentNames.insert (pMasterPage->GetName()); + } + MasterPageObserver::MasterPageNameSet::iterator aI; + + // Insert the recently used master pages that are currently not used. + RecentlyUsedMasterPages& rInstance (RecentlyUsedMasterPages::Instance()); + int nPageCount = rInstance.GetMasterPageCount(); + for (nIndex=0; nIndex<nPageCount; nIndex++) + { + // Add an entry when a) the page is already known to the + // MasterPageContainer, b) the style name is empty, i.e. it has not yet + // been loaded (and thus can not be in use) or otherwise c) the + // style name is not currently in use. + MasterPageContainer::Token aToken (rInstance.GetTokenForIndex(nIndex)); + if (aToken != MasterPageContainer::NIL_TOKEN) + { + String sStyleName (mpContainer->GetStyleNameForToken(aToken)); + if (sStyleName.Len()==0 + || aCurrentNames.find(sStyleName) == aCurrentNames.end()) + { + rItemList.push_back(aToken); + } + } + } +} + + + + +void RecentMasterPagesSelector::AssignMasterPageToPageList ( + SdPage* pMasterPage, + const ::boost::shared_ptr<std::vector<SdPage*> >& rpPageList) +{ + sal_uInt16 nSelectedItemId = PreviewValueSet::GetSelectItemId(); + + MasterPagesSelector::AssignMasterPageToPageList(pMasterPage, rpPageList); + + // Restore the selection. + if (PreviewValueSet::GetItemCount() > 0) + { + if (PreviewValueSet::GetItemCount() >= nSelectedItemId) + PreviewValueSet::SelectItem(nSelectedItemId); + else + PreviewValueSet::SelectItem(PreviewValueSet::GetItemCount()); + } +} + + + + +void RecentMasterPagesSelector::ProcessPopupMenu (Menu& rMenu) +{ + if (rMenu.GetItemPos(SID_TP_EDIT_MASTER) != MENU_ITEM_NOTFOUND) + rMenu.EnableItem(SID_TP_EDIT_MASTER, sal_False); +} + + + + +} } // end of namespace sd::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/sidebar/RecentMasterPagesSelector.hxx b/sd/source/ui/sidebar/RecentMasterPagesSelector.hxx new file mode 100644 index 000000000000..9c1358191bda --- /dev/null +++ b/sd/source/ui/sidebar/RecentMasterPagesSelector.hxx @@ -0,0 +1,77 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef SD_SIDEBAR_PANELS_RECENT_MASTER_PAGES_SELECTOR_HXX +#define SD_SIDEBAR_PANELS_RECENT_MASTER_PAGES_SELECTOR_HXX + +#include "MasterPagesSelector.hxx" + +namespace sd { namespace sidebar { + + +/** Show the recently used master pages (that are not currently used). +*/ +class RecentMasterPagesSelector + : public MasterPagesSelector +{ +public: + static MasterPagesSelector* Create ( + ::Window* pParent, + ViewShellBase& rViewShellBase, + const cssu::Reference<css::ui::XSidebar>& rxSidebar); + +protected: + DECL_LINK(MasterPageListListener, void*); + virtual void Fill (ItemList& rItemList); + + using sd::sidebar::MasterPagesSelector::Fill; + + /** Forward this call to the base class but save and restore the + currently selected item. + Assign the given master page to the list of pages. + @param pMasterPage + This master page will usually be a member of the list of all + available master pages as provided by the MasterPageContainer. + @param rPageList + The pages to which to assign the master page. These pages may + be slides or master pages themselves. + */ + virtual void AssignMasterPageToPageList ( + SdPage* pMasterPage, + const ::boost::shared_ptr<std::vector<SdPage*> >& rpPageList); + + virtual void ProcessPopupMenu (Menu& rMenu); + +private: + RecentMasterPagesSelector ( + ::Window* pParent, + SdDrawDocument& rDocument, + ViewShellBase& rBase, + const ::boost::shared_ptr<MasterPageContainer>& rpContainer, + const cssu::Reference<css::ui::XSidebar>& rxSidebar); + virtual ~RecentMasterPagesSelector (void); + + virtual void LateInit (void); +}; + +} } // end of namespace sd::sidebar + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/sidebar/RecentlyUsedMasterPages.cxx b/sd/source/ui/sidebar/RecentlyUsedMasterPages.cxx new file mode 100644 index 000000000000..be41524594c9 --- /dev/null +++ b/sd/source/ui/sidebar/RecentlyUsedMasterPages.cxx @@ -0,0 +1,479 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "RecentlyUsedMasterPages.hxx" +#include "MasterPageObserver.hxx" +#include "MasterPagesSelector.hxx" +#include "MasterPageDescriptor.hxx" +#include "tools/ConfigurationAccess.hxx" +#include "drawdoc.hxx" +#include "sdpage.hxx" + +#include <algorithm> +#include <vector> + +#include <comphelper/processfactory.hxx> +#include "unomodel.hxx" +#include <com/sun/star/drawing/XDrawPagesSupplier.hpp> +#include <com/sun/star/drawing/XDrawPages.hpp> +#include <com/sun/star/frame/XComponentLoader.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/container/XHierarchicalNameAccess.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/beans/PropertyState.hpp> +#include <unotools/confignode.hxx> +#include <osl/doublecheckedlocking.h> +#include <osl/getglobalmutex.hxx> + +using namespace ::std; +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; + + +namespace { + +static const OUString& GetPathToImpressConfigurationRoot (void) +{ + static const OUString sPathToImpressConfigurationRoot ("/org.openoffice.Office.Impress/"); + return sPathToImpressConfigurationRoot; +} +static const OUString& GetPathToSetNode (void) +{ + static const OUString sPathToSetNode("MultiPaneGUI/ToolPanel/RecentlyUsedMasterPages"); + return sPathToSetNode; +} + + +class Descriptor +{ +public: + OUString msURL; + OUString msName; + ::sd::sidebar::MasterPageContainer::Token maToken; + Descriptor (const OUString& rsURL, const OUString& rsName) + : msURL(rsURL), + msName(rsName), + maToken(::sd::sidebar::MasterPageContainer::NIL_TOKEN) + {} + Descriptor (::sd::sidebar::MasterPageContainer::Token aToken, + const OUString& rsURL, const OUString& rsName) + : msURL(rsURL), + msName(rsName), + maToken(aToken) + {} + class TokenComparator + { public: + TokenComparator(::sd::sidebar::MasterPageContainer::Token aToken) + : maToken(aToken) {} + bool operator () (const Descriptor& rDescriptor) + { return maToken==rDescriptor.maToken; } + private: ::sd::sidebar::MasterPageContainer::Token maToken; + }; +}; + +} // end of anonymous namespace + + + + +namespace sd { namespace sidebar { + +class RecentlyUsedMasterPages::MasterPageList : public ::std::vector<Descriptor> +{ +public: + MasterPageList (void) {} +}; + + +RecentlyUsedMasterPages* RecentlyUsedMasterPages::mpInstance = NULL; + + +RecentlyUsedMasterPages& RecentlyUsedMasterPages::Instance (void) +{ + if (mpInstance == NULL) + { + ::osl::GetGlobalMutex aMutexFunctor; + ::osl::MutexGuard aGuard (aMutexFunctor()); + if (mpInstance == NULL) + { + RecentlyUsedMasterPages* pInstance = new RecentlyUsedMasterPages(); + pInstance->LateInit(); + SdGlobalResourceContainer::Instance().AddResource ( + ::std::auto_ptr<SdGlobalResource>(pInstance)); + OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER(); + mpInstance = pInstance; + } + } + else { + OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER(); + } + + return *mpInstance; +} + + + + +RecentlyUsedMasterPages::RecentlyUsedMasterPages (void) + : maListeners(), + mpMasterPages(new MasterPageList()), + mnMaxListSize(8), + mpContainer(new MasterPageContainer()) +{ +} + + + + +RecentlyUsedMasterPages::~RecentlyUsedMasterPages (void) +{ + Link aLink (LINK(this,RecentlyUsedMasterPages,MasterPageContainerChangeListener)); + mpContainer->RemoveChangeListener(aLink); + + MasterPageObserver::Instance().RemoveEventListener( + LINK(this,RecentlyUsedMasterPages,MasterPageChangeListener)); +} + + + + +void RecentlyUsedMasterPages::LateInit (void) +{ + Link aLink (LINK(this,RecentlyUsedMasterPages,MasterPageContainerChangeListener)); + mpContainer->AddChangeListener(aLink); + + LoadPersistentValues (); + MasterPageObserver::Instance().AddEventListener( + LINK(this,RecentlyUsedMasterPages,MasterPageChangeListener)); +} + + + + +void RecentlyUsedMasterPages::LoadPersistentValues (void) +{ + try + { + tools::ConfigurationAccess aConfiguration ( + GetPathToImpressConfigurationRoot(), + tools::ConfigurationAccess::READ_ONLY); + Reference<container::XNameAccess> xSet ( + aConfiguration.GetConfigurationNode(GetPathToSetNode()), + UNO_QUERY); + if ( ! xSet.is()) + return; + + const OUString sURLMemberName("URL"); + const OUString sNameMemberName("Name"); + OUString sURL; + OUString sName; + + // Read the names and URLs of the master pages. + Sequence<OUString> aKeys (xSet->getElementNames()); + mpMasterPages->clear(); + mpMasterPages->reserve(aKeys.getLength()); + for (int i=0; i<aKeys.getLength(); i++) + { + Reference<container::XNameAccess> xSetItem ( + xSet->getByName(aKeys[i]), UNO_QUERY); + if (xSetItem.is()) + { + Any aURL (xSetItem->getByName(sURLMemberName)); + Any aName (xSetItem->getByName(sNameMemberName)); + aURL >>= sURL; + aName >>= sName; + SharedMasterPageDescriptor pDescriptor (new MasterPageDescriptor( + MasterPageContainer::TEMPLATE, + -1, + sURL, + String(), + sName, + false, + ::boost::shared_ptr<PageObjectProvider>( + new TemplatePageObjectProvider(sURL)), + ::boost::shared_ptr<PreviewProvider>( + new TemplatePreviewProvider(sURL)))); + // For user supplied templates we use a different + // preview provider: The preview in the document shows + // not only shapes on the master page but also shapes on + // the foreground. This is misleading and therefore + // these previews are discarded and created directly + // from the page objects. + if (pDescriptor->GetURLClassification() == MasterPageDescriptor::URLCLASS_USER) + pDescriptor->mpPreviewProvider = ::boost::shared_ptr<PreviewProvider>( + new PagePreviewProvider()); + MasterPageContainer::Token aToken (mpContainer->PutMasterPage(pDescriptor)); + mpMasterPages->push_back(Descriptor(aToken,sURL,sName)); + } + } + + ResolveList(); + } + catch (Exception&) + { + // Ignore exception. + } +} + + + + +void RecentlyUsedMasterPages::SavePersistentValues (void) +{ + try + { + tools::ConfigurationAccess aConfiguration ( + GetPathToImpressConfigurationRoot(), + tools::ConfigurationAccess::READ_WRITE); + Reference<container::XNameContainer> xSet ( + aConfiguration.GetConfigurationNode(GetPathToSetNode()), + UNO_QUERY); + if ( ! xSet.is()) + return; + + // Clear the set. + Sequence<OUString> aKeys (xSet->getElementNames()); + sal_Int32 i; + for (i=0; i<aKeys.getLength(); i++) + xSet->removeByName (aKeys[i]); + + // Fill it with the URLs of this object. + const OUString sURLMemberName("URL"); + const OUString sNameMemberName("Name"); + Any aValue; + Reference<lang::XSingleServiceFactory> xChildFactory ( + xSet, UNO_QUERY); + if ( ! xChildFactory.is()) + return; + MasterPageList::const_iterator iDescriptor; + sal_Int32 nIndex(0); + for (iDescriptor=mpMasterPages->begin(); + iDescriptor!=mpMasterPages->end(); + ++iDescriptor,++nIndex) + { + // Create new child. + OUString sKey ("index_"); + sKey += OUString::valueOf(nIndex); + Reference<container::XNameReplace> xChild( + xChildFactory->createInstance(), UNO_QUERY); + if (xChild.is()) + { + xSet->insertByName (sKey, makeAny(xChild)); + + aValue <<= OUString(iDescriptor->msURL); + xChild->replaceByName (sURLMemberName, aValue); + + aValue <<= OUString(iDescriptor->msName); + xChild->replaceByName (sNameMemberName, aValue); + } + } + + // Write the data back to disk. + aConfiguration.CommitChanges(); + } + catch (Exception&) + { + // Ignore exception. + } +} + + + + +void RecentlyUsedMasterPages::AddEventListener (const Link& rEventListener) +{ + if (::std::find ( + maListeners.begin(), + maListeners.end(), + rEventListener) == maListeners.end()) + { + maListeners.push_back (rEventListener); + } +} + + + + +void RecentlyUsedMasterPages::RemoveEventListener (const Link& rEventListener) +{ + maListeners.erase ( + ::std::find ( + maListeners.begin(), + maListeners.end(), + rEventListener)); +} + + + + +int RecentlyUsedMasterPages::GetMasterPageCount (void) const +{ + return mpMasterPages->size(); +} + + + + +MasterPageContainer::Token RecentlyUsedMasterPages::GetTokenForIndex (sal_uInt32 nIndex) const +{ + if(nIndex<mpMasterPages->size()) + return (*mpMasterPages)[nIndex].maToken; + else + return MasterPageContainer::NIL_TOKEN; +} + + + + +void RecentlyUsedMasterPages::SendEvent (void) +{ + ::std::vector<Link>::iterator aLink (maListeners.begin()); + ::std::vector<Link>::iterator aEnd (maListeners.end()); + while (aLink!=aEnd) + { + aLink->Call (NULL); + ++aLink; + } +} + + + + +IMPL_LINK(RecentlyUsedMasterPages, MasterPageChangeListener, + MasterPageObserverEvent*, pEvent) +{ + switch (pEvent->meType) + { + case MasterPageObserverEvent::ET_MASTER_PAGE_ADDED: + case MasterPageObserverEvent::ET_MASTER_PAGE_EXISTS: + AddMasterPage( + mpContainer->GetTokenForStyleName(pEvent->mrMasterPageName)); + break; + + case MasterPageObserverEvent::ET_MASTER_PAGE_REMOVED: + // Do not change the list of recently master pages (the deleted + // page was recently used) but tell the listeners. They may want + // to update their lists. + SendEvent(); + break; + } + return 0; +} + + + + +IMPL_LINK(RecentlyUsedMasterPages, MasterPageContainerChangeListener, + MasterPageContainerChangeEvent*, pEvent) +{ + if (pEvent != NULL) + switch (pEvent->meEventType) + { + case MasterPageContainerChangeEvent::CHILD_ADDED: + case MasterPageContainerChangeEvent::CHILD_REMOVED: + case MasterPageContainerChangeEvent::INDEX_CHANGED: + case MasterPageContainerChangeEvent::INDEXES_CHANGED: + ResolveList(); + break; + + default: + // Ignored. + break; + } + return 0; +} + + + + +void RecentlyUsedMasterPages::AddMasterPage ( + MasterPageContainer::Token aToken, + bool bMakePersistent) +{ + // For the page to be inserted the token has to be valid and the page + // has to have a valid URL. This excludes master pages that do not come + // from template files. + if (aToken != MasterPageContainer::NIL_TOKEN + && mpContainer->GetURLForToken(aToken).Len()>0) + { + + MasterPageList::iterator aIterator ( + ::std::find_if(mpMasterPages->begin(),mpMasterPages->end(), + Descriptor::TokenComparator(aToken))); + if (aIterator != mpMasterPages->end()) + { + // When an entry for the given token already exists then remove + // it now and insert it later at the head of the list. + mpMasterPages->erase (aIterator); + } + + mpMasterPages->insert(mpMasterPages->begin(), + Descriptor( + aToken, + mpContainer->GetURLForToken(aToken), + mpContainer->GetStyleNameForToken(aToken))); + + // Shorten list to maximal size. + while (mpMasterPages->size() > mnMaxListSize) + { + mpMasterPages->pop_back (); + } + + if (bMakePersistent) + SavePersistentValues (); + SendEvent(); + } +} + + + + +void RecentlyUsedMasterPages::ResolveList (void) +{ + bool bNotify (false); + + MasterPageList::iterator iDescriptor; + for (iDescriptor=mpMasterPages->begin(); iDescriptor!=mpMasterPages->end(); ++iDescriptor) + { + if (iDescriptor->maToken == MasterPageContainer::NIL_TOKEN) + { + MasterPageContainer::Token aToken (mpContainer->GetTokenForURL(iDescriptor->msURL)); + iDescriptor->maToken = aToken; + if (aToken != MasterPageContainer::NIL_TOKEN) + bNotify = true; + } + else + { + if ( ! mpContainer->HasToken(iDescriptor->maToken)) + { + iDescriptor->maToken = MasterPageContainer::NIL_TOKEN; + bNotify = true; + } + } + } + + if (bNotify) + SendEvent(); +} + + +} } // end of namespace sd::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/sidebar/RecentlyUsedMasterPages.hxx b/sd/source/ui/sidebar/RecentlyUsedMasterPages.hxx new file mode 100644 index 000000000000..4fb0aa599851 --- /dev/null +++ b/sd/source/ui/sidebar/RecentlyUsedMasterPages.hxx @@ -0,0 +1,119 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef SD_SIDEBAR_PANELS_RECENTLY_USED_MASTER_PAGES_HXX +#define SD_SIDEBAR_PANELS_RECENTLY_USED_MASTER_PAGES_HXX + +#include "tools/SdGlobalResourceContainer.hxx" +#include <osl/mutex.hxx> +#include <tools/link.hxx> +#include <vcl/image.hxx> +#include <vector> + +#include "DrawDocShell.hxx" +#include "MasterPageContainer.hxx" +#include <com/sun/star/uno/XInterface.hpp> + +namespace sd { +class MasterPageObserverEvent; +} + + +namespace sd { namespace sidebar { + +/** This singleton holds a list of the most recently used master pages. +*/ +class RecentlyUsedMasterPages + : public SdGlobalResource +{ +public: + /** Return the single instance of this class. + */ + static RecentlyUsedMasterPages& Instance (void); + + void AddEventListener (const Link& rEventListener); + void RemoveEventListener (const Link& rEventListener); + + int GetMasterPageCount (void) const; + MasterPageContainer::Token GetTokenForIndex (sal_uInt32 nIndex) const; + +private: + /** The single instance of this class. It is created on demand when + Instance() is called for the first time. + */ + static RecentlyUsedMasterPages* mpInstance; + + ::std::vector<Link> maListeners; + + class MasterPageList; + ::std::auto_ptr<MasterPageList> mpMasterPages; + unsigned long int mnMaxListSize; + ::boost::shared_ptr<MasterPageContainer> mpContainer; + + RecentlyUsedMasterPages (void); + virtual ~RecentlyUsedMasterPages (void); + + /** Call this method after a new object has been created. + */ + void LateInit (void); + + /// The copy constructor is not implemented. Do not use! + RecentlyUsedMasterPages (const RecentlyUsedMasterPages&); + + /// The assignment operator is not implemented. Do not use! + RecentlyUsedMasterPages& operator= (const RecentlyUsedMasterPages&); + + void SendEvent (void); + DECL_LINK(MasterPageChangeListener, MasterPageObserverEvent*); + DECL_LINK(MasterPageContainerChangeListener, MasterPageContainerChangeEvent*); + + /** Add a descriptor for the specified master page to the end of the + list of most recently used master pages. When the page is already a + member of that list the associated descriptor is moved to the end of + the list to make it the most recently used entry. + @param bMakePersistent + When <TRUE/> is given then the new list of recently used master + pages is written back into the configuration to make it + persistent. Giving <FALSE/> to ommit this is used while loading + the persistent list from the configuration. + */ + void AddMasterPage ( + MasterPageContainer::Token aToken, + bool bMakePersistent = true); + + /** Load the list of recently used master pages from the registry where + it was saved to make it persistent. + */ + void LoadPersistentValues (void); + + /** Save the list of recently used master pages to the registry to make + it presistent. + */ + void SavePersistentValues (void); + + void ResolveList (void); +}; + + + +} } // end of namespace sd::sidebar + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/sidebar/SidebarFocusManager.hxx b/sd/source/ui/sidebar/SidebarFocusManager.hxx new file mode 100644 index 000000000000..4ae747ebe468 --- /dev/null +++ b/sd/source/ui/sidebar/SidebarFocusManager.hxx @@ -0,0 +1,130 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef SD_TOOLPANEL_FOCUS_MANAGER_HXX +#define SD_TOOLPANEL_FOCUS_MANAGER_HXX + +#include <tools/link.hxx> + +#include <memory> + +class KeyCode; +class VclSimpleEvent; +class Window; + +namespace sd { namespace toolpanel { + +/** On certain key presses the focus is moved from one window to another. + For this to work every window that wants its focus managed has to + register or be registered and tell where to put the focus on what key + press. +*/ +class FocusManager +{ +public: + /** Return an instance of the focus manager. + */ + static FocusManager& Instance (void); + + /** Register a link from one window to another so that any time the + specified key is pressed while the source window is focused, the + focus is transferred to the target window. + @param pSource + The window from which the focus will be transferred. + @param pTarget + The window to which the focus will be transferred. + @param rKey + The key for which the focus is transferred from the source + window to the target window. + */ + void RegisterLink ( + ::Window* pSource, + ::Window* pTarget, + const KeyCode& rKey); + + /** Register a link that will move the focus from the source window to + the target window when the source window is focused and KEY_ESCAPE + is pressed. + @param pSource + The window from which the focus will be transferred. + @param pTarget + The window to which the focus will be transferred. + */ + void RegisterUpLink (::Window* pSource, ::Window* pTarget); + + /** Register a link that will move the focus from the source window to + the target window when the source window is focused and KEY_RETURN + is pressed. + @param pSource + The window from which the focus will be transferred. + @param pTarget + The window to which the focus will be transferred. + */ + void RegisterDownLink (::Window* pSource, ::Window* pTarget); + + /** Remove all links from the source window to the target window. When + there are links from the target window to the source window then + these are not touced. + */ + void RemoveLinks ( + ::Window* pSource, + ::Window* pTarget); + + /** Let the focus manager transfer the focus from the specified source + window to a target window that is determined according the the + registered links and the given key code. + When there is no rule for this combination of source window and key + code then the focus stays where it is. + */ + bool TransferFocus (::Window* pSource, const KeyCode& rCode); + +private: + friend struct FocusManagerCreator; + + class LinkMap; + ::std::auto_ptr<LinkMap> mpLinks; + + FocusManager (void); + ~FocusManager (void); + + /** Clear the list of focus transfer links. This removes all window + listeners. + */ + void Clear (void); + + /** Remove all links from or to the given window. + */ + void RemoveLinks (::Window* pWindow); + + /** Unregister as event listener from the given window when there are no + links from this window anymore. + */ + void RemoveUnusedEventListener (::Window* pWindow); + + /** Listen for key events and on KEY_RETURN go down and on + KEY_ESCAPE go up. + */ + DECL_LINK(WindowEventListener, VclSimpleEvent*); +}; + +} } // end of namespace ::sd::toolpanel + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/sidebar/SidebarShellManager.cxx b/sd/source/ui/sidebar/SidebarShellManager.cxx new file mode 100644 index 000000000000..526389e42a8e --- /dev/null +++ b/sd/source/ui/sidebar/SidebarShellManager.cxx @@ -0,0 +1,176 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + + +#include "TaskPaneShellManager.hxx" + +#include "SidebarShellManager.hxx" +#include "ViewShellManager.hxx" +#include <tools/diagnose_ex.h> +#include <vcl/window.hxx> + +#include <algorithm> + +namespace sd { namespace sidebar { + +SidebarShellManager::SidebarShellManager ( + const ::boost::shared_ptr<ViewShellManager>& rpViewShellManager, + const ViewShell& rViewShell) + : mpViewShellManager(rpViewShellManager), + mrViewShell(rViewShell), + maSubShells() +{ +} + + + + +SidebarShellManager::~SidebarShellManager (void) +{ + while ( ! maSubShells.empty()) + RemoveSubShell(maSubShells.begin()->second.mpShell); +} + + + + +SfxShell* SidebarShellManager::CreateShell( ShellId nId, ::Window* , FrameView* ) +{ + SubShells::const_iterator iShell (maSubShells.find(nId)); + if (iShell != maSubShells.end()) + return iShell->second.mpShell; + else + return NULL; +} + + + + +void SidebarShellManager::ReleaseShell (SfxShell* ) +{ + // Nothing to do. +} + +void SidebarShellManager::AddSubShell ( + ShellId nId, + SfxShell* pShell, + ::Window* pWindow) +{ + if (pShell != NULL) + { + maSubShells[nId] = ShellDescriptor(pShell,pWindow); + if (pWindow != NULL) + { + pWindow->AddEventListener(LINK(this,SidebarShellManager,WindowCallback)); + if (pWindow->IsReallyVisible()) + mpViewShellManager->ActivateSubShell(mrViewShell, nId); + } + else + mpViewShellManager->ActivateSubShell(mrViewShell, nId); + } +} + + + + +void SidebarShellManager::RemoveSubShell (const ShellId i_nShellId) +{ + SubShells::iterator pos = maSubShells.find( i_nShellId ); + ENSURE_OR_RETURN_VOID( pos != maSubShells.end(), "no shell for this ID" ); + if ( pos->second.mpWindow != NULL ) + { + pos->second.mpWindow->RemoveEventListener( LINK( this, SidebarShellManager, WindowCallback ) ); + } + mpViewShellManager->DeactivateSubShell( mrViewShell, pos->first ); + maSubShells.erase( pos ); +} + + + + +void SidebarShellManager::RemoveSubShell (const SfxShell* pShell) +{ + if (pShell != NULL) + { + SubShells::iterator iShell; + for (iShell=maSubShells.begin(); iShell!=maSubShells.end(); ++iShell) + if (iShell->second.mpShell == pShell) + { + if (iShell->second.mpWindow != NULL) + iShell->second.mpWindow->RemoveEventListener( + LINK(this,SidebarShellManager,WindowCallback)); + mpViewShellManager->DeactivateSubShell(mrViewShell,iShell->first); + maSubShells.erase(iShell); + break; + } + } +} + + + + +void SidebarShellManager::MoveToTop (SfxShell* pShell) +{ + SubShells::const_iterator iShell; + for (iShell=maSubShells.begin(); iShell!=maSubShells.end(); ++iShell) + if (iShell->second.mpShell == pShell) + { + ViewShellManager::UpdateLock aLocker (mpViewShellManager); + mpViewShellManager->MoveSubShellToTop(mrViewShell,iShell->first); + mpViewShellManager->MoveToTop(mrViewShell); + break; + } +} + + + + +IMPL_LINK(SidebarShellManager, WindowCallback, VclWindowEvent*, pEvent) +{ + if (pEvent != NULL) + { + SubShells::const_iterator iShell; + ::Window* pWindow = pEvent->GetWindow(); + for (iShell=maSubShells.begin(); iShell!=maSubShells.end(); ++iShell) + if (iShell->second.mpWindow == pWindow) + break; + if (iShell != maSubShells.end()) + switch (pEvent->GetId()) + { + case VCLEVENT_WINDOW_SHOW: + mpViewShellManager->ActivateSubShell(mrViewShell,iShell->first); + break; + + case VCLEVENT_WINDOW_HIDE: + // Do not activate the sub shell. This leads to + // problems with shapes currently being in text edit + // mode: Deactivating the shell leads to leaving the + // text editing mode. + // mpViewShellManager->DeactivateSubShell(mrViewShell,iShell->first); + break; + } + } + + return 0; +} + + +} } // end of namespace ::sd::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/sidebar/SidebarShellManager.hxx b/sd/source/ui/sidebar/SidebarShellManager.hxx new file mode 100644 index 000000000000..eec84c60620d --- /dev/null +++ b/sd/source/ui/sidebar/SidebarShellManager.hxx @@ -0,0 +1,116 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef SD_SIDEBAR_SHELL_MANAGER_HXX +#define SD_SIDEBAR_SHELL_MANAGER_HXX + +#include "ShellFactory.hxx" +#include "ViewShellManager.hxx" +#include <tools/link.hxx> +#include <map> + +class FrameView; +class SfxShell; +class VclWindowEvent; +class Window; + +namespace sd { +class ViewShell; +} + +namespace sd { namespace sidebar { + +/** The TaskPaneShellManager implements the ViewShellManager::ShellFactory + interface. However, it does not create or delete shells. It only + gives the ViewShellManager access to the sub shells of the + ToolPanelViewShell. Life time control of the sub shells is managed by + the sub shells themselves. +*/ +class SidebarShellManager + : public ShellFactory<SfxShell> +{ +public: + /** Create a shell manager that manages the stacked shells for the given + view shell. It works together with the given view shell manager. + */ + SidebarShellManager ( + const ::boost::shared_ptr<ViewShellManager>& rpViewShellManager, + const ViewShell& rViewShell); + ~SidebarShellManager (void); + + /** Return the requested sub shell. + @param nId + The id of the requested sub shell. + @return + When there is no sub shell currently registered under the given + id then NULL is returned. + */ + virtual SfxShell* CreateShell ( + ShellId nId, + ::Window* pParentWindow, + FrameView* pFrameView = NULL); + + virtual void ReleaseShell (SfxShell* pShell); + + /** Add a sub shell to the set of sub shells managed by the + TaskPaneShellManager. Only shells added by this method are returned + by CreateShell(). + */ + void AddSubShell (ShellId nId, SfxShell* pShell, ::Window* pWindow); + + /** Remove the given shell from the set of sub shells managed by the + TaskPaneShellManager. Following calls to CreateShell() will return + NULL when this shell is requested. + */ + void RemoveSubShell (const SfxShell* pShell); + /** removes the shell given by its ID from the set of sub shells managed by the + TaskPaneShellManager. Subsequent calls to CreateShell() will return + NULL when this shell is requested. + */ + void RemoveSubShell (const ShellId i_nShellId); + + /** Move the given sub-shell to the top of the local shell stack. + Furthermore move the view shell whose sub-shells this class manages + to the top of the global shell stack. + */ + void MoveToTop (SfxShell* pShell); + + DECL_LINK(WindowCallback,VclWindowEvent*); + +private: + ::boost::shared_ptr<ViewShellManager> mpViewShellManager; + + /// The view shell whose sub-shells this class manages. + const ViewShell& mrViewShell; + + class ShellDescriptor { public: + SfxShell* mpShell; + ::Window* mpWindow; + ShellDescriptor(void) : mpShell(NULL),mpWindow(NULL){} + ShellDescriptor(SfxShell*pShell,::Window*pWindow) : mpShell(pShell),mpWindow(pWindow){} + }; + typedef ::std::map<ShellId,ShellDescriptor> SubShells; + SubShells maSubShells; +}; + +} } // end of namespace ::sd::sidebar + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/sidebar/SlideTransitionPanel.cxx b/sd/source/ui/sidebar/SlideTransitionPanel.cxx new file mode 100644 index 000000000000..3b4d994d207b --- /dev/null +++ b/sd/source/ui/sidebar/SlideTransitionPanel.cxx @@ -0,0 +1,71 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "SlideTransitionPanel.hxx" + +#include "ViewShellBase.hxx" + + +namespace sd { + extern ::Window* createSlideTransitionPanel (::Window* pParent, ViewShellBase& rBase); + extern sal_Int32 getSlideTransitionPanelMinimumHeight (::Window* pParent); +} + + + + +namespace sd { namespace sidebar { + + +SlideTransitionPanel::SlideTransitionPanel ( + ::Window* pParentWindow, + ViewShellBase& rViewShellBase) + : PanelBase(pParentWindow, rViewShellBase) +{ +#ifdef DEBUG + SetText(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sd:SlideTransitionPanel"))); +#endif +} + + + + +SlideTransitionPanel::~SlideTransitionPanel (void) +{ +} + + + + +::Window* SlideTransitionPanel::CreateWrappedControl ( + ::Window* pParentWindow, + ViewShellBase& rViewShellBase) +{ + return createSlideTransitionPanel(pParentWindow, rViewShellBase); +} + + + + +css::ui::LayoutSize SlideTransitionPanel::GetHeightForWidth (const sal_Int32 /*nWidth*/) +{ + const sal_Int32 nMinimumHeight(getSlideTransitionPanelMinimumHeight(mpWrappedControl.get())); + return css::ui::LayoutSize(nMinimumHeight,-1, nMinimumHeight); +} + +} } // end of namespace sd::sidebar diff --git a/sd/source/ui/sidebar/SlideTransitionPanel.hxx b/sd/source/ui/sidebar/SlideTransitionPanel.hxx new file mode 100644 index 000000000000..40094feac70b --- /dev/null +++ b/sd/source/ui/sidebar/SlideTransitionPanel.hxx @@ -0,0 +1,46 @@ +/* + * 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 SD_SIDEBAR_PANELS_SLIDE_TRANSITION_PANEL_HXX +#define SD_SIDEBAR_PANELS_SLIDE_TRANSITION_PANEL_HXX + +#include "PanelBase.hxx" + +namespace sd { namespace sidebar { + +class SlideTransitionPanel + : public PanelBase +{ +public: + SlideTransitionPanel ( + ::Window* pParentWindow, + ViewShellBase& rViewShellBase); + virtual ~SlideTransitionPanel (void); + + // ILayoutableWindow + virtual css::ui::LayoutSize GetHeightForWidth (const sal_Int32 nWidth); + +protected: + virtual ::Window* CreateWrappedControl ( + ::Window* pParentWindow, + ViewShellBase& rViewShellBase); +}; + +} } // end of namespace sd::sidebar + + +#endif diff --git a/sd/source/ui/sidebar/TableDesignPanel.cxx b/sd/source/ui/sidebar/TableDesignPanel.cxx new file mode 100644 index 000000000000..28ceb65cfbbd --- /dev/null +++ b/sd/source/ui/sidebar/TableDesignPanel.cxx @@ -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 . + */ +#include "precompiled_sd.hxx" + +#include "TableDesignPanel.hxx" + +#include "ViewShellBase.hxx" + + +namespace sd { + extern ::Window * createTableDesignPanel (::Window* pParent, ViewShellBase& rBase); +} + + +namespace sd { namespace sidebar { + + +TableDesignPanel::TableDesignPanel ( + ::Window* pParentWindow, + ViewShellBase& rViewShellBase) + : PanelBase(pParentWindow, rViewShellBase) +{ +#ifdef DEBUG + SetText(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sd:TableDesignPanel"))); +#endif +} + + + + +TableDesignPanel::~TableDesignPanel (void) +{ +} + + + + +::Window* TableDesignPanel::CreateWrappedControl ( + ::Window* pParentWindow, + ViewShellBase& rViewShellBase) +{ + return createTableDesignPanel(pParentWindow, rViewShellBase); +} + + + + +css::ui::LayoutSize TableDesignPanel::GetHeightForWidth (const sal_Int32 nWidth) +{ + //TODO: make the sizes depend on the font size. + return css::ui::LayoutSize(350,-1, 400); +} + +} } // end of namespace sd::sidebar diff --git a/sd/source/ui/sidebar/TableDesignPanel.hxx b/sd/source/ui/sidebar/TableDesignPanel.hxx new file mode 100644 index 000000000000..8a6470b3c77c --- /dev/null +++ b/sd/source/ui/sidebar/TableDesignPanel.hxx @@ -0,0 +1,45 @@ +/* + * 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 SD_SIDEBAR_PANELS_TABLE_DESIGN_PANEL_HXX +#define SD_SIDEBAR_PANELS_TABLE_DESIGN_PANEL_HXX + +#include "PanelBase.hxx" + +namespace sd { namespace sidebar { + +class TableDesignPanel + : public PanelBase +{ +public: + TableDesignPanel ( + ::Window* pParentWindow, + ViewShellBase& rViewShellBase); + virtual ~TableDesignPanel (void); + + // ILayoutableWindow + virtual css::ui::LayoutSize GetHeightForWidth (const sal_Int32 nWidth); + +protected: + virtual ::Window* CreateWrappedControl ( + ::Window* pParentWindow, + ViewShellBase& rViewShellBase); +}; + +} } // end of namespace sd::sidebar + +#endif diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx index c36b7d3496bc..6b9c69048143 100644 --- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx +++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx @@ -191,7 +191,8 @@ void SlotManager::FuTemporary (SfxRequest& rRequest) // in the tool pane. if (mrSlideSorter.GetViewShellBase() != NULL) framework::FrameworkHelper::Instance(*mrSlideSorter.GetViewShellBase()) - ->RequestTaskPanel(sd::framework::FrameworkHelper::msSlideTransitionTaskPanelURL); + ->RequestSidebarPanel( + sd::framework::FrameworkHelper::msSlideTransitionTaskPanelURL); rRequest.Ignore (); break; } diff --git a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx index 7191956d18b5..43ff8248132e 100644 --- a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx +++ b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx @@ -46,6 +46,7 @@ #include "sdresid.hxx" #include "AccessibleSlideSorterView.hxx" #include "DrawDocShell.hxx" +#include "DrawViewShell.hxx" #include "FrameView.hxx" #include "SdUnoSlideView.hxx" #include "ViewShellManager.hxx" @@ -57,7 +58,10 @@ #include <sfx2/bindings.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/request.hxx> +#include <sfx2/sidebar/SidebarChildWindow.hxx> #include <svx/svxids.hrc> +#include <sfx2/sidebar/EnumContext.hxx> +#include <svx/sidebar/ContextChangeEventMultiplexer.hxx> #include <com/sun/star/drawing/framework/XControllerManager.hpp> #include <com/sun/star/drawing/framework/ResourceId.hpp> #include <cppuhelper/bootstrap.hxx> @@ -72,12 +76,14 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::drawing::framework; using ::sd::framework::FrameworkHelper; +using ::sfx2::sidebar::EnumContext; namespace sd { namespace slidesorter { SFX_IMPL_INTERFACE(SlideSorterViewShell, SfxShell, SdResId(STR_SLIDESORTERVIEWSHELL)) { + SFX_CHILDWINDOW_REGISTRATION(::sfx2::sidebar::SidebarChildWindow::GetChildWindowId()); } @@ -215,12 +221,11 @@ SlideSorterViewShell* SlideSorterViewShell::GetSlideSorter (ViewShellBase& rBase { SlideSorterViewShell* pViewShell = NULL; - // Test the center, left, and then the right pane for showing a slide sorter. + // Test the center and left pane for showing a slide sorter. OUString aPaneURLs[] = { FrameworkHelper::msCenterPaneURL, FrameworkHelper::msFullScreenPaneURL, FrameworkHelper::msLeftImpressPaneURL, - FrameworkHelper::msRightPaneURL, OUString()}; try @@ -547,6 +552,50 @@ void SlideSorterViewShell::Activate (sal_Bool bIsMDIActivate) ViewShell::Activate(bIsMDIActivate); if (mbIsArrangeGUIElementsPending) ArrangeGUIElements(); + + // Determine and broadcast the context that belongs to the main view shell. + EnumContext::Context eContext = EnumContext::Context_Unknown; + ::boost::shared_ptr<ViewShell> pMainViewShell (GetViewShellBase().GetMainViewShell()); + ViewShell::ShellType eMainViewShellType ( + pMainViewShell + ? pMainViewShell->GetShellType() + : ViewShell::ST_NONE); + switch (eMainViewShellType) + { + case ViewShell::ST_IMPRESS: + eContext = EnumContext::Context_DrawPage; + if (pMainViewShell->ISA(DrawViewShell)) + { + DrawViewShell* pDrawViewShell = static_cast<DrawViewShell*>(pMainViewShell.get()); + if (pDrawViewShell && (pDrawViewShell->GetEditMode()== EM_MASTERPAGE)) + eContext = EnumContext::Context_MasterPage; + } + break; + + case ViewShell::ST_SLIDE_SORTER: + eContext = EnumContext::Context_SlidesorterPage; + break; + + case ViewShell::ST_NOTES: + eContext = EnumContext::Context_NotesPage; + break; + + default: + break; + } + ContextChangeEventMultiplexer::NotifyContextChange( + &GetViewShellBase(), + eContext); +} + + + + +void SlideSorterViewShell::Deactivate (sal_Bool /*bIsMDIActivate*/) +{ + ContextChangeEventMultiplexer::NotifyContextChange( + &GetViewShellBase(), + EnumContext::Context_Default); } diff --git a/sd/source/ui/table/TableDesignPane.cxx b/sd/source/ui/table/TableDesignPane.cxx index b02617702396..29b278c67b21 100644 --- a/sd/source/ui/table/TableDesignPane.cxx +++ b/sd/source/ui/table/TableDesignPane.cxx @@ -96,7 +96,7 @@ TableDesignPane::TableDesignPane( ::Window* pParent, ViewShellBase& rBase, bool { Window* pControlParent = mbModal ? pParent : this; - mxControls[FL_TABLE_STYLES].reset( new FixedLine( pControlParent, SdResId( FL_TABLE_STYLES + 1 ) ) ); + // mxControls[FL_TABLE_STYLES].reset( new FixedLine( pControlParent, SdResId( FL_TABLE_STYLES + 1 ) ) ); ValueSet* pValueSet = new ValueSet( pControlParent, SdResId( CT_TABLE_STYLES+1 ) ); mxControls[CT_TABLE_STYLES].reset( pValueSet ); @@ -113,7 +113,7 @@ TableDesignPane::TableDesignPane( ::Window* pParent, ViewShellBase& rBase, bool } pValueSet->SetSelectHdl (LINK(this, TableDesignPane, implValueSetHdl)); - mxControls[FL_STYLE_OPTIONS].reset( new FixedLine( pControlParent, SdResId( FL_STYLE_OPTIONS + 1 ) ) ); + // mxControls[FL_STYLE_OPTIONS].reset( new FixedLine( pControlParent, SdResId( FL_STYLE_OPTIONS + 1 ) ) ); sal_uInt16 i; for( i = CB_HEADER_ROW; i <= CB_BANDED_COLUMNS; ++i ) { @@ -123,7 +123,14 @@ TableDesignPane::TableDesignPane( ::Window* pParent, ViewShellBase& rBase, bool } for( i = 0; i < DESIGNPANE_CONTROL_COUNT; i++ ) - mnOrgOffsetY[i] = mxControls[i]->GetPosPixel().Y(); + { + if (mxControls[i]) + mnOrgOffsetY[i] = mxControls[i]->GetPosPixel().Y(); + else if (i > 0) + mnOrgOffsetY[i] = mnOrgOffsetY[i-1]; + else + mnOrgOffsetY[i] = 0; + } // get current controller and initialize listeners try @@ -170,6 +177,60 @@ void TableDesignPane::Resize() updateLayout(); } + + + +LayoutSize TableDesignPane::GetHeightForWidth (const sal_Int32 nWidth) +{ + if ( ! IsVisible() || nWidth<=0) + return LayoutSize(0,0,0); + + // Initialize the height with the offset above and below the value + // set and below the check boxes. + const Point aOffset (LogicToPixel( Point(3,3), MAP_APPFONT)); + sal_Int32 nHeight (3 * aOffset.Y()); + + // Add the height for the check boxes. + nHeight += mnOrgOffsetY[CB_BANDED_COLUMNS] - mnOrgOffsetY[CB_HEADER_ROW] + + mxControls[CB_BANDED_COLUMNS]->GetSizePixel().Height(); + + // Setup minimal and maximal heights that include all check boxes + // and a small or large value set. + const sal_Int32 nMinimalHeight (nHeight+100); + const sal_Int32 nMaximalHeight (nHeight+450); + + // Calculate the number of rows and columns and then add the + // preferred size of the value set. + ValueSet* pValueSet = static_cast< ValueSet* >( mxControls[CT_TABLE_STYLES].get() ); + if (pValueSet->GetItemCount() > 0) + { + Image aImage = pValueSet->GetItemImage(pValueSet->GetItemId(0)); + Size aItemSize = pValueSet->CalcItemSizePixel(aImage.GetSizePixel()); + aItemSize.Width() += 10; + aItemSize.Height() += 10; + + int nColumnCount = (pValueSet->GetSizePixel().Width() - pValueSet->GetScrollWidth()) / aItemSize.Width(); + if (nColumnCount < 1) + nColumnCount = 1; + + int nRowCount = (pValueSet->GetItemCount() + nColumnCount - 1) / nColumnCount; + if (nRowCount < 1) + nRowCount = 1; + + nHeight += nRowCount * aItemSize.Height(); + } + + // Clip the requested height. + if (nHeight<nMinimalHeight) + nHeight = nMinimalHeight; + else if (nHeight>nMaximalHeight) + nHeight = nMaximalHeight; + return LayoutSize(nMinimalHeight, nMaximalHeight, nHeight); +} + + + + // -------------------------------------------------------------------- static SfxBindings* getBindings( ViewShellBase& rBase ) @@ -366,16 +427,19 @@ void TableDesignPane::updateLayout() const long nStylesHeight = aPaneSize.Height() - nOptionsHeight; - // set with of controls to size of pane + // set width of controls to size of pane for( sal_Int32 nId = 0; nId < DESIGNPANE_CONTROL_COUNT; ++nId ) { - Size aSize( mxControls[nId]->GetSizePixel() ); - aSize.Width() = aPaneSize.Width() - aOffset.X() - mxControls[nId]->GetPosPixel().X(); - mxControls[nId]->SetSizePixel( aSize ); - mxControls[nId]->SetPaintTransparent(sal_True); - mxControls[nId]->SetBackground(); + if (mxControls[nId]) + { + Size aSize( mxControls[nId]->GetSizePixel() ); + aSize.Width() = aPaneSize.Width() - aOffset.X() - mxControls[nId]->GetPosPixel().X(); + mxControls[nId]->SetSizePixel( aSize ); + mxControls[nId]->SetPaintTransparent(sal_True); + mxControls[nId]->SetBackground(); + } } - aValueSetSize = Size( pValueSet->GetSizePixel().Width(), nStylesHeight - mxControls[FL_TABLE_STYLES]->GetSizePixel().Height() - mnOrgOffsetY[FL_TABLE_STYLES] ); + aValueSetSize = Size( pValueSet->GetSizePixel().Width(), nStylesHeight ); } else { @@ -437,18 +501,22 @@ void TableDesignPane::updateLayout() // shift show options section down const long nOptionsPos = aPos.Y() + aValueSetSize.Height(); - for( sal_Int32 nId = FL_STYLE_OPTIONS; nId <= CB_BANDED_COLUMNS; ++nId ) + sal_Int32 nMaxY (0); + for( sal_Int32 nId = FL_STYLE_OPTIONS+1; nId <= CB_BANDED_COLUMNS; ++nId ) { - Point aCPos( mxControls[nId]->GetPosPixel() ); - aCPos.X() = ( nId == FL_STYLE_OPTIONS ? 1 : 2 ) * aOffset.X(); - aCPos.Y() = mnOrgOffsetY[nId] + nOptionsPos; - mxControls[nId]->SetPosPixel( aCPos ); + if (mxControls[nId]) + { + Point aCPos( mxControls[nId]->GetPosPixel() ); + aCPos.X() = ( nId == FL_STYLE_OPTIONS ? 1 : 2 ) * aOffset.X(); + aCPos.Y() = mnOrgOffsetY[nId] + nOptionsPos; + mxControls[nId]->SetPosPixel( aCPos ); + const sal_Int32 nBottom (aCPos.Y() + mxControls[nId]->GetSizePixel().Height()); + if (nBottom > nMaxY) + nMaxY = nBottom; + } } } } - - if( !mbModal ) - SetBackground( GetSettings().GetStyleSettings().GetWindowColor() ); } // -------------------------------------------------------------------- diff --git a/sd/source/ui/table/TableDesignPane.hxx b/sd/source/ui/table/TableDesignPane.hxx index 021bddc55161..671753f684e0 100644 --- a/sd/source/ui/table/TableDesignPane.hxx +++ b/sd/source/ui/table/TableDesignPane.hxx @@ -22,12 +22,14 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/ui/XUIElement.hpp> +#include <com/sun/star/ui/LayoutSize.hpp> #include <com/sun/star/drawing/XDrawView.hpp> #include <com/sun/star/container/XIndexAccess.hpp> #include <vcl/dialog.hxx> #include <vcl/fixed.hxx> #include <vcl/button.hxx> +#include <sfx2/sidebar/ILayoutableWindow.hxx> #include <boost/scoped_ptr.hpp> @@ -44,7 +46,7 @@ class ViewShellBase; // -------------------------------------------------------------------- -class TableDesignPane : public Control +class TableDesignPane : public Control, public sfx2::sidebar::ILayoutableWindow { public: TableDesignPane( ::Window* pParent, ViewShellBase& rBase, bool bModal ); @@ -56,6 +58,9 @@ public: // Control virtual void Resize(); + // ILayoutableWindow + virtual ::com::sun::star::ui::LayoutSize GetHeightForWidth (const sal_Int32 nWidth); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); void ApplyOptions(); diff --git a/sd/source/ui/table/TableDesignPane.src b/sd/source/ui/table/TableDesignPane.src index c36f43a60dac..c058d6370d0e 100644 --- a/sd/source/ui/table/TableDesignPane.src +++ b/sd/source/ui/table/TableDesignPane.src @@ -26,7 +26,7 @@ Control DLG_TABLEDESIGNPANE DialogControl = TRUE; Border = FALSE; - Size = MAP_APPFONT( 264, 160 ); + Size = MAP_APPFONT( 264, 134 ); Text [ en-US ] = "Table Design"; FixedLine FL_STYLE_OPTIONS+1 @@ -39,7 +39,7 @@ Control DLG_TABLEDESIGNPANE CheckBox CB_HEADER_ROW+1 { - Pos = MAP_APPFONT ( 146, 16 ) ; + Pos = MAP_APPFONT ( 146, 3 ) ; Size = MAP_APPFONT ( 120 , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "~Header Row" ; @@ -47,7 +47,7 @@ Control DLG_TABLEDESIGNPANE CheckBox CB_TOTAL_ROW+1 { - Pos = MAP_APPFONT ( 146, 29 ) ; + Pos = MAP_APPFONT ( 146, 16 ) ; Size = MAP_APPFONT ( 120 , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "Tot~al Row" ; @@ -55,7 +55,7 @@ Control DLG_TABLEDESIGNPANE CheckBox CB_BANDED_ROWS+1 { - Pos = MAP_APPFONT ( 146, 42 ) ; + Pos = MAP_APPFONT ( 146, 29 ) ; Size = MAP_APPFONT ( 120 , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "~Banded Rows" ; @@ -63,7 +63,7 @@ Control DLG_TABLEDESIGNPANE CheckBox CB_FIRST_COLUMN+1 { - Pos = MAP_APPFONT ( 146, 55 ) ; + Pos = MAP_APPFONT ( 146, 42 ) ; Size = MAP_APPFONT ( 120 , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "Fi~rst Column" ; @@ -71,7 +71,7 @@ Control DLG_TABLEDESIGNPANE CheckBox CB_LAST_COLUMN+1 { - Pos = MAP_APPFONT ( 146, 68 ) ; + Pos = MAP_APPFONT ( 146, 55 ) ; Size = MAP_APPFONT ( 120 , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "~Last Column" ; @@ -79,7 +79,7 @@ Control DLG_TABLEDESIGNPANE CheckBox CB_BANDED_COLUMNS+1 { - Pos = MAP_APPFONT ( 146, 82 ) ; + Pos = MAP_APPFONT ( 146, 68 ) ; Size = MAP_APPFONT ( 120 , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "Ba~nded Columns" ; @@ -95,7 +95,7 @@ Control DLG_TABLEDESIGNPANE Control CT_TABLE_STYLES+1 { - Pos = MAP_APPFONT ( 6, 14 ) ; + Pos = MAP_APPFONT ( 4, 3 ) ; Size = MAP_APPFONT( 120, 143 ); Border = TRUE ; TabStop = TRUE ; diff --git a/sd/source/ui/table/tablefunction.cxx b/sd/source/ui/table/tablefunction.cxx index 950949cdbf6c..77de56c68ab8 100644 --- a/sd/source/ui/table/tablefunction.cxx +++ b/sd/source/ui/table/tablefunction.cxx @@ -197,7 +197,7 @@ void DrawViewShell::FuTable(SfxRequest& rReq) { // Make the slide transition panel visible (expand it) in the // tool pane. - framework::FrameworkHelper::Instance(GetViewShellBase())->RequestTaskPanel( + framework::FrameworkHelper::Instance(GetViewShellBase())->RequestSidebarPanel( framework::FrameworkHelper::msTableDesignPanelURL); } diff --git a/sd/source/ui/table/tableobjectbar.cxx b/sd/source/ui/table/tableobjectbar.cxx index 2291839bc63f..24bb21ca19ac 100644 --- a/sd/source/ui/table/tableobjectbar.cxx +++ b/sd/source/ui/table/tableobjectbar.cxx @@ -26,6 +26,7 @@ #include <sfx2/viewfrm.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/msgpool.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include <svl/whiter.hxx> #include <svl/itempool.hxx> #include <svx/svdomedia.hxx> @@ -98,6 +99,7 @@ TableObjectBar::TableObjectBar( ViewShell* pSdViewShell, ::sd::View* pSdView ) SetRepeatTarget( mpView ); SetHelpId( SD_IF_SDDRAWTABLEOBJECTBAR ); SetName( String( SdResId( RID_DRAW_TABLE_TOOLBOX ) ) ); + SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Table)); } // ----------------------------------------------------------------------------- @@ -197,6 +199,8 @@ void TableObjectBar::Execute( SfxRequest& rReq ) pBindings->Invalidate( SID_FRAME_LINECOLOR ); pBindings->Invalidate( SID_ATTR_BORDER ); pBindings->Invalidate( SID_ATTR_FILL_STYLE ); + pBindings->Invalidate( SID_ATTR_FILL_TRANSPARENCE ); + pBindings->Invalidate( SID_ATTR_FILL_FLOATTRANSPARENCE ); pBindings->Invalidate( SID_TABLE_MERGE_CELLS ); pBindings->Invalidate( SID_TABLE_SPLIT_CELLS ); pBindings->Invalidate( SID_OPTIMIZE_TABLE ); diff --git a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx index 1d43547aac01..6d5878b899e1 100644 --- a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx +++ b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx @@ -410,7 +410,7 @@ void ToolPanelViewShell_Impl::Setup() else { ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( GetAntiImpl().GetViewShellBase() ) ); - pFrameworkHelper->RequestTaskPanel( aInitialPanel.sPanelResourceURL ); + pFrameworkHelper->RequestSidebarPanel( aInitialPanel.sPanelResourceURL ); // MMeeks } } @@ -804,7 +804,7 @@ void ToolPanelViewShell_Impl::ActivePanelChanged( const ::boost::optional< size_ { // activate the resource belonging to the new panel. This will automatically de-activate the previously active // panel resource (since ResourceActivationMode_REPLACE is used) - pFrameworkHelper->RequestTaskPanel( sNewPanelURL ); + pFrameworkHelper->RequestSidebarPanel( sNewPanelURL ); // MMeeks } else if ( !sOldPanelURL.isEmpty() ) { diff --git a/sd/source/ui/unoidl/facreg.cxx b/sd/source/ui/unoidl/facreg.cxx index d3cdfc9b287b..df50159dc2e7 100644 --- a/sd/source/ui/unoidl/facreg.cxx +++ b/sd/source/ui/unoidl/facreg.cxx @@ -113,13 +113,6 @@ extern OUString BasicViewFactory_getImplementationName(void) throw (uno::Runtime extern uno::Sequence<OUString> SAL_CALL BasicViewFactory_getSupportedServiceNames (void) throw (uno::RuntimeException); -extern uno::Reference<uno::XInterface> SAL_CALL TaskPanelFactory_createInstance( - const uno::Reference<uno::XComponentContext>& rxContext) - throw(uno::Exception); -extern OUString TaskPanelFactory_getImplementationName(void) throw (uno::RuntimeException); -extern uno::Sequence<OUString> SAL_CALL TaskPanelFactory_getSupportedServiceNames (void) - throw (uno::RuntimeException); - extern uno::Reference<uno::XInterface> SAL_CALL ResourceId_createInstance( const uno::Reference<uno::XComponentContext>& rxContext) throw(uno::Exception); @@ -136,14 +129,13 @@ extern uno::Sequence<OUString> SAL_CALL PresentationFactoryProvider_getSupported throw (uno::RuntimeException); } } +namespace sd { namespace sidebar { -namespace sd { namespace toolpanel { - -extern uno::Reference<uno::XInterface> SAL_CALL ToolPanelFactory_createInstance( +extern uno::Reference<uno::XInterface> SAL_CALL PanelFactory_createInstance( const uno::Reference<uno::XComponentContext>& rxContext) throw(uno::Exception); -extern OUString ToolPanelFactory_getImplementationName(void) throw (uno::RuntimeException); -extern uno::Sequence<OUString> SAL_CALL ToolPanelFactory_getSupportedServiceNames (void) +extern OUString PanelFactory_getImplementationName(void) throw (uno::RuntimeException); +extern uno::Sequence<OUString> SAL_CALL PanelFactory_getSupportedServiceNames (void) throw (uno::RuntimeException); } } @@ -205,7 +197,7 @@ using namespace ::sd; using namespace ::sd::framework; using namespace ::sd::presenter; using namespace ::sd::slidesorter; -using namespace ::sd::toolpanel; +using namespace ::sd::sidebar; @@ -228,8 +220,7 @@ enum FactoryId BasicPaneFactoryFactoryId, BasicToolBarFactoryFactoryId, BasicViewFactoryFactoryId, - TaskPanelFactoryFactoryId, - ToolPanelFactoryFactoryId, + PanelFactoryFactoryId, ResourceIdFactoryId, PresentationFactoryProviderFactoryId, SlideRendererFactoryId, @@ -262,8 +253,7 @@ static ::boost::shared_ptr<FactoryMap> spFactoryMap; (*spFactoryMap)[BasicPaneFactory_getImplementationName()] = BasicPaneFactoryFactoryId; (*spFactoryMap)[BasicToolBarFactory_getImplementationName()] = BasicToolBarFactoryFactoryId; (*spFactoryMap)[BasicViewFactory_getImplementationName()] = BasicViewFactoryFactoryId; - (*spFactoryMap)[TaskPanelFactory_getImplementationName()] = TaskPanelFactoryFactoryId; - (*spFactoryMap)[ToolPanelFactory_getImplementationName()] = ToolPanelFactoryFactoryId; + (*spFactoryMap)[sidebar::PanelFactory_getImplementationName()] = PanelFactoryFactoryId; (*spFactoryMap)[ResourceId_getImplementationName()] = ResourceIdFactoryId; (*spFactoryMap)[PresentationFactoryProvider_getImplementationName()] = PresentationFactoryProviderFactoryId; (*spFactoryMap)[SlideRenderer_getImplementationName()] = SlideRendererFactoryId; @@ -386,18 +376,11 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL sd_component_getFactory( sd::framework::BasicViewFactory_getSupportedServiceNames()); break; - case TaskPanelFactoryFactoryId: - xComponentFactory = ::cppu::createSingleComponentFactory( - sd::framework::TaskPanelFactory_createInstance, - sd::framework::TaskPanelFactory_getImplementationName(), - sd::framework::TaskPanelFactory_getSupportedServiceNames()); - break; - - case ToolPanelFactoryFactoryId: + case PanelFactoryFactoryId: xComponentFactory = ::cppu::createSingleComponentFactory( - sd::toolpanel::ToolPanelFactory_createInstance, - sd::toolpanel::ToolPanelFactory_getImplementationName(), - sd::toolpanel::ToolPanelFactory_getSupportedServiceNames()); + sd::sidebar::PanelFactory_createInstance, + sd::sidebar::PanelFactory_getImplementationName(), + sd::sidebar::PanelFactory_getSupportedServiceNames()); break; case ResourceIdFactoryId: diff --git a/sd/source/ui/view/ToolBarManager.cxx b/sd/source/ui/view/ToolBarManager.cxx index 578561a3fa27..c5be674a8b3c 100644 --- a/sd/source/ui/view/ToolBarManager.cxx +++ b/sd/source/ui/view/ToolBarManager.cxx @@ -1199,7 +1199,7 @@ void ToolBarRules::MainViewShellChanged (ViewShell::ShellType nShellType) case ViewShell::ST_NONE: case ViewShell::ST_PRESENTATION: - case ViewShell::ST_TASK_PANE: + case ViewShell::ST_SIDEBAR: default: break; } diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index 09006ed1f38e..3348c198ff76 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -54,7 +54,7 @@ #include "PresentationViewShell.hxx" #include "FormShellManager.hxx" #include "ToolBarManager.hxx" -#include "taskpane/PanelId.hxx" +#include "SidebarPanelId.hxx" #include "Window.hxx" #include "framework/ConfigurationController.hxx" #include "DocumentRenderer.hxx" @@ -697,13 +697,6 @@ void ViewShellBase::Execute (SfxRequest& rRequest) framework::FrameworkHelper::msSlideSorterURL); break; - case SID_TASKPANE: - mpImpl->SetPaneVisibility( - rRequest, - framework::FrameworkHelper::msRightPaneURL, - framework::FrameworkHelper::msTaskPaneURL); - break; - case SID_NORMAL_MULTI_PANE_GUI: case SID_SLIDE_SORTER_MULTI_PANE_GUI: case SID_DRAWINGMODE: @@ -1394,11 +1387,6 @@ void ViewShellBase::Implementation::GetSlotState (SfxItemSet& rSet) xContext, FrameworkHelper::msLeftDrawPaneURL); break; - case SID_TASKPANE: - xResourceId = ResourceId::create( - xContext, FrameworkHelper::msRightPaneURL); - break; - case SID_NORMAL_MULTI_PANE_GUI: xResourceId = ResourceId::createWithAnchorURL( xContext, @@ -1497,8 +1485,7 @@ void ViewShellBase::Implementation::ProcessTaskPaneSlot (SfxRequest& rRequest) { // Set the visibility state of the toolpanel and one of its top // level panels. - toolpanel::PanelId nPanelId ( - toolpanel::PID_UNKNOWN); + sidebar::PanelId nPanelId (sidebar::PID_UNKNOWN); bool bPanelIdGiven = false; // Extract the given arguments. @@ -1511,9 +1498,7 @@ void ViewShellBase::Implementation::ProcessTaskPaneSlot (SfxRequest& rRequest) ID_VAL_PANEL_INDEX, sal_False); if (pPanelId != NULL) { - nPanelId = static_cast< - toolpanel::PanelId>( - pPanelId->GetValue()); + nPanelId = static_cast<sidebar::PanelId>(pPanelId->GetValue()); bPanelIdGiven = true; } } @@ -1522,11 +1507,11 @@ void ViewShellBase::Implementation::ProcessTaskPaneSlot (SfxRequest& rRequest) // Ignore the request for some combinations of panels and view // shell types. if (bPanelIdGiven - && ! (nPanelId==toolpanel::PID_LAYOUT + && ! (nPanelId==sidebar::PID_LAYOUT && mrBase.GetMainViewShell()!=NULL && mrBase.GetMainViewShell()->GetShellType()==ViewShell::ST_OUTLINE)) { - framework::FrameworkHelper::Instance(mrBase)->RequestTaskPanel( + framework::FrameworkHelper::Instance(mrBase)->RequestSidebarPanel( framework::FrameworkHelper::msLayoutTaskPanelURL); } } diff --git a/sd/source/ui/view/ViewShellImplementation.cxx b/sd/source/ui/view/ViewShellImplementation.cxx index cea72846ce1d..84c31813b5d8 100644 --- a/sd/source/ui/view/ViewShellImplementation.cxx +++ b/sd/source/ui/view/ViewShellImplementation.cxx @@ -40,7 +40,7 @@ #include "FrameView.hxx" #include "DrawViewShell.hxx" #include "ViewShellHint.hxx" -#include "taskpane/PanelId.hxx" +#include "SidebarPanelId.hxx" #include "framework/FrameworkHelper.hxx" #include <sfx2/bindings.hxx> @@ -126,8 +126,7 @@ void ViewShell::Implementation::ProcessModifyPageSlot ( // Make the layout menu visible in the tool pane. SfxBoolItem aMakeToolPaneVisible (ID_VAL_ISVISIBLE, sal_True); - SfxUInt32Item aPanelId (ID_VAL_PANEL_INDEX, - ::sd::toolpanel::PID_LAYOUT); + SfxUInt32Item aPanelId (ID_VAL_PANEL_INDEX, sidebar::PID_LAYOUT); SfxViewFrame* pFrame = mrViewShell.GetViewFrame(); if (pFrame!=NULL && pFrame->GetDispatcher()!=NULL) { @@ -331,7 +330,7 @@ sal_uInt16 ViewShell::Implementation::GetViewId (void) // Since we have to return a view id for every possible shell type // and there is not (yet) a proper ViewShellBase sub class for the // remaining types we chose the Impress factory as a fall back. - case ViewShell::ST_TASK_PANE: + case ViewShell::ST_SIDEBAR: case ViewShell::ST_NONE: default: return IMPRESS_FACTORY_ID; diff --git a/sd/source/ui/view/ViewShellManager.cxx b/sd/source/ui/view/ViewShellManager.cxx index 109da58163c0..a6393d8a523d 100644 --- a/sd/source/ui/view/ViewShellManager.cxx +++ b/sd/source/ui/view/ViewShellManager.cxx @@ -53,6 +53,8 @@ public: SfxShell* mpShell; ShellId mnId; ViewShellManager::SharedShellFactory mpFactory; + bool mbIsListenerAddedToWindow; + ShellDescriptor (); ShellDescriptor (SfxShell* pShell, ShellId nId); ShellDescriptor (const ShellDescriptor& rDescriptor); @@ -233,7 +235,7 @@ private: ShellId nShellId, ::Window* pParentWindow, FrameView* pFrameView); - void DestroyViewShell (const ShellDescriptor& rDescriptor); + void DestroyViewShell (ShellDescriptor& rDescriptor); void DestroySubShell ( const SfxShell& rViewShell, const ShellDescriptor& rDescriptor); @@ -511,8 +513,11 @@ void ViewShellManager::Implementation::ActivateViewShell (ViewShell* pViewShell) { ::Window* pWindow = aResult.GetWindow(); if (pWindow != NULL) + { pWindow->AddEventListener( LINK(this, ViewShellManager::Implementation, WindowEventHandler)); + aResult.mbIsListenerAddedToWindow = true; + } else { DBG_ASSERT(false, @@ -1160,6 +1165,23 @@ IMPL_LINK(ViewShellManager::Implementation, WindowEventHandler, VclWindowEvent*, case VCLEVENT_WINDOW_LOSEFOCUS: break; + + case VCLEVENT_OBJECT_DYING: + // Remember that we do not have to remove the window + // listener for this window. + for (ActiveShellList::iterator + iShell(maActiveViewShells.begin()), + iEnd(maActiveViewShells.end()); + iShell!=iEnd; + ++iShell) + { + if (iShell->GetWindow() == pEventWindow) + { + iShell->mbIsListenerAddedToWindow = false; + break; + } + } + break; } } return sal_True; @@ -1204,15 +1226,19 @@ ShellDescriptor ViewShellManager::Implementation::CreateSubShell ( void ViewShellManager::Implementation::DestroyViewShell ( - const ShellDescriptor& rDescriptor) + ShellDescriptor& rDescriptor) { OSL_ASSERT(rDescriptor.mpShell != NULL); - ::Window* pWindow = rDescriptor.GetWindow(); - if (pWindow != NULL) + if (rDescriptor.mbIsListenerAddedToWindow) { - pWindow->RemoveEventListener( - LINK(this, ViewShellManager::Implementation, WindowEventHandler)); + rDescriptor.mbIsListenerAddedToWindow = false; + ::Window* pWindow = rDescriptor.GetWindow(); + if (pWindow != NULL) + { + pWindow->RemoveEventListener( + LINK(this, ViewShellManager::Implementation, WindowEventHandler)); + } } // Destroy the sub shell factories. @@ -1374,7 +1400,8 @@ namespace { ShellDescriptor::ShellDescriptor (void) : mpShell(NULL), mnId(0), - mpFactory() + mpFactory(), + mbIsListenerAddedToWindow(false) { } @@ -1386,7 +1413,8 @@ ShellDescriptor::ShellDescriptor ( ShellId nId) : mpShell(pShell), mnId(nId), - mpFactory() + mpFactory(), + mbIsListenerAddedToWindow(false) { } @@ -1394,9 +1422,10 @@ ShellDescriptor::ShellDescriptor ( ShellDescriptor::ShellDescriptor (const ShellDescriptor& rDescriptor) - : mpShell(rDescriptor.mpShell), - mnId(rDescriptor.mnId), - mpFactory(rDescriptor.mpFactory) + : mpShell(rDescriptor.mpShell), + mnId(rDescriptor.mnId), + mpFactory(rDescriptor.mpFactory), + mbIsListenerAddedToWindow(rDescriptor.mbIsListenerAddedToWindow) { } @@ -1405,9 +1434,13 @@ ShellDescriptor::ShellDescriptor (const ShellDescriptor& rDescriptor) ShellDescriptor& ShellDescriptor::operator= (const ShellDescriptor& rDescriptor) { - mpShell = rDescriptor.mpShell; - mnId = rDescriptor.mnId; - mpFactory = rDescriptor.mpFactory; + if (this != &rDescriptor) + { + mpShell = rDescriptor.mpShell; + mnId = rDescriptor.mnId; + mpFactory = rDescriptor.mpFactory; + mbIsListenerAddedToWindow = rDescriptor.mbIsListenerAddedToWindow; + } return *this; } diff --git a/sd/source/ui/view/drtxtob.cxx b/sd/source/ui/view/drtxtob.cxx index f285f815ad96..d65fa4320775 100644 --- a/sd/source/ui/view/drtxtob.cxx +++ b/sd/source/ui/view/drtxtob.cxx @@ -30,6 +30,7 @@ #include <editeng/editeng.hxx> #include <editeng/outliner.hxx> #include <editeng/unolingu.hxx> +#include <editeng/kernitem.hxx> #include <vcl/vclenum.hxx> #include <sfx2/app.hxx> #include <svl/whiter.hxx> @@ -128,10 +129,30 @@ TextObjectBar::~TextObjectBar() SetRepeatTarget(NULL); } +void TextObjectBar::GetCharState( SfxItemSet& rSet ) +{ + SfxItemSet aCharAttrSet( mpView->GetDoc().GetPool() ); + mpView->GetAttributes( aCharAttrSet ); + + SfxItemSet aNewAttr( mpViewShell->GetPool(),EE_ITEMS_START,EE_ITEMS_END); + + aNewAttr.Put(aCharAttrSet, sal_False); + rSet.Put(aNewAttr, sal_False); + + SvxKerningItem aKern = ( (const SvxKerningItem&) aCharAttrSet.Get( EE_CHAR_KERNING ) ); + //aKern.SetWhich(SID_ATTR_CHAR_KERNING); + rSet.Put(aKern); + + SfxItemState eState = aCharAttrSet.GetItemState( EE_CHAR_KERNING, sal_True ); + if ( eState == SFX_ITEM_DONTCARE ) + { + rSet.InvalidateItem(EE_CHAR_KERNING); + } +} + /** * Status of attribute items. */ - void TextObjectBar::GetAttrState( SfxItemSet& rSet ) { SfxWhichIter aIter( rSet ); @@ -155,6 +176,8 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet ) case SID_ATTR_CHAR_FONTHEIGHT: case SID_ATTR_CHAR_WEIGHT: case SID_ATTR_CHAR_POSTURE: + case SID_ATTR_CHAR_SHADOWED: + case SID_ATTR_CHAR_STRIKEOUT: { sal_uInt16 stretchX = 100; sal_uInt16 stretchY = 100; @@ -452,6 +475,8 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet ) } // paragraph justification + SvxLRSpaceItem aLR = ( (const SvxLRSpaceItem&) aAttrSet.Get( EE_PARA_LRSPACE ) ); + rSet.Put(aLR); SvxAdjust eAdj = ( (const SvxAdjustItem&) aAttrSet.Get( EE_PARA_JUST ) ).GetAdjust(); switch( eAdj ) { @@ -471,6 +496,13 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet ) break; } + Invalidate(SID_ATTR_PARA_ADJUST_LEFT); + Invalidate(SID_ATTR_PARA_ADJUST_CENTER); + Invalidate(SID_ATTR_PARA_ADJUST_RIGHT); + Invalidate(SID_ATTR_PARA_ADJUST_BLOCK); + Invalidate(SID_ATTR_PARA_LINESPACE); + Invalidate(SID_ATTR_PARA_ULSPACE); + // paragraph text direction if( bDisableParagraphTextDirection ) { @@ -519,6 +551,17 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet ) } } + SvxLRSpaceItem aLRSpace = ( (const SvxLRSpaceItem&) aAttrSet.Get( EE_PARA_LRSPACE ) ); + aLRSpace.SetWhich(SID_ATTR_PARA_LRSPACE); + rSet.Put(aLRSpace); + Invalidate(SID_ATTR_PARA_LRSPACE); + //Added by xuxu + SfxItemState eState = aAttrSet.GetItemState( EE_PARA_LRSPACE ); + if ( eState == SFX_ITEM_DONTCARE ) + { + rSet.InvalidateItem(EE_PARA_LRSPACE); + rSet.InvalidateItem(SID_ATTR_PARA_LRSPACE); + } sal_uInt16 nLineSpace = (sal_uInt16) ( (const SvxLineSpacingItem&) aAttrSet. Get( EE_PARA_SBL ) ).GetPropLineSpace(); switch( nLineSpace ) diff --git a/sd/source/ui/view/drtxtob1.cxx b/sd/source/ui/view/drtxtob1.cxx index 9d5cf273e53e..04137a3ee153 100644 --- a/sd/source/ui/view/drtxtob1.cxx +++ b/sd/source/ui/view/drtxtob1.cxx @@ -228,6 +228,7 @@ void TextObjectBar::Execute( SfxRequest &rReq ) break; case SID_OUTLINE_LEFT: + case SID_ATTR_PARA_LEFT: { if (pOLV) { @@ -243,6 +244,7 @@ void TextObjectBar::Execute( SfxRequest &rReq ) break; case SID_OUTLINE_RIGHT: + case SID_ATTR_PARA_RIGHT: { if (pOLV) { @@ -257,6 +259,22 @@ void TextObjectBar::Execute( SfxRequest &rReq ) } break; + case SID_ATTR_PARA_LRSPACE: + { + sal_uInt16 nSpaceSlot = SID_ATTR_PARA_LRSPACE; + SvxLRSpaceItem aLRSpace = (const SvxLRSpaceItem&)pArgs->Get( + GetPool().GetWhich(nSpaceSlot)); + + SfxItemSet aEditAttr( GetPool(), EE_PARA_LRSPACE, EE_PARA_LRSPACE ); + aLRSpace.SetWhich( EE_PARA_LRSPACE ); + + aEditAttr.Put( aLRSpace ); + mpView->SetAttributes( aEditAttr ); + + Invalidate(SID_ATTR_PARA_LRSPACE); + } + break; + case SID_OUTLINE_UP: { if (pOLV) @@ -558,6 +576,71 @@ void TextObjectBar::Execute( SfxRequest &rReq ) rReq.Done( aNewAttr ); pArgs = rReq.GetArgs(); } + else if (nSlot == SID_ATTR_PARA_ADJUST_LEFT || + nSlot == SID_ATTR_PARA_ADJUST_CENTER || + nSlot == SID_ATTR_PARA_ADJUST_RIGHT || + nSlot == SID_ATTR_PARA_ADJUST_BLOCK) + { + switch( nSlot ) + { + case SID_ATTR_PARA_ADJUST_LEFT: + { + aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_LEFT, EE_PARA_JUST ) ); + } + break; + case SID_ATTR_PARA_ADJUST_CENTER: + { + aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_CENTER, EE_PARA_JUST ) ); + } + break; + case SID_ATTR_PARA_ADJUST_RIGHT: + { + aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_RIGHT, EE_PARA_JUST ) ); + } + break; + case SID_ATTR_PARA_ADJUST_BLOCK: + { + aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_BLOCK, EE_PARA_JUST ) ); + } + break; + } + rReq.Done( aNewAttr ); + pArgs = rReq.GetArgs(); + } + else if(nSlot == SID_ATTR_CHAR_KERNING) + { + aNewAttr.Put(pArgs->Get(pArgs->GetPool()->GetWhich(nSlot))); + rReq.Done( aNewAttr ); + pArgs = rReq.GetArgs(); + } + else if(nSlot == SID_SET_SUPER_SCRIPT ) + { + SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT); + SvxEscapement eEsc = (SvxEscapement) ( (const SvxEscapementItem&) + aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue(); + + if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT ) + aItem.SetEscapement( SVX_ESCAPEMENT_OFF ); + else + aItem.SetEscapement( SVX_ESCAPEMENT_SUPERSCRIPT ); + aNewAttr.Put( aItem ); + rReq.Done( aNewAttr ); + pArgs = rReq.GetArgs(); + } + else if( nSlot == SID_SET_SUB_SCRIPT ) + { + SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT); + SvxEscapement eEsc = (SvxEscapement) ( (const SvxEscapementItem&) + aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue(); + + if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT ) + aItem.SetEscapement( SVX_ESCAPEMENT_OFF ); + else + aItem.SetEscapement( SVX_ESCAPEMENT_SUBSCRIPT ); + aNewAttr.Put( aItem ); + rReq.Done( aNewAttr ); + pArgs = rReq.GetArgs(); + } mpView->SetAttributes(*pArgs); diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index de3c663c994f..e5c12ca7dbee 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -83,6 +83,26 @@ #include <vcl/svapp.hxx> #include <vcl/waitobj.hxx> +#include <editeng/escapementitem.hxx> +#include <editeng/kernitem.hxx> +#include <editeng/wghtitem.hxx> +#include <editeng/postitem.hxx> +#include <editeng/udlnitem.hxx> +#include <editeng/crossedoutitem.hxx> +#include <editeng/contouritem.hxx> +#include <editeng/shdditem.hxx> +#include <svx/xtable.hxx> +#include <svx/svdobj.hxx> +#include <editeng/outlobj.hxx> +#include <editeng/flstitem.hxx> +#include <editeng/scripttypeitem.hxx> +#include <editeng/fontitem.hxx> +#include <editeng/fhgtitem.hxx> +#include <editeng/colritem.hxx> +#include <editeng/brushitem.hxx> + +#include <svl/whiter.hxx> + #include "app.hrc" #include "glob.hrc" #include "strings.hrc" @@ -131,6 +151,7 @@ #include "futransf.hxx" #include "futxtatt.hxx" #include "fuvect.hxx" +#include "futext.hxx" #include "fuzoom.hxx" #include "helpids.h" #include "optsitem.hxx" @@ -237,12 +258,19 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) case SID_ATTR_FILL_HATCH: case SID_ATTR_FILL_BITMAP: case SID_ATTR_FILL_SHADOW: + case SID_ATTR_FILL_TRANSPARENCE: + case SID_ATTR_FILL_FLOATTRANSPARENCE: case SID_ATTR_LINE_STYLE: case SID_ATTR_LINE_DASH: case SID_ATTR_LINE_WIDTH: case SID_ATTR_LINE_COLOR: case SID_ATTR_LINEEND_STYLE: + case SID_ATTR_LINE_START: + case SID_ATTR_LINE_END: + case SID_ATTR_LINE_TRANSPARENCE: + case SID_ATTR_LINE_JOINT: + case SID_ATTR_LINE_CAP: case SID_ATTR_TEXT_FITTOSIZE: { @@ -389,12 +417,17 @@ void DrawViewShell::FuTemporary(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: GetViewFrame()->GetDispatcher()->Execute( SID_ATTRIBUTES_AREA, SFX_CALLMODE_ASYNCHRON ); 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: GetViewFrame()->GetDispatcher()->Execute( SID_ATTRIBUTES_LINE, SFX_CALLMODE_ASYNCHRON ); break; case SID_ATTR_TEXT_FITTOSIZE: @@ -1143,6 +1176,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) } break; + case SID_CHAR_DLG_EFFECT: case SID_CHAR_DLG: // BASIC { SetCurrentFunction( FuChar::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) ); @@ -1157,7 +1191,25 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) } break; + case FN_NUM_BULLET_ON: + { + // The value (sal_uInt16)0xFFFF means set bullet on/off. + SfxUInt16Item aItem(FN_SVX_SET_BULLET, (sal_uInt16)0xFFFF); + GetViewFrame()->GetDispatcher()->Execute( FN_SVX_SET_BULLET, SFX_CALLMODE_RECORD, &aItem, 0L ); + } + break; + + case FN_NUM_NUMBERING_ON: + { + // The value (sal_uInt16)0xFFFF means set bullet on/off. + SfxUInt16Item aItem(FN_SVX_SET_NUMBER, (sal_uInt16)0xFFFF); + GetViewFrame()->GetDispatcher()->Execute( FN_SVX_SET_NUMBER, SFX_CALLMODE_RECORD, &aItem, 0L ); + } + break; + case SID_OUTLINE_BULLET: + case FN_SVX_SET_BULLET: + case FN_SVX_SET_NUMBER: { SetCurrentFunction( FuOutlineBullet::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) ); Cancel(); @@ -2467,6 +2519,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) break; case SID_HORIZONTAL: // BASIC + case SID_FLIP_HORIZONTAL: { mpDrawView->MirrorAllMarkedHorizontal(); Cancel(); @@ -2475,6 +2528,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) break; case SID_VERTICAL: // BASIC + case SID_FLIP_VERTICAL: { mpDrawView->MirrorAllMarkedVertical(); Cancel(); @@ -2766,7 +2820,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) { // Make the slide transition panel visible (expand it) in the // tool pane. - framework::FrameworkHelper::Instance(GetViewShellBase())->RequestTaskPanel( + framework::FrameworkHelper::Instance(GetViewShellBase())->RequestSidebarPanel( framework::FrameworkHelper::msCustomAnimationTaskPanelURL); Cancel(); @@ -2778,7 +2832,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) { // Make the slide transition panel visible (expand it) in the // tool pane. - framework::FrameworkHelper::Instance(GetViewShellBase())->RequestTaskPanel( + framework::FrameworkHelper::Instance(GetViewShellBase())->RequestSidebarPanel( framework::FrameworkHelper::msSlideTransitionTaskPanelURL); Cancel(); @@ -2945,6 +2999,177 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) } } +void DrawViewShell::ExecChar( SfxRequest &rReq ) +{ + SdDrawDocument* pDoc = GetDoc(); + if (!pDoc || !mpDrawView) + return; + + SfxItemSet aEditAttr( pDoc->GetPool() ); + mpDrawView->GetAttributes( aEditAttr ); + + //modified by wj for sym2_1580, if put old itemset into new set, + //when mpDrawView->SetAttributes(aNewAttr) it will invalidate all the item + // and use old attr to update all the attributes +// SfxItemSet aNewAttr( GetPool(), +// EE_ITEMS_START, EE_ITEMS_END ); +// aNewAttr.Put( aEditAttr, sal_False ); + SfxItemSet aNewAttr( pDoc->GetPool() ); + //modified end + + sal_uInt16 nSId = rReq.GetSlot(); + + MapSlot( nSId ); + + switch ( nSId ) + { + case SID_ATTR_CHAR_FONT: + if( rReq.GetArgs() ) + { + SFX_REQUEST_ARG( rReq, pItem, SvxFontItem, SID_ATTR_CHAR_FONT , sal_False ); + if (pItem) + { + aNewAttr.Put(*pItem); + } + } + break; + case SID_ATTR_CHAR_FONTHEIGHT: + if( rReq.GetArgs() ) + { + SFX_REQUEST_ARG( rReq, pItem, SvxFontHeightItem, SID_ATTR_CHAR_FONTHEIGHT , sal_False ); + if (pItem) + { + aNewAttr.Put(*pItem); + } + } + break; + case SID_ATTR_CHAR_WEIGHT: + if( rReq.GetArgs() ) + { + //const SvxWeightItem *pItem = (const SvxWeightItem*) rReq.GetArg( SID_ATTR_CHAR_WEIGHT, sal_False, TYPE(SvxWeightItem) ); + SFX_REQUEST_ARG( rReq, pItem, SvxWeightItem, SID_ATTR_CHAR_WEIGHT , sal_False ); + if (pItem) + { + aNewAttr.Put(*pItem); + } + } + break; + case SID_ATTR_CHAR_POSTURE: + if( rReq.GetArgs() ) + { + //const SvxPostureItem *pItem = (const SvxPostureItem*) rReq.GetArg( SID_ATTR_CHAR_POSTURE, sal_False, TYPE(SvxPostureItem) ); + SFX_REQUEST_ARG( rReq, pItem, SvxPostureItem, SID_ATTR_CHAR_POSTURE , sal_False ); + if (pItem) + { + aNewAttr.Put(*pItem); + } + } + break; + case SID_ATTR_CHAR_UNDERLINE: + if( rReq.GetArgs() ) + { + //<<modify by wj for sym2_1873 + //SFX_REQUEST_ARG( rReq, pItem, SvxTextLineItem, SID_ATTR_CHAR_UNDERLINE , sal_False ); + SFX_REQUEST_ARG( rReq, pItem, SvxUnderlineItem, SID_ATTR_CHAR_UNDERLINE , sal_False ); + //end>> + 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 ) ); + }//aNewAttr.Put( (const SvxUnderlineItem&)aEditAttr.Get( EE_CHAR_UNDERLINE ) ); + } + break; + case SID_ATTR_CHAR_SHADOWED: + if( rReq.GetArgs() ) + { + SFX_REQUEST_ARG( rReq, pItem, SvxShadowedItem, SID_ATTR_CHAR_SHADOWED , sal_False ); + if (pItem) + { + aNewAttr.Put(*pItem); + } + } + break; + case SID_ATTR_CHAR_STRIKEOUT: + if( rReq.GetArgs() ) + { + SFX_REQUEST_ARG( rReq, pItem, SvxCrossedOutItem, SID_ATTR_CHAR_STRIKEOUT , sal_False ); + if (pItem) + { + aNewAttr.Put(*pItem); + } + } + break; + case SID_ATTR_CHAR_COLOR: + if( rReq.GetArgs() ) + { + SFX_REQUEST_ARG( rReq, pItem, SvxColorItem, SID_ATTR_CHAR_COLOR , sal_False ); + if (pItem) + { + aNewAttr.Put(*pItem); + } + } + break; + case SID_ATTR_CHAR_KERNING: + if( rReq.GetArgs() ) + { + SFX_REQUEST_ARG( rReq, pItem, SvxKerningItem, SID_ATTR_CHAR_KERNING , sal_False ); + if (pItem) + { + aNewAttr.Put(*pItem); + } + } + break; + case SID_SET_SUB_SCRIPT: + if( rReq.GetArgs() ) + { + SvxEscapementItem aItem( EE_CHAR_ESCAPEMENT ); + SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&) + aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue(); + if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT ) + aItem.SetEscapement( SVX_ESCAPEMENT_OFF ); + else + aItem.SetEscapement( SVX_ESCAPEMENT_SUBSCRIPT ); + aNewAttr.Put( aItem ); + } + break; + case SID_SET_SUPER_SCRIPT: + if( rReq.GetArgs() ) + { + SvxEscapementItem aItem( EE_CHAR_ESCAPEMENT ); + SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&) + aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue(); + if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT ) + aItem.SetEscapement( SVX_ESCAPEMENT_OFF ); + else + aItem.SetEscapement( SVX_ESCAPEMENT_SUPERSCRIPT ); + aNewAttr.Put( aItem ); + } + break; + case SID_SHRINK_FONT_SIZE: + case SID_GROW_FONT_SIZE: + //if (rReq.GetArgs()) + { + const SvxFontListItem* pFonts = dynamic_cast<const SvxFontListItem*>(GetDocSh()->GetItem( SID_ATTR_CHAR_FONTLIST ) ); + const FontList* pFontList = pFonts->GetFontList(); + if( pFontList ) + { + FuText::ChangeFontSize( nSId == SID_GROW_FONT_SIZE, NULL, pFontList, mpView ); + GetViewFrame()->GetBindings().Invalidate( SID_ATTR_CHAR_FONTHEIGHT ); + } + } + default: + ; + } + + mpDrawView->SetAttributes(aNewAttr); + rReq.Done(); + Cancel(); +} + /** This method consists basically of three parts: 1. Process the arguments of the SFX request. 2. Use the model to create a new page or duplicate an existing one. @@ -2968,6 +3193,88 @@ SdPage* DrawViewShell::CreateOrDuplicatePage ( return pNewPage; } +void DrawViewShell::ExecutePropPanelAttr (SfxRequest& rReq) +{ + if(SlideShow::IsRunning( GetViewShellBase() )) + return; + + SdDrawDocument* pDoc = GetDoc(); + if (!pDoc || !mpDrawView) + return; + + sal_uInt16 nSId = rReq.GetSlot(); + SfxItemSet aAttrs( pDoc->GetPool() ); + + switch ( nSId ) + { + case SID_TABLE_VERT_NONE: + case SID_TABLE_VERT_CENTER: + case SID_TABLE_VERT_BOTTOM: + SdrTextVertAdjust eTVA = SDRTEXTVERTADJUST_TOP; + if (nSId == SID_TABLE_VERT_CENTER) + eTVA = SDRTEXTVERTADJUST_CENTER; + else if (nSId == SID_TABLE_VERT_BOTTOM) + eTVA = SDRTEXTVERTADJUST_BOTTOM; + + aAttrs.Put( SdrTextVertAdjustItem(eTVA) ); + mpDrawView->SetAttributes(aAttrs); + + break; + } +} + +void DrawViewShell::GetStatePropPanelAttr(SfxItemSet& rSet) +{ + SfxWhichIter aIter( rSet ); + sal_uInt16 nWhich = aIter.FirstWhich(); + + SdDrawDocument* pDoc = GetDoc(); + if (!pDoc || !mpDrawView) + return; + + SfxItemSet aAttrs( pDoc->GetPool() ); + mpDrawView->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(); + } +} + } // end of namespace sd /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx index 3b533be70a3a..04bd60741427 100644 --- a/sd/source/ui/view/drviews3.cxx +++ b/sd/source/ui/view/drviews3.cxx @@ -26,6 +26,7 @@ #include <editeng/lrspitem.hxx> #include <editeng/protitem.hxx> #include <editeng/frmdiritem.hxx> +#include <editeng/adjustitem.hxx> #include <svx/ruler.hxx> #include <editeng/numitem.hxx> #include <svx/rulritem.hxx> @@ -82,7 +83,8 @@ #include <com/sun/star/drawing/framework/XConfigurationController.hpp> #include <com/sun/star/drawing/framework/XConfiguration.hpp> #include <com/sun/star/frame/XFrame.hpp> - +#include <editeng/lspcitem.hxx> +#include <editeng/ulspitem.hxx> using namespace ::com::sun::star::uno; using namespace ::com::sun::star::drawing::framework; using ::com::sun::star::frame::XFrame; @@ -647,8 +649,97 @@ void DrawViewShell::ExecRuler(SfxRequest& rReq) break; } + case SID_ATTR_PARA_LINESPACE: + { + sal_uInt16 nSlot = SID_ATTR_PARA_LINESPACE; + SvxLineSpacingItem aParaLineSP = (const SvxLineSpacingItem&)pArgs->Get( + GetPool().GetWhich(nSlot)); + + SfxItemSet aEditAttr( GetPool(), EE_PARA_SBL, EE_PARA_SBL ); + aParaLineSP.SetWhich( EE_PARA_SBL ); + + aEditAttr.Put( aParaLineSP ); + mpDrawView->SetAttributes( aEditAttr ); + + Invalidate(SID_ATTR_PARA_LINESPACE); + } + break; + case SID_ATTR_PARA_ADJUST_LEFT: + { + SvxAdjustItem aItem( SVX_ADJUST_LEFT, EE_PARA_JUST ); + SfxItemSet aEditAttr( GetPool(), EE_PARA_JUST, EE_PARA_JUST ); + + aEditAttr.Put( aItem ); + mpDrawView->SetAttributes( aEditAttr ); + + Invalidate(SID_ATTR_PARA_ADJUST_LEFT); + } + break; + case SID_ATTR_PARA_ADJUST_CENTER: + { + SvxAdjustItem aItem( SVX_ADJUST_CENTER, EE_PARA_JUST ); + SfxItemSet aEditAttr( GetPool(), EE_PARA_JUST, EE_PARA_JUST ); + + aEditAttr.Put( aItem ); + mpDrawView->SetAttributes( aEditAttr ); + + Invalidate(SID_ATTR_PARA_ADJUST_CENTER); + } + break; + case SID_ATTR_PARA_ADJUST_RIGHT: + { + SvxAdjustItem aItem( SVX_ADJUST_RIGHT, EE_PARA_JUST ); + SfxItemSet aEditAttr( GetPool(), EE_PARA_JUST, EE_PARA_JUST ); + + aEditAttr.Put( aItem ); + mpDrawView->SetAttributes( aEditAttr ); + + Invalidate(SID_ATTR_PARA_ADJUST_RIGHT); + } + break; + case SID_ATTR_PARA_ADJUST_BLOCK: + { + SvxAdjustItem aItem( SVX_ADJUST_BLOCK, EE_PARA_JUST ); + SfxItemSet aEditAttr( GetPool(), EE_PARA_JUST, EE_PARA_JUST ); + + aEditAttr.Put( aItem ); + mpDrawView->SetAttributes( aEditAttr ); + + Invalidate(SID_ATTR_PARA_ADJUST_BLOCK); + } + break; + case SID_ATTR_PARA_ULSPACE: + { + sal_uInt16 nSlot = SID_ATTR_PARA_ULSPACE; + SvxULSpaceItem aULSP = (const SvxULSpaceItem&)pArgs->Get( + GetPool().GetWhich(nSlot)); + SfxItemSet aEditAttr( GetPool(), EE_PARA_ULSPACE, EE_PARA_ULSPACE ); + aULSP.SetWhich( EE_PARA_ULSPACE ); + + aEditAttr.Put( aULSP ); + mpDrawView->SetAttributes( aEditAttr ); + + Invalidate(SID_ATTR_PARA_ULSPACE); + } + break; + case SID_ATTR_PARA_LRSPACE: { + sal_uInt16 nSlot = SID_ATTR_PARA_LRSPACE; + SvxLRSpaceItem aLRSpace = (const SvxLRSpaceItem&)pArgs->Get( + GetPool().GetWhich(nSlot)); + + SfxItemSet aEditAttr( GetPool(), EE_PARA_LRSPACE, EE_PARA_LRSPACE ); + aLRSpace.SetWhich( EE_PARA_LRSPACE ); + + aEditAttr.Put( aLRSpace ); + mpDrawView->SetAttributes( aEditAttr ); + + Invalidate(SID_ATTR_PARA_LRSPACE); + break; + } + case SID_ATTR_LRSPACE: + { if( mpDrawView->IsTextEdit() ) { sal_uInt16 nId = SID_ATTR_PARA_LRSPACE; diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx index d3651b09568e..5579fe337118 100644 --- a/sd/source/ui/view/drviews7.cxx +++ b/sd/source/ui/view/drviews7.cxx @@ -203,6 +203,11 @@ IMPL_LINK( DrawViewShell, ClipboardChanged, TransferableDataHelper*, pDataHelper return 0; } +void DrawViewShell::GetDrawAttrState(SfxItemSet& rSet) +{ + SfxItemSet aSet( mpDrawView->GetGeoAttrFromMarked() ); + rSet.Put(aSet,sal_False); +} void DrawViewShell::GetMenuState( SfxItemSet &rSet ) { @@ -503,6 +508,8 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet ) { rSet.DisableItem( SID_HORIZONTAL ); rSet.DisableItem( SID_VERTICAL ); + rSet.DisableItem( SID_FLIP_HORIZONTAL ); + rSet.DisableItem( SID_FLIP_VERTICAL ); } if( !mpDrawView->IsMirrorAllowed() ) diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx index 840979562272..cad4da25a7e8 100644 --- a/sd/source/ui/view/drviewsa.cxx +++ b/sd/source/ui/view/drviewsa.cxx @@ -49,6 +49,7 @@ #include <svx/fmshell.hxx> #include <svtools/cliplistener.hxx> #include <svx/float3d.hxx> +#include <svx/sidebar/SelectionAnalyzer.hxx> #include "helpids.h" #include "view/viewoverlaymanager.hxx" @@ -69,10 +70,14 @@ #include "slideshow.hxx" #include "ToolBarManager.hxx" #include "annotationmanager.hxx" +#include "DrawController.hxx" + +#include <boost/bind.hpp> using namespace ::rtl; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; +using sfx2::sidebar::EnumContext; namespace sd { @@ -115,22 +120,31 @@ void SAL_CALL ScannerEventListener::disposing( const lang::EventObject& rEventOb DrawViewShell::DrawViewShell( SfxViewFrame* pFrame, ViewShellBase& rViewShellBase, ::Window* pParentWindow, PageKind ePageKind, FrameView* pFrameViewArgument ) -: ViewShell (pFrame, pParentWindow, rViewShellBase) -, maTabControl(this, pParentWindow) -, mbIsLayerModeActive(false) -, mbIsInSwitchPage(false) + : ViewShell (pFrame, pParentWindow, rViewShellBase) + , maTabControl(this, pParentWindow) + , mbIsLayerModeActive(false) + , mbIsInSwitchPage(false) + , mpSelectionChangeHandler(new svx::sidebar::SelectionChangeHandler( + ::boost::bind(&DrawViewShell::GetContextForSelection, this), + uno::Reference<frame::XController>(&rViewShellBase.GetDrawController()), + sfx2::sidebar::EnumContext::Context_Default)) { if (pFrameViewArgument != NULL) mpFrameView = pFrameViewArgument; else mpFrameView = new FrameView(GetDoc()); Construct(GetDocSh(), ePageKind); + + mpSelectionChangeHandler->Connect(); + doShow(); } DrawViewShell::~DrawViewShell() { + mpSelectionChangeHandler->Disconnect(); + mpAnnotationManager.reset(); mpViewOverlayManager.reset(); @@ -810,6 +824,22 @@ void DrawViewShell::GetAnnotationState (SfxItemSet& rItemSet ) } +EnumContext::Context DrawViewShell::GetContextForSelection (void) const +{ + if (mpDrawView->GetMarkedObjectList().GetMarkCount() == 1) + if (mpDrawView->GetTextEditObject() != NULL) + if (mpDrawView->GetTextEditOutlinerView() != NULL) + return EnumContext::Context_DrawText; + + // All other cases are handled by the SelectionAnalyzer. + return ::svx::sidebar::SelectionAnalyzer::GetContextForSelection_SD( + mpDrawView->GetMarkedObjectList(), + meEditMode == EM_MASTERPAGE, + mePageKind == PK_HANDOUT, + mePageKind == PK_NOTES); +} + + } // end of namespace sd /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx index f1e04babdc82..4989cd2a5a07 100644 --- a/sd/source/ui/view/drviewsf.cxx +++ b/sd/source/ui/view/drviewsf.cxx @@ -58,6 +58,16 @@ #include "cfgids.hxx" #include "anminfo.hxx" +#include <editeng/lspcitem.hxx> +#include <editeng/ulspitem.hxx> +#include <editeng/lrspitem.hxx> +#include <editeng/escapementitem.hxx> +#include <editeng/numitem.hxx> +#include <editeng/adjustitem.hxx> +#include <svx/nbdtmgfact.hxx> +#include <svx/nbdtmg.hxx> + +using namespace svx::sidebar; using namespace ::com::sun::star; namespace sd { @@ -277,17 +287,133 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet ) : nWhich; switch ( nSlotId ) { + case SID_ATTR_PARA_ADJUST_LEFT: + { + SfxItemSet aAttrs( GetDoc()->GetPool() ); + mpDrawView->GetAttributes( aAttrs ); + + SvxAdjustItem aItem= ( (const SvxAdjustItem&) aAttrs.Get( EE_PARA_JUST ) ); + SvxAdjust eAdj = aItem.GetAdjust(); + if ( eAdj == SVX_ADJUST_LEFT) + { + rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_LEFT, sal_True ) ); + } + + bAttr = sal_True; + + Invalidate(nSlotId); + } + break; + case SID_ATTR_PARA_ADJUST_CENTER: + { + SfxItemSet aAttrs( GetDoc()->GetPool() ); + mpDrawView->GetAttributes( aAttrs ); + + SvxAdjustItem aItem= ( (const SvxAdjustItem&) aAttrs.Get( EE_PARA_JUST ) ); + SvxAdjust eAdj = aItem.GetAdjust(); + if ( eAdj == SVX_ADJUST_CENTER) + { + rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_CENTER, sal_True ) ); + } + + bAttr = sal_True; + + Invalidate(nSlotId); + } + break; + case SID_ATTR_PARA_ADJUST_RIGHT: + { + SfxItemSet aAttrs( GetDoc()->GetPool() ); + mpDrawView->GetAttributes( aAttrs ); + + SvxAdjustItem aItem= ( (const SvxAdjustItem&) aAttrs.Get( EE_PARA_JUST ) ); + SvxAdjust eAdj = aItem.GetAdjust(); + if ( eAdj == SVX_ADJUST_RIGHT) + { + rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_RIGHT, sal_True ) ); + } + + bAttr = sal_True; + + Invalidate(nSlotId); + } + break; + case SID_ATTR_PARA_ADJUST_BLOCK: + { + SfxItemSet aAttrs( GetDoc()->GetPool() ); + mpDrawView->GetAttributes( aAttrs ); + + SvxAdjustItem aItem= ( (const SvxAdjustItem&) aAttrs.Get( EE_PARA_JUST ) ); + SvxAdjust eAdj = aItem.GetAdjust(); + if ( eAdj == SVX_ADJUST_BLOCK) + { + rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_BLOCK, sal_True ) ); + } + + bAttr = sal_True; + + Invalidate(nSlotId); + } + break; + case SID_ATTR_PARA_LRSPACE: + { + SfxItemSet aAttrs( GetDoc()->GetPool() ); + mpDrawView->GetAttributes( aAttrs ); + SvxLRSpaceItem aLRSpace = ( (const SvxLRSpaceItem&) aAttrs.Get( EE_PARA_LRSPACE ) ); + aLRSpace.SetWhich(SID_ATTR_PARA_LRSPACE); + rSet.Put(aLRSpace); + bAttr = sal_True; + Invalidate(SID_ATTR_PARA_LRSPACE); + } + break; + case SID_ATTR_PARA_LINESPACE: + { + SfxItemSet aAttrs( GetDoc()->GetPool() ); + mpDrawView->GetAttributes( aAttrs ); + SvxLineSpacingItem aLineLR = ( (const SvxLineSpacingItem&) aAttrs.Get( EE_PARA_SBL ) ); + rSet.Put(aLineLR); + bAttr = sal_True; + Invalidate(SID_ATTR_PARA_LINESPACE); + } + break; + case SID_ATTR_PARA_ULSPACE: + { + SfxItemSet aAttrs( GetDoc()->GetPool() ); + mpDrawView->GetAttributes( aAttrs ); + SvxULSpaceItem aULSP = ( (const SvxULSpaceItem&) aAttrs.Get( EE_PARA_ULSPACE ) ); + aULSP.SetWhich(SID_ATTR_PARA_ULSPACE); + rSet.Put(aULSP); + bAttr = sal_True; + Invalidate(SID_ATTR_PARA_ULSPACE); + } + break; case SID_ATTR_FILL_STYLE: case SID_ATTR_FILL_COLOR: case SID_ATTR_FILL_GRADIENT: case SID_ATTR_FILL_HATCH: case SID_ATTR_FILL_BITMAP: case SID_ATTR_FILL_SHADOW: + case SID_ATTR_FILL_TRANSPARENCE: + case SID_ATTR_FILL_FLOATTRANSPARENCE: 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: case SID_ATTR_TEXT_FITTOSIZE: + case SID_ATTR_CHAR_FONT: + case SID_ATTR_CHAR_FONTHEIGHT: + case SID_ATTR_CHAR_SHADOWED: + case SID_ATTR_CHAR_POSTURE: + case SID_ATTR_CHAR_UNDERLINE: + case SID_ATTR_CHAR_STRIKEOUT: + case SID_ATTR_CHAR_WEIGHT: + case SID_ATTR_CHAR_COLOR: + case SID_ATTR_CHAR_KERNING: + case SID_SET_SUB_SCRIPT: + case SID_SET_SUPER_SCRIPT: { bAttr = sal_True; } @@ -427,6 +553,118 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet ) } } break; + case FN_BUL_NUM_RULE_INDEX: + case FN_NUM_NUM_RULE_INDEX: + { + SfxItemSet aEditAttr( GetDoc()->GetPool() ); + mpDrawView->GetAttributes( aEditAttr ); + + SfxItemSet aNewAttr( GetPool(), EE_ITEMS_START, EE_ITEMS_END ); + aNewAttr.Put( aEditAttr, sal_False ); + + + sal_uInt16 nActNumLvl = (sal_uInt16)0xFFFF; + SvxNumRule* pNumRule = NULL; + const SfxPoolItem* pTmpItem=NULL; + sal_uInt16 nNumItemId = SID_ATTR_NUMBERING_RULE; + + //if(SFX_ITEM_SET == aNewAttr.GetItemState(SID_PARAM_CUR_NUM_LEVEL, sal_False, &pTmpItem)) + // nActNumLvl = ((const SfxUInt16Item*)pTmpItem)->GetValue(); + rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,DEFAULT_NONE)); + rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,DEFAULT_NONE)); + nActNumLvl = mpDrawView->GetSelectionLevel(); + pTmpItem=GetNumBulletItem(aNewAttr, nNumItemId); + + if (pTmpItem) + pNumRule = new SvxNumRule(*((SvxNumBulletItem*)pTmpItem)->GetNumRule()); + + if ( pNumRule ) + { + sal_uInt16 nMask = 1; + sal_uInt16 nCount = 0; + sal_uInt16 nCurLevel = (sal_uInt16)0xFFFF; + for(sal_uInt16 i = 0; i < pNumRule->GetLevelCount(); i++) + { + if(nActNumLvl & nMask) + { + nCount++; + nCurLevel = i; + } + nMask <<= 1; + } + if ( nCount == 1 ) + { + sal_Bool bBullets = sal_False; + const SvxNumberFormat* pNumFmt = pNumRule->Get(nCurLevel); + if ( pNumFmt ) + { + switch(pNumFmt->GetNumberingType()) + { + case SVX_NUM_CHAR_SPECIAL: + case SVX_NUM_BITMAP: + bBullets = sal_True; + break; + + default: + bBullets = sal_False; + } + + rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,(sal_uInt16)0xFFFF)); + rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,(sal_uInt16)0xFFFF)); + if ( bBullets ) + { + NBOTypeMgrBase* pBullets = NBOutlineTypeMgrFact::CreateInstance(eNBOType::MIXBULLETS); + if ( pBullets ) + { + sal_uInt16 nBulIndex = pBullets->GetNBOIndexForNumRule(*pNumRule,nActNumLvl); + rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,nBulIndex)); + } + }else + { + NBOTypeMgrBase* pNumbering = NBOutlineTypeMgrFact::CreateInstance(eNBOType::NUMBERING); + if ( pNumbering ) + { + sal_uInt16 nBulIndex = pNumbering->GetNBOIndexForNumRule(*pNumRule,nActNumLvl); + rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,nBulIndex)); + } + } + } + } + } + } + break; + //End + // Added by Li Hui for story 179. + case FN_NUM_BULLET_ON: + case FN_NUM_NUMBERING_ON: + { + sal_Bool bEnable = sal_False; + const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); + const sal_uInt32 nMarkCount = rMarkList.GetMarkCount(); + for (sal_uInt32 nIndex = 0; nIndex < nMarkCount; nIndex++) + { + SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >(rMarkList.GetMark(nIndex)->GetMarkedSdrObj()); + if (pTextObj && pTextObj->GetObjInventor() == SdrInventor) + { + if (pTextObj->GetObjIdentifier() != OBJ_OLE2) + { + bEnable = sal_True; + break; + } + } + } + if (bEnable) + { + rSet.Put(SfxBoolItem(FN_NUM_BULLET_ON, sal_False)); + rSet.Put(SfxBoolItem(FN_NUM_NUMBERING_ON, sal_False)); + } + else + { + rSet.DisableItem(FN_NUM_BULLET_ON); + rSet.DisableItem(FN_NUM_NUMBERING_ON); + } + } + break; } nWhich = aIter.NextWhich(); } @@ -461,9 +699,45 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet ) nWhich = aNewIter.NextWhich(); } } + + SfxItemState eState = pSet->GetItemState( EE_PARA_LRSPACE ); + if ( eState == SFX_ITEM_DONTCARE ) + { + rSet.InvalidateItem(EE_PARA_LRSPACE); + rSet.InvalidateItem(SID_ATTR_PARA_LRSPACE); + } + eState = pSet->GetItemState( EE_PARA_SBL ); + if ( eState == SFX_ITEM_DONTCARE ) + { + rSet.InvalidateItem(EE_PARA_SBL); + rSet.InvalidateItem(SID_ATTR_PARA_LINESPACE); + } + eState = pSet->GetItemState( EE_PARA_ULSPACE ); + if ( eState == SFX_ITEM_DONTCARE ) + { + rSet.InvalidateItem(EE_PARA_ULSPACE); + rSet.InvalidateItem(SID_ATTR_PARA_ULSPACE); + } + + SvxEscapement eEsc = (SvxEscapement) ( (const SvxEscapementItem&) + pSet->Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue(); + if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT ) + { + rSet.Put( SfxBoolItem( SID_SET_SUPER_SCRIPT, sal_True ) ); + } + else if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT ) + { + rSet.Put( SfxBoolItem( SID_SET_SUB_SCRIPT, sal_True ) ); + } + + eState = pSet->GetItemState( EE_CHAR_KERNING, sal_True ); + if ( eState == SFX_ITEM_DONTCARE ) + { + rSet.InvalidateItem(EE_CHAR_KERNING); + rSet.InvalidateItem(SID_ATTR_CHAR_KERNING); + } delete pSet; } - } diff --git a/sd/source/ui/view/drviewsj.cxx b/sd/source/ui/view/drviewsj.cxx index 4be97a05403f..61e33f900463 100644 --- a/sd/source/ui/view/drviewsj.cxx +++ b/sd/source/ui/view/drviewsj.cxx @@ -75,6 +75,8 @@ void DrawViewShell::GetMenuStateSel( SfxItemSet &rSet ) SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OBJECT_TITLE_DESCRIPTION ) || SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ATTR_FILL_STYLE ) || + SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ATTR_FILL_TRANSPARENCE ) || + SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ATTR_FILL_FLOATTRANSPARENCE ) || SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CHANGEBEZIER ) || SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CHANGEPOLYGON ) || SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_LINEEND_POLYGON ) || @@ -166,6 +168,8 @@ void DrawViewShell::GetMenuStateSel( SfxItemSet &rSet ) { //rSet.DisableItem( SID_ATTRIBUTES_AREA ); // remove again! rSet.DisableItem( SID_ATTR_FILL_STYLE ); + rSet.DisableItem( SID_ATTR_FILL_TRANSPARENCE ); + rSet.DisableItem( SID_ATTR_FILL_FLOATTRANSPARENCE ); } if( (!pObj->ISA( SdrPathObj ) && !aInfoRec.bCanConvToPath) || pObj->ISA( SdrObjGroup ) ) // As long as JOE handles it incorrectly! { // JOE: a group object may can be converted into a PathObj @@ -364,6 +368,8 @@ void DrawViewShell::GetMenuStateSel( SfxItemSet &rSet ) if( bLine && !bText && !bDrawObj &&!b3dObj) { rSet.DisableItem( SID_ATTR_FILL_STYLE ); + rSet.DisableItem( SID_ATTR_FILL_TRANSPARENCE ); + rSet.DisableItem( SID_ATTR_FILL_FLOATTRANSPARENCE ); } if( !bEdgeObj ) rSet.DisableItem( SID_CONNECTION_DLG ); @@ -482,6 +488,8 @@ void DrawViewShell::GetMenuStateSel( SfxItemSet &rSet ) rSet.DisableItem( SID_COPYOBJECTS ); rSet.DisableItem( SID_HORIZONTAL ); rSet.DisableItem( SID_VERTICAL ); + rSet.DisableItem( SID_FLIP_HORIZONTAL ); + rSet.DisableItem( SID_FLIP_VERTICAL ); rSet.DisableItem( SID_GROUP ); rSet.DisableItem( SID_UNGROUP ); rSet.DisableItem( SID_NAME_GROUP ); diff --git a/sd/source/ui/view/drvwshrg.cxx b/sd/source/ui/view/drvwshrg.cxx index 384ffa0e803b..abe2d38f8c44 100644 --- a/sd/source/ui/view/drvwshrg.cxx +++ b/sd/source/ui/view/drvwshrg.cxx @@ -28,6 +28,7 @@ #include <svx/imapdlg.hxx> #include <svx/colrctrl.hxx> #include <sfx2/objface.hxx> +#include <sfx2/sidebar/SidebarChildWindow.hxx> #include <svx/f3dchild.hxx> #include <svx/tbxcustomshapes.hxx> @@ -79,6 +80,7 @@ SFX_IMPL_INTERFACE(DrawViewShell, SfxShell, SdResId(STR_DRAWVIEWSHELL)) SFX_CHILDWINDOW_REGISTRATION( ::sd::SpellDialogChildWindow::GetChildWindowId() ); SFX_CHILDWINDOW_REGISTRATION( SID_SEARCH_DLG ); SFX_CHILDWINDOW_REGISTRATION( ::avmedia::MediaPlayer::GetChildWindowId() ); + SFX_CHILDWINDOW_REGISTRATION(::sfx2::sidebar::SidebarChildWindow::GetChildWindowId()); } @@ -104,6 +106,7 @@ SFX_IMPL_INTERFACE(GraphicViewShell, SfxShell, SdResId(STR_DRAWVIEWSHELL)) //SOH SFX_CHILDWINDOW_REGISTRATION( ::sd::SpellDialogChildWindow::GetChildWindowId() ); SFX_CHILDWINDOW_REGISTRATION( SID_SEARCH_DLG ); SFX_CHILDWINDOW_REGISTRATION( ::avmedia::MediaPlayer::GetChildWindowId() ); + SFX_CHILDWINDOW_REGISTRATION(::sfx2::sidebar::SidebarChildWindow::GetChildWindowId()); } TYPEINIT1( GraphicViewShell, DrawViewShell ); diff --git a/sd/source/ui/view/outlnvs2.cxx b/sd/source/ui/view/outlnvs2.cxx index 93db7ea6ccfd..87086ac60af3 100644 --- a/sd/source/ui/view/outlnvs2.cxx +++ b/sd/source/ui/view/outlnvs2.cxx @@ -63,6 +63,7 @@ #include "sdabstdlg.hxx" #include "framework/FrameworkHelper.hxx" #include "DrawViewShell.hxx" +#include <boost/scoped_ptr.hpp> using namespace ::com::sun::star::uno; using namespace ::com::sun::star::presentation; @@ -365,12 +366,16 @@ void OutlineViewShell::ShowSlideShow(SfxRequest& rReq) void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq) { - OutlineViewModelChangeGuard aGuard( *pOlView ); - + sal_uInt16 nSId = rReq.GetSlot(); + boost::scoped_ptr< OutlineViewModelChangeGuard > aGuard; + if (nSId != SID_OUTLINE_BULLET && nSId != FN_SVX_SET_BULLET && nSId != FN_SVX_SET_NUMBER) + { + aGuard.reset( new OutlineViewModelChangeGuard(*pOlView) ); + } DeactivateCurrentFunction(); OutlinerView* pOutlinerView = pOlView->GetViewByWindow( GetActiveWindow() ); - sal_uInt16 nSId = rReq.GetSlot(); + //sal_uInt16 nSId = rReq.GetSlot(); switch( nSId ) { @@ -415,6 +420,8 @@ void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq) break; case SID_OUTLINE_BULLET: + case FN_SVX_SET_BULLET: + case FN_SVX_SET_NUMBER: { SetCurrentFunction( FuOutlineBullet::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) ); Cancel(); @@ -429,6 +436,7 @@ void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq) } break; + case SID_CHAR_DLG_EFFECT: case SID_CHAR_DLG: { SetCurrentFunction( FuChar::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) ); diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx index 743a6b22b7a2..494101834ce8 100644 --- a/sd/source/ui/view/outlnvsh.cxx +++ b/sd/source/ui/view/outlnvsh.cxx @@ -46,6 +46,8 @@ #include <editeng/editstat.hxx> #include <svl/itempool.hxx> #include <sfx2/tplpitem.hxx> +#include <sfx2/sidebar/SidebarChildWindow.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include <svx/svdorect.hxx> #include <sot/formats.hxx> #include <com/sun/star/linguistic2/XThesaurus.hpp> @@ -117,6 +119,7 @@ SFX_IMPL_INTERFACE(OutlineViewShell, SfxShell, SdResId(STR_OUTLINEVIEWSHELL)) SFX_CHILDWINDOW_REGISTRATION( SvxHlinkDlgWrapper::GetChildWindowId() ); SFX_CHILDWINDOW_REGISTRATION( ::sd::SpellDialogChildWindow::GetChildWindowId() ); SFX_CHILDWINDOW_REGISTRATION( SID_SEARCH_DLG ); + SFX_CHILDWINDOW_REGISTRATION(::sfx2::sidebar::SidebarChildWindow::GetChildWindowId()); } @@ -209,6 +212,8 @@ OutlineViewShell::OutlineViewShell ( Construct(GetDocSh()); + SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_OutlineText)); + doShow(); } diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx index 06249b80bc2b..ed0579050984 100644 --- a/sd/source/ui/view/sdview.cxx +++ b/sd/source/ui/view/sdview.cxx @@ -43,11 +43,13 @@ #include <svx/dialogs.hrc> #include <sfx2/viewfrm.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include <svx/svdopage.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <svx/xlndsit.hxx> #include <svx/xlineit0.hxx> #include <svx/xlnclit.hxx> +#include <svx/sidebar/ContextChangeEventMultiplexer.hxx> #include <vcl/virdev.hxx> #include "app.hrc" @@ -70,6 +72,7 @@ #include "undo/undomanager.hxx" #include <svx/sdr/contact/viewobjectcontact.hxx> #include <svx/sdr/contact/viewcontact.hxx> +#include <svx/svdotable.hxx> #include "EventMultiplexer.hxx" #include "ViewShellBase.hxx" #include "ViewShellManager.hxx" @@ -80,6 +83,7 @@ #include <drawinglayer/primitive2d/textlayoutdevice.hxx> #include <drawinglayer/primitive2d/groupprimitive2d.hxx> #include <svx/sdr/contact/objectcontact.hxx> +#include <svx/sdr/table/tablecontroller.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <drawinglayer/primitive2d/textprimitive2d.hxx> #include <svx/unoapi.hxx> @@ -89,6 +93,7 @@ using namespace com::sun::star; using namespace com::sun::star::uno; +using namespace sdr::table; namespace sd { TYPEINIT1(View, FmFormView); @@ -690,6 +695,10 @@ sal_Bool View::SdrBeginTextEdit( pGivenOutlinerView, bDontDeleteOutliner, bOnlyOneView, bGrabFocus); + ContextChangeEventMultiplexer::NotifyContextChange( + &GetViewShell()->GetViewShellBase(), + ::sfx2::sidebar::EnumContext::Context_DrawText); + if (bReturn) { ::Outliner* pOL = GetTextEditOutliner(); @@ -705,11 +714,15 @@ sal_Bool View::SdrBeginTextEdit( { aBackground = pObj->GetPage()->GetPageBackgroundColor(pPV); } - pOL->SetBackgroundColor( aBackground ); + if (pOL != NULL) + pOL->SetBackgroundColor( aBackground ); } - pOL->SetParaInsertedHdl(LINK(this, View, OnParagraphInsertedHdl)); - pOL->SetParaRemovingHdl(LINK(this, View, OnParagraphRemovingHdl)); + if (pOL != NULL) + { + pOL->SetParaInsertedHdl(LINK(this, View, OnParagraphInsertedHdl)); + pOL->SetParaRemovingHdl(LINK(this, View, OnParagraphRemovingHdl)); + } } return(bReturn); @@ -746,10 +759,16 @@ SdrEndTextEditKind View::SdrEndTextEdit(sal_Bool bDontDeleteReally ) } } - GetViewShell()->GetViewShellBase().GetEventMultiplexer()->MultiplexEvent(sd::tools::EventMultiplexerEvent::EID_END_TEXT_EDIT, (void*)xObj.get() ); + GetViewShell()->GetViewShellBase().GetEventMultiplexer()->MultiplexEvent( + sd::tools::EventMultiplexerEvent::EID_END_TEXT_EDIT, + (void*)xObj.get() ); if( xObj.is() ) { + ContextChangeEventMultiplexer::NotifyContextChange( + &GetViewShell()->GetViewShellBase(), + ::sfx2::sidebar::EnumContext::Context_Default); + SdPage* pPage = dynamic_cast< SdPage* >( xObj->GetPage() ); if( pPage ) pPage->onEndTextEdit( xObj.get() ); @@ -1208,6 +1227,169 @@ void View::OnEndPasteOrDrop( PasteOrDropInfos* pInfos ) } } +sal_Bool View::ShouldToggleOn(sal_Bool bBulletOnOffMode, sal_Bool bNormalBullet) +{ + // If setting bullets/numbering by the dialog, always should toggle on. + if (!bBulletOnOffMode) + return sal_True; + SdrModel* pSdrModel = GetModel(); + if (!pSdrModel) + return sal_False; + + sal_Bool bToggleOn = sal_False; + SdrOutliner* pOutliner = SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT, pSdrModel); + sal_uInt32 nMarkCount = GetMarkedObjectCount(); + for (sal_uInt32 nIndex = 0; nIndex < nMarkCount && !bToggleOn; nIndex++) + { + SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >(GetMarkedObjectByIndex(nIndex)); + if (!pTextObj || pTextObj->IsTextEditActive()) + continue; + if (pTextObj->ISA(SdrTableObj)) + { + SdrTableObj* pTableObj = dynamic_cast< SdrTableObj* >(pTextObj); + if (!pTableObj) + continue; + CellPos aStart, aEnd; + SvxTableController* pTableController = dynamic_cast< SvxTableController* >(getSelectionController().get()); + if (pTableController) + { + pTableController->getSelectedCells(aStart, aEnd); + } + else + { + aStart = pTableObj->getFirstCell(); + aEnd = pTableObj->getLastCell(); + } + sal_Int32 nColCount = pTableObj->getColumnCount(); + for (sal_Int32 nRow = aStart.mnRow; nRow <= aEnd.mnRow && !bToggleOn; nRow++) + { + for (sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol && !bToggleOn; nCol++) + { + sal_Int32 nCellIndex = nRow * nColCount + nCol; + SdrText* pText = pTableObj->getText(nCellIndex); + if (!pText || !pText->GetOutlinerParaObject()) + continue; + pOutliner->SetText(*(pText->GetOutlinerParaObject())); + sal_Int16 nStatus = pOutliner->GetBulletsNumberingStatus(); + bToggleOn = ((bNormalBullet && nStatus != 0) || (!bNormalBullet && nStatus != 1)) ? sal_True : bToggleOn; + pOutliner->Clear(); + } + } + } + else + { + OutlinerParaObject* pParaObj = pTextObj->GetOutlinerParaObject(); + if (!pParaObj) + continue; + pOutliner->SetText(*pParaObj); + sal_Int16 nStatus = pOutliner->GetBulletsNumberingStatus(); + bToggleOn = ((bNormalBullet && nStatus != 0) || (!bNormalBullet && nStatus != 1)) ? sal_True : bToggleOn; + pOutliner->Clear(); + } + } + delete pOutliner; + return bToggleOn; +} + +void View::ToggleMarkedObjectsBullets(sal_Bool bBulletOnOffMode, sal_Bool bNormalBullet, sal_Bool bMasterView, SvxNumRule* pNumRule, sal_Bool bForceBulletOnOff) +{ + SdrModel* pSdrModel = GetModel(); + Window* pWindow = dynamic_cast< Window* >(GetFirstOutputDevice()); + if (!pSdrModel || !pWindow) + return; + + sal_Bool bUndoEnabled = pSdrModel->IsUndoEnabled(); + sal_Bool bToggleOn = ShouldToggleOn(bBulletOnOffMode, bNormalBullet); + if ( bForceBulletOnOff ) { + bToggleOn = bBulletOnOffMode; + } + SdrUndoGroup* pUndoGroup = new SdrUndoGroup(*pSdrModel); + SdrOutliner* pOutliner = SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT, pSdrModel); + OutlinerView* pOutlinerView = new OutlinerView(pOutliner, pWindow); + + sal_uInt32 nMarkCount = GetMarkedObjectCount(); + for (sal_uInt32 nIndex = 0; nIndex < nMarkCount; nIndex++) + { + SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >(GetMarkedObjectByIndex(nIndex)); + if (!pTextObj || pTextObj->IsTextEditActive()) + continue; + if (pTextObj->ISA(SdrTableObj)) + { + SdrTableObj* pTableObj = dynamic_cast< SdrTableObj* >(pTextObj); + if (!pTableObj) + continue; + CellPos aStart, aEnd; + SvxTableController* pTableController = dynamic_cast< SvxTableController* >(getSelectionController().get()); + if (pTableController) + { + pTableController->getSelectedCells(aStart, aEnd); + } + else + { + aStart = pTableObj->getFirstCell(); + aEnd = pTableObj->getLastCell(); + } + sal_Int32 nColCount = pTableObj->getColumnCount(); + for (sal_Int32 nRow = aStart.mnRow; nRow <= aEnd.mnRow; nRow++) + { + for (sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol; nCol++) + { + sal_Int32 nCellIndex = nRow * nColCount + nCol; + SdrText* pText = pTableObj->getText(nCellIndex); + if (!pText || !pText->GetOutlinerParaObject()) + continue; + + pOutliner->SetText(*(pText->GetOutlinerParaObject())); + if (bUndoEnabled) + { + SdrUndoObjSetText* pTxtUndo = dynamic_cast< SdrUndoObjSetText* >(pSdrModel->GetSdrUndoFactory().CreateUndoObjectSetText(*pTextObj, nCellIndex)); + pUndoGroup->AddAction(pTxtUndo); + } + pOutlinerView->ToggleAllParagraphsBullets(bBulletOnOffMode, bNormalBullet, bToggleOn, bMasterView, pNumRule); + sal_uInt32 nParaCount = pOutliner->GetParagraphCount(); + pText->SetOutlinerParaObject(pOutliner->CreateParaObject(0, (sal_uInt16)nParaCount)); + pOutliner->Clear(); + } + } + // Broadcast the object change event. + if (!pTextObj->AdjustTextFrameWidthAndHeight()) + { + pTextObj->SetChanged(); + pTextObj->BroadcastObjectChange(); + } + } + else + { + OutlinerParaObject* pParaObj = pTextObj->GetOutlinerParaObject(); + if (!pParaObj) + continue; + pOutliner->SetText(*pParaObj); + if (bUndoEnabled) + { + SdrUndoObjSetText* pTxtUndo = dynamic_cast< SdrUndoObjSetText* >(pSdrModel->GetSdrUndoFactory().CreateUndoObjectSetText(*pTextObj, 0)); + pUndoGroup->AddAction(pTxtUndo); + } + pOutlinerView->ToggleAllParagraphsBullets(bBulletOnOffMode, bNormalBullet, bToggleOn, bMasterView, pNumRule); + sal_uInt32 nParaCount = pOutliner->GetParagraphCount(); + pTextObj->SetOutlinerParaObject(pOutliner->CreateParaObject(0, (sal_uInt16)nParaCount)); + pOutliner->Clear(); + } + } + + if (pUndoGroup->GetActionCount() > 0 && bUndoEnabled) + { + pSdrModel->BegUndo(); + pSdrModel->AddUndo(pUndoGroup); + pSdrModel->EndUndo(); + } + else + { + delete pUndoGroup; + } + delete pOutliner; + delete pOutlinerView; +} + } // end of namespace sd /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index 50716b156818..6fe1ba2cded2 100644 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx @@ -75,6 +75,11 @@ #include "Window.hxx" #include "fupoor.hxx" +#include <editeng/numitem.hxx> +#include <editeng/eeitem.hxx> +#include <svl/poolitem.hxx> +#include <glob.hrc> + namespace sd { namespace ui { namespace table { extern SfxShell* CreateTableObjectBar( ViewShell& rShell, ::sd::View* pView ); } } } @@ -147,7 +152,8 @@ ViewShell::~ViewShell() { // Keep the content window from accessing in its destructor the // WindowUpdater. - mpContentWindow->SetViewShell(NULL); + if (mpContentWindow) + mpContentWindow->SetViewShell(NULL); delete mpZoomList; @@ -156,6 +162,13 @@ ViewShell::~ViewShell() if (mpImpl->mpSubShellFactory.get() != NULL) GetViewShellBase().GetViewShellManager()->RemoveSubShellFactory( this,mpImpl->mpSubShellFactory); + + if (mpContentWindow) + { + OSL_TRACE("destroying mpContentWindow at %x with parent %x", mpContentWindow.get(), + mpContentWindow->GetParent()); + mpContentWindow.reset(); + } } @@ -729,7 +742,86 @@ void ViewShell::SetupRulers (void) } } +const SfxPoolItem* ViewShell::GetNumBulletItem(SfxItemSet& aNewAttr, sal_uInt16& nNumItemId) +{ + const SfxPoolItem* pTmpItem = NULL; + + if(aNewAttr.GetItemState(nNumItemId, sal_False, &pTmpItem) == SFX_ITEM_SET) + { + return pTmpItem; + } + else + { + nNumItemId = aNewAttr.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE); + SfxItemState eState = aNewAttr.GetItemState(nNumItemId, sal_False, &pTmpItem); + if (eState == SFX_ITEM_SET) + return pTmpItem; + else + { + sal_Bool bOutliner = sal_False; + sal_Bool bTitle = sal_False; + + if( mpView ) + { + const SdrMarkList& rMarkList = mpView->GetMarkedObjectList(); + const sal_uInt32 nCount = rMarkList.GetMarkCount(); + + for(sal_uInt32 nNum = 0; nNum < nCount; nNum++) + { + SdrObject* pObj = rMarkList.GetMark(nNum)->GetMarkedSdrObj(); + if( pObj->GetObjInventor() == SdrInventor ) + { + switch(pObj->GetObjIdentifier()) + { + case OBJ_TITLETEXT: + bTitle = sal_True; + break; + case OBJ_OUTLINETEXT: + bOutliner = sal_True; + break; + } + } + } + } + + const SvxNumBulletItem *pItem = NULL; + if(bOutliner) + { + SfxStyleSheetBasePool* pSSPool = mpView->GetDocSh()->GetStyleSheetPool(); + String aStyleName((SdResId(STR_LAYOUT_OUTLINE))); + aStyleName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " 1" ) ); + SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find( aStyleName, SD_STYLE_FAMILY_PSEUDO); + if( pFirstStyleSheet ) + pFirstStyleSheet->GetItemSet().GetItemState(EE_PARA_NUMBULLET, sal_False, (const SfxPoolItem**)&pItem); + } + + if( pItem == NULL ) + pItem = (SvxNumBulletItem*) aNewAttr.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET); + + aNewAttr.Put(*pItem, EE_PARA_NUMBULLET); + + if(bTitle && aNewAttr.GetItemState(EE_PARA_NUMBULLET,sal_True) == SFX_ITEM_ON ) + { + SvxNumBulletItem* pBulletItem = (SvxNumBulletItem*)aNewAttr.GetItem(EE_PARA_NUMBULLET,sal_True); + SvxNumRule* pRule = pBulletItem->GetNumRule(); + if(pRule) + { + SvxNumRule aNewRule( *pRule ); + aNewRule.SetFeatureFlag( NUM_NO_NUMBERS, sal_True ); + + SvxNumBulletItem aNewItem( aNewRule, EE_PARA_NUMBULLET ); + aNewAttr.Put(aNewItem); + } + } + SfxItemState eNumState = aNewAttr.GetItemState(nNumItemId, sal_False, &pTmpItem); + if (eNumState == SFX_ITEM_SET) + return pTmpItem; + + } + } + return pTmpItem; +} sal_Bool ViewShell::HasRuler (void) @@ -885,9 +977,10 @@ void ViewShell::ArrangeGUIElements (void) { OSL_ASSERT (GetViewShell()!=NULL); - mpContentWindow->SetPosSizePixel( - Point(nLeft,nTop), - Size(nRight-nLeft,nBottom-nTop)); + if (mpContentWindow) + mpContentWindow->SetPosSizePixel( + Point(nLeft,nTop), + Size(nRight-nLeft,nBottom-nTop)); } // Windows in the center and rulers at the left and top side. diff --git a/sd/uiconfig/sdraw/menubar/menubar.xml b/sd/uiconfig/sdraw/menubar/menubar.xml index 85ea0e028868..0f2d312b0699 100644 --- a/sd/uiconfig/sdraw/menubar/menubar.xml +++ b/sd/uiconfig/sdraw/menubar/menubar.xml @@ -122,6 +122,7 @@ <menu:menuitem menu:id=".uno:ShowAnnotations"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:Navigator"/> + <menu:menuitem menu:id=".uno:Sidebar"/> <menu:menuseparator/> <menu:menu menu:id=".uno:Zoom"> <menu:menupopup> diff --git a/sd/uiconfig/simpress/menubar/menubar.xml b/sd/uiconfig/simpress/menubar/menubar.xml index 5d6a24a9e804..9a5b87418c21 100644 --- a/sd/uiconfig/simpress/menubar/menubar.xml +++ b/sd/uiconfig/simpress/menubar/menubar.xml @@ -114,6 +114,7 @@ </menu:menu> <menu:menuseparator/> <menu:menuitem menu:id=".uno:TaskPane"/> + <menu:menuitem menu:id=".uno:Sidebar"/> <menu:menuitem menu:id=".uno:LeftPaneImpress"/> <menu:menuitem menu:id=".uno:AvailableToolbars"/> <menu:menuitem menu:id=".uno:StatusBarVisible"/> diff --git a/sd/util/sd.component b/sd/util/sd.component index 41624e1df4f7..a5881659edcc 100644 --- a/sd/util/sd.component +++ b/sd/util/sd.component @@ -63,8 +63,8 @@ <implementation name="com.sun.star.comp.Draw.framework.ResourceId"> <service name="com.sun.star.drawing.framework.ResourceId"/> </implementation> - <implementation name="com.sun.star.comp.Draw.framework.TaskPanelFactory"> - <service name="com.sun.star.drawing.framework.TaskPanelFactory"/> + <implementation name="org.openoffice.comp.Draw.framework.PanelFactory"> + <service name="com.sun.star.drawing.framework.PanelFactory"/> </implementation> <implementation name="com.sun.star.comp.Draw.framework.configuration.Configuration"> <service name="com.sun.star.drawing.framework.Configuration"/> @@ -78,9 +78,6 @@ <implementation name="com.sun.star.comp.draw.SdHtmlOptionsDialog"> <service name="com.sun.star.ui.dialog.FilterOptionsDialog"/> </implementation> - <implementation name="com.sun.star.comp.drawing.ToolPanelFactory"> - <service name="com.sun.star.drawing.DefaultToolPanelFactory"/> - </implementation> <implementation name="com.sun.star.comp.sd.InsertSlideController"> <service name="com.sun.star.frame.ToolbarController"/> </implementation> diff --git a/sfx2/AllLangResTarget_sfx2.mk b/sfx2/AllLangResTarget_sfx2.mk index 596bf98e1b8e..c996a7fe74c2 100644 --- a/sfx2/AllLangResTarget_sfx2.mk +++ b/sfx2/AllLangResTarget_sfx2.mk @@ -64,6 +64,7 @@ $(eval $(call gb_SrsTarget_add_files,sfx/res,\ sfx2/source/doc/templatelocnames.src \ sfx2/source/doc/templatedlg.src \ sfx2/source/menu/menu.src \ + sfx2/source/sidebar/Sidebar.src \ sfx2/source/view/view.src \ )) diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk index e21ee68042a7..e32300c053f0 100644 --- a/sfx2/Library_sfx.mk +++ b/sfx2/Library_sfx.mk @@ -228,6 +228,37 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\ sfx2/source/menu/virtmenu \ sfx2/source/notify/eventsupplier \ sfx2/source/notify/hintpost \ + sfx2/source/sidebar/SidebarChildWindow \ + sfx2/source/sidebar/SidebarDockingWindow \ + sfx2/source/sidebar/SidebarController \ + sfx2/source/sidebar/SidebarPanelBase \ + sfx2/source/sidebar/SidebarToolBox \ + sfx2/source/sidebar/AsynchronousCall \ + sfx2/source/sidebar/Context \ + sfx2/source/sidebar/ContextChangeBroadcaster \ + sfx2/source/sidebar/ContextList \ + sfx2/source/sidebar/ControlFactory \ + sfx2/source/sidebar/ControllerItem \ + sfx2/source/sidebar/CustomImageRadioButton \ + sfx2/source/sidebar/Deck \ + sfx2/source/sidebar/DeckDescriptor \ + sfx2/source/sidebar/DeckLayouter \ + sfx2/source/sidebar/DeckTitleBar \ + sfx2/source/sidebar/DrawHelper \ + sfx2/source/sidebar/EnumContext \ + sfx2/source/sidebar/FocusManager \ + sfx2/source/sidebar/MenuButton \ + sfx2/source/sidebar/Paint \ + sfx2/source/sidebar/Panel \ + sfx2/source/sidebar/PanelDescriptor \ + sfx2/source/sidebar/PanelTitleBar \ + sfx2/source/sidebar/ResourceManager \ + sfx2/source/sidebar/TabBar \ + sfx2/source/sidebar/TabItem \ + sfx2/source/sidebar/TitleBar \ + sfx2/source/sidebar/Theme \ + sfx2/source/sidebar/Tools \ + sfx2/source/sidebar/ToolBoxBackground \ sfx2/source/statbar/stbitem \ sfx2/source/toolbox/imgmgr \ sfx2/source/toolbox/tbxitem \ diff --git a/sfx2/sdi/frmslots.sdi b/sfx2/sdi/frmslots.sdi index 3a37a1148667..69ba42d79133 100644 --- a/sfx2/sdi/frmslots.sdi +++ b/sfx2/sdi/frmslots.sdi @@ -41,6 +41,11 @@ interface Window ExecMethod = ChildWindowExecute ; StateMethod = ChildWindowState ; ] + SID_SIDEBAR // status(final|play) + [ + ExecMethod = ChildWindowExecute ; + StateMethod = ChildWindowState ; + ] SID_SHOW_BROWSER // ole(no) api(final/play/rec) [ ExecMethod = ChildWindowExecute ; diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index b8823d20a0fc..b34e2a205269 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -4138,6 +4138,32 @@ SfxBoolItem TaskPane SID_TASKPANE ] //-------------------------------------------------------------------------- +SfxBoolItem Sidebar SID_SIDEBAR +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = TRUE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Asynchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_VIEW; +] + +//-------------------------------------------------------------------------- SfxVoidItem RestoreEditingView SID_RESTORE_EDITING_VIEW [ diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx index 80edb43c508b..5735738dd87e 100644 --- a/sfx2/source/control/bindings.cxx +++ b/sfx2/source/control/bindings.cxx @@ -994,7 +994,7 @@ void SfxBindings::Register( SfxControllerItem& rItem ) void SfxBindings::Register_Impl( SfxControllerItem& rItem, sal_Bool bInternal ) { - DBG_ASSERT( nRegLevel > 0, "registration without EnterRegistrations" ); +// DBG_ASSERT( nRegLevel > 0, "registration without EnterRegistrations" ); DBG_ASSERT( !pImp->bInNextJob, "SfxBindings::Register while status-updating" ); // insert new cache if it does not already exist diff --git a/sfx2/source/control/shell.cxx b/sfx2/source/control/shell.cxx index 0fffa4a4aacb..6822af7e8d2c 100644 --- a/sfx2/source/control/shell.cxx +++ b/sfx2/source/control/shell.cxx @@ -42,6 +42,7 @@ #include <sfx2/mnumgr.hxx> #include "statcach.hxx" #include <sfx2/msgpool.hxx> +#include <sfx2/sidebar/ContextChangeBroadcaster.hxx> //==================================================================== @@ -84,6 +85,8 @@ struct SfxShell_Impl: public SfxBroadcaster SfxVerbSlotArr_Impl aSlotArr; com::sun::star::uno::Sequence < com::sun::star::embed::VerbDescriptor > aVerbList; + ::sfx2::sidebar::ContextChangeBroadcaster maContextChangeBroadcaster; + SfxShell_Impl() : pExecuter( 0 ), pUpdater( 0 ) {} ~SfxShell_Impl() { delete pExecuter; delete pUpdater;} }; @@ -162,6 +165,8 @@ SfxShell::~SfxShell() { DBG_DTOR(SfxShell, 0); + + delete pImp; } @@ -641,6 +646,9 @@ void SfxShell::Activate */ { + SfxViewFrame* pViewFrame = GetFrame(); + if (pViewFrame != NULL) + pImp->maContextChangeBroadcaster.Activate(pViewFrame->GetFrame().GetFrameInterface()); } //-------------------------------------------------------------------- @@ -673,6 +681,9 @@ void SfxShell::Deactivate */ { + SfxViewFrame* pViewFrame = GetFrame(); + if (pViewFrame != NULL) + pImp->maContextChangeBroadcaster.Deactivate(pViewFrame->GetFrame().GetFrameInterface()); } void SfxShell::ParentActivate @@ -1150,6 +1161,11 @@ void SfxShell::ApplyItemSet( sal_uInt16, const SfxItemSet& ) { } +void SfxShell::SetContextName (const ::rtl::OUString& rsContextName) +{ + pImp->maContextChangeBroadcaster.Initialize(rsContextName); +} + void SfxShell::SetViewShell_Impl( SfxViewShell* pView ) { pImp->pViewSh = pView; diff --git a/sfx2/source/dialog/dialog.src b/sfx2/source/dialog/dialog.src index 92b30f7b1f6e..d137b57f7502 100644 --- a/sfx2/source/dialog/dialog.src +++ b/sfx2/source/dialog/dialog.src @@ -108,6 +108,10 @@ String SID_TASKPANE { Text [ en-US ] = "Task Pane"; }; +String SID_SIDEBAR +{ + Text [ en-US ] = "Sidebar"; +}; ErrorBox MSG_ERROR_WRONG_CONFIRM { diff --git a/sfx2/source/dialog/dockwin.cxx b/sfx2/source/dialog/dockwin.cxx index 4affce8ea377..8486883fa2cf 100644 --- a/sfx2/source/dialog/dockwin.cxx +++ b/sfx2/source/dialog/dockwin.cxx @@ -1774,11 +1774,12 @@ long SfxDockingWindow::Notify( NotifyEvent& rEvt ) { if ( rEvt.GetType() == EVENT_GETFOCUS ) { - pBindings->SetActiveFrame( pMgr->GetFrame() ); + if (pMgr != NULL) + pBindings->SetActiveFrame( pMgr->GetFrame() ); if ( pImp->pSplitWin ) pImp->pSplitWin->SetActiveWindow_Impl( this ); - else + else if (pMgr != NULL) pMgr->Activate_Impl(); Window* pWindow = rEvt.GetWindow(); @@ -1809,7 +1810,8 @@ long SfxDockingWindow::Notify( NotifyEvent& rEvt ) else if ( rEvt.GetType() == EVENT_LOSEFOCUS && !HasChildPathFocus() ) { pBindings->SetActiveFrame( NULL ); - pMgr->Deactivate_Impl(); + if (pMgr != NULL) + pMgr->Deactivate_Impl(); } return DockingWindow::Notify( rEvt ); diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index cb57746fa0b1..69aedf64ca33 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -938,7 +938,7 @@ namespace sfx2 LINK( this, TaskPaneController_Impl, OnToolboxClicked ) ); m_rDockingWindow.SetEndDockingHdl( LINK( this, TaskPaneController_Impl, DockingChanged ) ); - impl_setLayout( LAYOUT_DRAWERS, true ); + impl_setLayout(LAYOUT_TABS_RIGHT, true); m_rTaskPane.GetPanelDeck().AddListener( *this ); diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index 173bc5be8d83..7853b729c6ac 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -142,7 +142,7 @@ SfxTemplateDialog::SfxTemplateDialog */ : SfxDockingWindow( pBind, pCW, pParent, SfxResId(DLG_STYLE_DESIGNER) ), - pImpl( new SfxTemplateDialog_Impl( pParent, pBind, this ) ) + pImpl( new SfxTemplateDialog_Impl( pBind, this ) ) { pImpl->updateNonFamilyImages(); @@ -384,6 +384,135 @@ void SfxTemplateDialogWrapper::SetParagraphFamily() static_cast< SfxTemplateDialog* >( GetWindow() )->SetParagraphFamily(); } + + +//===== SfxTemplatePanelControl =============================================== + +SfxTemplatePanelControl::SfxTemplatePanelControl ( + SfxBindings* pBindings, + Window* pParentWindow) + : DockingWindow(pParentWindow, SfxResId(DLG_STYLE_DESIGNER) ), + pImpl(new SfxTemplateDialog_Impl(pBindings, this)), + mpBindings(pBindings) +{ + OSL_ASSERT(mpBindings!=NULL); + + pImpl->updateNonFamilyImages(); +} + + + + +SfxTemplatePanelControl::~SfxTemplatePanelControl (void) +{ + delete pImpl; +} + + + + +ISfxTemplateCommon* SfxTemplatePanelControl::GetISfxTemplateCommon() +{ + return pImpl->GetISfxTemplateCommon(); +} + + + + +void SfxTemplatePanelControl::SetParagraphFamily() +{ + // first select the paragraph family + pImpl->FamilySelect( SFX_STYLE_FAMILY_PARA ); + // then select the automatic filter + pImpl->SetAutomaticFilter(); +} + + + + +void SfxTemplatePanelControl::DataChanged( const DataChangedEvent& _rDCEvt ) +{ + if ( ( DATACHANGED_SETTINGS == _rDCEvt.GetType() ) && + ( 0 != ( SETTINGS_STYLE & _rDCEvt.GetFlags() ) ) ) + { + pImpl->updateFamilyImages(); + pImpl->updateNonFamilyImages(); + } + + DockingWindow::DataChanged( _rDCEvt ); +} + + + + +void SfxTemplatePanelControl::Update() +{ + pImpl->Update(); +} + + + + +void SfxTemplatePanelControl::Resize() +{ + if(pImpl) + pImpl->Resize(); + DockingWindow::Resize(); +} + + +void SfxTemplatePanelControl::FreeResource (void) +{ + DockingWindow::FreeResource(); +} + + +SfxChildAlignment SfxTemplatePanelControl::CheckAlignment(SfxChildAlignment eActAlign,SfxChildAlignment eAlign) +{ + switch (eAlign) + { + case SFX_ALIGN_TOP: + case SFX_ALIGN_HIGHESTTOP: + case SFX_ALIGN_LOWESTTOP: + case SFX_ALIGN_BOTTOM: + case SFX_ALIGN_LOWESTBOTTOM: + case SFX_ALIGN_HIGHESTBOTTOM: + return eActAlign; + + case SFX_ALIGN_LEFT: + case SFX_ALIGN_RIGHT: + case SFX_ALIGN_FIRSTLEFT: + case SFX_ALIGN_LASTLEFT: + case SFX_ALIGN_FIRSTRIGHT: + case SFX_ALIGN_LASTRIGHT: + return eAlign; + + default: + return eAlign; + } +} + + +void SfxTemplatePanelControl::StateChanged( StateChangedType nStateChange ) +{ + if ( nStateChange == STATE_CHANGE_INITSHOW ) + { + SfxViewFrame *pFrame = mpBindings->GetDispatcher_Impl()->GetFrame(); + Window* pEditWin = pFrame->GetViewShell()->GetWindow(); + + Size aSize = pEditWin->GetSizePixel(); + Point aPoint = pEditWin->OutputToScreenPixel( pEditWin->GetPosPixel() ); + aPoint = GetParent()->ScreenToOutputPixel( aPoint ); + Size aWinSize = GetSizePixel(); + aPoint.X() += aSize.Width() - aWinSize.Width() - 20; + aPoint.Y() += aSize.Height() / 2 - aWinSize.Height() / 2; + // SetFloatingPos( aPoint ); + } + + DockingWindow::StateChanged( nStateChange ); +} + + //========================================================================= typedef std::vector<OUString> ExpandedEntries_t; @@ -708,7 +837,7 @@ SvTreeListEntry* FillBox_Impl(SvTreeListBox *pBox, //------------------------------------------------------------------------- // Constructor -SfxCommonTemplateDialog_Impl::SfxCommonTemplateDialog_Impl( SfxBindings* pB, SfxDockingWindow* pW ) : +SfxCommonTemplateDialog_Impl::SfxCommonTemplateDialog_Impl( SfxBindings* pB, Window* pW, bool ) : aISfxTemplateCommon ( this ), pBindings ( pB ), @@ -2284,10 +2413,11 @@ PopupMenu* SfxCommonTemplateDialog_Impl::CreateContextMenu( void ) // ------------------------------------------------------------------------ + SfxTemplateDialog_Impl::SfxTemplateDialog_Impl( - Window* /*pParent*/, SfxBindings* pB, SfxTemplateDialog* pDlgWindow ) : + SfxBindings* pB, SfxTemplateDialog* pDlgWindow ) : - SfxCommonTemplateDialog_Impl( pB, pDlgWindow ), + SfxCommonTemplateDialog_Impl( pB, pDlgWindow, true ), m_pFloat ( pDlgWindow ), m_bZoomIn ( sal_False ), @@ -2297,6 +2427,23 @@ SfxTemplateDialog_Impl::SfxTemplateDialog_Impl( { pDlgWindow->FreeResource(); Initialize(); +} + +SfxTemplateDialog_Impl::SfxTemplateDialog_Impl( + SfxBindings* pB, SfxTemplatePanelControl* pDlgWindow ) + : SfxCommonTemplateDialog_Impl( pB, pDlgWindow, true ), + m_pFloat ( pDlgWindow ), + m_bZoomIn ( sal_False ), + m_aActionTbL ( pDlgWindow, this ), + m_aActionTbR ( pDlgWindow, SfxResId( TB_ACTION ) ) +{ + pDlgWindow->FreeResource(); + Initialize(); +} + +void SfxTemplateDialog_Impl::Initialize (void) +{ + SfxCommonTemplateDialog_Impl::Initialize(); m_aActionTbL.SetSelectHdl(LINK(this, SfxTemplateDialog_Impl, ToolBoxLSelect)); m_aActionTbR.SetSelectHdl(LINK(this, SfxTemplateDialog_Impl, ToolBoxRSelect)); @@ -2413,7 +2560,8 @@ void SfxTemplateDialog_Impl::LoadedFamilies() // The size of the Listboxen is adjusted void SfxTemplateDialog_Impl::Resize() { - FloatingWindow *pF = m_pFloat->GetFloatingWindow(); + SfxDockingWindow* pDockingWindow = dynamic_cast<SfxDockingWindow*>(m_pFloat); + FloatingWindow *pF = pDockingWindow!=NULL ? pDockingWindow->GetFloatingWindow() : NULL; if ( pF ) { m_bZoomIn = pF->IsRollUp(); @@ -2421,6 +2569,8 @@ void SfxTemplateDialog_Impl::Resize() return; } + if (m_pFloat == NULL) + return; Size aDlgSize=m_pFloat->PixelToLogic(m_pFloat->GetOutputSizePixel()); Size aSizeATL=m_pFloat->PixelToLogic(m_aActionTbL.CalcWindowSizePixel()); Size aSizeATR=m_pFloat->PixelToLogic(m_aActionTbR.CalcWindowSizePixel()); @@ -2482,23 +2632,31 @@ void SfxTemplateDialog_Impl::Resize() Size SfxTemplateDialog_Impl::GetMinOutputSizePixel() { - Size aSizeATL=m_pFloat->PixelToLogic(m_aActionTbL.CalcWindowSizePixel()); - Size aSizeATR=m_pFloat->PixelToLogic(m_aActionTbR.CalcWindowSizePixel()); - Size aMinSize=Size( - aSizeATL.Width()+aSizeATR.Width()+ - 2*SFX_TEMPLDLG_HFRAME + SFX_TEMPLDLG_MIDHSPACE, - 4*aSizeATL.Height()+2*SFX_TEMPLDLG_MIDVSPACE); - return aMinSize; + if (m_pFloat != NULL) + { + Size aSizeATL=m_pFloat->PixelToLogic(m_aActionTbL.CalcWindowSizePixel()); + Size aSizeATR=m_pFloat->PixelToLogic(m_aActionTbR.CalcWindowSizePixel()); + Size aMinSize=Size( + aSizeATL.Width()+aSizeATR.Width()+ + 2*SFX_TEMPLDLG_HFRAME + SFX_TEMPLDLG_MIDHSPACE, + 4*aSizeATL.Height()+2*SFX_TEMPLDLG_MIDVSPACE); + return aMinSize; + } + else + return Size(0,0); } //------------------------------------------------------------------------- void SfxTemplateDialog_Impl::Command( const CommandEvent& rCEvt ) { - if(COMMAND_CONTEXTMENU == rCEvt.GetCommand()) - ExecuteContextMenu_Impl( rCEvt.GetMousePosPixel(), m_pFloat ); - else - m_pFloat->Command(rCEvt); + if (m_pFloat != NULL) + { + if(COMMAND_CONTEXTMENU == rCEvt.GetCommand()) + ExecuteContextMenu_Impl( rCEvt.GetMousePosPixel(), m_pFloat ); + else + m_pFloat->Command(rCEvt); + } } //------------------------------------------------------------------------- diff --git a/sfx2/source/inc/helpid.hrc b/sfx2/source/inc/helpid.hrc index 5232dd8eaced..c11cabb2700d 100644 --- a/sfx2/source/inc/helpid.hrc +++ b/sfx2/source/inc/helpid.hrc @@ -151,6 +151,8 @@ #define HID_TASKPANE_WINDOW "SFX2_HID_TASKPANE_WINDOW" #define HID_TASKPANE_VIEW_MENU "SFX2_HID_TASKPANE_VIEW_MENU" +#define HID_SIDEBAR_WINDOW "SFX2_HID_SIDEBAR_WINDOW" + #endif // #ifndef _SFX_HELPID_HRC // ******************************************************************* EOF diff --git a/sfx2/source/inc/templdgi.hxx b/sfx2/source/inc/templdgi.hxx index fe6e046de5b7..88405faec951 100644 --- a/sfx2/source/inc/templdgi.hxx +++ b/sfx2/source/inc/templdgi.hxx @@ -230,7 +230,7 @@ protected: public: TYPEINFO(); - SfxCommonTemplateDialog_Impl( SfxBindings* pB, SfxDockingWindow* ); + SfxCommonTemplateDialog_Impl( SfxBindings* pB, Window*, bool ); ~SfxCommonTemplateDialog_Impl(); DECL_LINK( MenuSelectHdl, Menu * ); @@ -286,9 +286,10 @@ private: friend class SfxTemplateControllerItem; friend class SfxTemplateDialogWrapper; friend class DropToolBox_Impl; + friend class SfxTemplatePanelControl; - SfxTemplateDialog* m_pFloat; - sal_Bool m_bZoomIn; + Window* m_pFloat; + sal_Bool m_bZoomIn; DropToolBox_Impl m_aActionTbL; ToolBox m_aActionTbR; @@ -319,8 +320,11 @@ public: friend class SfxTemplateDialog; TYPEINFO(); - SfxTemplateDialog_Impl( Window* pParent, SfxBindings*, SfxTemplateDialog* pWindow ); + SfxTemplateDialog_Impl( SfxBindings*, SfxTemplateDialog* pDlgWindow ); + SfxTemplateDialog_Impl( SfxBindings*, SfxTemplatePanelControl* pDlgWindow ); ~SfxTemplateDialog_Impl(); + + void Initialize (void); }; #endif // #ifndef _SFX_TEMPDLGI_HXX diff --git a/sfx2/source/sidebar/AsynchronousCall.cxx b/sfx2/source/sidebar/AsynchronousCall.cxx new file mode 100644 index 000000000000..54f5883622bd --- /dev/null +++ b/sfx2/source/sidebar/AsynchronousCall.cxx @@ -0,0 +1,87 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "AsynchronousCall.hxx" + +#include <vcl/svapp.hxx> + + +namespace sfx2 { namespace sidebar { + +AsynchronousCall::AsynchronousCall (const Action& rAction) + : maAction(rAction), + mnCallId(0) +{ +} + + + + +AsynchronousCall::~AsynchronousCall (void) +{ + CancelRequest(); +} + + + + +void AsynchronousCall::RequestCall (const Action& rAction) +{ + CancelRequest(); + maAction = rAction; + RequestCall(); +} + + + + +void AsynchronousCall::RequestCall (void) +{ + if (mnCallId == 0) + { + Link aLink (LINK(this, AsynchronousCall, HandleUserCall)); + mnCallId = Application::PostUserEvent(aLink); + } +} + + + + +void AsynchronousCall::CancelRequest (void) +{ + if (mnCallId != 0) + { + Application::RemoveUserEvent(mnCallId); + mnCallId = -1; + } +} + + + + +IMPL_LINK(AsynchronousCall, HandleUserCall, void*, EMPTYARG ) +{ + mnCallId = 0; + if (maAction) + maAction(); + + return sal_True; +} + + +} } // end of namespace sfx2::sidebar + diff --git a/sfx2/source/sidebar/AsynchronousCall.hxx b/sfx2/source/sidebar/AsynchronousCall.hxx new file mode 100644 index 000000000000..a1d0e2a883ef --- /dev/null +++ b/sfx2/source/sidebar/AsynchronousCall.hxx @@ -0,0 +1,51 @@ +/* + * 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 SFX_SIDEBAR_ASYNCHRONOUS_CALL_HXX +#define SFX_SIDEBAR_ASYNCHRONOUS_CALL_HXX + +#include <boost/function.hpp> +#include <tools/solar.h> +#include <tools/link.hxx> + +namespace sfx2 { namespace sidebar { + +/** A simple asynchronous call via Application::PostUserCall. +*/ +class AsynchronousCall +{ +public: + typedef ::boost::function<void(void)> Action; + + AsynchronousCall (const Action& rAction); + ~AsynchronousCall (void); + + void RequestCall (const Action& rAction); + void RequestCall (void); + void CancelRequest (void); + +private: + Action maAction; + sal_uLong mnCallId; + + DECL_LINK(HandleUserCall, void*); +}; + + +} } // end of namespace sfx2::sidebar + +#endif diff --git a/sfx2/source/sidebar/Context.cxx b/sfx2/source/sidebar/Context.cxx new file mode 100644 index 000000000000..99edf6d82a14 --- /dev/null +++ b/sfx2/source/sidebar/Context.cxx @@ -0,0 +1,116 @@ +/* + * 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 "Context.hxx" + +#define AnyApplicationName "any" +#define AnyContextName "any" + +namespace sfx2 { namespace sidebar { + +const sal_Int32 Context::NoMatch = 4; +const sal_Int32 Context::ApplicationWildcardMatch = 1; +const sal_Int32 Context::ContextWildcardMatch = 2; +const sal_Int32 Context::OptimalMatch = 0; // Neither application nor context name is "any". + +#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) + +Context::Context (void) + : msApplication(A2S(AnyApplicationName)), + msContext(A2S(AnyContextName)) +{ +} + + + + +Context::Context ( + const ::rtl::OUString& rsApplication, + const ::rtl::OUString& rsContext) + : msApplication(rsApplication), + msContext(rsContext) +{ +} + + + + +sal_Int32 Context::EvaluateMatch ( + const Context& rOther) const +{ + const bool bApplicationNameIsAny (rOther.msApplication.equalsAscii(AnyApplicationName)); + if (rOther.msApplication.equals(msApplication) || bApplicationNameIsAny) + { + // Application name matches. + const bool bContextNameIsAny (rOther.msContext.equalsAscii(AnyContextName)); + if (rOther.msContext.equals(msContext) || bContextNameIsAny) + { + // Context name matches. + return (bApplicationNameIsAny ? ApplicationWildcardMatch : 0) + + (bContextNameIsAny ? ContextWildcardMatch : 0); + } + } + return NoMatch; +} + + + + +sal_Int32 Context::EvaluateMatch (const ::std::vector<Context>& rOthers) const +{ + sal_Int32 nBestMatch (NoMatch); + + for (::std::vector<Context>::const_iterator + iContext(rOthers.begin()), + iEnd(rOthers.end()); + iContext!=iEnd; + ++iContext) + { + const sal_Int32 nMatch (EvaluateMatch(*iContext)); + if (nMatch < nBestMatch) + { + if (nMatch == OptimalMatch) + { + // We will find no better match so stop searching. + return OptimalMatch; + } + nBestMatch = nMatch; + } + } + return nBestMatch; +} + + + + +bool Context::operator== (const Context& rOther) const +{ + return msApplication.equals(rOther.msApplication) + && msContext.equals(rOther.msContext); +} + + + + +bool Context::operator!= (const Context& rOther) const +{ + return ( ! msApplication.equals(rOther.msApplication)) + || ( ! msContext.equals(rOther.msContext)); +} + + +} } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/Context.hxx b/sfx2/source/sidebar/Context.hxx new file mode 100644 index 000000000000..df6fa631e64a --- /dev/null +++ b/sfx2/source/sidebar/Context.hxx @@ -0,0 +1,65 @@ +/* + * 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 SFX_SIDEBAR_CONTEXT_HXX +#define SFX_SIDEBAR_CONTEXT_HXX + +#include "rtl/ustring.hxx" + +#include <vector> + +namespace sfx2 { namespace sidebar { + +class Context +{ +public: + ::rtl::OUString msApplication; + ::rtl::OUString msContext; + + Context (void); + Context ( + const ::rtl::OUString& rsApplication, + const ::rtl::OUString& rsContext); + + /** When two contexts are matched against each other then + application or context name may have the wildcard value 'any'. + In order to prefer matches without wildcards over matches with + wildcards we introduce a integer evaluation for matches. + */ + const static sal_Int32 NoMatch; + const static sal_Int32 OptimalMatch; + const static sal_Int32 ApplicationWildcardMatch; + const static sal_Int32 ContextWildcardMatch; + + /** Return the numeric value that describes how good the match + between two contexts is. + Smaller values represent better matches. + */ + sal_Int32 EvaluateMatch (const Context& rOther) const; + + /** Return the best match against the given list of contexts. + */ + sal_Int32 EvaluateMatch (const ::std::vector<Context>& rOthers) const; + + bool operator== (const Context& rOther) const; + bool operator!= (const Context& rOther) const; +}; + + +} } // end of namespace sfx2::sidebar + +#endif diff --git a/sfx2/source/sidebar/ContextChangeBroadcaster.cxx b/sfx2/source/sidebar/ContextChangeBroadcaster.cxx new file mode 100644 index 000000000000..463d1512df9a --- /dev/null +++ b/sfx2/source/sidebar/ContextChangeBroadcaster.cxx @@ -0,0 +1,134 @@ +/* + * 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/ContextChangeBroadcaster.hxx" +#include "sfx2/sidebar/EnumContext.hxx" +#include <com/sun/star/ui/ContextChangeEventObject.hpp> +#include <com/sun/star/ui/ContextChangeEventMultiplexer.hpp> +#include <com/sun/star/frame/XModuleManager.hpp> +#include <comphelper/componentcontext.hxx> +#include <comphelper/processfactory.hxx> + + +using ::rtl::OUString; +using namespace css; +using namespace cssu; + +namespace sfx2 { namespace sidebar { + + +ContextChangeBroadcaster::ContextChangeBroadcaster (void) + : msContextName(), + mbIsContextActive(false) +{ +} + + + +ContextChangeBroadcaster::~ContextChangeBroadcaster (void) +{ +} + + + + +void ContextChangeBroadcaster::Initialize (const ::rtl::OUString& rsContextName) +{ + OSL_ASSERT( ! mbIsContextActive); + + msContextName = rsContextName; +} + + + + +void ContextChangeBroadcaster::Activate (const cssu::Reference<css::frame::XFrame>& rxFrame) +{ + if (msContextName.getLength() > 0) + BroadcastContextChange(rxFrame, GetModuleName(rxFrame), msContextName); +} + + + + +void ContextChangeBroadcaster::Deactivate (const cssu::Reference<css::frame::XFrame>& rxFrame) +{ + if (msContextName.getLength() > 0) + { + BroadcastContextChange( + rxFrame, + GetModuleName(rxFrame), + EnumContext::GetContextName(EnumContext::Context_Default)); + } +} + + + + +void ContextChangeBroadcaster::BroadcastContextChange ( + const cssu::Reference<css::frame::XFrame>& rxFrame, + const ::rtl::OUString& rsModuleName, + const ::rtl::OUString& rsContextName) +{ + if (rsContextName.getLength() == 0) + return; + + if ( ! rxFrame.is() || ! rxFrame->getController().is()) + { + // Frame is (probably) being deleted. Broadcasting context + // changes is not necessary anymore. + return; + } + + const css::ui::ContextChangeEventObject aEvent( + rxFrame->getController(), + rsModuleName, + rsContextName); + + cssu::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer ( + css::ui::ContextChangeEventMultiplexer::get( + ::comphelper::getProcessComponentContext())); + if (xMultiplexer.is()) + xMultiplexer->broadcastContextChangeEvent(aEvent, rxFrame->getController()); +} + + + + +OUString ContextChangeBroadcaster::GetModuleName (const cssu::Reference<css::frame::XFrame>& rxFrame) +{ + if ( ! rxFrame.is() || ! rxFrame->getController().is()) + return OUString(); + OUString sModuleName; + try + { + const ::comphelper::ComponentContext aContext (::comphelper::getProcessServiceFactory()); + const Reference<frame::XModuleManager> xModuleManager ( + aContext.createComponent("com.sun.star.frame.ModuleManager" ), + UNO_QUERY_THROW ); + return xModuleManager->identify(rxFrame); + } + catch (const Exception&) + { + OSL_ENSURE(false, "can not determine module name"); + } + return OUString(); +} + + + +} } // end of namespace ::sd::sidebar diff --git a/sfx2/source/sidebar/ContextList.cxx b/sfx2/source/sidebar/ContextList.cxx new file mode 100644 index 000000000000..aebfdbd1897d --- /dev/null +++ b/sfx2/source/sidebar/ContextList.cxx @@ -0,0 +1,100 @@ +/* + * 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 "ContextList.hxx" +#include "Context.hxx" + +using ::rtl::OUString; + +namespace sfx2 { namespace sidebar { + + +ContextList::ContextList (void) + : maEntries() +{ +} + + + + +ContextList::~ContextList (void) +{ +} + + + + +const ContextList::Entry* ContextList::GetMatch (const Context& rContext) const +{ + const ::std::vector<Entry>::const_iterator iEntry = FindBestMatch(rContext); + if (iEntry != maEntries.end()) + return &*iEntry; + else + return NULL; +} + + + + +::std::vector<ContextList::Entry>::const_iterator ContextList::FindBestMatch (const Context& rContext) const +{ + sal_Int32 nBestMatch (Context::NoMatch); + ::std::vector<Entry>::const_iterator iBestMatch (maEntries.end()); + + for (::std::vector<Entry>::const_iterator + iEntry(maEntries.begin()), + iEnd(maEntries.end()); + iEntry!=iEnd; + ++iEntry) + { + const sal_Int32 nMatch (rContext.EvaluateMatch(iEntry->maContext)); + if (nMatch < nBestMatch) + { + nBestMatch = nMatch; + iBestMatch = iEntry; + } + if (nBestMatch == Context::OptimalMatch) + return iEntry; + } + + return iBestMatch; +} + + + + +void ContextList::AddContextDescription ( + const Context& rContext, + const bool bIsInitiallyVisible, + const OUString& rsMenuCommand) +{ + maEntries.push_back(Entry()); + maEntries.back().maContext = rContext; + maEntries.back().mbIsInitiallyVisible = bIsInitiallyVisible; + maEntries.back().msMenuCommand = rsMenuCommand; +} + + + + +bool ContextList::IsEmpty (void) +{ + return maEntries.empty(); +} + + +} } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/ContextList.hxx b/sfx2/source/sidebar/ContextList.hxx new file mode 100644 index 000000000000..f026ff9d3305 --- /dev/null +++ b/sfx2/source/sidebar/ContextList.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 SFX_SIDEBAR_CONTEXT_LIST_HXX +#define SFX_SIDEBAR_CONTEXT_LIST_HXX + +#include "Context.hxx" +#include <sal/types.h> +#include <rtl/ustring.hxx> + +#include <vector> + + +namespace sfx2 { namespace sidebar { + + +class ContextList +{ +public: + ContextList (void); + ~ContextList (void); + + class Entry + { + public: + Context maContext; + bool mbIsInitiallyVisible; + ::rtl::OUString msMenuCommand; + }; + + /** Return <TRUE/> when the given context matches any of the stored contexts. + */ + const Entry* GetMatch ( + const Context& rContext) const; + + void AddContextDescription ( + const Context& rContext, + const bool bIsInitiallyVisible, + const ::rtl::OUString& rsMenuCommand); + + /** Returns <TRUE/> when no call to AddContextDescription() was made before. + */ + bool IsEmpty (void); + + +private: + ::std::vector<Entry> maEntries; + + ::std::vector<Entry>::const_iterator FindBestMatch (const Context& rContext) const; +}; + + +} } // end of namespace sfx2::sidebar + +#endif diff --git a/sfx2/source/sidebar/ContextMatcher.cxx b/sfx2/source/sidebar/ContextMatcher.cxx new file mode 100644 index 000000000000..9de3567d8da1 --- /dev/null +++ b/sfx2/source/sidebar/ContextMatcher.cxx @@ -0,0 +1,136 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "precompiled_sfx2.hxx" + +#include "ContextMatcher.hxx" +#include "Context.hxx" + +using ::rtl::OUString; + +namespace sfx2 { namespace sidebar { + +namespace { + static const sal_Char* gsAny = "any"; +} + + + +ContextMatcher::ContextMatcher (void) + : maEntries() +{ +} + + + + +ContextMatcher::~ContextMatcher (void) +{ +} + + + + +sal_Int32 ContextMatcher::EvaluateMatch ( + const Context& rContext) const +{ + sal_Int32 nBestMatch (Context::NoMatch); + + for (::std::vector<Entry>::const_iterator + iEntry(maEntries.begin()), + iEnd(maEntries.end()); + iEntry!=iEnd; + ++iEntry) + { + const sal_Int32 nMatch (EvaluateMatch(rContext, *iEntry)); + if (nMatch < nBestMatch) + nBestMatch = nMatch; + if (nBestMatch == Context::OptimalMatch) + break; + } + + return nBestMatch; +} + + + + +sal_Int32 ContextMatcher::EvaluateMatch ( + const Context& rContext, + const Entry& rEntry) const +{ + sal_Int32 nApplicationMatch (Context::NoMatch); + if (rContext.msApplication.equals(rEntry.msApplicationName)) + nApplicationMatch = 0; + else if (rEntry.msApplicationName.equalsAscii(gsAny)) + nApplicationMatch = Context::ApplicationWildcardMatch; + else + return Context::NoMatch; + + sal_Int32 nBestContextMatch (Context::NoMatch); + for (::std::vector<OUString>::const_iterator + iContext(rEntry.maContextNames.begin()), + iEnd(rEntry.maContextNames.end()); + iContext!=iEnd; + ++iContext) + { + sal_Int32 nContextMatch (Context::NoMatch); + if (rContext.msContext.equals(*iContext)) + nContextMatch = 0; + else if (iContext->equalsAscii(gsAny)) + nContextMatch = Context::ContextWildcardMatch; + else + continue; + if (nContextMatch < nBestContextMatch) + nBestContextMatch = nContextMatch; + } + + if (rEntry.mbIsContextListNegated) + nBestContextMatch = Context::NoMatch - nBestContextMatch; + + return nApplicationMatch + nBestContextMatch; +} + + + + +void ContextMatcher::AddMatcher ( + const ::rtl::OUString& rsApplicationName, + const ::std::vector<rtl::OUString>& rContextNames, + const bool bIsContextListNegated) +{ + maEntries.push_back(Entry()); + maEntries.back().msApplicationName = rsApplicationName; + maEntries.back().maContextNames = rContextNames; + maEntries.back().mbIsContextListNegated = bIsContextListNegated; +} + + + + +void ContextMatcher::AddMatcher ( + const ::rtl::OUString& rsApplicationName, + const ::rtl::OUString& rsContextName) +{ + maEntries.push_back(Entry()); + maEntries.back().msApplicationName = rsApplicationName; + maEntries.back().maContextNames.push_back(rsContextName); + maEntries.back().mbIsContextListNegated = false; +} + + +} } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/ContextMatcher.hxx b/sfx2/source/sidebar/ContextMatcher.hxx new file mode 100644 index 000000000000..f34c078702bf --- /dev/null +++ b/sfx2/source/sidebar/ContextMatcher.hxx @@ -0,0 +1,71 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SFX_SIDEBAR_CONTEXT_MATCHER_HXX +#define SFX_SIDEBAR_CONTEXT_MATCHER_HXX + +#include <sal/types.h> +#include <rtl/ustring.hxx> + +#include <vector> + + +namespace sfx2 { namespace sidebar { + +class Context; + + +/** Data read from the configuration for matching contexts. +*/ +class ContextMatcher +{ +public: + ContextMatcher (void); + ~ContextMatcher (void); + + sal_Int32 EvaluateMatch ( + const Context& rContext) const; + + void AddMatcher ( + const ::rtl::OUString& rsApplicationName, + const ::std::vector<rtl::OUString>& rContextNames, + const bool mbIsContextListNegated); + void AddMatcher ( + const ::rtl::OUString& rsApplicationName, + const ::rtl::OUString& rsContextName); + +private: + class Entry + { + public: + ::rtl::OUString msApplicationName; + ::std::vector<rtl::OUString> maContextNames; + bool mbIsContextListNegated; + }; + ::std::vector<Entry> maEntries; + + sal_Int32 EvaluateMatch ( + const Context& rContext, + const Entry& rEntry) const; + +}; +static bool IsMatchBetterThan (const sal_Int32 nMatchA, const sal_Int32 nMatchB); + + +} } // end of namespace sfx2::sidebar + +#endif diff --git a/sfx2/source/sidebar/ControlFactory.cxx b/sfx2/source/sidebar/ControlFactory.cxx new file mode 100644 index 000000000000..43946e0cd061 --- /dev/null +++ b/sfx2/source/sidebar/ControlFactory.cxx @@ -0,0 +1,82 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "sidebar/ControlFactory.hxx" + +#include "MenuButton.hxx" +#include "TabItem.hxx" +#include "SidebarToolBox.hxx" +#include "ToolBoxBackground.hxx" +#include "CustomImageRadioButton.hxx" +#include <vcl/toolbox.hxx> + + +namespace sfx2 { namespace sidebar { + + +CheckBox* ControlFactory::CreateMenuButton (Window* pParentWindow) +{ + return new MenuButton(pParentWindow); +} + + + + +ImageRadioButton* ControlFactory::CreateTabItem (Window* pParentWindow) +{ + return new TabItem(pParentWindow); +} + + + + +ToolBox* ControlFactory::CreateToolBox ( + Window* pParentWindow, + const ResId& rResId) +{ + SidebarToolBox* pToolBox = new SidebarToolBox(pParentWindow, rResId); + pToolBox->SetBorderWindow(pParentWindow); + + pToolBox->Invalidate(); + + return pToolBox; +} + + + + +Window* ControlFactory::CreateToolBoxBackground ( + Window* pParentWindow) +{ + ToolBoxBackground* pBorderWindow = new ToolBoxBackground(pParentWindow); + pBorderWindow->Show(); + return pBorderWindow; +} + + + + +ImageRadioButton* ControlFactory::CreateCustomImageRadionButton( + Window* pParentWindow, + const ResId& rResId ) +{ + return new CustomImageRadioButton( + pParentWindow, + rResId ); +} + +} } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/ControllerItem.cxx b/sfx2/source/sidebar/ControllerItem.cxx new file mode 100644 index 000000000000..e00241250227 --- /dev/null +++ b/sfx2/source/sidebar/ControllerItem.cxx @@ -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 . + */ +#include "sidebar/ControllerItem.hxx" + +namespace sfx2 { namespace sidebar { + +ControllerItem::ControllerItem ( + const sal_uInt16 nInId, + SfxBindings &rBindings, + ItemUpdateReceiverInterface& rItemUpdateReceiver) + : SfxControllerItem(nInId, rBindings), + mrItemUpdateReceiver(rItemUpdateReceiver) +{ +} + + + + +ControllerItem::~ControllerItem (void) +{ +} + + + + +void ControllerItem::StateChanged ( + sal_uInt16 nSID, + SfxItemState eState, + const SfxPoolItem* pState) +{ + mrItemUpdateReceiver.NotifyItemUpdate(nSID, eState, pState); +} + +ControllerItem::ItemUpdateReceiverInterface::~ItemUpdateReceiverInterface() +{ +} + + +} } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/CustomImageRadioButton.cxx b/sfx2/source/sidebar/CustomImageRadioButton.cxx new file mode 100644 index 000000000000..adc0eed9cc97 --- /dev/null +++ b/sfx2/source/sidebar/CustomImageRadioButton.cxx @@ -0,0 +1,74 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "CustomImageRadioButton.hxx" + +#include "DrawHelper.hxx" +#include "Paint.hxx" +#include "Tools.hxx" + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; + + +namespace sfx2 { namespace sidebar { + + +CustomImageRadioButton::CustomImageRadioButton ( + Window* pParentWindow, + const ResId& rResId ) + : ImageRadioButton( pParentWindow, rResId ) +{ + SetStyle( GetStyle() | WB_NOPOINTERFOCUS ); +} + + +CustomImageRadioButton::~CustomImageRadioButton (void) +{ +} + + +void CustomImageRadioButton::Paint (const Rectangle& /*rUpdateArea*/) +{ + Rectangle aPaintRect( Rectangle(Point(0,0), GetSizePixel() ) ); + SetMouseRect( aPaintRect ); + SetStateRect( aPaintRect ); + + const Theme::ThemeItem eBackground = + IsMouseOver() + ? Theme::Paint_TabItemBackgroundHighlight + : Theme::Paint_PanelBackground; + DrawHelper::DrawRoundedRectangle( + *this, + aPaintRect, + Theme::GetInteger(Theme::Int_ButtonCornerRadius), + IsChecked() || IsMouseOver() ? Theme::GetColor(Theme::Color_TabItemBorder) : Color(0xffffffff), + Theme::GetPaint( eBackground ) ); + + const Image& rIcon = GetModeRadioImage(); + const Size aIconSize (rIcon.GetSizePixel()); + const Point aIconLocation( + (GetSizePixel().Width() - aIconSize.Width())/2, + (GetSizePixel().Height() - aIconSize.Height())/2 ); + DrawImage( + aIconLocation, + rIcon, + IsEnabled() ? 0 : IMAGE_DRAW_DISABLE ); +} + + +} } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/CustomImageRadioButton.hxx b/sfx2/source/sidebar/CustomImageRadioButton.hxx new file mode 100644 index 000000000000..a0e9614610f2 --- /dev/null +++ b/sfx2/source/sidebar/CustomImageRadioButton.hxx @@ -0,0 +1,45 @@ +/* + * 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 SFX_SIDEBAR_CUSTOM_IMAGE_RADIO_BUTTON_HXX +#define SFX_SIDEBAR_CUSTOM_IMAGE_RADIO_BUTTON_HXX + +#include "vcl/button.hxx" + +#include "sfx2/sidebar/Theme.hxx" + +namespace sfx2 { namespace sidebar { + +/** A custom image radion button with more control over used colors for sidebar +*/ +class CustomImageRadioButton + : public ImageRadioButton +{ +public: + CustomImageRadioButton( + Window* pParentWindow, + const ResId& rResId ); + + virtual ~CustomImageRadioButton(void); + + virtual void Paint( const Rectangle& rUpdateArea ); +}; + + +} } // end of namespace sfx2::sidebar + +#endif diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx new file mode 100644 index 000000000000..a1f32ebed59b --- /dev/null +++ b/sfx2/source/sidebar/Deck.cxx @@ -0,0 +1,384 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "Deck.hxx" +#include "DeckDescriptor.hxx" +#include "DeckLayouter.hxx" +#include "DrawHelper.hxx" +#include "DeckTitleBar.hxx" +#include "Paint.hxx" +#include "Panel.hxx" +#include "ToolBoxBackground.hxx" +#include "Tools.hxx" +#include "sfx2/sidebar/Theme.hxx" + +#include <vcl/dockwin.hxx> +#include <vcl/scrbar.hxx> +#include <tools/svborder.hxx> + +#include <boost/bind.hpp> + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; + + +namespace sfx2 { namespace sidebar { + + +namespace { + static const sal_Int32 MinimalPanelHeight (25); +} + + +Deck::Deck ( + const DeckDescriptor& rDeckDescriptor, + Window* pParentWindow, + const ::boost::function<void(void)>& rCloserAction) + : Window(pParentWindow, 0), + msId(rDeckDescriptor.msId), + maIcon(), + msIconURL(rDeckDescriptor.msIconURL), + msHighContrastIconURL(rDeckDescriptor.msHighContrastIconURL), + maPanels(), + mpTitleBar(new DeckTitleBar(rDeckDescriptor.msTitle, this, rCloserAction)), + mpScrollClipWindow(new Window(this)), + mpScrollContainer(new ScrollContainerWindow(mpScrollClipWindow.get())), + mpFiller(new Window(this)), + mpVerticalScrollBar(new ScrollBar(this)) +{ + SetBackground(Wallpaper()); + + mpScrollClipWindow->SetBackground(Wallpaper()); + mpScrollClipWindow->Show(); + + mpScrollContainer->SetStyle(mpScrollContainer->GetStyle() | WB_DIALOGCONTROL); + mpScrollContainer->SetBackground(Wallpaper()); + mpScrollContainer->Show(); + + mpVerticalScrollBar->SetScrollHdl(LINK(this, Deck, HandleVerticalScrollBarChange)); + +#ifdef DEBUG + SetText(A2S("Deck")); + mpScrollClipWindow->SetText(A2S("ScrollClipWindow")); + mpFiller->SetText(A2S("Filler")); + mpVerticalScrollBar->SetText(A2S("VerticalScrollBar")); +#endif +} + + + + +Deck::~Deck (void) +{ + Dispose(); + + // We have to explicitly trigger the destruction of panels. + // Otherwise that is done by one of our base class destructors + // without updating maPanels. + maPanels.clear(); +} + + + + +void Deck::Dispose (void) +{ + SharedPanelContainer aPanels; + aPanels.swap(maPanels); + for (SharedPanelContainer::iterator + iPanel(aPanels.begin()), + iEnd(aPanels.end()); + iPanel!=iEnd; + ++iPanel) + { + if (*iPanel) + { + (*iPanel)->Dispose(); + OSL_ASSERT(iPanel->unique()); + iPanel->reset(); + } + } + + mpTitleBar.reset(); + mpFiller.reset(); + mpVerticalScrollBar.reset(); +} + + + + +const ::rtl::OUString& Deck::GetId (void) const +{ + return msId; +} + + + + +DeckTitleBar* Deck::GetTitleBar (void) const +{ + return mpTitleBar.get(); +} + + + + +Rectangle Deck::GetContentArea (void) const +{ + const Size aWindowSize (GetSizePixel()); + const int nBorderSize (Theme::GetInteger(Theme::Int_DeckBorderSize)); + + return Rectangle( + Theme::GetInteger(Theme::Int_DeckLeftPadding) + nBorderSize, + Theme::GetInteger(Theme::Int_DeckTopPadding) + nBorderSize, + aWindowSize.Width() - 1 - Theme::GetInteger(Theme::Int_DeckRightPadding) - nBorderSize, + aWindowSize.Height() - 1 - Theme::GetInteger(Theme::Int_DeckBottomPadding) - nBorderSize); +} + + + + +::rtl::OUString Deck::GetIconURL (const bool bIsHighContrastModeActive) const +{ + if (bIsHighContrastModeActive) + return msHighContrastIconURL; + else + return msIconURL; +} + + + + +void Deck::Paint (const Rectangle& rUpdateArea) +{ + (void) rUpdateArea; + + const Size aWindowSize (GetSizePixel()); + const SvBorder aPadding ( + Theme::GetInteger(Theme::Int_DeckLeftPadding), + Theme::GetInteger(Theme::Int_DeckTopPadding), + Theme::GetInteger(Theme::Int_DeckRightPadding), + Theme::GetInteger(Theme::Int_DeckBottomPadding)); + + // Paint deck background outside the border. + Rectangle aBox( + 0, + 0, + aWindowSize.Width() - 1, + aWindowSize.Height() - 1); + DrawHelper::DrawBorder( + *this, + aBox, + aPadding, + Theme::GetPaint(Theme::Paint_DeckBackground), + Theme::GetPaint(Theme::Paint_DeckBackground)); + + // Paint the border. + const int nBorderSize (Theme::GetInteger(Theme::Int_DeckBorderSize)); + aBox.Left() += aPadding.Left(); + aBox.Top() += aPadding.Top(); + aBox.Right() -= aPadding.Right(); + aBox.Bottom() -= aPadding.Bottom(); + const sfx2::sidebar::Paint& rHorizontalBorderPaint (Theme::GetPaint(Theme::Paint_HorizontalBorder)); + DrawHelper::DrawBorder( + *this, + aBox, + SvBorder(nBorderSize, nBorderSize, nBorderSize, nBorderSize), + rHorizontalBorderPaint, + Theme::GetPaint(Theme::Paint_VerticalBorder)); +} + + + + +void Deck::DataChanged (const DataChangedEvent& rEvent) +{ + (void)rEvent; + RequestLayout(); +} + + + + +void Deck::SetPanels (const SharedPanelContainer& rPanels) +{ + maPanels = rPanels; + + RequestLayout(); +} + + + + +const SharedPanelContainer& Deck::GetPanels (void) const +{ + return maPanels; +} + + + + +void Deck::RequestLayout (void) +{ + // PrintWindowTree(); + + DeckLayouter::LayoutDeck( + GetContentArea(), + maPanels, + *GetTitleBar(), + *mpScrollClipWindow, + *mpScrollContainer, + *mpFiller, + *mpVerticalScrollBar); + + Invalidate(); +} + + + + +::Window* Deck::GetPanelParentWindow (void) +{ + return mpScrollContainer.get(); +} + + + + +const char* GetWindowClassification (const Window* pWindow) +{ + const String& rsName (pWindow->GetText()); + if (rsName.Len() > 0) + { + return ::rtl::OUStringToOString(rsName, RTL_TEXTENCODING_ASCII_US).getStr(); + } + else + { + static char msWindow[] = "window"; + return msWindow; + } +} + + +void Deck::PrintWindowSubTree (Window* pRoot, int nIndentation) +{ + static const char* sIndentation = " "; + const Point aLocation (pRoot->GetPosPixel()); + const Size aSize (pRoot->GetSizePixel()); + const char* sClassification = GetWindowClassification(pRoot); + const char* sVisible = pRoot->IsVisible() ? "visible" : "hidden"; + OSL_TRACE("%s%x %s %s +%d+%d x%dx%d", + sIndentation+strlen(sIndentation)-nIndentation*4, + pRoot, + sClassification, + sVisible, + aLocation.X(),aLocation.Y(), + aSize.Width(),aSize.Height()); + + const sal_uInt16 nChildCount (pRoot->GetChildCount()); + for (sal_uInt16 nIndex=0; nIndex<nChildCount; ++nIndex) + PrintWindowSubTree(pRoot->GetChild(nIndex), nIndentation+1); +} + + + + +void Deck::PrintWindowTree (void) +{ + PrintWindowSubTree(this, 0); +} + + + + +void Deck::PrintWindowTree (const ::std::vector<Panel*>& rPanels) +{ + (void)rPanels; + + PrintWindowTree(); +} + + + + +IMPL_LINK(Deck, HandleVerticalScrollBarChange,void*, EMPTYARG) +{ + const sal_Int32 nYOffset (-mpVerticalScrollBar->GetThumbPos()); + mpScrollContainer->SetPosPixel( + Point( + mpScrollContainer->GetPosPixel().X(), + nYOffset)); + return sal_True; +} + + + + +//----- Deck::ScrollContainerWindow ------------------------------------------- + +Deck::ScrollContainerWindow::ScrollContainerWindow (Window* pParentWindow) + : Window(pParentWindow), + maSeparators() +{ +#ifdef DEBUG + SetText(A2S("ScrollContainerWindow")); +#endif +} + + + + +Deck::ScrollContainerWindow::~ScrollContainerWindow (void) +{ +} + + + + +void Deck::ScrollContainerWindow::Paint (const Rectangle& rUpdateArea) +{ + (void)rUpdateArea; + + // Paint the separators. + const sal_Int32 nSeparatorHeight (Theme::GetInteger(Theme::Int_DeckSeparatorHeight)); + const sal_Int32 nLeft (0); + const sal_Int32 nRight (GetSizePixel().Width()-1); + const sfx2::sidebar::Paint& rHorizontalBorderPaint (Theme::GetPaint(Theme::Paint_HorizontalBorder)); + for (::std::vector<sal_Int32>::const_iterator iY(maSeparators.begin()), iEnd(maSeparators.end()); + iY!=iEnd; + ++iY) + { + DrawHelper::DrawHorizontalLine( + *this, + nLeft, + nRight, + *iY, + nSeparatorHeight, + rHorizontalBorderPaint); + } +} + + + + +void Deck::ScrollContainerWindow::SetSeparators (const ::std::vector<sal_Int32>& rSeparators) +{ + maSeparators = rSeparators; +} + +} } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/Deck.hxx b/sfx2/source/sidebar/Deck.hxx new file mode 100644 index 000000000000..ae1cf196ad42 --- /dev/null +++ b/sfx2/source/sidebar/Deck.hxx @@ -0,0 +1,101 @@ +/* + * 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 SFX_SIDEBAR_DECK_HXX +#define SFX_SIDEBAR_DECK_HXX + +#include "Panel.hxx" + +#include <vcl/window.hxx> +#include <vcl/image.hxx> +#include <com/sun/star/ui/LayoutSize.hpp> + +#include <boost/function.hpp> +#include <boost/scoped_ptr.hpp> + +class ScrollBar; + +namespace css = ::com::sun::star; + +namespace sfx2 { namespace sidebar { + +class DeckDescriptor; +class DeckTitleBar; + + +/** This is the parent window of the panels. + It displays the deck title. +*/ +class Deck + : public Window +{ +public: + Deck ( + const DeckDescriptor& rDeckDescriptor, + Window* pParentWindow, + const ::boost::function<void(void)>& rCloserAction); + virtual ~Deck (void); + + void Dispose (void); + + const ::rtl::OUString& GetId (void) const; + DeckTitleBar* GetTitleBar (void) const; + Rectangle GetContentArea (void) const; + ::rtl::OUString GetIconURL (const bool bIsHighContrastModeActive) const; + void SetPanels (const SharedPanelContainer& rPanels); + const SharedPanelContainer& GetPanels (void) const; + void RequestLayout (void); + ::Window* GetPanelParentWindow (void); + + virtual void Paint (const Rectangle& rUpdateArea); + virtual void DataChanged (const DataChangedEvent& rEvent); + + void PrintWindowTree (void); + void PrintWindowTree (const ::std::vector<Panel*>& rPanels); + static void PrintWindowSubTree (Window* pRoot, int nIndentation); + + class ScrollContainerWindow : public Window + { + public: + ScrollContainerWindow (Window* pParentWindow); + virtual ~ScrollContainerWindow (void); + virtual void Paint (const Rectangle& rUpdateArea); + void SetSeparators (const ::std::vector<sal_Int32>& rSeparators); + private: + ::std::vector<sal_Int32> maSeparators; + }; + +private: + const ::rtl::OUString msTitle; + const ::rtl::OUString msId; + Image maIcon; + const ::rtl::OUString msIconURL; + const ::rtl::OUString msHighContrastIconURL; + SharedPanelContainer maPanels; + ::boost::scoped_ptr<DeckTitleBar> mpTitleBar; + ::boost::scoped_ptr<Window> mpScrollClipWindow; + ::boost::scoped_ptr<ScrollContainerWindow> mpScrollContainer; + ::boost::scoped_ptr<Window> mpFiller; + ::boost::scoped_ptr<ScrollBar> mpVerticalScrollBar; + + DECL_LINK(HandleVerticalScrollBarChange,void*); +}; + + +} } // end of namespace sfx2::sidebar + +#endif diff --git a/sfx2/source/sidebar/DeckConfiguration.cxx b/sfx2/source/sidebar/DeckConfiguration.cxx new file mode 100644 index 000000000000..7e87e04b0897 --- /dev/null +++ b/sfx2/source/sidebar/DeckConfiguration.cxx @@ -0,0 +1,51 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "precompiled_sfx2.hxx" + +#include "DeckConfiguration.hxx" +#include "Deck.hxx" + + +namespace sfx2 { namespace sidebar { + +DeckConfiguration::DeckConfiguration (void) + : mpDeck(NULL), + maPanels() +{ +} + + + + +void DeckConfiguration::Dispose (void) +{ + if (mpDeck != NULL) + { + mpDeck->Dispose(); + + Deck* pDeck = mpDeck; + mpDeck = NULL; + OSL_TRACE("deleting deck window subtree"); + pDeck->PrintWindowTree(); + delete pDeck; + } +} + + + +} } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/DeckConfiguration.hxx b/sfx2/source/sidebar/DeckConfiguration.hxx new file mode 100644 index 000000000000..8b118cbd6a37 --- /dev/null +++ b/sfx2/source/sidebar/DeckConfiguration.hxx @@ -0,0 +1,45 @@ +/* + * 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 SFX_SIDEBAR_DECK_CONFIGURATION_HXX +#define SFX_SIDEBAR_DECK_CONFIGURATION_HXX + +#include <vector> + +namespace sfx2 { namespace sidebar { + +class Deck; +class Panel; + + +class DeckConfiguration +{ +public: + Deck* mpDeck; + ::std::vector<Panel*> maPanels; + + DeckConfiguration (void); + + void Dispose (void); +}; + + + + +} } // end of namespace sfx2::sidebar + +#endif diff --git a/sfx2/source/sidebar/DeckDescriptor.cxx b/sfx2/source/sidebar/DeckDescriptor.cxx new file mode 100644 index 000000000000..be0c77d088a3 --- /dev/null +++ b/sfx2/source/sidebar/DeckDescriptor.cxx @@ -0,0 +1,57 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "DeckDescriptor.hxx" + +namespace sfx2 { namespace sidebar { + +DeckDescriptor::DeckDescriptor (void) + : msTitle(), + msId(), + msIconURL(), + msHighContrastIconURL(), + msHelpURL(), + msHelpText(), + maContextList(), + mnOrderIndex(10000) // Default value as defined in Sidebar.xcs +{ +} + + + + +DeckDescriptor::DeckDescriptor (const DeckDescriptor& rOther) + : msTitle(rOther.msTitle), + msId(rOther.msId), + msIconURL(rOther.msIconURL), + msHighContrastIconURL(rOther.msHighContrastIconURL), + msHelpURL(rOther.msHelpURL), + msHelpText(rOther.msHelpText), + maContextList(rOther.maContextList), + mnOrderIndex(rOther.mnOrderIndex) +{ +} + + + + +DeckDescriptor::~DeckDescriptor (void) +{ +} + +} } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/DeckDescriptor.hxx b/sfx2/source/sidebar/DeckDescriptor.hxx new file mode 100644 index 000000000000..2c5a3d481f65 --- /dev/null +++ b/sfx2/source/sidebar/DeckDescriptor.hxx @@ -0,0 +1,49 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SFX_SIDEBAR_DECK_DESCRIPTOR_HXX +#define SFX_SIDEBAR_DECK_DESCRIPTOR_HXX + +#include "sfx2/sidebar/EnumContext.hxx" +#include "ContextList.hxx" +#include <boost/shared_ptr.hpp> + + +namespace sfx2 { namespace sidebar { + +class DeckDescriptor +{ +public: + ::rtl::OUString msTitle; + ::rtl::OUString msId; + ::rtl::OUString msIconURL; + ::rtl::OUString msHighContrastIconURL; + ::rtl::OUString msHelpURL; + ::rtl::OUString msHelpText; + ContextList maContextList; + bool mbIsEnabled; + sal_Int32 mnOrderIndex; + + DeckDescriptor (void); + DeckDescriptor (const DeckDescriptor& rOther); + ~DeckDescriptor (void); +}; +typedef ::boost::shared_ptr<DeckDescriptor> SharedDeckDescriptor; + +} } // end of namespace sfx2::sidebar + +#endif diff --git a/sfx2/source/sidebar/DeckLayouter.cxx b/sfx2/source/sidebar/DeckLayouter.cxx new file mode 100644 index 000000000000..b04f83b633d4 --- /dev/null +++ b/sfx2/source/sidebar/DeckLayouter.cxx @@ -0,0 +1,511 @@ +/* + * 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 "DeckLayouter.hxx" +#include "sfx2/sidebar/Theme.hxx" +#include "Panel.hxx" +#include "TitleBar.hxx" +#include "Deck.hxx" + +#include <vcl/window.hxx> +#include <vcl/scrbar.hxx> + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; + + +namespace sfx2 { namespace sidebar { + + +namespace { + static const sal_Int32 MinimalPanelHeight (25); +} + +#define IterateLayoutItems(iterator_name,container) \ + for(::std::vector<LayoutItem>::iterator \ + iterator_name(container.begin()), \ + iEnd(container.end()); \ + iterator_name!=iEnd; \ + ++iterator_name) + + + +void DeckLayouter::LayoutDeck ( + const Rectangle aContentArea, + SharedPanelContainer& rPanels, + Window& rDeckTitleBar, + Window& rScrollClipWindow, + Window& rScrollContainer, + Window& rFiller, + ScrollBar& rVerticalScrollBar) +{ + if (aContentArea.GetWidth()<=0 || aContentArea.GetHeight()<=0) + return; + Rectangle aBox (PlaceDeckTitle(rDeckTitleBar, aContentArea)); + + if ( ! rPanels.empty()) + { + // Prepare the layout item container. + ::std::vector<LayoutItem> aLayoutItems; + aLayoutItems.resize(rPanels.size()); + for (sal_Int32 nIndex(0),nCount(rPanels.size()); nIndex<nCount; ++nIndex) + { + aLayoutItems[nIndex].mpPanel = rPanels[nIndex]; + aLayoutItems[nIndex].mnPanelIndex = nIndex; + } + aBox = LayoutPanels( + aBox, + aLayoutItems, + rScrollClipWindow, + rScrollContainer, + rVerticalScrollBar, + false); + } + UpdateFiller(rFiller, aBox); +} + + + + +Rectangle DeckLayouter::LayoutPanels ( + const Rectangle aContentArea, + ::std::vector<LayoutItem>& rLayoutItems, + Window& rScrollClipWindow, + Window& rScrollContainer, + ScrollBar& rVerticalScrollBar, + const bool bShowVerticalScrollBar) +{ + Rectangle aBox (PlaceVerticalScrollBar(rVerticalScrollBar, aContentArea, bShowVerticalScrollBar)); + + const sal_Int32 nWidth (aBox.GetWidth()); + + // Get the requested heights of the panels and the available + // height that is left when all panel titles and separators are + // taken into account. + sal_Int32 nAvailableHeight (aBox.GetHeight()); + GetRequestedSizes(rLayoutItems, nAvailableHeight, aBox); + const sal_Int32 nTotalDecorationHeight (aBox.GetHeight() - nAvailableHeight); + + // Analyze the requested heights. + // Determine the height that is available for panel content + // and count the different layouts. + sal_Int32 nTotalPreferredHeight (0); + sal_Int32 nTotalMinimumHeight (0); + IterateLayoutItems(iItem,rLayoutItems) + { + nTotalMinimumHeight += iItem->maLayoutSize.Minimum; + nTotalPreferredHeight += iItem->maLayoutSize.Preferred; + } + + if (nTotalMinimumHeight > nAvailableHeight + && ! bShowVerticalScrollBar) + { + // Not enough space, even when all panels are shrunk to their + // minimum height. + // Show a vertical scrollbar. + return LayoutPanels( + aContentArea, + rLayoutItems, + rScrollClipWindow, + rScrollContainer, + rVerticalScrollBar, + true); + } + + // We are now in one of three modes. + // - The preferred height fits into the available size: + // Use the preferred size, distribute the remaining height bei + // enlarging panels. + // - The total minimum height fits into the available size: + // Use the minimum size, distribute the remaining height bei + // enlarging panels. + // - The total minimum height does not fit into the available + // size: + // Use the unmodified preferred height for all panels. + + LayoutMode eMode (MinimumOrLarger); + if (bShowVerticalScrollBar) + eMode = Preferred; + else if (nTotalPreferredHeight <= nAvailableHeight) + eMode = PreferredOrLarger; + else + eMode = MinimumOrLarger; + + if (eMode != Preferred) + { + const sal_Int32 nTotalHeight (eMode==MinimumOrLarger ? nTotalMinimumHeight : nTotalPreferredHeight); + + DistributeHeights( + rLayoutItems, + nAvailableHeight-nTotalHeight, + aBox.GetHeight(), + eMode==MinimumOrLarger); + } + + // Set position and size of the mpScrollClipWindow to the available + // size. Its child, the mpScrollContainer, may have a bigger + // height. + rScrollClipWindow.setPosSizePixel(aBox.Left(), aBox.Top(), aBox.GetWidth(), aBox.GetHeight()); + + const sal_Int32 nContentHeight ( + eMode==Preferred + ? nTotalPreferredHeight + nTotalDecorationHeight + : aBox.GetHeight()); + sal_Int32 nY = rVerticalScrollBar.GetThumbPos(); + if (nContentHeight-nY < aBox.GetHeight()) + nY = nContentHeight-aBox.GetHeight(); + if (nY < 0) + nY = 0; + rScrollContainer.setPosSizePixel( + 0, + -nY, + nWidth, + nContentHeight); + + if (bShowVerticalScrollBar) + SetupVerticalScrollBar(rVerticalScrollBar, nContentHeight, aBox.GetHeight()); + + const sal_Int32 nUsedHeight (PlacePanels(rLayoutItems, nWidth, eMode, rScrollContainer)); + aBox.Top() += nUsedHeight; + return aBox; +} + + + + +sal_Int32 DeckLayouter::PlacePanels ( + ::std::vector<LayoutItem>& rLayoutItems, + const sal_Int32 nWidth, + const LayoutMode eMode, + Window& rScrollContainer) +{ + ::std::vector<sal_Int32> aSeparators; + const sal_Int32 nDeckSeparatorHeight (Theme::GetInteger(Theme::Int_DeckSeparatorHeight)); + const sal_Int32 nPanelTitleBarHeight (Theme::GetInteger(Theme::Int_PanelTitleBarHeight)); + sal_Int32 nY (0); + + // Assign heights and places. + IterateLayoutItems(iItem,rLayoutItems) + { + if (iItem->mpPanel == NULL) + continue; + + Panel& rPanel (*iItem->mpPanel); + + // Separator above the panel title bar. + aSeparators.push_back(nY); + nY += nDeckSeparatorHeight; + + // Place the title bar. + TitleBar* pTitleBar = rPanel.GetTitleBar(); + if (pTitleBar != NULL) + { + if (iItem->mbShowTitleBar) + { + pTitleBar->setPosSizePixel(0, nY, nWidth, nPanelTitleBarHeight); + pTitleBar->Show(); + nY += nPanelTitleBarHeight; + } + else + { + pTitleBar->Hide(); + } + } + + if (rPanel.IsExpanded()) + { + rPanel.Show(); + + // Determine the height of the panel depending on layout + // mode and distributed heights. + sal_Int32 nPanelHeight (0); + switch(eMode) + { + case MinimumOrLarger: + nPanelHeight = iItem->maLayoutSize.Minimum + iItem->mnDistributedHeight; + break; + case PreferredOrLarger: + nPanelHeight = iItem->maLayoutSize.Preferred + iItem->mnDistributedHeight; + break; + case Preferred: + nPanelHeight = iItem->maLayoutSize.Preferred; + break; + default: + OSL_ASSERT(false); + break; + } + + // Place the panel. + rPanel.setPosSizePixel(0, nY, nWidth, nPanelHeight); + + nY += nPanelHeight; + } + else + { + rPanel.Hide(); + + // Add a separator below the collapsed panel, if it is the + // last panel in the deck. + if (iItem == rLayoutItems.end()-1) + { + // Separator below the panel title bar. + aSeparators.push_back(nY); + nY += nDeckSeparatorHeight; + } + } + } + + Deck::ScrollContainerWindow* pScrollContainerWindow + = dynamic_cast<Deck::ScrollContainerWindow*>(&rScrollContainer); + if (pScrollContainerWindow != NULL) + pScrollContainerWindow->SetSeparators(aSeparators); + + return nY; +} + + + + +void DeckLayouter::GetRequestedSizes ( + ::std::vector<LayoutItem>& rLayoutItems, + sal_Int32& rAvailableHeight, + const Rectangle& rContentBox) +{ + rAvailableHeight = rContentBox.GetHeight(); + + const sal_Int32 nPanelTitleBarHeight (Theme::GetInteger(Theme::Int_PanelTitleBarHeight)); + const sal_Int32 nDeckSeparatorHeight (Theme::GetInteger(Theme::Int_DeckSeparatorHeight)); + + IterateLayoutItems(iItem,rLayoutItems) + { + ui::LayoutSize aLayoutSize (ui::LayoutSize(0,0,0)); + if (iItem->mpPanel != NULL) + { + if (rLayoutItems.size() == 1 + && iItem->mpPanel->IsTitleBarOptional()) + { + // There is only one panel and its title bar is + // optional => hide it. + rAvailableHeight -= nDeckSeparatorHeight; + iItem->mbShowTitleBar = false; + } + else + { + // Show the title bar and a separator above and below + // the title bar. + rAvailableHeight -= nPanelTitleBarHeight; + rAvailableHeight -= nDeckSeparatorHeight; + } + + if (iItem->mpPanel->IsExpanded()) + { + Reference<ui::XSidebarPanel> xPanel (iItem->mpPanel->GetPanelComponent()); + if (xPanel.is()) + aLayoutSize = xPanel->getHeightForWidth(rContentBox.GetWidth()); + else + aLayoutSize = ui::LayoutSize(MinimalPanelHeight, 0, -1); + } + } + iItem->maLayoutSize = aLayoutSize; + } +} + + + + +void DeckLayouter::DistributeHeights ( + ::std::vector<LayoutItem>& rLayoutItems, + const sal_Int32 nHeightToDistribute, + const sal_Int32 nContainerHeight, + const bool bMinimumHeightIsBase) +{ + if (nHeightToDistribute <= 0) + return; + + sal_Int32 nRemainingHeightToDistribute (nHeightToDistribute); + + // Compute the weights as difference between panel base height + // (either its minimum or preferred height) and the container height. + sal_Int32 nTotalWeight (0); + sal_Int32 nNoMaximumCount (0); + IterateLayoutItems(iItem,rLayoutItems) + { + if (iItem->maLayoutSize.Maximum == 0) + continue; + if (iItem->maLayoutSize.Maximum < 0) + ++nNoMaximumCount; + + const sal_Int32 nBaseHeight ( + bMinimumHeightIsBase + ? iItem->maLayoutSize.Minimum + : iItem->maLayoutSize.Preferred); + if (nBaseHeight < nContainerHeight) + { + iItem->mnWeight = nContainerHeight - nBaseHeight; + nTotalWeight += iItem->mnWeight; + } + } + + if (nTotalWeight == 0) + return; + + // First pass of height distribution. + IterateLayoutItems(iItem,rLayoutItems) + { + const sal_Int32 nBaseHeight ( + bMinimumHeightIsBase + ? iItem->maLayoutSize.Minimum + : iItem->maLayoutSize.Preferred); + sal_Int32 nDistributedHeight (iItem->mnWeight * nHeightToDistribute / nTotalWeight); + if (nBaseHeight+nDistributedHeight > iItem->maLayoutSize.Maximum + && iItem->maLayoutSize.Maximum >= 0) + { + nDistributedHeight = ::std::max<sal_Int32>(0,iItem->maLayoutSize.Maximum - nBaseHeight); + } + iItem->mnDistributedHeight = nDistributedHeight; + nRemainingHeightToDistribute -= nDistributedHeight; + } + + if (nRemainingHeightToDistribute == 0) + return; + OSL_ASSERT(nRemainingHeightToDistribute > 0); + + // It is possible that not all of the height could be distributed + // because of Maximum heights being smaller than expected. + // Distribute the remaining height between the panels that have no + // Maximum (ie Maximum==-1). + if (nNoMaximumCount == 0) + { + // There are no panels with unrestricted height. + return; + } + const sal_Int32 nAdditionalHeightPerPanel (nRemainingHeightToDistribute / nNoMaximumCount); + // Handle rounding error. + sal_Int32 nAdditionalHeightForFirstPanel (nRemainingHeightToDistribute + - nNoMaximumCount*nAdditionalHeightPerPanel); + IterateLayoutItems(iItem,rLayoutItems) + { + if (iItem->maLayoutSize.Maximum < 0) + { + iItem->mnDistributedHeight += nAdditionalHeightPerPanel + nAdditionalHeightForFirstPanel; + nRemainingHeightToDistribute -= nAdditionalHeightPerPanel + nAdditionalHeightForFirstPanel; + } + } + + OSL_ASSERT(nRemainingHeightToDistribute==0); +} + + + + +Rectangle DeckLayouter::PlaceDeckTitle ( + Window& rDeckTitleBar, + const Rectangle& rAvailableSpace) +{ + if (static_cast<DockingWindow*>(rDeckTitleBar.GetParent()->GetParent())->IsFloatingMode()) + { + // When the side bar is undocked then the outer system window displays the deck title. + rDeckTitleBar.Hide(); + return rAvailableSpace; + } + else + { + const sal_Int32 nDeckTitleBarHeight (Theme::GetInteger(Theme::Int_DeckTitleBarHeight)); + rDeckTitleBar.setPosSizePixel( + rAvailableSpace.Left(), + rAvailableSpace.Top(), + rAvailableSpace.GetWidth(), + nDeckTitleBarHeight); + rDeckTitleBar.Show(); + return Rectangle( + rAvailableSpace.Left(), + rAvailableSpace.Top() + nDeckTitleBarHeight, + rAvailableSpace.Right(), + rAvailableSpace.Bottom()); + } +} + + + + +Rectangle DeckLayouter::PlaceVerticalScrollBar ( + ScrollBar& rVerticalScrollBar, + const Rectangle& rAvailableSpace, + const bool bShowVerticalScrollBar) +{ + if (bShowVerticalScrollBar) + { + const sal_Int32 nScrollBarWidth (rVerticalScrollBar.GetSizePixel().Width()); + rVerticalScrollBar.setPosSizePixel( + rAvailableSpace.Right() - nScrollBarWidth + 1, + rAvailableSpace.Top(), + nScrollBarWidth, + rAvailableSpace.GetHeight()); + rVerticalScrollBar.Show(); + return Rectangle( + rAvailableSpace.Left(), + rAvailableSpace.Top(), + rAvailableSpace.Right() - nScrollBarWidth, + rAvailableSpace.Bottom()); + } + else + { + rVerticalScrollBar.Hide(); + return rAvailableSpace; + } +} + + + + +void DeckLayouter::SetupVerticalScrollBar( + ScrollBar& rVerticalScrollBar, + const sal_Int32 nContentHeight, + const sal_Int32 nVisibleHeight) +{ + OSL_ASSERT(nContentHeight > nVisibleHeight); + + rVerticalScrollBar.SetRangeMin(0); + rVerticalScrollBar.SetRangeMax(nContentHeight-1); + rVerticalScrollBar.SetVisibleSize(nVisibleHeight); +} + + + + +void DeckLayouter::UpdateFiller ( + Window& rFiller, + const Rectangle& rBox) +{ + if (rBox.GetHeight() > 0) + { + // Show the filler. + rFiller.SetBackground(Theme::GetPaint(Theme::Paint_PanelBackground).GetWallpaper()); + rFiller.SetPosSizePixel(rBox.TopLeft(), rBox.GetSize()); + rFiller.Show(); + } + else + { + // Hide the filler. + rFiller.Hide(); + } +} + + + +} } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/DeckLayouter.hxx b/sfx2/source/sidebar/DeckLayouter.hxx new file mode 100644 index 000000000000..e1df7f277ec4 --- /dev/null +++ b/sfx2/source/sidebar/DeckLayouter.hxx @@ -0,0 +1,119 @@ +/* + * 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 SFX_SIDEBAR_DECK_LAYOUTER_HXX +#define SFX_SIDEBAR_DECK_LAYOUTER_HXX + +#include "Panel.hxx" + +#include <tools/gen.hxx> + +#include <com/sun/star/ui/LayoutSize.hpp> + +#include <vector> + +class ScrollBar; +class Window; + +namespace css = ::com::sun::star; + +namespace sfx2 { namespace sidebar { + +class Panel; + + +/** Helper class for layouting the direct and indirect children of a + deck like title bars, panels, and scroll bars. +*/ +class DeckLayouter +{ +public: + static void LayoutDeck ( + const Rectangle aContentArea, + SharedPanelContainer& rPanels, + Window& pDeckTitleBar, + Window& pScrollClipWindow, + Window& pScrollContainer, + Window& pFiller, + ScrollBar& pVerticalScrollBar); + +private: + // Do not use constructor or destructor. + DeckLayouter (void); + ~DeckLayouter (void); + + enum LayoutMode + { + MinimumOrLarger, + PreferredOrLarger, + Preferred + }; + class LayoutItem + { + public: + SharedPanel mpPanel; + css::ui::LayoutSize maLayoutSize; + sal_Int32 mnDistributedHeight; + sal_Int32 mnWeight; + sal_Int32 mnPanelIndex; + bool mbShowTitleBar; + + LayoutItem (void) + : mpPanel(),maLayoutSize(0,0,0),mnDistributedHeight(0),mnWeight(0),mnPanelIndex(0),mbShowTitleBar(true) + {} + }; + static Rectangle LayoutPanels ( + const Rectangle aContentArea, + ::std::vector<LayoutItem>& rLayoutItems, + Window& rScrollClipWindow, + Window& rScrollContainer, + ScrollBar& pVerticalScrollBar, + const bool bShowVerticalScrollBar); + static void GetRequestedSizes ( + ::std::vector<LayoutItem>& rLayoutItem, + sal_Int32& rAvailableHeight, + const Rectangle& rContentBox); + static void DistributeHeights ( + ::std::vector<LayoutItem>& rLayoutItems, + const sal_Int32 nHeightToDistribute, + const sal_Int32 nContainerHeight, + const bool bMinimumHeightIsBase); + static sal_Int32 PlacePanels ( + ::std::vector<LayoutItem>& rLayoutItems, + const sal_Int32 nWidth, + const LayoutMode eMode, + Window& rScrollContainer); + static Rectangle PlaceDeckTitle ( + Window& rTittleBar, + const Rectangle& rAvailableSpace); + static Rectangle PlaceVerticalScrollBar ( + ScrollBar& rVerticalScrollBar, + const Rectangle& rAvailableSpace, + const bool bShowVerticalScrollBar); + static void SetupVerticalScrollBar( + ScrollBar& rVerticalScrollBar, + const sal_Int32 nContentHeight, + const sal_Int32 nVisibleHeight); + static void UpdateFiller ( + Window& rFiller, + const Rectangle& rBox); +}; + + +} } // end of namespace sfx2::sidebar + +#endif diff --git a/sfx2/source/sidebar/DeckTitleBar.cxx b/sfx2/source/sidebar/DeckTitleBar.cxx new file mode 100644 index 000000000000..008da73ba1ea --- /dev/null +++ b/sfx2/source/sidebar/DeckTitleBar.cxx @@ -0,0 +1,143 @@ +/* + * 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 "DeckTitleBar.hxx" +#include "sfx2/sidebar/Theme.hxx" + +#include <vcl/image.hxx> + +#ifdef DEBUG +#include "Tools.hxx" +#endif + + +namespace sfx2 { namespace sidebar { + +static const sal_Int32 gaLeftGripPadding (3); +static const sal_Int32 gaRightGripPadding (3); + + +DeckTitleBar::DeckTitleBar ( + const ::rtl::OUString& rsTitle, + Window* pParentWindow, + const ::boost::function<void(void)>& rCloserAction) + : TitleBar(rsTitle, pParentWindow, GetBackgroundPaint()), + mnCloserItemIndex(1), + maCloserAction(rCloserAction), + mbIsCloserVisible(rCloserAction) +{ + OSL_ASSERT(pParentWindow != NULL); + + if (maCloserAction) + { + maToolBox.InsertItem( + mnCloserItemIndex, + Theme::GetImage(Theme::Image_Closer)); + } + +#ifdef DEBUG + SetText(A2S("DeckTitleBar")); +#endif +} + + + + +DeckTitleBar::~DeckTitleBar (void) +{ +} + + + + +void DeckTitleBar::SetCloserVisible (const bool bIsCloserVisible) +{ + if (mbIsCloserVisible != bIsCloserVisible) + { + mbIsCloserVisible = bIsCloserVisible; + + if (mbIsCloserVisible) + maToolBox.InsertItem( + mnCloserItemIndex, + Theme::GetImage(Theme::Image_Closer)); + else + maToolBox.RemoveItem( + maToolBox.GetItemPos(mnCloserItemIndex)); + } +} + + + + +Rectangle DeckTitleBar::GetTitleArea (const Rectangle& rTitleBarBox) +{ + Image aGripImage (Theme::GetImage(Theme::Image_Grip)); + return Rectangle( + aGripImage.GetSizePixel().Width() + gaLeftGripPadding + gaRightGripPadding, + rTitleBarBox.Top(), + rTitleBarBox.Right(), + rTitleBarBox.Bottom()); +} + + + + +void DeckTitleBar::PaintDecoration (const Rectangle& rTitleBarBox) +{ + (void)rTitleBarBox; +} + + + + +sidebar::Paint DeckTitleBar::GetBackgroundPaint (void) +{ + return Theme::GetPaint(Theme::Paint_DeckTitleBarBackground); +} + + + + +Color DeckTitleBar::GetTextColor (void) +{ + return Theme::GetColor(Theme::Color_DeckTitleFont); +} + + + + +void DeckTitleBar::HandleToolBoxItemClick (const sal_uInt16 nItemIndex) +{ + if (nItemIndex == mnCloserItemIndex) + if (maCloserAction) + maCloserAction(); +} + + + + +void DeckTitleBar::DataChanged (const DataChangedEvent& rEvent) +{ + maToolBox.SetItemImage( + mnCloserItemIndex, + Theme::GetImage(Theme::Image_Closer)); + TitleBar::DataChanged(rEvent); +} + + +} } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/DeckTitleBar.hxx b/sfx2/source/sidebar/DeckTitleBar.hxx new file mode 100644 index 000000000000..aab05648fe93 --- /dev/null +++ b/sfx2/source/sidebar/DeckTitleBar.hxx @@ -0,0 +1,57 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SFX_SIDEBAR_DECK_TITLE_BAR_HXX +#define SFX_SIDEBAR_DECK_TITLE_BAR_HXX + +#include "TitleBar.hxx" + +#include <boost/function.hpp> + + +namespace sfx2 { namespace sidebar { + +class DeckTitleBar + : public TitleBar +{ +public: + DeckTitleBar ( + const ::rtl::OUString& rsTitle, + Window* pParentWindow, + const ::boost::function<void(void)>& rCloserAction); + virtual ~DeckTitleBar (void); + + void SetCloserVisible (const bool bIsCloserVisible); + + virtual void DataChanged (const DataChangedEvent& rEvent); + +protected: + virtual Rectangle GetTitleArea (const Rectangle& rTitleBarBox); + virtual void PaintDecoration (const Rectangle& rTitleBarBox); + virtual sidebar::Paint GetBackgroundPaint (void); + virtual Color GetTextColor (void); + virtual void HandleToolBoxItemClick (const sal_uInt16 nItemIndex); + +private: + const sal_uInt16 mnCloserItemIndex; + const ::boost::function<void(void)> maCloserAction; + bool mbIsCloserVisible; +}; + +} } // end of namespace sfx2::sidebar + +#endif diff --git a/sfx2/source/sidebar/DrawHelper.cxx b/sfx2/source/sidebar/DrawHelper.cxx new file mode 100644 index 000000000000..f8172b2cf52c --- /dev/null +++ b/sfx2/source/sidebar/DrawHelper.cxx @@ -0,0 +1,244 @@ +/* + * 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 "DrawHelper.hxx" +#include "Paint.hxx" + +#include <vcl/lineinfo.hxx> + + +namespace sfx2 { namespace sidebar { + +void DrawHelper::DrawBorder ( + OutputDevice& rDevice, + const Rectangle rBox, + const SvBorder aBorderSize, + const Paint& rHorizontalPaint, + const Paint& rVerticalPaint) +{ + // Draw top line. + DrawHorizontalLine( + rDevice, + rBox.Left(), + rBox.Right(), + rBox.Top(), + aBorderSize.Top(), + rHorizontalPaint); + // Draw bottom line. + DrawHorizontalLine( + rDevice, + rBox.Left()+aBorderSize.Left(), + rBox.Right(), + rBox.Bottom()-aBorderSize.Bottom()+1, + aBorderSize.Bottom(), + rHorizontalPaint); + // Draw left line. + DrawVerticalLine( + rDevice, + rBox.Top()+aBorderSize.Top(), + rBox.Bottom(), + rBox.Left(), + aBorderSize.Left(), + rVerticalPaint); + // Draw right line. + DrawVerticalLine( + rDevice, + rBox.Top()+aBorderSize.Top(), + rBox.Bottom()-aBorderSize.Bottom(), + rBox.Right()-aBorderSize.Right()+1, + aBorderSize.Right(), + rVerticalPaint); +} + + + + +void DrawHelper::DrawBevelBorder ( + OutputDevice& rDevice, + const Rectangle rBox, + const SvBorder aBorderSize, + const Paint& rTopLeftPaint, + const Paint& rCenterPaint, + const Paint& rBottomRightPaint) +{ + // Draw top line. + DrawHorizontalLine( + rDevice, + rBox.Left(), + rBox.Right() - aBorderSize.Right(), + rBox.Top(), + aBorderSize.Top(), + rTopLeftPaint); + // Draw bottom line. + DrawHorizontalLine( + rDevice, + rBox.Left()+aBorderSize.Left(), + rBox.Right(), + rBox.Bottom()-aBorderSize.Bottom()+1, + aBorderSize.Bottom(), + rBottomRightPaint); + // Draw left line. + DrawVerticalLine( + rDevice, + rBox.Top()+aBorderSize.Top(), + rBox.Bottom() - aBorderSize.Bottom(), + rBox.Left(), + aBorderSize.Left(), + rTopLeftPaint); + // Draw right line. + DrawVerticalLine( + rDevice, + rBox.Top()+aBorderSize.Top(), + rBox.Bottom()-aBorderSize.Bottom(), + rBox.Right()-aBorderSize.Right()+1, + aBorderSize.Right(), + rBottomRightPaint); + // Draw top right corner. + DrawVerticalLine( + rDevice, + rBox.Top(), + rBox.Top()+aBorderSize.Top()-1, + rBox.Right()-aBorderSize.Right()+1, + aBorderSize.Right(), + rCenterPaint); + // Draw bottom right corner. + DrawVerticalLine( + rDevice, + rBox.Bottom() - aBorderSize.Bottom()+1, + rBox.Bottom(), + rBox.Left(), + aBorderSize.Left(), + rCenterPaint); +} + + + + +void DrawHelper::DrawHorizontalLine( + OutputDevice& rDevice, + const sal_Int32 nLeft, + const sal_Int32 nRight, + const sal_Int32 nY, + const sal_Int32 nHeight, + const Paint& rPaint) +{ + switch (rPaint.GetType()) + { + case Paint::NoPaint: + default: + break; + + case Paint::ColorPaint: + { + const Color aColor (rPaint.GetColor()); + rDevice.SetLineColor(aColor); + for (sal_Int32 nYOffset=0; nYOffset<nHeight; ++nYOffset) + rDevice.DrawLine( + Point(nLeft,nY+nYOffset), + Point(nRight,nY+nYOffset)); + break; + } + case Paint::GradientPaint: + rDevice.DrawGradient( + Rectangle( + nLeft, + nY, + nRight, + nY+nHeight-1), + rPaint.GetGradient()); + break; + } +} + + + + +void DrawHelper::DrawVerticalLine( + OutputDevice& rDevice, + const sal_Int32 nTop, + const sal_Int32 nBottom, + const sal_Int32 nX, + const sal_Int32 nWidth, + const Paint& rPaint) +{ + switch (rPaint.GetType()) + { + case Paint::NoPaint: + default: + break; + + case Paint::ColorPaint: + { + const Color aColor (rPaint.GetColor()); + rDevice.SetLineColor(aColor); + for (sal_Int32 nXOffset=0; nXOffset<nWidth; ++nXOffset) + rDevice.DrawLine( + Point(nX+nXOffset, nTop), + Point(nX+nXOffset, nBottom)); + break; + } + case Paint::GradientPaint: + rDevice.DrawGradient( + Rectangle( + nX, + nTop, + nX+nWidth-1, + nBottom), + rPaint.GetGradient()); + break; + } +} + + + + +void DrawHelper::DrawRoundedRectangle ( + OutputDevice& rDevice, + const Rectangle& rBox, + const sal_Int32 nCornerRadius, + const Color& rBorderColor, + const Paint& rFillPaint) +{ + rDevice.SetLineColor(rBorderColor); + switch(rFillPaint.GetType()) + { + case Paint::NoPaint: + default: + rDevice.SetFillColor(); + rDevice.DrawRect(rBox, nCornerRadius, nCornerRadius); + break; + + case Paint::ColorPaint: + rDevice.SetFillColor(rFillPaint.GetColor()); + rDevice.DrawRect(rBox, nCornerRadius, nCornerRadius); + break; + + case Paint::GradientPaint: + rDevice.DrawGradient( + rBox, + rFillPaint.GetGradient()); + rDevice.SetFillColor(); + rDevice.DrawRect(rBox, nCornerRadius, nCornerRadius); + break; + } +} + + + + +} } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/DrawHelper.hxx b/sfx2/source/sidebar/DrawHelper.hxx new file mode 100644 index 000000000000..45bf7ea9c25b --- /dev/null +++ b/sfx2/source/sidebar/DrawHelper.hxx @@ -0,0 +1,74 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SFX_SIDEBAR_DRAW_HELPER_HXX +#define SFX_SIDEBAR_DRAW_HELPER_HXX + +#include "vcl/window.hxx" + +#include <tools/svborder.hxx> + +class Color; + +namespace sfx2 { namespace sidebar { + +class Paint; + +/** Some convenience functions for painting backgrounds and borders. +*/ +class DrawHelper +{ +public: + static void DrawBorder ( + OutputDevice& rDevice, + const Rectangle rBox, + const SvBorder aBorderSize, + const Paint& rHorizontalPaint, + const Paint& rVerticalPaint); + static void DrawBevelBorder ( + OutputDevice& rDevice, + const Rectangle rBox, + const SvBorder aBorderSize, + const Paint& rTopLeftPaint, + const Paint& rCenterPaint, + const Paint& rBottomRightPaint); + static void DrawHorizontalLine( + OutputDevice& rDevice, + const sal_Int32 nLeft, + const sal_Int32 nRight, + const sal_Int32 nY, + const sal_Int32 nHeight, + const Paint& rPaint); + static void DrawVerticalLine( + OutputDevice& rDevice, + const sal_Int32 nTop, + const sal_Int32 nBottom, + const sal_Int32 nX, + const sal_Int32 nWidth, + const Paint& rPaint); + static void DrawRoundedRectangle ( + OutputDevice& rDevice, + const Rectangle& rBox, + const sal_Int32 nCornerRadius, + const Color& rBorderColor, + const Paint& rFillPaint); +}; + + +} } // end of namespace sfx2::sidebar + +#endif diff --git a/sfx2/source/sidebar/EnumContext.cxx b/sfx2/source/sidebar/EnumContext.cxx new file mode 100644 index 000000000000..d8d39fb75aac --- /dev/null +++ b/sfx2/source/sidebar/EnumContext.cxx @@ -0,0 +1,326 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "sidebar/EnumContext.hxx" + +#include <map> + +namespace sfx2 { namespace sidebar { + +#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) + +namespace { + +typedef ::std::map<rtl::OUString,EnumContext::Application> ApplicationMap; +typedef ::std::vector<rtl::OUString> ApplicationVector; +static ApplicationMap maApplicationMap; +static ApplicationVector maApplicationVector; + +typedef ::std::map<rtl::OUString,EnumContext::Context> ContextMap; +typedef ::std::vector<rtl::OUString> ContextVector; +static ContextMap maContextMap; +static ContextVector maContextVector; + +} + +const sal_Int32 EnumContext::NoMatch = 4; +const sal_Int32 EnumContext::OptimalMatch = 0; // Neither application nor context name is "any". + + +EnumContext::EnumContext (void) + : meApplication(Application_None), + meContext(Context_Unknown) +{ +} + + + + +EnumContext::EnumContext ( + const Application eApplication, + const Context eContext) + : meApplication(eApplication), + meContext(eContext) +{ +} + + + + +EnumContext::EnumContext ( + const ::rtl::OUString& rsApplicationName, + const ::rtl::OUString& rsContextName) + : meApplication(GetApplicationEnum(rsApplicationName)), + meContext(GetContextEnum(rsContextName)) +{ +} + + + + +sal_Int32 EnumContext::GetCombinedContext (void) const +{ + return CombinedEnumContext(meApplication, meContext); +} + + + + +sal_Int32 EnumContext::GetCombinedContext_DI (void) const +{ + switch (meApplication) + { + case Application_Draw: + case Application_Impress: + return CombinedEnumContext(Application_DrawImpress, meContext); + + case Application_Writer: + case Application_WriterWeb: + return CombinedEnumContext(Application_WriterAndWeb, meContext); + + default: + return CombinedEnumContext(meApplication, meContext); + } +} + + + + +const ::rtl::OUString& EnumContext::GetApplicationName (void) const +{ + return EnumContext::GetApplicationName(meApplication); +} + + + + +const ::rtl::OUString& EnumContext::GetContextName (void) const +{ + return EnumContext::GetContextName(meContext); +} + + + + +bool EnumContext::operator== (const EnumContext aOther) +{ + return meApplication==aOther.meApplication + && meContext==aOther.meContext; +} + + + + +bool EnumContext::operator!= (const EnumContext aOther) +{ + return meApplication!=aOther.meApplication + || meContext!=aOther.meContext; +} + + + + +void EnumContext::AddEntry (const ::rtl::OUString& rsName, const Application eApplication) +{ + maApplicationMap[rsName] = eApplication; + OSL_ASSERT(eApplication<=__LastApplicationEnum); + if (maApplicationVector.size() <= size_t(eApplication)) + maApplicationVector.resize(eApplication+1); + maApplicationVector[eApplication]=rsName; +} + + + + +void EnumContext::ProvideApplicationContainers (void) +{ + if (maApplicationMap.empty()) + { + maApplicationVector.resize(static_cast<size_t>(EnumContext::__LastApplicationEnum)+1); + AddEntry(A2S("com.sun.star.text.TextDocument"), EnumContext::Application_Writer); + AddEntry(A2S("com.sun.star.text.WebDocument"), EnumContext::Application_WriterWeb); + AddEntry(A2S("com.sun.star.sheet.SpreadsheetDocument"), EnumContext::Application_Calc); + AddEntry(A2S("com.sun.star.drawing.DrawingDocument"), EnumContext::Application_Draw); + AddEntry(A2S("com.sun.star.presentation.PresentationDocument"), EnumContext::Application_Impress); + + AddEntry(A2S("any"), EnumContext::Application_Any); + AddEntry(A2S("none"), EnumContext::Application_None); + } +} + + + + +EnumContext::Application EnumContext::GetApplicationEnum (const ::rtl::OUString& rsApplicationName) +{ + ProvideApplicationContainers(); + + ApplicationMap::const_iterator iApplication( + maApplicationMap.find(rsApplicationName)); + if (iApplication != maApplicationMap.end()) + return iApplication->second; + else + return EnumContext::Application_None; +} + + + + +const ::rtl::OUString& EnumContext::GetApplicationName (const Application eApplication) +{ + ProvideApplicationContainers(); + + const sal_Int32 nIndex (eApplication); + if (nIndex<0 || nIndex>= __LastApplicationEnum) + return maApplicationVector[Application_None]; + else + return maApplicationVector[nIndex]; +} + + + + +void EnumContext::AddEntry (const ::rtl::OUString& rsName, const Context eApplication) +{ + maContextMap[rsName] = eApplication; + OSL_ASSERT(eApplication<=__LastContextEnum); + if (maContextVector.size() <= size_t(eApplication)) + maContextVector.resize(eApplication+1); + maContextVector[eApplication] = rsName; +} + + + + +void EnumContext::ProvideContextContainers (void) +{ + if (maContextMap.empty()) + { + maContextVector.resize(static_cast<size_t>(__LastContextEnum)+1); + AddEntry(A2S("any"), Context_Any); + AddEntry(A2S("default"), Context_Default); + AddEntry(A2S("empty"), Context_Empty); +#define AddContext(context) AddEntry(A2S(#context), Context_##context); + AddContext(3DObject); + AddContext(Annotation); + AddContext(Auditing); + AddContext(Cell); + AddContext(Chart); + AddContext(Chart); + AddContext(Draw); + AddContext(DrawPage); + AddContext(DrawText); + AddContext(EditCell); + AddContext(Form); + AddContext(Frame); + AddContext(Graphic); + AddContext(HandoutPage); + AddContext(MasterPage); + AddContext(Media); + AddContext(MultiObject); + AddContext(NotesPage); + AddContext(OLE); + AddContext(OutlineText); + AddContext(Pivot); + AddContext(SlidesorterPage); + AddContext(Table); + AddContext(Text); + AddContext(TextObject); +#undef AddContext + } +} + + + + +EnumContext::Context EnumContext::GetContextEnum (const ::rtl::OUString& rsContextName) +{ + ProvideContextContainers(); + + ContextMap::const_iterator iContext( + maContextMap.find(rsContextName)); + if (iContext != maContextMap.end()) + return iContext->second; + else + return EnumContext::Context_Unknown; +} + + + + +const ::rtl::OUString& EnumContext::GetContextName (const Context eContext) +{ + ProvideContextContainers(); + + const sal_Int32 nIndex (eContext); + if (nIndex<0 || nIndex>= __LastContextEnum) + return maContextVector[Context_Unknown]; + else + return maContextVector[nIndex]; +} + + + + +sal_Int32 EnumContext::EvaluateMatch ( + const EnumContext& rOther) const +{ + const bool bApplicationNameIsAny (rOther.meApplication == Application_Any); + if (rOther.meApplication==meApplication || bApplicationNameIsAny) + { + // Application name matches. + const bool bContextNameIsAny (rOther.meContext == Context_Any); + if (rOther.meContext==meContext || bContextNameIsAny) + { + // Context name matches. + return (bApplicationNameIsAny ? 1 : 0) + + (bContextNameIsAny ? 2 : 0); + } + } + return NoMatch; +} + + + + +sal_Int32 EnumContext::EvaluateMatch (const ::std::vector<EnumContext>& rOthers) const +{ + sal_Int32 nBestMatch (NoMatch); + + for (::std::vector<EnumContext>::const_iterator + iContext(rOthers.begin()), + iEnd(rOthers.end()); + iContext!=iEnd; + ++iContext) + { + const sal_Int32 nMatch (EvaluateMatch(*iContext)); + if (nMatch < nBestMatch) + { + if (nMatch == OptimalMatch) + { + // We will find no better match so stop searching. + return OptimalMatch; + } + nBestMatch = nMatch; + } + } + return nBestMatch; +} + + + +} } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/FocusManager.cxx b/sfx2/source/sidebar/FocusManager.cxx new file mode 100644 index 000000000000..b5c2ec552333 --- /dev/null +++ b/sfx2/source/sidebar/FocusManager.cxx @@ -0,0 +1,559 @@ +/* + * 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 "FocusManager.hxx" +#include "Panel.hxx" +#include "Tools.hxx" +#include "TitleBar.hxx" +#include <vcl/button.hxx> +#include <vcl/toolbox.hxx> +#include <toolkit/helper/vclunohelper.hxx> + + +namespace sfx2 { namespace sidebar { + +namespace +{ + enum PanelComponent + { + PC_TitleBar, + PC_ToolBox, + PC_Content, + PC_None + }; + + PanelComponent GetFocusedComponent (const Panel& rPanel) + { + if (rPanel.HasFocus()) + return PC_Content; + else if (rPanel.GetTitleBar() != NULL) + { + if (rPanel.GetTitleBar()->HasFocus()) + return PC_TitleBar; + else if (rPanel.GetTitleBar()->GetToolBox().HasFocus()) + return PC_ToolBox; + } + return PC_None; + } +} + + +FocusManager::FocusManager (void) + : maPanels(), + maButtons(), + mpTopLevelWindow(NULL) +{ +} + + + + +FocusManager::~FocusManager (void) +{ + Clear(); +} + + + + +void FocusManager::GrabFocus (void) +{ + if ( ! maPanels.empty()) + FocusPanel(0); +} + + + + +void FocusManager::Clear (void) +{ + ClearPanels(); + ClearButtons(); +} + + + +void FocusManager::ClearPanels (void) +{ + SetTopLevelWindow(NULL); + + ::std::vector<Panel*> aPanels; + aPanels.swap(maPanels); + for (::std::vector<Panel*>::iterator iPanel(aPanels.begin()),iEnd(aPanels.end()); + iPanel!=iEnd; + ++iPanel) + { + UnregisterWindow(**iPanel); + if ((*iPanel)->GetTitleBar() != NULL) + { + UnregisterWindow(*(*iPanel)->GetTitleBar()); + UnregisterWindow((*iPanel)->GetTitleBar()->GetToolBox()); + } + } +} + + + + +void FocusManager::ClearButtons (void) +{ + ::std::vector<Window*> aButtons; + for (::std::vector<Window*>::iterator iButton(aButtons.begin()),iEnd(aButtons.end()); + iButton!=iEnd; + ++iButton) + { + UnregisterWindow(**iButton); + } +} + + + + +void FocusManager::SetPanels (const SharedPanelContainer& rPanels) +{ + ClearPanels(); + for(SharedPanelContainer::const_iterator iPanel(rPanels.begin()),iEnd(rPanels.end()); + iPanel!=iEnd; + ++iPanel) + { + RegisterWindow(**iPanel); + if ((*iPanel)->GetTitleBar() != NULL) + { + RegisterWindow(*(*iPanel)->GetTitleBar()); + RegisterWindow((*iPanel)->GetTitleBar()->GetToolBox()); + } + maPanels.push_back(iPanel->get()); + } + + RegisterTopLevelListener(); +} + + + + +void FocusManager::SetButtons (const ::std::vector<Button*>& rButtons) +{ + ClearButtons(); + for (::std::vector<Button*>::const_iterator iButton(rButtons.begin()),iEnd(rButtons.end()); + iButton!=iEnd; + ++iButton) + { + RegisterWindow(**iButton); + maButtons.push_back(*iButton); + } +} + + + + +void FocusManager::RegisterWindow (Window& rWindow) +{ + rWindow.AddEventListener(LINK(this, FocusManager, WindowEventListener)); +} + + + + +void FocusManager::UnregisterWindow (Window& rWindow) +{ + rWindow.RemoveEventListener(LINK(this, FocusManager, WindowEventListener)); +} + + + + +void FocusManager::RegisterTopLevelListener (void) +{ + if (maPanels.empty()) + return; + Window* pWindow = maPanels.front(); + while (pWindow != NULL && pWindow->GetParent()!=NULL) + { + pWindow = pWindow->GetParent(); + } + SetTopLevelWindow(pWindow); +} + + + + +void FocusManager::SetTopLevelWindow (Window* pWindow) +{ + if (mpTopLevelWindow != pWindow) + { + if (mpTopLevelWindow != NULL) + { + UnregisterWindow(*mpTopLevelWindow); + mpTopLevelWindow->RemoveChildEventListener(LINK(this, FocusManager, WindowEventListener)); + } + mpTopLevelWindow = pWindow; + if (mpTopLevelWindow != NULL) + { + RegisterWindow(*mpTopLevelWindow); + mpTopLevelWindow->AddChildEventListener(LINK(this, FocusManager, WindowEventListener)); + } + } +} + + + + +sal_Int32 FocusManager::GetPanelIndex (const Window& rWindow) const +{ + for (sal_Int32 nIndex=0,nCount(maPanels.size()); nIndex<nCount; ++nIndex) + { + if (maPanels[nIndex] == &rWindow) + return nIndex; + TitleBar* pTitleBar = maPanels[nIndex]->GetTitleBar(); + if (pTitleBar == &rWindow) + return nIndex; + if (pTitleBar!=NULL && &pTitleBar->GetToolBox()==&rWindow) + return nIndex; + } + return -1; +} + + + + +sal_Int32 FocusManager::GetButtonIndex (const Window& rWindow) const +{ + for (sal_Int32 nIndex=0,nCount(maButtons.size()); nIndex<nCount; ++nIndex) + if (maButtons[nIndex] == &rWindow) + return nIndex; + return -1; +} + + + + +bool FocusManager::IsAnyPanelFocused (void) const +{ + for (::std::vector<Panel*>::const_iterator iPanel(maPanels.begin()),iEnd(maPanels.end()); + iPanel!=iEnd; + ++iPanel) + { + if ((*iPanel)->HasFocus()) + return true; + else if ((*iPanel)->HasChildPathFocus()) + return true; + } + return false; +} + + + + +bool FocusManager::IsAnyButtonFocused (void) const +{ + for (::std::vector<Button*>::const_iterator iButton(maButtons.begin()),iEnd(maButtons.end()); + iButton!=iEnd; + ++iButton) + { + if ((*iButton)->HasFocus()) + return true; + } + return false; +} + + + + +void FocusManager::FocusPanel (const sal_Int32 nPanelIndex) +{ + Panel& rPanel (*maPanels[nPanelIndex]); + TitleBar* pTitleBar = rPanel.GetTitleBar(); + if (pTitleBar!=NULL && pTitleBar->IsVisible()) + { + rPanel.SetExpanded(true); + pTitleBar->GrabFocus(); + } + else + FocusPanelContent(nPanelIndex); +} + + + + +void FocusManager::FocusPanelContent (const sal_Int32 nPanelIndex) +{ + Window* pWindow = VCLUnoHelper::GetWindow(maPanels[nPanelIndex]->GetElementWindow()); + if (pWindow != NULL) + pWindow->GrabFocus(); +} + + + + +void FocusManager::FocusButton (const sal_Int32 nButtonIndex) +{ + maButtons[nButtonIndex]->GrabFocus(); + maButtons[nButtonIndex]->Invalidate(); +} + + + + +void FocusManager::ClickButton (const sal_Int32 nButtonIndex) +{ + maButtons[nButtonIndex]->Click(); + if (nButtonIndex > 0) + if ( ! maPanels.empty()) + FocusPanel(0); + maButtons[nButtonIndex]->GetParent()->Invalidate(); +} + + + + +void FocusManager::RemoveWindow (Window& rWindow) +{ + ::std::vector<Panel*>::iterator iPanel (::std::find(maPanels.begin(), maPanels.end(), &rWindow)); + if (iPanel != maPanels.end()) + { + UnregisterWindow(rWindow); + if ((*iPanel)->GetTitleBar() != NULL) + { + UnregisterWindow(*(*iPanel)->GetTitleBar()); + UnregisterWindow((*iPanel)->GetTitleBar()->GetToolBox()); + } + maPanels.erase(iPanel); + return; + } + + ::std::vector<Button*>::iterator iButton (::std::find(maButtons.begin(), maButtons.end(), &rWindow)); + if (iButton != maButtons.end()) + { + UnregisterWindow(rWindow); + maButtons.erase(iButton); + return; + } +} + + + + +bool FocusManager::MoveFocusInsidePanel ( + const sal_Int32 nPanelIndex, + const sal_Int32 nDirection) +{ + Panel& rPanel (*maPanels[nPanelIndex]); + switch (GetFocusedComponent(rPanel)) + { + case PC_TitleBar: + if (nDirection > 0) + rPanel.GetTitleBar()->GetToolBox().GrabFocus(); + else + FocusPanelContent(nPanelIndex); + return true; + + case PC_ToolBox: + if (nDirection > 0) + FocusPanelContent(nPanelIndex); + else + rPanel.GetTitleBar()->GrabFocus(); + return true; + + default: + return false; + } +} + + + + +long FocusManager::NotifyDockingWindowEvent (const KeyEvent& rKeyEvent) +{ + switch(rKeyEvent.GetKeyCode().GetCode()) + { + case KEY_F6: + if (rKeyEvent.GetKeyCode().IsShift()) + { + if (IsAnyButtonFocused()) + { + FocusPanel(0); + return 1; + } + } + else + { + if (IsAnyPanelFocused()) + { + FocusButton(0); + return 1; + } + } + break; + } + return 0; +} + + + + +void FocusManager::HandleKeyEvent ( + const KeyCode& rKeyCode, + const Window& rWindow) +{ + if (rKeyCode.GetModifier() != 0) + return; + + const sal_Int32 nPanelIndex (GetPanelIndex(rWindow)); + sal_Int32 nButtonIndex (nPanelIndex==-1 ? GetButtonIndex(rWindow) : -1); + + switch (rKeyCode.GetCode()) + { + case KEY_F6: + if (nPanelIndex >= 0) + FocusButton(0); + else + return; + break; + + case KEY_SPACE: + if (nPanelIndex >= 0) + { + if (GetFocusedComponent(*maPanels[nPanelIndex]) == PC_TitleBar) + { + // Toggle the expansion state. + maPanels[nPanelIndex]->SetExpanded( ! maPanels[nPanelIndex]->IsExpanded()); + } + } + else if (nButtonIndex >= 0) + { + // Activate the button. + ClickButton(nButtonIndex); + } + return; + + case KEY_RETURN: + if (nPanelIndex >= 0) + { + if (GetFocusedComponent(*maPanels[nPanelIndex]) == PC_TitleBar) + { + // Enter the panel. + FocusPanelContent(nPanelIndex); + } + } + else if (nButtonIndex >= 0) + { + // Activate the button. + ClickButton(nButtonIndex); + } + return; + + case KEY_TAB: + if (nPanelIndex >= 0) + { + if (rKeyCode.IsShift()) + MoveFocusInsidePanel(nPanelIndex, -1); + else + MoveFocusInsidePanel(nPanelIndex, +1); + } + break; + + case KEY_LEFT: + case KEY_UP: + // Go to previous element in focus ring. + if (nPanelIndex >= 0) + { + FocusPanel((nPanelIndex + maPanels.size() - 1) % maPanels.size()); + } + else if (nButtonIndex >= 0) + { + FocusButton((nButtonIndex + maButtons.size() - 1) % maButtons.size()); + } + break; + + case KEY_RIGHT: + case KEY_DOWN: + // Go to next element in focus ring. + if (nPanelIndex >= 0) + { + FocusPanel((nPanelIndex + 1) % maPanels.size()); + } + else if (nButtonIndex >= 0) + { + FocusButton((nButtonIndex + 1) % maButtons.size()); + } + break; + } +} + + + + +void FocusManager::HandleTopLevelEvent (VclWindowEvent& rEvent) +{ + switch (rEvent.GetId()) + { + case VCLEVENT_WINDOW_KEYINPUT: + { + KeyEvent* pKeyEvent = static_cast<KeyEvent*>(rEvent.GetData()); + switch (pKeyEvent->GetKeyCode().GetCode()) + { + case KEY_F6: + OSL_TRACE(""); + break; + } + } + } +} + + + + +IMPL_LINK(FocusManager, WindowEventListener, VclSimpleEvent*, pEvent) +{ + if (pEvent == NULL) + return 0; + + if ( ! pEvent->ISA(VclWindowEvent)) + return 0; + + VclWindowEvent* pWindowEvent = static_cast<VclWindowEvent*>(pEvent); + Window* pSource = pWindowEvent->GetWindow(); + if (pSource == NULL) + return 0; + + if (pSource == mpTopLevelWindow) + HandleTopLevelEvent(*pWindowEvent); + else + switch (pWindowEvent->GetId()) + { + case VCLEVENT_WINDOW_KEYINPUT: + { + KeyEvent* pKeyEvent = static_cast<KeyEvent*>(pWindowEvent->GetData()); + HandleKeyEvent(pKeyEvent->GetKeyCode(), *pSource); + return 1; + } + + case VCLEVENT_OBJECT_DYING: + RemoveWindow(*pSource); + return 1; + + case VCLEVENT_WINDOW_GETFOCUS: + case VCLEVENT_WINDOW_LOSEFOCUS: + pSource->Invalidate(); + } + return 0; +} + + + +} } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/FocusManager.hxx b/sfx2/source/sidebar/FocusManager.hxx new file mode 100644 index 000000000000..f811f5ef4ea4 --- /dev/null +++ b/sfx2/source/sidebar/FocusManager.hxx @@ -0,0 +1,108 @@ +/* + * 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 SFX_SIDEBAR_FOCUS_MANAGER_HXX +#define SFX_SIDEBAR_FOCUS_MANAGER_HXX + +#include "Panel.hxx" +#include <tools/link.hxx> + +class Button; +class KeyCode; +class VclSimpleEvent; + +namespace sfx2 { namespace sidebar { + +/** Concentrate all focus handling in this class. + There are two rings of windows that accept the input focus: panels + and tab bar buttons. + Arrow keys move the focus between them. Tab moves focus between rings. +*/ +class FocusManager +{ +public: + FocusManager (void); + ~FocusManager (void); + + /** Forget all panels and buttons. Remove all window listeners. + */ + void Clear (void); + + /** Transfer the focus into the sidebar tree of windows. This is + typically called from the SidebarChildWindow as result of + pressing the F6 key. + */ + void GrabFocus (void); + + /** Handle the key event that was sent to the docking window. + */ + long NotifyDockingWindowEvent (const KeyEvent& rKeyEvent); + + void SetPanels (const SharedPanelContainer& rPanels); + + void SetButtons (const ::std::vector<Button*>& rButtons); + +private: + ::std::vector<Panel*> maPanels; + ::std::vector<Button*> maButtons; + Window* mpTopLevelWindow; + + /** Listen for key events for panels and buttons. + */ + DECL_LINK(WindowEventListener, VclSimpleEvent*); + + void ClearPanels (void); + void ClearButtons (void); + + /** Let the focus manager listen for window events for the given + window. + */ + void RegisterWindow (Window& rWindow); + void UnregisterWindow (Window& rWindow); + void RegisterTopLevelListener (void); + + /** Remove the window from the panel or the button container. + */ + void RemoveWindow (Window& rWindow); + + sal_Int32 GetPanelIndex (const Window& rWindow) const; + sal_Int32 GetButtonIndex (const Window& rWindow) const; + bool IsAnyPanelFocused (void) const; + bool IsAnyButtonFocused (void) const; + + /** Set the focus to the title bar of the panel or, if the the + title bar is not visible, directly to the panel. + */ + void FocusPanel (const sal_Int32 nPanelIndex); + void FocusPanelContent (const sal_Int32 nPanelIndex); + void FocusButton (const sal_Int32 nButtonIndex); + void ClickButton (const sal_Int32 nButtonIndex); + bool MoveFocusInsidePanel ( + const sal_Int32 nPanelIndex, + const sal_Int32 nDirection); + + void HandleKeyEvent ( + const KeyCode& rKeyCode, + const Window& rWindow); + + void SetTopLevelWindow (Window* pWindow); + void HandleTopLevelEvent (VclWindowEvent& rEvent); +}; + +} } // end of namespace sfx2::sidebar + +#endif diff --git a/sfx2/source/sidebar/MenuButton.cxx b/sfx2/source/sidebar/MenuButton.cxx new file mode 100644 index 000000000000..5b28220b8637 --- /dev/null +++ b/sfx2/source/sidebar/MenuButton.cxx @@ -0,0 +1,150 @@ +/* + * 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 "MenuButton.hxx" + +#include "DrawHelper.hxx" +#include "Paint.hxx" +#include "Tools.hxx" +#include "sfx2/sidebar/Theme.hxx" + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; + + +namespace sfx2 { namespace sidebar { + + +MenuButton::MenuButton (Window* pParentWindow) + : CheckBox(pParentWindow), + mbIsLeftButtonDown(false), + mePaintType(PT_Theme) +{ +#ifdef DEBUG + SetText(A2S("MenuButton")); +#endif +} + + + + +MenuButton::~MenuButton (void) +{ +} + + + + +void MenuButton::Paint (const Rectangle& rUpdateArea) +{ + switch(mePaintType) + { + case PT_Theme: + default: + { + const bool bIsSelected (IsChecked()); + const bool bIsHighlighted (IsMouseOver() || HasFocus()); + DrawHelper::DrawRoundedRectangle( + *this, + Rectangle(Point(0,0), GetSizePixel()), + 3, + bIsHighlighted||bIsSelected + ? Theme::GetColor(Theme::Color_TabItemBorder) + : Color(0xffffffff), + bIsHighlighted + ? Theme::GetPaint(Theme::Paint_TabItemBackgroundHighlight) + : Theme::GetPaint(Theme::Paint_TabItemBackgroundNormal)); + + const Image aIcon(Button::GetModeImage()); + const Size aIconSize (aIcon.GetSizePixel()); + const Point aIconLocation( + (GetSizePixel().Width() - aIconSize.Width())/2, + (GetSizePixel().Height() - aIconSize.Height())/2); + DrawImage( + aIconLocation, + aIcon); + break; + } + case PT_Native: + Button::Paint(rUpdateArea); + // DrawImage(maIconPosition, maIcon); + break; + } +} + + + + +void MenuButton::MouseMove (const MouseEvent& rEvent) +{ + if (rEvent.IsEnterWindow() || rEvent.IsLeaveWindow()) + Invalidate(); + CheckBox::MouseMove(rEvent); +} + + + + +void MenuButton::MouseButtonDown (const MouseEvent& rMouseEvent) +{ +#if 0 + Hide(); + CheckBox::MouseButtonDown(rMouseEvent); + Show(); +#else + if (rMouseEvent.IsLeft()) + { + mbIsLeftButtonDown = true; + CaptureMouse(); + Invalidate(); + } +#endif +} + + + + +void MenuButton::MouseButtonUp (const MouseEvent& rMouseEvent) +{ +#if 0 + Hide(); + CheckBox::MouseButtonUp(rMouseEvent); + Show(); +#else + if (IsMouseCaptured()) + ReleaseMouse(); + + if (rMouseEvent.IsLeft()) + { + if (mbIsLeftButtonDown) + { + Check(); + Click(); + GetParent()->Invalidate(); + } + } + if (mbIsLeftButtonDown) + { + mbIsLeftButtonDown = false; + Invalidate(); + } +#endif +} + + +} } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/MenuButton.hxx b/sfx2/source/sidebar/MenuButton.hxx new file mode 100644 index 000000000000..13587dd312ce --- /dev/null +++ b/sfx2/source/sidebar/MenuButton.hxx @@ -0,0 +1,52 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SFX_SIDEBAR_MENU_BUTTON_HXX +#define SFX_SIDEBAR_MENU_BUTTON_HXX + +#include "vcl/button.hxx" + + +namespace sfx2 { namespace sidebar { + +class MenuButton + : public CheckBox +{ +public: + MenuButton (Window* pParentWindow); + virtual ~MenuButton (void); + + virtual void Paint (const Rectangle& rUpdateArea); + virtual void MouseMove (const MouseEvent& rEvent); + virtual void MouseButtonDown (const MouseEvent& rMouseEvent); + virtual void MouseButtonUp (const MouseEvent& rMouseEvent); + +protected: + using CheckBox::FillLayoutData; + +private: + bool mbIsLeftButtonDown; + enum PaintType { + PT_Native, + PT_Theme + } mePaintType; +}; + + +} } // end of namespace sfx2::sidebar + +#endif diff --git a/sfx2/source/sidebar/Paint.cxx b/sfx2/source/sidebar/Paint.cxx new file mode 100644 index 000000000000..20f9bb938113 --- /dev/null +++ b/sfx2/source/sidebar/Paint.cxx @@ -0,0 +1,136 @@ +/* + * 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 "Paint.hxx" +#include "Tools.hxx" +#include <com/sun/star/awt/Gradient.hpp> + + +using namespace ::com::sun::star; + +namespace sfx2 { namespace sidebar { + +Paint::Paint (void) + : meType(NoPaint) +{ +} + + + + +Paint::Paint (const Color& rColor) + : meType(ColorPaint), + maValue(rColor) +{ +} + + + + +Paint::Paint (const Gradient& rGradient) + : meType(GradientPaint), + maValue(rGradient) +{ +} + + + + +Paint Paint::Create (const cssu::Any& rValue) +{ + ColorData aColor (0); + if (rValue >>= aColor) + return Paint(Color(aColor)); + + awt::Gradient aAwtGradient; + if (rValue >>= aAwtGradient) + return Paint(Tools::AwtToVclGradient(aAwtGradient)); + + return Paint(); +} + + + + +void Paint::Set (const Paint& rOther) +{ + meType = rOther.meType; + maValue = rOther.maValue; +} + + + + +Paint::Type Paint::GetType (void) const +{ + return meType; +} + + + + +const Color& Paint::GetColor (void) const +{ + if (meType != ColorPaint) + { + assert(meType==ColorPaint); + static Color aErrorColor; + return aErrorColor; + } + else + return ::boost::get<Color>(maValue); +} + + + + +const Gradient& Paint::GetGradient (void) const +{ + if (meType != GradientPaint) + { + assert(meType==GradientPaint); + static Gradient aErrorGradient; + return aErrorGradient; + } + else + return ::boost::get<Gradient>(maValue); +} + + + + +Wallpaper Paint::GetWallpaper (void) const +{ + switch (meType) + { + case Paint::NoPaint: + default: + return Wallpaper(); + break; + + case Paint::ColorPaint: + return Wallpaper(GetColor()); + break; + + case Paint::GradientPaint: + return Wallpaper(GetGradient()); + break; + } +} + + +} } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/Paint.hxx b/sfx2/source/sidebar/Paint.hxx new file mode 100644 index 000000000000..e6840a9533e5 --- /dev/null +++ b/sfx2/source/sidebar/Paint.hxx @@ -0,0 +1,80 @@ +/* + * 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 SFX_SIDEBAR_PAINT_HXX +#define SFX_SIDEBAR_PAINT_HXX + +#include <tools/color.hxx> +#include <vcl/gradient.hxx> +#include <vcl/wall.hxx> +#include <com/sun/star/awt/Gradient.hpp> + +#include <boost/variant.hpp> + +namespace cssu = ::com::sun::star::uno; + +namespace sfx2 { namespace sidebar { + +/** Abstraction of different ways to fill outlines. + Can be + - none (empty: outline is not filled) + - singular color + - gradient +*/ +class Paint +{ +public: + enum Type + { + NoPaint, + ColorPaint, + GradientPaint + }; + + // Create a Paint object for an Any that may contain a color, a + // awt::Gradient, or nothing. + static Paint Create (const cssu::Any& rValue); + + // Create paint with type NoPaint. + explicit Paint (void); + + // Create a Paint object for the given color. + explicit Paint (const Color& rColor); + + // Create a Paint object for the given gradient. + explicit Paint (const Gradient& rGradient); + + void Set (const ::sfx2::sidebar::Paint& rOther); + + Type GetType (void) const; + const Color& GetColor (void) const; + const Gradient& GetGradient (void) const; + + Wallpaper GetWallpaper (void) const; + +private: + Type meType; + ::boost::variant< + Color, + Gradient + > maValue; +}; + + +} } // end of namespace sfx2::sidebar + +#endif diff --git a/sfx2/source/sidebar/Panel.cxx b/sfx2/source/sidebar/Panel.cxx new file mode 100644 index 000000000000..5389b4ff444b --- /dev/null +++ b/sfx2/source/sidebar/Panel.cxx @@ -0,0 +1,267 @@ +/* + * 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 "Panel.hxx" +#include "PanelTitleBar.hxx" +#include "PanelDescriptor.hxx" +#include "sfx2/sidebar/Theme.hxx" +#include "Paint.hxx" + +#ifdef DEBUG +#include "Tools.hxx" +#include "Deck.hxx" +#endif + +#include <tools/svborder.hxx> +#include <toolkit/helper/vclunohelper.hxx> + +#include <com/sun/star/awt/XWindowPeer.hpp> +#include <com/sun/star/awt/PosSize.hpp> +#include <com/sun/star/ui/XToolPanel.hpp> + +#include <boost/bind.hpp> + + +using namespace css; +using namespace cssu; + + + +namespace sfx2 { namespace sidebar { + +Panel::Panel ( + const PanelDescriptor& rPanelDescriptor, + Window* pParentWindow, + const ::boost::function<void(void)>& rDeckLayoutTrigger, + const ::boost::function<void(void)>& rShowMenuFunctor) + : Window(pParentWindow), + msPanelId(rPanelDescriptor.msId), + mpTitleBar(new PanelTitleBar( + rPanelDescriptor.msTitle, + pParentWindow, + this, + rShowMenuFunctor)), + mbIsTitleBarOptional(rPanelDescriptor.mbIsTitleBarOptional), + mxElement(), + mxPanelComponent(), + mbIsExpanded(true), + maDeckLayoutTrigger(rDeckLayoutTrigger) +{ + SetBackground(Theme::GetPaint(Theme::Paint_PanelBackground).GetWallpaper()); + +#ifdef DEBUG + OSL_TRACE("creating Panel at %x", this); + SetText(A2S("Panel")); +#endif +} + + + + +Panel::~Panel (void) +{ + OSL_TRACE("destroying Panel at %x", this); + Dispose(); +} + + + + +void Panel::Dispose (void) +{ + mxPanelComponent = NULL; + + if (mxElement.is()) + { + Reference<lang::XComponent> xComponent (mxElement->getRealInterface(), UNO_QUERY); + if (xComponent.is()) + xComponent->dispose(); + } + + { + Reference<lang::XComponent> xComponent (mxElement, UNO_QUERY); + mxElement = NULL; + if (xComponent.is()) + xComponent->dispose(); + } + + { + Reference<lang::XComponent> xComponent (GetElementWindow(), UNO_QUERY); + if (xComponent.is()) + xComponent->dispose(); + } + + mpTitleBar.reset(); +} + + + + +TitleBar* Panel::GetTitleBar (void) const +{ + return mpTitleBar.get(); +} + + + + +bool Panel::IsTitleBarOptional (void) const +{ + return mbIsTitleBarOptional; +} + + + + +void Panel::SetUIElement (const Reference<ui::XUIElement>& rxElement) +{ + mxElement = rxElement; + if (mxElement.is()) + { + mxPanelComponent.set(mxElement->getRealInterface(), UNO_QUERY); + } +} + + + + +void Panel::SetExpanded (const bool bIsExpanded) +{ + if (mbIsExpanded != bIsExpanded) + { + mbIsExpanded = bIsExpanded; + maDeckLayoutTrigger(); + } +} + + + + +bool Panel::IsExpanded (void) const +{ + return mbIsExpanded; +} + + + + +bool Panel::HasIdPredicate (const ::rtl::OUString& rsId) const +{ + if (this == NULL) + return false; + else + return msPanelId.equals(rsId); +} + + + + +const ::rtl::OUString& Panel::GetId (void) const +{ + return msPanelId; +} + + + + +void Panel::Paint (const Rectangle& rUpdateArea) +{ + Window::Paint(rUpdateArea); +} + + + + +void Panel::Resize (void) +{ + Window::Resize(); + + // Forward new size to window of XUIElement. + Reference<awt::XWindow> xElementWindow (GetElementWindow()); + if (xElementWindow.is()) + { + const Size aSize (GetSizePixel()); + xElementWindow->setPosSize( + 0, + 0, + aSize.Width(), + aSize.Height(), + awt::PosSize::POSSIZE); + } +} + + + + +void Panel::Activate (void) +{ + Window::Activate(); +} + + + + + +void Panel::DataChanged (const DataChangedEvent& rEvent) +{ + (void)rEvent; + SetBackground(Theme::GetPaint(Theme::Paint_PanelBackground).GetWallpaper()); +} + + + + +Reference<ui::XSidebarPanel> Panel::GetPanelComponent (void) const +{ + return mxPanelComponent; +} + + + + +void Panel::PrintWindowTree (void) +{ +#ifdef DEBUG + Window* pElementWindow = VCLUnoHelper::GetWindow(GetElementWindow()); + if (pElementWindow != NULL) + { + OSL_TRACE("panel parent is %x", pElementWindow->GetParent()); + Deck::PrintWindowSubTree(pElementWindow, 2); + } + else + OSL_TRACE(" panel is empty"); +#endif +} + + + + +Reference<awt::XWindow> Panel::GetElementWindow (void) +{ + if (mxElement.is()) + { + Reference<ui::XToolPanel> xToolPanel(mxElement->getRealInterface(), UNO_QUERY); + if (xToolPanel.is()) + return xToolPanel->getWindow(); + } + + return NULL; +} + + +} } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/Panel.hxx b/sfx2/source/sidebar/Panel.hxx new file mode 100644 index 000000000000..ce6cb3c12eb6 --- /dev/null +++ b/sfx2/source/sidebar/Panel.hxx @@ -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 . + */ +#ifndef SFX_SIDEBAR_PANEL_HXX +#define SFX_SIDEBAR_PANEL_HXX + +#include <vcl/window.hxx> + +#include <com/sun/star/ui/XUIElement.hpp> +#include <com/sun/star/ui/XSidebarPanel.hpp> + +#include <boost/function.hpp> +#include <boost/scoped_ptr.hpp> +#include <boost/shared_ptr.hpp> +#include <vector> + +namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; + +namespace sfx2 { namespace sidebar { + +class PanelDescriptor; +class TitleBar; + + +class Panel + : public Window +{ +public: + Panel ( + const PanelDescriptor& rPanelDescriptor, + Window* pParentWindow, + const ::boost::function<void(void)>& rDeckLayoutTrigger, + const ::boost::function<void(void)>& rShowMenuFunctor); + virtual ~Panel (void); + + void Dispose (void); + + TitleBar* GetTitleBar (void) const; + bool IsTitleBarOptional (void) const; + void SetUIElement (const cssu::Reference<css::ui::XUIElement>& rxElement); + cssu::Reference<css::ui::XSidebarPanel> GetPanelComponent (void) const; + cssu::Reference<css::awt::XWindow> GetElementWindow (void); + void SetExpanded (const bool bIsExpanded); + bool IsExpanded (void) const; + bool HasIdPredicate (const ::rtl::OUString& rsId) const; + const ::rtl::OUString& GetId (void) const; + + virtual void Paint (const Rectangle& rUpdateArea); + virtual void Resize (void); + virtual void DataChanged (const DataChangedEvent& rEvent); + virtual void Activate (void); + + void PrintWindowTree (void); + +private: + const ::rtl::OUString msPanelId; + ::boost::scoped_ptr<TitleBar> mpTitleBar; + const bool mbIsTitleBarOptional; + cssu::Reference<css::ui::XUIElement> mxElement; + cssu::Reference<css::ui::XSidebarPanel> mxPanelComponent; + bool mbIsExpanded; + const ::boost::function<void(void)> maDeckLayoutTrigger; + Rectangle maBoundingBox; +}; +typedef ::boost::shared_ptr<Panel> SharedPanel; +typedef ::std::vector<SharedPanel> SharedPanelContainer; + + +} } // end of namespace sfx2::sidebar + +#endif diff --git a/sfx2/source/sidebar/PanelDescriptor.cxx b/sfx2/source/sidebar/PanelDescriptor.cxx new file mode 100644 index 000000000000..31e3b9e3c139 --- /dev/null +++ b/sfx2/source/sidebar/PanelDescriptor.cxx @@ -0,0 +1,60 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "PanelDescriptor.hxx" + + +namespace sfx2 { namespace sidebar { + +PanelDescriptor::PanelDescriptor (void) + : msTitle(), + mbIsTitleBarOptional(false), + msId(), + msDeckId(), + msHelpURL(), + maContextList(), + msImplementationURL(), + mnOrderIndex(10000), // Default value as defined in Sidebar.xcs + mbWantsCanvas(false) +{ +} + + + + +PanelDescriptor::PanelDescriptor (const PanelDescriptor& rOther) + : msTitle(rOther.msTitle), + mbIsTitleBarOptional(rOther.mbIsTitleBarOptional), + msId(rOther.msId), + msDeckId(rOther.msDeckId), + msHelpURL(rOther.msHelpURL), + maContextList(rOther.maContextList), + msImplementationURL(rOther.msImplementationURL), + mnOrderIndex(rOther.mnOrderIndex), + mbWantsCanvas(rOther.mbWantsCanvas) +{ +} + + + +PanelDescriptor::~PanelDescriptor (void) +{ +} + + +} } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/PanelDescriptor.hxx b/sfx2/source/sidebar/PanelDescriptor.hxx new file mode 100644 index 000000000000..a9b34456d762 --- /dev/null +++ b/sfx2/source/sidebar/PanelDescriptor.hxx @@ -0,0 +1,49 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SFX_SIDEBAR_PANEL_DESCRIPTOR_HXX +#define SFX_SIDEBAR_PANEL_DESCRIPTOR_HXX + +#include "sfx2/sidebar/EnumContext.hxx" +#include "ContextList.hxx" +#include <boost/shared_ptr.hpp> + + +namespace sfx2 { namespace sidebar { + +class PanelDescriptor +{ +public: + ::rtl::OUString msTitle; + sal_Bool mbIsTitleBarOptional; + ::rtl::OUString msId; + ::rtl::OUString msDeckId; + ::rtl::OUString msHelpURL; + ContextList maContextList; + ::rtl::OUString msImplementationURL; + sal_Int32 mnOrderIndex; + bool mbWantsCanvas; + + PanelDescriptor (void); + PanelDescriptor (const PanelDescriptor& rPanelDescriptor); + ~PanelDescriptor (void); +}; +typedef ::boost::shared_ptr<PanelDescriptor> SharedPanelDescriptor; + +} } // end of namespace sfx2::sidebar + +#endif diff --git a/sfx2/source/sidebar/PanelTitleBar.cxx b/sfx2/source/sidebar/PanelTitleBar.cxx new file mode 100644 index 000000000000..ded65fb8a458 --- /dev/null +++ b/sfx2/source/sidebar/PanelTitleBar.cxx @@ -0,0 +1,185 @@ +/* + * 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 "PanelTitleBar.hxx" + +#include "Paint.hxx" +#include "Panel.hxx" +#include "sfx2/sidebar/Theme.hxx" + +#include <tools/svborder.hxx> +#include <vcl/gradient.hxx> +#include <vcl/image.hxx> + +#ifdef DEBUG +#include "Tools.hxx" +#endif + + +namespace sfx2 { namespace sidebar { + + +static const sal_Int32 gaLeftIconPadding (5); +static const sal_Int32 gaRightIconPadding (5); + + +PanelTitleBar::PanelTitleBar ( + const ::rtl::OUString& rsTitle, + Window* pParentWindow, + Panel* pPanel, + const ::boost::function<void(void)>& rMenuAction) + : TitleBar(rsTitle, pParentWindow, GetBackgroundPaint()), + mbIsLeftButtonDown(false), + mpPanel(pPanel), + mnMenuItemIndex(1), + maMenuAction(rMenuAction) +{ + OSL_ASSERT(mpPanel != NULL); + + if (maMenuAction) + { + maToolBox.InsertItem( + mnMenuItemIndex, + Theme::GetImage(Theme::Image_PanelMenu)); + maToolBox.SetOutStyle(TOOLBOX_STYLE_FLAT); + } + +#ifdef DEBUG + SetText(A2S("PanelTitleBar")); +#endif +} + + + + +PanelTitleBar::~PanelTitleBar (void) +{ +} + + + + +Rectangle PanelTitleBar::GetTitleArea (const Rectangle& rTitleBarBox) +{ + if (mpPanel != NULL) + { + Image aImage (mpPanel->IsExpanded() + ? Theme::GetImage(Theme::Image_Expand) + : Theme::GetImage(Theme::Image_Collapse)); + return Rectangle( + aImage.GetSizePixel().Width() + gaLeftIconPadding + gaRightIconPadding, + rTitleBarBox.Top(), + rTitleBarBox.Right(), + rTitleBarBox.Bottom()); + } + else + return rTitleBarBox; +} + + + + +void PanelTitleBar::PaintDecoration (const Rectangle& rTitleBarBox) +{ + (void)rTitleBarBox; + + if (mpPanel != NULL) + { + Image aImage (mpPanel->IsExpanded() + ? Theme::GetImage(Theme::Image_Collapse) + : Theme::GetImage(Theme::Image_Expand)); + const Point aTopLeft ( + gaLeftIconPadding, + (GetSizePixel().Height()-aImage.GetSizePixel().Height())/2); + DrawImage(aTopLeft, aImage); + } +} + + + + +Paint PanelTitleBar::GetBackgroundPaint (void) +{ + return Theme::GetPaint(Theme::Paint_PanelTitleBarBackground); +} + + + + +Color PanelTitleBar::GetTextColor (void) +{ + return Theme::GetColor(Theme::Color_PanelTitleFont); +} + + + + +void PanelTitleBar::HandleToolBoxItemClick (const sal_uInt16 nItemIndex) +{ + if (nItemIndex == mnMenuItemIndex) + if (maMenuAction) + maMenuAction(); +} + + + + +void PanelTitleBar::MouseButtonDown (const MouseEvent& rMouseEvent) +{ + if (rMouseEvent.IsLeft()) + { + mbIsLeftButtonDown = true; + CaptureMouse(); + } +} + + + + +void PanelTitleBar::MouseButtonUp (const MouseEvent& rMouseEvent) +{ + if (IsMouseCaptured()) + ReleaseMouse(); + + if (rMouseEvent.IsLeft()) + { + if (mbIsLeftButtonDown) + { + if (mpPanel != NULL) + { + mpPanel->SetExpanded( ! mpPanel->IsExpanded()); + Invalidate(); + } + } + } + if (mbIsLeftButtonDown) + mbIsLeftButtonDown = false; +} + + + + +void PanelTitleBar::DataChanged (const DataChangedEvent& rEvent) +{ + maToolBox.SetItemImage( + mnMenuItemIndex, + Theme::GetImage(Theme::Image_PanelMenu)); + TitleBar::DataChanged(rEvent); +} + +} } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/PanelTitleBar.hxx b/sfx2/source/sidebar/PanelTitleBar.hxx new file mode 100644 index 000000000000..f76edcb4eaad --- /dev/null +++ b/sfx2/source/sidebar/PanelTitleBar.hxx @@ -0,0 +1,62 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SFX_SIDEBAR_PANEL_TITLE_BAR_HXX +#define SFX_SIDEBAR_PANEL_TITLE_BAR_HXX + +#include "TitleBar.hxx" + +#include <boost/function.hpp> + + +namespace sfx2 { namespace sidebar { + +class Panel; + +class PanelTitleBar + : public TitleBar +{ +public: + PanelTitleBar ( + const ::rtl::OUString& rsTitle, + Window* pParentWindow, + Panel* pPanel, + const ::boost::function<void(void)>& rMenuAction); + virtual ~PanelTitleBar (void); + + virtual void DataChanged (const DataChangedEvent& rEvent); + virtual void MouseButtonDown (const MouseEvent& rMouseEvent); + virtual void MouseButtonUp (const MouseEvent& rMouseEvent); + +protected: + virtual Rectangle GetTitleArea (const Rectangle& rTitleBarBox); + virtual void PaintDecoration (const Rectangle& rTitleBarBox); + virtual sidebar::Paint GetBackgroundPaint (void); + virtual Color GetTextColor (void); + virtual void HandleToolBoxItemClick (const sal_uInt16 nItemIndex); + +private: + bool mbIsLeftButtonDown; + Panel* mpPanel; + const sal_uInt16 mnMenuItemIndex; + const ::boost::function<void(void)> maMenuAction; +}; + + +} } // end of namespace sfx2::sidebar + +#endif diff --git a/sfx2/source/sidebar/PopupContainer.cxx b/sfx2/source/sidebar/PopupContainer.cxx new file mode 100644 index 000000000000..adf55a1b2a9c --- /dev/null +++ b/sfx2/source/sidebar/PopupContainer.cxx @@ -0,0 +1,50 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "precompiled_sfx2.hxx" + +#include "sfx2/sidebar/PopupContainer.hxx" + +namespace sfx2 { namespace sidebar { + +PopupContainer::PopupContainer (Window* pParent) + : FloatingWindow(pParent, WB_SYSTEMWINDOW | WB_3DLOOK) +{ +} + + + + +PopupContainer::~PopupContainer (void) +{ +} + + + + +long PopupContainer::Notify (NotifyEvent& rEvent) +{ + if (rEvent.GetType() == EVENT_LOSEFOCUS) + { + if( ! HasChildPathFocus(sal_True)) + EndPopupMode(); + } + return FloatingWindow::Notify(rEvent); +} + + +} } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/ResourceManager.cxx b/sfx2/source/sidebar/ResourceManager.cxx new file mode 100644 index 000000000000..efb1fa134820 --- /dev/null +++ b/sfx2/source/sidebar/ResourceManager.cxx @@ -0,0 +1,621 @@ +/* + * 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 "ResourceManager.hxx" +#include "Tools.hxx" + +#include <unotools/confignode.hxx> +#include <comphelper/componentcontext.hxx> +#include <comphelper/processfactory.hxx> +#include <comphelper/namedvaluecollection.hxx> +#include <comphelper/types.hxx> +#include <comphelper/stlunosequence.hxx> + +#include <rtl/ustrbuf.hxx> +#include <tools/diagnose_ex.h> + +#include <com/sun/star/frame/XModuleManager.hpp> + +#include <map> + + + +using ::rtl::OUString; +using namespace css; +using namespace cssu; + +namespace sfx2 { namespace sidebar { + +class ResourceManager::Deleter +{ +public: + void operator() (ResourceManager* pObject) + { + delete pObject; + } +}; + + +ResourceManager& ResourceManager::Instance (void) +{ + static ResourceManager maInstance; + return maInstance; +} + + + + +ResourceManager::ResourceManager (void) + : maDecks(), + maPanels(), + maProcessedApplications() +{ + ReadDeckList(); + ReadPanelList(); +} + + + + +ResourceManager::~ResourceManager (void) +{ + maPanels.clear(); + maDecks.clear(); +} + + + + +const DeckDescriptor* ResourceManager::GetBestMatchingDeck ( + const Context& rContext, + const Reference<frame::XFrame>& rxFrame) +{ + ReadLegacyAddons(rxFrame); + + for (DeckContainer::const_iterator iDeck(maDecks.begin()), iEnd(maDecks.end()); + iDeck!=iEnd; + ++iDeck) + { + if (iDeck->maContextList.GetMatch(rContext) != NULL) + return &*iDeck; + } + return NULL; +} + + + + +const DeckDescriptor* ResourceManager::GetDeckDescriptor ( + const ::rtl::OUString& rsDeckId) const +{ + for (DeckContainer::const_iterator + iDeck(maDecks.begin()), + iEnd(maDecks.end()); + iDeck!=iEnd; + ++iDeck) + { + if (iDeck->msId.equals(rsDeckId)) + return &*iDeck; + } + return NULL; +} + + + + +const PanelDescriptor* ResourceManager::GetPanelDescriptor ( + const ::rtl::OUString& rsPanelId) const +{ + for (PanelContainer::const_iterator + iPanel(maPanels.begin()), + iEnd(maPanels.end()); + iPanel!=iEnd; + ++iPanel) + { + if (iPanel->msId.equals(rsPanelId)) + return &*iPanel; + } + return NULL; +} + + + + +void ResourceManager::SetIsDeckEnabled ( + const ::rtl::OUString& rsDeckId, + const bool bIsEnabled) +{ + for (DeckContainer::iterator + iDeck(maDecks.begin()), + iEnd(maDecks.end()); + iDeck!=iEnd; + ++iDeck) + { + if (iDeck->msId.equals(rsDeckId)) + { + iDeck->mbIsEnabled = bIsEnabled; + return; + } + } +} + + + + +const ResourceManager::IdContainer& ResourceManager::GetMatchingDecks ( + IdContainer& rDeckIds, + const Context& rContext, + const Reference<frame::XFrame>& rxFrame) +{ + ReadLegacyAddons(rxFrame); + + ::std::multimap<sal_Int32,OUString> aOrderedIds; + for (DeckContainer::const_iterator + iDeck(maDecks.begin()), + iEnd (maDecks.end()); + iDeck!=iEnd; + ++iDeck) + { + const DeckDescriptor& rDeckDescriptor (*iDeck); + if (rDeckDescriptor.maContextList.GetMatch(rContext) != NULL) + aOrderedIds.insert(::std::multimap<sal_Int32,OUString>::value_type( + rDeckDescriptor.mnOrderIndex, + rDeckDescriptor.msId)); + } + + for (::std::multimap<sal_Int32,OUString>::const_iterator + iId(aOrderedIds.begin()), + iEnd(aOrderedIds.end()); + iId!=iEnd; + ++iId) + { + rDeckIds.push_back(iId->second); + } + + return rDeckIds; +} + + + + +const ResourceManager::PanelContextDescriptorContainer& ResourceManager::GetMatchingPanels ( + PanelContextDescriptorContainer& rPanelIds, + const Context& rContext, + const ::rtl::OUString& rsDeckId, + const Reference<frame::XFrame>& rxFrame) +{ + ReadLegacyAddons(rxFrame); + + ::std::multimap<sal_Int32,PanelContextDescriptor> aOrderedIds; + for (PanelContainer::const_iterator + iPanel(maPanels.begin()), + iEnd(maPanels.end()); + iPanel!=iEnd; + ++iPanel) + { + const PanelDescriptor& rPanelDescriptor (*iPanel); + if (rPanelDescriptor.msDeckId.equals(rsDeckId)) + { + const ContextList::Entry* pEntry = rPanelDescriptor.maContextList.GetMatch(rContext); + if (pEntry != NULL) + { + PanelContextDescriptor aPanelContextDescriptor; + aPanelContextDescriptor.msId = rPanelDescriptor.msId; + aPanelContextDescriptor.msMenuCommand = pEntry->msMenuCommand; + aPanelContextDescriptor.mbIsInitiallyVisible = pEntry->mbIsInitiallyVisible; + aOrderedIds.insert(::std::multimap<sal_Int32,PanelContextDescriptor>::value_type( + rPanelDescriptor.mnOrderIndex, + aPanelContextDescriptor)); + } + } + } + + for (::std::multimap<sal_Int32,PanelContextDescriptor>::const_iterator + iId(aOrderedIds.begin()), + iEnd(aOrderedIds.end()); + iId!=iEnd; + ++iId) + { + rPanelIds.push_back(iId->second); + } + + return rPanelIds; +} + + + + +void ResourceManager::ReadDeckList (void) +{ + const ::utl::OConfigurationTreeRoot aDeckRootNode ( + ::comphelper::getProcessComponentContext(), + A2S("org.openoffice.Office.UI.Sidebar/Content/DeckList"), + false); + if ( ! aDeckRootNode.isValid() ) + return; + + const Sequence<OUString> aDeckNodeNames (aDeckRootNode.getNodeNames()); + const sal_Int32 nCount (aDeckNodeNames.getLength()); + maDecks.resize(nCount); + sal_Int32 nWriteIndex(0); + for (sal_Int32 nReadIndex(0); nReadIndex<nCount; ++nReadIndex) + { + const ::utl::OConfigurationNode aDeckNode (aDeckRootNode.openNode(aDeckNodeNames[nReadIndex])); + if ( ! aDeckNode.isValid()) + continue; + + DeckDescriptor& rDeckDescriptor (maDecks[nWriteIndex++]); + + rDeckDescriptor.msTitle = ::comphelper::getString( + aDeckNode.getNodeValue("Title")); + rDeckDescriptor.msId = ::comphelper::getString( + aDeckNode.getNodeValue("Id")); + rDeckDescriptor.msIconURL = ::comphelper::getString( + aDeckNode.getNodeValue("IconURL")); + rDeckDescriptor.msHighContrastIconURL = ::comphelper::getString( + aDeckNode.getNodeValue("HighContrastIconURL")); + rDeckDescriptor.msHelpURL = ::comphelper::getString( + aDeckNode.getNodeValue("HelpURL")); + rDeckDescriptor.msHelpText = rDeckDescriptor.msTitle; + rDeckDescriptor.mbIsEnabled = true; + rDeckDescriptor.mnOrderIndex = ::comphelper::getINT32( + aDeckNode.getNodeValue("OrderIndex")); + + ReadContextList( + aDeckNode, + rDeckDescriptor.maContextList, + OUString()); + } + + // When there where invalid nodes then we have to adapt the size + // of the deck vector. + if (nWriteIndex<nCount) + maDecks.resize(nWriteIndex); +} + + + + +void ResourceManager::ReadPanelList (void) +{ + const ::utl::OConfigurationTreeRoot aPanelRootNode ( + ::comphelper::getProcessComponentContext(), + A2S("org.openoffice.Office.UI.Sidebar/Content/PanelList"), + false); + if ( ! aPanelRootNode.isValid() ) + return; + + const Sequence<OUString> aPanelNodeNames (aPanelRootNode.getNodeNames()); + const sal_Int32 nCount (aPanelNodeNames.getLength()); + maPanels.resize(nCount); + sal_Int32 nWriteIndex (0); + for (sal_Int32 nReadIndex(0); nReadIndex<nCount; ++nReadIndex) + { + const ::utl::OConfigurationNode aPanelNode (aPanelRootNode.openNode(aPanelNodeNames[nReadIndex])); + if ( ! aPanelNode.isValid()) + continue; + + PanelDescriptor& rPanelDescriptor (maPanels[nWriteIndex++]); + + rPanelDescriptor.msTitle = ::comphelper::getString( + aPanelNode.getNodeValue("Title")); + rPanelDescriptor.mbIsTitleBarOptional = ::comphelper::getBOOL( + aPanelNode.getNodeValue("TitleBarIsOptional")); + rPanelDescriptor.msId = ::comphelper::getString( + aPanelNode.getNodeValue("Id")); + rPanelDescriptor.msDeckId = ::comphelper::getString( + aPanelNode.getNodeValue("DeckId")); + rPanelDescriptor.msHelpURL = ::comphelper::getString( + aPanelNode.getNodeValue("HelpURL")); + rPanelDescriptor.msImplementationURL = ::comphelper::getString( + aPanelNode.getNodeValue("ImplementationURL")); + rPanelDescriptor.mnOrderIndex = ::comphelper::getINT32( + aPanelNode.getNodeValue("OrderIndex")); + rPanelDescriptor.mbWantsCanvas = ::comphelper::getBOOL( + aPanelNode.getNodeValue("WantsCanvas")); + const OUString sDefaultMenuCommand (::comphelper::getString( + aPanelNode.getNodeValue("DefaultMenuCommand"))); + + ReadContextList( + aPanelNode, + rPanelDescriptor.maContextList, + sDefaultMenuCommand); + } + + // When there where invalid nodes then we have to adapt the size + // of the deck vector. + if (nWriteIndex<nCount) + maPanels.resize(nWriteIndex); +} + + + + +void ResourceManager::ReadContextList ( + const ::utl::OConfigurationNode& rParentNode, + ContextList& rContextList, + const OUString& rsDefaultMenuCommand) const +{ + const Any aValue = rParentNode.getNodeValue("ContextList"); + Sequence<OUString> aValues; + sal_Int32 nCount; + if (aValue >>= aValues) + nCount = aValues.getLength(); + else + nCount = 0; + + for (sal_Int32 nIndex=0; nIndex<nCount; ++nIndex) + { + const OUString sValue (aValues[nIndex]); + sal_Int32 nCharacterIndex (0); + const OUString sApplicationName (sValue.getToken(0, ',', nCharacterIndex).trim()); + if (nCharacterIndex < 0) + { + if (sApplicationName.getLength() == 0) + { + // This is a valid case: in the XML file the separator + // was used as terminator. Using it in the last line + // creates an additional but empty entry. + break; + } + else + { + OSL_ASSERT("expecting three or four values per ContextList entry, separated by comma"); + continue; + } + } + + const OUString sContextName (sValue.getToken(0, ',', nCharacterIndex).trim()); + if (nCharacterIndex < 0) + { + OSL_ASSERT("expecting three or four values per ContextList entry, separated by comma"); + continue; + } + + const OUString sInitialState (sValue.getToken(0, ',', nCharacterIndex).trim()); + + // The fourth argument is optional. + const OUString sMenuCommandOverride ( + nCharacterIndex<0 + ? OUString() + : sValue.getToken(0, ',', nCharacterIndex).trim()); + const OUString sMenuCommand ( + sMenuCommandOverride.getLength()>0 + ? (sMenuCommandOverride.equalsAscii("none") + ? OUString() + : sMenuCommandOverride) + : rsDefaultMenuCommand); + + EnumContext::Application eApplication (EnumContext::GetApplicationEnum(sApplicationName)); + EnumContext::Application eApplication2 (EnumContext::Application_None); + if (eApplication == EnumContext::Application_None + && !sApplicationName.equals(EnumContext::GetApplicationName(EnumContext::Application_None))) + { + // Handle some special names: abbreviations that make + // context descriptions more readable. + if (sApplicationName.equalsAscii("Writer")) + eApplication = EnumContext::Application_Writer; + else if (sApplicationName.equalsAscii("Calc")) + eApplication = EnumContext::Application_Calc; + else if (sApplicationName.equalsAscii("Draw")) + eApplication = EnumContext::Application_Draw; + else if (sApplicationName.equalsAscii("Impress")) + eApplication = EnumContext::Application_Impress; + else if (sApplicationName.equalsAscii("DrawImpress")) + { + // A special case among the special names: it is + // common to use the same context descriptions for + // both Draw and Impress. This special case helps to + // avoid duplication in the .xcu file. + eApplication = EnumContext::Application_Draw; + eApplication2 = EnumContext::Application_Impress; + } + else if (sApplicationName.equalsAscii("WriterAndWeb")) + { + // Another special case for Writer and WriterWeb. + eApplication = EnumContext::Application_Writer; + eApplication2 = EnumContext::Application_WriterWeb; + } + else + { + OSL_ASSERT("application name not recognized"); + continue; + } + } + + const EnumContext::Context eContext (EnumContext::GetContextEnum(sContextName)); + if (eContext == EnumContext::Context_Unknown) + { + OSL_ASSERT("context name not recognized"); + continue; + } + + bool bIsInitiallyVisible; + if (sInitialState.equalsAscii("visible")) + bIsInitiallyVisible = true; + else if (sInitialState.equalsAscii("hidden")) + bIsInitiallyVisible = false; + else + { + OSL_ASSERT("unrecognized state"); + continue; + } + + if (eApplication != EnumContext::Application_None) + rContextList.AddContextDescription( + Context( + EnumContext::GetApplicationName(eApplication), + EnumContext::GetContextName(eContext)), + bIsInitiallyVisible, + sMenuCommand); + if (eApplication2 != EnumContext::Application_None) + rContextList.AddContextDescription( + Context( + EnumContext::GetApplicationName(eApplication2), + EnumContext::GetContextName(eContext)), + bIsInitiallyVisible, + sMenuCommand); + } +} + + + + +void ResourceManager::ReadLegacyAddons (const Reference<frame::XFrame>& rxFrame) +{ + // Get module name for given frame. + ::rtl::OUString sModuleName (GetModuleName(rxFrame)); + if (sModuleName.getLength() == 0) + return; + if (maProcessedApplications.find(sModuleName) != maProcessedApplications.end()) + { + // Addons for this application have already been read. + // There is nothing more to do. + return; + } + + // Mark module as processed. Even when there is an error that + // prevents the configuration data from being read, this error + // will not be triggered a second time. + maProcessedApplications.insert(sModuleName); + + // Get access to the configuration root node for the application. + ::utl::OConfigurationTreeRoot aLegacyRootNode (GetLegacyAddonRootNode(sModuleName)); + if ( ! aLegacyRootNode.isValid()) + return; + + // Process child nodes. + ::std::vector<OUString> aMatchingNodeNames; + GetToolPanelNodeNames(aMatchingNodeNames, aLegacyRootNode); + const sal_Int32 nCount (aMatchingNodeNames.size()); + size_t nDeckWriteIndex (maDecks.size()); + size_t nPanelWriteIndex (maPanels.size()); + maDecks.resize(maDecks.size() + nCount); + maPanels.resize(maPanels.size() + nCount); + for (sal_Int32 nReadIndex(0); nReadIndex<nCount; ++nReadIndex) + { + const OUString& rsNodeName (aMatchingNodeNames[nReadIndex]); + const ::utl::OConfigurationNode aChildNode (aLegacyRootNode.openNode(rsNodeName)); + if ( ! aChildNode.isValid()) + continue; + + DeckDescriptor& rDeckDescriptor (maDecks[nDeckWriteIndex++]); + rDeckDescriptor.msTitle = ::comphelper::getString(aChildNode.getNodeValue("UIName")); + rDeckDescriptor.msId = rsNodeName; + rDeckDescriptor.msIconURL = ::comphelper::getString(aChildNode.getNodeValue("ImageURL")); + rDeckDescriptor.msHighContrastIconURL = rDeckDescriptor.msIconURL; + rDeckDescriptor.msHelpURL = ::comphelper::getString(aChildNode.getNodeValue("HelpURL")); + rDeckDescriptor.msHelpText = rDeckDescriptor.msTitle; + rDeckDescriptor.maContextList.AddContextDescription(Context(sModuleName, A2S("any")), true, OUString()); + rDeckDescriptor.mbIsEnabled = true; + + PanelDescriptor& rPanelDescriptor (maPanels[nPanelWriteIndex++]); + rPanelDescriptor.msTitle = ::comphelper::getString(aChildNode.getNodeValue("UIName")); + rPanelDescriptor.mbIsTitleBarOptional = true; + rPanelDescriptor.msId = rsNodeName; + rPanelDescriptor.msDeckId = rsNodeName; + rPanelDescriptor.msHelpURL = ::comphelper::getString(aChildNode.getNodeValue("HelpURL")); + rPanelDescriptor.maContextList.AddContextDescription(Context(sModuleName, A2S("any")), true, OUString()); + rPanelDescriptor.msImplementationURL = rsNodeName; + } + + // When there where invalid nodes then we have to adapt the size + // of the deck and panel vectors. + if (nDeckWriteIndex < maDecks.size()) + maDecks.resize(nDeckWriteIndex); + if (nPanelWriteIndex < maPanels.size()) + maPanels.resize(nPanelWriteIndex); +} + + + + +::rtl::OUString ResourceManager::GetModuleName ( + const cssu::Reference<css::frame::XFrame>& rxFrame) +{ + if ( ! rxFrame.is() || ! rxFrame->getController().is()) + return OUString(); + + try + { + const ::comphelper::ComponentContext aContext (::comphelper::getProcessServiceFactory()); + const Reference<frame::XModuleManager> xModuleManager ( + aContext.createComponent("com.sun.star.frame.ModuleManager"), + UNO_QUERY_THROW); + return xModuleManager->identify(rxFrame); + } + catch (const Exception&) + { + DBG_UNHANDLED_EXCEPTION(); + } + return OUString(); +} + + + + +::utl::OConfigurationTreeRoot ResourceManager::GetLegacyAddonRootNode ( + const ::rtl::OUString& rsModuleName) const +{ + try + { + const ::comphelper::ComponentContext aContext (::comphelper::getProcessServiceFactory()); + const Reference<container::XNameAccess> xModuleAccess ( + aContext.createComponent("com.sun.star.frame.ModuleManager"), + UNO_QUERY_THROW); + const ::comphelper::NamedValueCollection aModuleProperties (xModuleAccess->getByName(rsModuleName)); + const ::rtl::OUString sWindowStateRef (aModuleProperties.getOrDefault( + "ooSetupFactoryWindowStateConfigRef", + ::rtl::OUString())); + + ::rtl::OUStringBuffer aPathComposer; + aPathComposer.appendAscii("org.openoffice.Office.UI."); + aPathComposer.append(sWindowStateRef); + aPathComposer.appendAscii("/UIElements/States"); + + return ::utl::OConfigurationTreeRoot(::comphelper::getProcessComponentContext(), + aPathComposer.makeStringAndClear(), false); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + return ::utl::OConfigurationTreeRoot(); +} + + + + +void ResourceManager::GetToolPanelNodeNames ( + ::std::vector<OUString>& rMatchingNames, + const ::utl::OConfigurationTreeRoot aRoot) const +{ + Sequence<OUString> aChildNodeNames (aRoot.getNodeNames()); + const sal_Int32 nCount (aChildNodeNames.getLength()); + for (sal_Int32 nIndex(0); nIndex<nCount; ++nIndex) + { + if (aChildNodeNames[nIndex].matchAsciiL( + RTL_CONSTASCII_STRINGPARAM( "private:resource/toolpanel/"))) + rMatchingNames.push_back(aChildNodeNames[nIndex]); + } +} + + + +} } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/ResourceManager.hxx b/sfx2/source/sidebar/ResourceManager.hxx new file mode 100644 index 000000000000..cc9093c34b92 --- /dev/null +++ b/sfx2/source/sidebar/ResourceManager.hxx @@ -0,0 +1,121 @@ +/* + * 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 SFX_SIDEBAR_RESOURCE_MANAGER_HXX +#define SFX_SIDEBAR_RESOURCE_MANAGER_HXX + +#include "DeckDescriptor.hxx" +#include "PanelDescriptor.hxx" +#include "Context.hxx" +#include <unotools/confignode.hxx> +#include <com/sun/star/frame/XFrame.hpp> +#include <set> +#include <boost/shared_ptr.hpp> + + +namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; + +namespace sfx2 { namespace sidebar { + +class Context; +class ContextList; + +/** Read the content of the Sidebar.xcu file and provide access + methods so that the sidebar can easily decide which content panels + to display for a certain context. +*/ +class ResourceManager +{ +public: + static ResourceManager& Instance (void); + + const DeckDescriptor* GetBestMatchingDeck ( + const Context& rContext, + const cssu::Reference<css::frame::XFrame>& rxFrame); + + const DeckDescriptor* GetDeckDescriptor ( + const ::rtl::OUString& rsDeckId) const; + const PanelDescriptor* GetPanelDescriptor ( + const ::rtl::OUString& rsPanelId) const; + + /** Excluded or include a deck from being displayed in the tab + bar. + Note that this value is not persistent. + The flag can not be set directly at a DeckDescriptor object + because the ResourceManager gives access to to them only + read-only. + */ + void SetIsDeckEnabled ( + const ::rtl::OUString& rsDeckId, + const bool bIsEnabled); + + typedef ::std::vector<rtl::OUString> IdContainer; + class PanelContextDescriptor + { + public: + ::rtl::OUString msId; + ::rtl::OUString msMenuCommand; + bool mbIsInitiallyVisible; + }; + typedef ::std::vector<PanelContextDescriptor> PanelContextDescriptorContainer; + + const IdContainer& GetMatchingDecks ( + IdContainer& rDeckDescriptors, + const Context& rContext, + const cssu::Reference<css::frame::XFrame>& rxFrame); + + const PanelContextDescriptorContainer& GetMatchingPanels ( + PanelContextDescriptorContainer& rPanelDescriptors, + const Context& rContext, + const ::rtl::OUString& rsDeckId, + const cssu::Reference<css::frame::XFrame>& rxFrame); + + static ::rtl::OUString GetModuleName ( + const cssu::Reference<css::frame::XFrame>& rxFrame); + +private: + ResourceManager (void); + ~ResourceManager (void); + class Deleter; + friend class Deleter; + + typedef ::std::vector<DeckDescriptor> DeckContainer; + DeckContainer maDecks; + typedef ::std::vector<PanelDescriptor> PanelContainer; + PanelContainer maPanels; + mutable ::std::set<rtl::OUString> maProcessedApplications; + + void ReadDeckList (void); + void ReadPanelList (void); + void ReadContextList ( + const ::utl::OConfigurationNode& rNode, + ContextList& rContextList, + const ::rtl::OUString& rsDefaultMenuCommand) const; + void ReadLegacyAddons ( + const cssu::Reference<css::frame::XFrame>& rxFrame); + ::utl::OConfigurationTreeRoot GetLegacyAddonRootNode ( + const ::rtl::OUString& rsModuleName) const; + void GetToolPanelNodeNames ( + ::std::vector<rtl::OUString>& rMatchingNames, + const ::utl::OConfigurationTreeRoot aRoot) const; +}; + + +} } // end of namespace sfx2::sidebar + +#endif diff --git a/sfx2/source/sidebar/Sidebar.cxx b/sfx2/source/sidebar/Sidebar.cxx new file mode 100644 index 000000000000..af3797a2b49a --- /dev/null +++ b/sfx2/source/sidebar/Sidebar.cxx @@ -0,0 +1,77 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "precompiled_sfx2.hxx" + +#include "Sidebar.hxx" +#include "ResourceManager.hxx" + +using namespace css; +using namespace cssu; + +namespace sfx2 { namespace sidebar { + +Sidebar::Sidebar( + Window& rParentWindow, + const Reference<frame::XFrame>& rxDocumentFrame) + : Window(&rParentWindow, WB_DIALOGCONTROL) +{ + ContentPanelManager::Instance(); +} + + + + +Sidebar::~Sidebar (void) +{ +} + + + + +void Sidebar::Resize (void) +{ + Window::Resize(); + // m_pImpl->OnResize(); +} + + + + +void Sidebar::GetFocus (void) +{ + Window::GetFocus(); + // m_pImpl->OnGetFocus(); +} + + + + +void Sidebar::DataChanged (const DataChangedEvent& rDataChangedEvent) +{ + if (rDataChangedEvent.GetType() == DATACHANGED_SETTINGS + && (rDataChangedEvent.GetFlags() & SETTINGS_STYLE)!= 0) + { + Invalidate(); + } + else + Window::DataChanged(rDataChangedEvent); +} + + + +} } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/Sidebar.hrc b/sfx2/source/sidebar/Sidebar.hrc new file mode 100644 index 000000000000..852648c6a929 --- /dev/null +++ b/sfx2/source/sidebar/Sidebar.hrc @@ -0,0 +1,53 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include <sfx2/sfx.hrc> + +#define RID_SIDEBAR_RESOURCE (RID_SFX_SIDEBAR_START + 0) + +#define IMAGE_SIDEBAR_PLUS 1 +#define IMAGE_SIDEBAR_MINUS 3 +#define IMAGE_SIDEBAR_GRIP 5 +#define IMAGE_SIDEBAR_MENU 7 +#define IMAGE_SIDEBAR_DETAIL_DIALOG 9 +#define IMAGE_SIDEBAR_TOOLBOX_SEPARATOR 11 +#define IMAGE_SIDEBAR_DECK_3D_LARGE 20 +#define IMAGE_SIDEBAR_DECK_3D_SMALL 22 +#define IMAGE_SIDEBAR_DECK_ANIMATION_LARGE 30 +#define IMAGE_SIDEBAR_DECK_ANIMATION_SMALL 32 +#define IMAGE_SIDEBAR_DECK_COLORS_LARGE 40 +#define IMAGE_SIDEBAR_DECK_COLORS_SMALL 42 +#define IMAGE_SIDEBAR_DECK_EYEDROPPER_LARGE 50 +#define IMAGE_SIDEBAR_DECK_EYEDROPPER_SMALL 52 +#define IMAGE_SIDEBAR_DECK_GALLERY_LARGE 60 +#define IMAGE_SIDEBAR_DECK_GALLERY_SMALL 62 +#define IMAGE_SIDEBAR_DECK_IMGANIM_LARGE 70 +#define IMAGE_SIDEBAR_DECK_IMGANIM_SMALL 72 +#define IMAGE_SIDEBAR_DECK_NAVIGATOR_LARGE 80 +#define IMAGE_SIDEBAR_DECK_NAVIGATOR_SMALL 82 +#define IMAGE_SIDEBAR_PROPERTIES_DECK_LARGE 90 +#define IMAGE_SIDEBAR_PROPERTIES_DECK_SMALL 92 +#define IMAGE_SIDEBAR_DECK_STYLE_LARGE 100 +#define IMAGE_SIDEBAR_DECK_STYLE_SMALL 102 +#define IMAGE_SIDEBAR_DECK_TEMPLATE_LARGE 110 +#define IMAGE_SIDEBAR_DECK_TEMPLATE_SMALL 112 +#define IMAGE_SIDEBAR_DECK_TRANSITION_LARGE 120 +#define IMAGE_SIDEBAR_DECK_TRANSITION_SMALL 122 +#define IMAGE_SIDEBAR_DECK_FUNCTIONS_LARGE 130 +#define IMAGE_SIDEBAR_DECK_FUNCTIONS_SMALL 132 +#define STRING_CUSTOMIZATION 200 +#define STRING_RESTORE 201 diff --git a/sfx2/source/sidebar/Sidebar.hxx b/sfx2/source/sidebar/Sidebar.hxx new file mode 100644 index 000000000000..e225bdf8aaa8 --- /dev/null +++ b/sfx2/source/sidebar/Sidebar.hxx @@ -0,0 +1,64 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SFX_SIDEBAR_HXX +#define SFX_SIDEBAR_HXX + +#include "sfx2/dllapi.h" +#include <vcl/window.hxx> +#include <com/sun/star/frame/XFrame.hpp> + + +namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; + +namespace sfx2 { namespace sidebar { + + +/** SFX-less version of a module dependent task pane, filled with tool panels as specified in the respective + module's configuration +*/ +class SFX2_DLLPUBLIC Sidebar + : public Window +{ +public: + /** creates a new instance + @param i_rParentWindow + the parent window + @param i_rDocumentFrame + the frame to which the task pane belongs. Will be passed to any custom tool panels created + via an XUIElementFactory. Also, it is used to determine the module which the task pane is + responsible for, thus controlling which tool panels are actually available. + */ + Sidebar( + Window& rParentWindow, + const cssu::Reference<css::frame::XFrame>& rxDocumentFrame); + + + virtual ~Sidebar (void); + +protected: + virtual void Resize (void); + virtual void GetFocus (void); + +private: +}; + + +} } // end of namespace sfx2::sidebar + +#endif diff --git a/sfx2/source/sidebar/Sidebar.src b/sfx2/source/sidebar/Sidebar.src new file mode 100644 index 000000000000..64eef88e3a23 --- /dev/null +++ b/sfx2/source/sidebar/Sidebar.src @@ -0,0 +1,158 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "Sidebar.hrc" + +Resource RID_SIDEBAR_RESOURCE +{ + Image IMAGE_SIDEBAR_PLUS + { + ImageBitmap = Bitmap { File = "plus.png" ;}; + }; + + Image IMAGE_SIDEBAR_MINUS + { + ImageBitmap = Bitmap { File = "minus.png" ;}; + }; + + Image IMAGE_SIDEBAR_GRIP + { + ImageBitmap = Bitmap { File = "grip.png" ;}; + }; + + Image IMAGE_SIDEBAR_MENU + { + ImageBitmap = Bitmap { File = "symphony/open_more.png" ;}; + }; + + Image IMAGE_SIDEBAR_DETAIL_DIALOG + { + ImageBitmap = Bitmap { File = "symphony/morebutton.png" ;}; + }; + + Image IMAGE_SIDEBAR_TOOLBOX_SEPARATOR + { + ImageBitmap = Bitmap { File = "separator.png" ;}; + }; + + Image IMAGE_SIDEBAR_DECK_3D_LARGE + { + ImageBitmap = Bitmap { File = "symphony/sidebar-3d-large.png" ;}; + }; + Image IMAGE_SIDEBAR_DECK_3D_SMALL + { + ImageBitmap = Bitmap { File = "symphony/sidebar-3d-small.png" ;}; + }; + Image IMAGE_SIDEBAR_DECK_ANIMATION_LARGE + { + ImageBitmap = Bitmap { File = "symphony/sidebar-animation-large.png" ;}; + }; + Image IMAGE_SIDEBAR_DECK_ANIMATION_SMALL + { + ImageBitmap = Bitmap { File = "symphony/sidebar-animation-small.png" ;}; + }; + Image IMAGE_SIDEBAR_DECK_COLORS_LARGE + { + ImageBitmap = Bitmap { File = "symphony/sidebar-colors-large.png" ;}; + }; + Image IMAGE_SIDEBAR_DECK_COLORS_SMALL + { + ImageBitmap = Bitmap { File = "symphony/sidebar-colors-small.png" ;}; + }; + Image IMAGE_SIDEBAR_DECK_EYEDROPPER_LARGE + { + ImageBitmap = Bitmap { File = "symphony/sidebar-eyedropper-large.png" ;}; + }; + Image IMAGE_SIDEBAR_DECK_EYEDROPPER_SMALL + { + ImageBitmap = Bitmap { File = "symphony/sidebar-eyedropper-small.png" ;}; + }; + Image IMAGE_SIDEBAR_DECK_GALLERY_LARGE + { + ImageBitmap = Bitmap { File = "symphony/sidebar-gallery-large.png" ;}; + }; + Image IMAGE_SIDEBAR_DECK_GALLERY_SMALL + { + ImageBitmap = Bitmap { File = "symphony/sidebar-gallery-small.png" ;}; + }; + Image IMAGE_SIDEBAR_DECK_IMGANIM_LARGE + { + ImageBitmap = Bitmap { File = "symphony/sidebar-imganim-large.png" ;}; + }; + Image IMAGE_SIDEBAR_DECK_IMGANIM_SMALL + { + ImageBitmap = Bitmap { File = "symphony/sidebar-imganim-small.png" ;}; + }; + Image IMAGE_SIDEBAR_DECK_NAVIGATOR_LARGE + { + ImageBitmap = Bitmap { File = "symphony/sidebar-navigator-large.png" ;}; + }; + Image IMAGE_SIDEBAR_DECK_NAVIGATOR_SMALL + { + ImageBitmap = Bitmap { File = "symphony/sidebar-navigator-small.png" ;}; + }; + Image IMAGE_SIDEBAR_PROPERTIES_DECK_LARGE + { + ImageBitmap = Bitmap { File = "symphony/sidebar-property-large.png" ;}; + }; + Image IMAGE_SIDEBAR_PROPERTIES_DECK_SMALL + { + ImageBitmap = Bitmap { File = "symphony/sidebar-property-small.png" ;}; + }; + Image IMAGE_SIDEBAR_DECK_STYLE_LARGE + { + ImageBitmap = Bitmap { File = "symphony/sidebar-style-large.png" ;}; + }; + Image IMAGE_SIDEBAR_DECK_STYLE_SMALL + { + ImageBitmap = Bitmap { File = "symphony/sidebar-style-small.png" ;}; + }; + Image IMAGE_SIDEBAR_DECK_TEMPLATE_LARGE + { + ImageBitmap = Bitmap { File = "symphony/sidebar-template-large.png" ;}; + }; + Image IMAGE_SIDEBAR_DECK_TEMPLATE_SMALL + { + ImageBitmap = Bitmap { File = "symphony/sidebar-template-small.png" ;}; + }; + Image IMAGE_SIDEBAR_DECK_TRANSITION_LARGE + { + ImageBitmap = Bitmap { File = "symphony/sidebar-transition-large.png" ;}; + }; + Image IMAGE_SIDEBAR_DECK_TRANSITION_SMALL + { + ImageBitmap = Bitmap { File = "symphony/sidebar-transition-small.png" ;}; + }; + Image IMAGE_SIDEBAR_DECK_FUNCTIONS_LARGE + { + ImageBitmap = Bitmap { File = "symphony/sidebar-functions-large.png" ;}; + }; + Image IMAGE_SIDEBAR_DECK_FUNCTIONS_SMALL + { + ImageBitmap = Bitmap { File = "symphony/sidebar-functions-small.png" ;}; + }; + String STRING_CUSTOMIZATION + { + Text [en-US] = "Customization"; + }; + String STRING_RESTORE + { + Text [en-US] = "Restore Default"; + }; +}; + + diff --git a/sfx2/source/sidebar/SidebarChildWindow.cxx b/sfx2/source/sidebar/SidebarChildWindow.cxx new file mode 100644 index 000000000000..2fdf0a23d865 --- /dev/null +++ b/sfx2/source/sidebar/SidebarChildWindow.cxx @@ -0,0 +1,56 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "sfx2/sidebar/SidebarChildWindow.hxx" +#include "SidebarDockingWindow.hxx" +#include "sfx2/sfxsids.hrc" +#include "helpid.hrc" +#include "sfx2/dockwin.hxx" +#include <sfx2/sidebar/ResourceDefinitions.hrc> + + +namespace sfx2 { namespace sidebar { + + +SFX_IMPL_DOCKINGWINDOW_WITHID(SidebarChildWindow, SID_SIDEBAR); + + +SidebarChildWindow::SidebarChildWindow ( + Window* pSidebarParent, + sal_uInt16 nId, + SfxBindings* pBindings, + SfxChildWinInfo* pInfo ) + : SfxChildWindow(pSidebarParent, nId) +{ + this->pWindow = new SidebarDockingWindow( + pBindings, + *this, + pSidebarParent, + WB_STDDOCKWIN | WB_OWNERDRAWDECORATION | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK | WB_ROLLABLE); + eChildAlignment = SFX_ALIGN_RIGHT; + + this->pWindow->SetHelpId(HID_SIDEBAR_WINDOW); + this->pWindow->SetOutputSizePixel(Size(300, 450)); + + dynamic_cast<SfxDockingWindow*>(pWindow)->Initialize(pInfo); + SetHideNotDelete(sal_True); + + this->pWindow->Show(); +} + + +} } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx new file mode 100644 index 000000000000..08e1e6d420ff --- /dev/null +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -0,0 +1,927 @@ +/* + * 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 "SidebarController.hxx" +#include "Deck.hxx" +#include "DeckTitleBar.hxx" +#include "Panel.hxx" +#include "SidebarPanel.hxx" +#include "SidebarResource.hxx" +#include "TabBar.hxx" +#include "sfx2/sidebar/Theme.hxx" +#include "SidebarDockingWindow.hxx" +#include "Context.hxx" +#include "Tools.hxx" + +#include "sfxresid.hxx" +#include "sfx2/sfxsids.hrc" +#include "sfx2/titledockwin.hxx" +#include "sfxlocal.hrc" +#include <vcl/floatwin.hxx> +#include "splitwin.hxx" +#include <svl/smplhint.hxx> +#include <tools/link.hxx> +#include <comphelper/processfactory.hxx> +#include <comphelper/componentcontext.hxx> +#include <comphelper/namedvaluecollection.hxx> + +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/ui/ContextChangeEventMultiplexer.hpp> +#include <com/sun/star/ui/ContextChangeEventObject.hpp> +#include <com/sun/star/ui/XUIElementFactory.hpp> +#include <com/sun/star/util/XURLTransformer.hpp> +#include <com/sun/star/util/URL.hpp> + +#include <boost/bind.hpp> +#include <boost/function.hpp> +#include <boost/scoped_array.hpp> + + +using namespace css; +using namespace cssu; +using ::rtl::OUString; + + + +namespace sfx2 { namespace sidebar { + +namespace { + enum MenuId + { + MID_UNLOCK_TASK_PANEL = 1, + MID_LOCK_TASK_PANEL, + MID_CUSTOMIZATION, + MID_RESTORE_DEFAULT, + MID_FIRST_PANEL, + MID_FIRST_HIDE = 1000 + }; +} + + +SidebarController::SidebarController ( + SidebarDockingWindow* pParentWindow, + const cssu::Reference<css::frame::XFrame>& rxFrame) + : SidebarControllerInterfaceBase(m_aMutex), + mpCurrentDeck(), + mpParentWindow(pParentWindow), + mpTabBar(new TabBar( + mpParentWindow, + rxFrame, + ::boost::bind(&SidebarController::SwitchToDeck, this, _1), + ::boost::bind(&SidebarController::ShowPopupMenu, this, _1,_2,_3))), + mxFrame(rxFrame), + maCurrentContext(OUString(), OUString()), + msCurrentDeckId(A2S("PropertyDeck")), + maPropertyChangeForwarder(::boost::bind(&SidebarController::BroadcastPropertyChange, this)), + mbIsDeckClosed(false), + mnSavedSidebarWidth(pParentWindow->GetSizePixel().Width()) +{ + if (pParentWindow == NULL) + { + OSL_ASSERT(pParentWindow!=NULL); + return; + } + + // Listen for context change events. + cssu::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer ( + css::ui::ContextChangeEventMultiplexer::get( + ::comphelper::getProcessComponentContext())); + if (xMultiplexer.is()) + xMultiplexer->addContextChangeEventListener( + static_cast<css::ui::XContextChangeEventListener*>(this), + mxFrame->getController()); + + // Listen for window events. + mpParentWindow->AddEventListener(LINK(this, SidebarController, WindowEventHandler)); + + // Listen for theme property changes. + Theme::GetPropertySet()->addPropertyChangeListener( + A2S(""), + static_cast<css::beans::XPropertyChangeListener*>(this)); + + SwitchToDeck(A2S("default")); +} + + + + +SidebarController::~SidebarController (void) +{ +} + + + + +void SAL_CALL SidebarController::disposing (void) +{ + maFocusManager.Clear(); + + cssu::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer ( + css::ui::ContextChangeEventMultiplexer::get( + ::comphelper::getProcessComponentContext())); + if (xMultiplexer.is()) + xMultiplexer->removeAllContextChangeEventListeners( + static_cast<css::ui::XContextChangeEventListener*>(this)); + + if (mpParentWindow != NULL) + { + mpParentWindow->RemoveEventListener(LINK(this, SidebarController, WindowEventHandler)); + mpParentWindow = NULL; + } + + if (mpCurrentDeck) + { + mpCurrentDeck->Dispose(); + OSL_TRACE("deleting deck window subtree"); + mpCurrentDeck->PrintWindowTree(); + mpCurrentDeck.reset(); + } + + mpTabBar.reset(); + + Theme::GetPropertySet()->removePropertyChangeListener( + A2S(""), + static_cast<css::beans::XPropertyChangeListener*>(this)); +} + + + + +void SAL_CALL SidebarController::notifyContextChangeEvent (const css::ui::ContextChangeEventObject& rEvent) + throw(cssu::RuntimeException) +{ + UpdateConfigurations( + Context( + rEvent.ApplicationName, + rEvent.ContextName)); +} + + + + +void SAL_CALL SidebarController::disposing (const css::lang::EventObject& rEventObject) + throw(cssu::RuntimeException) +{ + (void)rEventObject; + + dispose(); +} + + + + +void SAL_CALL SidebarController::propertyChange (const css::beans::PropertyChangeEvent& rEvent) + throw(cssu::RuntimeException) +{ + (void)rEvent; + + maPropertyChangeForwarder.RequestCall(); +} + + + + +void SAL_CALL SidebarController::requestLayout (void) + throw(cssu::RuntimeException) +{ + if (mpCurrentDeck) + mpCurrentDeck->RequestLayout(); + RestrictWidth(); +} + + + + +void SidebarController::BroadcastPropertyChange (void) +{ + DataChangedEvent aEvent (DATACHANGED_USER); + mpParentWindow->NotifyAllChildren(aEvent); + mpParentWindow->Invalidate(INVALIDATE_CHILDREN); +} + + + + +void SidebarController::NotifyResize (void) +{ + if (mpTabBar == NULL) + { + OSL_ASSERT(mpTabBar!=NULL); + return; + } + + Window* pParentWindow = mpTabBar->GetParent(); + + const sal_Int32 nWidth (pParentWindow->GetSizePixel().Width()); + const sal_Int32 nHeight (pParentWindow->GetSizePixel().Height()); + + // Place the deck. + if (mpCurrentDeck) + { + mpCurrentDeck->setPosSizePixel(0,0, nWidth-TabBar::GetDefaultWidth(), nHeight); + mpCurrentDeck->Show(); + mpCurrentDeck->RequestLayout(); + } + + // Place the tab bar. + mpTabBar->setPosSizePixel(nWidth-TabBar::GetDefaultWidth(),0,TabBar::GetDefaultWidth(),nHeight); + mpTabBar->Show(); + + // Determine if the closer of the deck can be shown. + if (mpCurrentDeck) + { + DeckTitleBar* pTitleBar = mpCurrentDeck->GetTitleBar(); + if (pTitleBar != NULL && pTitleBar->IsVisible()) + pTitleBar->SetCloserVisible(CanModifyChildWindowWidth()); + } + + if (nWidth > TabBar::GetDefaultWidth()) + mnSavedSidebarWidth = nWidth; + + RestrictWidth(); +#ifdef DEBUG + if (mpCurrentDeck) + { + mpCurrentDeck->PrintWindowTree(); + sal_Int32 nPanelIndex (0); + for (SharedPanelContainer::const_iterator + iPanel(mpCurrentDeck->GetPanels().begin()), + iEnd(mpCurrentDeck->GetPanels().end()); + iPanel!=iEnd; + ++iPanel,++nPanelIndex) + { + OSL_TRACE("panel %d:", nPanelIndex); + (*iPanel)->PrintWindowTree(); + } + } +#endif +} + + + + +void SidebarController::UpdateConfigurations (const Context& rContext) +{ + if (maCurrentContext != rContext) + { + maCurrentContext = rContext; + + // Notify the tab bar about the updated set of decks. + ResourceManager::IdContainer aDeckIds; + ResourceManager::Instance().GetMatchingDecks ( + aDeckIds, + rContext, + mxFrame); + mpTabBar->SetDecks(aDeckIds); + + // Check if the current deck is among the matching decks. + bool bCurrentDeckMatches (false); + for (ResourceManager::IdContainer::const_iterator + iDeck(aDeckIds.begin()), + iEnd(aDeckIds.end()); + iDeck!=iEnd; + ++iDeck) + { + if (iDeck->equals(msCurrentDeckId)) + { + bCurrentDeckMatches = true; + break; + } + } + + DeckDescriptor const* pDeckDescriptor = NULL; + if ( ! bCurrentDeckMatches) + pDeckDescriptor = ResourceManager::Instance().GetBestMatchingDeck(rContext, mxFrame); + else + pDeckDescriptor = ResourceManager::Instance().GetDeckDescriptor(msCurrentDeckId); + if (pDeckDescriptor != NULL) + { + msCurrentDeckId = pDeckDescriptor->msId; + SwitchToDeck(*pDeckDescriptor, rContext); + } + +#ifdef DEBUG + // Show the context name in the deck title bar. + if (mpCurrentDeck) + { + DeckTitleBar* pTitleBar = mpCurrentDeck->GetTitleBar(); + if (pTitleBar != NULL) + pTitleBar->SetTitle(msCurrentDeckTitle+A2S(" (")+rContext.msContext+A2S(")")); + } +#endif + } +} + + + + +void SidebarController::SwitchToDeck ( + const ::rtl::OUString& rsDeckId) +{ + if ( ! msCurrentDeckId.equals(rsDeckId) || mbIsDeckClosed) + { + const DeckDescriptor* pDeckDescriptor = ResourceManager::Instance().GetDeckDescriptor(rsDeckId); + if (pDeckDescriptor != NULL) + SwitchToDeck(*pDeckDescriptor, maCurrentContext); + } +} + + + + +void SidebarController::SwitchToDeck ( + const DeckDescriptor& rDeckDescriptor, + const Context& rContext) +{ + maFocusManager.Clear(); + + if ( ! msCurrentDeckId.equals(rDeckDescriptor.msId)) + { + // When the deck changes then destroy the deck and all panels + // and create everything new. + if (mpCurrentDeck) + { + mpCurrentDeck->Dispose(); + mpCurrentDeck.reset(); + } + + msCurrentDeckId = rDeckDescriptor.msId; + } + + // Reopen the deck when necessary. + OpenDeck(); + + // Determine the panels to display in the deck. + ResourceManager::PanelContextDescriptorContainer aPanelContextDescriptors; + ResourceManager::Instance().GetMatchingPanels( + aPanelContextDescriptors, + rContext, + rDeckDescriptor.msId, + mxFrame); + + if (aPanelContextDescriptors.empty()) + { + // There are no panels to be displayed in the current context. + if (EnumContext::GetContextEnum(rContext.msContext) != EnumContext::Context_Empty) + { + // Switch to the "empty" context and try again. + SwitchToDeck( + rDeckDescriptor, + Context( + rContext.msApplication, + EnumContext::GetContextName(EnumContext::Context_Empty))); + return; + } + else + { + // This is already the "empty" context. Looks like we have + // to live with an empty deck. + } + } + + if (mpCurrentDeck + && ArePanelSetsEqual(mpCurrentDeck->GetPanels(), aPanelContextDescriptors)) + { + // Requested set of panels is identical to the current set of + // panels => Nothing to do. + return; + } + + // Provide a configuration and Deck object. + if ( ! mpCurrentDeck) + { + mpCurrentDeck.reset( + new Deck( + rDeckDescriptor, + mpParentWindow, + ::boost::bind(&SidebarController::CloseDeck, this))); + msCurrentDeckTitle = rDeckDescriptor.msTitle; + } + if ( ! mpCurrentDeck) + return; + + // Update the panel list. + const sal_Int32 nNewPanelCount (aPanelContextDescriptors.size()); + SharedPanelContainer aNewPanels; + const SharedPanelContainer& rCurrentPanels (mpCurrentDeck->GetPanels()); + aNewPanels.resize(nNewPanelCount); + sal_Int32 nWriteIndex (0); + bool bHasPanelSetChanged (false); + for (sal_Int32 nReadIndex=0; nReadIndex<nNewPanelCount; ++nReadIndex) + { + const ResourceManager::PanelContextDescriptor& rPanelContexDescriptor ( + aPanelContextDescriptors[nReadIndex]); + + // Find the corresponding panel among the currently active + // panels. + SharedPanelContainer::const_iterator iPanel (::std::find_if( + rCurrentPanels.begin(), + rCurrentPanels.end(), + ::boost::bind(&Panel::HasIdPredicate, _1, ::boost::cref(rPanelContexDescriptor.msId)))); + if (iPanel != rCurrentPanels.end()) + { + // Panel already exists in current deck. Reuse it. + aNewPanels[nWriteIndex] = *iPanel; + OSL_TRACE(" reusing panel %s", S2A(rPanelContexDescriptor.msId)); + } + else + { + // Panel does not yet exist. Create it. + aNewPanels[nWriteIndex] = CreatePanel( + rPanelContexDescriptor.msId, + mpCurrentDeck->GetPanelParentWindow(), + rPanelContexDescriptor.msMenuCommand); + OSL_TRACE(" creating panel %s", S2A(rPanelContexDescriptor.msId)); + bHasPanelSetChanged = true; + } + if (aNewPanels[nWriteIndex] != NULL) + { + // Depending on the context we have to collapse the panel. + aNewPanels[nWriteIndex]->SetExpanded(rPanelContexDescriptor.mbIsInitiallyVisible); + + ++nWriteIndex; + } + + } + aNewPanels.resize(nWriteIndex); + + // Activate the deck and the new set of panels. + mpCurrentDeck->setPosSizePixel( + 0, + 0, + mpParentWindow->GetSizePixel().Width()-TabBar::GetDefaultWidth(), + mpParentWindow->GetSizePixel().Height()); + mpCurrentDeck->SetPanels(aNewPanels); + mpCurrentDeck->Show(); + + // Tell the tab bar to highlight the button associated with the + // deck. + mpTabBar->HighlightDeck(rDeckDescriptor.msId); + + mpParentWindow->SetText(rDeckDescriptor.msTitle); + + if (bHasPanelSetChanged) + NotifyResize(); + + // Tell the focus manager about the new panels and tab bar + // buttons. + maFocusManager.SetPanels(aNewPanels); + mpTabBar->UpdateFocusManager(maFocusManager); +} + + + + +bool SidebarController::ArePanelSetsEqual ( + const SharedPanelContainer& rCurrentPanels, + const ResourceManager::PanelContextDescriptorContainer& rRequestedPanels) +{ + OSL_TRACE("current panel list:"); + for (SharedPanelContainer::const_iterator + iPanel(rCurrentPanels.begin()), + iEnd(rCurrentPanels.end()); + iPanel!=iEnd; + ++iPanel) + { + OSL_TRACE(" panel %s", S2A((*iPanel)->GetId())); + } + + OSL_TRACE("requested panels: "); + for (ResourceManager::PanelContextDescriptorContainer::const_iterator + iId(rRequestedPanels.begin()), + iEnd(rRequestedPanels.end()); + iId!=iEnd; + ++iId) + { + OSL_TRACE(" panel %s", S2A(iId->msId)); + } + + if (rCurrentPanels.size() != rRequestedPanels.size()) + return false; + for (sal_Int32 nIndex=0,nCount=rCurrentPanels.size(); nIndex<nCount; ++nIndex) + { + if (rCurrentPanels[nIndex] == NULL) + return false; + if ( ! rCurrentPanels[nIndex]->GetId().equals(rRequestedPanels[nIndex].msId)) + return false; + } + return true; +} + + + + +SharedPanel SidebarController::CreatePanel ( + const OUString& rsPanelId, + ::Window* pParentWindow, + const OUString& rsMenuCommand) +{ + const PanelDescriptor* pPanelDescriptor = ResourceManager::Instance().GetPanelDescriptor(rsPanelId); + if (pPanelDescriptor == NULL) + return SharedPanel(); + +#ifdef DEBUG + // Prevent the panel not being created in the same memory of an old panel. + ::boost::scoped_array<char> pUnused (new char[sizeof(Panel)]); + OSL_TRACE("allocated memory at %x", pUnused.get()); +#endif + + // Create the panel which is the parent window of the UIElement. + SharedPanel pPanel (new Panel( + *pPanelDescriptor, + pParentWindow, + ::boost::bind(&Deck::RequestLayout, mpCurrentDeck.get()), + rsMenuCommand.getLength()>0 + ? ::boost::bind(&SidebarController::ShowDetailMenu,this,rsMenuCommand) + : ::boost::function<void(void)>())); + + // Create the XUIElement. + Reference<ui::XUIElement> xUIElement (CreateUIElement( + pPanel->GetComponentInterface(), + pPanelDescriptor->msImplementationURL)); + if (xUIElement.is()) + { + // Initialize the panel and add it to the active deck. + pPanel->SetUIElement(xUIElement); + } + else + { + pPanel.reset(); + } + + return pPanel; +} + + + + +Reference<ui::XUIElement> SidebarController::CreateUIElement ( + const Reference<awt::XWindowPeer>& rxWindow, + const ::rtl::OUString& rsImplementationURL) +{ + try + { + const ::comphelper::ComponentContext aComponentContext (::comphelper::getProcessServiceFactory()); + const Reference<ui::XUIElementFactory> xUIElementFactory ( + aComponentContext.createComponent("com.sun.star.ui.UIElementFactoryManager"), + UNO_QUERY_THROW); + + // Create the XUIElement. + ::comphelper::NamedValueCollection aCreationArguments; + aCreationArguments.put("Frame", makeAny(mxFrame)); + aCreationArguments.put("ParentWindow", makeAny(rxWindow)); + SfxDockingWindow* pSfxDockingWindow = dynamic_cast<SfxDockingWindow*>(mpParentWindow); + if (pSfxDockingWindow != NULL) + aCreationArguments.put("SfxBindings", makeAny(sal_uInt64(&pSfxDockingWindow->GetBindings()))); + aCreationArguments.put("Theme", Theme::GetPropertySet()); + aCreationArguments.put("Sidebar", makeAny(Reference<ui::XSidebar>(static_cast<ui::XSidebar*>(this)))); + + Reference<ui::XUIElement> xUIElement( + xUIElementFactory->createUIElement( + rsImplementationURL, + Sequence<beans::PropertyValue>(aCreationArguments.getPropertyValues())), + UNO_QUERY_THROW); + + return xUIElement; + } + catch(Exception& rException) + { + OSL_TRACE("caught exception: %s", + OUStringToOString(rException.Message, RTL_TEXTENCODING_ASCII_US).getStr()); + // For some reason we can not create the actual panel. + // Probably because its factory was not properly registered. + // TODO: provide feedback to developer to better pinpoint the + // source of the error. + + return NULL; + } +} + + + + +IMPL_LINK(SidebarController, WindowEventHandler, VclWindowEvent*, pEvent) +{ + if (pEvent != NULL) + { + switch (pEvent->GetId()) + { + case VCLEVENT_WINDOW_GETFOCUS: + case VCLEVENT_WINDOW_LOSEFOCUS: + break; + + case VCLEVENT_WINDOW_SHOW: + case VCLEVENT_WINDOW_RESIZE: + NotifyResize(); + break; + + case VCLEVENT_WINDOW_DATACHANGED: + // Force an update of deck and tab bar to reflect + // changes in theme (high contrast mode). + Theme::HandleDataChange(); + mpParentWindow->Invalidate(); + break; + + case SFX_HINT_DYING: + dispose(); + break; + + default: + break; + } + } + + return sal_True; +} + + + + +void SidebarController::ShowPopupMenu ( + const Rectangle& rButtonBox, + const ::std::vector<TabBar::DeckMenuData>& rDeckSelectionData, + const ::std::vector<TabBar::DeckMenuData>& rDeckShowData) const +{ + ::boost::shared_ptr<PopupMenu> pMenu = CreatePopupMenu(rDeckSelectionData, rDeckShowData); + pMenu->SetSelectHdl(LINK(this, SidebarController, OnMenuItemSelected)); + + // pass toolbox button rect so the menu can stay open on button up + Rectangle aBox (rButtonBox); + aBox.Move(mpTabBar->GetPosPixel().X(), 0); + pMenu->Execute(mpParentWindow, aBox, POPUPMENU_EXECUTE_DOWN); +} + + + + +void SidebarController::ShowDetailMenu (const ::rtl::OUString& rsMenuCommand) const +{ + try + { + util::URL aURL; + aURL.Complete = rsMenuCommand; + + const ::comphelper::ComponentContext aComponentContext (::comphelper::getProcessServiceFactory()); + const Reference<util::XURLTransformer> xParser ( + aComponentContext.createComponent("com.sun.star.util.URLTransformer"), + UNO_QUERY_THROW); + xParser->parseStrict(aURL); + Reference<frame::XDispatchProvider> xProvider (mxFrame, UNO_QUERY_THROW); + Reference<frame::XDispatch> xDispatch (xProvider->queryDispatch(aURL, OUString(), 0)); + if (xDispatch.is()) + xDispatch->dispatch(aURL, Sequence<beans::PropertyValue>()); + } + catch(Exception& rException) + { + OSL_TRACE("caught exception: %s", + OUStringToOString(rException.Message, RTL_TEXTENCODING_ASCII_US).getStr()); + } +} + + + + +::boost::shared_ptr<PopupMenu> SidebarController::CreatePopupMenu ( + const ::std::vector<TabBar::DeckMenuData>& rDeckSelectionData, + const ::std::vector<TabBar::DeckMenuData>& rDeckShowData) const +{ + ::boost::shared_ptr<PopupMenu> pMenu (new PopupMenu()); + FloatingWindow* pMenuWindow = dynamic_cast<FloatingWindow*>(pMenu->GetWindow()); + if (pMenuWindow != NULL) + { + pMenuWindow->SetPopupModeFlags(pMenuWindow->GetPopupModeFlags() | FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE); + } + + SidebarResource aLocalResource; + + // Add one entry for every tool panel element to individually make + // them visible or hide them. + { + sal_Int32 nIndex (MID_FIRST_PANEL); + for(::std::vector<TabBar::DeckMenuData>::const_iterator + iItem(rDeckSelectionData.begin()), + iEnd(rDeckSelectionData.end()); + iItem!=iEnd; + ++iItem) + { + pMenu->InsertItem(nIndex, iItem->get<0>(), MIB_RADIOCHECK); + pMenu->CheckItem(nIndex, iItem->get<2>()); + ++nIndex; + } + } + + pMenu->InsertSeparator(); + + // Add entry for docking or un-docking the tool panel. + if (mpParentWindow->IsFloatingMode()) + pMenu->InsertItem(MID_LOCK_TASK_PANEL, String(SfxResId(STR_SFX_DOCK))); + else + pMenu->InsertItem(MID_UNLOCK_TASK_PANEL, String(SfxResId(STR_SFX_UNDOCK))); + + // Add sub menu for customization (hiding of deck tabs.) + PopupMenu* pCustomizationMenu = new PopupMenu(); + { + sal_Int32 nIndex (MID_FIRST_HIDE); + for(::std::vector<TabBar::DeckMenuData>::const_iterator + iItem(rDeckShowData.begin()), + iEnd(rDeckShowData.end()); + iItem!=iEnd; + ++iItem) + { + pCustomizationMenu->InsertItem(nIndex, iItem->get<0>(), MIB_CHECKABLE); + pCustomizationMenu->CheckItem(nIndex, iItem->get<2>()); + ++nIndex; + } + } + + pCustomizationMenu->InsertSeparator(); + pCustomizationMenu->InsertItem(MID_RESTORE_DEFAULT, String(SfxResId(STRING_RESTORE))); + + pMenu->InsertItem(MID_CUSTOMIZATION, String(SfxResId(STRING_CUSTOMIZATION))); + pMenu->SetPopupMenu(MID_CUSTOMIZATION, pCustomizationMenu); + + pMenu->RemoveDisabledEntries(sal_False, sal_False); + + return pMenu; +} + + + + +IMPL_LINK(SidebarController, OnMenuItemSelected, Menu*, pMenu) +{ + if (pMenu == NULL) + { + OSL_ENSURE(pMenu!=NULL, "sfx2::sidebar::SidebarController::OnMenuItemSelected: illegal menu!"); + return 0; + } + + pMenu->Deactivate(); + const sal_Int32 nIndex (pMenu->GetCurItemId()); + switch (nIndex) + { + case MID_UNLOCK_TASK_PANEL: + mpParentWindow->SetFloatingMode(sal_True); + break; + + case MID_LOCK_TASK_PANEL: + mpParentWindow->SetFloatingMode(sal_False); + break; + + case MID_RESTORE_DEFAULT: + mpTabBar->RestoreHideFlags(); + break; + + default: + { + try + { + if (nIndex >= MID_FIRST_PANEL && nIndex<MID_FIRST_HIDE) + SwitchToDeck(mpTabBar->GetDeckIdForIndex(nIndex - MID_FIRST_PANEL)); + else if (nIndex >=MID_FIRST_HIDE) + mpTabBar->ToggleHideFlag(nIndex-MID_FIRST_HIDE); + } + catch (RuntimeException&) + { + } + } + break; + } + + return 1; +} + + + + +void SidebarController::CloseDeck (void) +{ + if ( ! mbIsDeckClosed) + { + mbIsDeckClosed = true; + if ( ! mpParentWindow->IsFloatingMode()) + mnSavedSidebarWidth = SetChildWindowWidth(TabBar::GetDefaultWidth()); + mpParentWindow->SetStyle(mpParentWindow->GetStyle() & ~WB_SIZEABLE); + + if (mpCurrentDeck) + mpCurrentDeck->Hide(); + + NotifyResize(); + } +} + + + + +void SidebarController::OpenDeck (void) +{ + if (mbIsDeckClosed) + { + mbIsDeckClosed = false; + SetChildWindowWidth(mnSavedSidebarWidth); + + if (mpCurrentDeck) + mpCurrentDeck->Show(); + + NotifyResize(); + } +} + + + + +FocusManager& SidebarController::GetFocusManager (void) +{ + return maFocusManager; +} + + + + +bool SidebarController::CanModifyChildWindowWidth (void) const +{ + SfxSplitWindow* pSplitWindow = dynamic_cast<SfxSplitWindow*>(mpParentWindow->GetParent()); + if (pSplitWindow == NULL) + { + OSL_ASSERT(pSplitWindow!=NULL); + return 0; + } + + sal_uInt16 nRow (0xffff); + sal_uInt16 nColumn (0xffff); + pSplitWindow->GetWindowPos(mpParentWindow, nColumn, nRow); + + sal_uInt16 nRowCount (pSplitWindow->GetWindowCount(nColumn)); + + return nRowCount == 1; +} + + + + +sal_Int32 SidebarController::SetChildWindowWidth (const sal_Int32 nNewWidth) +{ + SfxSplitWindow* pSplitWindow = dynamic_cast<SfxSplitWindow*>(mpParentWindow->GetParent()); + if (pSplitWindow == NULL) + return 0; + + sal_uInt16 nRow (0xffff); + sal_uInt16 nColumn (0xffff); + pSplitWindow->GetWindowPos(mpParentWindow, nColumn, nRow); + const long nColumnWidth (pSplitWindow->GetLineSize(nColumn)); + + Window* pWindow = mpParentWindow; + const Point aWindowPosition (pWindow->GetPosPixel()); + const Size aWindowSize (pWindow->GetSizePixel()); + + pSplitWindow->MoveWindow( + mpParentWindow, + Size(nNewWidth, aWindowSize.Height()), + nColumn, + nRow); + + return static_cast<sal_Int32>(nColumnWidth); +} + + + + +void SidebarController::RestrictWidth (void) +{ + SfxSplitWindow* pSplitWindow = dynamic_cast<SfxSplitWindow*>(mpParentWindow->GetParent()); + if (pSplitWindow != NULL) + { + const sal_uInt16 nId (pSplitWindow->GetItemId(mpParentWindow)); + const sal_uInt16 nSetId (pSplitWindow->GetSet(nId)); + // Minimum width is always that of the tabbar. + const sal_Int32 nMinimumWidth (TabBar::GetDefaultWidth()); + // Maximum width depends on whether the deck is open or closed. + const sal_Int32 nMaximumWidth ( + mbIsDeckClosed + ? TabBar::GetDefaultWidth() + : 400); + pSplitWindow->SetItemSizeRange( + nSetId, + Range(nMinimumWidth, nMaximumWidth)); + if (nMinimumWidth == nMaximumWidth) + pSplitWindow->SetItemSize(nSetId, nMinimumWidth); + } +} + + +} } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/SidebarController.hxx b/sfx2/source/sidebar/SidebarController.hxx new file mode 100644 index 000000000000..8902a73dd883 --- /dev/null +++ b/sfx2/source/sidebar/SidebarController.hxx @@ -0,0 +1,165 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SFX_SIDEBAR_CONTROLLER_HXX +#define SFX_SIDEBAR_CONTROLLER_HXX + +#include "AsynchronousCall.hxx" +#include "Context.hxx" +#include "FocusManager.hxx" +#include "Panel.hxx" +#include "ResourceManager.hxx" +#include "TabBar.hxx" + +#include <vcl/menu.hxx> + +#include <com/sun/star/awt/XWindowPeer.hpp> +#include <com/sun/star/beans/XPropertyChangeListener.hpp> +#include <com/sun/star/ui/XContextChangeEventListener.hpp> +#include <com/sun/star/ui/XUIElement.hpp> +#include <com/sun/star/ui/XSidebar.hpp> + +#include <boost/noncopyable.hpp> +#include <cppuhelper/compbase3.hxx> +#include <cppuhelper/basemutex.hxx> + +namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; + + +namespace +{ + typedef ::cppu::WeakComponentImplHelper3 < + css::ui::XContextChangeEventListener, + css::beans::XPropertyChangeListener, + css::ui::XSidebar + > SidebarControllerInterfaceBase; +} + +namespace sfx2 { namespace sidebar { + +class ContentPanelDescriptor; +class Deck; +class DeckDescriptor; +class SidebarDockingWindow; +class TabBar; +class TabBarConfiguration; + +class SidebarController + : private ::boost::noncopyable, + private ::cppu::BaseMutex, + public SidebarControllerInterfaceBase +{ +public: + SidebarController( + SidebarDockingWindow* pParentWindow, + const cssu::Reference<css::frame::XFrame>& rxFrame); + virtual ~SidebarController (void); + + // ui::XContextChangeEventListener + virtual void SAL_CALL notifyContextChangeEvent (const css::ui::ContextChangeEventObject& rEvent) + throw(cssu::RuntimeException); + + // XEventListener + virtual void SAL_CALL disposing (const css::lang::EventObject& rEventObject) + throw(cssu::RuntimeException); + + // beans::XPropertyChangeListener + virtual void SAL_CALL propertyChange (const css::beans::PropertyChangeEvent& rEvent) + throw(cssu::RuntimeException); + + // ui::XSidebar + virtual void SAL_CALL requestLayout (void) + throw(cssu::RuntimeException); + + void NotifyResize (void); + + void SwitchToDeck ( + const ::rtl::OUString& rsDeckId); + + /** Show only the tab bar, not the deck. + */ + void CloseDeck (void); + + /** Open the deck area and restore the parent window to its old width. + */ + void OpenDeck (void); + + FocusManager& GetFocusManager (void); + +private: + ::boost::scoped_ptr<Deck> mpCurrentDeck; + SidebarDockingWindow* mpParentWindow; + ::boost::scoped_ptr<TabBar> mpTabBar; + cssu::Reference<css::frame::XFrame> mxFrame; + Context maCurrentContext; + ::rtl::OUString msCurrentDeckId; + ::rtl::OUString msCurrentDeckTitle; + AsynchronousCall maPropertyChangeForwarder; + bool mbIsDeckClosed; + /** Before the deck is closed the sidebar width is saved into this variable, + so that it can be restored when the deck is reopended. + */ + sal_Int32 mnSavedSidebarWidth; + FocusManager maFocusManager; + + DECL_LINK(WindowEventHandler, VclWindowEvent*); + void UpdateConfigurations (const Context& rContext); + bool ArePanelSetsEqual ( + const SharedPanelContainer& rCurrentPanels, + const ResourceManager::PanelContextDescriptorContainer& rRequestedPanels); + cssu::Reference<css::ui::XUIElement> CreateUIElement ( + const cssu::Reference<css::awt::XWindowPeer>& rxWindow, + const ::rtl::OUString& rsImplementationURL); + SharedPanel CreatePanel ( + const ::rtl::OUString& rsPanelId, + ::Window* pParentWindow, + const ::rtl::OUString& rsMenuCommand); + void SwitchToDeck ( + const DeckDescriptor& rDeckDescriptor, + const Context& rContext); + void ShowPopupMenu ( + const Rectangle& rButtonBox, + const ::std::vector<TabBar::DeckMenuData>& rDeckSelectionData, + const ::std::vector<TabBar::DeckMenuData>& rDeckShowData) const; + void ShowDetailMenu (const ::rtl::OUString& rsMenuCommand) const; + ::boost::shared_ptr<PopupMenu> CreatePopupMenu ( + const ::std::vector<TabBar::DeckMenuData>& rDeckSelectionData, + const ::std::vector<TabBar::DeckMenuData>& rDeckShowData) const; + DECL_LINK(OnMenuItemSelected, Menu*); + void BroadcastPropertyChange (void); + + /** The close of the deck changes the width of the child window. + That is only possible if there is no other docking window docked above or below the sidebar. + Return whether the width of the child window can be modified. + */ + bool CanModifyChildWindowWidth (void) const; + + /** Set the child window container to a new width. + Return the old width. + */ + sal_Int32 SetChildWindowWidth (const sal_Int32 nNewWidth); + + void RestrictWidth (void); + + virtual void SAL_CALL disposing (void); +}; + + +} } // end of namespace sfx2::sidebar + +#endif diff --git a/sfx2/source/sidebar/SidebarDockingWindow.cxx b/sfx2/source/sidebar/SidebarDockingWindow.cxx new file mode 100644 index 000000000000..ccfdbaaa3705 --- /dev/null +++ b/sfx2/source/sidebar/SidebarDockingWindow.cxx @@ -0,0 +1,130 @@ +/* + * 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 "SidebarDockingWindow.hxx" +#include "sfx2/sidebar/SidebarChildWindow.hxx" +#include "SidebarController.hxx" + +#include "sfx2/bindings.hxx" +#include "sfx2/dispatch.hxx" +#include <tools/link.hxx> + +using namespace css; +using namespace cssu; + + +namespace sfx2 { namespace sidebar { + + +SidebarDockingWindow::SidebarDockingWindow( + SfxBindings* pSfxBindings, + SidebarChildWindow& rChildWindow, + Window* pParent, + WinBits nBits) + : SfxDockingWindow(pSfxBindings, &rChildWindow, pParent, nBits), + mpSidebarController() +{ + // Get the XFrame from the bindings. + if (pSfxBindings==NULL || pSfxBindings->GetDispatcher()==NULL) + { + OSL_ASSERT(pSfxBindings!=NULL); + OSL_ASSERT(pSfxBindings->GetDispatcher()!=NULL); + } + else + { + const SfxViewFrame* pViewFrame = pSfxBindings->GetDispatcher()->GetFrame(); + const SfxFrame& rFrame = pViewFrame->GetFrame(); + mpSidebarController.set(new sfx2::sidebar::SidebarController(this, rFrame.GetFrameInterface())); + } +} + + + + +SidebarDockingWindow::~SidebarDockingWindow (void) +{ + DoDispose(); +} + + + + +void SidebarDockingWindow::DoDispose (void) +{ +} + + + + +void SidebarDockingWindow::GetFocus() +{ + mpSidebarController->GetFocusManager().GrabFocus(); +} + + + + +long SidebarDockingWindow::PreNotify (NotifyEvent& rEvent) +{ + switch (rEvent.GetType()) + { + case EVENT_KEYINPUT: + { + const KeyEvent* pKeyEvent = rEvent.GetKeyEvent(); + if (pKeyEvent != NULL) + return mpSidebarController->GetFocusManager().NotifyDockingWindowEvent(*pKeyEvent); + else + break; + } + + case EVENT_GETFOCUS: + OSL_TRACE(""); + break; + + } + + return SfxDockingWindow::PreNotify(rEvent); +} + + + + +SfxChildWindow* SidebarDockingWindow::GetChildWindow (void) +{ + return GetChildWindow_Impl(); +} + + + + +sal_Bool SidebarDockingWindow::Close (void) +{ + if (mpSidebarController.is()) + { + // Do not close the floating window. + // Dock it and close just the deck instead. + mpSidebarController->CloseDeck(); + SetFloatingMode(sal_False); + mpSidebarController->NotifyResize(); + return sal_False; + } + else + return SfxDockingWindow::Close(); +} + + +} } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/SidebarDockingWindow.hxx b/sfx2/source/sidebar/SidebarDockingWindow.hxx new file mode 100644 index 000000000000..700ffde16e94 --- /dev/null +++ b/sfx2/source/sidebar/SidebarDockingWindow.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 SFX_SIDEBAR_DOCKING_WINDOW_HXX +#define SFX_SIDEBAR_DOCKING_WINDOW_HXX + +#include "sfx2/dockwin.hxx" +#include "sfx2/dockwin.hxx" +#include "Sidebar.hxx" + +#include <rtl/ref.hxx> + +namespace sfx2 { namespace sidebar { + +class SidebarChildWindow; + +class SidebarController; + +class SidebarDockingWindow + : public SfxDockingWindow +{ +public: + SidebarDockingWindow( + SfxBindings* pBindings, + SidebarChildWindow& rChildWindow, + Window* pParent, + WinBits nBits); + virtual ~SidebarDockingWindow (void); + + virtual sal_Bool Close (void); + + SfxChildWindow* GetChildWindow (void); + +protected: + // Window overridables + virtual void GetFocus (void); + virtual long PreNotify (NotifyEvent& rEvent); + +private: + ::rtl::Reference<sfx2::sidebar::SidebarController> mpSidebarController; + + void DoDispose (void); +}; + + +} } // end of namespace sfx2::sidebar + + +#endif diff --git a/sfx2/source/sidebar/SidebarPanel.cxx b/sfx2/source/sidebar/SidebarPanel.cxx new file mode 100644 index 000000000000..33c3ef6ff7cf --- /dev/null +++ b/sfx2/source/sidebar/SidebarPanel.cxx @@ -0,0 +1,171 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "precompiled_sfx2.hxx" + +#include "SidebarPanel.hxx" + +#include "Panel.hxx" +#include "sfx2/sidebar/Theme.hxx" + +#include <vos/mutex.hxx> +#include <vcl/svapp.hxx> +#include <svl/smplhint.hxx> +#include <comphelper/componentcontext.hxx> +#include <comphelper/processfactory.hxx> +#include <com/sun/star/awt/XWindowPeer.hpp> + + +using namespace css; +using namespace cssu; + +namespace sfx2 { namespace sidebar { + +Reference<css::ui::XSidebarPanel> SidebarPanel::Create (Panel* pPanel) +{ + return Reference<css::ui::XSidebarPanel>(new SidebarPanel(pPanel)); +} + + + + +SidebarPanel::SidebarPanel(Panel* pPanel) + : SidebarPanelInterfaceBase(m_aMutex), + mpPanel(pPanel), + mxCanvas() +{ + if (mpPanel != NULL) + mpPanel->AddEventListener(LINK(this, SidebarPanel, HandleWindowEvent)); + else + { + mpPanel = NULL; + dispose(); + } +} + + + + +SidebarPanel::~SidebarPanel (void) +{ +} + + + + +void SAL_CALL SidebarPanel::disposing (const css::lang::EventObject& rEventObject) + throw(cssu::RuntimeException) +{ + (void)rEventObject; +} + + + + +void SAL_CALL SidebarPanel::disposing (void) +{ + if (mpPanel != NULL) + { + mpPanel->RemoveEventListener(LINK(this, SidebarPanel, HandleWindowEvent)); + mpPanel = NULL; + } +} + + + + +cssu::Reference<css::rendering::XCanvas> SAL_CALL SidebarPanel::getCanvas (void) + throw (cssu::RuntimeException) +{ + if ( ! mxCanvas.is()) + { + Sequence<Any> aArg (5); + + // common: first any is VCL pointer to window (for VCL canvas) + aArg[0] = makeAny(reinterpret_cast<sal_Int64>(mpPanel)); + aArg[1] = Any(); + aArg[2] = makeAny(::com::sun::star::awt::Rectangle()); + aArg[3] = makeAny(sal_False); + aArg[4] = makeAny(mpPanel->GetComponentInterface()); + + const ::comphelper::ComponentContext aComponentContext (::comphelper::getProcessServiceFactory()); + mxCanvas = Reference<rendering::XCanvas>( + aComponentContext.createComponentWithArguments( + "com.sun.star.rendering.VCLCanvas", + aArg), + UNO_QUERY); + } + + return mxCanvas; + +} + + + + +awt::Point SAL_CALL SidebarPanel::getPositionOnScreen (void) + throw (cssu::RuntimeException) +{ + awt::Point aAwtPoint; + + if (mpPanel != NULL) + { + ::vos::OGuard aGuard (Application::GetSolarMutex()); + + // mpPanel->GetPosPixel() + const Point aLocationOnScreen (mpPanel->OutputToAbsoluteScreenPixel(Point(0,0))); + + aAwtPoint.X = aLocationOnScreen.X(); + aAwtPoint.Y = aLocationOnScreen.Y(); + } + + return aAwtPoint; +} + + + + +Reference<beans::XPropertySet> SAL_CALL SidebarPanel::getThemeProperties (void) + throw (RuntimeException) +{ + return Theme::GetPropertySet(); +} + + + + +IMPL_LINK(SidebarPanel, HandleWindowEvent, VclWindowEvent*, pEvent) +{ + if (pEvent != NULL) + { + switch (pEvent->GetId()) + { + case SFX_HINT_DYING: + dispose(); + break; + + default: + break; + } + } + + return sal_True; +} + + + +} } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/SidebarPanel.hxx b/sfx2/source/sidebar/SidebarPanel.hxx new file mode 100644 index 000000000000..99a8e8020394 --- /dev/null +++ b/sfx2/source/sidebar/SidebarPanel.hxx @@ -0,0 +1,74 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SFX_SIDEBAR_SIDEBAR_PANEL_HXX +#define SFX_SIDEBAR_SIDEBAR_PANEL_HXX + +#include <tools/link.hxx> +#include <com/sun/star/ui/XSidebarPanel.hpp> + +#include <boost/noncopyable.hpp> +#include <cppuhelper/compbase1.hxx> +#include <cppuhelper/basemutex.hxx> + +namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; + +namespace +{ + typedef ::cppu::WeakComponentImplHelper1 < + css::ui::XSidebarPanel + > SidebarPanelInterfaceBase; +} + + +class DockingWindow; +class VclWindowEvent; + +namespace sfx2 { namespace sidebar { + +class Panel; + +class SidebarPanel + : private ::boost::noncopyable, + private ::cppu::BaseMutex, + public SidebarPanelInterfaceBase +{ +public: + static cssu::Reference<css::ui::XSidebarPanel> Create (Panel* pPanel); + +protected: + SidebarPanel( + Panel* pPanel); + virtual ~SidebarPanel (void); + + virtual void SAL_CALL disposing (const css::lang::EventObject& rEventObject) + throw(cssu::RuntimeException); + + virtual void SAL_CALL disposing (void); + +private: + Panel* mpPanel; + cssu::Reference<css::rendering::XCanvas> mxCanvas; + + DECL_LINK(HandleWindowEvent, VclWindowEvent*); +}; + + +} } // end of namespace sfx2::sidebar + +#endif diff --git a/sfx2/source/sidebar/SidebarPanelBase.cxx b/sfx2/source/sidebar/SidebarPanelBase.cxx new file mode 100644 index 000000000000..6a17fb70dfcf --- /dev/null +++ b/sfx2/source/sidebar/SidebarPanelBase.cxx @@ -0,0 +1,251 @@ +/* + * 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/SidebarPanelBase.hxx" +#include "sfx2/sidebar/Theme.hxx" +#include "sfx2/sidebar/ILayoutableWindow.hxx" +#include "sfx2/sidebar/IContextChangeReceiver.hxx" +#include "sfx2/imagemgr.hxx" +#include <vcl/ctrl.hxx> +#include <comphelper/processfactory.hxx> + +#include <com/sun/star/ui/ContextChangeEventMultiplexer.hpp> +#include <com/sun/star/ui/UIElementType.hpp> + +using namespace css; +using namespace cssu; + + +namespace sfx2 { namespace sidebar { + +Reference<ui::XUIElement> SidebarPanelBase::Create ( + const ::rtl::OUString& rsResourceURL, + const cssu::Reference<css::frame::XFrame>& rxFrame, + Window* pWindow, + const css::ui::LayoutSize& rLayoutSize) +{ + Reference<ui::XUIElement> xUIElement ( + new SidebarPanelBase( + rsResourceURL, + rxFrame, + pWindow, + rLayoutSize)); + return xUIElement; +} + + + + +SidebarPanelBase::SidebarPanelBase ( + const ::rtl::OUString& rsResourceURL, + const cssu::Reference<css::frame::XFrame>& rxFrame, + Window* pWindow, + const css::ui::LayoutSize& rLayoutSize) + : SidebarPanelBaseInterfaceBase(m_aMutex), + mxFrame(rxFrame), + mpControl(pWindow), + msResourceURL(rsResourceURL), + maLayoutSize(rLayoutSize) +{ + if (mxFrame.is()) + { + cssu::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer ( + css::ui::ContextChangeEventMultiplexer::get( + ::comphelper::getProcessComponentContext())); + if (xMultiplexer.is()) + xMultiplexer->addContextChangeEventListener(this, mxFrame->getController()); + } + if (mpControl != NULL) + { + mpControl->SetBackground(Theme::GetWallpaper(Theme::Paint_PanelBackground)); + mpControl->Show(); + } +} + + + + +SidebarPanelBase::~SidebarPanelBase (void) +{ +} + + + + +void SAL_CALL SidebarPanelBase::disposing (void) + throw (cssu::RuntimeException) +{ + if (mpControl != NULL) + { + delete mpControl; + mpControl = NULL; + } + + if (mxFrame.is()) + { + cssu::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer ( + css::ui::ContextChangeEventMultiplexer::get( + ::comphelper::getProcessComponentContext())); + if (xMultiplexer.is()) + xMultiplexer->removeAllContextChangeEventListeners(this); + mxFrame = NULL; + } +} + + + + +void SidebarPanelBase::SetControl (::Window* pControl) +{ + mpControl = pControl; +} + + + + +::Window* SidebarPanelBase::GetControl (void) const +{ + return mpControl; +} + + + + +// XContextChangeEventListener +void SAL_CALL SidebarPanelBase::notifyContextChangeEvent ( + const ui::ContextChangeEventObject& rEvent) + throw (cssu::RuntimeException) +{ + IContextChangeReceiver* pContextChangeReceiver + = dynamic_cast<IContextChangeReceiver*>(mpControl); + if (pContextChangeReceiver != NULL) + { + const EnumContext aContext( + EnumContext::GetApplicationEnum(rEvent.ApplicationName), + EnumContext::GetContextEnum(rEvent.ContextName)); + pContextChangeReceiver->HandleContextChange(aContext); + } +} + + + + +void SAL_CALL SidebarPanelBase::disposing ( + const css::lang::EventObject& rEvent) + throw (cssu::RuntimeException) +{ + (void)rEvent; + + mxFrame = NULL; + mpControl = NULL; +} + + + + +cssu::Reference<css::frame::XFrame> SAL_CALL SidebarPanelBase::getFrame (void) + throw(cssu::RuntimeException) +{ + return mxFrame; +} + + + + +::rtl::OUString SAL_CALL SidebarPanelBase::getResourceURL (void) + throw(cssu::RuntimeException) +{ + return msResourceURL; +} + + + + +sal_Int16 SAL_CALL SidebarPanelBase::getType (void) + throw(cssu::RuntimeException) +{ + return ui::UIElementType::TOOLPANEL; +} + + + + +Reference<XInterface> SAL_CALL SidebarPanelBase::getRealInterface (void) + throw(cssu::RuntimeException) +{ + return Reference<XInterface>(static_cast<XWeak*>(this)); +} + + + + +Reference<accessibility::XAccessible> SAL_CALL SidebarPanelBase::createAccessible ( + const Reference<accessibility::XAccessible>& rxParentAccessible) + throw(cssu::RuntimeException) +{ + (void)rxParentAccessible; + + // Not yet implemented. + return NULL; +} + + + + +Reference<awt::XWindow> SAL_CALL SidebarPanelBase::getWindow (void) + throw(cssu::RuntimeException) +{ + if (mpControl != NULL) + return Reference<awt::XWindow>( + mpControl->GetComponentInterface(), + UNO_QUERY); + else + return NULL; +} + + + + +ui::LayoutSize SAL_CALL SidebarPanelBase::getHeightForWidth (const sal_Int32 nWidth) + throw(cssu::RuntimeException) +{ + if (maLayoutSize.Minimum >= 0) + return maLayoutSize; + else + { + ILayoutableWindow* pLayoutableWindow = dynamic_cast<ILayoutableWindow*>(mpControl); + if (pLayoutableWindow != NULL) + return pLayoutableWindow->GetHeightForWidth(nWidth); + else if (mpControl != NULL) + { + const sal_Int32 nHeight (mpControl->GetSizePixel().Height()); + return ui::LayoutSize(nHeight,nHeight,nHeight); + } + } + + return ui::LayoutSize(0,0,0); +} + +IContextChangeReceiver::~IContextChangeReceiver() +{ +} + +ILayoutableWindow::~ILayoutableWindow() +{ +} + +} } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/SidebarResource.hxx b/sfx2/source/sidebar/SidebarResource.hxx new file mode 100644 index 000000000000..be1371ba7ff7 --- /dev/null +++ b/sfx2/source/sidebar/SidebarResource.hxx @@ -0,0 +1,35 @@ +/* + * 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 SFX_SIDEBAR_RESOURCE_HXX +#define SFX_SIDEBAR_RESOURCE_HXX + + +#include "Sidebar.hrc" +#include <sfx2/sfxresid.hxx> +#include <tools/rc.hxx> + + +class SidebarResource : public Resource +{ +public: + SidebarResource (void) : Resource(SfxResId(RID_SIDEBAR_RESOURCE)){} + ~SidebarResource (void) { FreeResource(); } +}; + + +#endif diff --git a/sfx2/source/sidebar/SidebarToolBox.cxx b/sfx2/source/sidebar/SidebarToolBox.cxx new file mode 100644 index 000000000000..6a404dfec2c6 --- /dev/null +++ b/sfx2/source/sidebar/SidebarToolBox.cxx @@ -0,0 +1,153 @@ +/* + * 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 "SidebarToolBox.hxx" +#include "ToolBoxBackground.hxx" +#include "sfx2/sidebar/Theme.hxx" +#include "Tools.hxx" + +#include <vcl/gradient.hxx> + + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; + + +namespace sfx2 { namespace sidebar { + + +SidebarToolBox::SidebarToolBox ( + Window* pParentWindow, + const ResId& rResId) + : ToolBox(pParentWindow, rResId), + mbParentIsBorder(false), + maItemSeparator(Theme::GetImage(Theme::Image_ToolBoxItemSeparator)) +{ + SetBackground(Wallpaper()); + SetPaintTransparent(true); +#ifdef DEBUG + SetText(A2S("SidebarToolBox")); +#endif +} + + + + +SidebarToolBox::~SidebarToolBox (void) +{ +} + + + + +void SidebarToolBox::SetBorderWindow (const Window* pBorderWindow) +{ + if (pBorderWindow != GetParent()) + { + OSL_ASSERT("SetBorderWindow can only handle parent as border window"); + return; + } + + if ( ! mbParentIsBorder) + { + mbParentIsBorder = true; + + setPosSizePixel ( + GetPosPixel().X(), + GetPosPixel().Y(), + GetSizePixel().Width(), + GetSizePixel().Height(), + WINDOW_POSSIZE_ALL); + } +} + + + + +void SidebarToolBox::Paint (const Rectangle& rRect) +{ + ToolBox::Paint(rRect); + + if (Theme::GetBoolean(Theme::Bool_UseToolBoxItemSeparator)) + { + const sal_Int32 nSeparatorY ((GetSizePixel().Height() - maItemSeparator.GetSizePixel().Height())/2); + const sal_uInt16 nItemCount (GetItemCount()); + int nLastRight (-1); + for (sal_uInt16 nIndex=0; nIndex<nItemCount; ++nIndex) + { + const Rectangle aItemBoundingBox (GetItemPosRect(nIndex)); + if (nLastRight >= 0) + { + const int nSeparatorX ((nLastRight + aItemBoundingBox.Left() - 1) / 2); + DrawImage(Point(nSeparatorX,nSeparatorY), maItemSeparator); + } + + nLastRight = aItemBoundingBox.Right(); + } + } +} + + + + +Point SidebarToolBox::GetPosPixel (void) const +{ + if (mbParentIsBorder) + { + const Point aParentPoint (GetParent()->GetPosPixel()); + const Point aChildPoint (ToolBox::GetPosPixel()); + return Point( + aParentPoint.X() + aChildPoint.X(), + aParentPoint.Y() + aChildPoint.Y()); + } + else + return ToolBox::GetPosPixel(); +} + + + + +void SidebarToolBox::setPosSizePixel ( + long nX, + long nY, + long nWidth, + long nHeight, + sal_uInt16 nFlags) +{ + if (mbParentIsBorder) + { + const Point aRelativePosition (static_cast<ToolBoxBackground*>(GetParent())->SetToolBoxChild( + this, + nX, + nY, + nWidth, + nHeight, + nFlags)); + ToolBox::setPosSizePixel( + aRelativePosition.X(), + aRelativePosition.Y(), + nWidth, + nHeight, + nFlags); + } + else + ToolBox::setPosSizePixel(nX, nY, nWidth, nHeight, nFlags); +} + + + +} } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/SidebarToolBox.hxx b/sfx2/source/sidebar/SidebarToolBox.hxx new file mode 100644 index 000000000000..125839a8a24d --- /dev/null +++ b/sfx2/source/sidebar/SidebarToolBox.hxx @@ -0,0 +1,52 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SFX_SIDEBAR_TOOLBOX_HXX +#define SFX_SIDEBAR_TOOLBOX_HXX + +#include "vcl/toolbox.hxx" + + +namespace sfx2 { namespace sidebar { + +class SidebarToolBox + : public ToolBox +{ +public: + SidebarToolBox (Window* pParentWindow, const ResId& rResId); + virtual ~SidebarToolBox (void); + + void SetBorderWindow (const Window* pBorderWindow); + virtual void Paint (const Rectangle& rRect); + + virtual Point GetPosPixel (void) const; + virtual void setPosSizePixel ( + long nX, + long nY, + long nWidth, + long nHeight, + sal_uInt16 nFlags); + +private: + bool mbParentIsBorder; + Image maItemSeparator; +}; + + +} } // end of namespace sfx2::sidebar + +#endif diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx new file mode 100644 index 000000000000..c30953bbdd94 --- /dev/null +++ b/sfx2/source/sidebar/TabBar.cxx @@ -0,0 +1,385 @@ +/* + * 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 "TabBar.hxx" +#include "TabItem.hxx" +#include "sidebar/ControlFactory.hxx" +#include "DeckDescriptor.hxx" +#include "Paint.hxx" +#include "sfx2/sidebar/Theme.hxx" +#include "Tools.hxx" +#include "FocusManager.hxx" + +#include <vcl/gradient.hxx> +#include <vcl/image.hxx> +#include <vcl/wrkwin.hxx> +#include <comphelper/processfactory.hxx> +#include <comphelper/componentcontext.hxx> +#include <tools/svborder.hxx> + +#include <com/sun/star/graphic/XGraphicProvider.hpp> + + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; + + + + +namespace sfx2 { namespace sidebar { + +TabBar::TabBar ( + Window* pParentWindow, + const Reference<frame::XFrame>& rxFrame, + const ::boost::function<void(const ::rtl::OUString&)>& rDeckActivationFunctor, + const PopupMenuProvider& rPopupMenuProvider) + : Window(pParentWindow, WB_DIALOGCONTROL), + mxFrame(rxFrame), + mpMenuButton(ControlFactory::CreateMenuButton(this)), + maItems(), + maDeckActivationFunctor(rDeckActivationFunctor), + maPopupMenuProvider(rPopupMenuProvider) +{ + SetBackground(Theme::GetPaint(Theme::Paint_TabBarBackground).GetWallpaper()); + + mpMenuButton->SetModeImage(Theme::GetImage(Theme::Image_TabBarMenu)); + mpMenuButton->SetClickHdl(LINK(this, TabBar, OnToolboxClicked)); + Layout(); + +#ifdef DEBUG + SetText(A2S("TabBar")); +#endif +} + + + + +TabBar::~TabBar (void) +{ +} + + + + +void TabBar::Paint (const Rectangle& rUpdateArea) +{ + Window::Paint(rUpdateArea); + + const sal_Int32 nHorizontalPadding (Theme::GetInteger(Theme::Int_TabMenuSeparatorPadding)); + SetLineColor(Theme::GetColor(Theme::Color_TabMenuSeparator)); + DrawLine( + Point(nHorizontalPadding, mnMenuSeparatorY), + Point(GetSizePixel().Width()-nHorizontalPadding, mnMenuSeparatorY)); +} + + + + +sal_Int32 TabBar::GetDefaultWidth (void) +{ + return Theme::GetInteger(Theme::Int_TabItemWidth) + + Theme::GetInteger(Theme::Int_TabBarLeftPadding) + + Theme::GetInteger(Theme::Int_TabBarRightPadding); +} + + + + +void TabBar::SetDecks ( + const ResourceManager::IdContainer& rDeckIds) +{ + // Remove the current buttons. + { + for(ItemContainer::iterator + iItem(maItems.begin()), iEnd(maItems.end()); + iItem!=iEnd; + ++iItem) + { + iItem->mpButton.reset(); + } + maItems.clear(); + } + + maItems.resize(rDeckIds.size()); + sal_Int32 nIndex (0); + for (ResourceManager::IdContainer::const_iterator + iDeckId(rDeckIds.begin()), + iEnd(rDeckIds.end()); + iDeckId!=iEnd; + ++iDeckId) + { + const DeckDescriptor* pDescriptor = ResourceManager::Instance().GetDeckDescriptor(*iDeckId); + if (pDescriptor == NULL) + { + OSL_ASSERT(pDescriptor!=NULL); + continue; + } + + Item& rItem (maItems[nIndex++]); + rItem.msDeckId = pDescriptor->msId; + rItem.mpButton.reset(CreateTabItem(*pDescriptor)); + rItem.mpButton->SetClickHdl(LINK(&rItem, TabBar::Item, HandleClick)); + rItem.maDeckActivationFunctor = maDeckActivationFunctor; + rItem.mbIsHiddenByDefault = false; + rItem.mbIsHidden = ! pDescriptor->mbIsEnabled; + } + + UpdateButtonIcons(); + Layout(); +} + + + + +void TabBar::UpdateButtonIcons (void) +{ + mpMenuButton->SetModeImage(Theme::GetImage(Theme::Image_TabBarMenu)); + + for(ItemContainer::const_iterator + iItem(maItems.begin()), iEnd(maItems.end()); + iItem!=iEnd; + ++iItem) + { + const DeckDescriptor* pDeckDescriptor = ResourceManager::Instance().GetDeckDescriptor(iItem->msDeckId); + if (pDeckDescriptor != NULL) + iItem->mpButton->SetModeImage(GetItemImage(*pDeckDescriptor)); + } + + Invalidate(); +} + + + + +void TabBar::Layout (void) +{ + const SvBorder aPadding ( + Theme::GetInteger(Theme::Int_TabBarLeftPadding), + Theme::GetInteger(Theme::Int_TabBarTopPadding), + Theme::GetInteger(Theme::Int_TabBarRightPadding), + Theme::GetInteger(Theme::Int_TabBarBottomPadding)); + sal_Int32 nX (aPadding.Top()); + sal_Int32 nY (aPadding.Left()); + const Size aTabItemSize ( + Theme::GetInteger(Theme::Int_TabItemWidth), + Theme::GetInteger(Theme::Int_TabItemHeight)); + + // Place the menu button and the separator. + if (mpMenuButton != NULL) + { + mpMenuButton->SetPosSizePixel( + Point(nX,nY), + aTabItemSize); + mpMenuButton->Show(); + nY += mpMenuButton->GetSizePixel().Height() + 1 + Theme::GetInteger(Theme::Int_TabMenuPadding); + mnMenuSeparatorY = nY - Theme::GetInteger(Theme::Int_TabMenuPadding)/2 - 1; + } + + // Place the deck selection buttons. + for(ItemContainer::const_iterator + iItem(maItems.begin()), iEnd(maItems.end()); + iItem!=iEnd; + ++iItem) + { + Button& rButton (*iItem->mpButton); + rButton.Show( ! iItem->mbIsHidden); + + if (iItem->mbIsHidden) + continue; + + // Place and size the icon. + rButton.SetPosSizePixel( + Point(nX,nY), + aTabItemSize); + rButton.Show(); + + nY += rButton.GetSizePixel().Height() + 1 + aPadding.Bottom(); + } + Invalidate(); +} + + + + +void TabBar::HighlightDeck (const ::rtl::OUString& rsDeckId) +{ + for (ItemContainer::const_iterator iItem(maItems.begin()),iEnd(maItems.end()); + iItem!=iEnd; + ++iItem) + { + if (iItem->msDeckId.equals(rsDeckId)) + { + iItem->mpButton->Check(); + break; + } + } +} + + + + +void TabBar::DataChanged (const DataChangedEvent& rDataChangedEvent) +{ + SetBackground(Theme::GetPaint(Theme::Paint_TabBarBackground).GetWallpaper()); + UpdateButtonIcons(); + + Window::DataChanged(rDataChangedEvent); +} + + + + +RadioButton* TabBar::CreateTabItem (const DeckDescriptor& rDeckDescriptor) +{ + RadioButton* pItem = ControlFactory::CreateTabItem(this); + pItem->SetHelpText(rDeckDescriptor.msHelpText); + pItem->SetQuickHelpText(rDeckDescriptor.msHelpText); + + return pItem; +} + + + +Image TabBar::GetItemImage (const DeckDescriptor& rDeckDescriptor) const +{ + return Tools::GetImage( + rDeckDescriptor.msIconURL, + rDeckDescriptor.msHighContrastIconURL, + mxFrame); +} + + + + + +IMPL_LINK(TabBar::Item, HandleClick, Button*, EMPTYARG) +{ + maDeckActivationFunctor(msDeckId); + return 1; +} + + + + +const ::rtl::OUString TabBar::GetDeckIdForIndex (const sal_Int32 nIndex) const +{ + if (nIndex<0 || static_cast<size_t>(nIndex)>=maItems.size()) + throw RuntimeException(); + else + return maItems[nIndex].msDeckId; +} + + + + +void TabBar::ToggleHideFlag (const sal_Int32 nIndex) +{ + if (nIndex<0 || static_cast<size_t>(nIndex)>=maItems.size()) + throw RuntimeException(); + else + { + maItems[nIndex].mbIsHidden = ! maItems[nIndex].mbIsHidden; + ResourceManager::Instance().SetIsDeckEnabled( + maItems[nIndex].msDeckId, + maItems[nIndex].mbIsHidden); + Layout(); + } +} + + + + +void TabBar::RestoreHideFlags (void) +{ + bool bNeedsLayout (false); + for(ItemContainer::iterator iItem(maItems.begin()),iEnd(maItems.end()); + iItem!=iEnd; + ++iItem) + { + if (iItem->mbIsHidden != iItem->mbIsHiddenByDefault) + { + iItem->mbIsHidden = iItem->mbIsHiddenByDefault; + bNeedsLayout = true; + } + } + if (bNeedsLayout) + Layout(); +} + + + + +void TabBar::UpdateFocusManager (FocusManager& rFocusManager) +{ + ::std::vector<Button*> aButtons; + aButtons.reserve(maItems.size()+1); + + aButtons.push_back(mpMenuButton.get()); + for(ItemContainer::const_iterator + iItem(maItems.begin()), iEnd(maItems.end()); + iItem!=iEnd; + ++iItem) + { + aButtons.push_back(iItem->mpButton.get()); + } + rFocusManager.SetButtons(aButtons); +} + + + + +IMPL_LINK(TabBar, OnToolboxClicked, void*, EMPTYARG) +{ + ::std::vector<DeckMenuData> aSelectionData; + ::std::vector<DeckMenuData> aShowData; + + for(ItemContainer::const_iterator iItem(maItems.begin()),iEnd(maItems.end()); + iItem!=iEnd; + ++iItem) + { + const DeckDescriptor* pDeckDescriptor = ResourceManager::Instance().GetDeckDescriptor(iItem->msDeckId); + if (pDeckDescriptor != NULL) + { + if ( ! iItem->mbIsHidden) + aSelectionData.push_back( + DeckMenuData( + pDeckDescriptor->msTitle, + pDeckDescriptor->msId, + iItem->mpButton->IsChecked())); + + aShowData.push_back( + DeckMenuData( + pDeckDescriptor->msTitle, + pDeckDescriptor->msId, + !iItem->mbIsHidden)); + } + } + + maPopupMenuProvider( + Rectangle( + mpMenuButton->GetPosPixel(), + mpMenuButton->GetSizePixel()), + aSelectionData, + aShowData); + + return 0; +} + + + +} } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/TabBar.hxx b/sfx2/source/sidebar/TabBar.hxx new file mode 100644 index 000000000000..50ea6f3537d0 --- /dev/null +++ b/sfx2/source/sidebar/TabBar.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 SFX_SIDEBAR_TAB_BAR_HXX +#define SFX_SIDEBAR_TAB_BAR_HXX + +#include "DeckDescriptor.hxx" +#include "ResourceManager.hxx" + +#include <vcl/menu.hxx> +#include <vcl/window.hxx> + +#include <com/sun/star/frame/XFrame.hpp> +#include <boost/function.hpp> +#include <boost/tuple/tuple.hpp> +#include <boost/scoped_ptr.hpp> + +class Button; +class RadioButton; + +namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; + + +namespace sfx2 { namespace sidebar { + +class FocusManager; +class TabBarConfiguration; +class TabItem; + +/** The tab bar is the container for the individual tabs. +*/ +class TabBar + : public Window +{ +public: + /** DeckMenuData has entries for display name, deck id, and a flag: + - isCurrentDeck for the deck selection data + - isEnabled for the show/hide menu + */ + typedef ::boost::tuple<rtl::OUString,rtl::OUString,bool> DeckMenuData; + typedef ::boost::function<void( + const Rectangle&, + const ::std::vector<DeckMenuData>& rDeckSelectionData, + const ::std::vector<DeckMenuData>& rDeckShowData)> PopupMenuProvider; + TabBar ( + Window* pParentWindow, + const cssu::Reference<css::frame::XFrame>& rxFrame, + const ::boost::function<void(const ::rtl::OUString&rsDeckId)>& rDeckActivationFunctor, + const PopupMenuProvider& rPopupMenuProvider); + virtual ~TabBar (void); + + virtual void Paint (const Rectangle& rUpdateArea); + virtual void DataChanged (const DataChangedEvent& rDataChangedEvent); + + static sal_Int32 GetDefaultWidth (void); + + void SetDecks ( + const ResourceManager::IdContainer& rDeckIds); + void HighlightDeck (const ::rtl::OUString& rsDeckId); + void AddPopupMenuEntries ( + PopupMenu& rMenu, + const sal_Int32 nFirstIndex); + void AddCustomizationMenuEntries ( + PopupMenu& rMenu, + const sal_Int32 nFirstIndex); + const ::rtl::OUString GetDeckIdForIndex (const sal_Int32 nIndex) const; + void ToggleHideFlag (const sal_Int32 nIndex); + void RestoreHideFlags (void); + + void UpdateFocusManager (FocusManager& rFocusManager); + +private: + cssu::Reference<css::frame::XFrame> mxFrame; + ::boost::scoped_ptr<Button> mpMenuButton; + class Item + { + public: + DECL_LINK(HandleClick, Button*); + ::boost::shared_ptr<RadioButton> mpButton; + ::rtl::OUString msDeckId; + ::boost::function<void(const ::rtl::OUString&rsDeckId)> maDeckActivationFunctor; + bool mbIsHidden; + bool mbIsHiddenByDefault; + }; + typedef ::std::vector<Item> ItemContainer; + ItemContainer maItems; + const ::boost::function<void(const ::rtl::OUString&rsDeckId)> maDeckActivationFunctor; + sal_Int32 mnMenuSeparatorY; + PopupMenuProvider maPopupMenuProvider; + + RadioButton* CreateTabItem (const DeckDescriptor& rDeckDescriptor); + Image GetItemImage (const DeckDescriptor& rDeskDescriptor) const; + void Layout (void); + void UpdateButtonIcons (void); + + ::boost::shared_ptr<PopupMenu> CreatePopupMenu (void) const; + void ShowPopupMenu (void) const; + DECL_LINK(OnToolboxClicked, void*); + +}; + + +} } // end of namespace sfx2::sidebar + +#endif diff --git a/sfx2/source/sidebar/TabItem.cxx b/sfx2/source/sidebar/TabItem.cxx new file mode 100644 index 000000000000..059fabdf6d7b --- /dev/null +++ b/sfx2/source/sidebar/TabItem.cxx @@ -0,0 +1,143 @@ +/* + * 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 "TabItem.hxx" + +#include "DrawHelper.hxx" +#include "Paint.hxx" +#include "Tools.hxx" + +#include "sfx2/sidebar/Theme.hxx" + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; + + +namespace sfx2 { namespace sidebar { + + +TabItem::TabItem (Window* pParentWindow) + : ImageRadioButton(pParentWindow), + mbIsLeftButtonDown(false), + mePaintType(PT_Theme) +{ + SetStyle(GetStyle() | WB_TABSTOP | WB_DIALOGCONTROL | WB_NOPOINTERFOCUS); + SetBackground(Theme::GetPaint(Theme::Paint_TabBarBackground).GetWallpaper()); +#ifdef DEBUG + SetText(A2S("TabItem")); +#endif +} + + + + +TabItem::~TabItem (void) +{ +} + + + + +void TabItem::Paint (const Rectangle& rUpdateArea) +{ + OSL_TRACE("TabItem::Paint"); + switch(mePaintType) + { + case PT_Theme: + default: + { + const bool bIsSelected (IsChecked()); + const bool bIsHighlighted (IsMouseOver() || HasFocus()); + DrawHelper::DrawRoundedRectangle( + *this, + Rectangle(Point(0,0), GetSizePixel()), + Theme::GetInteger(Theme::Int_ButtonCornerRadius), + bIsHighlighted||bIsSelected + ? Theme::GetColor(Theme::Color_TabItemBorder) + : Color(0xffffffff), + bIsHighlighted + ? Theme::GetPaint(Theme::Paint_TabItemBackgroundHighlight) + : Theme::GetPaint(Theme::Paint_TabItemBackgroundNormal)); + + const Image aIcon(Button::GetModeImage()); + const Size aIconSize (aIcon.GetSizePixel()); + const Point aIconLocation( + (GetSizePixel().Width() - aIconSize.Width())/2, + (GetSizePixel().Height() - aIconSize.Height())/2); + DrawImage( + aIconLocation, + aIcon); + break; + } + case PT_Native: + Button::Paint(rUpdateArea); + // DrawImage(maIconPosition, maIcon); + break; + } +} + + + + +void TabItem::MouseMove (const MouseEvent& rEvent) +{ + if (rEvent.IsEnterWindow() || rEvent.IsLeaveWindow()) + Invalidate(); + ImageRadioButton::MouseMove(rEvent); +} + + + + +void TabItem::MouseButtonDown (const MouseEvent& rMouseEvent) +{ + if (rMouseEvent.IsLeft()) + { + mbIsLeftButtonDown = true; + CaptureMouse(); + Invalidate(); + } +} + + + + +void TabItem::MouseButtonUp (const MouseEvent& rMouseEvent) +{ + if (IsMouseCaptured()) + ReleaseMouse(); + + if (rMouseEvent.IsLeft()) + { + if (mbIsLeftButtonDown) + { + Check(); + Click(); + GetParent()->Invalidate(); + } + } + if (mbIsLeftButtonDown) + { + mbIsLeftButtonDown = false; + Invalidate(); + } +} + + + +} } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/TabItem.hxx b/sfx2/source/sidebar/TabItem.hxx new file mode 100644 index 000000000000..31898b3e8334 --- /dev/null +++ b/sfx2/source/sidebar/TabItem.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 SFX_SIDEBAR_TAB_ITEM_HXX +#define SFX_SIDEBAR_TAB_ITEM_HXX + +#include "vcl/button.hxx" + +#include "DeckDescriptor.hxx" + +class Window; + +namespace sfx2 { namespace sidebar { + +/** A single button in the The tab bar. +*/ +class TabItem + : public ImageRadioButton +{ +public: + TabItem (Window* pParentWindow); + virtual ~TabItem (void); + + virtual void Paint (const Rectangle& rUpdateArea); + virtual void MouseMove (const MouseEvent& rEvent); + virtual void MouseButtonDown (const MouseEvent& rMouseEvent); + virtual void MouseButtonUp (const MouseEvent& rMouseEvent); + +private: + bool mbIsLeftButtonDown; + enum PaintType { + PT_Native, + PT_Theme + } mePaintType; +}; + + +} } // end of namespace sfx2::sidebar + +#endif diff --git a/sfx2/source/sidebar/Theme.cxx b/sfx2/source/sidebar/Theme.cxx new file mode 100644 index 000000000000..d571885ca525 --- /dev/null +++ b/sfx2/source/sidebar/Theme.cxx @@ -0,0 +1,1148 @@ +/* + * 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/Theme.hxx" +#include "Paint.hxx" +#include "SidebarResource.hxx" +#include "Tools.hxx" + +#include <tools/svborder.hxx> +#include <tools/rc.hxx> +#include <vcl/svapp.hxx> + +using namespace css; +using namespace cssu; + + +namespace sfx2 { namespace sidebar { + +::rtl::Reference<Theme> Theme::mpInstance; + + + + +Theme& Theme::GetCurrentTheme (void) +{ + if ( ! mpInstance.is()) + { + mpInstance.set(new Theme()); + mpInstance->InitializeTheme(); + } + return *mpInstance; +} + + + + +Theme::Theme (void) + : ThemeInterfaceBase(m_aMutex), + maImages(), + maColors(), + maPaints(), + maIntegers(), + maBooleans(), + mbIsHighContrastMode(Application::GetSettings().GetStyleSettings().GetHighContrastMode()), + mbIsHighContrastModeSetManually(false), + maPropertyNameToIdMap(), + maPropertyIdToNameMap(), + maRawValues(), + maChangeListeners(), + maVetoableListeners() + +{ + SetupPropertyMaps(); +} + + + + +Theme::~Theme (void) +{ +} + + + + +Image Theme::GetImage (const ThemeItem eItem) +{ + const PropertyType eType (GetPropertyType(eItem)); + OSL_ASSERT(eType==PT_Image); + const sal_Int32 nIndex (GetIndex(eItem, eType)); + const Theme& rTheme (GetCurrentTheme()); + return rTheme.maImages[nIndex]; +} + + + + +Color Theme::GetColor (const ThemeItem eItem) +{ + const PropertyType eType (GetPropertyType(eItem)); + OSL_ASSERT(eType==PT_Color || eType==PT_Paint); + const sal_Int32 nIndex (GetIndex(eItem, eType)); + const Theme& rTheme (GetCurrentTheme()); + if (eType == PT_Color) + return rTheme.maColors[nIndex]; + else if (eType == PT_Paint) + return rTheme.maPaints[nIndex].GetColor(); + else + return COL_WHITE; +} + + + + +const Paint& Theme::GetPaint (const ThemeItem eItem) +{ + const PropertyType eType (GetPropertyType(eItem)); + OSL_ASSERT(eType==PT_Paint); + const sal_Int32 nIndex (GetIndex(eItem, eType)); + const Theme& rTheme (GetCurrentTheme()); + return rTheme.maPaints[nIndex]; +} + + + + +const Wallpaper Theme::GetWallpaper (const ThemeItem eItem) +{ + return GetPaint(eItem).GetWallpaper(); +} + + + + +sal_Int32 Theme::GetInteger (const ThemeItem eItem) +{ + const PropertyType eType (GetPropertyType(eItem)); + OSL_ASSERT(eType==PT_Integer); + const sal_Int32 nIndex (GetIndex(eItem, eType)); + const Theme& rTheme (GetCurrentTheme()); + return rTheme.maIntegers[nIndex]; +} + + + + +bool Theme::GetBoolean (const ThemeItem eItem) +{ + const PropertyType eType (GetPropertyType(eItem)); + OSL_ASSERT(eType==PT_Boolean); + const sal_Int32 nIndex (GetIndex(eItem, eType)); + const Theme& rTheme (GetCurrentTheme()); + return rTheme.maBooleans[nIndex]; +} + + + + +Rectangle Theme::GetRectangle (const ThemeItem eItem) +{ + const PropertyType eType (GetPropertyType(eItem)); + OSL_ASSERT(eType==PT_Rectangle); + const sal_Int32 nIndex (GetIndex(eItem, eType)); + const Theme& rTheme (GetCurrentTheme()); + return rTheme.maRectangles[nIndex]; +} + + + + +bool Theme::IsHighContrastMode (void) +{ + const Theme& rTheme (GetCurrentTheme()); + return rTheme.mbIsHighContrastMode; +} + + + + +void Theme::HandleDataChange (void) +{ + Theme& rTheme (GetCurrentTheme()); + + if ( ! rTheme.mbIsHighContrastModeSetManually) + { + // Do not modify mbIsHighContrastMode when it was manually set. + GetCurrentTheme().mbIsHighContrastMode = Application::GetSettings().GetStyleSettings().GetHighContrastMode(); + rTheme.maRawValues[Bool_IsHighContrastModeActive] = Any(GetCurrentTheme().mbIsHighContrastMode); + } + + GetCurrentTheme().UpdateTheme(); +} + + + + +void Theme::InitializeTheme (void) +{ + setPropertyValue( + maPropertyIdToNameMap[Bool_UseSymphonyIcons], + Any(false)); + setPropertyValue( + maPropertyIdToNameMap[Bool_UseSystemColors], + Any(false)); +} + + + + +void Theme::UpdateTheme (void) +{ + SidebarResource aLocalResource; + + try + { + const StyleSettings& rStyle (Application::GetSettings().GetStyleSettings()); + const bool bUseSystemColors (GetBoolean(Bool_UseSystemColors)); + +#define Alternatives(n,hc,sys) (mbIsHighContrastMode ? hc : (bUseSystemColors ? sys : n)) + + const Color aBaseBackgroundColor (rStyle.GetDialogColor()); + Color aBorderColor (aBaseBackgroundColor); + aBorderColor.DecreaseLuminance(15); + Color aSecondColor (aBaseBackgroundColor); + aSecondColor.DecreaseLuminance(15); + + setPropertyValue( + maPropertyIdToNameMap[Paint_DeckBackground], + Any(sal_Int32(rStyle.GetMenuColor().GetRGBColor()))); + + setPropertyValue( + maPropertyIdToNameMap[Paint_DeckTitleBarBackground], + Any(sal_Int32(aBaseBackgroundColor.GetRGBColor()))); + setPropertyValue( + maPropertyIdToNameMap[Int_DeckLeftPadding], + Any(sal_Int32(2))); + setPropertyValue( + maPropertyIdToNameMap[Int_DeckTopPadding], + Any(sal_Int32(2))); + setPropertyValue( + maPropertyIdToNameMap[Int_DeckRightPadding], + Any(sal_Int32(2))); + setPropertyValue( + maPropertyIdToNameMap[Int_DeckBottomPadding], + Any(sal_Int32(2))); + setPropertyValue( + maPropertyIdToNameMap[Int_DeckBorderSize], + Any(sal_Int32(1))); + setPropertyValue( + maPropertyIdToNameMap[Int_DeckSeparatorHeight], + Any(sal_Int32(1))); + setPropertyValue( + maPropertyIdToNameMap[Int_ButtonCornerRadius], + Any(sal_Int32(3))); + setPropertyValue( + maPropertyIdToNameMap[Color_DeckTitleFont], + Any(sal_Int32(rStyle.GetFontColor().GetRGBColor()))); + setPropertyValue( + maPropertyIdToNameMap[Int_DeckTitleBarHeight], + Any(sal_Int32(Alternatives( + 26, + 26, + rStyle.GetFloatTitleHeight())))); + setPropertyValue( + maPropertyIdToNameMap[Paint_PanelBackground], + Any(sal_Int32(rStyle.GetDialogColor().GetRGBColor()))); + // Any(sal_Int32(mbIsHighContrastMode ? 0x000000 : + // 0xffffff))); + + setPropertyValue( + maPropertyIdToNameMap[Paint_PanelTitleBarBackground], + Any(Tools::VclToAwtGradient(Gradient( + GradientStyle_LINEAR, + aSecondColor.GetRGBColor(), + aBaseBackgroundColor.GetRGBColor() + )))); + setPropertyValue( + maPropertyIdToNameMap[Color_PanelTitleFont], + Any(sal_Int32(mbIsHighContrastMode ? 0x00ff00 : 0x262626))); + setPropertyValue( + maPropertyIdToNameMap[Int_PanelTitleBarHeight], + Any(sal_Int32(Alternatives( + 26, + 26, + rStyle.GetTitleHeight())))); + setPropertyValue( + maPropertyIdToNameMap[Paint_TabBarBackground], + Any(sal_Int32(aBaseBackgroundColor.GetRGBColor()))); + setPropertyValue( + maPropertyIdToNameMap[Int_TabBarLeftPadding], + Any(sal_Int32(2))); + setPropertyValue( + maPropertyIdToNameMap[Int_TabBarTopPadding], + Any(sal_Int32(2))); + setPropertyValue( + maPropertyIdToNameMap[Int_TabBarRightPadding], + Any(sal_Int32(2))); + setPropertyValue( + maPropertyIdToNameMap[Int_TabBarBottomPadding], + Any(sal_Int32(2))); + + setPropertyValue( + maPropertyIdToNameMap[Int_TabMenuPadding], + Any(sal_Int32(6))); + setPropertyValue( + maPropertyIdToNameMap[Color_TabMenuSeparator], + Any(sal_Int32(aBorderColor.GetRGBColor()))); + setPropertyValue( + maPropertyIdToNameMap[Int_TabMenuSeparatorPadding], + Any(sal_Int32(7))); + + setPropertyValue( + maPropertyIdToNameMap[Int_TabItemWidth], + Any(sal_Int32(32))); + setPropertyValue( + maPropertyIdToNameMap[Int_TabItemHeight], + Any(sal_Int32(32))); + setPropertyValue( + maPropertyIdToNameMap[Color_TabItemBorder], + Any(sal_Int32(rStyle.GetActiveBorderColor().GetRGBColor()))); + // mbIsHighContrastMode ? 0x00ff00 : 0xbfbfbf))); + + setPropertyValue( + maPropertyIdToNameMap[Paint_DropDownBackground], + Any(sal_Int32(aBaseBackgroundColor.GetRGBColor()))); + setPropertyValue( + maPropertyIdToNameMap[Color_DropDownBorder], + Any(sal_Int32(rStyle.GetActiveBorderColor().GetRGBColor()))); + + setPropertyValue( + maPropertyIdToNameMap[Color_Highlight], + Any(sal_Int32(rStyle.GetHighlightColor().GetRGBColor()))); + setPropertyValue( + maPropertyIdToNameMap[Color_HighlightText], + Any(sal_Int32(rStyle.GetHighlightTextColor().GetRGBColor()))); + + setPropertyValue( + maPropertyIdToNameMap[Paint_TabItemBackgroundNormal], + Any()); + setPropertyValue( + maPropertyIdToNameMap[Paint_TabItemBackgroundHighlight], + Any(sal_Int32(rStyle.GetActiveTabColor().GetRGBColor()))); + // mbIsHighContrastMode ? 0x000000 : 0x00ffffff))); + + setPropertyValue( + maPropertyIdToNameMap[Paint_HorizontalBorder], + Any(sal_Int32(aBorderColor.GetRGBColor()))); + // mbIsHighContrastMode ? 0x00ff00 : 0xe4e4e4))); + setPropertyValue( + maPropertyIdToNameMap[Paint_VerticalBorder], + Any(sal_Int32(aBorderColor.GetRGBColor()))); + setPropertyValue( + maPropertyIdToNameMap[Image_Grip], + Any(A2S("private:graphicrepository/sfx2/res/grip.png"))); + setPropertyValue( + maPropertyIdToNameMap[Image_Expand], + Any(A2S("private:graphicrepository/res/plus.png"))); + setPropertyValue( + maPropertyIdToNameMap[Image_Collapse], + Any(A2S("private:graphicrepository/res/minus.png"))); + setPropertyValue( + maPropertyIdToNameMap[Image_TabBarMenu], + Any(A2S("private:graphicrepository/sfx2/res/symphony/open_more.png"))); + setPropertyValue( + maPropertyIdToNameMap[Image_PanelMenu], + Any(A2S("private:graphicrepository/sfx2/res/symphony/morebutton.png"))); + setPropertyValue( + maPropertyIdToNameMap[Image_Closer], + Any(A2S("private:graphicrepository/sfx2/res/closedoc.png"))); + setPropertyValue( + maPropertyIdToNameMap[Image_ToolBoxItemSeparator], + Any( + A2S("private:graphicrepository/sfx2/res/separator.png"))); + + // ToolBox + + /* + // Separator style + setPropertyValue( + maPropertyIdToNameMap[Paint_ToolBoxBackground], + Any(sal_Int32(rStyle.GetMenuColor().GetRGBColor()))); + setPropertyValue( + maPropertyIdToNameMap[Paint_ToolBoxBorderTopLeft], + Any()); + setPropertyValue( + maPropertyIdToNameMap[Paint_ToolBoxBorderCenterCorners], + Any()); + setPropertyValue( + maPropertyIdToNameMap[Paint_ToolBoxBorderBottomRight], + Any()); + setPropertyValue( + maPropertyIdToNameMap[Rect_ToolBoxPadding], + Any(awt::Rectangle(2,2,2,2))); + setPropertyValue( + maPropertyIdToNameMap[Rect_ToolBoxBorder], + Any(awt::Rectangle(0,0,0,0))); + setPropertyValue( + maPropertyIdToNameMap[Bool_UseToolBoxItemSeparator], + Any(true)); + + */ + + // Gradient style + setPropertyValue( + maPropertyIdToNameMap[Paint_ToolBoxBackground], + Any(Tools::VclToAwtGradient(Gradient( + GradientStyle_LINEAR, + Color(0xf2f2f2), + Color(0xfefefe) + )))); + setPropertyValue( + maPropertyIdToNameMap[Paint_ToolBoxBorderTopLeft], + mbIsHighContrastMode + ? Any(util::Color(sal_uInt32(0x00ff00))) + : Any(util::Color(sal_uInt32(0xf2f2f2)))); + setPropertyValue( + maPropertyIdToNameMap[Paint_ToolBoxBorderCenterCorners], + mbIsHighContrastMode + ? Any(util::Color(sal_uInt32(0x00ff00))) + : Any(util::Color(sal_uInt32(0xf2f2f2)))); + setPropertyValue( + maPropertyIdToNameMap[Paint_ToolBoxBorderBottomRight], + mbIsHighContrastMode + ? Any(util::Color(sal_uInt32(0x00ff00))) + : Any(util::Color(sal_uInt32(0xf2f2f2)))); + setPropertyValue( + maPropertyIdToNameMap[Rect_ToolBoxPadding], + Any(awt::Rectangle(2,2,2,2))); + setPropertyValue( + maPropertyIdToNameMap[Rect_ToolBoxBorder], + Any(awt::Rectangle(1,1,1,1))); + setPropertyValue( + maPropertyIdToNameMap[Bool_UseToolBoxItemSeparator], + Any(false)); + } + catch(beans::UnknownPropertyException& rException) + { + OSL_TRACE("unknown property: %s", + OUStringToOString( + rException.Message, + RTL_TEXTENCODING_ASCII_US).getStr()); + OSL_ASSERT(false); + } +} + + + + +void SAL_CALL Theme::disposing (void) +{ + ChangeListeners aListeners; + maChangeListeners.swap(aListeners); + + const lang::EventObject aEvent (static_cast<XWeak*>(this)); + + for (ChangeListeners::const_iterator + iContainer(maChangeListeners.begin()), + iContainerEnd(maChangeListeners.end()); + iContainerEnd!=iContainerEnd; + ++iContainerEnd) + { + for (ChangeListenerContainer::const_iterator + iListener(iContainer->second.begin()), + iEnd(iContainer->second.end()); + iListener!=iEnd; + ++iListener) + { + try + { + (*iListener)->disposing(aEvent); + } + catch(const Exception&) + { + } + } + } +} + + + + +Reference<beans::XPropertySet> Theme::GetPropertySet (void) +{ + return Reference<beans::XPropertySet>(static_cast<XWeak*>(&GetCurrentTheme()), UNO_QUERY); +} + + + + +Reference<beans::XPropertySetInfo> SAL_CALL Theme::getPropertySetInfo (void) + throw(cssu::RuntimeException) +{ + return Reference<beans::XPropertySetInfo>(this); +} + + + + +void SAL_CALL Theme::setPropertyValue ( + const ::rtl::OUString& rsPropertyName, + const cssu::Any& rValue) + throw(cssu::RuntimeException) +{ + PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName)); + if (iId == maPropertyNameToIdMap.end()) + throw beans::UnknownPropertyException(rsPropertyName, NULL); + + const PropertyType eType (GetPropertyType(iId->second)); + if (eType == PT_Invalid) + throw beans::UnknownPropertyException(rsPropertyName, NULL); + + const ThemeItem eItem (iId->second); + + if (rValue == maRawValues[eItem]) + { + // Value is not different from the one in the property + // set => nothing to do. + return; + } + + const Any aOldValue (maRawValues[eItem]); + + const beans::PropertyChangeEvent aEvent( + static_cast<XWeak*>(this), + rsPropertyName, + sal_False, + eItem, + aOldValue, + rValue); + + if (DoVetoableListenersVeto(GetVetoableListeners(__AnyItem, false), aEvent)) + return; + if (DoVetoableListenersVeto(GetVetoableListeners(eItem, false), aEvent)) + return; + + maRawValues[eItem] = rValue; + ProcessNewValue(rValue, eItem, eType); + + BroadcastPropertyChange(GetChangeListeners(__AnyItem, false), aEvent); + BroadcastPropertyChange(GetChangeListeners(eItem, false), aEvent); +} + + + + +Any SAL_CALL Theme::getPropertyValue ( + const ::rtl::OUString& rsPropertyName) + throw(css::beans::UnknownPropertyException, + css::lang::WrappedTargetException, + cssu::RuntimeException) +{ + PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName)); + if (iId == maPropertyNameToIdMap.end()) + throw beans::UnknownPropertyException(); + + const PropertyType eType (GetPropertyType(iId->second)); + if (eType == PT_Invalid) + throw beans::UnknownPropertyException(); + + const ThemeItem eItem (iId->second); + + return maRawValues[eItem]; +} + + + + +void SAL_CALL Theme::addPropertyChangeListener( + const ::rtl::OUString& rsPropertyName, + const cssu::Reference<css::beans::XPropertyChangeListener>& rxListener) + throw(css::beans::UnknownPropertyException, + css::lang::WrappedTargetException, + cssu::RuntimeException) +{ + ThemeItem eItem (__AnyItem); + if (rsPropertyName.getLength() > 0) + { + PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName)); + if (iId == maPropertyNameToIdMap.end()) + throw beans::UnknownPropertyException(); + + const PropertyType eType (GetPropertyType(iId->second)); + if (eType == PT_Invalid) + throw beans::UnknownPropertyException(); + + eItem = iId->second; + } + ChangeListenerContainer* pListeners = GetChangeListeners(eItem, true); + if (pListeners != NULL) + pListeners->push_back(rxListener); +} + + + + +void SAL_CALL Theme::removePropertyChangeListener( + const ::rtl::OUString& rsPropertyName, + const cssu::Reference<css::beans::XPropertyChangeListener>& rxListener) + throw(css::beans::UnknownPropertyException, + css::lang::WrappedTargetException, + cssu::RuntimeException) +{ + ThemeItem eItem (__AnyItem); + if (rsPropertyName.getLength() > 0) + { + PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName)); + if (iId == maPropertyNameToIdMap.end()) + throw beans::UnknownPropertyException(); + + const PropertyType eType (GetPropertyType(iId->second)); + if (eType == PT_Invalid) + throw beans::UnknownPropertyException(); + + eItem = iId->second; + } + ChangeListenerContainer* pContainer = GetChangeListeners(eItem, false); + if (pContainer != NULL) + { + ChangeListenerContainer::iterator iListener (::std::find(pContainer->begin(), pContainer->end(), rxListener)); + if (iListener != pContainer->end()) + { + pContainer->erase(iListener); + + // Remove the listener container when empty. + if (pContainer->empty()) + maChangeListeners.erase(eItem); + } + } +} + + + + +void SAL_CALL Theme::addVetoableChangeListener( + const ::rtl::OUString& rsPropertyName, + const cssu::Reference<css::beans::XVetoableChangeListener>& rxListener) + throw(css::beans::UnknownPropertyException, + css::lang::WrappedTargetException, + cssu::RuntimeException) +{ + ThemeItem eItem (__AnyItem); + if (rsPropertyName.getLength() > 0) + { + PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName)); + if (iId == maPropertyNameToIdMap.end()) + throw beans::UnknownPropertyException(); + + const PropertyType eType (GetPropertyType(iId->second)); + if (eType == PT_Invalid) + throw beans::UnknownPropertyException(); + + eItem = iId->second; + } + VetoableListenerContainer* pListeners = GetVetoableListeners(eItem, true); + if (pListeners != NULL) + pListeners->push_back(rxListener); +} + + + + +void SAL_CALL Theme::removeVetoableChangeListener( + const ::rtl::OUString& rsPropertyName, + const cssu::Reference<css::beans::XVetoableChangeListener>& rxListener) + throw(css::beans::UnknownPropertyException, + css::lang::WrappedTargetException, + cssu::RuntimeException) +{ + ThemeItem eItem (__AnyItem); + if (rsPropertyName.getLength() > 0) + { + PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName)); + if (iId == maPropertyNameToIdMap.end()) + throw beans::UnknownPropertyException(); + + const PropertyType eType (GetPropertyType(iId->second)); + if (eType == PT_Invalid) + throw beans::UnknownPropertyException(); + + eItem = iId->second; + } + VetoableListenerContainer* pContainer = GetVetoableListeners(eItem, false); + if (pContainer != NULL) + { + VetoableListenerContainer::iterator iListener (::std::find(pContainer->begin(), pContainer->end(), rxListener)); + if (iListener != pContainer->end()) + { + pContainer->erase(iListener); + // Remove container when empty. + if (pContainer->empty()) + maVetoableListeners.erase(eItem); + } + } +} + + + + +cssu::Sequence<css::beans::Property> SAL_CALL Theme::getProperties (void) + throw(cssu::RuntimeException) +{ + ::std::vector<beans::Property> aProperties; + + for (sal_Int32 nItem(__Begin),nEnd(__End); nItem!=nEnd; ++nItem) + { + const ThemeItem eItem (static_cast<ThemeItem>(nItem)); + const PropertyType eType (GetPropertyType(eItem)); + if (eType == PT_Invalid) + continue; + + const beans::Property aProperty( + maPropertyIdToNameMap[eItem], + eItem, + GetCppuType(eType), + 0); + aProperties.push_back(aProperty); + } + + return cssu::Sequence<css::beans::Property>( + &aProperties.front(), + aProperties.size()); +} + + + + +beans::Property SAL_CALL Theme::getPropertyByName (const ::rtl::OUString& rsPropertyName) + throw(css::beans::UnknownPropertyException, + cssu::RuntimeException) +{ + PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName)); + if (iId == maPropertyNameToIdMap.end()) + throw beans::UnknownPropertyException(); + + const PropertyType eType (GetPropertyType(iId->second)); + if (eType == PT_Invalid) + throw beans::UnknownPropertyException(); + + const ThemeItem eItem (iId->second); + + return beans::Property( + rsPropertyName, + eItem, + GetCppuType(eType), + 0); +} + + + + +sal_Bool SAL_CALL Theme::hasPropertyByName (const ::rtl::OUString& rsPropertyName) + throw(cssu::RuntimeException) +{ + PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName)); + if (iId == maPropertyNameToIdMap.end()) + return sal_False; + + const PropertyType eType (GetPropertyType(iId->second)); + if (eType == PT_Invalid) + return sal_False; + + return sal_True; +} + + + + +void Theme::SetupPropertyMaps (void) +{ + maPropertyIdToNameMap.resize(__Post_Rect); + maImages.resize(__Image_Color - __Pre_Image - 1); + maColors.resize(__Color_Paint - __Image_Color - 1); + maPaints.resize(__Paint_Int - __Color_Paint - 1); + maIntegers.resize(__Int_Bool - __Paint_Int - 1); + maBooleans.resize(__Bool_Rect - __Int_Bool - 1); + maRectangles.resize(__Post_Rect - __Bool_Rect - 1); + + #define AddEntry(e) maPropertyNameToIdMap[A2S(#e)]=e; maPropertyIdToNameMap[e]=A2S(#e) + + AddEntry(Image_Grip); + AddEntry(Image_Expand); + AddEntry(Image_Collapse); + AddEntry(Image_TabBarMenu); + AddEntry(Image_PanelMenu); + AddEntry(Image_ToolBoxItemSeparator); + AddEntry(Image_Closer); + + AddEntry(Color_DeckTitleFont); + AddEntry(Color_PanelTitleFont); + AddEntry(Color_TabMenuSeparator); + AddEntry(Color_TabItemBorder); + AddEntry(Color_DropDownBorder); + AddEntry(Color_Highlight); + AddEntry(Color_HighlightText); + + AddEntry(Paint_DeckBackground); + AddEntry(Paint_DeckTitleBarBackground); + AddEntry(Paint_PanelBackground); + AddEntry(Paint_PanelTitleBarBackground); + AddEntry(Paint_TabBarBackground); + AddEntry(Paint_TabItemBackgroundNormal); + AddEntry(Paint_TabItemBackgroundHighlight); + AddEntry(Paint_HorizontalBorder); + AddEntry(Paint_VerticalBorder); + AddEntry(Paint_ToolBoxBackground); + AddEntry(Paint_ToolBoxBorderTopLeft); + AddEntry(Paint_ToolBoxBorderCenterCorners); + AddEntry(Paint_ToolBoxBorderBottomRight); + AddEntry(Paint_DropDownBackground); + + AddEntry(Int_DeckTitleBarHeight); + AddEntry(Int_DeckBorderSize); + AddEntry(Int_DeckSeparatorHeight); + AddEntry(Int_PanelTitleBarHeight); + AddEntry(Int_TabMenuPadding); + AddEntry(Int_TabMenuSeparatorPadding); + AddEntry(Int_TabItemWidth); + AddEntry(Int_TabItemHeight); + AddEntry(Int_DeckLeftPadding); + AddEntry(Int_DeckTopPadding); + AddEntry(Int_DeckRightPadding); + AddEntry(Int_DeckBottomPadding); + AddEntry(Int_TabBarLeftPadding); + AddEntry(Int_TabBarTopPadding); + AddEntry(Int_TabBarRightPadding); + AddEntry(Int_TabBarBottomPadding); + AddEntry(Int_ButtonCornerRadius); + + AddEntry(Bool_UseSymphonyIcons); + AddEntry(Bool_UseSystemColors); + AddEntry(Bool_UseToolBoxItemSeparator); + AddEntry(Bool_IsHighContrastModeActive); + + AddEntry(Rect_ToolBoxPadding); + AddEntry(Rect_ToolBoxBorder); + + #undef AddEntry + + maRawValues.resize(maPropertyIdToNameMap.size()); +} + + + + +Theme::PropertyType Theme::GetPropertyType (const ThemeItem eItem) +{ + switch(eItem) + { + case Image_Grip: + case Image_Expand: + case Image_Collapse: + case Image_TabBarMenu: + case Image_PanelMenu: + case Image_ToolBoxItemSeparator: + case Image_Closer: + return PT_Image; + + case Color_DeckTitleFont: + case Color_PanelTitleFont: + case Color_TabMenuSeparator: + case Color_TabItemBorder: + case Color_DropDownBorder: + case Color_Highlight: + case Color_HighlightText: + return PT_Color; + + case Paint_DeckBackground: + case Paint_DeckTitleBarBackground: + case Paint_PanelBackground: + case Paint_PanelTitleBarBackground: + case Paint_TabBarBackground: + case Paint_TabItemBackgroundNormal: + case Paint_TabItemBackgroundHighlight: + case Paint_HorizontalBorder: + case Paint_VerticalBorder: + case Paint_ToolBoxBackground: + case Paint_ToolBoxBorderTopLeft: + case Paint_ToolBoxBorderCenterCorners: + case Paint_ToolBoxBorderBottomRight: + case Paint_DropDownBackground: + return PT_Paint; + + case Int_DeckTitleBarHeight: + case Int_DeckBorderSize: + case Int_DeckSeparatorHeight: + case Int_PanelTitleBarHeight: + case Int_TabMenuPadding: + case Int_TabMenuSeparatorPadding: + case Int_TabItemWidth: + case Int_TabItemHeight: + case Int_DeckLeftPadding: + case Int_DeckTopPadding: + case Int_DeckRightPadding: + case Int_DeckBottomPadding: + case Int_TabBarLeftPadding: + case Int_TabBarTopPadding: + case Int_TabBarRightPadding: + case Int_TabBarBottomPadding: + case Int_ButtonCornerRadius: + return PT_Integer; + + case Bool_UseSymphonyIcons: + case Bool_UseSystemColors: + case Bool_UseToolBoxItemSeparator: + case Bool_IsHighContrastModeActive: + return PT_Boolean; + + case Rect_ToolBoxBorder: + case Rect_ToolBoxPadding: + return PT_Rectangle; + + default: + return PT_Invalid; + } +} + + + + +cssu::Type Theme::GetCppuType (const PropertyType eType) +{ + switch(eType) + { + case PT_Image: + return getCppuType((rtl::OUString*)NULL); + + case PT_Color: + return getCppuType((sal_uInt32*)NULL); + + case PT_Paint: + return getCppuVoidType(); + + case PT_Integer: + return getCppuType((sal_Int32*)NULL); + + case PT_Boolean: + return getCppuType((sal_Bool*)NULL); + + case PT_Rectangle: + return getCppuType((awt::Rectangle*)NULL); + + case PT_Invalid: + default: + return getCppuVoidType(); + } +} + + + + +sal_Int32 Theme::GetIndex (const ThemeItem eItem, const PropertyType eType) +{ + switch(eType) + { + case PT_Image: + return eItem - __Pre_Image-1; + case PT_Color: + return eItem - __Image_Color-1; + case PT_Paint: + return eItem - __Color_Paint-1; + case PT_Integer: + return eItem - __Paint_Int-1; + case PT_Boolean: + return eItem - __Int_Bool-1; + case PT_Rectangle: + return eItem - __Bool_Rect-1; + + default: + OSL_ASSERT(false); + return 0; + } +} + + + + +Theme::VetoableListenerContainer* Theme::GetVetoableListeners ( + const ThemeItem eItem, + const bool bCreate) +{ + VetoableListeners::iterator iContainer (maVetoableListeners.find(eItem)); + if (iContainer != maVetoableListeners.end()) + return &iContainer->second; + else if (bCreate) + { + maVetoableListeners[eItem] = VetoableListenerContainer(); + return &maVetoableListeners[eItem]; + } + else + return NULL; +} + + + + +Theme::ChangeListenerContainer* Theme::GetChangeListeners ( + const ThemeItem eItem, + const bool bCreate) +{ + ChangeListeners::iterator iContainer (maChangeListeners.find(eItem)); + if (iContainer != maChangeListeners.end()) + return &iContainer->second; + else if (bCreate) + { + maChangeListeners[eItem] = ChangeListenerContainer(); + return &maChangeListeners[eItem]; + } + else + return NULL; +} + + + + +bool Theme::DoVetoableListenersVeto ( + const VetoableListenerContainer* pListeners, + const beans::PropertyChangeEvent& rEvent) const +{ + if (pListeners == NULL) + return false; + + VetoableListenerContainer aListeners (*pListeners); + try + { + for (VetoableListenerContainer::const_iterator + iListener(aListeners.begin()), + iEnd(aListeners.end()); + iListener!=iEnd; + ++iListener) + { + (*iListener)->vetoableChange(rEvent); + } + } + catch(const beans::PropertyVetoException&) + { + return true; + } + catch(const Exception&) + { + // Ignore any other errors (such as disposed listeners). + } + return false; +} + + + + +void Theme::BroadcastPropertyChange ( + const ChangeListenerContainer* pListeners, + const beans::PropertyChangeEvent& rEvent) const +{ + if (pListeners == NULL) + return; + + const ChangeListenerContainer aListeners (*pListeners); + try + { + for (ChangeListenerContainer::const_iterator + iListener(aListeners.begin()), + iEnd(aListeners.end()); + iListener!=iEnd; + ++iListener) + { + (*iListener)->propertyChange(rEvent); + } + } + catch(const Exception&) + { + // Ignore any errors (such as disposed listeners). + } +} + + + + +void Theme::ProcessNewValue ( + const Any& rValue, + const ThemeItem eItem, + const PropertyType eType) +{ + const sal_Int32 nIndex (GetIndex (eItem, eType)); + switch (eType) + { + case PT_Image: + { + ::rtl::OUString sURL; + if (rValue >>= sURL) + { + maImages[nIndex] = Tools::GetImage(sURL, NULL); + } + break; + } + case PT_Color: + { + sal_Int32 nColorValue (0); + if (rValue >>= nColorValue) + { + maColors[nIndex] = Color(nColorValue); + } + break; + } + case PT_Paint: + { + maPaints[nIndex] = Paint::Create(rValue); + break; + } + case PT_Integer: + { + sal_Int32 nValue (0); + if (rValue >>= nValue) + { + maIntegers[nIndex] = nValue; + } + break; + } + case PT_Boolean: + { + sal_Bool nValue (0); + if (rValue >>= nValue) + { + maBooleans[nIndex] = (nValue==sal_True); + if (eItem == Bool_IsHighContrastModeActive) + { + mbIsHighContrastModeSetManually = true; + mbIsHighContrastMode = maBooleans[nIndex]; + HandleDataChange(); + } + else if (eItem == Bool_UseSystemColors) + { + HandleDataChange(); + } + } + break; + } + case PT_Rectangle: + { + awt::Rectangle aBox; + if (rValue >>= aBox) + { + maRectangles[nIndex] = Rectangle( + aBox.X, + aBox.Y, + aBox.Width, + aBox.Height); + } + break; + } + case PT_Invalid: + OSL_ASSERT(eType != PT_Invalid); + throw RuntimeException(); + } +} + +} } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/TitleBar.cxx b/sfx2/source/sidebar/TitleBar.cxx new file mode 100644 index 000000000000..1a48d0308fbf --- /dev/null +++ b/sfx2/source/sidebar/TitleBar.cxx @@ -0,0 +1,193 @@ +/* + * 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 "TitleBar.hxx" +#include "Paint.hxx" + +#include <tools/svborder.hxx> +#include <vcl/gradient.hxx> +#include <vcl/lineinfo.hxx> + +ToolbarValue::~ToolbarValue (void) {} + + +namespace sfx2 { namespace sidebar { + +TitleBar::TitleBar ( + const ::rtl::OUString& rsTitle, + Window* pParentWindow, + const sidebar::Paint& rInitialBackgroundPaint) + : Window(pParentWindow), + maToolBox(this), + msTitle(rsTitle) +{ + SetBackground(rInitialBackgroundPaint.GetWallpaper()); + + maToolBox.SetSelectHdl(LINK(this, TitleBar, SelectionHandler)); +} + + + + +TitleBar::~TitleBar (void) +{ +} + + + + +void TitleBar::SetTitle (const ::rtl::OUString& rsTitle) +{ + msTitle = rsTitle; + Invalidate(); +} + + + + +void TitleBar::Paint (const Rectangle& rUpdateArea) +{ + (void)rUpdateArea; + + // Paint title bar background. + Size aWindowSize (GetOutputSizePixel()); + Rectangle aTitleBarBox( + 0, + 0, + aWindowSize.Width(), + aWindowSize.Height() + ); + + PaintDecoration(aTitleBarBox); + const Rectangle aTitleBox (GetTitleArea(aTitleBarBox)); + PaintTitle(aTitleBox); + if (HasFocus()) + PaintFocus(aTitleBox); +} + + + + +void TitleBar::DataChanged (const DataChangedEvent& rEvent) +{ + (void)rEvent; + + SetBackground(GetBackgroundPaint().GetWallpaper()); +} + + + + +void TitleBar::setPosSizePixel ( + long nX, + long nY, + long nWidth, + long nHeight, + sal_uInt16 nFlags) +{ + Window::setPosSizePixel(nX,nY,nWidth,nHeight,nFlags); + + // Place the toolbox. + const sal_Int32 nToolBoxWidth (maToolBox.GetItemPosRect(0).GetWidth()); + maToolBox.setPosSizePixel(nWidth-nToolBoxWidth,0,nToolBoxWidth,nHeight); + maToolBox.Show(); +} + + + + +ToolBox& TitleBar::GetToolBox (void) +{ + return maToolBox; +} + + + + +void TitleBar::HandleToolBoxItemClick (const sal_uInt16 nItemIndex) +{ + (void)nItemIndex; + // Any real processing has to be done in derived class. +} + + + + +void TitleBar::PaintTitle (const Rectangle& rTitleBox) +{ + Push(PUSH_FONT | PUSH_TEXTCOLOR); + + Font aFont(GetFont()); + SetFont(aFont); + + // Paint title bar text. + SetTextColor(GetTextColor()); + DrawText( + rTitleBox, + msTitle, + TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER); + + Pop(); +} + + + + +void TitleBar::PaintFocus (const Rectangle& rFocusBox) +{ + Push(PUSH_FONT | PUSH_TEXTCOLOR | PUSH_LINECOLOR | PUSH_FILLCOLOR); + + const Rectangle aTextBox ( + GetTextRect( + rFocusBox, + msTitle, + TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER)); + const Rectangle aLargerTextBox ( + aTextBox.Left() - 2, + aTextBox.Top() - 2, + aTextBox.Right() + 2, + aTextBox.Bottom() + 2); + + LineInfo aDottedStyle (LINE_DASH); + aDottedStyle.SetDashCount(0); + aDottedStyle.SetDotCount(1); + aDottedStyle.SetDotLen(1); + aDottedStyle.SetDistance(1); + + SetFillColor(); + SetLineColor(COL_BLACK); + DrawPolyLine(Polygon(aLargerTextBox), aDottedStyle); + + Pop(); +} + + + + +IMPL_LINK(TitleBar, SelectionHandler, ToolBox*, pToolBox) +{ + (void)pToolBox; + OSL_ASSERT(&maToolBox==pToolBox); + const sal_uInt16 nItemId (maToolBox.GetHighlightItemId()); + + HandleToolBoxItemClick(nItemId); + + return sal_True; +} + +} } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/TitleBar.hxx b/sfx2/source/sidebar/TitleBar.hxx new file mode 100644 index 000000000000..4f4f67c8b601 --- /dev/null +++ b/sfx2/source/sidebar/TitleBar.hxx @@ -0,0 +1,72 @@ +/* + * 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 SFX_SIDEBAR_TITLE_BAR_HXX +#define SFX_SIDEBAR_TITLE_BAR_HXX + +#include "Paint.hxx" + +#include <vcl/window.hxx> +#include <vcl/toolbox.hxx> + + +namespace sfx2 { namespace sidebar { + +class TitleBar + : public Window +{ +public: + TitleBar ( + const ::rtl::OUString& rsTitle, + Window* pParentWindow, + const sidebar::Paint& rInitialBackgroundPaint); + virtual ~TitleBar (void); + + void SetTitle (const ::rtl::OUString& rsTitle); + + virtual void Paint (const Rectangle& rUpdateArea); + virtual void DataChanged (const DataChangedEvent& rEvent); + virtual void setPosSizePixel ( + long nX, + long nY, + long nWidth, + long nHeight, + sal_uInt16 nFlags = WINDOW_POSSIZE_ALL); + + ToolBox& GetToolBox (void); + +protected: + ToolBox maToolBox; + + virtual Rectangle GetTitleArea (const Rectangle& rTitleBarBox) = 0; + virtual void PaintDecoration (const Rectangle& rTitleBarBox) = 0; + virtual void PaintFocus (const Rectangle& rFocusBox); + virtual sidebar::Paint GetBackgroundPaint (void) = 0; + virtual Color GetTextColor (void) = 0; + virtual void HandleToolBoxItemClick (const sal_uInt16 nItemIndex); + +private: + ::rtl::OUString msTitle; + + void PaintTitle (const Rectangle& rTitleBox); + DECL_LINK(SelectionHandler, ToolBox*); +}; + + +} } // end of namespace sfx2::sidebar + +#endif diff --git a/sfx2/source/sidebar/ToolBox.hxx b/sfx2/source/sidebar/ToolBox.hxx new file mode 100644 index 000000000000..8de0a6b003ee --- /dev/null +++ b/sfx2/source/sidebar/ToolBox.hxx @@ -0,0 +1,52 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SFX_SIDEBAR_TOOLBOX_HXX +#define SFX_SIDEBAR_TOOLBOX_HXX + +#include "vcl/toolbox.hxx" + + +namespace sfx2 { namespace sidebar { + +class ToolBox + : public ::ToolBox +{ +public: + MenuButton (Window* pParentWindow); + virtual ~MenuButton (void); + + virtual void Paint (const Rectangle& rUpdateArea); + virtual void MouseMove (const MouseEvent& rEvent); + virtual void MouseButtonDown (const MouseEvent& rMouseEvent); + virtual void MouseButtonUp (const MouseEvent& rMouseEvent); + +protected: + using CheckBox::FillLayoutData; + +private: + bool mbIsLeftButtonDown; + enum PaintType { + PT_Native, + PT_Theme + } mePaintType; +}; + + +} } // end of namespace sfx2::sidebar + +#endif diff --git a/sfx2/source/sidebar/ToolBoxBackground.cxx b/sfx2/source/sidebar/ToolBoxBackground.cxx new file mode 100644 index 000000000000..1336c03478ed --- /dev/null +++ b/sfx2/source/sidebar/ToolBoxBackground.cxx @@ -0,0 +1,148 @@ +/* + * 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 "ToolBoxBackground.hxx" +#include "Paint.hxx" +#include "DrawHelper.hxx" +#include "Tools.hxx" +#include "sfx2/sidebar/Theme.hxx" + +#include <vcl/toolbox.hxx> +#include <vcl/gradient.hxx> +#include <svl/smplhint.hxx> + + +namespace sfx2 { namespace sidebar { + +ToolBoxBackground::ToolBoxBackground (Window* pParentWindow) + : Window(pParentWindow, WB_DIALOGCONTROL), + maPadding(Tools::RectangleToSvBorder(Theme::GetRectangle(Theme::Rect_ToolBoxPadding))) +{ + SetBackground(Theme::GetPaint(Theme::Paint_ToolBoxBackground).GetWallpaper()); + +#ifdef DEBUG + SetText(A2S("ToolBoxBackground")); +#endif +} + + + + +ToolBoxBackground::~ToolBoxBackground (void) +{ + Link aEventListener (LINK(this, ToolBoxBackground, WindowEventHandler)); + if (GetChildCount() > 0) + GetChild(0)->RemoveEventListener(aEventListener); +} + + + + +Point ToolBoxBackground::SetToolBoxChild ( + ToolBox* pChild, + long nX, + long nY, + long nWidth, + long nHeight, + sal_uInt16 nFlags) +{ + if (pChild == NULL) + { + OSL_ASSERT(pChild!=NULL); + return Point(nX, nY); + } + + Link aEventListener (LINK(this, ToolBoxBackground, WindowEventHandler)); + pChild->AddEventListener(aEventListener); + + setPosSizePixel( + nX - maPadding.Left(), + nY - maPadding.Top(), + nWidth + maPadding.Left() + maPadding.Right(), + nHeight + maPadding.Top() + maPadding.Bottom(), + nFlags); + return Point( + maPadding.Left(), + maPadding.Top()); +} + + + + +void ToolBoxBackground::Paint (const Rectangle& rRect) +{ + Window::Paint(rRect); + + Rectangle aBox (Point(0,0), GetSizePixel()); + + const sidebar::Paint aTopLeftBorderPaint (Theme::GetPaint(Theme::Paint_ToolBoxBorderTopLeft)); + const sidebar::Paint aCenterBorderPaint (Theme::GetPaint(Theme::Paint_ToolBoxBorderCenterCorners)); + const sidebar::Paint aBottomRightBorderPaint (Theme::GetPaint(Theme::Paint_ToolBoxBorderBottomRight)); + const Rectangle aBorderSize (Theme::GetRectangle(Theme::Rect_ToolBoxBorder)); + DrawHelper::DrawBevelBorder ( + *this, + aBox, + Tools::RectangleToSvBorder(aBorderSize), + aTopLeftBorderPaint, + aCenterBorderPaint, + aBottomRightBorderPaint); +} + + + + +void ToolBoxBackground::DataChanged (const DataChangedEvent& rEvent) +{ + (void)rEvent; + + SetBackground(Theme::GetPaint(Theme::Paint_ToolBoxBackground).GetWallpaper()); + maPadding = Tools::RectangleToSvBorder(Theme::GetRectangle(Theme::Rect_ToolBoxPadding)); +} + + + + +IMPL_LINK(ToolBoxBackground, WindowEventHandler, VclWindowEvent*, pEvent) +{ + if (pEvent != NULL) + { + switch (pEvent->GetId()) + { + case VCLEVENT_WINDOW_SHOW: + if (GetChild(0)->IsVisible()) + Show(); + break; + + case VCLEVENT_WINDOW_HIDE: + if ( ! GetChild(0)->IsVisible()) + Hide(); + break; + + case SFX_HINT_DYING: + doLazyDelete(); + break; + + default: + break; + } + } + + return sal_True; +} + + +} } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/ToolBoxBackground.hxx b/sfx2/source/sidebar/ToolBoxBackground.hxx new file mode 100644 index 000000000000..e5204b921204 --- /dev/null +++ b/sfx2/source/sidebar/ToolBoxBackground.hxx @@ -0,0 +1,64 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SFX_SIDEBAR_TOOLBOX_BACKGROUND_HXX +#define SFX_SIDEBAR_TOOLBOX_BACKGROUND_HXX + +#include "vcl/window.hxx" + +#include <tools/svborder.hxx> + + +class ToolBox; + +namespace sfx2 { namespace sidebar { + +class ToolBoxBackground + : public Window +{ +public: + ToolBoxBackground (Window* pParentWindow); + virtual ~ToolBoxBackground (void); + + /** Call this method once to + a) let the ToolBoxBackground object know which ToolBox to + monitor and + b) so that position and sizes can be set up. + @return + The relative position of the child. + */ + Point SetToolBoxChild ( + ToolBox* pChild, + long nX, + long nY, + long nWidth, + long nHeight, + sal_uInt16 nFlags); + + virtual void Paint (const Rectangle& rRect); + virtual void DataChanged (const DataChangedEvent& rEvent); + +private: + SvBorder maPadding; + + DECL_LINK(WindowEventHandler, VclWindowEvent*); +}; + + +} } // end of namespace sfx2::sidebar + +#endif diff --git a/sfx2/source/sidebar/Tools.cxx b/sfx2/source/sidebar/Tools.cxx new file mode 100644 index 000000000000..27956cd6670d --- /dev/null +++ b/sfx2/source/sidebar/Tools.cxx @@ -0,0 +1,150 @@ +/* + * 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 "Tools.hxx" + +#include "sfx2/sidebar/Theme.hxx" + +#include "sfx2/imagemgr.hxx" +#include <comphelper/processfactory.hxx> +#include <comphelper/componentcontext.hxx> +#include <comphelper/namedvaluecollection.hxx> +#include <vcl/gradient.hxx> + +#include <com/sun/star/graphic/XGraphicProvider.hpp> + +#include <cstring> + +using namespace css; +using namespace cssu; + + +namespace sfx2 { namespace sidebar { + +Image Tools::GetImage ( + const ::rtl::OUString& rsImageURL, + const ::rtl::OUString& rsHighContrastImageURL, + const Reference<frame::XFrame>& rxFrame) +{ + if (Theme::IsHighContrastMode()) + return GetImage(rsHighContrastImageURL, rxFrame); + else + return GetImage(rsImageURL, rxFrame); +} + + + + +Image Tools::GetImage ( + const ::rtl::OUString& rsURL, + const Reference<frame::XFrame>& rxFrame) +{ + if (rsURL.getLength() > 0) + { + const sal_Char sUnoCommandPrefix[] = ".uno:"; + const sal_Char sCommandImagePrefix[] = "private:commandimage/"; + const sal_Int32 nCommandImagePrefixLength = strlen(sCommandImagePrefix); + + if (rsURL.startsWith(sUnoCommandPrefix)) + { + const Image aPanelImage (::GetImage(rxFrame, rsURL, sal_False)); + return aPanelImage; + } + else if (rsURL.startsWith(sCommandImagePrefix)) + { + ::rtl::OUStringBuffer aCommandName; + aCommandName.appendAscii(sUnoCommandPrefix); + aCommandName.append(rsURL.copy(nCommandImagePrefixLength)); + const ::rtl::OUString sCommandName (aCommandName.makeStringAndClear()); + + const Image aPanelImage (::GetImage(rxFrame, sCommandName, sal_False)); + return aPanelImage; + } + else + { + const ::comphelper::ComponentContext aContext (::comphelper::getProcessServiceFactory()); + const Reference<graphic::XGraphicProvider> xGraphicProvider ( + aContext.createComponent("com.sun.star.graphic.GraphicProvider"), + UNO_QUERY); + if ( xGraphicProvider.is()) + { + ::comphelper::NamedValueCollection aMediaProperties; + aMediaProperties.put("URL", rsURL); + const Reference<graphic::XGraphic> xGraphic ( + xGraphicProvider->queryGraphic(aMediaProperties.getPropertyValues()), + UNO_QUERY); + if (xGraphic.is()) + return Image(xGraphic); + } + } + } + return Image(); +} + + + + +css::awt::Gradient Tools::VclToAwtGradient (const Gradient aVclGradient) +{ + css::awt::Gradient aAwtGradient ( + awt::GradientStyle(aVclGradient.GetStyle()), + aVclGradient.GetStartColor().GetRGBColor(), + aVclGradient.GetEndColor().GetRGBColor(), + aVclGradient.GetAngle(), + aVclGradient.GetBorder(), + aVclGradient.GetOfsX(), + aVclGradient.GetOfsY(), + aVclGradient.GetStartIntensity(), + aVclGradient.GetEndIntensity(), + aVclGradient.GetSteps()); + return aAwtGradient; +} + + + + +Gradient Tools::AwtToVclGradient (const css::awt::Gradient aAwtGradient) +{ + Gradient aVclGradient ( + GradientStyle(aAwtGradient.Style), + aAwtGradient.StartColor, + aAwtGradient.EndColor); + aVclGradient.SetAngle(aAwtGradient.Angle); + aVclGradient.SetBorder(aAwtGradient.Border); + aVclGradient.SetOfsX(aAwtGradient.XOffset); + aVclGradient.SetOfsY(aAwtGradient.YOffset); + aVclGradient.SetStartIntensity(aAwtGradient.StartIntensity); + aVclGradient.SetEndIntensity(aAwtGradient.EndIntensity); + aVclGradient.SetSteps(aAwtGradient.StepCount); + + return aVclGradient; +} + + + + +SvBorder Tools::RectangleToSvBorder (const Rectangle aBox) +{ + return SvBorder( + aBox.Left(), + aBox.Top(), + aBox.Right(), + aBox.Bottom()); +} + +} } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/Tools.hxx b/sfx2/source/sidebar/Tools.hxx new file mode 100644 index 000000000000..70bc7f995d0c --- /dev/null +++ b/sfx2/source/sidebar/Tools.hxx @@ -0,0 +1,59 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SFX_SIDEBAR_TOOLS_HXX +#define SFX_SIDEBAR_TOOLS_HXX + +#include <vcl/image.hxx> +#include <vcl/gradient.hxx> +#include <tools/svborder.hxx> + +#include <com/sun/star/awt/Gradient.hpp> +#include <com/sun/star/frame/XFrame.hpp> + + +#define A2S(s) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s))) +#define S2A(s) rtl::OUStringToOString(s, RTL_TEXTENCODING_ASCII_US).getStr() + +namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; + + +namespace sfx2 { namespace sidebar { + +class Tools +{ +public: + static Image GetImage ( + const ::rtl::OUString& rsImageURL, + const ::rtl::OUString& rsHighContrastImageURL, + const cssu::Reference<css::frame::XFrame>& rxFrame); + + static Image GetImage ( + const ::rtl::OUString& rsURL, + const cssu::Reference<css::frame::XFrame>& rxFrame); + + static css::awt::Gradient VclToAwtGradient (const Gradient aGradient); + static Gradient AwtToVclGradient (const css::awt::Gradient aGradient); + + static SvBorder RectangleToSvBorder (const Rectangle aBox); +}; + + +} } // end of namespace sfx2::sidebar + +#endif diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 6386ceb54c82..4faf84fae3e9 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -3230,6 +3230,18 @@ void SfxViewFrame::ChildWindowState( SfxItemSet& rState ) rState.Put( SfxBoolItem( nSID, HasChildWindow( nSID ) ) ); } } + else if ( nSID == SID_SIDEBAR ) + { + if ( !KnowsChildWindow( nSID ) ) + { + OSL_ENSURE( false, "SID_TASKPANE state requested, but no task pane child window exists for this ID!" ); + rState.DisableItem( nSID ); + } + else + { + rState.Put( SfxBoolItem( nSID, HasChildWindow( nSID ) ) ); + } + } else if ( KnowsChildWindow(nSID) ) rState.Put( SfxBoolItem( nSID, HasChildWindow(nSID) ) ); else diff --git a/svx/AllLangResTarget_svx.mk b/svx/AllLangResTarget_svx.mk index 6042b520d18f..82140786bc9d 100644 --- a/svx/AllLangResTarget_svx.mk +++ b/svx/AllLangResTarget_svx.mk @@ -70,6 +70,14 @@ $(eval $(call gb_SrsTarget_add_files,svx/res,\ svx/source/form/formshell.src \ svx/source/items/svxerr.src \ svx/source/items/svxitems.src \ + svx/source/mnuctrls/mnuctrls.src \ + svx/source/sidebar/EmptyPanel.src \ + svx/source/sidebar/area/AreaPropertyPanel.src \ + svx/source/sidebar/graphic/GraphicPropertyPanel.src \ + svx/source/sidebar/line/LinePropertyPanel.src \ + svx/source/sidebar/possize/PosSizePropertyPanel.src \ + svx/source/sidebar/text/TextPropertyPanel.src \ + svx/source/sidebar/paragraph/ParaPropertyPanel.src \ svx/source/stbctrls/stbctrls.src \ svx/source/svdraw/svdstr.src \ svx/source/table/table.src \ @@ -78,7 +86,6 @@ $(eval $(call gb_SrsTarget_add_files,svx/res,\ svx/source/tbxctrls/fontworkgallery.src \ svx/source/tbxctrls/grafctrl.src \ svx/source/tbxctrls/lboxctrl.src \ - svx/source/tbxctrls/linectrl.src \ svx/source/tbxctrls/tbcontrl.src \ svx/source/tbxctrls/tbunosearchcontrollers.src \ svx/source/toolbars/extrusionbar.src \ diff --git a/svx/Library_svx.mk b/svx/Library_svx.mk index 9ebfd965da0f..3089cdebd440 100644 --- a/svx/Library_svx.mk +++ b/svx/Library_svx.mk @@ -158,6 +158,47 @@ $(eval $(call gb_Library_add_exception_objects,svx,\ svx/source/mnuctrls/fntctl \ svx/source/mnuctrls/fntszctl \ svx/source/mnuctrls/SmartTagCtl \ + svx/source/sidebar/ContextChangeEventMultiplexer \ + svx/source/sidebar/EmptyPanel \ + svx/source/sidebar/nbdtmg \ + svx/source/sidebar/nbdtmgfact \ + svx/source/sidebar/PanelFactory \ + svx/source/sidebar/SelectionAnalyzer \ + svx/source/sidebar/SelectionChangeHandler \ + svx/source/sidebar/debug/ColorPanel \ + svx/source/sidebar/debug/ContextPanel \ + svx/source/sidebar/debug/NotYetImplementedPanel \ + svx/source/sidebar/text/SvxSBFontNameBox \ + svx/source/sidebar/text/TextCharacterSpacingControl \ + svx/source/sidebar/text/TextCharacterSpacingPopup \ + svx/source/sidebar/text/TextUnderlineControl \ + svx/source/sidebar/text/TextUnderlinePopup \ + svx/source/sidebar/text/TextPropertyPanel \ + svx/source/sidebar/paragraph/ParaNumberingControl \ + svx/source/sidebar/paragraph/ParaNumberingPopup \ + svx/source/sidebar/paragraph/ParaBulletsControl \ + svx/source/sidebar/paragraph/ParaBulletsPopup \ + svx/source/sidebar/paragraph/ParaLineSpacingControl \ + svx/source/sidebar/paragraph/ParaLineSpacingPopup \ + svx/source/sidebar/paragraph/ParaPropertyPanel \ + svx/source/sidebar/area/AreaPropertyPanel \ + svx/source/sidebar/area/AreaTransparencyGradientControl \ + svx/source/sidebar/area/AreaTransparencyGradientPopup \ + svx/source/sidebar/graphic/GraphicPropertyPanel \ + svx/source/sidebar/line/LinePropertyPanel \ + svx/source/sidebar/line/LineStyleValueSet \ + svx/source/sidebar/line/LineWidthControl \ + svx/source/sidebar/line/LineWidthValueSet \ + svx/source/sidebar/line/LineWidthPopup \ + svx/source/sidebar/possize/PosSizePropertyPanel \ + svx/source/sidebar/possize/SidebarDialControl \ + svx/source/sidebar/possize/SidebarDialControlBmp \ + svx/source/sidebar/tools/ColorControl \ + svx/source/sidebar/tools/ColorPopup \ + svx/source/sidebar/tools/PopupControl \ + svx/source/sidebar/tools/PopupContainer \ + svx/source/sidebar/tools/Popup \ + svx/source/sidebar/tools/ValueSetWithTextControl \ svx/source/stbctrls/pszctrl \ svx/source/stbctrls/insctrl \ svx/source/stbctrls/selctrl \ diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk index 431eedbc0fb3..2f3eaf9eaffe 100644 --- a/svx/Library_svxcore.mk +++ b/svx/Library_svxcore.mk @@ -128,6 +128,8 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\ svx/source/gallery2/galmisc \ svx/source/gallery2/galobj \ svx/source/gallery2/galtheme \ + svx/source/gallery2/GalleryControl \ + svx/source/gallery2/GallerySplitter \ svx/source/items/chrtitem \ svx/source/items/clipfmtitem \ svx/source/items/customshapeitem \ @@ -373,6 +375,7 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\ svx/source/xoutdev/xtabgrdt \ svx/source/xoutdev/xtabhtch \ svx/source/xoutdev/xtable \ + svx/source/xoutdev/XPropertyEntry \ svx/source/xoutdev/xtablend \ )) diff --git a/svx/inc/GalleryControl.hxx b/svx/inc/GalleryControl.hxx new file mode 100644 index 000000000000..0617bf16546c --- /dev/null +++ b/svx/inc/GalleryControl.hxx @@ -0,0 +1,75 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SVX_SIDEBAR_GALLERY_CONTROL_HXX +#define SVX_SIDEBAR_GALLERY_CONTROL_HXX + +#include <vcl/window.hxx> +#include <vcl/graph.hxx> +#include <tools/urlobj.hxx> +#include "svx/svxdllapi.h" + +#include <boost/scoped_ptr.hpp> + +class SfxBindings; + +class Gallery; +class GallerySplitter; +class GalleryBrowser1; +class GalleryBrowser2; +class FmFormModel; + +namespace svx { namespace sidebar { + + +class SVX_DLLPUBLIC GalleryControl : public Window +{ +public: + GalleryControl ( + SfxBindings* pBindings, + Window* pParentWindow); + virtual ~GalleryControl (void); + + sal_Bool GalleryKeyInput( const KeyEvent& rKEvt, Window* pWindow); + +private: + Gallery* mpGallery; + ::boost::scoped_ptr<GallerySplitter> mpSplitter; + ::boost::scoped_ptr<GalleryBrowser1> mpBrowser1; + ::boost::scoped_ptr<GalleryBrowser2> mpBrowser2; + Size maLastSize; + bool mbIsInitialResize; + + void InitSettings (void); + + virtual void Resize (void); + virtual void GetFocus (void); + + DECL_LINK(SplitHdl, void*); + +protected: + void ThemeSelectionHasChanged (void); + + INetURLObject GetURL (void) const; + String GetFilterName (void) const; + Graphic GetGraphic (void) const; + sal_Bool IsLinkage (void) const; +}; + +} } // end of namespace svx::sidebar + +#endif diff --git a/svx/inc/galbrws2.hxx b/svx/inc/galbrws2.hxx index 63991173b076..a3be5977e389 100644 --- a/svx/inc/galbrws2.hxx +++ b/svx/inc/galbrws2.hxx @@ -91,9 +91,12 @@ class GalleryPreview; class Menu; class SgaObject; +namespace svx { namespace sidebar { class GalleryControl; } } + class GalleryBrowser2 : public Control, public SfxListener { friend class GalleryBrowser; + friend class svx::sidebar::GalleryControl; using Control::Notify; using Window::KeyInput; @@ -144,7 +147,7 @@ public: public: - GalleryBrowser2( GalleryBrowser* pParent, const ResId& rResId, Gallery* pGallery ); + GalleryBrowser2( Window* pParent, const ResId& rResId, Gallery* pGallery ); ~GalleryBrowser2(); void SelectTheme( const String& rThemeName ); diff --git a/svx/inc/helpid.hrc b/svx/inc/helpid.hrc index b2088f61c155..9db45b80de72 100644 --- a/svx/inc/helpid.hrc +++ b/svx/inc/helpid.hrc @@ -179,6 +179,128 @@ #define HID_XMLSEC_CALL "SVX_HID_XMLSEC_CALL" #define HID_CT_THES_ALTERNATIVES "SVX_HID_CT_THES_ALTERNATIVES" +#define HID_PROPERTYPANEL_SECTIONPAGE_BEGIN "SVX_HID_PROPERTYPANEL_SECTIONPAGE_BEGIN" +#define HID_PROPERTYPANEL_TEXT_SECTION "SVX_HID_PROPERTYPANEL_TEXT_SECTION" +#define HID_PROPERTYPANEL_PARA_SECTION "SVX_HID_PROPERTYPANEL_PARA_SECTION" +#define HID_PROPERTYPANEL_AREA_SECTION "SVX_HID_PROPERTYPANEL_AREA_SECTION" +#define HID_PROPERTYPANEL_LINE_SECTION "SVX_HID_PROPERTYPANEL_LINE_SECTION" +#define HID_PPROPERTYPANEL_AREA_LB_TRGR_TYPES "SVX_HID_PPROPERTYPANEL_AREA_LB_TRGR_TYPES" +#define HID_PPROPERTYPANEL_AREA_MTR_TRANSPARENT "SVX_HID_PPROPERTYPANEL_AREA_MTR_TRANSPARENT" +#define HID_PPROPERTYPANEL_AREA_LB_FILL_TYPES "SVX_HID_PPROPERTYPANEL_AREA_LB_FILL_TYPES" +#define HID_PPROPERTYPANEL_AREA_LB_FILL_ATTR "SVX_HID_PPROPERTYPANEL_AREA_LB_FILL_ATTR" +#define HID_PPROPERTYPANEL_AREA_MTR_TRGR_CENTER_X "SVX_HID_PPROPERTYPANEL_AREA_MTR_TRGR_CENTER_X" +#define HID_PPROPERTYPANEL_AREA_MTR_TRGR_CENTER_Y "SVX_HID_PPROPERTYPANEL_AREA_MTR_TRGR_CENTER_Y" +#define HID_PPROPERTYPANEL_AREA_MTR_TRGR_ANGLE "SVX_HID_PPROPERTYPANEL_AREA_MTR_TRGR_ANGLE" +#define HID_PPROPERTYPANEL_AREA_MTR_TRGR_SVALUE "SVX_HID_PPROPERTYPANEL_AREA_MTR_TRGR_SVALUE" +#define HID_PPROPERTYPANEL_AREA_MTR_TRGR_EVALUE "SVX_HID_PPROPERTYPANEL_AREA_MTR_TRGR_EVALUE" +#define HID_PPROPERTYPANEL_AREA_MTR_TRGR_BORDER "SVX_HID_PPROPERTYPANEL_AREA_MTR_TRGR_BORDER" +#define HID_PPROPERTYPANEL_AREA_BTN_LEFT_SECOND "SVX_HID_PPROPERTYPANEL_AREA_BTN_LEFT_SECOND" +#define HID_PPROPERTYPANEL_AREA_BTN_RIGHT_FIRST "SVX_HID_PPROPERTYPANEL_AREA_BTN_RIGHT_FIRST" +#define HID_PPROPERTYPANEL_TEXT_TBX_FONT "SVX_HID_PPROPERTYPANEL_TEXT_TBX_FONT" +#define HID_PPROPERTYPANEL_TEXT_TBI_BOLD "SVX_HID_PPROPERTYPANEL_TEXT_TBI_BOLD" +#define HID_PPROPERTYPANEL_TEXT_TBI_ITALIC "SVX_HID_PPROPERTYPANEL_TEXT_TBI_ITALIC" +#define HID_PPROPERTYPANEL_TEXT_TBI_UNDERLINE "SVX_HID_PPROPERTYPANEL_TEXT_TBI_UNDERLINE" +#define HID_PPROPERTYPANEL_TEXT_TBI_STRIKEOUT "SVX_HID_PPROPERTYPANEL_TEXT_TBI_STRIKEOUT" +#define HID_PPROPERTYPANEL_TEXT_TBI_SHADOWED "SVX_HID_PPROPERTYPANEL_TEXT_TBI_SHADOWED" +#define HID_PPROPERTYPANEL_TEXT_TBX_FONTSIZE_INDE "SVX_HID_PPROPERTYPANEL_TEXT_TBX_FONTSIZE_INDE" +#define HID_PPROPERTYPANEL_TEXT_TBI_INCREASE "SVX_HID_PPROPERTYPANEL_TEXT_TBI_INCREASE" +#define HID_PPROPERTYPANEL_TEXT_TBI_DECREASE "SVX_HID_PPROPERTYPANEL_TEXT_TBI_DECREASE" +#define HID_PPROPERTYPANEL_TEXT_TBX_FONT_COLOR "SVX_HID_PPROPERTYPANEL_TEXT_TBX_FONT_COLOR" +#define HID_PPROPERTYPANEL_TEXT_TBI_FONT_COLOR "SVX_HID_PPROPERTYPANEL_TEXT_TBI_FONT_COLOR" +#define HID_PPROPERTYPANEL_TEXT_TBX_HIGHLIGHT_COLOR "SVX_HID_PPROPERTYPANEL_TEXT_TBX_HIGHLIGHT_COLOR" +#define HID_PPROPERTYPANEL_TEXT_TBI_HIGHLIGHT_COLOR "SVX_HID_PPROPERTYPANEL_TEXT_TBI_HIGHLIGHT_COLOR" +#define HID_PPROPERTYPANEL_TEXT_TBX_SCRIPT_SW "SVX_HID_PPROPERTYPANEL_TEXT_TBX_SCRIPT_SW" +#define HID_PPROPERTYPANEL_TEXT_TBI_SUPER_SW "SVX_HID_PPROPERTYPANEL_TEXT_TBI_SUPER_SW" +#define HID_PPROPERTYPANEL_TEXT_TBI_SUB_SW "SVX_HID_PPROPERTYPANEL_TEXT_TBI_SUB_SW" +#define HID_PPROPERTYPANEL_TEXT_TBX_SCRIPT "SVX_HID_PPROPERTYPANEL_TEXT_TBX_SCRIPT" +#define HID_PPROPERTYPANEL_TEXT_TBI_SUPER "SVX_HID_PPROPERTYPANEL_TEXT_TBI_SUPER" +#define HID_PPROPERTYPANEL_TEXT_TBI_SUB "SVX_HID_PPROPERTYPANEL_TEXT_TBI_SUB" +#define HID_PPROPERTYPANEL_TEXT_UNDERLINE_VS "SVX_HID_PPROPERTYPANEL_TEXT_UNDERLINE_VS" +#define HID_PPROPERTYPANEL_TEXT_COLOR_VS "SVX_HID_PPROPERTYPANEL_TEXT_COLOR_VS" +#define HID_PPROPERTYPANEL_PARA_TBX_HALIGN "SVX_HID_PPROPERTYPANEL_PARA_TBX_HALIGN" +#define HID_PPROPERTYPANEL_PARA_TBI_HALIGN_LEFT "SVX_HID_PPROPERTYPANEL_PARA_TBI_HALIGN_LEFT" +#define HID_PPROPERTYPANEL_PARA_TBI_HALIGN_CENTER "SVX_HID_PPROPERTYPANEL_PARA_TBI_HALIGN_CENTER" +#define HID_PPROPERTYPANEL_PARA_TBI_HALIGN_RIGHT "SVX_HID_PPROPERTYPANEL_PARA_TBI_HALIGN_RIGHT" +#define HID_PPROPERTYPANEL_PARA_TBI_HALIGN_JUSTIFY "SVX_HID_PPROPERTYPANEL_PARA_TBI_HALIGN_JUSTIFY" +#define HID_PPROPERTYPANEL_PARA_TBX_VALIGN "SVX_HID_PPROPERTYPANEL_PARA_TBX_VALIGN" +#define HID_PPROPERTYPANEL_PARA_TBI_VALIGN_TOP "SVX_HID_PPROPERTYPANEL_PARA_TBI_VALIGN_TOP" +#define HID_PPROPERTYPANEL_PARA_TBI_VALIGN_CENTER "SVX_HID_PPROPERTYPANEL_PARA_TBI_VALIGN_CENTER" +#define HID_PPROPERTYPANEL_PARA_TBI_VALIGN_BOT "SVX_HID_PPROPERTYPANEL_PARA_TBI_VALIGN_BOT" +#define HID_PPROPERTYPANEL_PARA_TBX_BACK_COLOR "SVX_HID_PPROPERTYPANEL_PARA_TBX_BACK_COLOR" +#define HID_PPROPERTYPANEL_PARA_TBI_BACK_COLOR "SVX_HID_PPROPERTYPANEL_PARA_TBI_BACK_COLOR" +#define HID_PPROPERTYPANEL_PARA_BACK_COLOR_VS "SVX_HID_PPROPERTYPANEL_PARA_BACK_COLOR_VS" +#define HID_PPROPERTYPANEL_LINE_TBX_WIDTH "SVX_HID_PPROPERTYPANEL_LINE_TBX_WIDTH" +#define HID_PPROPERTYPANEL_LINE_TBI_WIDTH "SVX_HID_PPROPERTYPANEL_LINE_TBI_WIDTH" +#define HID_PPROPERTYPANEL_LINE_TBX_COLOR "SVX_HID_PPROPERTYPANEL_LINE_TBX_COLOR" +#define HID_PPROPERTYPANEL_LINE_TBI_COLOR "SVX_HID_PPROPERTYPANEL_LINE_TBI_COLOR" +#define HID_PPROPERTYPANEL_LINE_TBX_STYLE "SVX_HID_PPROPERTYPANEL_LINE_TBX_STYLE" +#define HID_PPROPERTYPANEL_LINE_TBI_STYLE "SVX_HID_PPROPERTYPANEL_LINE_TBI_STYLE" +#define HID_PPROPERTYPANEL_LINE_MTR_TRANCEPARENCE "SVX_HID_PPROPERTYPANEL_LINE_MTR_TRANCEPARENCE" +#define HID_PPROPERTYPANEL_LINE_LB_START "SVX_HID_PPROPERTYPANEL_LINE_LB_START" +#define HID_PPROPERTYPANEL_LINE_LB_END "SVX_HID_PPROPERTYPANEL_LINE_LB_END" +#define HID_PPROPERTYPANEL_LINE_VS_WIDTH "SVX_HID_PPROPERTYPANEL_LINE_VS_WIDTH" +#define HID_PPROPERTYPANEL_LINE_MTR_WIDTH "SVX_HID_PPROPERTYPANEL_LINE_MTR_WIDTH" +#define HID_PPROPERTYPANEL_LINE_VS_COLOR "SVX_HID_PPROPERTYPANEL_LINE_VS_COLOR" +#define HID_PPROPERTYPANEL_LINE_VS_STYLE "SVX_HID_PPROPERTYPANEL_LINE_VS_STYLE" +#define HID_PPROPERTYPANEL_LINE_BTN_STYLE "SVX_HID_PPROPERTYPANEL_LINE_BTN_STYLE" +#define HID_PPROPERTYPANEL_TEXT_SPACING_VS "SVX_HID_PPROPERTYPANEL_TEXT_SPACING_VS" +#define HID_PPROPERTYPANEL_LINE_LB_EDGESTYLE "SVX_HID_PPROPERTYPANEL_LINE_LB_EDGESTYLE" +#define HID_PPROPERTYPANEL_LINE_LB_CAPSTYLE "SVX_HID_PPROPERTYPANEL_LINE_LB_CAPSTYLE" +//add for position and size +#define HID_PROPERTY_PANEL_POSIZE_MTR_FLD_WIDTH "SVX_HID_PROPERTY_PANEL_POSIZE_MTR_FLD_WIDTH" +#define HID_PROPERTY_PANEL_POSIZE_MTR_FLD_HEIGHT "SVX_HID_PROPERTY_PANEL_POSIZE_MTR_FLD_HEIGHT" +#define HID_PROPERTY_PANEL_POSIZE_CBX_SCALE "SVX_HID_PROPERTY_PANEL_POSIZE_CBX_SCALE" +#define HID_PROPERTY_PANEL_POSIZE_MF_HORIZONTAL "SVX_HID_PROPERTY_PANEL_POSIZE_MF_HORIZONTAL" +#define HID_PROPERTY_PANEL_POSIZE_MF_VERTICAL "SVX_HID_PROPERTY_PANEL_POSIZE_MF_VERTICAL" +#define HID_PROPERTY_PANEL_POSIZE_MTR_FLD_ANGLE "SVX_HID_PROPERTY_PANEL_POSIZE_MTR_FLD_ANGLE" +#define HID_PROPERTY_PANEL_POSIZE_TBX_FLIP "SVX_HID_PROPERTY_PANEL_POSIZE_TBX_FLIP" +#define HID_PROPERTY_PANEL_POSIZE_FLIP_VERTICAL "SVX_HID_PROPERTY_PANEL_POSIZE_FLIP_VERTICAL" +#define HID_PROPERTY_PANEL_POSIZE_FLIP_HORIZONTAL "SVX_HID_PROPERTY_PANEL_POSIZE_FLIP_HORIZONTAL" +#define HID_PROPERTY_PANEL_POSIZE_DIAL_CONTROL "SVX_HID_PROPERTY_PANEL_POSIZE_DIAL_CONTROL" +//end +//add for graphic +#define HID_PROPERTY_PANEL_GRAPHIC_MTR_BRIGHT "SVX_HID_PROPERTY_PANEL_GRAPHIC_MTR_BRIGHT" +#define HID_PROPERTY_PANEL_GRAPHIC_MTR_CONTRAST "SVX_HID_PROPERTY_PANEL_GRAPHIC_MTR_CONTRAST" +#define HID_PROPERTY_PANEL_GRAPHIC_LB_COLORMODE "SVX_HID_PROPERTY_PANEL_GRAPHIC_LB_COLORMODE" +#define HID_PROPERTY_PANEL_GRAPHIC_MTR_TRANSP "SVX_HID_PROPERTY_PANEL_GRAPHIC_MTR_TRANSP" +#define HID_PROPERTY_PANEL_GRAPHIC_MTR_RED "SVX_HID_PROPERTY_PANEL_GRAPHIC_MTR_RED" +#define HID_PROPERTY_PANEL_GRAPHIC_MTR_GREEN "SVX_HID_PROPERTY_PANEL_GRAPHIC_MTR_GREEN" +#define HID_PROPERTY_PANEL_GRAPHIC_MTR_BLUE "SVX_HID_PROPERTY_PANEL_GRAPHIC_MTR_BLUE" +#define HID_PROPERTY_PANEL_GRAPHIC_MTR_GAMMA "SVX_HID_PROPERTY_PANEL_GRAPHIC_MTR_GAMMA" +//end + +#define HID_PROPERTYPANEL_POSIZE_SECTION "SVX_HID_PROPERTYPANEL_POSIZE_SECTION" +#define HID_PROPERTYPANEL_GRAPHIC_SECTION "SVX_HID_PROPERTYPANEL_GRAPHIC_SECTION" + + +#define HID_PPROPERTYPANEL_PARA_TBX_NUM_BULLET "SVX_HID_PPROPERTYPANEL_PARA_TBX_NUM_BULLET" +#define HID_PPROPERTYPANEL_PARA_TBI_NUM "SVX_HID_PPROPERTYPANEL_PARA_TBI_NUM" +#define HID_PPROPERTYPANEL_PARA_TBI_BULLET "SVX_HID_PPROPERTYPANEL_PARA_TBI_BULLET" +#define HID_PPROPERTYPANEL_PARA_TBX_INC_DEC "SVX_HID_PPROPERTYPANEL_PARA_TBX_INC_DEC" +#define HID_PPROPERTYPANEL_PARA_TBI_INC "SVX_HID_PPROPERTYPANEL_PARA_TBI_INC" +#define HID_PPROPERTYPANEL_PARA_TBI_DEC "SVX_HID_PPROPERTYPANEL_PARA_TBI_DEC" +#define HID_PPROPERTYPANEL_PARA_TBX_INDENT_INC_DEC "SVX_HID_PPROPERTYPANEL_PARA_TBX_INDENT_INC_DEC" +#define HID_PPROPERTYPANEL_PARA_TBI_INDENT_INC "SVX_HID_PPROPERTYPANEL_PARA_TBI_INDENT_INC" +#define HID_PPROPERTYPANEL_PARA_TBI_INDENT_DEC "SVX_HID_PPROPERTYPANEL_PARA_TBI_INDENT_DEC" +#define HID_PPROPERTYPANEL_PARA_TBI_INDENT_HANG "SVX_HID_PPROPERTYPANEL_PARA_TBI_INDENT_HANG" +#define HID_PPROPERTYPANEL_PARA_TBX_INDENTP_INC_DEC "SVX_HID_PPROPERTYPANEL_PARA_TBX_INDENTP_INC_DEC" +#define HID_PPROPERTYPANEL_PARA_TBI_INDENTP_INC "SVX_HID_PPROPERTYPANEL_PARA_TBI_INDENTP_INC" +#define HID_PPROPERTYPANEL_PARA_TBI_INDENTP_DEC "SVX_HID_PPROPERTYPANEL_PARA_TBI_INDENTP_DEC" +#define HID_PPROPERTYPANEL_PARA_TBI_INDENTP_HANG "SVX_HID_PPROPERTYPANEL_PARA_TBI_INDENTP_HANG" +#define HID_PPROPERTYPANEL_PARA_TBX_LINESP "SVX_HID_PPROPERTYPANEL_PARA_TBX_LINESP" +#define HID_PPROPERTYPANEL_PARA_TBI_LINESP "SVX_HID_PPROPERTYPANEL_PARA_TBI_LINESP" +#define HID_PPROPERTYPANEL_AREA_TBX_COLOR "SVX_HID_PPROPERTYPANEL_AREA_TBX_COLOR" +#define HID_PPROPERTYPANEL_AREA_TBI_COLOR "SVX_HID_PPROPERTYPANEL_AREA_TBI_COLOR" +#define HID_PPROPERTYPANEL_AREA_COLOR_VS "SVX_HID_PPROPERTYPANEL_AREA_COLOR_VS" +//add end + +#define HID_PPROPERTYPANEL_AREA_TBX_GRADIENT "SVX_HID_PPROPERTYPANEL_AREA_TBX_GRADIENT" +#define HID_PPROPERTYPANEL_AREA_TBI_GRADIENT "SVX_HID_PPROPERTYPANEL_AREA_TBI_GRADIENT" +#define HID_PROPERTYPANEL_SECTIONPAGE_END "SVX_HID_PROPERTYPANEL_SECTIONPAGE_END" + +#define HID_PPROPERTYPANEL_AREA_LB_FILL_TYPES "SVX_HID_PPROPERTYPANEL_AREA_LB_FILL_TYPES" +#define HID_PPROPERTYPANEL_AREA_LB_FILL_ATTR "SVX_HID_PPROPERTYPANEL_AREA_LB_FILL_ATTR" + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/inc/sidebar/PanelFactory.hxx b/svx/inc/sidebar/PanelFactory.hxx new file mode 100644 index 000000000000..bfb626f08c20 --- /dev/null +++ b/svx/inc/sidebar/PanelFactory.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 SVX_SIDEBAR_PANEL_FACTORY_HXX +#define SVX_SIDEBAR_PANEL_FACTORY_HXX + +#include <cppuhelper/compbase1.hxx> +#include <cppuhelper/basemutex.hxx> + +#include <com/sun/star/ui/XUIElementFactory.hpp> + +#include <boost/noncopyable.hpp> + + +namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; + + +namespace svx { namespace sidebar { + +namespace +{ + typedef ::cppu::WeakComponentImplHelper1 < + css::ui::XUIElementFactory + > PanelFactoryInterfaceBase; +} + + +class PanelFactory + : private ::boost::noncopyable, + private ::cppu::BaseMutex, + public PanelFactoryInterfaceBase +{ +public: + static ::rtl::OUString SAL_CALL getImplementationName (void); + static cssu::Reference<cssu::XInterface> SAL_CALL createInstance ( + const cssu::Reference<css::lang::XMultiServiceFactory>& rxFactory); + static cssu::Sequence<rtl::OUString> SAL_CALL getSupportedServiceNames (void); + + PanelFactory (void); + virtual ~PanelFactory (void); + + // XUIElementFactory + cssu::Reference<css::ui::XUIElement> SAL_CALL createUIElement ( + const ::rtl::OUString& rsResourceURL, + const ::cssu::Sequence<css::beans::PropertyValue>& rArguments) + throw( + css::container::NoSuchElementException, + css::lang::IllegalArgumentException, + cssu::RuntimeException); +}; + + +} } // end of namespace svx::sidebar + +#endif diff --git a/svx/inc/svx/AffineMatrixItem.hxx b/svx/inc/svx/AffineMatrixItem.hxx new file mode 100644 index 000000000000..20fa4ae8f15b --- /dev/null +++ b/svx/inc/svx/AffineMatrixItem.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 _SVX_AFFINEMATRIXITEM_HXX +#define _SVX_AFFINEMATRIXITEM_HXX + +#include <svx/svxdllapi.h> +#include <svl/poolitem.hxx> +#include <com/sun/star/geometry/AffineMatrix2D.hpp> + +//--------------------- +// class AffineMatrixItem +//--------------------- + +class SVX_DLLPUBLIC AffineMatrixItem : public SfxPoolItem +{ +private: + com::sun::star::geometry::AffineMatrix2D maMatrix; + +public: + TYPEINFO(); + AffineMatrixItem(const com::sun::star::geometry::AffineMatrix2D* pMatrix = 0); + AffineMatrixItem(SvStream& rIn); + AffineMatrixItem(const AffineMatrixItem&); + virtual ~AffineMatrixItem(); + + virtual int operator==(const SfxPoolItem&) const; + virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const; + virtual SfxPoolItem* Create( SvStream& rIn, sal_uInt16 nVer ) const; + virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const; + + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + + const com::sun::star::geometry::AffineMatrix2D& GetAffineMatrix2D() const; +}; + +#endif // _SVX_AFFINEMATRIXITEM_HXX + +// eof diff --git a/svx/inc/svx/XPropertyEntry.hxx b/svx/inc/svx/XPropertyEntry.hxx new file mode 100644 index 000000000000..32b5b409c27b --- /dev/null +++ b/svx/inc/svx/XPropertyEntry.hxx @@ -0,0 +1,47 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _XPROPERTYENTRY_HXX +#define _XPROPERTYENTRY_HXX + +#include <svx/svxdllapi.h> +#include <tools/string.hxx> +#include <vcl/bitmap.hxx> + +// --------------------- +// class XPropertyEntry + +class SVX_DLLPUBLIC XPropertyEntry +{ +private: + String maName; + Bitmap maUiBitmap; + +protected: + XPropertyEntry(const String& rName); + XPropertyEntry(const XPropertyEntry& rOther); + +public: + virtual ~XPropertyEntry(); + + void SetName(const String& rName) { maName = rName; } + const String& GetName() const { return maName; } + void SetUiBitmap(const Bitmap& rUiBitmap) { maUiBitmap = rUiBitmap; } + const Bitmap& GetUiBitmap() const { return maUiBitmap; } +}; + +#endif // _XPROPERTYENTRY_HXX diff --git a/svx/inc/svx/nbdtmg.hxx b/svx/inc/svx/nbdtmg.hxx new file mode 100644 index 000000000000..eb75368a5274 --- /dev/null +++ b/svx/inc/svx/nbdtmg.hxx @@ -0,0 +1,376 @@ +/* + * 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 _NBDTMG_HXX +#define _NBDTMG_HXX +#include "svx/svxdllapi.h" +#include <boost/shared_ptr.hpp> +#include <vector> +#include <editeng/numitem.hxx> +#include <vcl/font.hxx> + +namespace svx { namespace sidebar { + +#define DEFAULT_BULLET_TYPES 8 +#define DEFAULT_NONE 10 +#define DEFAULT_NUM_TYPE_MEMBER 5 +#define DEFAULT_NUM_VALUSET_COUNT 8 +#define DEFAULT_NUMBERING_CACHE_FORMAT_VERSION 0x10 + +typedef sal_uInt16 NBOType; +namespace eNBOType +{ + const NBOType BULLETS = 0x01; + const NBOType GRAPHICBULLETS = 0x02; + const NBOType NUMBERING = 0x03; + const NBOType OUTLINE = 0x04; + const NBOType MIXBULLETS = 0x05; +} + +typedef sal_uInt16 NBType; +namespace eNBType +{ + const NBOType BULLETS = 0x01; + const NBOType GRAPHICBULLETS = 0x02; +} + +class SVX_DLLPUBLIC NumSettings_Impl +{ + public: + short nNumberType; + short nParentNumbering; + SvxNumberFormat::LabelFollowedBy eLabelFollowedBy; + long nTabValue; + SvxAdjust eNumAlign; + long nNumAlignAt; + long nNumIndentAt; + rtl::OUString sPrefix; + rtl::OUString sSuffix; + rtl::OUString sBulletChar; + rtl::OUString sBulletFont; + SvxBrushItem *pBrushItem; + Size aSize; + + public: + NumSettings_Impl() + : nNumberType(0) + , nParentNumbering(0) + , pBrushItem(0) + , aSize(0,0) + {} + ~NumSettings_Impl(){} +}; + +typedef NumSettings_Impl* NumSettings_ImplPtr; +typedef std::vector< boost::shared_ptr<NumSettings_Impl> > NumSettingsArr_Impl; + +class SVX_DLLPUBLIC BulletsSettings +{ + public: + sal_Bool bIsCustomized; + rtl::OUString sDescription; + NBType eType; + public: + BulletsSettings(NBType eTy) : + bIsCustomized(sal_False), + eType(eTy) + {} + virtual ~BulletsSettings(){} +}; + +class SVX_DLLPUBLIC BulletsSettings_Impl:public BulletsSettings +{ + public: + sal_Unicode cBulletChar; + //rtl::OUString sBulletFont; + Font aFont; + + public: + BulletsSettings_Impl(NBType eTy) : + BulletsSettings(eTy) + {} + virtual ~BulletsSettings_Impl(){} +}; + +class SVX_DLLPUBLIC GrfBulDataRelation: public BulletsSettings +{ + public: + String sGrfName; + sal_uInt16 nTabIndex; + sal_uInt16 nGallaryIndex; + const Graphic* pGrfObj; + Size aSize; + GrfBulDataRelation(NBType eTy): + BulletsSettings(eTy), + nTabIndex((sal_uInt16)0xFFFF), + nGallaryIndex((sal_uInt16)0xFFFF), + pGrfObj(0), + aSize(0,0) + {} + virtual ~GrfBulDataRelation(){} +}; + +class SVX_DLLPUBLIC MixBulletsSettings_Impl +{ + public: + NBType eType; + sal_uInt16 nIndex; //index in the tab page display + sal_uInt16 nIndexDefault; + BulletsSettings* pBullets; + public: + MixBulletsSettings_Impl(NBType eTy) : + eType(eTy), + nIndex((sal_uInt16)0xFFFF), + nIndexDefault((sal_uInt16)0xFFFF), + pBullets(0) + {} + ~MixBulletsSettings_Impl(){} +}; + +class SVX_DLLPUBLIC NumberSettings_Impl +{ + public: + sal_Bool bIsCustomized; + rtl::OUString sDescription; + sal_uInt16 nIndex; //index in the tab page display + sal_uInt16 nIndexDefault; + NumSettings_Impl *pNumSetting; + public: + NumberSettings_Impl() : + bIsCustomized(sal_False), + nIndex((sal_uInt16)0xFFFF), + nIndexDefault((sal_uInt16)0xFFFF), + pNumSetting(NULL) + {} + ~NumberSettings_Impl(){} +}; + +typedef NumberSettings_Impl* NumberSettings_ImplPtr; +typedef std::vector< boost::shared_ptr<NumberSettings_Impl> > NumberSettingsArr_Impl; + +class SVX_DLLPUBLIC OutlineSettings_Impl +{ + public: + sal_Bool bIsCustomized; + rtl::OUString sDescription; + NumSettingsArr_Impl *pNumSettingsArr; + public: + OutlineSettings_Impl() : + bIsCustomized(sal_False), + pNumSettingsArr(NULL) + {} + ~OutlineSettings_Impl(){ + } +}; + +class SVX_DLLPUBLIC NBOTypeMgrBase +{ + public: + NBOType eType; + private: + const SfxItemSet* pSet; + SfxMapUnit eCoreUnit; + //Sym3_2508 store the attributes passed from pSet + String aNumCharFmtName; + void StoreBulCharFmtName_impl(); + void StoreMapUnit_impl(); + + public: + NBOTypeMgrBase(const NBOType aType):eType(aType),pSet(0),eCoreUnit(SFX_MAPUNIT_TWIP),aNumCharFmtName(String()){} + NBOTypeMgrBase(const NBOType aType,const SfxItemSet* pArg):eType(aType),pSet(pArg),eCoreUnit(SFX_MAPUNIT_TWIP),aNumCharFmtName(String()){} + NBOTypeMgrBase(const NBOTypeMgrBase& aTypeMgr){eType = aTypeMgr.eType;pSet = aTypeMgr.pSet;eCoreUnit = aTypeMgr.eCoreUnit;aNumCharFmtName = aTypeMgr.aNumCharFmtName; } + virtual ~NBOTypeMgrBase() {} + virtual void Init()=0; + virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex=0)=0; + virtual sal_Bool RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF)=0; + virtual sal_Bool ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF, sal_Bool isDefault=false,sal_Bool isResetSize=false)=0; + virtual String GetDescription(sal_uInt16 nIndex,sal_Bool isDefault=false)=0; + virtual sal_Bool IsCustomized(sal_uInt16 nIndex)=0; + sal_uInt16 IsSingleLevel(sal_uInt16 nCurLevel); + const SfxItemSet* GetItems() { return pSet;} + //Sym3_2508 store the attributes passed from pSet + void SetItems(const SfxItemSet* pArg) { pSet = pArg;StoreBulCharFmtName_impl();StoreMapUnit_impl();} + protected: + String GetBulCharFmtName(); + SfxMapUnit GetMapUnit(); + protected: + sal_Bool bIsLoading; + void ImplLoad(String filename); + void ImplStore(String filename); + +}; + + +class SVX_DLLPUBLIC BulletsTypeMgr: public NBOTypeMgrBase +{ + friend class OutlineTypeMgr; + friend class NumberingTypeMgr; + public: + static sal_Unicode aDynamicBulletTypes[DEFAULT_BULLET_TYPES]; + static sal_Unicode aDynamicRTLBulletTypes[DEFAULT_BULLET_TYPES]; + static BulletsSettings_Impl* pActualBullets[DEFAULT_BULLET_TYPES]; + static BulletsTypeMgr* _instance; + public: + BulletsTypeMgr(const NBOType aType); + BulletsTypeMgr(const NBOType aType,const SfxItemSet* pArg); + BulletsTypeMgr(const BulletsTypeMgr& aTypeMgr); + virtual ~BulletsTypeMgr() {} + virtual void Init(); + virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex=0); + virtual sal_Bool RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF); + virtual sal_Bool ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF,sal_Bool isDefault=false,sal_Bool isResetSize=false); + virtual String GetDescription(sal_uInt16 nIndex,sal_Bool isDefault=false); + virtual sal_Bool IsCustomized(sal_uInt16 nIndex); + sal_Unicode GetBulChar(sal_uInt16 nIndex); + Font GetBulCharFont(sal_uInt16 nIndex); + static BulletsTypeMgr* GetInstance() + { + if ( _instance == 0 ) + { + _instance = new BulletsTypeMgr(eNBOType::BULLETS); + } + + return _instance; + } + +}; + +class SVX_DLLPUBLIC GraphyicBulletsTypeMgr: public NBOTypeMgrBase +{ + friend class OutlineTypeMgr; + friend class NumberingTypeMgr; + public: + typedef std::vector<GrfBulDataRelation*> ListType; + ListType aGrfDataLst; + static GraphyicBulletsTypeMgr* _instance; + public: + GraphyicBulletsTypeMgr(const NBOType aType); + GraphyicBulletsTypeMgr(const NBOType aType,const SfxItemSet* pArg); + GraphyicBulletsTypeMgr(const GraphyicBulletsTypeMgr& aTypeMgr); + virtual ~GraphyicBulletsTypeMgr(); + virtual void Init(); + virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex=0); + virtual sal_Bool RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF); + virtual sal_Bool ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF,sal_Bool isDefault=false,sal_Bool isResetSize=false); + virtual String GetDescription(sal_uInt16 nIndex,sal_Bool isDefault=false); + virtual sal_Bool IsCustomized(sal_uInt16 nIndex); + String GetGrfName(sal_uInt16 nIndex); + static GraphyicBulletsTypeMgr* GetInstance() + { + if ( _instance == 0 ) + { + _instance = new GraphyicBulletsTypeMgr(eNBOType::BULLETS); + } + + return _instance; + } + +}; + +class SVX_DLLPUBLIC MixBulletsTypeMgr: public NBOTypeMgrBase +{ + friend class OutlineTypeMgr; + friend class NumberingTypeMgr; + public: + static MixBulletsSettings_Impl* pActualBullets[DEFAULT_BULLET_TYPES]; + static MixBulletsSettings_Impl* pDefaultActualBullets[DEFAULT_BULLET_TYPES]; + static MixBulletsTypeMgr* _instance; + public: + MixBulletsTypeMgr(const NBOType aType); + MixBulletsTypeMgr(const NBOType aType,const SfxItemSet* pArg); + MixBulletsTypeMgr(const MixBulletsTypeMgr& aTypeMgr); + virtual ~MixBulletsTypeMgr() {} + virtual void Init(); + virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex=0); + virtual sal_Bool RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF); + virtual sal_Bool ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF,sal_Bool isDefault=false,sal_Bool isResetSize=false); + virtual String GetDescription(sal_uInt16 nIndex,sal_Bool isDefault=false); + virtual sal_Bool IsCustomized(sal_uInt16 nIndex); + static MixBulletsTypeMgr* GetInstance() + { + if ( _instance == 0 ) + { + _instance = new MixBulletsTypeMgr(eNBOType::MIXBULLETS); + } + + return _instance; + } + +}; + +class SVX_DLLPUBLIC NumberingTypeMgr: public NBOTypeMgrBase +{ + public: + //NumSettingsArr_Impl* pNumSettingsArr; + NumberSettingsArr_Impl* pNumberSettingsArr; + NumberSettingsArr_Impl* pDefaultNumberSettingsArr; + static NumberingTypeMgr* _instance; + public: + NumberingTypeMgr(const NBOType aType); + NumberingTypeMgr(const NBOType aType,const SfxItemSet* pArg); + NumberingTypeMgr(const NumberingTypeMgr& aTypeMgr); + virtual ~NumberingTypeMgr() {} + virtual void Init(); + virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex=0); + virtual sal_Bool RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF); + virtual sal_Bool ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF,sal_Bool isDefault=false,sal_Bool isResetSize=false); + virtual String GetDescription(sal_uInt16 nIndex,sal_Bool isDefault=false); + virtual sal_Bool IsCustomized(sal_uInt16 nIndex); + sal_uInt16 GetNumCount() const; + NumberSettings_Impl* GetNumSettingByIndex(sal_uInt16 nIndex) const; + static NumberingTypeMgr* GetInstance() + { + if ( _instance == 0 ) + { + _instance = new NumberingTypeMgr(eNBOType::NUMBERING); + } + + return _instance; + } +}; + +class SVX_DLLPUBLIC OutlineTypeMgr: public NBOTypeMgrBase +{ + public: + //NumSettingsArr_Impl* pNumSettingsArrs[DEFAULT_NUM_VALUSET_COUNT]; + OutlineSettings_Impl* pOutlineSettingsArrs[DEFAULT_NUM_VALUSET_COUNT]; + OutlineSettings_Impl* pDefaultOutlineSettingsArrs[DEFAULT_NUM_VALUSET_COUNT]; + static OutlineTypeMgr* _instance; + public: + OutlineTypeMgr(const NBOType aType); + OutlineTypeMgr(const NBOType aType,const SfxItemSet* pArg); + OutlineTypeMgr(const OutlineTypeMgr& aTypeMgr); + virtual ~OutlineTypeMgr() {} + virtual void Init(); + virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex=0); + virtual sal_Bool RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF); + virtual sal_Bool ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF,sal_Bool isDefault=false,sal_Bool isResetSize=false); + virtual String GetDescription(sal_uInt16 nIndex,sal_Bool isDefault=false); + virtual sal_Bool IsCustomized(sal_uInt16 nIndex); + static OutlineTypeMgr* GetInstance() + { + if ( _instance == 0 ) + { + _instance = new OutlineTypeMgr(eNBOType::OUTLINE); + } + + return _instance; + } +}; +}} +#endif + diff --git a/svx/inc/svx/nbdtmgfact.hxx b/svx/inc/svx/nbdtmgfact.hxx new file mode 100644 index 000000000000..76638d996a98 --- /dev/null +++ b/svx/inc/svx/nbdtmgfact.hxx @@ -0,0 +1,33 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _NBDTMGFACT_HXX +#define _NBDTMGFACT_HXX +#ifndef _NBDTMG_HXX +#include "nbdtmg.hxx" +#endif +namespace svx { namespace sidebar { +class SVX_DLLPUBLIC NBOutlineTypeMgrFact +{ +public: + static NBOTypeMgrBase* CreateInstance(const NBOType aType); + NBOutlineTypeMgrFact(); + virtual ~NBOutlineTypeMgrFact() {} +}; +}} +#endif + diff --git a/svx/source/table/tablecontroller.hxx b/svx/inc/svx/sdr/table/tablecontroller.hxx index c25b2f1b093b..5efdd875968e 100644 --- a/svx/source/table/tablecontroller.hxx +++ b/svx/inc/svx/sdr/table/tablecontroller.hxx @@ -28,7 +28,7 @@ #include <svx/selectioncontroller.hxx> #include <svx/svdotable.hxx> #include <svx/svdview.hxx> -#include <tablemodel.hxx> +//#include <tablemodel.hxx> class SdrObjEditView; class SdrObject; @@ -36,6 +36,8 @@ class SfxItemSet; namespace sdr { namespace table { +class TableModel; + class SVX_DLLPUBLIC SvxTableController: public sdr::SelectionController { public: @@ -131,7 +133,8 @@ private: DECL_LINK( UpdateHdl, void * ); - TableModelRef mxTable; + //TableModelRef mxTable; + rtl::Reference< TableModel > mxTable; CellPos maCursorFirstPos; CellPos maCursorLastPos; diff --git a/svx/inc/svx/sidebar/ColorControl.hxx b/svx/inc/svx/sidebar/ColorControl.hxx new file mode 100644 index 000000000000..58ab534c1aa1 --- /dev/null +++ b/svx/inc/svx/sidebar/ColorControl.hxx @@ -0,0 +1,82 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "svx/sidebar/PopupControl.hxx" + +#include <svtools/valueset.hxx> +#include <boost/function.hpp> + +class Window; +class SfxBindings; +class RedId; +class FloatingWindow; + + +namespace svx { namespace sidebar { + +/** The ColorControl uses a ValueSet control for displaying all named + colors in a matrix. +*/ +class SVX_DLLPUBLIC ColorControl + : public PopupControl +{ +public: + /** Create a new ColorControl object. + @param rControlResId + The resource id for the whole color control. + @param rNoColorGetter + A functor for getting the color which will be returned when the + WB_NONEFIELD is used and got selected + @param rColorSetter + A functor for setting the color that is selected by the + user. + @param pNoColorStringResId + Resource id of an optional string for the "no color" + string. When a value is given then a + field/button is created above the color matrix for + selecting "no color" ie. transparent. + When zero is given then no such field is created. + */ + ColorControl ( + Window* pParent, + SfxBindings* pBindings, + const ResId& rControlResId, + const ResId& rValueSetResId, + const ::boost::function<Color(void)>& rNoColorGetter, + const ::boost::function<void(String&,Color)>& rColorSetter, + FloatingWindow* pFloatingWindow, + const ResId* pNoColorStringResId); + virtual ~ColorControl (void); + + void GetFocus (void); + void SetCurColorSelect ( + const Color aCol, + const bool bAvl); + +private: + SfxBindings* mpBindings; + ValueSet maVSColor; + FloatingWindow* mpFloatingWindow; + const String msNoColorString; + ::boost::function<Color(void)> maNoColorGetter; + ::boost::function<void(String&,Color)> maColorSetter; + + void FillColors (void); + DECL_LINK(VSSelectHdl, void *); +}; + +} } // end of namespace svx::sidebar diff --git a/svx/inc/svx/sidebar/ColorPopup.hxx b/svx/inc/svx/sidebar/ColorPopup.hxx new file mode 100644 index 000000000000..cdac568c7fd5 --- /dev/null +++ b/svx/inc/svx/sidebar/ColorPopup.hxx @@ -0,0 +1,51 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_SIDEBAR_COLOR_POPUP_HXX_ +#define _SVX_SIDEBAR_COLOR_POPUP_HXX_ + +#include "svx/sidebar/Popup.hxx" + +#include <tools/color.hxx> + + +namespace svx { namespace sidebar { + +/** Popup control that displays all named colors in a matrix. + The number of rows and columns of the matrix are computed from + the number of named colors so that both have roughly the same + value. + + The ColorPopup uses ColorControl as control for its content. +*/ +class SVX_DLLPUBLIC ColorPopup + : public Popup +{ +public : + ColorPopup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator); + virtual ~ColorPopup (void); + + void SetCurrentColor ( + const Color aCurrentColor, + const bool bIsColorAvailable); +}; + +} } // end of namespace svx::sidebar + +#endif diff --git a/svx/inc/svx/sidebar/ContextChangeEventMultiplexer.hxx b/svx/inc/svx/sidebar/ContextChangeEventMultiplexer.hxx new file mode 100644 index 000000000000..5075cdac70be --- /dev/null +++ b/svx/inc/svx/sidebar/ContextChangeEventMultiplexer.hxx @@ -0,0 +1,65 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_SIDEBAR_CONTEXT_CHANGE_EVENT_MULTIPLEXER_HXX_ +#define _SVX_SIDEBAR_CONTEXT_CHANGE_EVENT_MULTIPLEXER_HXX_ + +#include "svx/svxdllapi.h" +#include <sfx2/sidebar/EnumContext.hxx> +#include <com/sun/star/frame/XController.hpp> +#include <com/sun/star/frame/XFrame.hpp> + +namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; + +class SfxViewShell; + +/** Convenience frontend for com::sun::star::ui::ContextChangeEventMultiplexer +*/ +class SVX_DLLPUBLIC ContextChangeEventMultiplexer +{ +public: + /** Notify the activation of a context. + @param rxController + This controller is used to determine the module (ie + application like Writer or Calc). + @param eContext + The activated context. + */ + static void NotifyContextChange ( + const cssu::Reference<css::frame::XController>& rxController, + const ::sfx2::sidebar::EnumContext::Context eContext); + + /** Notify the activation of a context. + @param pViewShell + This view shell is used to determine the module (ie + application like Writer or Calc). When <NULL/> then no + notification is made. + @param eContext + The activated context. + */ + static void NotifyContextChange ( + SfxViewShell* pViewShell, + const ::sfx2::sidebar::EnumContext::Context eContext); + +private: + static ::rtl::OUString GetModuleName ( + const cssu::Reference<css::frame::XFrame>& rxFrame); +}; + +#endif + diff --git a/svx/inc/svx/sidebar/Popup.hxx b/svx/inc/svx/sidebar/Popup.hxx new file mode 100644 index 000000000000..25571f11a5a7 --- /dev/null +++ b/svx/inc/svx/sidebar/Popup.hxx @@ -0,0 +1,103 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_SIDEBAR_POPUP_HXX_ +#define _SVX_SIDEBAR_POPUP_HXX_ + +#include "svx/svxdllapi.h" +#include <rtl/ustring.hxx> +#include <tools/link.hxx> + +#include <boost/function.hpp> +#include <boost/scoped_ptr.hpp> + +class Window; +class ToolBox; + +namespace svx { namespace sidebar { + +class PopupContainer; +class PopupControl; + +/** A wrapper around a PopupContainer and a PopupControl object. + Usually used as drop down for a toolbox. Use Show() to start + drop down mode and Hide() to end it. +*/ +class SVX_DLLPUBLIC Popup +{ +public : + /** Create a Popup wrapper object. + @param pParent + Parent window of the PopupContainer, which in turn is the + parent of the PopupControl. + @param rControlCreator + A functor that is called to create the PopupControl object + (usually an instance of a class derived from + PopupControl). + */ + Popup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator, + const ::rtl::OUString& rsAccessibleName); + virtual ~Popup (void); + + /** Show the popup. + @rToolBox + The tool box is used to determine the position at which + the popup is displayed. + */ + void Show (ToolBox& rToolBox); + + /** Hide the popup. + This method is called automatically when eg. the user clicks + outside the popup or when the ESC-key is pressed. The + application can call Hide() when the popup should be closed + for other, non-standard reasons. + */ + void Hide (void); + + /** If you want to be informed when the popup closes then add a + callback that is called after that. + */ + void SetPopupModeEndHandler (const ::boost::function<void(void)>& rCallback); + +protected: + ::boost::scoped_ptr<PopupControl> mpControl; + + /** Make sure that both PopupContainer and PopupControl objects + exist. Calls the maControlCreator functor if necessary. + */ + void ProvideContainerAndControl (void); + + /** A derived specialisation class can override this method to do + additional work. + */ + virtual void CreateContainerAndControl (void); + +private: + Window* mpParent; + ::boost::function<PopupControl*(PopupContainer*)> maControlCreator; + ::boost::function<void(void)> maPopupModeEndCallback; + const ::rtl::OUString msAccessibleName; + ::boost::scoped_ptr<PopupContainer> mpContainer; + + DECL_LINK(PopupModeEndHandler, void*); +}; + +} } // end of namespace svx::sidebar + +#endif diff --git a/svx/inc/svx/sidebar/PopupContainer.hxx b/svx/inc/svx/sidebar/PopupContainer.hxx new file mode 100644 index 000000000000..1b33988c50fd --- /dev/null +++ b/svx/inc/svx/sidebar/PopupContainer.hxx @@ -0,0 +1,44 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_SIDEBAR_POPUP_CONTAINER_HXX_ +#define _SVX_SIDEBAR_POPUP_CONTAINER_HXX_ + +#include "svx/svxdllapi.h" +#include <vcl/floatwin.hxx> + +namespace svx { namespace sidebar { + +/** Simple base class for popup container windows used by sidebar + related drop downs. + It initializes the underlying floating window with the right + flags and closes the drop down when appropriate. +*/ +class SVX_DLLPUBLIC PopupContainer + : public FloatingWindow +{ +public: + PopupContainer (Window* pParent); + virtual ~PopupContainer (void); + + virtual long Notify (NotifyEvent& rNEvt); +}; + + +} } // end of namespace svx::sidebar + +#endif diff --git a/svx/inc/svx/sidebar/PopupControl.hxx b/svx/inc/svx/sidebar/PopupControl.hxx new file mode 100644 index 000000000000..de116750109f --- /dev/null +++ b/svx/inc/svx/sidebar/PopupControl.hxx @@ -0,0 +1,47 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_SIDEBAR_POPUP_CONTROL_HXX_ +#define _SVX_SIDEBAR_POPUP_CONTROL_HXX_ + +#include "svx/svxdllapi.h" +#include <vcl/ctrl.hxx> + +namespace svx { namespace sidebar { + +/** Base class for sidebar related popup controls. + A PopupControl is typically a child of a PopupContainer and + provides the actual content of a popup. + This base class takes care of painting the proper background and + border for sidebar popups. + Specialize by derivation. +*/ +class SVX_DLLPUBLIC PopupControl + : public Control +{ +public : + PopupControl ( + Window* pParent, + const ResId& rResId); + virtual ~PopupControl (void); + + virtual void Paint (const Rectangle& rect); +}; + +} } // end of namespace svx::sidebar + +#endif diff --git a/svx/inc/svx/sidebar/SelectionAnalyzer.hxx b/svx/inc/svx/sidebar/SelectionAnalyzer.hxx new file mode 100644 index 000000000000..05f8c0b4ee9d --- /dev/null +++ b/svx/inc/svx/sidebar/SelectionAnalyzer.hxx @@ -0,0 +1,62 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_SIDEBAR_SELECTION_ANALYZER_HXX_ +#define _SVX_SIDEBAR_SELECTION_ANALYZER_HXX_ + +#include <sfx2/sidebar/EnumContext.hxx> +#include "svx/svxdllapi.h" + +class SdrMarkList; +class SdrObject; + + +namespace svx { namespace sidebar { + +class SVX_DLLPUBLIC SelectionAnalyzer +{ +public : + static sfx2::sidebar::EnumContext::Context GetContextForSelection_SC ( + const SdrMarkList& rMarkList); + static sfx2::sidebar::EnumContext::Context GetContextForSelection_SD ( + const SdrMarkList& rMarkList, + const bool bIsMasterPage, + const bool bIsHandoutPage, + const bool bIsNotesPage); + +private: + static sfx2::sidebar::EnumContext::Context GetContextForObjectId_SC ( + const sal_uInt16 nObjectId); + static sfx2::sidebar::EnumContext::Context GetContextForObjectId_SD ( + const sal_uInt16 nObjectId, + const bool bIsHandoutPage, + const bool bIsNotesPage); + static sal_uInt32 GetInventorTypeFromMark ( + const SdrMarkList& rMarkList); + static sal_uInt16 GetObjectTypeFromMark ( + const SdrMarkList& rMarkList); + static sal_uInt16 GetObjectTypeFromGroup ( + const SdrObject* pObj); + static bool IsShapeType ( + const sal_uInt16 nType); + static bool IsTextObjType ( + const sal_uInt16 nType); +}; + +} } // end of namespace svx::sidebar + +#endif diff --git a/svx/inc/svx/sidebar/SelectionChangeHandler.hxx b/svx/inc/svx/sidebar/SelectionChangeHandler.hxx new file mode 100644 index 000000000000..29116e5249b8 --- /dev/null +++ b/svx/inc/svx/sidebar/SelectionChangeHandler.hxx @@ -0,0 +1,85 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_SIDEBAR_SELECTION_CHANGE_HANDLER_HXX_ +#define _SVX_SIDEBAR_SELECTION_CHANGE_HANDLER_HXX_ + +#include "svx/svxdllapi.h" +#include <sfx2/sidebar/EnumContext.hxx> +#include <com/sun/star/frame/XController.hpp> +#include <com/sun/star/view/XSelectionSupplier.hpp> +#include <com/sun/star/view/XSelectionChangeListener.hpp> + +#include <cppuhelper/compbase1.hxx> +#include <cppuhelper/basemutex.hxx> + +#include <boost/noncopyable.hpp> +#include <boost/function.hpp> + +namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; + + +class SdrMarkView; + + +namespace svx { namespace sidebar { + +namespace { + typedef ::cppu::WeakComponentImplHelper1 < + css::view::XSelectionChangeListener + > SelectionChangeHandlerInterfaceBase; +} + + +class SVX_DLLPUBLIC SelectionChangeHandler + : private ::boost::noncopyable, + private ::cppu::BaseMutex, + public SelectionChangeHandlerInterfaceBase +{ +public: + SelectionChangeHandler ( + const boost::function<sfx2::sidebar::EnumContext::Context(void)>& rSelectionChangeCallback, + const cssu::Reference<css::frame::XController>& rxController, + const sfx2::sidebar::EnumContext::Context eDefaultContext); + virtual ~SelectionChangeHandler (void); + + virtual void SAL_CALL selectionChanged (const css::lang::EventObject& rEvent) + throw (cssu::RuntimeException); + + virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent) + throw (cssu::RuntimeException); + + virtual void SAL_CALL disposing (void) + throw (cssu::RuntimeException); + + void Connect (void); + void Disconnect (void); + +private: + const boost::function<sfx2::sidebar::EnumContext::Context(void)> maSelectionChangeCallback; + cssu::Reference<css::frame::XController> mxController; + const sfx2::sidebar::EnumContext::Context meDefaultContext; + bool mbIsConnected; +}; + + +} } // end of namespace svx::sidebar + + +#endif + diff --git a/svx/inc/svx/sidebar/SidebarDialControl.hxx b/svx/inc/svx/sidebar/SidebarDialControl.hxx new file mode 100644 index 000000000000..f468784cb36f --- /dev/null +++ b/svx/inc/svx/sidebar/SidebarDialControl.hxx @@ -0,0 +1,41 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SVX_SIDEBAR_DIAL_CONTROL_HXX +#define SVX_SIDEBAR_DIAL_CONTROL_HXX + +#include <svx/dialcontrol.hxx> + +namespace svx { namespace sidebar { + +/** Provide some improvements over the standard DialControl. +*/ +class SVX_DLLPUBLIC SidebarDialControl : public svx::DialControl +{ +public: + SidebarDialControl (Window* pParent, const ResId& rResId); + virtual ~SidebarDialControl (void); + + virtual void MouseButtonDown (const MouseEvent& rMEvt); + +protected: + virtual void HandleMouseEvent (const Point& rPos, bool bInitial); +}; + +} } // end of namespace svx::sidebar + +#endif diff --git a/svx/inc/svx/sidebar/ValueSetWithTextControl.hxx b/svx/inc/svx/sidebar/ValueSetWithTextControl.hxx new file mode 100644 index 000000000000..d0e524ca4e70 --- /dev/null +++ b/svx/inc/svx/sidebar/ValueSetWithTextControl.hxx @@ -0,0 +1,157 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_SIDEBAR_VALUESETWITHTEXT_CONTROL_HXX_ +#define _SVX_SIDEBAR_VALUESETWITHTEXT_CONTROL_HXX_ + +#include "svx/svxdllapi.h" + +#include <svtools/valueset.hxx> +#include <limits.h> +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/uno/Sequence.h> +#include <com/sun/star/lang/Locale.hpp> + +#include <vcl/image.hxx> + +#include <vector> + +namespace com{namespace sun{ namespace star{ + namespace container{ + class XIndexAccess; + } + namespace beans{ + struct PropertyValue; + } + namespace text{ + class XNumberingFormatter; + } +}}} + +namespace svx { namespace sidebar { + +/** Specialization of class <ValueSet>. + This specialization allows is a one-columned ValueSet which allow + items containing an image and a text or a text and a second text. + + Especially, used for sidebar related controls. +*/ +class SVX_DLLPUBLIC ValueSetWithTextControl : public ValueSet +{ +public: + // control type of specialized <ValueSet>: + // - image + text + // - text + text + enum tControlType + { + IMAGE_TEXT, + TEXT_TEXT + }; + + ValueSetWithTextControl( + const tControlType eControlType, + Window* pParent, + const ResId& rResId); + + virtual ~ValueSetWithTextControl(void); + + // add item for control type IMAGE_TEXT + // if control type does not match IMAGE_TEXT no item is added. + // @param pSelectedItemImage + // selection item image is optional. if not provided, it is the same as the image item + // @param pItemHelpText + // help text is optional. if not provided, it is the same as the item text + void AddItem( + const Image& rItemImage, + const Image* pSelectedItemImage, + const XubString& rItemText, + const XubString* pItemHelpText ); + + // replace item images for control type IMAGE_TEXT + void ReplaceItemImages( + const sal_uInt16 nItemId, + const Image& rItemImage, + const Image* pSelectedItemImage ); + + // add item for control type TEXT_TEXT + // if control type does not match TEXT_TEXT no item is added. + // @param pItemHelpText + // help text is optional. if not provided, it is the same as the item text + void AddItem( + const XubString& rItemText, + const XubString& rItemText2, + const XubString* pItemHelpText ); + + virtual void UserDraw( const UserDrawEvent& rUDEvt ); + +private: + struct ValueSetWithTextItem + { + Image maItemImage; + Image maSelectedItemImage; + XubString maItemText; + XubString maItemText2; + }; + + typedef ::std::vector< ValueSetWithTextItem > tItemList; + + const tControlType meControlType; + tItemList maItems; +}; + +class SVX_DLLPUBLIC SvxNumValueSet2 : public ValueSet +{ + Color aLineColor; + Rectangle aOrgRect; + VirtualDevice* pVDev; + + com::sun::star::uno::Reference<com::sun::star::text::XNumberingFormatter> xFormatter; + com::sun::star::lang::Locale aLocale; + + com::sun::star::uno::Sequence< + com::sun::star::uno::Sequence< + com::sun::star::beans::PropertyValue> > aNumSettings; + + + public: + SvxNumValueSet2( Window* pParent, const ResId& rResId); + ~SvxNumValueSet2(); + + virtual void UserDraw( const UserDrawEvent& rUDEvt ); + + + void SetNumberingSettings( + const com::sun::star::uno::Sequence< + com::sun::star::uno::Sequence< + com::sun::star::beans::PropertyValue> >& aNum, + com::sun::star::uno::Reference<com::sun::star::text::XNumberingFormatter>& xFormatter, + const com::sun::star::lang::Locale& rLocale ); +}; + +class SVX_DLLPUBLIC SvxNumValueSet3 : public ValueSet +{ + public: + SvxNumValueSet3( Window* pParent, const ResId& rResId); + ~SvxNumValueSet3(); + + virtual void UserDraw( const UserDrawEvent& rUDEvt ); + +}; + +} } // end of namespace svx::sidebar + +#endif diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi index 370587871e96..e2e9dd9dfda1 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -3955,6 +3955,30 @@ SfxVoidItem FontDialog SID_CHAR_DLG GroupId = GID_FORMAT; ] +SfxVoidItem FontDialogEff SID_CHAR_DLG_EFFECT +() +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = TRUE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerItem; + Asynchron; + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_FORMAT; +] + //-------------------------------------------------------------------------- SvxFontHeightItem FontHeight SID_ATTR_CHAR_FONTHEIGHT @@ -4387,6 +4411,55 @@ XFormTextStyleItem FontWorkTextStyle SID_FORMTEXT_STYLE GroupId = GID_SPECIAL; ] +SvxLRSpaceItem ParaOutlineLeft SID_ATTR_PARA_LEFT + +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = TRUE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_VIEW; +] + +//-------------------------------------------------------------------------- +SvxLRSpaceItem ParaOutlineRight SID_ATTR_PARA_RIGHT +() +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = TRUE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_VIEW; +] + //-------------------------------------------------------------------------- SfxVoidItem FormatArea SID_ATTRIBUTES_AREA () @@ -6497,6 +6570,63 @@ SfxVoidItem DefaultNumbering FN_NUM_NUMBERING_ON GroupId = GID_ENUMERATION; ] +SfxBoolItem CurrentBulNumRule FN_BUL_NUM_RULE_INDEX +(SfxUInt16Item On FN_PARAM_1) +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = TRUE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + ImageRotation = TRUE; + ImageReflection = TRUE; + /* status: */ + SlotType = SfxBoolItem + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_ENUMERATION; +] +SfxBoolItem CurrentNumNumRule FN_NUM_NUM_RULE_INDEX +(SfxUInt16Item On FN_PARAM_1) +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = TRUE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + ImageRotation = TRUE; + ImageReflection = TRUE; + /* status: */ + SlotType = SfxBoolItem + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_ENUMERATION; +] + //-------------------------------------------------------------------------- SfxVoidItem InsertObject SID_INSERT_OBJECT ( SfxGlobalNameItem ClassId SID_INSERT_OBJECT ) @@ -7393,6 +7523,32 @@ SvxLineSpacingItem LineSpacing SID_ATTR_PARA_LINESPACE GroupId = GID_FORMAT; ] +SvxULSpaceItem ULSpacing SID_ATTR_PARA_ULSPACE + +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_FORMAT; +] + //-------------------------------------------------------------------------- SvxLineItem LineStyle SID_FRAME_LINESTYLE @@ -7846,6 +8002,57 @@ SfxVoidItem OutlineBullet SID_OUTLINE_BULLET GroupId = GID_FORMAT; ] +SfxUInt16Item SetNumber FN_SVX_SET_NUMBER +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_SPECIAL; +] + +//-------------------------------------------------------------------------- +SfxUInt16Item SetBullet FN_SVX_SET_BULLET +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_SPECIAL; +] + //-------------------------------------------------------------------------- SfxVoidItem OutlineCollapse SID_OUTLINE_COLLAPSE () @@ -15409,3 +15616,641 @@ SfxVoidItem PrepareMailExport SID_MAIL_PREPAREEXPORT ToolBoxConfig = FALSE, GroupId = GID_EXPLORER; ] + +//-------------------------------------------------------------------------- + +SfxUInt16Item FillTransparence SID_ATTR_FILL_TRANSPARENCE +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_FORMAT; +] + +//-------------------------------------------------------------------------- + +XFillFloatTransparenceItem FillFloatTransparence SID_ATTR_FILL_FLOATTRANSPARENCE +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_FORMAT; +] + +//-------------------------------------------------------------------------- + +SfxUInt16Item LineTransparence SID_ATTR_LINE_TRANSPARENCE +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_FORMAT; +] + +//-------------------------------------------------------------------------- + + +//-------------------------------------------------------------------------- + +XLineJointItem LineJoint SID_ATTR_LINE_JOINT +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_FORMAT; +] + +//-------------------------------------------------------------------------- + +XLineCapItem LineCap SID_ATTR_LINE_CAP +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_FORMAT; +] + +//-------------------------------------------------------------------------- + +XLineStartItem LineStart SID_ATTR_LINE_START +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_FORMAT; +] + +//-------------------------------------------------------------------------- + +XLineEndItem LineEnd SID_ATTR_LINE_END +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_FORMAT; +] + +//-------------------------------------------------------------------------- + +SfxUInt32Item SvxTransFormPosX SID_ATTR_TRANSFORM_POS_X +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_SPECIAL; +] + +//-------------------------------------------------------------------------- + +SfxUInt32Item SvxTransFormPosY SID_ATTR_TRANSFORM_POS_Y +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_SPECIAL; +] + +//-------------------------------------------------------------------------- + +SfxUInt32Item SvxTransFormWidth SID_ATTR_TRANSFORM_WIDTH +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_SPECIAL; +] + +//-------------------------------------------------------------------------- + +SfxUInt32Item SvxTransFormHeight SID_ATTR_TRANSFORM_HEIGHT +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_SPECIAL; +] + +//-------------------------------------------------------------------------- + +SfxUInt32Item TransAngle SID_ATTR_TRANSFORM_ANGLE +[ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_FORMAT; +] + +//-------------------------------------------------------------------------- + +SfxUInt32Item TransRotX SID_ATTR_TRANSFORM_ROT_X +[ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_FORMAT; +] + +//-------------------------------------------------------------------------- + +SfxUInt32Item TransRotY SID_ATTR_TRANSFORM_ROT_Y +[ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_FORMAT; +] + +//-------------------------------------------------------------------------- + +SfxBoolItem ProtectPos SID_ATTR_TRANSFORM_PROTECT_POS +[ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_FORMAT; +] + +//-------------------------------------------------------------------------- + +SfxBoolItem ProtectSize SID_ATTR_TRANSFORM_PROTECT_SIZE +[ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_FORMAT; +] + +//-------------------------------------------------------------------------- + +SfxVoidItem SvxFlipHorizontal SID_FLIP_HORIZONTAL +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_EDIT; +] + +//-------------------------------------------------------------------------- + +SfxBoolItem SvxAutoWidth SID_ATTR_TRANSFORM_AUTOWIDTH +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_EDIT; +] + +//-------------------------------------------------------------------------- + +SfxVoidItem SvxFlipVertical SID_FLIP_VERTICAL +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_EDIT; +] + +//-------------------------------------------------------------------------- + +SfxBoolItem SvxAutoWidth SID_ATTR_TRANSFORM_AUTOWIDTH +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_SPECIAL; +] + +//-------------------------------------------------------------------------- + +SfxBoolItem SvxAutoHeight SID_ATTR_TRANSFORM_AUTOHEIGHT +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_SPECIAL; +] + +//---------------------------------------------------------------------- +SvxLineItem BorderTLBR SID_ATTR_BORDER_DIAG_TLBR +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_FORMAT; +] + +SvxLineItem BorderBLTR SID_ATTR_BORDER_DIAG_BLTR +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_FORMAT; +] + +//-------------------------------------------------------------------------- + +SfxVoidItem SCDialogBorder SID_CELL_FORMAT_BORDER +() +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = TRUE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerItem; + Asynchron; + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_FORMAT; +] + diff --git a/svx/sdi/xoitems.sdi b/svx/sdi/xoitems.sdi index 5562942ea6d9..1a6d12f8290c 100644 --- a/svx/sdi/xoitems.sdi +++ b/svx/sdi/xoitems.sdi @@ -137,6 +137,28 @@ enum SvxLineStyle item SvxLineStyle XLineStyleItem; +enum SvxLineJoint +{ + // com::sun::star::drawing::LineJoint + SVX_LINEJOINT_NONE, // no rounding + SVX_LINEJOINT_MIDDLE, // calc middle value between joints + SVX_LINEJOINT_BEVEL, // join edges with line + SVX_LINEJOINT_MITER, // extend till cut + SVX_LINEJOINT_ROUND // create arc +}; + +item SvxLineJoint XLineJointItem; + +enum SvxLineCap +{ + // com::sun::star::drawing::LineCap + SVX_LINECAP_BUTT, + SVX_LINECAP_ROUND, + SVX_LINECAP_SQUARE +}; + +item SvxLineCap XLineCapItem; + item INT32 XLineWidthItem; item INT32 XFormTextStyleItem; item INT32 XFormTextAdjustItem; @@ -152,3 +174,7 @@ item INT32 XFormTextShadowItem; // SfxEnumItem item INT32 XFormTextShadowColorItem; // XColorItem item INT32 XFormTextShadowXValItem; // SfxMetricItem/SfxInt32Item item INT32 XFormTextShadowYValItem; // SfxMetricItem/SfxInt32Item + +item XFillGradient XFillFloatTransparenceItem; // XFillGradient + +// eof diff --git a/svx/source/dialog/dialcontrol.cxx b/svx/source/dialog/dialcontrol.cxx index 1ffdfa2efd36..080b0b3804db 100644 --- a/svx/source/dialog/dialcontrol.cxx +++ b/svx/source/dialog/dialcontrol.cxx @@ -18,7 +18,9 @@ */ #include "svx/dialcontrol.hxx" - +#include "bmpmask.hrc" +#include <svx/dialmgr.hxx> +#include <tools/rcid.h> #include <math.h> #include <vcl/virdev.hxx> #include <vcl/svapp.hxx> @@ -33,44 +35,14 @@ namespace svx { const long DIAL_OUTER_WIDTH = 8; -// ============================================================================ - -class DialControlBmp : public VirtualDevice -{ -public: - explicit DialControlBmp( Window& rParent ); - - void InitBitmap(const Font& rFont); - void SetSize(const Size& rSize); - void CopyBackground( const DialControlBmp& rSrc ); - void DrawBackground( const Size& rSize, bool bEnabled ); - void DrawElements( const String& rText, sal_Int32 nAngle ); - -private: - const Color& GetBackgroundColor() const; - const Color& GetTextColor() const; - const Color& GetScaleLineColor() const; - const Color& GetButtonLineColor() const; - const Color& GetButtonFillColor( bool bMain ) const; - - void Init(); - void DrawBackground(); - - Window& mrParent; - Rectangle maRect; - long mnCenterX; - long mnCenterY; - bool mbEnabled; -}; - // ---------------------------------------------------------------------------- DialControlBmp::DialControlBmp( Window& rParent ) : VirtualDevice( rParent, 0, 0 ), + mbEnabled( true ), mrParent( rParent ), mnCenterX(0), - mnCenterY(0), - mbEnabled( true ) + mnCenterY(0) { EnableRTL( sal_False ); } @@ -236,35 +208,13 @@ void DialControlBmp::DrawBackground() maRect.Right() - DIAL_OUTER_WIDTH, maRect.Bottom() - DIAL_OUTER_WIDTH ) ); } -// ============================================================================ - -struct DialControl_Impl -{ - DialControlBmp maBmpEnabled; - DialControlBmp maBmpDisabled; - DialControlBmp maBmpBuffered; - Link maModifyHdl; - NumericField* mpLinkField; - Size maWinSize; - Font maWinFont; - sal_Int32 mnAngle; - sal_Int32 mnInitialAngle; - sal_Int32 mnOldAngle; - long mnCenterX; - long mnCenterY; - bool mbNoRot; - - explicit DialControl_Impl( Window& rParent ); - void Init( const Size& rWinSize, const Font& rWinFont ); - void SetSize( const Size& rWinSize ); -}; - // ---------------------------------------------------------------------------- -DialControl_Impl::DialControl_Impl( Window& rParent ) : - maBmpEnabled( rParent ), - maBmpDisabled( rParent ), - maBmpBuffered( rParent ), +DialControl::DialControl_Impl::DialControl_Impl ( + Window& rParent ) : + mpBmpEnabled(new DialControlBmp(rParent)), + mpBmpDisabled(new DialControlBmp(rParent)), + mpBmpBuffered(new DialControlBmp(rParent)), mpLinkField( 0 ), mnAngle( 0 ), mnInitialAngle( 0 ), @@ -274,15 +224,15 @@ DialControl_Impl::DialControl_Impl( Window& rParent ) : { } -void DialControl_Impl::Init( const Size& rWinSize, const Font& rWinFont ) +void DialControl::DialControl_Impl::Init( const Size& rWinSize, const Font& rWinFont ) { maWinFont = rWinFont; maWinFont.SetTransparent(true); - maBmpBuffered.InitBitmap(maWinFont); + mpBmpBuffered->InitBitmap(maWinFont); SetSize(rWinSize); } -void DialControl_Impl::SetSize( const Size& rWinSize ) +void DialControl::DialControl_Impl::SetSize( const Size& rWinSize ) { // "(x - 1) | 1" creates odd value <= x, to have a well-defined center pixel position maWinSize = Size( (rWinSize.Width() - 1) | 1, (rWinSize.Height() - 1) | 1 ); @@ -290,9 +240,9 @@ void DialControl_Impl::SetSize( const Size& rWinSize ) mnCenterX = maWinSize.Width() / 2; mnCenterY = maWinSize.Height() / 2; - maBmpEnabled.DrawBackground( maWinSize, true ); - maBmpDisabled.DrawBackground( maWinSize, false ); - maBmpBuffered.SetSize( maWinSize ); + mpBmpEnabled->DrawBackground( maWinSize, true ); + mpBmpDisabled->DrawBackground( maWinSize, false ); + mpBmpBuffered->SetSize( maWinSize ); } // ============================================================================ @@ -329,7 +279,7 @@ void DialControl::Resize() void DialControl::Paint( const Rectangle& ) { Point aPos; - DrawBitmapEx( aPos, mpImpl->maBmpBuffered.GetBitmapEx( aPos, mpImpl->maWinSize ) ); + DrawBitmapEx( aPos, mpImpl->mpBmpBuffered->GetBitmapEx( aPos, mpImpl->maWinSize ) ); } void DialControl::StateChanged( StateChangedType nStateChange ) @@ -435,7 +385,7 @@ Size DialControl::GetOptimalSize() const void DialControl::SetRotation( sal_Int32 nAngle ) { - ImplSetRotation( nAngle, false ); + SetRotation( nAngle, false ); } void DialControl::SetLinkedField( NumericField* pField ) @@ -492,13 +442,13 @@ void DialControl::Init( const Size& rWinSize ) void DialControl::InvalidateControl() { - mpImpl->maBmpBuffered.CopyBackground( IsEnabled() ? mpImpl->maBmpEnabled : mpImpl->maBmpDisabled ); + mpImpl->mpBmpBuffered->CopyBackground( IsEnabled() ? *mpImpl->mpBmpEnabled : *mpImpl->mpBmpDisabled ); if( !mpImpl->mbNoRot ) - mpImpl->maBmpBuffered.DrawElements( GetText(), mpImpl->mnAngle ); + mpImpl->mpBmpBuffered->DrawElements( GetText(), mpImpl->mnAngle ); Invalidate(); } -void DialControl::ImplSetRotation( sal_Int32 nAngle, bool bBroadcast ) +void DialControl::SetRotation( sal_Int32 nAngle, bool bBroadcast ) { bool bOldSel = mpImpl->mbNoRot; mpImpl->mbNoRot = false; @@ -543,7 +493,7 @@ void DialControl::HandleMouseEvent( const Point& rPos, bool bInitial ) nAngle = 36000 - nAngle; if( bInitial ) // round to entire 15 degrees nAngle = ((nAngle + 750) / 1500) * 1500; - ImplSetRotation( nAngle, true ); + SetRotation( nAngle, true ); } } @@ -552,7 +502,7 @@ void DialControl::HandleEscapeEvent() if( IsMouseCaptured() ) { ReleaseMouse(); - ImplSetRotation( mpImpl->mnOldAngle, true ); + SetRotation( mpImpl->mnOldAngle, true ); if( mpImpl->mpLinkField ) mpImpl->mpLinkField->GrabFocus(); } @@ -561,7 +511,7 @@ void DialControl::HandleEscapeEvent() IMPL_LINK( DialControl, LinkedFieldModifyHdl, NumericField*, pField ) { if( pField ) - ImplSetRotation( static_cast< sal_Int32 >( pField->GetValue() * 100 ), false ); + SetRotation( static_cast< sal_Int32 >( pField->GetValue() * 100 ), false ); return 0; } diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx index 29d6b9b407f1..72f98cc363cc 100644 --- a/svx/source/dialog/dlgctrl.cxx +++ b/svx/source/dialog/dlgctrl.cxx @@ -41,7 +41,6 @@ #include <svx/svdopath.hxx> #include <svx/sdr/contact/objectcontactofobjlistpainter.hxx> #include <svx/sdr/contact/displayinfo.hxx> -#include <linectrl.hrc> #include <vcl/bmpacc.hxx> #include <svx/xbtmpit.hxx> @@ -993,9 +992,9 @@ void HatchingLB::Fill( const XHatchListRef &pList ) for( long i = 0; i < nCount; i++ ) { pEntry = pList->GetHatch( i ); - Bitmap* pBitmap = pList->GetBitmap( i ); - if( pBitmap ) - InsertEntry( pEntry->GetName(), *pBitmap ); + const Bitmap aBitmap = pList->GetUiBitmap( i ); + if( !aBitmap.IsEmpty() ) + InsertEntry( pEntry->GetName(), aBitmap ); else InsertEntry( pEntry->GetName() ); } @@ -1075,9 +1074,9 @@ void FillAttrLB::Fill( const XHatchListRef &pList ) for( long i = 0; i < nCount; i++ ) { pEntry = pList->GetHatch( i ); - Bitmap* pBitmap = pList->GetBitmap( i ); - if( pBitmap ) - ListBox::InsertEntry( pEntry->GetName(), *pBitmap ); + const Bitmap aBitmap = pList->GetUiBitmap( i ); + if( !aBitmap.IsEmpty() ) + ListBox::InsertEntry( pEntry->GetName(), aBitmap ); else InsertEntry( pEntry->GetName() ); } @@ -1134,9 +1133,9 @@ void GradientLB::Fill( const XGradientListRef &pList ) for( long i = 0; i < nCount; i++ ) { pEntry = pList->GetGradient( i ); - Bitmap* pBitmap = pList->GetBitmap( i ); - if( pBitmap ) - InsertEntry( pEntry->GetName(), *pBitmap ); + const Bitmap aBitmap = pList->GetUiBitmap( i ); + if( !aBitmap.IsEmpty() ) + InsertEntry( pEntry->GetName(), aBitmap ); else InsertEntry( pEntry->GetName() ); } @@ -1253,9 +1252,9 @@ void FillAttrLB::Fill( const XGradientListRef &pList ) for( long i = 0; i < nCount; i++ ) { pEntry = pList->GetGradient( i ); - Bitmap* pBitmap = pList->GetBitmap( i ); - if( pBitmap ) - ListBox::InsertEntry( pEntry->GetName(), *pBitmap ); + const Bitmap aBitmap = pList->GetUiBitmap( i ); + if( !aBitmap.IsEmpty() ) + ListBox::InsertEntry( pEntry->GetName(), aBitmap ); else InsertEntry( pEntry->GetName() ); } @@ -1271,28 +1270,32 @@ BitmapLB::BitmapLB(Window* pParent, ResId Id, bool bUserDraw /*= false*/ ) mpList(NULL), mbUserDraw(bUserDraw) { - maVD.SetOutputSizePixel(Size(32, 16)); EnableUserDraw(mbUserDraw); } /************************************************************************/ -void BitmapLB::SetVirtualDevice() +void BitmapLB::SetVirtualDevice(const Size& rSize) { + maVD.SetOutputSizePixel(rSize); + if(maBitmapEx.GetSizePixel().Width() > 8 || maBitmapEx.GetSizePixel().Height() > 8) { - maVD.DrawBitmapEx(Point(0, 0), Size(32, 16), maBitmapEx); + maVD.DrawBitmapEx(Point(0, 0), rSize, maBitmapEx); } else { - maVD.DrawBitmapEx(Point(0, 0), maBitmapEx); - maVD.DrawBitmapEx(Point(8, 0), maBitmapEx); - maVD.DrawBitmapEx(Point(16, 0), maBitmapEx); - maVD.DrawBitmapEx(Point(24, 0), maBitmapEx); - maVD.DrawBitmapEx(Point(0, 8), maBitmapEx); - maVD.DrawBitmapEx(Point(8, 8), maBitmapEx); - maVD.DrawBitmapEx(Point(16, 8), maBitmapEx); - maVD.DrawBitmapEx(Point(24, 8), maBitmapEx); + const Size aBitmapSize(maBitmapEx.GetSizePixel()); + + for(sal_uInt32 y(0); y < rSize.Height(); y += aBitmapSize.Height()) + { + for(sal_uInt32 x(0); x < rSize.Width(); x += aBitmapSize.Width()) + { + maVD.DrawBitmapEx( + Point(x, y), + maBitmapEx); + } + } } } @@ -1322,8 +1325,12 @@ void BitmapLB::Fill( const XBitmapListRef &pList ) { pEntry = pList->GetBitmap(i); maBitmapEx = pEntry->GetGraphicObject().GetGraphic().GetBitmapEx(); - SetVirtualDevice(); - InsertEntry(pEntry->GetName(), maVD.GetBitmap(Point(0, 2), Size(32, 12))); + const Size aSize(pList->getUiBitmapWidth(), pList->getUiBitmapHeight()); + SetVirtualDevice(aSize); + InsertEntry( + pEntry->GetName(), + maVD.GetBitmap(Point(0, 0), + aSize)); } } @@ -1374,64 +1381,73 @@ void BitmapLB::UserDraw(const UserDrawEvent& rUDEvt) /************************************************************************/ -void BitmapLB::Append(XBitmapEntry* pEntry, BitmapEx* pBmpEx) +void BitmapLB::Append(const Size& rSize, const XBitmapEntry& rEntry, BitmapEx* pBmpEx) { if(pBmpEx) { - maBitmapEx = pEntry->GetGraphicObject().GetGraphic().GetBitmapEx(); - SetVirtualDevice(); - InsertEntry(pEntry->GetName(), maVD.GetBitmap(Point(0, 2), Size(32, 12))); + maBitmapEx = rEntry.GetGraphicObject().GetGraphic().GetBitmapEx(); + SetVirtualDevice(rSize); + InsertEntry( + rEntry.GetName(), + maVD.GetBitmap(Point(0, 0), + rSize)); } else { - InsertEntry(pEntry->GetName()); + InsertEntry(rEntry.GetName()); } } /************************************************************************/ -void BitmapLB::Modify(XBitmapEntry* pEntry, sal_uInt16 nPos, BitmapEx* pBmpEx) +void BitmapLB::Modify(const Size& rSize, const XBitmapEntry& rEntry, sal_uInt16 nPos, BitmapEx* pBmpEx) { RemoveEntry(nPos); if(pBmpEx) { - maBitmapEx = pEntry->GetGraphicObject().GetGraphic().GetBitmapEx(); - SetVirtualDevice(); - InsertEntry(pEntry->GetName(), maVD.GetBitmap(Point(0, 2), Size(32, 12)), nPos); + maBitmapEx = rEntry.GetGraphicObject().GetGraphic().GetBitmapEx(); + SetVirtualDevice(rSize); + InsertEntry( + rEntry.GetName(), + maVD.GetBitmap(Point(0, 0), rSize), + nPos); } else { - InsertEntry(pEntry->GetName()); + InsertEntry(rEntry.GetName()); } } FillAttrLB::FillAttrLB(Window* pParent, WinBits aWB) : ColorListBox(pParent, aWB) { - maVD.SetOutputSizePixel(Size(32, 16)); } /************************************************************************/ -void FillAttrLB::SetVirtualDevice() +void FillAttrLB::SetVirtualDevice(const Size& rSize) { + maVD.SetOutputSizePixel(rSize); maVD.Erase(); if(maBitmapEx.GetSizePixel().Width() > 8 || maBitmapEx.GetSizePixel().Height() > 8) { - maVD.DrawBitmapEx(Point(0, 0), Size(32, 16), maBitmapEx); + maVD.DrawBitmapEx(Point(0, 0), rSize, maBitmapEx); } else { - maVD.DrawBitmapEx(Point(0, 0), maBitmapEx); - maVD.DrawBitmapEx(Point(8, 0), maBitmapEx); - maVD.DrawBitmapEx(Point(16, 0), maBitmapEx); - maVD.DrawBitmapEx(Point(24, 0), maBitmapEx); - maVD.DrawBitmapEx(Point(0, 8), maBitmapEx); - maVD.DrawBitmapEx(Point(8, 8), maBitmapEx); - maVD.DrawBitmapEx(Point(16, 8), maBitmapEx); - maVD.DrawBitmapEx(Point(24, 8), maBitmapEx); + const Size aBitmapSize(maBitmapEx.GetSizePixel()); + + for(sal_uInt32 y(0); y < rSize.Height(); y += aBitmapSize.Height()) + { + for(sal_uInt32 x(0); x < rSize.Width(); x += aBitmapSize.Width()) + { + maVD.DrawBitmapEx( + Point(x, y), + maBitmapEx); + } + } } } @@ -1448,8 +1464,12 @@ void FillAttrLB::Fill( const XBitmapListRef &pList ) { pEntry = pList->GetBitmap( i ); maBitmapEx = pEntry->GetGraphicObject().GetGraphic().GetBitmapEx(); - SetVirtualDevice(); - ListBox::InsertEntry(pEntry->GetName(), maVD.GetBitmap(Point(0, 2), Size(32, 12))); + const Size aSize(pList->getUiBitmapWidth(), pList->getUiBitmapHeight()); + SetVirtualDevice(aSize); + ListBox::InsertEntry( + pEntry->GetName(), + maVD.GetBitmap(Point(0, 0), + aSize)); } ListBox::SetUpdateMode(true); @@ -1470,6 +1490,16 @@ void FillTypeLB::Fill() void LineLB::Fill( const XDashListRef &pList ) { + Clear(); + + // entry for 'none' + InsertEntry(pList->GetStringForUiNoLine()); + + // entry for solid line + InsertEntry(pList->GetStringForUiSolidLine(), pList->GetBitmapForUISolidLine()); + + // entries for dashed lines + if( !pList.is() ) return; @@ -1480,11 +1510,10 @@ void LineLB::Fill( const XDashListRef &pList ) for( long i = 0; i < nCount; i++ ) { pEntry = pList->GetDash( i ); - Bitmap* pBitmap = pList->CreateBitmapForUI( i ); - if( pBitmap ) + const Bitmap aBitmap = pList->GetUiBitmap( i ); + if( !aBitmap.IsEmpty() ) { - InsertEntry( pEntry->GetName(), *pBitmap ); - delete pBitmap; + InsertEntry( pEntry->GetName(), aBitmap ); } else InsertEntry( pEntry->GetName() ); @@ -1492,33 +1521,9 @@ void LineLB::Fill( const XDashListRef &pList ) SetUpdateMode( sal_True ); } -void LineLB::FillStyles() -{ - ResMgr& rMgr = DIALOG_MGR(); - - // Line Styles - Clear(); - InsertEntry( String( ResId( RID_SVXSTR_INVISIBLE, rMgr ) ) ); - - const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings(); - Bitmap aBitmap ( SVX_RES ( RID_SVXCTRL_LINECTRL ) ); - Color aSourceColors[2]; - Color aDestColors[2]; - - aSourceColors[0] = Color( COL_WHITE ); - aSourceColors[1] = Color( COL_BLACK ); - - aDestColors[0] = rStyles.GetFieldColor(); - aDestColors[1] = rStyles.GetFieldTextColor(); - - aBitmap.Replace ( aSourceColors, aDestColors, 2 ); - Image aSolidLine ( aBitmap ); - InsertEntry( String( ResId( RID_SVXSTR_SOLID, rMgr ) ), aSolidLine ); -} - /************************************************************************/ -void LineLB::Append( XDashEntry* pEntry, Bitmap* pBmp ) +void LineLB::Append( XDashEntry* pEntry, const Bitmap* pBmp ) { if( pBmp ) InsertEntry( pEntry->GetName(), *pBmp ); @@ -1528,7 +1533,7 @@ void LineLB::Append( XDashEntry* pEntry, Bitmap* pBmp ) /************************************************************************/ -void LineLB::Modify( XDashEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp ) +void LineLB::Modify( XDashEntry* pEntry, sal_uInt16 nPos, const Bitmap* pBmp ) { RemoveEntry( nPos ); @@ -1540,6 +1545,20 @@ void LineLB::Modify( XDashEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp ) // Fills the listbox (provisional) with strings +LineEndLB::LineEndLB( Window* pParent, ResId Id ) + : ListBox( pParent, Id ) +{ +} + +LineEndLB::LineEndLB( Window* pParent, WinBits aWB ) + : ListBox( pParent, aWB ) +{ +} + +LineEndLB::~LineEndLB(void) +{ +} + void LineEndLB::Fill( const XLineEndListRef &pList, sal_Bool bStart ) { if( !pList.is() ) @@ -1553,17 +1572,16 @@ void LineEndLB::Fill( const XLineEndListRef &pList, sal_Bool bStart ) for( long i = 0; i < nCount; i++ ) { pEntry = pList->GetLineEnd( i ); - Bitmap* pBitmap = pList->CreateBitmapForUI( i ); - if( pBitmap ) + const Bitmap aBitmap = pList->GetUiBitmap( i ); + if( !aBitmap.IsEmpty() ) { - Size aBmpSize( pBitmap->GetSizePixel() ); + Size aBmpSize( aBitmap.GetSizePixel() ); aVD.SetOutputSizePixel( aBmpSize, sal_False ); - aVD.DrawBitmap( Point(), *pBitmap ); + aVD.DrawBitmap( Point(), aBitmap ); InsertEntry( pEntry->GetName(), aVD.GetBitmap( bStart ? Point() : Point( aBmpSize.Width() / 2, 0 ), Size( aBmpSize.Width() / 2, aBmpSize.Height() ) ) ); - - delete pBitmap; + //delete pBitmap; } else InsertEntry( pEntry->GetName() ); @@ -1573,8 +1591,7 @@ void LineEndLB::Fill( const XLineEndListRef &pList, sal_Bool bStart ) /************************************************************************/ -void LineEndLB::Append( XLineEndEntry* pEntry, Bitmap* pBmp, - sal_Bool bStart ) +void LineEndLB::Append( XLineEndEntry* pEntry, const Bitmap* pBmp, sal_Bool bStart ) { if( pBmp ) { @@ -1593,8 +1610,7 @@ void LineEndLB::Append( XLineEndEntry* pEntry, Bitmap* pBmp, /************************************************************************/ -void LineEndLB::Modify( XLineEndEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp, - sal_Bool bStart ) +void LineEndLB::Modify( XLineEndEntry* pEntry, sal_uInt16 nPos, const Bitmap* pBmp, sal_Bool bStart ) { RemoveEntry( nPos ); diff --git a/svx/source/dialog/dlgutil.cxx b/svx/source/dialog/dlgutil.cxx index 6afa326b36cb..bbf73cbc7d33 100644 --- a/svx/source/dialog/dlgutil.cxx +++ b/svx/source/dialog/dlgutil.cxx @@ -73,4 +73,9 @@ bool GetApplyCharUnit( const SfxItemSet& rSet ) return bUseCharUnit; } +FieldUnit GetModuleFieldUnit() +{ + return SfxModule::GetCurrentFieldUnit(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/dialog/sdstring.src b/svx/source/dialog/sdstring.src index 34360edd6190..08cf55078efe 100644 --- a/svx/source/dialog/sdstring.src +++ b/svx/source/dialog/sdstring.src @@ -39,7 +39,7 @@ String RID_SVXSTR_LINESTYLE }; String RID_SVXSTR_INVISIBLE { - Text [ en-US ] = "Invisible" ; + Text [ en-US ] = "None" ; }; String RID_SVXSTR_COLOR { diff --git a/svx/source/dialog/svxbmpnumvalueset.src b/svx/source/dialog/svxbmpnumvalueset.src index d0ad43a2b262..8665a0b37adc 100644 --- a/svx/source/dialog/svxbmpnumvalueset.src +++ b/svx/source/dialog/svxbmpnumvalueset.src @@ -53,7 +53,8 @@ String RID_SVXSTR_BULLET_DESCRIPTION_7 }; String RID_SVXSTR_SINGLENUM_DESCRIPTION_0 { - Text [en-US] = "Number 1) 2) 3)"; + //Text [en-US] = "Number 1) 2) 3)"; + Text [en-US] = "Number %NUMBERINGSAMPLE"; }; String RID_SVXSTR_SINGLENUM_DESCRIPTION_1 { diff --git a/svx/source/gallery2/GalleryControl.cxx b/svx/source/gallery2/GalleryControl.cxx new file mode 100644 index 000000000000..9c6356beeef0 --- /dev/null +++ b/svx/source/gallery2/GalleryControl.cxx @@ -0,0 +1,290 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "sidebar/PanelFactory.hxx" + +#include "GalleryControl.hxx" + +#include "gallery.hrc" +#include "svx/galmisc.hxx" +#include "svx/gallery1.hxx" +#include "galbrws1.hxx" +#include "galbrws2.hxx" +#include "GallerySplitter.hxx" +#include <vcl/svapp.hxx> +#include <sfx2/sidebar/Theme.hxx> + +#include <boost/bind.hpp> + +namespace svx { namespace sidebar { + +static const sal_Int32 gnInitialVerticalSplitPosition (150); + + +GalleryControl::GalleryControl ( + SfxBindings* /*pBindings*/, + Window* pParentWindow) + : Window(pParentWindow, GAL_RES(RID_SVXDLG_GALLERYBROWSER)), + mpGallery (Gallery::GetGalleryInstance()), + mpSplitter(new GallerySplitter( + this, + GAL_RES(GALLERY_SPLITTER), + ::boost::bind(&GalleryControl::InitSettings, this))), + mpBrowser1(new GalleryBrowser1( + this, + GAL_RES(GALLERY_BROWSER1), + mpGallery, + ::boost::bind(&GalleryControl::GalleryKeyInput,this,_1,_2), + ::boost::bind(&GalleryControl::ThemeSelectionHasChanged, this))), + mpBrowser2(new GalleryBrowser2(this, GAL_RES(GALLERY_BROWSER2), mpGallery)), + maLastSize(GetOutputSizePixel()), + mbIsInitialResize(true) +{ + FreeResource(); + + mpBrowser1->SelectTheme(0); + mpBrowser1->Show(sal_True); + + mpBrowser2->Show(sal_True); + + mpSplitter->SetHorizontal(false); + mpSplitter->SetSplitHdl( LINK( this, GalleryControl, SplitHdl ) ); + mpSplitter->Show( sal_True ); + + InitSettings(); +} + + + + +GalleryControl::~GalleryControl (void) +{ +} + + + + +void GalleryControl::InitSettings (void) +{ + SetBackground( Wallpaper( GALLERY_DLG_COLOR ) ); + SetControlBackground( GALLERY_DLG_COLOR ); + SetControlForeground( GALLERY_DLG_COLOR ); + + mpSplitter->SetBackground( Wallpaper( GALLERY_DLG_COLOR ) ); + mpSplitter->SetControlBackground( GALLERY_DLG_COLOR ); + mpSplitter->SetControlForeground( GALLERY_DLG_COLOR ); + + mpBrowser1->SetBackground( Wallpaper( GALLERY_DLG_COLOR ) ); + mpBrowser1->SetControlBackground( GALLERY_DLG_COLOR ); + mpBrowser1->SetControlForeground( GALLERY_DLG_COLOR ); + + mpBrowser2->SetBackground( Wallpaper( GALLERY_DLG_COLOR ) ); + mpBrowser2->SetControlBackground( GALLERY_DLG_COLOR ); + mpBrowser2->SetControlForeground( GALLERY_DLG_COLOR ); + + const Wallpaper aBackground (sfx2::sidebar::Theme::GetWallpaper(sfx2::sidebar::Theme::Paint_PanelBackground)); + mpSplitter->SetBackground(aBackground); + SetBackground(aBackground); + mpBrowser2->SetBackground(aBackground); +} + + + + +void GalleryControl::Resize (void) +{ + // call parent + Window::Resize(); + + // update hor/ver + const Size aNewSize( GetOutputSizePixel() ); + if (aNewSize.Width()<=0 || aNewSize.Height()<=0) + return; + + const bool bNewLayoutHorizontal(aNewSize.Width() > aNewSize.Height()); + const bool bOldLayoutHorizontal(mpSplitter->IsHorizontal()); + long nSplitPos( bOldLayoutHorizontal ? mpSplitter->GetPosPixel().X() : mpSplitter->GetPosPixel().Y()); + const long nSplitSize( bOldLayoutHorizontal ? mpSplitter->GetOutputSizePixel().Width() : mpSplitter->GetOutputSizePixel().Height()); + + if(bNewLayoutHorizontal != bOldLayoutHorizontal) + { + mpSplitter->SetHorizontal(bNewLayoutHorizontal); + } + else + { + if (mbIsInitialResize) + { + nSplitPos = gnInitialVerticalSplitPosition; + if (nSplitPos > aNewSize.Height()/2) + nSplitPos = aNewSize.Height()/2; + } + } + mbIsInitialResize = false; + + const long nFrameLen = LogicToPixel( Size( 3, 0 ), MAP_APPFONT ).Width(); + const long nFrameLen2 = nFrameLen << 1; + + if(bNewLayoutHorizontal) + { + mpBrowser1->SetPosSizePixel( + Point( nFrameLen, nFrameLen ), + Size(nSplitPos - nFrameLen, aNewSize.Height() - nFrameLen2) ); + + mpSplitter->SetPosSizePixel( + Point( nSplitPos, 0), + Size( nSplitSize, aNewSize.Height() ) ); + + mpSplitter->SetDragRectPixel( + Rectangle( + Point( nFrameLen2, 0 ), + Size( aNewSize.Width() - ( nFrameLen2 << 1 ) - nSplitSize, aNewSize.Height() ) ) ); + + mpBrowser2->SetPosSizePixel( + Point( nSplitPos + nSplitSize, nFrameLen ), + Size( aNewSize.Width() - nSplitSize - nSplitPos - nFrameLen, aNewSize.Height() - nFrameLen2 ) ); + } + else + { + mpBrowser1->SetPosSizePixel( + Point( nFrameLen, nFrameLen ), + Size(aNewSize.Width() - nFrameLen2, nSplitPos - nFrameLen)); + + mpSplitter->SetPosSizePixel( + Point( 0, nSplitPos), + Size( aNewSize.Width(), nSplitSize ) ); + + mpSplitter->SetDragRectPixel( + Rectangle( + Point( 0, nFrameLen2 ), + Size( aNewSize.Width(), aNewSize.Height() - ( nFrameLen2 << 1 ) - nSplitSize ) )); + + mpBrowser2->SetPosSizePixel( + Point( nFrameLen, nSplitPos + nSplitSize ), + Size( aNewSize.Width() - nFrameLen2, aNewSize.Height() - nSplitSize - nSplitPos - nFrameLen )); + } + + maLastSize = aNewSize; +} + + + + +sal_Bool GalleryControl::GalleryKeyInput( const KeyEvent& rKEvt, Window* ) +{ + const sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode(); + sal_Bool bRet = ( !rKEvt.GetKeyCode().IsMod1() && + ( ( KEY_TAB == nCode ) || ( KEY_F6 == nCode && rKEvt.GetKeyCode().IsMod2() ) ) ); + + if( bRet ) + { + if( !rKEvt.GetKeyCode().IsShift() ) + { + if( mpBrowser1->mpThemes->HasChildPathFocus( sal_True ) ) + mpBrowser2->GetViewWindow()->GrabFocus(); + else if( mpBrowser2->GetViewWindow()->HasFocus() ) + mpBrowser2->maViewBox.GrabFocus(); + else if( mpBrowser2->maViewBox.HasFocus() ) + mpBrowser1->maNewTheme.GrabFocus(); + else + mpBrowser1->mpThemes->GrabFocus(); + } + else + { + if( mpBrowser1->mpThemes->HasChildPathFocus( sal_True ) ) + mpBrowser1->maNewTheme.GrabFocus(); + else if( mpBrowser1->maNewTheme.HasFocus() ) + mpBrowser2->maViewBox.GrabFocus(); + else if( mpBrowser2->maViewBox.HasFocus() ) + mpBrowser2->GetViewWindow()->GrabFocus(); + else + mpBrowser1->mpThemes->GrabFocus(); + } + } + + return bRet; +} + + + + +void GalleryControl::GetFocus (void) +{ + Window::GetFocus(); + mpBrowser1->GrabFocus(); +} + + + + +void GalleryControl::ThemeSelectionHasChanged (void) +{ + mpBrowser2->SelectTheme(mpBrowser1->GetSelectedTheme()); +} + + + + +INetURLObject GalleryControl::GetURL (void) const +{ + return mpBrowser2->GetURL(); +} + + + + +String GalleryControl::GetFilterName (void) const +{ + return mpBrowser2->GetFilterName(); +} + + + + +Graphic GalleryControl::GetGraphic(void) const +{ + return mpBrowser2->GetGraphic(); +} + + + + +sal_Bool GalleryControl::IsLinkage (void) const +{ + return mpBrowser2->IsLinkage(); +} + + + + +IMPL_LINK( GalleryControl, SplitHdl, void*, EMPTYARG ) +{ + if(mpSplitter->IsHorizontal()) + { + mpSplitter->SetPosPixel( Point( mpSplitter->GetSplitPosPixel(), mpSplitter->GetPosPixel().Y() ) ); + } + else + { + mpSplitter->SetPosPixel( Point( mpSplitter->GetPosPixel().X(), mpSplitter->GetSplitPosPixel() ) ); + } + + Resize(); + + return 0L; +} + + +} } // end of namespace svx::sidebar diff --git a/svx/source/gallery2/GallerySplitter.cxx b/svx/source/gallery2/GallerySplitter.cxx new file mode 100644 index 000000000000..eb8d2c016f86 --- /dev/null +++ b/svx/source/gallery2/GallerySplitter.cxx @@ -0,0 +1,50 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "GallerySplitter.hxx" + + +DBG_NAME(GallerySplitter) + +GallerySplitter::GallerySplitter( + Window* pParent, + const ResId& rResId, + const ::boost::function<void(void)>& rDataChangeFunctor) + : Splitter( pParent, rResId ), + maDataChangeFunctor(rDataChangeFunctor) +{ + DBG_CTOR(GallerySplitter,NULL); +} + + + + +GallerySplitter::~GallerySplitter() +{ + DBG_DTOR(GallerySplitter,NULL); +} + + + + +void GallerySplitter::DataChanged( const DataChangedEvent& rDCEvt ) +{ + Splitter::DataChanged( rDCEvt ); + if (maDataChangeFunctor) + maDataChangeFunctor(); +} diff --git a/svx/source/gallery2/GallerySplitter.hxx b/svx/source/gallery2/GallerySplitter.hxx new file mode 100644 index 000000000000..cdb127776508 --- /dev/null +++ b/svx/source/gallery2/GallerySplitter.hxx @@ -0,0 +1,41 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SVX_GALLERY_SPLITTER_HXX +#define SVX_GALLERY_SPLITTER_HXX + +#include <vcl/split.hxx> +#include <boost/function.hpp> + +class GallerySplitter : public Splitter +{ +public: + GallerySplitter ( + Window* pParent, + const ResId& rResId, + const ::boost::function<void(void)>& rDataChangeFunctor); + virtual ~GallerySplitter (void); + +protected: + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + +private: + ::boost::function<void(void)> maDataChangeFunctor; +}; + + +#endif diff --git a/svx/source/gallery2/galbrws.cxx b/svx/source/gallery2/galbrws.cxx index 1ee3194359a2..7435788b614b 100644 --- a/svx/source/gallery2/galbrws.cxx +++ b/svx/source/gallery2/galbrws.cxx @@ -17,7 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - #include <vcl/split.hxx> #include <vcl/ctrl.hxx> #include <unotools/pathoptions.hxx> @@ -29,46 +28,9 @@ #include "galbrws1.hxx" #include "galbrws2.hxx" #include "svx/galbrws.hxx" +#include "GallerySplitter.hxx" -// ------------------- -// - GallerySplitter - -// ------------------- -DBG_NAME(GallerySplitter) - -class GallerySplitter : public Splitter -{ -protected: - - virtual void DataChanged( const DataChangedEvent& rDCEvt ); - -public: - - GallerySplitter( Window* pParent, const ResId& rResId ); - virtual ~GallerySplitter(); -}; - -// ----------------------------------------------------------------------------- - -GallerySplitter::GallerySplitter( Window* pParent, const ResId& rResId ) : - Splitter( pParent, rResId ) -{ - DBG_CTOR(GallerySplitter,NULL); -} - -// ----------------------------------------------------------------------------- - -GallerySplitter::~GallerySplitter() -{ - DBG_DTOR(GallerySplitter,NULL); -} - -// ----------------------------------------------------------------------------- - -void GallerySplitter::DataChanged( const DataChangedEvent& rDCEvt ) -{ - Splitter::DataChanged( rDCEvt ); - static_cast< GalleryBrowser* >( GetParent() )->InitSettings(); -} +#include <boost/bind.hpp> // ------------------------- // - SvxGalleryChildWindow - @@ -101,24 +63,40 @@ SFX_IMPL_DOCKINGWINDOW_WITHID( GalleryChildWindow, SID_GALLERY ) // ------------------ DBG_NAME(GalleryBrowser) -GalleryBrowser::GalleryBrowser( SfxBindings* _pBindings, SfxChildWindow* pCW, - Window* pParent, const ResId& rResId ) : - SfxDockingWindow( _pBindings, pCW, pParent, rResId ) +GalleryBrowser::GalleryBrowser( + SfxBindings* _pBindings, + SfxChildWindow* pCW, + Window* pParent, + const ResId& rResId) +: SfxDockingWindow(_pBindings, pCW, pParent, rResId), + maLastSize(GetOutputSizePixel()), + mpSplitter(0), + mpBrowser1(0), + mpBrowser2(0), + mpGallery(0) { DBG_CTOR(GalleryBrowser,NULL); mpGallery = Gallery::GetGalleryInstance(); - mpBrowser1 = new GalleryBrowser1( this, GAL_RES( GALLERY_BROWSER1 ), mpGallery ); - mpSplitter = new GallerySplitter( this, GAL_RES( GALLERY_SPLITTER ) ); + mpBrowser1 = new GalleryBrowser1( + this, + GAL_RES( GALLERY_BROWSER1 ), + mpGallery, + ::boost::bind(&GalleryBrowser::KeyInput,this,_1,_2), + ::boost::bind(&GalleryBrowser::ThemeSelectionHasChanged, this)); + mpSplitter = new GallerySplitter( this, GAL_RES( GALLERY_SPLITTER ), + ::boost::bind(&GalleryBrowser::InitSettings, this)); mpBrowser2 = new GalleryBrowser2( this, GAL_RES( GALLERY_BROWSER2 ), mpGallery ); FreeResource(); - SetMinOutputSizePixel( maLastSize = GetOutputSizePixel() ); + SetMinOutputSizePixel(maLastSize); mpBrowser1->SelectTheme( 0 ); mpBrowser1->Show( sal_True ); mpBrowser2->Show( sal_True ); + const bool bLayoutHorizontal(maLastSize.Width() > maLastSize.Height()); + mpSplitter->SetHorizontal(bLayoutHorizontal); mpSplitter->SetSplitHdl( LINK( this, GalleryBrowser, SplitHdl ) ); mpSplitter->Show( sal_True ); @@ -161,22 +139,62 @@ void GalleryBrowser::InitSettings() void GalleryBrowser::Resize() { + // call parent SfxDockingWindow::Resize(); - const long nFrameWidth = LogicToPixel( Size( 3, 0 ), MAP_APPFONT ).Width(); - const long nFrameWidth2 = nFrameWidth << 1; - Size aNewSize( GetOutputSizePixel() ); - Point aSplitPos( mpSplitter->GetPosPixel() ); - const Size aSplitSize( mpSplitter->GetOutputSizePixel() ); + // update hor/ver + const Size aNewSize( GetOutputSizePixel() ); + const bool bNewLayoutHorizontal(aNewSize.Width() > aNewSize.Height()); + const bool bOldLayoutHorizontal(mpSplitter->IsHorizontal()); + const long nSplitPos( bOldLayoutHorizontal ? mpSplitter->GetPosPixel().X() : mpSplitter->GetPosPixel().Y()); + const long nSplitSize( bOldLayoutHorizontal ? mpSplitter->GetOutputSizePixel().Width() : mpSplitter->GetOutputSizePixel().Height()); - mpBrowser1->SetPosSizePixel( Point( nFrameWidth, nFrameWidth ), - Size( aSplitPos.X() - nFrameWidth, aNewSize.Height() - nFrameWidth2 ) ); + if(bNewLayoutHorizontal != bOldLayoutHorizontal) + { + mpSplitter->SetHorizontal(bNewLayoutHorizontal); + } - mpSplitter->SetPosSizePixel( aSplitPos, Size( aSplitSize.Width(), aNewSize.Height() ) ); - mpSplitter->SetDragRectPixel( Rectangle( Point( nFrameWidth2, 0 ), Size( aNewSize.Width() - ( nFrameWidth2 << 1 ) - aSplitSize.Width(), aNewSize.Height() ) ) ); + const long nFrameLen = LogicToPixel( Size( 3, 0 ), MAP_APPFONT ).Width(); + const long nFrameLen2 = nFrameLen << 1; - mpBrowser2->SetPosSizePixel( Point( aSplitPos.X() + aSplitSize.Width(), nFrameWidth ), - Size( aNewSize.Width() - aSplitSize.Width() - aSplitPos.X() - nFrameWidth, aNewSize.Height() - nFrameWidth2 ) ); + if(bNewLayoutHorizontal) + { + mpBrowser1->SetPosSizePixel( + Point( nFrameLen, nFrameLen ), + Size(nSplitPos - nFrameLen, aNewSize.Height() - nFrameLen2) ); + + mpSplitter->SetPosSizePixel( + Point( nSplitPos, 0), + Size( nSplitSize, aNewSize.Height() ) ); + + mpSplitter->SetDragRectPixel( + Rectangle( + Point( nFrameLen2, 0 ), + Size( aNewSize.Width() - ( nFrameLen2 << 1 ) - nSplitSize, aNewSize.Height() ) ) ); + + mpBrowser2->SetPosSizePixel( + Point( nSplitPos + nSplitSize, nFrameLen ), + Size( aNewSize.Width() - nSplitSize - nSplitPos - nFrameLen, aNewSize.Height() - nFrameLen2 ) ); + } + else + { + mpBrowser1->SetPosSizePixel( + Point( nFrameLen, nFrameLen ), + Size(aNewSize.Width() - nFrameLen2, nSplitPos - nFrameLen)); + + mpSplitter->SetPosSizePixel( + Point( 0, nSplitPos), + Size( aNewSize.Width(), nSplitSize ) ); + + mpSplitter->SetDragRectPixel( + Rectangle( + Point( 0, nFrameLen2 ), + Size( aNewSize.Width(), aNewSize.Height() - ( nFrameLen2 << 1 ) - nSplitSize ) )); + + mpBrowser2->SetPosSizePixel( + Point( nFrameLen, nSplitPos + nSplitSize ), + Size( aNewSize.Width() - nFrameLen2, aNewSize.Height() - nSplitSize - nSplitPos - nFrameLen )); + } maLastSize = aNewSize; } @@ -272,7 +290,15 @@ sal_Bool GalleryBrowser::IsLinkage() const IMPL_LINK_NOARG(GalleryBrowser, SplitHdl) { - mpSplitter->SetPosPixel( Point( mpSplitter->GetSplitPosPixel(), mpSplitter->GetPosPixel().Y() ) ); + if(mpSplitter->IsHorizontal()) + { + mpSplitter->SetPosPixel( Point( mpSplitter->GetSplitPosPixel(), mpSplitter->GetPosPixel().Y() ) ); + } + else + { + mpSplitter->SetPosPixel( Point( mpSplitter->GetPosPixel().X(), mpSplitter->GetSplitPosPixel() ) ); + } + Resize(); return 0L; diff --git a/svx/source/gallery2/galbrws1.cxx b/svx/source/gallery2/galbrws1.cxx index e449a02e3e81..e1af74e63f0d 100644 --- a/svx/source/gallery2/galbrws1.cxx +++ b/svx/source/gallery2/galbrws1.cxx @@ -131,7 +131,13 @@ long GalleryThemeListBox::PreNotify( NotifyEvent& rNEvt ) // - GalleryBrowser1 - // ------------------- -GalleryBrowser1::GalleryBrowser1( GalleryBrowser* pParent, const ResId& rResId, Gallery* pGallery ) : +GalleryBrowser1::GalleryBrowser1( + Window* pParent, + const ResId& rResId, + Gallery* pGallery, + const ::boost::function<sal_Bool(const KeyEvent&,Window*)>& rKeyInputHandler, + const ::boost::function<void(void)>& rThemeSlectionHandler) + : Control ( pParent, rResId ), maNewTheme ( this, WB_3DLOOK ), mpThemes ( new GalleryThemeListBox( this, WB_TABSTOP | WB_3DLOOK | WB_BORDER | WB_HSCROLL | WB_VSCROLL | WB_AUTOHSCROLL | WB_SORT ) ), @@ -140,7 +146,9 @@ GalleryBrowser1::GalleryBrowser1( GalleryBrowser* pParent, const ResId& rResId, mpThemePropsDlgItemSet( NULL ), aImgNormal ( GalleryResGetBitmapEx( RID_SVXBMP_THEME_NORMAL ) ), aImgDefault ( GalleryResGetBitmapEx( RID_SVXBMP_THEME_DEFAULT ) ), - aImgReadOnly ( GalleryResGetBitmapEx( RID_SVXBMP_THEME_READONLY ) ) + aImgReadOnly ( GalleryResGetBitmapEx( RID_SVXBMP_THEME_READONLY ) ), + maKeyInputHandler(rKeyInputHandler), + maThemeSlectionHandler(rThemeSlectionHandler) { StartListening( *mpGallery ); @@ -563,7 +571,9 @@ void GalleryBrowser1::ShowContextMenu() sal_Bool GalleryBrowser1::KeyInput( const KeyEvent& rKEvt, Window* pWindow ) { - sal_Bool bRet = static_cast< GalleryBrowser* >( GetParent() )->KeyInput( rKEvt, pWindow ); + sal_Bool bRet (sal_False); + if (maKeyInputHandler) + bRet = maKeyInputHandler(rKEvt, pWindow); if( !bRet ) { @@ -671,7 +681,8 @@ IMPL_LINK( GalleryBrowser1, PopupMenuHdl, Menu*, pMenu ) IMPL_LINK_NOARG(GalleryBrowser1, SelectThemeHdl) { - ( (GalleryBrowser*) GetParent() )->ThemeSelectionHasChanged(); + if (maThemeSlectionHandler) + maThemeSlectionHandler(); return 0L; } diff --git a/svx/source/gallery2/galbrws1.hxx b/svx/source/gallery2/galbrws1.hxx index 84dbc18cbcf2..8c667c1f8026 100644 --- a/svx/source/gallery2/galbrws1.hxx +++ b/svx/source/gallery2/galbrws1.hxx @@ -24,6 +24,8 @@ #include <vector> #include "svx/galbrws.hxx" +#include <boost/function.hpp> + // ----------------- // - GalleryButton - // ----------------- @@ -70,9 +72,12 @@ class VclAbstractDialog2; struct ExchangeData; class SfxItemSet; +namespace svx { namespace sidebar { class GalleryControl; } } + class GalleryBrowser1 : public Control, SfxListener { friend class GalleryBrowser; + friend class svx::sidebar::GalleryControl; friend class GalleryThemeListBox; using Control::Notify; using Window::KeyInput; @@ -90,6 +95,9 @@ private: Image aImgReadOnly; Image aImgImported; + ::boost::function<sal_Bool(const KeyEvent&,Window*)> maKeyInputHandler; + ::boost::function<void(void)> maThemeSlectionHandler; + void ImplAdjustControls(); sal_uIntPtr ImplInsertThemeEntry( const GalleryThemeEntry* pEntry ); void ImplFillExchangeData( const GalleryTheme* pThm, ExchangeData& rData ); @@ -115,7 +123,12 @@ private: public: - GalleryBrowser1( GalleryBrowser* pParent, const ResId& rResId, Gallery* pGallery ); + GalleryBrowser1( + Window* pParent, + const ResId& rResId, + Gallery* pGallery, + const ::boost::function<sal_Bool(const KeyEvent&,Window*)>& rKeyInputHandler, + const ::boost::function<void(void)>& rThemeSlectionHandler); ~GalleryBrowser1(); void SelectTheme( const String& rThemeName ) { mpThemes->SelectEntry( rThemeName ); SelectThemeHdl( NULL ); } diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx index 00b975236a65..baba4094bc11 100644 --- a/svx/source/gallery2/galbrws2.cxx +++ b/svx/source/gallery2/galbrws2.cxx @@ -46,6 +46,7 @@ #include <svx/dialmgr.hxx> #include <svx/svxdlg.hxx> #include <svx/dialogs.hrc> +#include "GalleryControl.hxx" #undef GALLERY_USE_CLIPBOARD @@ -265,7 +266,7 @@ void GalleryToolBox::KeyInput( const KeyEvent& rKEvt ) DBG_NAME(GalleryBrowser2) -GalleryBrowser2::GalleryBrowser2( GalleryBrowser* pParent, const ResId& rResId, Gallery* pGallery ) : +GalleryBrowser2::GalleryBrowser2( Window* pParent, const ResId& rResId, Gallery* pGallery ) : Control ( pParent, rResId ), mpGallery ( pGallery ), mpCurTheme ( NULL ), @@ -501,7 +502,16 @@ sal_Bool GalleryBrowser2::KeyInput( const KeyEvent& rKEvt, Window* pWindow ) { Point aSelPos; const sal_uIntPtr nItemId = ImplGetSelectedItemId( NULL, aSelPos ); - sal_Bool bRet = static_cast< GalleryBrowser* >( GetParent() )->KeyInput( rKEvt, pWindow ); + GalleryBrowser* pParentBrowser = dynamic_cast<GalleryBrowser*>(GetParent()); + sal_Bool bRet = sal_False; + if (pParentBrowser != NULL) + bRet = pParentBrowser->KeyInput( rKEvt, pWindow ); + else + { + svx::sidebar::GalleryControl* pParentControl = dynamic_cast<svx::sidebar::GalleryControl*>(GetParent()); + if (pParentControl != NULL) + bRet = pParentControl->GalleryKeyInput(rKEvt, pWindow); + } if( !bRet && !maViewBox.HasFocus() && nItemId && mpCurTheme ) { diff --git a/svx/source/items/svxitems.src b/svx/source/items/svxitems.src index 49bb30dcde45..587d97a35026 100644 --- a/svx/source/items/svxitems.src +++ b/svx/source/items/svxitems.src @@ -206,7 +206,7 @@ String RID_SVXITEMS_BRUSHSTYLE_BITMAP { Text [ en-US ] = "Image" ; }; - +// end enum ColorName ----------------------------------------------------------- String RID_SVXITEMS_ORI_STANDARD { Text [ en-US ] = "Default orientation" ; diff --git a/svx/source/sdr/attribute/sdrformtextattribute.cxx b/svx/source/sdr/attribute/sdrformtextattribute.cxx index 819f3d5b87ee..4f0a145fc1a9 100644 --- a/svx/source/sdr/attribute/sdrformtextattribute.cxx +++ b/svx/source/sdr/attribute/sdrformtextattribute.cxx @@ -50,27 +50,27 @@ namespace { - basegfx::B2DLineJoin impGetB2DLineJoin(XLineJoint eLineJoint) + basegfx::B2DLineJoin impGetB2DLineJoin(com::sun::star::drawing::LineJoint eLineJoint) { switch(eLineJoint) { - case XLINEJOINT_MIDDLE : + case com::sun::star::drawing::LineJoint_MIDDLE : { return basegfx::B2DLINEJOIN_MIDDLE; } - case XLINEJOINT_BEVEL : + case com::sun::star::drawing::LineJoint_BEVEL : { return basegfx::B2DLINEJOIN_BEVEL; } - case XLINEJOINT_MITER : + case com::sun::star::drawing::LineJoint_MITER : { return basegfx::B2DLINEJOIN_MITER; } - case XLINEJOINT_ROUND : + case com::sun::star::drawing::LineJoint_ROUND : { return basegfx::B2DLINEJOIN_ROUND; } - default : + default : // com::sun::star::drawing::LineJoint_NONE { return basegfx::B2DLINEJOIN_NONE; // XLINEJOINT_NONE } @@ -109,8 +109,7 @@ namespace } const sal_uInt32 nLineWidth = ((const XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue(); - const XLineJoint eLineJoint = ((const XLineJointItem&)(rSet.Get(XATTR_LINEJOINT))).GetValue(); - + const com::sun::star::drawing::LineJoint eLineJoint = ((const XLineJointItem&)(rSet.Get(XATTR_LINEJOINT))).GetValue(); const com::sun::star::drawing::LineCap eLineCap = ((const XLineCapItem&)(rSet.Get(XATTR_LINECAP))).GetValue(); return drawinglayer::attribute::LineAttribute( diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx index 10e3dd171a60..a6fd57358534 100644 --- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx +++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx @@ -132,29 +132,29 @@ namespace drawinglayer } } - basegfx::B2DLineJoin XLineJointtoB2DLineJoin(XLineJoint eLineJoint) + basegfx::B2DLineJoin LineJointToB2DLineJoin(com::sun::star::drawing::LineJoint eLineJoint) { switch(eLineJoint) { - case XLINEJOINT_MIDDLE : + case com::sun::star::drawing::LineJoint_MIDDLE : { return basegfx::B2DLINEJOIN_MIDDLE; } - case XLINEJOINT_BEVEL : + case com::sun::star::drawing::LineJoint_BEVEL : { return basegfx::B2DLINEJOIN_BEVEL; } - case XLINEJOINT_MITER : + case com::sun::star::drawing::LineJoint_MITER : { return basegfx::B2DLINEJOIN_MITER; } - case XLINEJOINT_ROUND : + case com::sun::star::drawing::LineJoint_ROUND : { return basegfx::B2DLINEJOIN_ROUND; } - default : + default : // com::sun::star::drawing::LineJoint_NONE { - return basegfx::B2DLINEJOIN_NONE; // XLINEJOINT_NONE + return basegfx::B2DLINEJOIN_NONE; } } } @@ -233,7 +233,7 @@ namespace drawinglayer { const sal_uInt32 nWidth(((const XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue()); const Color aColor(((const XLineColorItem&)(rSet.Get(XATTR_LINECOLOR))).GetColorValue()); - const XLineJoint eJoint(((const XLineJointItem&)(rSet.Get(XATTR_LINEJOINT))).GetValue()); + const com::sun::star::drawing::LineJoint eJoint(((const XLineJointItem&)(rSet.Get(XATTR_LINEJOINT))).GetValue()); const com::sun::star::drawing::LineCap eCap(((const XLineCapItem&)(rSet.Get(XATTR_LINECAP))).GetValue()); ::std::vector< double > aDotDashArray; double fFullDotDashLen(0.0); @@ -249,7 +249,7 @@ namespace drawinglayer } return attribute::SdrLineAttribute( - XLineJointtoB2DLineJoin(eJoint), + LineJointToB2DLineJoin(eJoint), (double)nWidth, (double)nTransparence * 0.01, aColor.getBColor(), @@ -394,6 +394,26 @@ namespace drawinglayer if(100 != nTransparence) { + // need to check XFillFloatTransparence, object fill may still be completely transparent + const SfxPoolItem* pGradientItem; + + if(SFX_ITEM_SET == rSet.GetItemState(XATTR_FILLFLOATTRANSPARENCE, sal_True, &pGradientItem) + && ((XFillFloatTransparenceItem*)pGradientItem)->IsEnabled()) + { + const XGradient& rGradient = ((XFillFloatTransparenceItem*)pGradientItem)->GetGradientValue(); + const sal_uInt8 nStartLuminance(rGradient.GetStartColor().GetLuminance()); + const sal_uInt8 nEndLuminance(rGradient.GetEndColor().GetLuminance()); + const bool bCompletelyTransparent(0xff == nStartLuminance && 0xff == nEndLuminance); + + if(bCompletelyTransparent) + { + nTransparence = 100; + } + } + } + + if(100 != nTransparence) + { const Color aColor(((const XFillColorItem&)(rSet.Get(XATTR_FILLCOLOR))).GetColorValue()); attribute::FillGradientAttribute aGradient; attribute::FillHatchAttribute aHatch; @@ -564,8 +584,13 @@ namespace drawinglayer const sal_uInt8 nStartLuminance(rGradient.GetStartColor().GetLuminance()); const sal_uInt8 nEndLuminance(rGradient.GetEndColor().GetLuminance()); const bool bCompletelyTransparent(0xff == nStartLuminance && 0xff == nEndLuminance); + const bool bNotTransparent(0x00 == nStartLuminance && 0x00 == nEndLuminance); - if(!bCompletelyTransparent) + // create nothing when completely transparent: This case is already checked for the + // normal fill attributes, XFILL_NONE will be used. + // create nothing when not transparent: use normal fill, no need t create a FillGradientAttribute. + // Both cases are optimizations, always creating FillGradientAttribute will work, too + if(!bNotTransparent && !bCompletelyTransparent) { const double fStartLum(nStartLuminance / 255.0); const double fEndLum(nEndLuminance / 255.0); diff --git a/svx/source/sidebar/ColorPanel.cxx b/svx/source/sidebar/ColorPanel.cxx new file mode 100644 index 000000000000..92874c03f139 --- /dev/null +++ b/svx/source/sidebar/ColorPanel.cxx @@ -0,0 +1,229 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "precompiled_svx.hxx" + +#include "ColorPanel.hxx" + +#include <vcl/image.hxx> +#include <vcl/svapp.hxx> + +namespace svx { namespace sidebar { + +ColorPanel::ColorPanel (::Window* pParent) + : ValueSet(pParent), + mnPreferredColumnCount(2) +{ + WinBits aStyle = + WB_ITEMBORDER + | WB_DOUBLEBORDER + | WB_NAMEFIELD + | WB_FLATVALUESET + | WB_TABSTOP + | WB_VSCROLL; + + SetStyle(GetStyle() | aStyle); + SetExtraSpacing(2); + + Fill (); + Show(); +} + + + + +ColorPanel::~ColorPanel (void) +{ +} + + + + +sal_Int32 ColorPanel::GetPreferredHeight (sal_Int32 nWidth) +{ + sal_Int32 nPreferredHeight = 0; + if (GetItemCount()>0) + { + Image aImage = GetItemImage(GetItemId(0)); + Size aItemSize = CalcItemSizePixel (aImage.GetSizePixel()); + if (nWidth>0 && aItemSize.Width()>0) + { + int nColumnCount = nWidth / aItemSize.Width(); + if (nColumnCount <= 0) + nColumnCount = 1; + else if (nColumnCount > 4) + nColumnCount = 4; + int nRowCount = (GetItemCount() + nColumnCount-1) + / nColumnCount; + nPreferredHeight = nRowCount * aItemSize.Height(); + } + } + return nPreferredHeight; +} + + + + +void ColorPanel::Resize (void) +{ + ::Window::Resize(); + Size aWindowSize = GetOutputSizePixel(); + SetPosSizePixel(Point(0,0), aWindowSize); + if (IsVisible() && aWindowSize.Width() > 0) + { + // Calculate the number of rows and columns. + if (GetItemCount() > 0) + { + Image aImage = GetItemImage(GetItemId(0)); + Size aItemSize = CalcItemSizePixel ( + aImage.GetSizePixel()); + int nColumnCount = aWindowSize.Width() / 30; + if (nColumnCount < 1) + nColumnCount = 1; + else if (nColumnCount > 4) + nColumnCount = 4; + + sal_uInt16 nRowCount = (sal_uInt16)CalculateRowCount(aItemSize, nColumnCount); + + SetColCount((sal_uInt16)nColumnCount); + SetLineCount(nRowCount); + } + } + +} + + + + +int ColorPanel::CalculateRowCount (const Size&, int nColumnCount) +{ + int nRowCount = 0; + + if (GetItemCount()>0 && nColumnCount>0) + { + nRowCount = GetOutputSizePixel().Height() / 30; + if (nRowCount < 1) + nRowCount = 1; + } + + return nRowCount; +} + + + + +void ColorPanel::DataChanged (const DataChangedEvent& rEvent) +{ + Fill(); +} + + + + +void ColorPanel::Fill (void) +{ + const StyleSettings& rSettings ( + Application::GetSettings().GetStyleSettings()); + Clear(); + SetItemWidth (30); + SetItemHeight (30); + sal_uInt16 i = 0; + InsertItem (++i, rSettings.GetFaceColor()); + SetItemText (i, String::CreateFromAscii("FaceColor")); + InsertItem (++i, rSettings.GetCheckedColor()); + SetItemText (i, String::CreateFromAscii("CheckedColor")); + InsertItem (++i, rSettings.GetLightColor()); + SetItemText (i, String::CreateFromAscii("LightColor")); + InsertItem (++i, rSettings.GetLightBorderColor()); + SetItemText (i, String::CreateFromAscii("LightBorderColor")); + InsertItem (++i, rSettings.GetShadowColor()); + SetItemText (i, String::CreateFromAscii("ShadowColor")); + InsertItem (++i, rSettings.GetDarkShadowColor()); + SetItemText (i, String::CreateFromAscii("DarkShadowColor")); + InsertItem (++i, rSettings.GetButtonTextColor()); + SetItemText (i, String::CreateFromAscii("ButtonTextColor")); + InsertItem (++i, rSettings.GetRadioCheckTextColor()); + SetItemText (i, String::CreateFromAscii("RadioCheckTextColor")); + InsertItem (++i, rSettings.GetGroupTextColor()); + SetItemText (i, String::CreateFromAscii("GroupTextColor")); + InsertItem (++i, rSettings.GetLabelTextColor()); + SetItemText (i, String::CreateFromAscii("LabelTextColor")); + InsertItem (++i, rSettings.GetInfoTextColor()); + SetItemText (i, String::CreateFromAscii("InfoTextColor")); + InsertItem (++i, rSettings.GetWindowColor()); + SetItemText (i, String::CreateFromAscii("WindowColor")); + InsertItem (++i, rSettings.GetWindowTextColor()); + SetItemText (i, String::CreateFromAscii("WindowTextColor")); + InsertItem (++i, rSettings.GetDialogColor()); + SetItemText (i, String::CreateFromAscii("DialogColor")); + InsertItem (++i, rSettings.GetDialogTextColor()); + SetItemText (i, String::CreateFromAscii("DialogTextColor")); + InsertItem (++i, rSettings.GetWorkspaceColor()); + SetItemText (i, String::CreateFromAscii("WorkspaceColor")); + InsertItem (++i, rSettings.GetFieldColor()); + SetItemText (i, String::CreateFromAscii("FieldColor")); + InsertItem (++i, rSettings.GetFieldTextColor()); + SetItemText (i, String::CreateFromAscii("FieldTextColor")); + InsertItem (++i, rSettings.GetActiveColor()); + SetItemText (i, String::CreateFromAscii("ActiveColor")); + InsertItem (++i, rSettings.GetActiveColor2()); + SetItemText (i, String::CreateFromAscii("ActiveColor2")); + InsertItem (++i, rSettings.GetActiveTextColor()); + SetItemText (i, String::CreateFromAscii("ActiveTextColor")); + InsertItem (++i, rSettings.GetActiveBorderColor()); + SetItemText (i, String::CreateFromAscii("ActiveBorderColor")); + InsertItem (++i, rSettings.GetDeactiveColor()); + SetItemText (i, String::CreateFromAscii("DeactiveColor")); + InsertItem (++i, rSettings.GetDeactiveColor2()); + SetItemText (i, String::CreateFromAscii("DeactiveColor2")); + InsertItem (++i, rSettings.GetDeactiveTextColor()); + SetItemText (i, String::CreateFromAscii("DeactiveTextColor")); + InsertItem (++i, rSettings.GetDeactiveBorderColor()); + SetItemText (i, String::CreateFromAscii("DeactiveBorderColor")); + InsertItem (++i, rSettings.GetHighlightColor()); + SetItemText (i, String::CreateFromAscii("HighlightColor")); + InsertItem (++i, rSettings.GetHighlightTextColor()); + SetItemText (i, String::CreateFromAscii("HighlightTextColor")); + InsertItem (++i, rSettings.GetDisableColor()); + SetItemText (i, String::CreateFromAscii("DisableColor")); + InsertItem (++i, rSettings.GetHelpColor()); + SetItemText (i, String::CreateFromAscii("HelpColor")); + InsertItem (++i, rSettings.GetHelpTextColor()); + SetItemText (i, String::CreateFromAscii("HelpTextColor")); + InsertItem (++i, rSettings.GetMenuColor()); + SetItemText (i, String::CreateFromAscii("MenuColor")); + InsertItem (++i, rSettings.GetMenuBarColor()); + SetItemText (i, String::CreateFromAscii("MenuBarColor")); + InsertItem (++i, rSettings.GetMenuBorderColor()); + SetItemText (i, String::CreateFromAscii("MenuBorderColor")); + InsertItem (++i, rSettings.GetMenuTextColor()); + SetItemText (i, String::CreateFromAscii("MenuTextColor")); + InsertItem (++i, rSettings.GetMenuHighlightColor()); + SetItemText (i, String::CreateFromAscii("MenuHighlightColor")); + InsertItem (++i, rSettings.GetMenuHighlightTextColor()); + SetItemText (i, String::CreateFromAscii("MenuHighlightTextColor")); + InsertItem (++i, rSettings.GetLinkColor()); + SetItemText (i, String::CreateFromAscii("LinkColor")); + InsertItem (++i, rSettings.GetVisitedLinkColor()); + SetItemText (i, String::CreateFromAscii("VisitedLinkColor")); + InsertItem (++i, rSettings.GetHighlightLinkColor()); + SetItemText (i, String::CreateFromAscii("HighlightLinkColor")); + InsertItem (++i, rSettings.GetFontColor()); + SetItemText (i, String::CreateFromAscii("FontColor")); +} + +} } // end of namespace ::svx::sidebar diff --git a/svx/source/sidebar/ColorPanel.hxx b/svx/source/sidebar/ColorPanel.hxx new file mode 100644 index 000000000000..4168dff96999 --- /dev/null +++ b/svx/source/sidebar/ColorPanel.hxx @@ -0,0 +1,60 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SVX_SIDEBAR_COLOR_PANEL_HXX +#define SVX_SIDEBAR_COLOR_PANEL_HXX + +#include <svtools/valueset.hxx> +#include <vcl/window.hxx> + + +namespace svx { namespace sidebar { + + +/** This demo panel shows the colors that are available from the + StyleSettings. +*/ +class ColorPanel + : public ValueSet +{ +public: + ColorPanel (::Window* pParent); + virtual ~ColorPanel (void); + + // From ::Window + virtual void Resize (void); + virtual void DataChanged (const DataChangedEvent& rEvent); + +private: + int mnPreferredColumnCount; + + /** Depending on the given number of columns and the item size + calculate the number of rows that are necessary to display all + items. + */ + int CalculateRowCount (const Size& rItemSize, int nColumnCount); + void Fill (void); + + sal_Int32 GetPreferredHeight (sal_Int32 nWidth); +}; + +} } // end of namespace ::svx::sidebar + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/sidebar/ContextChangeEventMultiplexer.cxx b/svx/source/sidebar/ContextChangeEventMultiplexer.cxx new file mode 100644 index 000000000000..427c37a37d03 --- /dev/null +++ b/svx/source/sidebar/ContextChangeEventMultiplexer.cxx @@ -0,0 +1,86 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "svx/sidebar/ContextChangeEventMultiplexer.hxx" + +#include <com/sun/star/ui/ContextChangeEventObject.hpp> +#include <com/sun/star/ui/XContextChangeEventMultiplexer.hpp> +#include <com/sun/star/ui/ContextChangeEventMultiplexer.hpp> +#include <com/sun/star/frame/XModuleManager.hpp> +#include <comphelper/processfactory.hxx> +#include <comphelper/componentcontext.hxx> +#include <sfx2/viewsh.hxx> +#include <tools/diagnose_ex.h> + +using namespace css; +using namespace cssu; + + +void ContextChangeEventMultiplexer::NotifyContextChange ( + const cssu::Reference<css::frame::XController>& rxController, + const ::sfx2::sidebar::EnumContext::Context eContext) +{ + if (rxController.is() && rxController->getFrame().is()) + { + const css::ui::ContextChangeEventObject aEvent( + rxController, + GetModuleName(rxController->getFrame()), + ::sfx2::sidebar::EnumContext::GetContextName(eContext)); + + cssu::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer ( + css::ui::ContextChangeEventMultiplexer::get( + ::comphelper::getProcessComponentContext())); + if (xMultiplexer.is()) + xMultiplexer->broadcastContextChangeEvent(aEvent, rxController); + } +} + + + + +void ContextChangeEventMultiplexer::NotifyContextChange ( + SfxViewShell* pViewShell, + const ::sfx2::sidebar::EnumContext::Context eContext) +{ + if (pViewShell != NULL) + NotifyContextChange(pViewShell->GetController(), eContext); +} + + + + +::rtl::OUString ContextChangeEventMultiplexer::GetModuleName ( + const cssu::Reference<css::frame::XFrame>& rxFrame) +{ + try + { + const ::comphelper::ComponentContext aContext (::comphelper::getProcessServiceFactory()); + const Reference<frame::XModuleManager> xModuleManager ( + aContext.createComponent("com.sun.star.frame.ModuleManager" ), + UNO_QUERY_THROW ); + return xModuleManager->identify(rxFrame); + } + catch (const Exception&) + { + // An exception typically means that a context change is notified + // during initialization or destruction of a view. + // Ignore it. + } + return ::sfx2::sidebar::EnumContext::GetApplicationName( + ::sfx2::sidebar::EnumContext::Application_None); +} diff --git a/svx/source/sidebar/EmptyPanel.cxx b/svx/source/sidebar/EmptyPanel.cxx new file mode 100644 index 000000000000..2f8943684e85 --- /dev/null +++ b/svx/source/sidebar/EmptyPanel.cxx @@ -0,0 +1,75 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "EmptyPanel.hxx" +#include "EmptyPanel.hrc" +#include "area/AreaPropertyPanel.hrc" +#include "svx/dialogs.hrc" +#include "svx/dialmgr.hxx" + + +namespace svx { namespace sidebar { + +namespace +{ + class SidebarResource : public Resource + { + public: + SidebarResource (const ResId& rResId) : Resource(rResId) {} + ~SidebarResource (void) { FreeResource(); } + }; +} + + + + +EmptyPanel::EmptyPanel (::Window* pParent) + : Control(pParent, SVX_RES(RID_SIDEBAR_EMPTY_PANEL)), + maMessageControl(this, SVX_RES(FT_MESSAGE)) +{ + maMessageControl.setPosSizePixel(5,5, 250,15); + maMessageControl.SetStyle(WB_WORDBREAK);// | WB_NOMNEMONICS); + //maMessageControl.GetStyle() + // & ~(WB_NOMULTILINE | WB_PATHELLIPSIS) + // | WB_WORDBREAK | WB_NOMNEMONICS); + FreeResource(); + + SetBackground(Wallpaper()); + + maMessageControl.Show(); + Show(); +} + + + + +EmptyPanel::~EmptyPanel (void) +{ +} + + + + +void EmptyPanel::Resize (void) +{ + const Size aSize (GetSizePixel()); + maMessageControl.SetSizePixel(aSize); +} + + +} } // end of namespace ::svx::sidebar diff --git a/svx/source/inc/linectrl.hrc b/svx/source/sidebar/EmptyPanel.hrc index 7f3b8ab1dce6..26f5defff662 100644 --- a/svx/source/inc/linectrl.hrc +++ b/svx/source/sidebar/EmptyPanel.hrc @@ -16,6 +16,10 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#define RID_SVXCTRL_LINECTRL 257 +#include <svx/dialogs.hrc> + +// For RID_SIDEBAR_EMPTY_PANEL + +#define FT_MESSAGE 1 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/sidebar/EmptyPanel.hxx b/svx/source/sidebar/EmptyPanel.hxx new file mode 100644 index 000000000000..96a674bdd994 --- /dev/null +++ b/svx/source/sidebar/EmptyPanel.hxx @@ -0,0 +1,50 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SVX_SIDEBAR_DEBUG_EMPTY_PANEL_HXX +#define SVX_SIDEBAR_DEBUG_EMPTY_PANEL_HXX + +#include <vcl/window.hxx> +#include <vcl/ctrl.hxx> +#include <vcl/fixed.hxx> + + +namespace svx { namespace sidebar { + + +/** Display a panel that tells the user that the current deck is + intentionally empty. +*/ +class EmptyPanel + : public Control +{ +public: + EmptyPanel (::Window* pParent); + virtual ~EmptyPanel (void); + + virtual void Resize (void); + +private: + FixedText maMessageControl; +}; + +} } // end of namespace ::svx::sidebar + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/sidebar/EmptyPanel.src b/svx/source/sidebar/EmptyPanel.src new file mode 100644 index 000000000000..77e375b7cb91 --- /dev/null +++ b/svx/source/sidebar/EmptyPanel.src @@ -0,0 +1,29 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "EmptyPanel.hrc" +#include <svx/dialogs.hrc> + +Control RID_SIDEBAR_EMPTY_PANEL +{ + FixedText FT_MESSAGE + { + Pos = MAP_APPFONT(2,2); + Size = MAP_APPFONT(100,24); + Text [en-US] = "Properties for the task that you are performing are not available in the sidebar at this time."; + }; +}; diff --git a/svx/source/sidebar/PanelFactory.cxx b/svx/source/sidebar/PanelFactory.cxx new file mode 100644 index 000000000000..60738503ee8a --- /dev/null +++ b/svx/source/sidebar/PanelFactory.cxx @@ -0,0 +1,205 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "sidebar/PanelFactory.hxx" + +#include "text/TextPropertyPanel.hxx" +#include "paragraph/ParaPropertyPanel.hxx" +#include "area/AreaPropertyPanel.hxx" +#include "graphic/GraphicPropertyPanel.hxx" +#include "line/LinePropertyPanel.hxx" +#include "possize/PosSizePropertyPanel.hxx" +#include "GalleryControl.hxx" +#include "debug/ColorPanel.hxx" +#include "debug/ContextPanel.hxx" +#include "debug/NotYetImplementedPanel.hxx" +#include "EmptyPanel.hxx" +#include <sfx2/sidebar/SidebarPanelBase.hxx> +#include <sfx2/sfxbasecontroller.hxx> +#include <sfx2/templdlg.hxx> +#include <toolkit/helper/vclunohelper.hxx> +#include <vcl/window.hxx> +#include <rtl/ref.hxx> +#include <comphelper/namedvaluecollection.hxx> +#include <com/sun/star/ui/XSidebar.hpp> + +#include <boost/bind.hpp> + + +using namespace css; +using namespace cssu; +using ::rtl::OUString; + + +namespace svx { namespace sidebar { + +#define A2S(s) ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)) +#define IMPLEMENTATION_NAME "org.apache.openoffice.comp.svx.sidebar.PanelFactory" +#define SERVICE_NAME "com.sun.star.ui.UIElementFactory" + + +::rtl::OUString SAL_CALL PanelFactory::getImplementationName (void) +{ + return A2S(IMPLEMENTATION_NAME); +} + + + + +cssu::Reference<cssu::XInterface> SAL_CALL PanelFactory::createInstance ( + const uno::Reference<lang::XMultiServiceFactory>& rxFactory) +{ + (void)rxFactory; + + ::rtl::Reference<PanelFactory> pPanelFactory (new PanelFactory()); + cssu::Reference<cssu::XInterface> xService (static_cast<XWeak*>(pPanelFactory.get()), cssu::UNO_QUERY); + return xService; +} + + + + +cssu::Sequence<OUString> SAL_CALL PanelFactory::getSupportedServiceNames (void) +{ + cssu::Sequence<OUString> aServiceNames (1); + aServiceNames[0] = A2S(SERVICE_NAME); + return aServiceNames; + +} + + + + +PanelFactory::PanelFactory (void) + : PanelFactoryInterfaceBase(m_aMutex) +{ +} + + + + +PanelFactory::~PanelFactory (void) +{ +} + + + + +Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement ( + const ::rtl::OUString& rsResourceURL, + const ::cssu::Sequence<css::beans::PropertyValue>& rArguments) + throw( + container::NoSuchElementException, + lang::IllegalArgumentException, + RuntimeException) +{ + const ::comphelper::NamedValueCollection aArguments (rArguments); + Reference<frame::XFrame> xFrame (aArguments.getOrDefault("Frame", Reference<frame::XFrame>())); + Reference<awt::XWindow> xParentWindow (aArguments.getOrDefault("ParentWindow", Reference<awt::XWindow>())); + Reference<ui::XSidebar> xSidebar (aArguments.getOrDefault("Sidebar", Reference<ui::XSidebar>())); + const sal_uInt64 nBindingsValue (aArguments.getOrDefault("SfxBindings", sal_uInt64(0))); + SfxBindings* pBindings = reinterpret_cast<SfxBindings*>(nBindingsValue); + + ::Window* pParentWindow = VCLUnoHelper::GetWindow(xParentWindow); + if ( ! xParentWindow.is() || pParentWindow==NULL) + throw RuntimeException( + A2S("PanelFactory::createUIElement called without ParentWindow"), + NULL); + if ( ! xFrame.is()) + throw RuntimeException( + A2S("PanelFactory::createUIElement called without Frame"), + NULL); + if (pBindings == NULL) + throw RuntimeException( + A2S("PanelFactory::createUIElement called without SfxBindings"), + NULL); + + Window* pControl = NULL; + ui::LayoutSize aLayoutSize (-1,-1,-1); + +#define DoesResourceEndWith(s) rsResourceURL.endsWithAsciiL(s,strlen(s)) + if (DoesResourceEndWith("/TextPropertyPanel")) + { + pControl = TextPropertyPanel::Create(pParentWindow, xFrame, pBindings, xSidebar); + } + else if (DoesResourceEndWith("/ParaPropertyPanel")) + { + pControl = ParaPropertyPanel::Create(pParentWindow, xFrame, pBindings, xSidebar); + } + else if (DoesResourceEndWith("/AreaPropertyPanel")) + { + pControl = AreaPropertyPanel::Create(pParentWindow, xFrame, pBindings); + } + else if (DoesResourceEndWith("/GraphicPropertyPanel")) + { + pControl = GraphicPropertyPanel::Create(pParentWindow, xFrame, pBindings); + } + else if (DoesResourceEndWith("/LinePropertyPanel")) + { + pControl = LinePropertyPanel::Create(pParentWindow, xFrame, pBindings); + } + else if (DoesResourceEndWith("/PosSizePropertyPanel")) + { + pControl = PosSizePropertyPanel::Create(pParentWindow, xFrame, pBindings, xSidebar); + } + else if (DoesResourceEndWith("/GalleryPanel")) + { + pControl = new GalleryControl(pBindings, pParentWindow); + aLayoutSize = ui::LayoutSize(300,-1,400); + } + else if (DoesResourceEndWith("/StyleListPanel")) + { + pControl = new SfxTemplatePanelControl(pBindings, pParentWindow); + aLayoutSize = ui::LayoutSize(0,-1,-1); + } + else if (DoesResourceEndWith("/Debug_ColorPanel")) + { + pControl = new ColorPanel(pParentWindow); + aLayoutSize = ui::LayoutSize(300,-1,400); + } + else if (DoesResourceEndWith("/Debug_ContextPanel")) + { + pControl = new ContextPanel(pParentWindow); + aLayoutSize = ui::LayoutSize(45,45,45); + } + else if (DoesResourceEndWith("/Debug_NotYetImplementedPanel")) + { + pControl = new NotYetImplementedPanel(pParentWindow); + aLayoutSize = ui::LayoutSize(20,25,25); + } + else if (DoesResourceEndWith("/EmptyPanel")) + { + pControl = new EmptyPanel(pParentWindow); + aLayoutSize = ui::LayoutSize(20,-1, 50); + } +#undef DoesResourceEndWith + + if (pControl != NULL) + { + return sfx2::sidebar::SidebarPanelBase::Create( + rsResourceURL, + xFrame, + pControl, + aLayoutSize); + } + else + return Reference<ui::XUIElement>(); +} + +} } // end of namespace svx::sidebar + +// eof diff --git a/svx/source/sidebar/SelectionAnalyzer.cxx b/svx/source/sidebar/SelectionAnalyzer.cxx new file mode 100644 index 000000000000..2f201e98125c --- /dev/null +++ b/svx/source/sidebar/SelectionAnalyzer.cxx @@ -0,0 +1,456 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "svx/sidebar/SelectionAnalyzer.hxx" +#include "svx/svdmrkv.hxx" +#include "svx/svdobj.hxx" +#include "svx/svdpage.hxx" +#include "svx/fmglob.hxx" +#include "svx/globl3d.hxx" + +using sfx2::sidebar::EnumContext; + + +namespace svx { namespace sidebar { + +EnumContext::Context SelectionAnalyzer::GetContextForSelection_SC (const SdrMarkList& rMarkList) +{ + EnumContext::Context eContext = EnumContext::Context_Unknown; + + switch (rMarkList.GetMarkCount()) + { + case 0: + // Empty selection. Return Context_Unknown to let the caller + // substitute it with the default context. + break; + + case 1: + { + SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); + const sal_uInt32 nInv = pObj->GetObjInventor(); + const sal_uInt16 nObjId = pObj->GetObjIdentifier(); + if (nInv == SdrInventor) + eContext = GetContextForObjectId_SC(nObjId); + else if (nInv == FmFormInventor) + eContext = EnumContext::Context_Form; + break; + } + + default: + { + // Multi selection. + switch (GetInventorTypeFromMark(rMarkList)) + { + case SdrInventor: + { + const sal_uInt16 nObjId (GetObjectTypeFromMark(rMarkList)); + if (nObjId == 0) + eContext = EnumContext::Context_MultiObject; + else + eContext = GetContextForObjectId_SC(nObjId); + break; + } + + case FmFormInventor: + eContext = EnumContext::Context_Form; + break; + + case 0: + eContext = EnumContext::Context_MultiObject; + break; + } + } + } + + return eContext; +} + + + + +EnumContext::Context SelectionAnalyzer::GetContextForSelection_SD ( + const SdrMarkList& rMarkList, + const bool bIsMasterPage, + const bool bIsHandoutPage, + const bool bIsNotesPage) +{ + EnumContext::Context eContext = EnumContext::Context_Unknown; + + // Note that some cases are handled by the caller. They rely on + // sd specific data. + switch (rMarkList.GetMarkCount()) + { + case 0: + if (bIsHandoutPage) + eContext = EnumContext::Context_HandoutPage; + else if (bIsNotesPage) + eContext = EnumContext::Context_NotesPage; + else if (bIsMasterPage) + eContext = EnumContext::Context_MasterPage; + else + eContext = EnumContext::Context_DrawPage; + break; + + case 1: + { + SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); + const sal_uInt32 nInv = pObj->GetObjInventor(); + sal_uInt16 nObjId = pObj->GetObjIdentifier(); + if (nInv == SdrInventor) + { + if (nObjId == OBJ_GRUP) + { + nObjId = GetObjectTypeFromGroup(pObj); + if (nObjId == 0) + nObjId = OBJ_GRUP; + } + eContext = GetContextForObjectId_SD(nObjId, bIsHandoutPage, bIsNotesPage); + } + else if (nInv == E3dInventor) + { + eContext = EnumContext::Context_3DObject; + } + else if (nInv == FmFormInventor) + { + eContext = EnumContext::Context_Form; + } + break; + } + + default: + { + switch (GetInventorTypeFromMark(rMarkList)) + { + case SdrInventor: + { + const sal_uInt16 nObjId = GetObjectTypeFromMark(rMarkList); + if (nObjId == 0) + eContext = EnumContext::Context_MultiObject; + else + eContext = GetContextForObjectId_SD(nObjId, bIsHandoutPage, bIsNotesPage); + break; + } + + case E3dInventor: + eContext = EnumContext::Context_3DObject; + break; + + case FmFormInventor: + eContext = EnumContext::Context_Form; + break; + + case 0: + eContext = EnumContext::Context_MultiObject; + break; + } + break; + } + } + + return eContext; +} + + + + +EnumContext::Context SelectionAnalyzer::GetContextForObjectId_SC (const sal_uInt16 nObjectId) +{ + switch (nObjectId) + { + case OBJ_CAPTION: + case OBJ_TITLETEXT: + case OBJ_OUTLINETEXT: + case OBJ_TEXT: + case OBJ_TEXTEXT: + case OBJ_PATHLINE: + case OBJ_PLIN: + case OBJ_FREELINE: + case OBJ_EDGE: + case OBJ_LINE: + case OBJ_MEASURE: + case OBJ_RECT: + case OBJ_CIRC: + case OBJ_FREEFILL: + case OBJ_PATHFILL: + case OBJ_POLY: + case OBJ_SECT: + case OBJ_CARC: + case OBJ_CCUT: + case OBJ_CUSTOMSHAPE: + case OBJ_GRUP: + return EnumContext::Context_Draw; + + case OBJ_GRAF: + return EnumContext::Context_Graphic; + + case OBJ_OLE2: + return EnumContext::Context_OLE; + + case OBJ_MEDIA: + return EnumContext::Context_Media; + break; + + default: + return EnumContext::Context_Unknown; + } +} + + + + +EnumContext::Context SelectionAnalyzer::GetContextForObjectId_SD ( + const sal_uInt16 nObjectId, + const bool bIsHandoutPage, + const bool bIsNotesPage) +{ + switch (nObjectId) + { + case OBJ_CAPTION: + case OBJ_PATHLINE: + case OBJ_PLIN: + case OBJ_FREELINE: + case OBJ_EDGE: + case OBJ_LINE: + case OBJ_MEASURE: + case OBJ_RECT: + case OBJ_CIRC: + case OBJ_FREEFILL: + case OBJ_PATHFILL: + case OBJ_POLY: + case OBJ_SECT: + case OBJ_CARC: + case OBJ_CCUT: + case OBJ_CUSTOMSHAPE: + case OBJ_GRUP: + return EnumContext::Context_Draw; + + case OBJ_TITLETEXT: + case OBJ_OUTLINETEXT: + case OBJ_TEXT: + case OBJ_TEXTEXT: + return EnumContext::Context_TextObject; + + case OBJ_GRAF: + return EnumContext::Context_Graphic; + + case OBJ_OLE2: + return EnumContext::Context_OLE; + + case OBJ_MEDIA: + return EnumContext::Context_Media; + + case OBJ_TABLE: + return EnumContext::Context_Table; + + case OBJ_PAGE: + if (bIsHandoutPage) + return EnumContext::Context_HandoutPage; + else if (bIsNotesPage) + return EnumContext::Context_NotesPage; + else + return EnumContext::Context_Unknown; + + default: + return EnumContext::Context_Unknown; + } +} + + + + +sal_uInt32 SelectionAnalyzer::GetInventorTypeFromMark (const SdrMarkList& rMarkList) +{ + const sal_uLong nMarkCount (rMarkList.GetMarkCount()); + + if (nMarkCount < 1) + return 0; + + SdrMark* pMark = rMarkList.GetMark(0); + SdrObject* pObj = pMark->GetMarkedSdrObj(); + const sal_uInt32 nFirstInv = pObj->GetObjInventor(); + + for (sal_uLong nIndex=1; nIndex<nMarkCount; ++nIndex) + { + pMark = rMarkList.GetMark(nIndex); + pObj = pMark->GetMarkedSdrObj(); + const sal_uInt32 nInv (pObj->GetObjInventor()); + + if (nInv != nFirstInv) + return 0; + } + + return nFirstInv; +} + + + + +sal_uInt16 SelectionAnalyzer::GetObjectTypeFromGroup (const SdrObject* pObj) +{ + SdrObjList* pObjList = pObj->GetSubList(); + if (pObjList) + { + const sal_uLong nSubObjCount (pObjList->GetObjCount()); + + if (nSubObjCount>0) + { + SdrObject* pSubObj = pObjList->GetObj(0); + sal_uInt16 nResultType = pSubObj->GetObjIdentifier(); + + if (nResultType == OBJ_GRUP) + nResultType = GetObjectTypeFromGroup(pSubObj); + + if (IsShapeType(nResultType)) + nResultType = OBJ_CUSTOMSHAPE; + + if (IsTextObjType(nResultType)) + nResultType = OBJ_TEXT; + + for (sal_uInt16 nIndex=1; nIndex<nSubObjCount; ++nIndex) + { + pSubObj = pObjList->GetObj(nIndex); + sal_uInt16 nType (pSubObj->GetObjIdentifier()); + + if(nType == OBJ_GRUP) + nType = GetObjectTypeFromGroup(pSubObj); + + if (IsShapeType(nType)) + nType = OBJ_CUSTOMSHAPE; + + if ((nType == OBJ_CUSTOMSHAPE) && (nResultType == OBJ_TEXT)) + nType = OBJ_TEXT; + + if (IsTextObjType(nType)) + nType = OBJ_TEXT; + + if ((nType == OBJ_TEXT) && (nResultType == OBJ_CUSTOMSHAPE)) + nResultType = OBJ_TEXT; + + if (nType != nResultType) + return 0; + } + + return nResultType; + } + } + + return 0; +} + + + + +sal_uInt16 SelectionAnalyzer::GetObjectTypeFromMark (const SdrMarkList& rMarkList) +{ + const sal_uLong nMarkCount (rMarkList.GetMarkCount()); + + if (nMarkCount < 1) + return 0; + + SdrMark* pMark = rMarkList.GetMark(0); + SdrObject* pObj = pMark->GetMarkedSdrObj(); + sal_uInt16 nResultType = pObj->GetObjIdentifier(); + + if(nResultType == OBJ_GRUP) + nResultType = GetObjectTypeFromGroup(pObj); + + if (IsShapeType(nResultType)) + nResultType = OBJ_CUSTOMSHAPE; + + if (IsTextObjType(nResultType)) + nResultType = OBJ_TEXT; + + for (sal_uLong nIndex=1; nIndex<nMarkCount; ++nIndex) + { + pMark = rMarkList.GetMark(nIndex); + pObj = pMark->GetMarkedSdrObj(); + sal_uInt16 nType = pObj->GetObjIdentifier(); + + if(nType == OBJ_GRUP) + nType = GetObjectTypeFromGroup(pObj); + + if (IsShapeType(nType)) + nType = OBJ_CUSTOMSHAPE; + + if ((nType == OBJ_CUSTOMSHAPE) && (nResultType == OBJ_TEXT)) + nType = OBJ_TEXT; + + if (IsTextObjType(nType)) + nType = OBJ_TEXT; + + if ((nType == OBJ_TEXT) && (nResultType == OBJ_CUSTOMSHAPE)) + nResultType = OBJ_TEXT; + + if (nType != nResultType) + return 0; + } + + return nResultType; +} + + + + +bool SelectionAnalyzer::IsShapeType (const sal_uInt16 nType) +{ + switch (nType) + { + case OBJ_LINE: + case OBJ_CARC: + case OBJ_PLIN: + case OBJ_PATHLINE: + case OBJ_RECT: + case OBJ_CIRC: + case OBJ_SECT: + case OBJ_CCUT: + case OBJ_PATHFILL: + case OBJ_CUSTOMSHAPE: + case OBJ_CAPTION: + case OBJ_MEASURE: + case OBJ_EDGE: + case OBJ_POLY: + case OBJ_FREELINE: + case OBJ_FREEFILL: + return true; + + default: + return false; + } +} + + + + +bool SelectionAnalyzer::IsTextObjType (const sal_uInt16 nType) +{ + switch(nType) + { + case OBJ_TEXT: + case OBJ_TEXTEXT: + case OBJ_TITLETEXT: + case OBJ_OUTLINETEXT: + return true; + + default: + return false; + } +} + + + +} } // end of namespace ::svx::sidebar diff --git a/svx/source/sidebar/SelectionChangeHandler.cxx b/svx/source/sidebar/SelectionChangeHandler.cxx new file mode 100644 index 000000000000..275812fc35e5 --- /dev/null +++ b/svx/source/sidebar/SelectionChangeHandler.cxx @@ -0,0 +1,115 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "svx/sidebar/SelectionChangeHandler.hxx" +#include "svx/sidebar/SelectionAnalyzer.hxx" +#include "svx/sidebar/ContextChangeEventMultiplexer.hxx" +#include "svx/svdmrkv.hxx" + +#include <sfx2/sidebar/EnumContext.hxx> +#include <sfx2/shell.hxx> + + +using namespace css; +using namespace cssu; + +using namespace sfx2::sidebar; + +namespace svx { namespace sidebar { + +SelectionChangeHandler::SelectionChangeHandler ( + const boost::function<sfx2::sidebar::EnumContext::Context(void)>& rSelectionChangeCallback, + const Reference<frame::XController>& rxController, + const EnumContext::Context eDefaultContext) + : SelectionChangeHandlerInterfaceBase(m_aMutex), + maSelectionChangeCallback(rSelectionChangeCallback), + mxController(rxController), + meDefaultContext(eDefaultContext), + mbIsConnected(false) +{ +} + + + + +SelectionChangeHandler::~SelectionChangeHandler (void) +{ +} + + + + +void SAL_CALL SelectionChangeHandler::selectionChanged (const lang::EventObject&) + throw (uno::RuntimeException) +{ + if (maSelectionChangeCallback) + { + const EnumContext::Context eContext (maSelectionChangeCallback()); + ContextChangeEventMultiplexer::NotifyContextChange( + mxController, + eContext==EnumContext::Context_Unknown + ? meDefaultContext + : eContext); + } +} + + + + +void SAL_CALL SelectionChangeHandler::disposing (const lang::EventObject&) + throw (uno::RuntimeException) +{ +} + + + + +void SAL_CALL SelectionChangeHandler::disposing (void) + throw (uno::RuntimeException) +{ + if (mbIsConnected) + Disconnect(); +} + + + + +void SelectionChangeHandler::Connect (void) +{ + uno::Reference<view::XSelectionSupplier> xSupplier (mxController, uno::UNO_QUERY); + if (xSupplier.is()) + { + mbIsConnected = true; + xSupplier->addSelectionChangeListener(this); + } +} + + + + +void SelectionChangeHandler::Disconnect (void) +{ + uno::Reference<view::XSelectionSupplier> xSupplier (mxController, uno::UNO_QUERY); + if (xSupplier.is()) + { + mbIsConnected = false; + xSupplier->removeSelectionChangeListener(this); + } +} + + +} } // end of namespace svx::sidebar diff --git a/svx/source/sidebar/area/AreaPropertyPanel.cxx b/svx/source/sidebar/area/AreaPropertyPanel.cxx new file mode 100644 index 000000000000..0e746aa44d63 --- /dev/null +++ b/svx/source/sidebar/area/AreaPropertyPanel.cxx @@ -0,0 +1,1361 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "svx/sidebar/PopupContainer.hxx" +#include "AreaTransparencyGradientControl.hxx" + +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include <sfx2/sidebar/Theme.hxx> +#include <sfx2/sidebar/ControlFactory.hxx> +#include <AreaPropertyPanel.hxx> +#include <AreaPropertyPanel.hrc> +#include <svx/dialogs.hrc> +#include <svx/dialmgr.hxx> +#include <sfx2/objsh.hxx> +#include <svx/xfltrit.hxx> +#include <svx/xflftrit.hxx> +#include <svx/xtable.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/bindings.hxx> +#include <helpid.hrc> +#include <svtools/valueset.hxx> +#include <unotools/pathoptions.hxx> +#include <svx/svxitems.hrc> +#include <vcl/toolbox.hxx> +#include <svtools/toolbarmenu.hxx> +#include <svx/sidebar/ColorControl.hxx> + +#include <boost/bind.hpp> + +using namespace css; +using namespace cssu; +using ::sfx2::sidebar::Theme; + +#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) + + + + +namespace svx { namespace sidebar { + +const sal_Int32 AreaPropertyPanel::DEFAULT_CENTERX = 50; +const sal_Int32 AreaPropertyPanel::DEFAULT_CENTERY = 50; +const sal_Int32 AreaPropertyPanel::DEFAULT_ANGLE = 0; +const sal_Int32 AreaPropertyPanel::DEFAULT_STARTVALUE = 0; +const sal_Int32 AreaPropertyPanel::DEFAULT_ENDVALUE = 16777215; +const sal_Int32 AreaPropertyPanel::DEFAULT_BORDER = 0; + + +AreaPropertyPanel::AreaPropertyPanel( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings) + : Control(pParent, SVX_RES(RID_SIDEBAR_AREA_PANEL)), + meLastXFS(-1), + maLastColor(Color(COL_DEFAULT_SHAPE_FILLING)), + mnLastPosGradient(0), + mnLastPosHatch(0), + mnLastPosBitmap(0), + mnLastTransSolid(50), + maGradientLinear(), + maGradientAxial(), + maGradientRadial(), + maGradientElliptical(), + maGradientSquare(), + maGradientRect(), + mpColorTextFT(new FixedText(this, SVX_RES(FT_COLOR_LIST))), + mpLbFillType(new SvxFillTypeBox(this)), + mpLbFillAttr(new SvxFillAttrBox(this)), + mpToolBoxColorBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), + mpToolBoxColor(sfx2::sidebar::ControlFactory::CreateToolBox(mpToolBoxColorBackground.get(), SVX_RES(TB_COLOR))), + mpTrspTextFT(new FixedText(this, SVX_RES(FL_TRSP_TEXT))), + mpLBTransType(new ListBox(this, SVX_RES(LB_TRGR_TYPES))), + mpMTRTransparent(new MetricField(this, SVX_RES(MTR_TRANSPARENT))), + mpBTNGradientBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), + mpBTNGradient(sfx2::sidebar::ControlFactory::CreateToolBox(mpBTNGradientBackground.get(), SVX_RES(BTN_GRADIENT))), + mpColorUpdater(new ::svx::ToolboxButtonColorUpdater(SID_ATTR_FILL_COLOR, TBI_COLOR, mpToolBoxColor.get(), TBX_UPDATER_MODE_CHAR_COLOR_NEW)), + mpStyleItem(), + mpColorItem(), + mpFillGradientItem(), + mpHatchItem(), + mpBitmapItem(), + mpColorListItem(), + mpGradientListItem(), + mpHatchListItem(), + mpBitmapListItem(), + maStyleControl(SID_ATTR_FILL_STYLE, *pBindings, *this), + maColorControl(SID_ATTR_FILL_COLOR, *pBindings, *this), + maGradientControl(SID_ATTR_FILL_GRADIENT, *pBindings, *this), + maHatchControl(SID_ATTR_FILL_HATCH, *pBindings, *this), + maBitmapControl(SID_ATTR_FILL_BITMAP, *pBindings, *this), + maColorTableControl(SID_COLOR_TABLE, *pBindings, *this), + maGradientListControl(SID_GRADIENT_LIST, *pBindings, *this), + maHatchListControl(SID_HATCH_LIST, *pBindings, *this), + maBitmapListControl(SID_BITMAP_LIST, *pBindings, *this), + maFillTransparenceController(SID_ATTR_FILL_TRANSPARENCE, *pBindings, *this), + maFillFloatTransparenceController(SID_ATTR_FILL_FLOATTRANSPARENCE, *pBindings, *this), + maImgAxial(SVX_RES(IMG_AXIAL)), + maImgElli(SVX_RES(IMG_ELLI)), + maImgQuad(SVX_RES(IMG_QUAD)), + maImgRadial(SVX_RES(IMG_RADIAL)), + maImgSquare(SVX_RES(IMG_SQUARE)), + maImgLinear(SVX_RES(IMG_LINEAR)), + maImgColor(SVX_RES(IMG_COLOR)), + msHelpFillType(SVX_RES(STR_HELP_TYPE)), + msHelpFillAttr(SVX_RES(STR_HELP_ATTR)), + maTrGrPopup(this, ::boost::bind(&AreaPropertyPanel::CreateTransparencyGradientControl, this, _1)), + maColorPopup(this, ::boost::bind(&AreaPropertyPanel::CreateColorPopupControl, this, _1)), + mpFloatTransparenceItem(), + mpTransparanceItem(), + mxFrame(rxFrame), + mpBindings(pBindings), + mbTBShow(true), + mbColorAvail(true) +{ + Initialize(); + FreeResource(); +} + + + +AreaPropertyPanel::~AreaPropertyPanel() +{ + // Destroy the toolboxes, then their background windows. + mpToolBoxColor.reset(); + mpBTNGradient.reset(); + mpToolBoxColorBackground.reset(); + mpBTNGradientBackground.reset(); +} + + + +void AreaPropertyPanel::Initialize() +{ + mpColorTextFT->SetBackground(Wallpaper()); + mpTrspTextFT->SetBackground(Wallpaper()); + + maGradientLinear.SetXOffset(DEFAULT_CENTERX); + maGradientLinear.SetYOffset(DEFAULT_CENTERY); + maGradientLinear.SetAngle(DEFAULT_ANGLE); + maGradientLinear.SetStartColor(Color(DEFAULT_STARTVALUE)); + maGradientLinear.SetEndColor(Color(DEFAULT_ENDVALUE)); + maGradientLinear.SetBorder(DEFAULT_BORDER); + maGradientLinear.SetGradientStyle(XGRAD_LINEAR); + + maGradientAxial = maGradientLinear; + maGradientAxial.SetGradientStyle(XGRAD_AXIAL); + + maGradientRadial = maGradientLinear; + maGradientRadial.SetGradientStyle(XGRAD_RADIAL); + + maGradientElliptical = maGradientLinear; + maGradientElliptical.SetGradientStyle(XGRAD_ELLIPTICAL); + + maGradientSquare = maGradientLinear; + maGradientSquare.SetGradientStyle(XGRAD_SQUARE); + + maGradientRect = maGradientLinear; + maGradientRect.SetGradientStyle(XGRAD_RECT); + + Size aLogicalFillSize(MBOX_WIDTH,LISTBOX_HEIGHT); + Size aLogicalAttrSize(MBOX_WIDTH + 1,LISTBOX_HEIGHT); + + Point aPoint(SECTIONPAGE_MARGIN_HORIZONTAL,SECTIONPAGE_MARGIN_VERTICAL_TOP + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL); + Point aPoint_Picker(SECTIONPAGE_MARGIN_HORIZONTAL + MBOX_WIDTH + CONTROL_SPACING_HORIZONTAL,SECTIONPAGE_MARGIN_VERTICAL_TOP + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL); + + Size aTypeSize(LogicToPixel(aLogicalFillSize, MAP_APPFONT)); + Size aAttrSize(LogicToPixel(aLogicalAttrSize, MAP_APPFONT)); + + Point aTypePoint(LogicToPixel(aPoint, MAP_APPFONT)); + Point aAttrPoint(LogicToPixel(aPoint_Picker, MAP_APPFONT)); + + mpLbFillType->SetPosSizePixel(aTypePoint,aTypeSize); + mpLbFillAttr->SetPosSizePixel(aAttrPoint,aAttrSize); + + mpLbFillType->SetHelpId(HID_PPROPERTYPANEL_AREA_LB_FILL_TYPES); + mpLbFillAttr->SetHelpId(HID_PPROPERTYPANEL_AREA_LB_FILL_ATTR); + + mpLbFillType->SetQuickHelpText(msHelpFillType); + mpLbFillAttr->SetQuickHelpText(msHelpFillAttr); + + mpLbFillType->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Fill"))); //wj acc + mpLbFillAttr->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Fill"))); //wj acc + + Link aLink = LINK( this, AreaPropertyPanel, SelectFillTypeHdl ); + mpLbFillType->SetSelectHdl( aLink ); + + aLink = LINK( this, AreaPropertyPanel, SelectFillAttrHdl ); + mpLbFillAttr->SetSelectHdl( aLink ); + + //add for new color picker + mpLbFillAttr->Hide(); + mpToolBoxColor->SetItemImage(TBI_COLOR, maImgColor); + Size aTbxSize( mpToolBoxColor->CalcWindowSizePixel() ); + mpToolBoxColor->SetOutputSizePixel( aTbxSize ); + mpToolBoxColor->SetItemBits( TBI_COLOR, mpToolBoxColor->GetItemBits( TBI_COLOR ) | TIB_DROPDOWNONLY ); + mpToolBoxColor->SetBackground(Wallpaper()); + mpToolBoxColor->SetPaintTransparent(true); + mpToolBoxColor->SetQuickHelpText(TBI_COLOR, String(SVX_RES(STR_HELP_COLOR))); //wj acc + //mpToolBoxColor->SetItemText(TBI_COLOR, msHelpFillAttr); + + long aHeightLBStyle = mpLbFillType->GetSizePixel().getHeight(); + long aLBPosY = mpLbFillType->GetPosPixel().getY(); + long aHeightTBAttr = mpToolBoxColor->GetSizePixel().getHeight(); + Point aPointTBAttr = mpToolBoxColor->GetPosPixel(); + aPointTBAttr.setY( aLBPosY + aHeightLBStyle / 2 - aHeightTBAttr / 2); + mpToolBoxColor->SetPosPixel(aPointTBAttr); + + aLink = LINK(this, AreaPropertyPanel, ToolBoxColorDropHdl); + mpToolBoxColor->SetDropdownClickHdl ( aLink ); + mpToolBoxColor->SetSelectHdl ( aLink ); + + //add end + mpLBTransType->SetSelectHdl(LINK(this, AreaPropertyPanel, ChangeTrgrTypeHdl_Impl)); + mpLBTransType->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Transparency"))); //wj acc + + mpMTRTransparent->SetValue( 50 ); + mpMTRTransparent->SetModifyHdl(LINK(this, AreaPropertyPanel, ModifyTransparentHdl_Impl)); + mpMTRTransparent->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Transparency"))); //wj acc + + mpBTNGradient->SetItemBits( TBI_BTX_GRADIENT, mpBTNGradient->GetItemBits( TBI_BTX_GRADIENT ) | TIB_DROPDOWNONLY ); + aLink = LINK( this, AreaPropertyPanel, ClickTrGrHdl_Impl ); + mpBTNGradient->SetDropdownClickHdl( aLink ); + mpBTNGradient->SetSelectHdl( aLink ); + aTbxSize = mpBTNGradient->CalcWindowSizePixel(); + mpBTNGradient->SetOutputSizePixel( aTbxSize ); + mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT,maImgLinear); + mpBTNGradient->SetQuickHelpText(TBI_BTX_GRADIENT, String(SVX_RES(STR_HELP_GRADIENT))); //wj acc + mpBTNGradient->Hide(); + + long aHeightLBTrans = mpLBTransType->GetSizePixel().getHeight(); + Point aPointLB = mpLBTransType->GetPosPixel(); + long aPosY = aPointLB.getY(); + + Point aPointMetric = mpMTRTransparent->GetPosPixel(); + Point aPointTB = mpMTRTransparent->GetPosPixel(); + long aHeightMetric = mpMTRTransparent->GetSizePixel().getHeight(); + long aHeightTool = mpBTNGradient->GetSizePixel().getHeight(); + aPointMetric.setY(aPosY+aHeightLBTrans/2-aHeightMetric/2); + aPointTB.setY(aPosY+aHeightLBTrans/2-aHeightTool/2); + aPointTB.setX(aPointTB.getX()+3); + mpMTRTransparent->SetPosPixel(aPointMetric); + mpBTNGradient->SetPosPixel(aPointTB); + + mpLbFillType->SetAccessibleRelationLabeledBy(mpColorTextFT.get()); + mpLbFillAttr->SetAccessibleRelationLabeledBy(mpLbFillAttr.get()); + mpToolBoxColor->SetAccessibleRelationLabeledBy(mpToolBoxColor.get()); + mpLBTransType->SetAccessibleRelationLabeledBy(mpTrspTextFT.get()); + mpMTRTransparent->SetAccessibleRelationLabeledBy(mpMTRTransparent.get()); + mpBTNGradient->SetAccessibleRelationLabeledBy(mpBTNGradient.get()); + + SetupIcons(); +} + + + +IMPL_LINK( AreaPropertyPanel, SelectFillTypeHdl, ListBox *, pToolBox ) +{ + XFillStyle eXFS = (XFillStyle)mpLbFillType->GetSelectEntryPos(); + + if( (XFillStyle) meLastXFS != eXFS ) + { + mpLbFillAttr->Clear(); + SfxObjectShell* pSh = SfxObjectShell::Current(); + XFillStyleItem aXFillStyleItem( eXFS ); + GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_STYLE, SFX_CALLMODE_RECORD, &aXFillStyleItem, 0L); + + switch( eXFS ) + { + case XFILL_NONE: + { + mpLbFillAttr->Show(); + mpToolBoxColor->Hide(); + mbTBShow = false; + mpLbFillType->Selected(); + mpLbFillAttr->Disable(); + } + break; + + case XFILL_SOLID: + { + mpLbFillAttr->Hide(); + mpToolBoxColor->Show(); + mbTBShow = true; + String aTmpStr; + Color aColor = maLastColor; + XFillColorItem aXFillColorItem( aTmpStr, aColor ); + GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_COLOR, SFX_CALLMODE_RECORD, &aXFillColorItem, 0L); + } + break; + + case XFILL_GRADIENT: + { + mpLbFillAttr->Show(); + mpToolBoxColor->Hide(); + mbTBShow = false; + if ( pSh && pSh->GetItem( SID_GRADIENT_LIST ) ) + { + if(mpLbFillAttr->GetEntryCount() == 0) + { + SvxGradientListItem aItem( *(const SvxGradientListItem*)( + pSh->GetItem( SID_GRADIENT_LIST ) ) ); + mpLbFillAttr->Enable(); + mpLbFillAttr->Clear(); + mpLbFillAttr->Fill( aItem.GetGradientList() ); + } + + mpLbFillAttr->SetDropDownLineCount(std::min(sal_uInt16(20), mpLbFillAttr->GetEntryCount())); + + if ( mnLastPosGradient != LISTBOX_ENTRY_NOTFOUND) + { + SvxGradientListItem aItem( *(const SvxGradientListItem*)( pSh->GetItem( SID_GRADIENT_LIST ) ) ); + if ( mnLastPosGradient < aItem.GetGradientList()->Count() ) + { + XGradient aGradient = aItem.GetGradientList()->GetGradient( mnLastPosGradient )->GetGradient(); + XFillGradientItem aXFillGradientItem( mpLbFillAttr->GetEntry(mnLastPosGradient), aGradient ); + GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_GRADIENT, SFX_CALLMODE_RECORD, &aXFillGradientItem, 0L); + mpLbFillAttr->SelectEntryPos(mnLastPosGradient); //add + } + } + } + else + mpLbFillAttr->Disable(); + } + break; + + case XFILL_HATCH: + { + mpLbFillAttr->Show(); + mpToolBoxColor->Hide(); + mbTBShow = false; + if ( pSh && pSh->GetItem( SID_HATCH_LIST ) ) + { + if(mpLbFillAttr->GetEntryCount() == 0) + { + SvxHatchListItem aItem( *(const SvxHatchListItem*)( + pSh->GetItem( SID_HATCH_LIST ) ) ); + mpLbFillAttr->Enable(); + mpLbFillAttr->Clear(); + mpLbFillAttr->Fill( aItem.GetHatchList() ); + } + + mpLbFillAttr->SetDropDownLineCount(std::min(sal_uInt16(20), mpLbFillAttr->GetEntryCount())); + + if ( mnLastPosHatch != LISTBOX_ENTRY_NOTFOUND ) + { + SvxHatchListItem aItem( *(const SvxHatchListItem*)( pSh->GetItem( SID_HATCH_LIST ) ) ); + if ( mnLastPosHatch < aItem.GetHatchList()->Count() ) + { + XHatch aHatch = aItem.GetHatchList()->GetHatch( mnLastPosHatch )->GetHatch(); + XFillHatchItem aXFillHatchItem( mpLbFillAttr->GetSelectEntry(), aHatch ); + GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_HATCH, SFX_CALLMODE_RECORD, &aXFillHatchItem, 0L); + mpLbFillAttr->SelectEntryPos(mnLastPosHatch); //add + } + } + } + else + mpLbFillAttr->Disable(); + } + break; + + case XFILL_BITMAP: + { + mpLbFillAttr->Show(); + mpToolBoxColor->Hide(); + mbTBShow = false; + if ( pSh && pSh->GetItem( SID_BITMAP_LIST ) ) + { + if(mpLbFillAttr->GetEntryCount() == 0) + { + SvxBitmapListItem aItem( *(const SvxBitmapListItem*)( + pSh->GetItem( SID_BITMAP_LIST ) ) ); + mpLbFillAttr->Enable(); + mpLbFillAttr->Clear(); + mpLbFillAttr->Fill( aItem.GetBitmapList() ); + } + + mpLbFillAttr->SetDropDownLineCount(std::min(sal_uInt16(20), mpLbFillAttr->GetEntryCount())); + + if ( mnLastPosBitmap != LISTBOX_ENTRY_NOTFOUND ) + { + SvxBitmapListItem aItem( *(const SvxBitmapListItem*)( pSh->GetItem( SID_BITMAP_LIST ) ) ); + if ( mnLastPosBitmap < aItem.GetBitmapList()->Count() ) + { + const XBitmapEntry* pXBitmapEntry = aItem.GetBitmapList()->GetBitmap(mnLastPosBitmap); + XFillBitmapItem aXFillBitmapItem( mpLbFillAttr->GetSelectEntry(), pXBitmapEntry->GetGraphicObject() ); + GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_BITMAP, SFX_CALLMODE_RECORD, &aXFillBitmapItem, 0L); + mpLbFillAttr->SelectEntryPos(mnLastPosBitmap); //add + } + } + } + else + mpLbFillAttr->Disable(); + } + break; + } + meLastXFS = (sal_uInt16)eXFS; + if( eXFS != XFILL_NONE ) + { + if ( pToolBox ) + mpLbFillType->Selected(); + } + } + return 0; +} + + + +IMPL_LINK( AreaPropertyPanel, SelectFillAttrHdl, ListBox*, pToolBox ) +{ + XFillStyle eXFS = (XFillStyle)mpLbFillType->GetSelectEntryPos(); + XFillStyleItem aXFillStyleItem( eXFS ); + SfxObjectShell* pSh = SfxObjectShell::Current(); + + if(pToolBox) + { + if( (XFillStyle) meLastXFS != eXFS ) + { + GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_STYLE, SFX_CALLMODE_RECORD, &aXFillStyleItem, 0L); //Added 20090909 + } + + switch( eXFS ) + { + case XFILL_SOLID: + //{ + // //String aTmpStr = mpLbFillAttr->GetSelectEntry(); + // //Color aColor = mpLbFillAttr->GetSelectEntryColor(); + // //if(aColor.GetColor() == 0 && aTmpStr.Equals(String::CreateFromAscii(""))) + // String aTmpStr; + // Color aColor = maLastColor; + // XFillColorItem aXFillColorItem( aTmpStr, aColor ); + // GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_COLOR, SFX_CALLMODE_RECORD, &aXFillColorItem, 0L); + // maLastColor = aColor; + //} + break; + + case XFILL_GRADIENT: + { + sal_uInt16 nPos = mpLbFillAttr->GetSelectEntryPos(); + if( nPos == LISTBOX_ENTRY_NOTFOUND ) + nPos = mnLastPosGradient; + + if ( nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem( SID_GRADIENT_LIST ) ) + { + SvxGradientListItem aItem( *(const SvxGradientListItem*)( pSh->GetItem( SID_GRADIENT_LIST ) ) ); + if ( nPos < aItem.GetGradientList()->Count() ) + { + XGradient aGradient = aItem.GetGradientList()->GetGradient( nPos )->GetGradient(); + XFillGradientItem aXFillGradientItem( mpLbFillAttr->GetSelectEntry(), aGradient ); + GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_GRADIENT, SFX_CALLMODE_RECORD, &aXFillGradientItem, 0L); + } + } + if(nPos != LISTBOX_ENTRY_NOTFOUND) + mnLastPosGradient = nPos; + } + break; + + case XFILL_HATCH: + { + sal_uInt16 nPos = mpLbFillAttr->GetSelectEntryPos(); + if( nPos == LISTBOX_ENTRY_NOTFOUND ) + nPos = mnLastPosHatch; + if ( nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem( SID_HATCH_LIST ) ) + { + SvxHatchListItem aItem( *(const SvxHatchListItem*)( pSh->GetItem( SID_HATCH_LIST ) ) ); + if ( nPos < aItem.GetHatchList()->Count() ) + { + XHatch aHatch = aItem.GetHatchList()->GetHatch( nPos )->GetHatch(); + XFillHatchItem aXFillHatchItem( mpLbFillAttr->GetSelectEntry(), aHatch ); + GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_HATCH, SFX_CALLMODE_RECORD, &aXFillHatchItem, 0L); + } + } + if(nPos != LISTBOX_ENTRY_NOTFOUND) + mnLastPosHatch = nPos; + } + break; + + case XFILL_BITMAP: + { + sal_uInt16 nPos = mpLbFillAttr->GetSelectEntryPos(); + if( nPos == LISTBOX_ENTRY_NOTFOUND ) + nPos = mnLastPosBitmap; + if ( nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem( SID_BITMAP_LIST ) ) + { + SvxBitmapListItem aItem( *(const SvxBitmapListItem*)( pSh->GetItem( SID_BITMAP_LIST ) ) ); + if ( nPos < aItem.GetBitmapList()->Count() ) + { + const XBitmapEntry* pXBitmapEntry = aItem.GetBitmapList()->GetBitmap(nPos); + XFillBitmapItem aXFillBitmapItem( mpLbFillAttr->GetSelectEntry(), pXBitmapEntry->GetGraphicObject() ); + GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_BITMAP, SFX_CALLMODE_RECORD, &aXFillBitmapItem, 0L); + } + } + if(nPos != LISTBOX_ENTRY_NOTFOUND) + mnLastPosBitmap = nPos; + } + break; + + default: + break; + } + } + return 0; +} + + +//add for color picker + +IMPL_LINK(AreaPropertyPanel, ToolBoxColorDropHdl, ToolBox*, pToolBox) +{ + sal_uInt16 nId = pToolBox->GetCurItemId(); + + if(nId == TBI_COLOR) + { + maColorPopup.Show(*pToolBox); + if (mpColorItem) + maColorPopup.SetCurrentColor(mpColorItem->GetColorValue(), mbColorAvail); + else + maColorPopup.SetCurrentColor(COL_WHITE, false); + } + + return 0; +} + + + +void AreaPropertyPanel::SetColor ( + const String& rsColorName, + const Color aColor) +{ + XFillColorItem aXFillColorItem (rsColorName, aColor); + mpBindings->GetDispatcher()->Execute(SID_ATTR_FILL_COLOR, SFX_CALLMODE_RECORD, &aXFillColorItem, 0L); + maLastColor = aColor; +} + + + + +PopupControl* AreaPropertyPanel::CreateTransparencyGradientControl (PopupContainer* pParent) +{ + return new AreaTransparencyGradientControl(pParent, *this); +} + + + + +PopupControl* AreaPropertyPanel::CreateColorPopupControl (PopupContainer* pParent) +{ + return new ColorControl( + pParent, + mpBindings, + SVX_RES(RID_POPUPPANEL_AERAPAGE_COLOR), + SVX_RES(VS_COLOR), + ::boost::bind(&AreaPropertyPanel::GetLastColor, this), + ::boost::bind(&AreaPropertyPanel::SetColor, this, _1,_2), + pParent, + 0); +} + + + + +void AreaPropertyPanel::SetupIcons(void) +{ + if(Theme::GetBoolean(Theme::Bool_UseSymphonyIcons)) + { + // todo + } + else + { + // todo + } +} + + + +AreaPropertyPanel* AreaPropertyPanel::Create ( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings) +{ + if (pParent == NULL) + throw lang::IllegalArgumentException(A2S("no parent Window given to AreaPropertyPanel::Create"), NULL, 0); + if ( ! rxFrame.is()) + throw lang::IllegalArgumentException(A2S("no XFrame given to AreaPropertyPanel::Create"), NULL, 1); + if (pBindings == NULL) + throw lang::IllegalArgumentException(A2S("no SfxBindings given to AreaPropertyPanel::Create"), NULL, 2); + + return new AreaPropertyPanel( + pParent, + rxFrame, + pBindings); +} + + + +void AreaPropertyPanel::DataChanged( + const DataChangedEvent& rEvent) +{ + (void)rEvent; + + SetupIcons(); +} + + + +void AreaPropertyPanel::ImpUpdateTransparencies() +{ + if(mpTransparanceItem.get() || mpFloatTransparenceItem.get()) + { + bool bZeroValue(false); + + if(mpTransparanceItem.get()) + { + const sal_uInt16 nValue(mpTransparanceItem->GetValue()); + + if(!nValue) + { + bZeroValue = true; + } + else if(nValue <= 100) + { + mpLBTransType->Enable(); + mpLBTransType->SelectEntryPos(1); + mpBTNGradient->Hide(); + mpMTRTransparent->Show(); + mpMTRTransparent->Enable(); + mpMTRTransparent->SetValue(nValue); + } + + if(!bZeroValue) + { + maTrGrPopup.Hide(); + } + } + + if(bZeroValue && mpFloatTransparenceItem.get()) + { + if(mpFloatTransparenceItem->IsEnabled()) + { + const XGradient& rGradient = mpFloatTransparenceItem->GetGradientValue(); + sal_uInt16 nEntryPos(0); + Image* pImage = 0; + + mpLBTransType->Enable(); + mpMTRTransparent->Hide(); + mpBTNGradient->Enable(); + mpBTNGradient->Show(); + + switch(rGradient.GetGradientStyle()) + { + case XGRAD_LINEAR: + { + nEntryPos = 2; + pImage = &maImgLinear; + break; + } + case XGRAD_AXIAL: + { + nEntryPos = 3; + pImage = &maImgAxial; + break; + } + case XGRAD_RADIAL: + { + nEntryPos = 4; + pImage = &maImgRadial; + break; + } + case XGRAD_ELLIPTICAL: + { + nEntryPos = 5; + pImage = &maImgElli; + break; + } + case XGRAD_SQUARE: + { + nEntryPos = 6; + pImage = &maImgQuad; + break; + } + case XGRAD_RECT: + { + nEntryPos = 7; + pImage = &maImgSquare; + break; + } + } + + mpLBTransType->SelectEntryPos(nEntryPos); + mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT, *pImage); + bZeroValue = false; + } + else + { + bZeroValue = true; + } + } + + if(bZeroValue) + { + mpLBTransType->Enable(); + mpLBTransType->SelectEntryPos(0); + mpBTNGradient->Hide(); + mpMTRTransparent->Enable(); + mpMTRTransparent->Show(); + mpMTRTransparent->SetValue(0); + } + } + else + { + // no transparency at all + mpLBTransType->SetNoSelection(); + mpMTRTransparent->Disable(); + mpMTRTransparent->Show(); + mpBTNGradient->Disable(); + mpBTNGradient->Hide(); + } +} + + + +void AreaPropertyPanel::NotifyItemUpdate( + sal_uInt16 nSID, + SfxItemState eState, + const SfxPoolItem* pState) +{ + XFillStyle eXFS; + SfxObjectShell* pSh = SfxObjectShell::Current(); + bool bFillTransparenceChanged(false); + + if(SID_ATTR_FILL_TRANSPARENCE == nSID) + { + bFillTransparenceChanged = true; + + if(eState >= SFX_ITEM_AVAILABLE) + { + const SfxUInt16Item* pItem = dynamic_cast< const SfxUInt16Item* >(pState); + + if(pItem && (!mpTransparanceItem || *pItem != *mpTransparanceItem)) + { + mpTransparanceItem.reset((SfxUInt16Item*)pItem->Clone()); + } + else + { + mpTransparanceItem.reset(); + } + } + else + { + mpTransparanceItem.reset(); + } + } + else if(SID_ATTR_FILL_FLOATTRANSPARENCE == nSID) + { + bFillTransparenceChanged = true; + + if(eState >= SFX_ITEM_AVAILABLE) + { + const XFillFloatTransparenceItem* pItem = dynamic_cast< const XFillFloatTransparenceItem* >(pState); + + if(pItem && (!mpFloatTransparenceItem || *pItem != *mpFloatTransparenceItem)) + { + mpFloatTransparenceItem.reset((XFillFloatTransparenceItem*)pItem->Clone()); + } + else + { + mpFloatTransparenceItem.reset(); + } + } + else + { + mpFloatTransparenceItem.reset(); + } + } + + if(bFillTransparenceChanged) + { + // update transparency settings dependent of mpTransparanceItem and mpFloatTransparenceItem + ImpUpdateTransparencies(); + } + + if (nSID == SID_ATTR_FILL_STYLE ) + { + if( eState == SFX_ITEM_DISABLED ) + { + mpLbFillType->Disable(); + mpLbFillType->SetNoSelection(); + mpLbFillAttr->Show(); + mpLbFillAttr->Disable(); + mpLbFillAttr->SetNoSelection(); + mpToolBoxColor->Hide(); + mbTBShow = false; + meLastXFS = -1; + mpStyleItem.reset(); + } + else if( SFX_ITEM_AVAILABLE == eState ) + { + mpStyleItem.reset(pState ? (XFillStyleItem*)pState->Clone() : 0); + mpLbFillType->Enable(); + + eXFS = (XFillStyle)mpStyleItem->GetValue(); + meLastXFS = eXFS; + mpLbFillType->SelectEntryPos( + sal::static_int_cast< sal_uInt16 >( eXFS ) ); + //Added for select invisable + if(eXFS == XFILL_NONE) + { + mpLbFillAttr->SetNoSelection(); + mpLbFillAttr->Disable(); + } + //else + // mpLbFillAttr->Enable(); + Update(); + //SelectFillTypeHdl( NULL ); + } + else + { + mpLbFillType->SetNoSelection(); + mpLbFillAttr->Show(); + mpLbFillAttr->Disable(); + mpLbFillAttr->SetNoSelection(); + mpToolBoxColor->Hide(); + mbTBShow = false; + meLastXFS = -1; //Added + mpStyleItem.reset(); + } + } + else if(nSID == SID_ATTR_FILL_COLOR) + { + if( SFX_ITEM_AVAILABLE == eState) + { + mpColorItem.reset(pState ? (XFillColorItem*)pState->Clone() : 0); + } + if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue() == XFILL_SOLID) + { + mpLbFillAttr->Hide(); + mpToolBoxColor->Show(); + mbTBShow = true; + if( SFX_ITEM_AVAILABLE == eState) + { + mpToolBoxColor->Enable(); + mbColorAvail = true; // + // maLastColor = mpColorItem->GetColorValue(); + Update(); + } + else if(SFX_ITEM_DISABLED == eState ) + { + mpToolBoxColor->Disable(); + mbColorAvail = false; // + mpColorUpdater->Update(COL_WHITE); + } + else + { + mbColorAvail = false; // + mpColorUpdater->Update(COL_WHITE); + } + } + } + else if(nSID == SID_ATTR_FILL_GRADIENT) + { + if( SFX_ITEM_AVAILABLE == eState) + { + mpFillGradientItem.reset(pState ? (XFillGradientItem*)pState->Clone() : 0); + } + if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue() == XFILL_GRADIENT ) + { + mpLbFillAttr->Show(); + mpToolBoxColor->Hide(); + mbTBShow = false; + if( SFX_ITEM_AVAILABLE == eState) + { + mpLbFillAttr->Enable(); + Update(); + } + + else if(SFX_ITEM_DISABLED == eState ) + { + mpLbFillAttr->Disable(); + mpLbFillAttr->SetNoSelection(); + } + else + mpLbFillAttr->SetNoSelection(); + } + } + else if(nSID == SID_ATTR_FILL_HATCH) + { + if( SFX_ITEM_AVAILABLE == eState) + { + mpHatchItem.reset(pState ? (XFillHatchItem*)pState->Clone() : 0); + } + if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue() == XFILL_HATCH ) + { + mpLbFillAttr->Show(); + mpToolBoxColor->Hide(); + mbTBShow = false; + if( SFX_ITEM_AVAILABLE == eState) + { + mpLbFillAttr->Enable(); + Update(); + } + else if(SFX_ITEM_DISABLED == eState ) + { + mpLbFillAttr->Disable(); + mpLbFillAttr->SetNoSelection(); + } + else + mpLbFillAttr->SetNoSelection(); + } + } + else if(nSID == SID_ATTR_FILL_BITMAP) + { + if( SFX_ITEM_AVAILABLE == eState) + { + mpBitmapItem.reset(pState ? (XFillBitmapItem*)pState->Clone() : 0); + } + if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue() == XFILL_BITMAP ) + { + mpLbFillAttr->Show(); + mpToolBoxColor->Hide(); + mbTBShow = false; + if( SFX_ITEM_AVAILABLE == eState) + { + mpLbFillAttr->Enable(); + Update(); + } + else if(SFX_ITEM_DISABLED == eState ) + { + mpLbFillAttr->Disable(); + mpLbFillAttr->SetNoSelection(); + } + else + mpLbFillAttr->SetNoSelection(); + } + } + else if(nSID == SID_COLOR_TABLE) + { + if( SFX_ITEM_AVAILABLE == eState) + { + mpColorListItem.reset(pState ? (SvxColorListItem*)pState->Clone() : 0); + + if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue()== XFILL_SOLID) + { + if ( mpColorItem ) + { + String aString( mpColorItem->GetName() ); + Color aColor = mpColorItem->GetColorValue(); + mpLbFillAttr->Clear(); + SvxColorListItem aItem( *(const SvxColorListItem*)( + pSh->GetItem( SID_COLOR_TABLE ) ) ); + mpLbFillAttr->Enable(); + mpLbFillAttr->Fill( aItem.GetColorList() ); + mpLbFillAttr->SelectEntry( aColor ); + } + else + mpLbFillAttr->SetNoSelection(); + } + } + } + else if(nSID == SID_GRADIENT_LIST) + { + if( SFX_ITEM_AVAILABLE == eState) + { + mpGradientListItem.reset(pState ? (SvxGradientListItem*)pState->Clone() : 0); + + if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue() == XFILL_GRADIENT) + { + if ( mpFillGradientItem ) + { + String aString( mpFillGradientItem->GetName() ); + mpLbFillAttr->Clear(); + SvxGradientListItem aItem( *(const SvxGradientListItem*)( + pSh->GetItem( SID_GRADIENT_LIST ) ) ); + mpLbFillAttr->Enable(); + mpLbFillAttr->Fill( aItem.GetGradientList() ); + mpLbFillAttr->SelectEntry( aString ); + } + else + mpLbFillAttr->SetNoSelection(); + } + } + } + else if(nSID == SID_HATCH_LIST) + { + if( SFX_ITEM_AVAILABLE == eState) + { + mpHatchListItem.reset(pState ? (SvxHatchListItem*)pState->Clone() : 0); + + if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue() == XFILL_HATCH ) + { + if ( mpHatchItem) + { + String aString( mpHatchItem->GetName() ); + mpLbFillAttr->Clear(); + SvxHatchListItem aItem( *(const SvxHatchListItem*)( + pSh->GetItem( SID_HATCH_LIST ) ) ); + mpLbFillAttr->Enable(); + mpLbFillAttr->Fill( aItem.GetHatchList() ); + mpLbFillAttr->SelectEntry( aString ); + } + else + mpLbFillAttr->SetNoSelection(); + } + } + } + else if(nSID == SID_BITMAP_LIST) + { + if( SFX_ITEM_AVAILABLE == eState) + { + mpBitmapListItem.reset(pState ? (SvxBitmapListItem*)pState->Clone() : 0); + + if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue() == XFILL_BITMAP ) + { + if ( mpBitmapItem ) + { + String aString( mpBitmapItem->GetName() ); + mpLbFillAttr->Clear(); + SvxBitmapListItem aItem( *(const SvxBitmapListItem*)( + pSh->GetItem( SID_BITMAP_LIST ) ) ); + mpLbFillAttr->Enable(); + mpLbFillAttr->Fill( aItem.GetBitmapList() ); + mpLbFillAttr->SelectEntry( aString ); + } + else + mpLbFillAttr->SetNoSelection(); + } + } + } +} + + + +SfxBindings* AreaPropertyPanel::GetBindings() +{ + return mpBindings; +} + + + +void AreaPropertyPanel::Update() +{ + if ( mpStyleItem ) + { + XFillStyle eXFS = (XFillStyle)mpStyleItem->GetValue(); + SfxObjectShell* pSh = SfxObjectShell::Current(); + + switch( eXFS ) + { + case XFILL_NONE: + { + mpLbFillAttr->Show(); //wj for new color picker + mpToolBoxColor->Hide(); //wj for new color picker + mbTBShow = false; + } + break; + + case XFILL_SOLID: + { + if ( mpColorItem ) + { + mpLbFillAttr->Hide(); //wj for new color picker + mpToolBoxColor->Show(); //wj for new color picker + mbTBShow = true; + mpColorUpdater->Update(mpColorItem->GetColorValue()); + } + else + mpColorUpdater->Update(COL_WHITE); + } + break; + + case XFILL_GRADIENT: + { + mpLbFillAttr->Show(); //wj for new color picker + mpToolBoxColor->Hide(); //wj for new color picker + mbTBShow = false; + if ( pSh && pSh->GetItem( SID_GRADIENT_LIST ) ) + { + SvxGradientListItem aItem( *(const SvxGradientListItem*)( + pSh->GetItem( SID_GRADIENT_LIST ) ) ); + mpLbFillAttr->Enable(); + mpLbFillAttr->Clear(); + mpLbFillAttr->Fill( aItem.GetGradientList() ); + if ( mpFillGradientItem ) + { + String aString( mpFillGradientItem->GetName() ); + mpLbFillAttr->SelectEntry( aString ); + } + else + mpLbFillAttr->SetNoSelection(); + } + else + mpLbFillAttr->SetNoSelection(); + } + break; + + case XFILL_HATCH: + { + mpLbFillAttr->Show(); //wj for new color picker + mpToolBoxColor->Hide(); //wj for new color picker + mbTBShow = false; + if ( pSh && pSh->GetItem( SID_HATCH_LIST ) ) + { + SvxHatchListItem aItem( *(const SvxHatchListItem*)( + pSh->GetItem( SID_HATCH_LIST ) ) ); + mpLbFillAttr->Enable(); + mpLbFillAttr->Clear(); + mpLbFillAttr->Fill( aItem.GetHatchList() ); + if ( mpHatchItem ) + { + String aString( mpHatchItem->GetName() ); + mpLbFillAttr->SelectEntry( aString ); + } + else + mpLbFillAttr->SetNoSelection(); + } + else + mpLbFillAttr->SetNoSelection(); + } + break; + + case XFILL_BITMAP: + { + mpLbFillAttr->Show(); //wj for new color picker + mpToolBoxColor->Hide(); //wj for new color picker + mbTBShow = false; + //mpLbFillAttr->Fill( mpBitmapListItem->GetBitmapList() ); + if ( pSh && pSh->GetItem( SID_BITMAP_LIST ) ) + { + SvxBitmapListItem aItem( *(const SvxBitmapListItem*)( + pSh->GetItem( SID_BITMAP_LIST ) ) ); + mpLbFillAttr->Enable(); + mpLbFillAttr->Clear(); + mpLbFillAttr->Fill( aItem.GetBitmapList() ); + if ( mpBitmapItem ) + { + String aString( mpBitmapItem->GetName() ); + mpLbFillAttr->SelectEntry( aString ); + } + else + mpLbFillAttr->SetNoSelection(); + } + else + mpLbFillAttr->SetNoSelection(); + } + break; + + default: + OSL_ENSURE(false, "Nicht unterstuetzter Flaechentyp"); + break; + } + } +} + + + +IMPL_LINK( AreaPropertyPanel, ImplPopupModeEndHdl, FloatingWindow*, EMPTYARG ) +{ + return 0; +} + + + +IMPL_LINK( AreaPropertyPanel, ClickTrGrHdl_Impl, ToolBox*, pToolBox ) +{ + maTrGrPopup.Rearrange(mpFloatTransparenceItem.get()); + + OSL_ASSERT(pToolBox->GetCurItemId() == TBI_BTX_GRADIENT); + + maTrGrPopup.Show(*pToolBox); + + return (0L); +} + + + +IMPL_LINK(AreaPropertyPanel, ChangeTrgrTypeHdl_Impl, void *, EMPTYARG) +{ + sal_uInt16 nSelectType = mpLBTransType->GetSelectEntryPos(); + bool bGradient = false; + sal_uInt16 nTrans = 0; + + if (nSelectType == 0) + { + mpBTNGradient->Hide(); + mpMTRTransparent->Show(); + mpMTRTransparent->Enable(); + mpMTRTransparent->SetValue(0); + } + else if (nSelectType == 1) + { + mpBTNGradient->Hide(); + mpMTRTransparent->Show(); + nTrans = mnLastTransSolid; + mpMTRTransparent->SetValue(nTrans); + mpLBTransType->SelectEntryPos(1);// for multi-selected, choose solid no selection + mpMTRTransparent->Enable(); + } + else + { + mpBTNGradient->Show(); + //for beta1 + switch ( nSelectType ) + { + case 2: + mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT, maImgLinear); // high contrast + break; + case 3: + mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT, maImgAxial); + break; + case 4: + mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT, maImgRadial); + break; + case 5: + mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT, maImgElli ); + break; + case 6: + mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT, maImgQuad ); + break; + case 7: + mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT, maImgSquare); + break; + } + //end of new code + mpMTRTransparent->Hide(); + mpBTNGradient->Enable(); + bGradient = true; + } + + XFillTransparenceItem aLinearItem(nTrans); + GetBindings()->GetDispatcher()->Execute( SID_ATTR_FILL_TRANSPARENCE, SFX_CALLMODE_RECORD, &aLinearItem, 0L ); + + if (nSelectType > 1) nSelectType = nSelectType-2; + + XGradient aTmpGradient; + + switch(nSelectType) + { + case XGRAD_LINEAR: + aTmpGradient = maGradientLinear; + break; + case XGRAD_AXIAL: + aTmpGradient = maGradientAxial; + break; + case XGRAD_RADIAL: + aTmpGradient = maGradientRadial; + break; + case XGRAD_ELLIPTICAL: + aTmpGradient = maGradientElliptical; + break; + case XGRAD_SQUARE: + aTmpGradient = maGradientSquare; + break; + case XGRAD_RECT: + aTmpGradient = maGradientRect; + break; + } + SfxItemPool* pPool = NULL; + bool bEnable = false; + if (bGradient) bEnable = true; + XFillFloatTransparenceItem aGradientItem(pPool,aTmpGradient, bEnable ); + + GetBindings()->GetDispatcher()->Execute( SID_ATTR_FILL_FLOATTRANSPARENCE, SFX_CALLMODE_RECORD, &aGradientItem, 0L ); + + return( 0L ); +} + + + +IMPL_LINK(AreaPropertyPanel, ModifyTransparentHdl_Impl, void*, EMPTYARG) +{ + sal_uInt16 nTrans = (sal_uInt16)mpMTRTransparent->GetValue(); + mnLastTransSolid = nTrans; + sal_uInt16 nSelectType = mpLBTransType->GetSelectEntryPos(); + if (nTrans != 0 && nSelectType == 0) + mpLBTransType->SelectEntryPos(1); + XFillTransparenceItem aLinearItem(nTrans); + GetBindings()->GetDispatcher()->Execute( SID_ATTR_FILL_TRANSPARENCE, SFX_CALLMODE_RECORD, &aLinearItem, 0L ); + + return 0L; +} + + +Color AreaPropertyPanel::GetLastColor (void) const +{ + return maLastColor; +} + + + + +XGradient AreaPropertyPanel::GetGradient (const XGradientStyle eStyle) const +{ + switch (eStyle) + { + default: + case XGRAD_LINEAR: + return maGradientLinear; + case XGRAD_AXIAL: + return maGradientAxial; + case XGRAD_RADIAL: + return maGradientRadial; + case XGRAD_ELLIPTICAL: + return maGradientElliptical; + case XGRAD_SQUARE: + return maGradientSquare; + case XGRAD_RECT: + return maGradientRect; + } +} + + + + +void AreaPropertyPanel::SetGradient (const XGradient& rGradient) +{ + switch (rGradient.GetGradientStyle()) + { + case XGRAD_LINEAR: + maGradientLinear = rGradient; + break; + case XGRAD_AXIAL: + maGradientAxial = rGradient; + break; + case XGRAD_RADIAL: + maGradientRadial = rGradient; + break; + case XGRAD_ELLIPTICAL: + maGradientElliptical = rGradient; + break; + case XGRAD_SQUARE: + maGradientSquare = rGradient; + break; + case XGRAD_RECT: + maGradientRect = rGradient; + break; + } +} + + + + +sal_Int32 AreaPropertyPanel::GetSelectedTransparencyTypeIndex (void) const +{ + return mpLBTransType->GetSelectEntryPos(); +} + +} } // end of namespace svx::sidebar + +// eof diff --git a/svx/source/sidebar/area/AreaPropertyPanel.hrc b/svx/source/sidebar/area/AreaPropertyPanel.hrc new file mode 100644 index 000000000000..a11a54faaf94 --- /dev/null +++ b/svx/source/sidebar/area/AreaPropertyPanel.hrc @@ -0,0 +1,82 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +// RID_SIDEBAR_AREA_PANEL-------------------------------------------------------------- +#define FT_COLOR_LIST 1 +#define TB_COLOR 2 +#define TBI_COLOR 3 +#define IMG_COLOR 5 + +#define VS_COLOR 1 + +#define TBI_LEFT 1 +#define TBI_RIGHT 1 +#define TBI_BTX_GRADIENT 51 +#define FL_TRSP_TEXT 4 + +#define LB_TRGR_TYPES 6 +#define MTR_TRANSPARENT 7 +#define BTN_GRADIENT 8 + +#define FT_TRGR_CENTER_X 9 +#define MTR_TRGR_CENTER_X 10 +#define FT_TRGR_CENTER_Y 11 +#define MTR_TRGR_CENTER_Y 12 +#define FT_TRGR_ANGLE 13 +#define MTR_TRGR_ANGLE 14 +#define FT_TRGR_START_VALUE 15 +#define MTR_TRGR_START_VALUE 16 +#define FT_TRGR_END_VALUE 17 +#define MTR_TRGR_END_VALUE 18 +#define FT_TRGR_BORDER 19 +#define MTR_TRGR_BORDER 20 +#define STR_HELP_LEFT 24 +#define STR_HELP_RIGHT 25 + +#define BTN_LEFT_SECOND 22 +#define BTN_RIGHT_FIRST 23 + +#define IMG_AXIAL 24 +#define IMG_ELLI 25 +#define IMG_QUAD 26 +#define IMG_RADIAL 27 +#define IMG_SQUARE 28 +#define IMG_LINEAR 29 +#define IMG_ROT_LEFT 30 +#define IMG_ROT_RIGHT 31 +#define STR_HELP_TYPE 32 +#define STR_HELP_ATTR 33 +#define STR_HELP_COLOR 41 +#define STR_HELP_GRADIENT 42 + +#define FIXED_TEXT_HEIGHT 9 +#define FIXED_TEXT_WIDTH 40 +#define MBOX_WIDTH 50 +#define CONTROL_HEIGHT 12 +#define CONTROL_WIDTH 45 +#define LISTBOX_HEIGHT 80 +#define ROTATE_BUTTON_WIDTH 13 +#define ROTATE_BUTTON_SPACING 15 +#define POP_WIDTH 2*POPUPPANEL_MARGIN_HORIZONTAL+2*CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL +#define POP_HEIGHT 2*POPUPPANEL_MARGIN_VERTICAL + 4*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + MBOX_HEIGHT ) + 3*CONTROL_SPACING_VERTICAL +#define POP_HEIGHT2 2*POPUPPANEL_MARGIN_VERTICAL + 3*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + MBOX_HEIGHT ) + 2*CONTROL_SPACING_VERTICAL +#define LEFT_RIGHT_X1 POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL + 1 +#define LEFT_RIGHT_Y1 POPUPPANEL_MARGIN_VERTICAL + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL - 2 +#define LEFT_RIGHT_X2 POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL + ROTATE_BUTTON_SPACING +#define LEFT_RIGHT_Y2 POPUPPANEL_MARGIN_VERTICAL + 2*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL)+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL - 2 + +// eof diff --git a/svx/source/sidebar/area/AreaPropertyPanel.hxx b/svx/source/sidebar/area/AreaPropertyPanel.hxx new file mode 100644 index 000000000000..69617a0cc13a --- /dev/null +++ b/svx/source/sidebar/area/AreaPropertyPanel.hxx @@ -0,0 +1,198 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SVX_PROPERTYPANEL_AREAPAGE_HXX +#define SVX_PROPERTYPANEL_AREAPAGE_HXX + +#include <svx/sidebar/ColorPopup.hxx> +#include "AreaTransparencyGradientPopup.hxx" +#include <vcl/ctrl.hxx> +#include <sfx2/sidebar/SidebarPanelBase.hxx> +#include <sfx2/sidebar/ControllerItem.hxx> +#include <svx/xgrad.hxx> +#include <svx/itemwin.hxx> +#include <svx/xfillit0.hxx> +#include <svx/xflclit.hxx> +#include <svx/xflgrit.hxx> +#include <svx/xflhtit.hxx> +#include <svx/xbtmpit.hxx> +#include <svx/drawitem.hxx> +#include <vcl/lstbox.hxx> +#include <vcl/field.hxx> +#include <vcl/fixed.hxx> +#include <svl/intitem.hxx> +#include <svx/tbxcolorupdate.hxx> +#include <com/sun/star/ui/XUIElement.hpp> +#include <boost/scoped_ptr.hpp> + + +class XFillFloatTransparenceItem; +namespace svx { class ToolboxButtonColorUpdater; } + + +namespace svx { namespace sidebar { + +class PopupContainer; +class AreaTransparencyGradientControl; + +class AreaPropertyPanel +: public Control, + public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface +{ +public: + static AreaPropertyPanel* Create( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings); + + virtual void DataChanged( + const DataChangedEvent& rEvent); + + virtual void NotifyItemUpdate( + const sal_uInt16 nSId, + const SfxItemState eState, + const SfxPoolItem* pState); + + SfxBindings* GetBindings(); + + const static sal_Int32 DEFAULT_CENTERX; + const static sal_Int32 DEFAULT_CENTERY; + const static sal_Int32 DEFAULT_ANGLE; + const static sal_Int32 DEFAULT_STARTVALUE; + const static sal_Int32 DEFAULT_ENDVALUE; + const static sal_Int32 DEFAULT_BORDER; + + XGradient GetGradient (const XGradientStyle eStyle) const; + void SetGradient (const XGradient& rGradient); + sal_Int32 GetSelectedTransparencyTypeIndex (void) const; + +private: + sal_uInt16 meLastXFS; + Color maLastColor; + + sal_uInt16 mnLastPosGradient; + sal_uInt16 mnLastPosHatch; + sal_uInt16 mnLastPosBitmap; + sal_uInt16 mnLastTransSolid; + + XGradient maGradientLinear; + XGradient maGradientAxial; + XGradient maGradientRadial; + XGradient maGradientElliptical; + XGradient maGradientSquare; + XGradient maGradientRect; + + //ui controls + ::boost::scoped_ptr< FixedText > mpColorTextFT; + ::boost::scoped_ptr< SvxFillTypeBox > mpLbFillType; + ::boost::scoped_ptr< SvxFillAttrBox > mpLbFillAttr; + ::boost::scoped_ptr< Window > mpToolBoxColorBackground; + ::boost::scoped_ptr< ToolBox > mpToolBoxColor; // for new color picker + ::boost::scoped_ptr< FixedText > mpTrspTextFT; + ::boost::scoped_ptr< ListBox > mpLBTransType; + ::boost::scoped_ptr< MetricField > mpMTRTransparent; + ::boost::scoped_ptr< Window > mpBTNGradientBackground; + ::boost::scoped_ptr< ToolBox > mpBTNGradient; + + ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpColorUpdater; + + ::boost::scoped_ptr< XFillStyleItem > mpStyleItem; + ::boost::scoped_ptr< XFillColorItem > mpColorItem; + ::boost::scoped_ptr< XFillGradientItem > mpFillGradientItem; + ::boost::scoped_ptr< XFillHatchItem > mpHatchItem; + ::boost::scoped_ptr< XFillBitmapItem > mpBitmapItem; + ::boost::scoped_ptr< SvxColorListItem > mpColorListItem; + ::boost::scoped_ptr< SvxGradientListItem > mpGradientListItem; + ::boost::scoped_ptr< SvxHatchListItem > mpHatchListItem; + ::boost::scoped_ptr< SvxBitmapListItem > mpBitmapListItem; + + ::sfx2::sidebar::ControllerItem maStyleControl; + ::sfx2::sidebar::ControllerItem maColorControl; + ::sfx2::sidebar::ControllerItem maGradientControl; + ::sfx2::sidebar::ControllerItem maHatchControl; + ::sfx2::sidebar::ControllerItem maBitmapControl; + ::sfx2::sidebar::ControllerItem maColorTableControl; + ::sfx2::sidebar::ControllerItem maGradientListControl; + ::sfx2::sidebar::ControllerItem maHatchListControl; + ::sfx2::sidebar::ControllerItem maBitmapListControl; + ::sfx2::sidebar::ControllerItem maFillTransparenceController; + ::sfx2::sidebar::ControllerItem maFillFloatTransparenceController; + + Image maImgAxial; + Image maImgElli; + Image maImgQuad; + Image maImgRadial; + Image maImgSquare; + Image maImgLinear; + Image maImgColor; + + String msHelpFillType; + String msHelpFillAttr; + + AreaTransparencyGradientPopup maTrGrPopup; + ColorPopup maColorPopup; + + ::boost::scoped_ptr< XFillFloatTransparenceItem > mpFloatTransparenceItem; + ::boost::scoped_ptr< SfxUInt16Item > mpTransparanceItem; + + cssu::Reference<css::frame::XFrame> mxFrame; + SfxBindings* mpBindings; + + /// bitfield + bool mbTBShow : 1; + bool mbColorAvail : 1; + + DECL_LINK(SelectFillTypeHdl, ListBox* ); + DECL_LINK(SelectFillAttrHdl, ListBox* ); + DECL_LINK(ChangeTrgrTypeHdl_Impl, void*); + DECL_LINK(ModifyTransparentHdl_Impl, void*); + DECL_LINK( ImplPopupModeEndHdl, FloatingWindow* ); + + // for transparency gradient + PopupControl* CreateTransparencyGradientControl (PopupContainer* pParent); + DECL_LINK( ClickTrGrHdl_Impl, ToolBox* ); + + // for color picker + PopupControl* CreateColorPopupControl (PopupContainer* pParent); + DECL_LINK(ToolBoxColorDropHdl, ToolBox *); //for new color picker + + // constructor/destuctor + AreaPropertyPanel( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings); + virtual ~AreaPropertyPanel(void); + + void SetupIcons(void); + void Initialize(); + void Update(); + void ImpUpdateTransparencies(); + + Color GetLastColor (void) const; + void SetColor ( + const String& rsColorName, + const Color aColor); +}; + + +} } // end of namespace ::svx::sidebar + + + +#endif // SVX_PROPERTYPANEL_AREAPAGE_HXX + +// eof diff --git a/svx/source/sidebar/area/AreaPropertyPanel.src b/svx/source/sidebar/area/AreaPropertyPanel.src new file mode 100644 index 000000000000..32696ed78b60 --- /dev/null +++ b/svx/source/sidebar/area/AreaPropertyPanel.src @@ -0,0 +1,389 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "AreaPropertyPanel.hrc" +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include <svx/dialogs.hrc> +#include "helpid.hrc" + +#define TOOLBOX_WIDTH 50 +#define TOOLBOX_HEIGHT 17 + +Control RID_SIDEBAR_AREA_PANEL +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + Size = MAP_APPFONT( PROPERTYPAGE_WIDTH, SECTIONPAGE_MARGIN_VERTICAL_TOP + SECTIONPAGE_MARGIN_VERTICAL_BOT + 2*( FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + CBOX_HEIGHT) + CONTROL_SPACING_VERTICAL ); + HelpID = HID_PROPERTYPANEL_AREA_SECTION ; + Text [ en-US ] = "Area"; + + FixedText FT_COLOR_LIST + { + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL , SECTIONPAGE_MARGIN_VERTICAL_TOP ) ; + Size = MAP_APPFONT ( FIXED_TEXT_WIDTH + 50, FIXED_TEXT_HEIGHT ) ; + Text [ en-US ] = "~Fill:"; + }; + FixedText FL_TRSP_TEXT + { + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL , SECTIONPAGE_MARGIN_VERTICAL_TOP + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL ) ; + Size = MAP_APPFONT ( FIXED_TEXT_WIDTH + 50, FIXED_TEXT_HEIGHT ) ; + Text [ en-US ] = "~Transparency:"; + }; + ToolBox TB_COLOR + { + HelpID = HID_PPROPERTYPANEL_AREA_TBX_COLOR; + SVLook = TRUE ; + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + MBOX_WIDTH + CONTROL_SPACING_HORIZONTAL, SECTIONPAGE_MARGIN_VERTICAL_TOP + FIXED_TEXT_HEIGHT + 1) ; + Size = MAP_APPFONT (TOOLBOX_WIDTH ,TOOLBOX_HEIGHT ) ; + TabStop = TRUE ; + Text = "Color"; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_COLOR ; + HelpID = HID_PPROPERTYPANEL_AREA_TBI_COLOR; + DropDown = TRUE ; + Text = "Color" ; + }; + }; + }; + String STR_HELP_COLOR + { + Text [ en-US ] = "Select the color to apply." ; + }; + String STR_HELP_TYPE + { + Text [en-US] = "Select the fill type to apply."; + }; + String STR_HELP_ATTR + { + Text [en-US] = "Select the effect to apply."; + }; + Image IMG_AXIAL + { + ImageBitmap = Bitmap{File = "symphony/axial.png";}; + }; + Image IMG_ELLI + { + ImageBitmap = Bitmap{File = "symphony/ellipsoid.png";}; + }; + Image IMG_QUAD + { + ImageBitmap = Bitmap{File = "symphony/Quadratic.png";}; + }; + Image IMG_RADIAL + { + ImageBitmap = Bitmap{File = "symphony/radial.png";}; + }; + Image IMG_SQUARE + { + ImageBitmap = Bitmap{File = "symphony/Square.png";}; + }; + Image IMG_LINEAR + { + ImageBitmap = Bitmap{File = "symphony/linear.png";}; + }; + Image IMG_COLOR + { + ImageBitmap = Bitmap{File = "symphony/fill_color.png";}; + }; + + //===================================================================================================================================== + ListBox LB_TRGR_TYPES + { + Border = TRUE ; + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL , SECTIONPAGE_MARGIN_VERTICAL_TOP + 2*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL) + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL ) ; + Size = MAP_APPFONT ( MBOX_WIDTH , LISTBOX_HEIGHT ) ; + QuickHelpText [ en-US ] = "Select the type of transparence to apply." ; + TabStop = TRUE ; + DropDown = TRUE ; + HelpID = HID_PPROPERTYPANEL_AREA_LB_TRGR_TYPES ; + StringList [ en-US ] = + { + < "None" ; Default ; > ; + < "Solid" ; Default ; > ; + < "Linear" ; Default ; > ; + < "Axial" ; Default ; > ; + < "Radial" ; Default ; > ; + < "Ellipsoid" ; Default ; > ; + < "Quadratic" ; Default ; > ; + < "Square" ; Default ; > ; + }; + }; + + MetricField MTR_TRANSPARENT + { + Border = TRUE ; + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + MBOX_WIDTH + CONTROL_SPACING_HORIZONTAL , SECTIONPAGE_MARGIN_VERTICAL_TOP + 2*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL) + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL ) ; + Size = MAP_APPFONT ( MBOX_WIDTH + 1 ,MBOX_HEIGHT ) ; + HelpID = HID_PPROPERTYPANEL_AREA_MTR_TRANSPARENT ; + QuickHelpText [ en-US ] = "Specify 0% for fully opaque through 100% for fully transparent." ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + Last = 100 ; + SpinSize = 5 ; + }; + + ToolBox BTN_GRADIENT + { + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + MBOX_WIDTH + CONTROL_SPACING_HORIZONTAL , SECTIONPAGE_MARGIN_VERTICAL_TOP + 2*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL) + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL ) ; + HelpID = HID_PPROPERTYPANEL_AREA_TBX_GRADIENT ; + SVLook = TRUE ; + Border = FALSE ; + TabStop = TRUE ; + Text = "Gradient"; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_BTX_GRADIENT ; + HelpID = HID_PPROPERTYPANEL_AREA_TBI_GRADIENT ; + ItemBitmap = Bitmap + { + File = "symphony/linear.png" ; + }; + DropDown = TRUE; + Text = "Gradient" ; + }; + }; + }; + String STR_HELP_GRADIENT + { + Text [ en-US ] = "Specify the variation of gradient transparency." ; + }; +}; + +Control RID_POPUPPANEL_AREAPAGE_TRGR +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + +// Size = MAP_APPFONT( POP_WIDTH, POP_HEIGHT ); + + FixedText FT_TRGR_CENTER_X + { + Size = MAP_APPFONT ( CONTROL_WIDTH , FIXED_TEXT_HEIGHT ) ; + Text [ en-US ] = "Center ~X:"; + }; + MetricField MTR_TRGR_CENTER_X + { + Border = TRUE ; + Size = MAP_APPFONT ( CONTROL_WIDTH , MBOX_HEIGHT ) ; + HelpID = HID_PPROPERTYPANEL_AREA_MTR_TRGR_CENTER_X ; + QuickHelpText [ en-US ] = "Specify the horizontal offset percentage from the center for the gradient shading style. 50% is the horizontal center." ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + Last = 100 ; + SpinSize = 5 ; + }; + FixedText FT_TRGR_CENTER_Y + { + Size = MAP_APPFONT ( CONTROL_WIDTH + POPUPPANEL_MARGIN_HORIZONTAL, FIXED_TEXT_HEIGHT ) ;//wj + Text [ en-US ] = "Center ~Y:"; + }; + MetricField MTR_TRGR_CENTER_Y + { + Border = TRUE ; + Size = MAP_APPFONT ( CONTROL_WIDTH , MBOX_HEIGHT ) ; + HelpID = HID_PPROPERTYPANEL_AREA_MTR_TRGR_CENTER_Y ; + QuickHelpText [ en-US ] = "Specify the vertical offset percentage from the center for the gradient shading style. 50% is the vertical center." ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + Last = 100 ; + SpinSize = 5 ; + }; + FixedText FT_TRGR_ANGLE + { + Size = MAP_APPFONT ( CONTROL_WIDTH * 2 + POPUPPANEL_MARGIN_HORIZONTAL + CONTROL_SPACING_HORIZONTAL, FIXED_TEXT_HEIGHT ) ;//wj + Text [ en-US ] = "~Angle:"; + }; + MetricField MTR_TRGR_ANGLE + { + Border = TRUE ; + Size = MAP_APPFONT ( CONTROL_WIDTH , MBOX_HEIGHT ) ; + HelpID = HID_PPROPERTYPANEL_AREA_MTR_TRGR_ANGLE ; + QuickHelpText [ en-US ] = "Specify the angle of rotation for the gradient shading style." ; + TabStop = FALSE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = -9999 ; + Maximum = 9999 ; + Unit = FUNIT_CUSTOM ; + SpinSize = 1 ; + CustomUnitText [ en-US ] = " degrees"; + }; + FixedText FT_TRGR_START_VALUE + { + Size = MAP_APPFONT ( CONTROL_WIDTH , FIXED_TEXT_HEIGHT ) ; + Text [ en-US ] = "~Start value:"; + }; + MetricField MTR_TRGR_START_VALUE + { + Border = TRUE ; + Size = MAP_APPFONT ( CONTROL_WIDTH , MBOX_HEIGHT ) ; + HelpID = HID_PPROPERTYPANEL_AREA_MTR_TRGR_SVALUE ; + QuickHelpText [ en-US ] = "Enter a transparency value for the beginning point of the gradient, where 0% is fully opaque and 100% is fully transparent." ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + Last = 100 ; + SpinSize = 5 ; + }; + FixedText FT_TRGR_END_VALUE + { + Size = MAP_APPFONT (CONTROL_WIDTH + POPUPPANEL_MARGIN_HORIZONTAL, FIXED_TEXT_HEIGHT ) ; //wj + Text [ en-US ] = "~End value:"; + }; + MetricField MTR_TRGR_END_VALUE + { + Border = TRUE ; + Size = MAP_APPFONT ( CONTROL_WIDTH , MBOX_HEIGHT ) ; + HelpID = HID_PPROPERTYPANEL_AREA_MTR_TRGR_EVALUE ; + QuickHelpText [ en-US ] = "Enter a transparency value for the endpoint of the gradient, where 0% is fully opaque and 100% is fully transparent." ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + Last = 100 ; + SpinSize = 5 ; + }; + FixedText FT_TRGR_BORDER + { + Size = MAP_APPFONT ( CONTROL_WIDTH * 2 + POPUPPANEL_MARGIN_HORIZONTAL + CONTROL_SPACING_HORIZONTAL, FIXED_TEXT_HEIGHT ) ; // + Text [ en-US ] = "~Border:"; + }; + MetricField MTR_TRGR_BORDER + { + Border = TRUE ; + Size = MAP_APPFONT ( CONTROL_WIDTH , MBOX_HEIGHT ) ; + HelpID = HID_PPROPERTYPANEL_AREA_MTR_TRGR_BORDER ; + QuickHelpText [ en-US ] = "Specify the border value of gradient transparence." ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + Last = 100 ; + SpinSize = 5 ; + }; + //===================================================================================================================================== + + ToolBox BTN_LEFT_SECOND + { + Border = FALSE ; + HelpID = HID_PPROPERTYPANEL_AREA_BTN_LEFT_SECOND ; + SVLook = TRUE ; + Border = FALSE ; + TabStop = TRUE ; + Text = "Rotate Left"; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_LEFT ; + Text = "Rotate Left" ; + ItemBitmap = Bitmap + { + // File = "symphony/rotate_left.png" ; + }; + }; + }; + }; + ToolBox BTN_RIGHT_FIRST + { + Border = FALSE ; + HelpID = HID_PPROPERTYPANEL_AREA_BTN_RIGHT_FIRST ; + SVLook = TRUE ; + Border = FALSE ; + TabStop = TRUE ; + Text = "Rotate Right"; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_RIGHT ; + Text = "Rotate Right" ; + ItemBitmap = Bitmap + { + // File = "symphony/rotate_right.png" ; + }; + }; + }; + }; + String STR_HELP_LEFT + { + Text [ en-US ] = "Rotate counterclockwise by 45 degrees." ; + }; + String STR_HELP_RIGHT + { + Text [ en-US ] = "Rotate clockwise by 45 degrees." ; + }; + Image IMG_ROT_LEFT + { + ImageBitmap = Bitmap{File = "symphony/rotate_left.png";}; + }; + Image IMG_ROT_RIGHT + { + ImageBitmap = Bitmap{File = "symphony/rotate_right.png";}; + }; +}; +Control RID_POPUPPANEL_AERAPAGE_COLOR +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + Size = MAP_APPFONT( POPUP_COLOR_PICKER_WIDTH , POPUP_COLOR_PICKER_HEIGHT ); + + Control VS_COLOR + { + HelpID = HID_PPROPERTYPANEL_AREA_COLOR_VS; + Hide = TRUE ; + Pos = MAP_APPFONT ( OFFSET_X , OFFSET_Y ); + Size = MAP_APPFONT ( POPUP_COLOR_PICKER_WIDTH - OFFSET_X * 2, POPUP_COLOR_PICKER_HEIGHT - OFFSET_Y * 2); + TabStop = TRUE ; + Text = "Color"; + }; +}; + +// eof diff --git a/svx/source/sidebar/area/AreaTransparencyGradientControl.cxx b/svx/source/sidebar/area/AreaTransparencyGradientControl.cxx new file mode 100644 index 000000000000..92ebdeeba927 --- /dev/null +++ b/svx/source/sidebar/area/AreaTransparencyGradientControl.cxx @@ -0,0 +1,345 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "AreaTransparencyGradientControl.hxx" +#include "AreaPropertyPanel.hxx" +#include "AreaPropertyPanel.hrc" + +#include <svx/dialogs.hrc> +#include <svx/dialmgr.hxx> +#include <svx/xflftrit.hxx> +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> + +namespace svx { namespace sidebar { + +// positioning helpers +#define APOS1_1 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL), MAP_APPFONT)) +#define APOS2_1 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL), MAP_APPFONT)) +#define APOS1_2 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL), MAP_APPFONT)) +#define APOS2_2 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL), MAP_APPFONT)) +#define APOS1_3 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL), MAP_APPFONT)) +#define APOS1_4 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 2*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL)+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL), MAP_APPFONT)) +#define APOS2_3 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL), MAP_APPFONT)) +#define APOS2_4 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 2*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL)+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL), MAP_APPFONT)) +#define APOS1_5 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 2*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL)), MAP_APPFONT)) +#define APOS1_6 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 3*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL)+2*(MBOX_HEIGHT+CONTROL_SPACING_VERTICAL)), MAP_APPFONT)) +#define APOS2_5 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 2*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL)), MAP_APPFONT)) +#define APOS2_6 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL+CONTROL_WIDTH+CONTROL_SPACING_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 3*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL)+2*(MBOX_HEIGHT+CONTROL_SPACING_VERTICAL)), MAP_APPFONT)) +#define APOS1_7 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 3*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL+MBOX_HEIGHT+CONTROL_SPACING_VERTICAL)), MAP_APPFONT)) +#define APOS1_8 Point(LogicToPixel(Point(POPUPPANEL_MARGIN_HORIZONTAL,POPUPPANEL_MARGIN_VERTICAL + 4*(FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL)+3*(MBOX_HEIGHT+CONTROL_SPACING_VERTICAL)), MAP_APPFONT)) +#define APOS_Left_Right_1 Point(LogicToPixel(Point(LEFT_RIGHT_X1,LEFT_RIGHT_Y1), MAP_APPFONT)) +#define APOS_Left_Right_2 Point(LogicToPixel(Point(LEFT_RIGHT_X2,LEFT_RIGHT_Y1), MAP_APPFONT)) +#define APOS_Left_Right_3 Point(LogicToPixel(Point(LEFT_RIGHT_X1,LEFT_RIGHT_Y2), MAP_APPFONT)) +#define APOS_Left_Right_4 Point(LogicToPixel(Point(LEFT_RIGHT_X2,LEFT_RIGHT_Y2), MAP_APPFONT)) + + + + +AreaTransparencyGradientControl::AreaTransparencyGradientControl ( + Window* pParent, + AreaPropertyPanel& rPanel) + : PopupControl( pParent,SVX_RES(RID_POPUPPANEL_AREAPAGE_TRGR)), + maFtTrgrCenterX(this, SVX_RES(FT_TRGR_CENTER_X)), + maMtrTrgrCenterX(this, SVX_RES(MTR_TRGR_CENTER_X)), + maFtTrgrCenterY(this, SVX_RES(FT_TRGR_CENTER_Y)), + maMtrTrgrCenterY(this, SVX_RES(MTR_TRGR_CENTER_Y)), + maFtTrgrAngle(this, SVX_RES(FT_TRGR_ANGLE)), + maMtrTrgrAngle(this, SVX_RES(MTR_TRGR_ANGLE)), + maBtnLeft45(this, SVX_RES(BTN_LEFT_SECOND)), + maBtnRight45(this, SVX_RES(BTN_RIGHT_FIRST)), + maFtTrgrStartValue(this, SVX_RES(FT_TRGR_START_VALUE)), + maMtrTrgrStartValue(this, SVX_RES(MTR_TRGR_START_VALUE)), + maFtTrgrEndValue(this, SVX_RES(FT_TRGR_END_VALUE)), + maMtrTrgrEndValue(this, SVX_RES(MTR_TRGR_END_VALUE)), + maFtTrgrBorder(this, SVX_RES(FT_TRGR_BORDER)), + maMtrTrgrBorder(this, SVX_RES(MTR_TRGR_BORDER)), + maRotLeft( SVX_RES(IMG_ROT_LEFT)), + maRotRight( SVX_RES(IMG_ROT_RIGHT)), + mrAreaPropertyPanel(rPanel), + mpBindings(NULL) +{ + Link aLink = LINK( this, AreaTransparencyGradientControl, ModifiedTrgrHdl_Impl); + maMtrTrgrCenterX.SetModifyHdl( aLink ); + maMtrTrgrCenterY.SetModifyHdl( aLink ); + maMtrTrgrAngle.SetModifyHdl( aLink ); + maMtrTrgrBorder.SetModifyHdl( aLink ); + maMtrTrgrStartValue.SetModifyHdl( aLink ); + maMtrTrgrEndValue.SetModifyHdl( aLink ); + aLink = LINK( this, AreaTransparencyGradientControl, Left_Click45_Impl); + maBtnLeft45.SetSelectHdl( aLink ); + aLink = LINK( this, AreaTransparencyGradientControl, Right_Click45_Impl); + maBtnRight45.SetSelectHdl( aLink ); + maBtnLeft45.SetItemImage(1,maRotLeft); + Size aTbxSize = maBtnLeft45.CalcWindowSizePixel(); + maBtnLeft45.SetOutputSizePixel( aTbxSize ); + maBtnLeft45.SetQuickHelpText(1, String(SVX_RES(STR_HELP_LEFT))); //acc wj + + maBtnRight45.SetItemImage(1,maRotRight); + aTbxSize = maBtnRight45.CalcWindowSizePixel(); + maBtnRight45.SetOutputSizePixel( aTbxSize ); + maBtnRight45.SetQuickHelpText(1, String(SVX_RES(STR_HELP_RIGHT))); //acc wj + + maBtnLeft45.SetBackground(Wallpaper()); + maBtnLeft45.SetPaintTransparent(true); + maBtnRight45.SetBackground(Wallpaper()); + maBtnRight45.SetPaintTransparent(true); + + FreeResource(); + mpBindings = mrAreaPropertyPanel.GetBindings(); +} + + + + +AreaTransparencyGradientControl::~AreaTransparencyGradientControl (void) +{ +} + + + + +void AreaTransparencyGradientControl::ToGetFocus() +{ + if(maMtrTrgrCenterX.IsVisible()) + maMtrTrgrCenterX.GrabFocus(); + else + maMtrTrgrAngle.GrabFocus(); +} + + + + +void AreaTransparencyGradientControl::Rearrange(XFillFloatTransparenceItem* pGradientItem) +{ + InitStatus(pGradientItem); + const XGradient& rGradient = pGradientItem->GetGradientValue(); + XGradientStyle eXGS(rGradient.GetGradientStyle()); + Size aSize(POP_WIDTH,POP_HEIGHT); + aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) ); + Size aSize2(POP_WIDTH,POP_HEIGHT2); + aSize2 = LogicToPixel( aSize2, MapMode(MAP_APPFONT) ); + long aPosY = 0; + Point aPointAngle; + Size aSizeAngle = maMtrTrgrAngle.GetSizePixel(); + Size aTbxSize = maBtnLeft45.CalcWindowSizePixel(); + + switch(eXGS) + { + case XGRAD_LINEAR: + case XGRAD_AXIAL: + maFtTrgrCenterX.Hide(); + maMtrTrgrCenterX.Hide(); + maFtTrgrCenterY.Hide(); + maMtrTrgrCenterY.Hide(); + maFtTrgrAngle.Show(); + maFtTrgrAngle.SetPosPixel(APOS1_1); + maMtrTrgrAngle.Show(); + maMtrTrgrAngle.SetPosPixel(APOS2_1); + maFtTrgrStartValue.SetPosPixel(APOS1_3); + maMtrTrgrStartValue.SetPosPixel(APOS1_4); + maFtTrgrEndValue.SetPosPixel(APOS2_3); + maMtrTrgrEndValue.SetPosPixel(APOS2_4); + maFtTrgrBorder.SetPosPixel(APOS1_5); + maMtrTrgrBorder.SetPosPixel(APOS1_6); + + maBtnLeft45.Show(); + maBtnRight45.Show(); + + aPointAngle = maMtrTrgrAngle.GetPosPixel(); + aPosY = aPointAngle.getY() + aSizeAngle.getHeight() - aTbxSize.getHeight(); + + maBtnLeft45.SetPosPixel(Point(APOS_Left_Right_1.getX(), aPosY)); + maBtnRight45.SetPosPixel(Point(APOS_Left_Right_2.getX(), aPosY)); + + SetSizePixel(aSize2); + break; + + case XGRAD_RADIAL: + maFtTrgrCenterX.Show(); + maFtTrgrCenterX.SetPosPixel(APOS1_1); + maMtrTrgrCenterX.Show(); + maMtrTrgrCenterX.SetPosPixel(APOS2_1); + maFtTrgrCenterY.Show(); + maFtTrgrCenterY.SetPosPixel(APOS1_2); + maMtrTrgrCenterY.Show(); + maMtrTrgrCenterY.SetPosPixel(APOS2_2); + maFtTrgrAngle.Hide(); + maMtrTrgrAngle.Hide(); + maFtTrgrStartValue.SetPosPixel(APOS1_3); + maMtrTrgrStartValue.SetPosPixel(APOS1_4); + maFtTrgrEndValue.SetPosPixel(APOS2_3); + maMtrTrgrEndValue.SetPosPixel(APOS2_4); + maFtTrgrBorder.SetPosPixel(APOS1_5); + maMtrTrgrBorder.SetPosPixel(APOS1_6); + + maBtnLeft45.Hide(); + maBtnRight45.Hide(); + + SetSizePixel(aSize2); + + break; + + case XGRAD_ELLIPTICAL: + case XGRAD_SQUARE: + case XGRAD_RECT: + maFtTrgrCenterX.Show(); + maFtTrgrCenterX.SetPosPixel(APOS1_1); + maMtrTrgrCenterX.Show(); + maMtrTrgrCenterX.SetPosPixel(APOS2_1); + maFtTrgrCenterY.Show(); + maFtTrgrCenterY.SetPosPixel(APOS1_2); + maMtrTrgrCenterY.Show(); + maMtrTrgrCenterY.SetPosPixel(APOS2_2); + maFtTrgrAngle.Show(); + maFtTrgrAngle.SetPosPixel(APOS1_3); + maMtrTrgrAngle.Show(); + maMtrTrgrAngle.SetPosPixel(APOS1_4); + + maFtTrgrStartValue.SetPosPixel(APOS1_5); + maMtrTrgrStartValue.SetPosPixel(APOS1_6); + maFtTrgrEndValue.SetPosPixel(APOS2_5); + maMtrTrgrEndValue.SetPosPixel(APOS2_6); + maFtTrgrBorder.SetPosPixel(APOS1_7); + maMtrTrgrBorder.SetPosPixel(APOS1_8); + + maBtnLeft45.Show(); + maBtnRight45.Show(); + + aPointAngle = maMtrTrgrAngle.GetPosPixel(); + aPosY = aPointAngle.getY() + aSizeAngle.getHeight() - aTbxSize.getHeight(); + + maBtnLeft45.SetPosPixel(Point(APOS_Left_Right_3.getX(), aPosY)); + maBtnRight45.SetPosPixel(Point(APOS_Left_Right_4.getX(), aPosY)); + + SetSizePixel(aSize); + + break; + } +} + + + + +void AreaTransparencyGradientControl::InitStatus(XFillFloatTransparenceItem* pGradientItem) +{ + const XGradient& rGradient = pGradientItem->GetGradientValue(); + + XGradient aGradient; + + if (rGradient.GetXOffset() == AreaPropertyPanel::DEFAULT_CENTERX + && rGradient.GetYOffset() == AreaPropertyPanel::DEFAULT_CENTERY + && (rGradient.GetAngle() / 10) == AreaPropertyPanel::DEFAULT_ANGLE + && ((sal_uInt16)((((sal_uInt16)rGradient.GetStartColor().GetRed() + 1) * 100) / 255)) + == AreaPropertyPanel::DEFAULT_STARTVALUE + && ((sal_uInt16)((((sal_uInt16)rGradient.GetEndColor().GetRed() + 1) * 100) / 255)) + == AreaPropertyPanel::DEFAULT_ENDVALUE + && rGradient.GetBorder() == AreaPropertyPanel::DEFAULT_BORDER) + { + aGradient = mrAreaPropertyPanel.GetGradient(rGradient.GetGradientStyle()); + } + else + { + aGradient = rGradient; + } + maMtrTrgrCenterX.SetValue(aGradient.GetXOffset()); + maMtrTrgrCenterY.SetValue(aGradient.GetYOffset()); + maMtrTrgrAngle.SetValue(aGradient.GetAngle() / 10); + maMtrTrgrStartValue.SetValue((sal_uInt16)((((sal_uInt16)aGradient.GetStartColor().GetRed() + 1) * 100) / 255)); + maMtrTrgrEndValue.SetValue((sal_uInt16)((((sal_uInt16)aGradient.GetEndColor().GetRed() + 1) * 100) / 255)); + maMtrTrgrBorder.SetValue(aGradient.GetBorder()); +} + + + + +void AreaTransparencyGradientControl::ExecuteValueModify( sal_uInt8 nStartCol, sal_uInt8 nEndCol ) +{ + //Added + sal_Int16 aMtrValue = (sal_Int16)maMtrTrgrAngle.GetValue(); + while(aMtrValue<0) + aMtrValue += 360; + sal_uInt16 nVal = aMtrValue/360; + nVal = aMtrValue - nVal*360; + maMtrTrgrAngle.SetValue(nVal); + //End of new code + XGradient aTmpGradient( + Color(nStartCol, nStartCol, nStartCol), + Color(nEndCol, nEndCol, nEndCol), + (XGradientStyle)(mrAreaPropertyPanel.GetSelectedTransparencyTypeIndex()-2), + (sal_uInt16)maMtrTrgrAngle.GetValue() * 10, + (sal_uInt16)maMtrTrgrCenterX.GetValue(), + (sal_uInt16)maMtrTrgrCenterY.GetValue(), + (sal_uInt16)maMtrTrgrBorder.GetValue(), + 100, 100); + + mrAreaPropertyPanel.SetGradient(aTmpGradient); + + SfxItemPool* pPool = NULL; + bool bEnable = true; + XFillFloatTransparenceItem aGradientItem(pPool,aTmpGradient, bEnable ); + + mpBindings->GetDispatcher()->Execute( SID_ATTR_FILL_FLOATTRANSPARENCE, SFX_CALLMODE_RECORD, &aGradientItem, 0L ); +} + + + + +IMPL_LINK_NOARG(AreaTransparencyGradientControl, ModifiedTrgrHdl_Impl) +{ + sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrStartValue.GetValue() * 255) / 100); + sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrEndValue.GetValue() * 255) / 100); + ExecuteValueModify( nStartCol, nEndCol ); + return( 0L ); +} + + + + +IMPL_LINK_NOARG(AreaTransparencyGradientControl, Left_Click45_Impl) +{ + sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrStartValue.GetValue() * 255) / 100); + sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrEndValue.GetValue() * 255) / 100); + sal_uInt16 aTemp = (sal_uInt16)maMtrTrgrAngle.GetValue(); + if(aTemp>=315) + aTemp -= 360; + aTemp += 45; + maMtrTrgrAngle.SetValue(aTemp); + ExecuteValueModify( nStartCol, nEndCol ); + return( 0L ); +} + + + + +IMPL_LINK_NOARG(AreaTransparencyGradientControl, Right_Click45_Impl) +{ + sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrStartValue.GetValue() * 255) / 100); + sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrEndValue.GetValue() * 255) / 100); + sal_uInt16 aTemp = (sal_uInt16)maMtrTrgrAngle.GetValue(); + if(aTemp<45) + aTemp += 360; + aTemp -= 45; + maMtrTrgrAngle.SetValue(aTemp); + ExecuteValueModify( nStartCol, nEndCol ); + return( 0L ); +} + +} } // end of namespace svx::sidebar + +// eof diff --git a/svx/source/sidebar/area/AreaTransparencyGradientControl.hxx b/svx/source/sidebar/area/AreaTransparencyGradientControl.hxx new file mode 100644 index 000000000000..5d31d44d5b8b --- /dev/null +++ b/svx/source/sidebar/area/AreaTransparencyGradientControl.hxx @@ -0,0 +1,74 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "svx/sidebar/PopupControl.hxx" + +#include <vcl/fixed.hxx> +#include <vcl/field.hxx> +#include <vcl/toolbox.hxx> +#include <svx/xenum.hxx> + +class XFillFloatTransparenceItem; +class SfxBindings; + +namespace svx { namespace sidebar { + +class AreaPropertyPanel; + +class AreaTransparencyGradientControl : public PopupControl +{ +public: + AreaTransparencyGradientControl ( + Window* pParent, + AreaPropertyPanel& rPanel); + virtual ~AreaTransparencyGradientControl (void); + + void ToGetFocus(); + void Rearrange(XFillFloatTransparenceItem* pGradientItem); + void InitStatus(XFillFloatTransparenceItem* pGradientItem); + void ExecuteValueModify( sal_uInt8 nStartCol, sal_uInt8 nEndCol ); + void SetControlState_Impl(XGradientStyle eXGS); + +private: + FixedText maFtTrgrCenterX; + MetricField maMtrTrgrCenterX; + FixedText maFtTrgrCenterY; + MetricField maMtrTrgrCenterY; + FixedText maFtTrgrAngle; + MetricField maMtrTrgrAngle; + ToolBox maBtnLeft45; + ToolBox maBtnRight45; + FixedText maFtTrgrStartValue; + MetricField maMtrTrgrStartValue; + FixedText maFtTrgrEndValue; + MetricField maMtrTrgrEndValue; + FixedText maFtTrgrBorder; + MetricField maMtrTrgrBorder; + Image maRotLeft; + Image maRotRight; + + AreaPropertyPanel& mrAreaPropertyPanel; + SfxBindings* mpBindings; + DECL_LINK( ModifiedTrgrHdl_Impl, void* ); + DECL_LINK( Left_Click45_Impl, void* ); + DECL_LINK( Right_Click45_Impl, void* ); +}; + + +} } // end of namespace svx::sidebar + +// eof diff --git a/svx/source/sidebar/area/AreaTransparencyGradientPopup.cxx b/svx/source/sidebar/area/AreaTransparencyGradientPopup.cxx new file mode 100644 index 000000000000..4ae8c7edcaae --- /dev/null +++ b/svx/source/sidebar/area/AreaTransparencyGradientPopup.cxx @@ -0,0 +1,56 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "AreaTransparencyGradientPopup.hxx" +#include "AreaTransparencyGradientControl.hxx" + + +namespace svx { namespace sidebar { + +AreaTransparencyGradientPopup::AreaTransparencyGradientPopup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator) + : Popup( + pParent, + rControlCreator, + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Transparency and Gradient"))) +{ +} + + + + +AreaTransparencyGradientPopup::~AreaTransparencyGradientPopup (void) +{ +} + + + + +void AreaTransparencyGradientPopup::Rearrange (XFillFloatTransparenceItem* pItem) +{ + ProvideContainerAndControl(); + + AreaTransparencyGradientControl* pControl = dynamic_cast<AreaTransparencyGradientControl*>(mpControl.get()); + if (pControl != NULL) + pControl->Rearrange(pItem); +} + + +} } // end of namespace svx::sidebar + +// eof diff --git a/svx/source/sidebar/area/AreaTransparencyGradientPopup.hxx b/svx/source/sidebar/area/AreaTransparencyGradientPopup.hxx new file mode 100644 index 000000000000..7c11f6b535d6 --- /dev/null +++ b/svx/source/sidebar/area/AreaTransparencyGradientPopup.hxx @@ -0,0 +1,47 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_SIDEBAR_TRANSPARENCY_GRADIENT_POPUP_HXX_ +#define _SVX_SIDEBAR_TRANSPARENCY_GRADIENT_POPUP_HXX_ + +#include "svx/sidebar/Popup.hxx" + +#include <boost/function.hpp> + + +class XFillFloatTransparenceItem; + + +namespace svx { namespace sidebar { + +class AreaTransparencyGradientPopup + : public Popup +{ +public : + AreaTransparencyGradientPopup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator); + ~AreaTransparencyGradientPopup (void); + + void Rearrange (XFillFloatTransparenceItem* pItem); +}; + +} } // end of namespace svx::sidebar + +#endif + +// eof diff --git a/svx/source/sidebar/debug/ColorPanel.cxx b/svx/source/sidebar/debug/ColorPanel.cxx new file mode 100644 index 000000000000..57cce2017359 --- /dev/null +++ b/svx/source/sidebar/debug/ColorPanel.cxx @@ -0,0 +1,228 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "ColorPanel.hxx" + +#include <vcl/image.hxx> +#include <vcl/svapp.hxx> + +namespace svx { namespace sidebar { + +ColorPanel::ColorPanel (::Window* pParent) + : ValueSet(pParent, WB_ITEMBORDER), + mnPreferredColumnCount(2) +{ + WinBits aStyle = + WB_ITEMBORDER + | WB_DOUBLEBORDER + | WB_NAMEFIELD + | WB_FLATVALUESET + | WB_TABSTOP + | WB_VSCROLL; + + SetStyle(GetStyle() | aStyle); + SetExtraSpacing(2); + + Fill (); + Show(); +} + + + + +ColorPanel::~ColorPanel (void) +{ +} + + + + +sal_Int32 ColorPanel::GetPreferredHeight (sal_Int32 nWidth) +{ + sal_Int32 nPreferredHeight = 0; + if (GetItemCount()>0) + { + Image aImage = GetItemImage(GetItemId(0)); + Size aItemSize = CalcItemSizePixel (aImage.GetSizePixel()); + if (nWidth>0 && aItemSize.Width()>0) + { + int nColumnCount = nWidth / aItemSize.Width(); + if (nColumnCount <= 0) + nColumnCount = 1; + else if (nColumnCount > 4) + nColumnCount = 4; + int nRowCount = (GetItemCount() + nColumnCount-1) + / nColumnCount; + nPreferredHeight = nRowCount * aItemSize.Height(); + } + } + return nPreferredHeight; +} + + + + +void ColorPanel::Resize (void) +{ + ::Window::Resize(); + Size aWindowSize = GetOutputSizePixel(); + SetPosSizePixel(Point(0,0), aWindowSize); + if (IsVisible() && aWindowSize.Width() > 0) + { + // Calculate the number of rows and columns. + if (GetItemCount() > 0) + { + Image aImage = GetItemImage(GetItemId(0)); + Size aItemSize = CalcItemSizePixel ( + aImage.GetSizePixel()); + int nColumnCount = aWindowSize.Width() / 30; + if (nColumnCount < 1) + nColumnCount = 1; + else if (nColumnCount > 4) + nColumnCount = 4; + + sal_uInt16 nRowCount = (sal_uInt16)CalculateRowCount(aItemSize, nColumnCount); + + SetColCount((sal_uInt16)nColumnCount); + SetLineCount(nRowCount); + } + } + +} + + + + +int ColorPanel::CalculateRowCount (const Size&, int nColumnCount) +{ + int nRowCount = 0; + + if (GetItemCount()>0 && nColumnCount>0) + { + nRowCount = GetOutputSizePixel().Height() / 30; + if (nRowCount < 1) + nRowCount = 1; + } + + return nRowCount; +} + + + + +void ColorPanel::DataChanged (const DataChangedEvent& /*rEvent*/) +{ + Fill(); +} + + + + +void ColorPanel::Fill (void) +{ + const StyleSettings& rSettings ( + Application::GetSettings().GetStyleSettings()); + Clear(); + SetItemWidth (30); + SetItemHeight (30); + sal_uInt16 i = 0; + InsertItem (++i, rSettings.GetFaceColor()); + SetItemText (i, OUString("FaceColor")); + InsertItem (++i, rSettings.GetCheckedColor()); + SetItemText (i, OUString("CheckedColor")); + InsertItem (++i, rSettings.GetLightColor()); + SetItemText (i, OUString("LightColor")); + InsertItem (++i, rSettings.GetLightBorderColor()); + SetItemText (i, OUString("LightBorderColor")); + InsertItem (++i, rSettings.GetShadowColor()); + SetItemText (i, OUString("ShadowColor")); + InsertItem (++i, rSettings.GetDarkShadowColor()); + SetItemText (i, OUString("DarkShadowColor")); + InsertItem (++i, rSettings.GetButtonTextColor()); + SetItemText (i, OUString("ButtonTextColor")); + InsertItem (++i, rSettings.GetRadioCheckTextColor()); + SetItemText (i, OUString("RadioCheckTextColor")); + InsertItem (++i, rSettings.GetGroupTextColor()); + SetItemText (i, OUString("GroupTextColor")); + InsertItem (++i, rSettings.GetLabelTextColor()); + SetItemText (i, OUString("LabelTextColor")); + InsertItem (++i, rSettings.GetInfoTextColor()); + SetItemText (i, OUString("InfoTextColor")); + InsertItem (++i, rSettings.GetWindowColor()); + SetItemText (i, OUString("WindowColor")); + InsertItem (++i, rSettings.GetWindowTextColor()); + SetItemText (i, OUString("WindowTextColor")); + InsertItem (++i, rSettings.GetDialogColor()); + SetItemText (i, OUString("DialogColor")); + InsertItem (++i, rSettings.GetDialogTextColor()); + SetItemText (i, OUString("DialogTextColor")); + InsertItem (++i, rSettings.GetWorkspaceColor()); + SetItemText (i, OUString("WorkspaceColor")); + InsertItem (++i, rSettings.GetFieldColor()); + SetItemText (i, OUString("FieldColor")); + InsertItem (++i, rSettings.GetFieldTextColor()); + SetItemText (i, OUString("FieldTextColor")); + InsertItem (++i, rSettings.GetActiveColor()); + SetItemText (i, OUString("ActiveColor")); + InsertItem (++i, rSettings.GetActiveColor2()); + SetItemText (i, OUString("ActiveColor2")); + InsertItem (++i, rSettings.GetActiveTextColor()); + SetItemText (i, OUString("ActiveTextColor")); + InsertItem (++i, rSettings.GetActiveBorderColor()); + SetItemText (i, OUString("ActiveBorderColor")); + InsertItem (++i, rSettings.GetDeactiveColor()); + SetItemText (i, OUString("DeactiveColor")); + InsertItem (++i, rSettings.GetDeactiveColor2()); + SetItemText (i, OUString("DeactiveColor2")); + InsertItem (++i, rSettings.GetDeactiveTextColor()); + SetItemText (i, OUString("DeactiveTextColor")); + InsertItem (++i, rSettings.GetDeactiveBorderColor()); + SetItemText (i, OUString("DeactiveBorderColor")); + InsertItem (++i, rSettings.GetHighlightColor()); + SetItemText (i, OUString("HighlightColor")); + InsertItem (++i, rSettings.GetHighlightTextColor()); + SetItemText (i, OUString("HighlightTextColor")); + InsertItem (++i, rSettings.GetDisableColor()); + SetItemText (i, OUString("DisableColor")); + InsertItem (++i, rSettings.GetHelpColor()); + SetItemText (i, OUString("HelpColor")); + InsertItem (++i, rSettings.GetHelpTextColor()); + SetItemText (i, OUString("HelpTextColor")); + InsertItem (++i, rSettings.GetMenuColor()); + SetItemText (i, OUString("MenuColor")); + InsertItem (++i, rSettings.GetMenuBarColor()); + SetItemText (i, OUString("MenuBarColor")); + InsertItem (++i, rSettings.GetMenuBorderColor()); + SetItemText (i, OUString("MenuBorderColor")); + InsertItem (++i, rSettings.GetMenuTextColor()); + SetItemText (i, OUString("MenuTextColor")); + InsertItem (++i, rSettings.GetMenuHighlightColor()); + SetItemText (i, OUString("MenuHighlightColor")); + InsertItem (++i, rSettings.GetMenuHighlightTextColor()); + SetItemText (i, OUString("MenuHighlightTextColor")); + InsertItem (++i, rSettings.GetLinkColor()); + SetItemText (i, OUString("LinkColor")); + InsertItem (++i, rSettings.GetVisitedLinkColor()); + SetItemText (i, OUString("VisitedLinkColor")); + InsertItem (++i, rSettings.GetHighlightLinkColor()); + SetItemText (i, OUString("HighlightLinkColor")); + InsertItem (++i, rSettings.GetFontColor()); + SetItemText (i, OUString("FontColor")); +} + +} } // end of namespace ::svx::sidebar diff --git a/svx/source/sidebar/debug/ColorPanel.hxx b/svx/source/sidebar/debug/ColorPanel.hxx new file mode 100644 index 000000000000..5f7887a7a6e3 --- /dev/null +++ b/svx/source/sidebar/debug/ColorPanel.hxx @@ -0,0 +1,57 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SVX_SIDEBAR_COLOR_PANEL_HXX +#define SVX_SIDEBAR_COLOR_PANEL_HXX + +#include <svtools/valueset.hxx> +#include <vcl/window.hxx> + + +namespace svx { namespace sidebar { + + +/** This demo panel shows the colors that are available from the + StyleSettings. +*/ +class ColorPanel + : public ValueSet +{ +public: + ColorPanel (::Window* pParent); + virtual ~ColorPanel (void); + + // From ::Window + virtual void Resize (void); + virtual void DataChanged (const DataChangedEvent& rEvent); + +private: + int mnPreferredColumnCount; + + /** Depending on the given number of columns and the item size + calculate the number of rows that are necessary to display all + items. + */ + int CalculateRowCount (const Size& rItemSize, int nColumnCount); + void Fill (void); + + sal_Int32 GetPreferredHeight (sal_Int32 nWidth); +}; + +} } // end of namespace ::svx::sidebar + +#endif diff --git a/svx/source/sidebar/debug/ContextPanel.cxx b/svx/source/sidebar/debug/ContextPanel.cxx new file mode 100644 index 000000000000..0a39a705c0b6 --- /dev/null +++ b/svx/source/sidebar/debug/ContextPanel.cxx @@ -0,0 +1,64 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "ContextPanel.hxx" + +namespace svx { namespace sidebar { + +ContextPanel::ContextPanel (::Window* pParent) + : Window(pParent, 0), + maApplicationName(this, 0), + maContextName(this, 0) +{ + maApplicationName.setPosSizePixel(5,5, 250,15); + maContextName.setPosSizePixel(5,25, 250,15); + + maApplicationName.Show(); + maContextName.Show(); + Show(); +} + + + + +ContextPanel::~ContextPanel (void) +{ +} + + + + +sal_Int32 ContextPanel::GetPreferredHeight (sal_Int32 /*nWidth*/) +{ + const sal_Int32 nHeight (maContextName.GetPosPixel().Y() + maContextName.GetSizePixel().Height() + 5); + return nHeight; +} + + + + +void ContextPanel::HandleContextChange (const sfx2::sidebar::EnumContext aContext) +{ + maApplicationName.SetText(aContext.GetApplicationName()); + maContextName.SetText(aContext.GetContextName()); +} + + + + +} } // end of namespace ::svx::sidebar diff --git a/svx/source/sidebar/debug/ContextPanel.hxx b/svx/source/sidebar/debug/ContextPanel.hxx new file mode 100644 index 000000000000..7115a352435c --- /dev/null +++ b/svx/source/sidebar/debug/ContextPanel.hxx @@ -0,0 +1,52 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SVX_SIDEBAR_DEBUG_CONTEXT_PANEL_HXX +#define SVX_SIDEBAR_DEBUG_CONTEXT_PANEL_HXX + +#include <sfx2/sidebar/IContextChangeReceiver.hxx> +#include <vcl/window.hxx> +#include <vcl/fixed.hxx> + + +namespace svx { namespace sidebar { + + +/** Display the current context. +*/ +class ContextPanel + : public Window, + public sfx2::sidebar::IContextChangeReceiver +{ +public: + ContextPanel (::Window* pParent); + virtual ~ContextPanel (void); + + // From Window + sal_Int32 GetPreferredHeight (sal_Int32 nWidth); + + // From IContextChangeReceiverInterface + virtual void HandleContextChange (const ::sfx2::sidebar::EnumContext aContext); + +private: + FixedText maApplicationName; + FixedText maContextName; +}; + +} } // end of namespace ::svx::sidebar + +#endif diff --git a/svx/source/sidebar/debug/NotYetImplementedPanel.cxx b/svx/source/sidebar/debug/NotYetImplementedPanel.cxx new file mode 100644 index 000000000000..2bb5ae9c1df0 --- /dev/null +++ b/svx/source/sidebar/debug/NotYetImplementedPanel.cxx @@ -0,0 +1,44 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "NotYetImplementedPanel.hxx" + +namespace svx { namespace sidebar { + +NotYetImplementedPanel::NotYetImplementedPanel (::Window* pParent) + : Window(pParent, 0), + maMessageControl(this, 0) +{ + maMessageControl.setPosSizePixel(5,5, 250,15); + maMessageControl.SetText(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("not yet implemented"))); + + maMessageControl.Show(); + Show(); +} + + + + +NotYetImplementedPanel::~NotYetImplementedPanel (void) +{ +} + + + + +} } // end of namespace ::svx::sidebar diff --git a/svx/source/sidebar/debug/NotYetImplementedPanel.hxx b/svx/source/sidebar/debug/NotYetImplementedPanel.hxx new file mode 100644 index 000000000000..575c810a147a --- /dev/null +++ b/svx/source/sidebar/debug/NotYetImplementedPanel.hxx @@ -0,0 +1,43 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SVX_SIDEBAR_DEBUG_NOT_YET_IMPLEMENTED_PANEL_HXX +#define SVX_SIDEBAR_DEBUG_NOT_YET_IMPLEMENTED_PANEL_HXX + +#include <vcl/window.hxx> +#include <vcl/fixed.hxx> + + +namespace svx { namespace sidebar { + + +/** Display a panel as placeholder for a not-yet-implemented panel. +*/ +class NotYetImplementedPanel + : public Window +{ +public: + NotYetImplementedPanel (::Window* pParent); + virtual ~NotYetImplementedPanel (void); + +private: + FixedText maMessageControl; +}; + +} } // end of namespace ::svx::sidebar + +#endif diff --git a/svx/source/tbxctrls/linectrl.src b/svx/source/sidebar/gallery/GalleryPanel.hxx index 90d1409f8659..8efb8512e650 100644 --- a/svx/source/tbxctrls/linectrl.src +++ b/svx/source/sidebar/gallery/GalleryPanel.hxx @@ -17,11 +17,11 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "linectrl.hrc" +#ifndef SVX_SIDEBAR_GALLERY_PANEL_HXX +#define SVX_SIDEBAR_GALLERY_PANEL_HXX -Bitmap RID_SVXCTRL_LINECTRL +class GelleryPanel { - File = "soliline.bmp" ; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx b/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx new file mode 100644 index 000000000000..1e5103d1a133 --- /dev/null +++ b/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx @@ -0,0 +1,455 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include <sfx2/sidebar/Theme.hxx> +#include <sfx2/sidebar/ControlFactory.hxx> +#include <GraphicPropertyPanel.hxx> +#include <GraphicPropertyPanel.hrc> +#include <svx/dialogs.hrc> +#include <svx/dialmgr.hxx> +#include <vcl/field.hxx> +#include <vcl/lstbox.hxx> +#include <svl/intitem.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> + +using namespace css; +using namespace cssu; +using ::sfx2::sidebar::Theme; + +#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) + +////////////////////////////////////////////////////////////////////////////// +// namespace open + +namespace svx { namespace sidebar { + +////////////////////////////////////////////////////////////////////////////// + +GraphicPropertyPanel::GraphicPropertyPanel( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings) +: Control( + pParent, + SVX_RES(RID_SIDEBAR_GRAPHIC_PANEL)), + mpFtBrightness(new FixedText(this, SVX_RES(FT_BRIGHTNESS))), + mpMtrBrightness(new MetricField(this, SVX_RES(MTR_BRIGHTNESS))), + mpFtContrast(new FixedText(this, SVX_RES(FT_CONTRAST))), + mpMtrContrast(new MetricField(this, SVX_RES(MTR_CONTRAST))), + mpFtColorMode(new FixedText(this, SVX_RES(FT_COLOR_MODE))), + mpLBColorMode(new ListBox(this, SVX_RES(LB_COLOR_MODE))), + mpFtTrans(new FixedText(this, SVX_RES(FT_TRANSPARENT))), + mpMtrTrans(new MetricField(this, SVX_RES(MTR_TRANSPARENT))), + mpMtrRed(new MetricField(this, SVX_RES(MF_RED))), + mpMtrGreen(new MetricField(this, SVX_RES(MF_GREEN))), + mpMtrBlue(new MetricField(this, SVX_RES(MF_BLUE))), + mpMtrGamma(new MetricField(this, SVX_RES(MF_GAMMA))), + maBrightControl(SID_ATTR_GRAF_LUMINANCE, *pBindings, *this), + maContrastControl(SID_ATTR_GRAF_CONTRAST, *pBindings, *this), + maTransparenceControl(SID_ATTR_GRAF_TRANSPARENCE, *pBindings, *this), + maRedControl(SID_ATTR_GRAF_RED, *pBindings, *this), + maGreenControl(SID_ATTR_GRAF_GREEN, *pBindings, *this), + maBlueControl(SID_ATTR_GRAF_BLUE, *pBindings, *this), + maGammaControl(SID_ATTR_GRAF_GAMMA, *pBindings, *this), + maModeControl(SID_ATTR_GRAF_MODE, *pBindings, *this), + maImgNormal(SVX_RES(IMG_NORMAL)), + maImgBW(SVX_RES(IMG_BW)), + maImgGray(SVX_RES(IMG_GRAY)), + maImgWater(SVX_RES(IMG_WATER)), + maImgRed(this, SVX_RES(IMG_RED)), + maImgGreen(this, SVX_RES(IMG_GREEN)), + maImgBlue(this, SVX_RES(IMG_BLUE)), + maImgGamma(this, SVX_RES(IMG_GAMMA)), + msNormal(SVX_RES(STR_NORMAL)), + msBW(SVX_RES(STR_BW)), + msGray(SVX_RES(STR_GRAY)), + msWater(SVX_RES(STR_WATER)), + mxFrame(rxFrame), + mpBindings(pBindings) +{ + Initialize(); + FreeResource(); +} + +////////////////////////////////////////////////////////////////////////////// + +GraphicPropertyPanel::~GraphicPropertyPanel() +{ +} + +////////////////////////////////////////////////////////////////////////////// + +void GraphicPropertyPanel::Initialize() +{ + mpFtBrightness->SetBackground(Wallpaper()); + mpFtContrast->SetBackground(Wallpaper()); + mpFtColorMode->SetBackground(Wallpaper()); + mpFtTrans->SetBackground(Wallpaper()); + + mpMtrBrightness->SetModifyHdl( LINK( this, GraphicPropertyPanel, ModifyBrightnessHdl ) ); + mpMtrBrightness->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Brightness"))); //wj acc + mpMtrContrast->SetModifyHdl( LINK( this, GraphicPropertyPanel, ModifyContrastHdl ) ); + mpMtrContrast->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Contrast"))); //wj acc + mpMtrTrans->SetModifyHdl( LINK( this, GraphicPropertyPanel, ModifyTransHdl ) ); + mpMtrTrans->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Transparency"))); //wj acc + + mpLBColorMode->InsertEntry( msNormal, maImgNormal ); + mpLBColorMode->InsertEntry( msGray, maImgGray ); + mpLBColorMode->InsertEntry( msBW, maImgBW ); + mpLBColorMode->InsertEntry( msWater, maImgWater ); + mpLBColorMode->SetSelectHdl( LINK( this, GraphicPropertyPanel, ClickColorModeHdl )); + mpLBColorMode->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Color mode"))); //wj acc + + mpMtrRed->SetModifyHdl( LINK( this, GraphicPropertyPanel, RedHdl ) ); + mpMtrGreen->SetModifyHdl( LINK( this, GraphicPropertyPanel, GreenHdl ) ); + mpMtrBlue->SetModifyHdl( LINK( this, GraphicPropertyPanel, BlueHdl ) ); + mpMtrGamma->SetModifyHdl( LINK( this, GraphicPropertyPanel, GammaHdl ) ); + mpMtrRed->SetAccessibleName(mpMtrRed->GetQuickHelpText()); //wj acc + mpMtrGreen->SetAccessibleName(mpMtrGreen->GetQuickHelpText()); //wj acc + mpMtrBlue->SetAccessibleName(mpMtrBlue->GetQuickHelpText()); //wj acc + mpMtrGamma->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Gamma value"))); //wj acc + + mpMtrRed->SetAccessibleRelationLabeledBy(mpMtrRed.get()); + mpMtrGreen->SetAccessibleRelationLabeledBy(mpMtrGreen.get()); + mpMtrBlue->SetAccessibleRelationLabeledBy(mpMtrBlue.get()); + mpMtrGamma->SetAccessibleRelationLabeledBy(mpMtrGamma.get()); + mpMtrBrightness->SetAccessibleRelationLabeledBy(mpFtBrightness.get()); //7874 + mpMtrContrast->SetAccessibleRelationLabeledBy(mpFtContrast.get()); //7874 + mpMtrTrans->SetAccessibleRelationLabeledBy(mpFtTrans.get()); //7874 + mpLBColorMode->SetAccessibleRelationLabeledBy(mpFtColorMode.get()); //7874 +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK( GraphicPropertyPanel, ModifyBrightnessHdl, void *, EMPTYARG ) +{ + sal_Int16 nBright = mpMtrBrightness->GetValue(); + SfxInt16Item aBrightItem( SID_ATTR_GRAF_LUMINANCE, nBright ); + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_GRAF_LUMINANCE, SFX_CALLMODE_RECORD, &aBrightItem, 0L); + return 0L; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK( GraphicPropertyPanel, ModifyContrastHdl, void *, EMPTYARG ) +{ + sal_Int16 nContrast = mpMtrContrast->GetValue(); + SfxInt16Item aContrastItem( SID_ATTR_GRAF_CONTRAST, nContrast ); + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_GRAF_CONTRAST, SFX_CALLMODE_RECORD, &aContrastItem, 0L); + return 0L; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK( GraphicPropertyPanel, ModifyTransHdl, void *, EMPTYARG ) +{ + sal_Int16 nTrans = mpMtrTrans->GetValue(); + SfxInt16Item aTransItem( SID_ATTR_GRAF_TRANSPARENCE, nTrans ); + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_GRAF_TRANSPARENCE, SFX_CALLMODE_RECORD, &aTransItem, 0L); + return 0L; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK_NOARG( GraphicPropertyPanel, ClickColorModeHdl ) +{ + sal_Int16 nTrans = mpLBColorMode->GetSelectEntryPos(); + SfxInt16Item aTransItem( SID_ATTR_GRAF_MODE, nTrans ); + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_GRAF_MODE, SFX_CALLMODE_RECORD, &aTransItem, 0L); + return 0L; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK( GraphicPropertyPanel, RedHdl, void*, EMPTYARG ) +{ + sal_Int16 nRed = mpMtrRed->GetValue(); + SfxInt16Item aRedItem( SID_ATTR_GRAF_RED, nRed ); + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_GRAF_RED, SFX_CALLMODE_RECORD, &aRedItem, 0L); + return 0L; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK( GraphicPropertyPanel, GreenHdl, void*, EMPTYARG ) +{ + sal_Int16 nGreen = mpMtrGreen->GetValue(); + SfxInt16Item aGreenItem( SID_ATTR_GRAF_GREEN, nGreen ); + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_GRAF_GREEN, SFX_CALLMODE_RECORD, &aGreenItem, 0L); + return 0L; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK(GraphicPropertyPanel, BlueHdl, void *, EMPTYARG) +{ + sal_Int16 nBlue = mpMtrBlue->GetValue(); + SfxInt16Item aBlueItem( SID_ATTR_GRAF_BLUE, nBlue ); + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_GRAF_BLUE, SFX_CALLMODE_RECORD, &aBlueItem, 0L); + return 0L; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK(GraphicPropertyPanel, GammaHdl, void *, EMPTYARG) +{ + sal_Int32 nGamma = mpMtrGamma->GetValue(); + SfxInt32Item nGammaItem( SID_ATTR_GRAF_GAMMA, nGamma ); + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_GRAF_GAMMA, SFX_CALLMODE_RECORD, &nGammaItem, 0L); + return 0L; +} + +////////////////////////////////////////////////////////////////////////////// + +void GraphicPropertyPanel::SetupIcons(void) +{ + if(Theme::GetBoolean(Theme::Bool_UseSymphonyIcons)) + { + // todo + } + else + { + // todo + } +} + +////////////////////////////////////////////////////////////////////////////// + +GraphicPropertyPanel* GraphicPropertyPanel::Create ( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings) +{ + if (pParent == NULL) + throw lang::IllegalArgumentException(A2S("no parent Window given to GraphicPropertyPanel::Create"), NULL, 0); + if ( ! rxFrame.is()) + throw lang::IllegalArgumentException(A2S("no XFrame given to GraphicPropertyPanel::Create"), NULL, 1); + if (pBindings == NULL) + throw lang::IllegalArgumentException(A2S("no SfxBindings given to GraphicPropertyPanel::Create"), NULL, 2); + + return new GraphicPropertyPanel( + pParent, + rxFrame, + pBindings); +} + +////////////////////////////////////////////////////////////////////////////// + +void GraphicPropertyPanel::DataChanged( + const DataChangedEvent& rEvent) +{ + (void)rEvent; + + SetupIcons(); +} + +////////////////////////////////////////////////////////////////////////////// + +void GraphicPropertyPanel::NotifyItemUpdate( + sal_uInt16 nSID, + SfxItemState eState, + const SfxPoolItem* pState) +{ + switch( nSID ) + { + case SID_ATTR_GRAF_LUMINANCE: + if( eState >= SFX_ITEM_AVAILABLE) + { + mpMtrBrightness->Enable(); + const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState); + + if(pItem) + { + sal_Int64 nBright = pItem->GetValue(); + mpMtrBrightness->SetValue(nBright); + } + } + else if( eState == SFX_ITEM_DISABLED ) + mpMtrBrightness->Disable(); + else + { + mpMtrBrightness->Enable(); + mpMtrBrightness->SetText( String()); + } + break; + case SID_ATTR_GRAF_CONTRAST: + if( eState >= SFX_ITEM_AVAILABLE) + { + mpMtrContrast->Enable(); + const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState); + + if(pItem) + { + sal_Int64 nContrast = pItem->GetValue(); + mpMtrContrast->SetValue(nContrast); + } + } + else if( eState == SFX_ITEM_DISABLED ) + mpMtrContrast->Disable(); + else + { + mpMtrContrast->Enable(); + mpMtrContrast->SetText( String()); + } + break; + case SID_ATTR_GRAF_TRANSPARENCE: + if( eState >= SFX_ITEM_AVAILABLE) + { + mpMtrTrans->Enable(); + const SfxUInt16Item* pItem = dynamic_cast< const SfxUInt16Item* >(pState); + + if(pItem) + { + sal_Int64 nTrans = pItem->GetValue(); + mpMtrTrans->SetValue(nTrans); + } + } + else if( eState == SFX_ITEM_DISABLED ) + mpMtrTrans->Disable(); + else + { + mpMtrTrans->Enable(); + mpMtrTrans->SetText( String()); + } + break; + case SID_ATTR_GRAF_MODE: + if( eState >= SFX_ITEM_AVAILABLE) + { + mpLBColorMode->Enable(); + const SfxUInt16Item* pItem = dynamic_cast< const SfxUInt16Item* >(pState); + + if(pItem) + { + sal_Int64 nTrans = pItem->GetValue(); + mpLBColorMode->SelectEntryPos(nTrans); + } + } + else if( eState == SFX_ITEM_DISABLED ) + mpLBColorMode->Disable(); + else + { + mpLBColorMode->Enable(); + mpLBColorMode->SetNoSelection(); + } + break; + case SID_ATTR_GRAF_RED: + if( eState >= SFX_ITEM_AVAILABLE) + { + mpMtrRed->Enable(); + const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState); + + if(pItem) + { + sal_Int64 nRed = pItem->GetValue(); + mpMtrRed->SetValue( nRed ); + } + } + else if( eState == SFX_ITEM_DISABLED ) + mpMtrRed->Disable(); + else + { + mpMtrRed->Enable(); + mpMtrRed->SetText( String()); + } + break; + case SID_ATTR_GRAF_GREEN: + if( eState >= SFX_ITEM_AVAILABLE) + { + mpMtrGreen->Enable(); + const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState); + + if(pItem) + { + sal_Int64 nGreen = pItem->GetValue(); + mpMtrGreen->SetValue( nGreen ); + } + } + else if( eState == SFX_ITEM_DISABLED ) + mpMtrGreen->Disable(); + else + { + mpMtrGreen->Enable(); + mpMtrGreen->SetText( String()); + } + break; + case SID_ATTR_GRAF_BLUE: + if( eState >= SFX_ITEM_AVAILABLE) + { + mpMtrBlue->Enable(); + const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState); + + if(pItem) + { + sal_Int64 nBlue = pItem->GetValue(); + mpMtrBlue->SetValue( nBlue ); + } + } + else if( eState == SFX_ITEM_DISABLED ) + mpMtrBlue->Disable(); + else + { + mpMtrBlue->Enable(); + mpMtrBlue->SetText( String()); + } + break; + case SID_ATTR_GRAF_GAMMA: + if( eState >= SFX_ITEM_AVAILABLE) + { + mpMtrGamma->Enable(); + const SfxUInt32Item* pItem = dynamic_cast< const SfxUInt32Item* >(pState); + + if(pItem) + { + sal_Int64 nGamma = pItem->GetValue(); + mpMtrGamma->SetValue( nGamma ); + } + } + else if( eState == SFX_ITEM_DISABLED ) + mpMtrGamma->Disable(); + else + { + mpMtrGamma->Enable(); + mpMtrGamma->SetText( String()); + } + break; + } +} + +////////////////////////////////////////////////////////////////////////////// + +SfxBindings* GraphicPropertyPanel::GetBindings() +{ + return mpBindings; +} + +////////////////////////////////////////////////////////////////////////////// +// namespace close + +}} // end of namespace ::svx::sidebar + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/svx/source/sidebar/graphic/GraphicPropertyPanel.hrc b/svx/source/sidebar/graphic/GraphicPropertyPanel.hrc new file mode 100644 index 000000000000..0ca1f5cee441 --- /dev/null +++ b/svx/source/sidebar/graphic/GraphicPropertyPanel.hrc @@ -0,0 +1,78 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +// RID_SIDEBAR_GRAPHIC_PANEL-------------------------------------------------------------- +#define FT_BRIGHTNESS 1 +#define MTR_BRIGHTNESS 2 +#define FT_CONTRAST 3 +#define MTR_CONTRAST 4 +#define FT_TRANSPARENT 5 +#define MTR_TRANSPARENT 6 +#define FT_COLOR_MODE 10 +#define LB_COLOR_MODE 11 +#define MBOX_WIDTH 50 + +#define IMG_NORMAL 13 +#define IMG_BW 14 +#define IMG_GRAY 15 +#define IMG_WATER 16 +#define STR_NORMAL 17 +#define STR_BW 18 +#define STR_GRAY 19 +#define STR_WATER 20 +#define MF_RED 21 +#define MF_GREEN 22 +#define MF_BLUE 23 +#define MF_GAMMA 24 +#define IMG_RED 25 +#define IMG_GREEN 26 +#define IMG_BLUE 27 +#define IMG_GAMMA 28 + +//===========================location================================ + +#define FT_BRIGHTNESS_X SECTIONPAGE_MARGIN_HORIZONTAL +#define FT_BRIGHTNESS_Y SECTIONPAGE_MARGIN_VERTICAL_TOP +#define MTR_BRIGHTNESS_X FT_BRIGHTNESS_X +#define MTR_BRIGHTNESS_Y FT_BRIGHTNESS_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL +#define FT_CONTRAST_X FT_BRIGHTNESS_X + MBOX_WIDTH + CONTROL_SPACING_HORIZONTAL +#define FT_CONTRAST_Y FT_BRIGHTNESS_Y +#define MTR_CONTRAST_X FT_CONTRAST_X +#define MTR_CONTRAST_Y MTR_BRIGHTNESS_Y + +#define FT_COLOR_MODE_X FT_BRIGHTNESS_X +#define FT_COLOR_MODE_Y MTR_BRIGHTNESS_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL +#define LBX_COLOR_MODE_X FT_COLOR_MODE_X +#define LBX_COLOR_MODE_Y FT_COLOR_MODE_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + +#define FT_TRANSPARENT_X FT_CONTRAST_X +#define FT_TRANSPARENT_Y MTR_CONTRAST_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL +#define MTR_TRANS_X FT_TRANSPARENT_X +#define MTR_TRANS_Y FT_TRANSPARENT_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + +#define MF_RED_X SECTIONPAGE_MARGIN_HORIZONTAL +#define MF_RED_Y MTR_TRANS_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL +#define MF_GREEN_X MF_RED_X + MBOX_WIDTH + CONTROL_SPACING_HORIZONTAL +#define MF_GREEN_Y MF_RED_Y +#define MF_BLUE_X MF_RED_X +#define MF_BLUE_Y MF_RED_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL +#define MF_GAMMA_X MF_GREEN_X +#define MF_GAMMA_Y MF_BLUE_Y + +#define PAGE_HEIGHT MF_GAMMA_Y + MBOX_HEIGHT + SECTIONPAGE_MARGIN_VERTICAL_BOT + +// eof diff --git a/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx b/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx new file mode 100644 index 000000000000..c5bd01cd9bf4 --- /dev/null +++ b/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx @@ -0,0 +1,123 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SVX_PROPERTYPANEL_GRAPHICPAGE_HXX +#define SVX_PROPERTYPANEL_GRAPHICPAGE_HXX + +#include <vcl/ctrl.hxx> +#include <sfx2/sidebar/SidebarPanelBase.hxx> +#include <sfx2/sidebar/ControllerItem.hxx> +#include <vcl/fixed.hxx> +#include <boost/scoped_ptr.hpp> + +class FixedText; +class MetricField; +class ListBox; +class FloatingWindow; + + +namespace svx { namespace sidebar { + +class GraphicPropertyPanel +: public Control, + public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface +{ +public: + static GraphicPropertyPanel* Create( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings); + + virtual void DataChanged( + const DataChangedEvent& rEvent); + + virtual void NotifyItemUpdate( + const sal_uInt16 nSId, + const SfxItemState eState, + const SfxPoolItem* pState); + + SfxBindings* GetBindings(); + +private: + //ui controls + ::boost::scoped_ptr< FixedText > mpFtBrightness; + ::boost::scoped_ptr< MetricField > mpMtrBrightness; + ::boost::scoped_ptr< FixedText > mpFtContrast; + ::boost::scoped_ptr< MetricField > mpMtrContrast; + ::boost::scoped_ptr< FixedText > mpFtColorMode; + ::boost::scoped_ptr< ListBox > mpLBColorMode; + ::boost::scoped_ptr< FixedText > mpFtTrans; + ::boost::scoped_ptr< MetricField > mpMtrTrans; + ::boost::scoped_ptr< MetricField > mpMtrRed; + ::boost::scoped_ptr< MetricField > mpMtrGreen; + ::boost::scoped_ptr< MetricField > mpMtrBlue; + ::boost::scoped_ptr< MetricField > mpMtrGamma; + + ::sfx2::sidebar::ControllerItem maBrightControl; + ::sfx2::sidebar::ControllerItem maContrastControl; + ::sfx2::sidebar::ControllerItem maTransparenceControl; + ::sfx2::sidebar::ControllerItem maRedControl; + ::sfx2::sidebar::ControllerItem maGreenControl; + ::sfx2::sidebar::ControllerItem maBlueControl; + ::sfx2::sidebar::ControllerItem maGammaControl; + ::sfx2::sidebar::ControllerItem maModeControl; + + Image maImgNormal; + Image maImgBW; + Image maImgGray; + Image maImgWater; + + FixedImage maImgRed; + FixedImage maImgGreen; + FixedImage maImgBlue; + FixedImage maImgGamma; + + String msNormal; + String msBW; + String msGray; + String msWater; + + cssu::Reference<css::frame::XFrame> mxFrame; + SfxBindings* mpBindings; + + DECL_LINK( ModifyBrightnessHdl, void * ); + DECL_LINK( ModifyContrastHdl, void * ); + DECL_LINK( ModifyTransHdl, void * ); + DECL_LINK( ClickColorModeHdl, void * ); + DECL_LINK( ImplPopupModeEndHdl, FloatingWindow* ); + DECL_LINK( RedHdl, void*); + DECL_LINK( GreenHdl, void*); + DECL_LINK( BlueHdl, void*); + DECL_LINK( GammaHdl, void*); + + // constructor/destuctor + GraphicPropertyPanel( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings); + virtual ~GraphicPropertyPanel(); + + void SetupIcons(void); + void Initialize(); +}; + + +} } // end of namespace ::svx::sidebar + +#endif + +// eof diff --git a/svx/source/sidebar/graphic/GraphicPropertyPanel.src b/svx/source/sidebar/graphic/GraphicPropertyPanel.src new file mode 100644 index 000000000000..4946b61a656c --- /dev/null +++ b/svx/source/sidebar/graphic/GraphicPropertyPanel.src @@ -0,0 +1,253 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "GraphicPropertyPanel.hrc" +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include <svx/dialogs.hrc> +#include "helpid.hrc" + +Control RID_SIDEBAR_GRAPHIC_PANEL +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + + Size = MAP_APPFONT( PROPERTYPAGE_WIDTH, PAGE_HEIGHT ); + HelpID = HID_PROPERTYPANEL_GRAPHIC_SECTION ; + Text = "Graphic"; + + FixedText FT_BRIGHTNESS + { + Pos = MAP_APPFONT ( FT_BRIGHTNESS_X, FT_BRIGHTNESS_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH , TEXT_HEIGHT ) ; + Text [ en-US ] = "~Brightness:"; + }; + MetricField MTR_BRIGHTNESS + { + Border = TRUE ; + Pos = MAP_APPFONT ( MTR_BRIGHTNESS_X, MTR_BRIGHTNESS_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH , MBOX_HEIGHT ) ; + HelpID = HID_PROPERTY_PANEL_GRAPHIC_MTR_BRIGHT; + QuickHelpText [ en-US ] = "Specify the luminance of the graphic."; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + Minimum = -100 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + SpinSize = 1 ; + }; + FixedText FT_CONTRAST + { + Pos = MAP_APPFONT ( FT_CONTRAST_X, FT_CONTRAST_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH, TEXT_HEIGHT ) ; + Text [ en-US ] = "~Contrast:"; + }; + MetricField MTR_CONTRAST + { + Border = TRUE ; + Pos = MAP_APPFONT ( MTR_CONTRAST_X, MTR_CONTRAST_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH , MBOX_HEIGHT ) ; + HelpID = HID_PROPERTY_PANEL_GRAPHIC_MTR_CONTRAST; + QuickHelpText [ en-US ] = "Specify the degree of difference between the lightest and darkest parts of the graphic."; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + Minimum = -100 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + SpinSize = 1 ; + }; + FixedText FT_COLOR_MODE + { + Pos = MAP_APPFONT ( FT_COLOR_MODE_X, FT_COLOR_MODE_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH, TEXT_HEIGHT ) ; + Text [ en-US ] = "Color ~mode:"; + }; + ListBox LB_COLOR_MODE + { + Border = TRUE ; + Pos = MAP_APPFONT ( LBX_COLOR_MODE_X , LBX_COLOR_MODE_Y ) ; + Size = MAP_APPFONT ( MBOX_WIDTH , 100 ) ; + HelpID = HID_PROPERTY_PANEL_GRAPHIC_LB_COLORMODE; + QuickHelpText [ en-US ] = "Select the color mode of the graphic."; + TabStop = TRUE ; + DropDown = TRUE ; + }; + FixedText FT_TRANSPARENT + { + Pos = MAP_APPFONT ( FT_TRANSPARENT_X, FT_TRANSPARENT_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH , TEXT_HEIGHT ) ; + Text [ en-US ] = "~Transparency:"; + }; + MetricField MTR_TRANSPARENT + { + Border = TRUE ; + Pos = MAP_APPFONT ( MTR_TRANS_X, MTR_TRANS_Y ) ; + Size = MAP_APPFONT ( MBOX_WIDTH ,MBOX_HEIGHT ) ; + HelpID = HID_PROPERTY_PANEL_GRAPHIC_MTR_TRANSP; + QuickHelpText [ en-US ] = "Specify the percentage of transparency; 0% is fully opaque and 100% is fully transparent."; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + SpinSize = 1 ; + }; + MetricField MF_RED + { + Border = TRUE ; + Pos = MAP_APPFONT ( MF_RED_X + 10, MF_RED_Y ) ; + Size = MAP_APPFONT ( MBOX_WIDTH - 10,MBOX_HEIGHT ) ; + HelpID = HID_PROPERTY_PANEL_GRAPHIC_MTR_RED; + QuickHelpText [ en-US ] = "Red"; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + Minimum = -100 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + SpinSize = 1 ; + }; + MetricField MF_GREEN + { + Border = TRUE ; + Pos = MAP_APPFONT ( MF_GREEN_X + 10, MF_GREEN_Y ) ; + Size = MAP_APPFONT ( MBOX_WIDTH - 10 ,MBOX_HEIGHT ) ; + HelpID = HID_PROPERTY_PANEL_GRAPHIC_MTR_GREEN; + QuickHelpText [ en-US ] = "Green"; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + Minimum = -100 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + SpinSize = 1 ; + }; + MetricField MF_BLUE + { + Border = TRUE ; + Pos = MAP_APPFONT ( MF_BLUE_X + 10, MF_BLUE_Y ) ; + Size = MAP_APPFONT ( MBOX_WIDTH - 10 ,MBOX_HEIGHT ) ; + HelpID = HID_PROPERTY_PANEL_GRAPHIC_MTR_BLUE; + QuickHelpText [ en-US ] = "Blue"; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + Minimum = -100 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + SpinSize = 1 ; + }; + MetricField MF_GAMMA + { + Border = TRUE ; + Pos = MAP_APPFONT ( MF_GAMMA_X + 10, MF_GAMMA_Y ) ; + Size = MAP_APPFONT ( MBOX_WIDTH - 10 ,MBOX_HEIGHT ) ; + HelpID = HID_PROPERTY_PANEL_GRAPHIC_MTR_GAMMA; + QuickHelpText [ en-US ] = "Specify the gamma value that affects the brightness of the midtone values."; + TabStop = TRUE; + Repeat = TRUE; + Spin = TRUE; + Minimum = 10; + Maximum = 1000; + DecimalDigits = 2; + SpinSize = 10; + }; + Image IMG_NORMAL + { + ImageBitmap = Bitmap{File = "symphony/ColorModeNormal_16x16.png";}; + }; + Image IMG_BW + { + ImageBitmap = Bitmap{File = "symphony/ColorModeBlackWhite_16x16.png";}; + }; + Image IMG_GRAY + { + ImageBitmap = Bitmap{File = "symphony/ColorModeGrey_16x16.png";}; + }; + Image IMG_WATER + { + ImageBitmap = Bitmap{File = "symphony/ColorModeWaterMark_16x16.png";}; + }; + FixedImage IMG_RED + { + Pos = MAP_APPFONT( MF_RED_X, MF_RED_Y ); + Size = MAP_APPFONT( 10, 12 ); + Fixed = Image + { + ImageBitmap = Bitmap { File = "symphony/AdjustColorRed_16x16.png"; }; + }; + }; + FixedImage IMG_GREEN + { + Pos = MAP_APPFONT( MF_GREEN_X, MF_GREEN_Y ); + Size = MAP_APPFONT( 10, 12 ); + Fixed = Image + { + ImageBitmap = Bitmap { File = "symphony/AdjustColorGreen_16x16.png"; }; + }; + }; + FixedImage IMG_BLUE + { + Pos = MAP_APPFONT( MF_BLUE_X, MF_BLUE_Y ); + Size = MAP_APPFONT( 10, 12 ); + Fixed = Image + { + ImageBitmap = Bitmap { File = "symphony/AdjustColorBlue_16x16.png"; }; + }; + }; + FixedImage IMG_GAMMA + { + Pos = MAP_APPFONT( MF_GAMMA_X, MF_GAMMA_Y ); + Size = MAP_APPFONT( 10, 12 ); + Fixed = Image + { + ImageBitmap = Bitmap { File = "symphony/AdjustColorGamma_16x16.png"; }; + }; + }; + String STR_NORMAL + { + Text [ en-US ] = "Normal"; + }; + String STR_BW + { + Text [ en-US ] = "Black/White"; + }; + String STR_GRAY + { + Text [ en-US ] = "Grayscale"; + }; + String STR_WATER + { + Text [ en-US ] = "Watermark"; + }; +}; + +// eof diff --git a/svx/source/sidebar/line/LinePropertyPanel.cxx b/svx/source/sidebar/line/LinePropertyPanel.cxx new file mode 100644 index 000000000000..74fdb7afbd83 --- /dev/null +++ b/svx/source/sidebar/line/LinePropertyPanel.cxx @@ -0,0 +1,1143 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include <sfx2/sidebar/Theme.hxx> +#include <sfx2/sidebar/ControlFactory.hxx> +#include <LinePropertyPanel.hxx> +#include <LinePropertyPanel.hrc> +#include <svx/dialogs.hrc> +#include <svx/dialmgr.hxx> +#include <sfx2/objsh.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <svx/xlnclit.hxx> +#include <svx/xtable.hxx> +#include <svx/xdash.hxx> +#include <svx/drawitem.hxx> +#include <svx/svxitems.hrc> +#include <svtools/valueset.hxx> +#include <unotools/pathoptions.hxx> +#include <unotools/viewoptions.hxx> +#include <comphelper/processfactory.hxx> +#include <i18nlangtag/mslangid.hxx> +#include <svx/xlineit0.hxx> +#include <svx/xlndsit.hxx> +#include <vcl/svapp.hxx> +#include <svx/xlnwtit.hxx> +#include <vcl/lstbox.hxx> +#include <svx/tbxcolorupdate.hxx> +#include <vcl/toolbox.hxx> +#include <svx/xlntrit.hxx> +#include <svx/xlnstit.hxx> +#include <svx/xlnedit.hxx> +#include <svx/xlncapit.hxx> +#include <svx/xlinjoit.hxx> +#include "svx/sidebar/PopupContainer.hxx" +#include "svx/sidebar/PopupControl.hxx" +#include <svx/sidebar/ColorControl.hxx> +#include "LineWidthControl.hxx" +#include <boost/bind.hpp> + +using namespace css; +using namespace cssu; +using ::sfx2::sidebar::Theme; + +#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) + +namespace { + short GetItemId_Impl_line( ValueSet& rValueSet, const Color& rCol ) + { + if(rCol == COL_AUTO) + return 0; + + bool bFound = false; + sal_uInt16 nCount = rValueSet.GetItemCount(); + sal_uInt16 n = 1; + + while ( !bFound && n <= nCount ) + { + Color aValCol = rValueSet.GetItemColor(n); + + bFound = ( aValCol.GetRed() == rCol.GetRed() + && aValCol.GetGreen() == rCol.GetGreen() + && aValCol.GetBlue() == rCol.GetBlue() ); + + if ( !bFound ) + n++; + } + return bFound ? n : -1; + } + + Color GetTransparentColor (void) + { + return COL_TRANSPARENT; + } + + void FillLineEndListBox(ListBox& rListBoxStart, ListBox& rListBoxEnd, const XLineEndList& rList) + { + const sal_uInt32 nCount(rList.Count()); + const String sNone(SVX_RES(RID_SVXSTR_NONE)); + + rListBoxStart.SetUpdateMode(false); + rListBoxEnd.SetUpdateMode(false); + + rListBoxStart.Clear(); + rListBoxEnd.Clear(); + + // add 'none' entries + rListBoxStart.InsertEntry(sNone); + rListBoxEnd.InsertEntry(sNone); + + for(sal_uInt32 i(0); i < nCount; i++) + { + XLineEndEntry* pEntry = rList.GetLineEnd(i); + const Bitmap aBitmap = const_cast< XLineEndList& >(rList).GetUiBitmap(i); + + if(!aBitmap.IsEmpty()) + { + Bitmap aCopyStart(aBitmap); + Bitmap aCopyEnd(aBitmap); + // delete pBitmap; + const Size aBmpSize(aCopyStart.GetSizePixel()); + const Rectangle aCropRectStart(Point(), Size(aBmpSize.Width() / 2, aBmpSize.Height())); + const Rectangle aCropRectEnd(Point(aBmpSize.Width() / 2, 0), Size(aBmpSize.Width() / 2, aBmpSize.Height())); + + aCopyStart.Crop(aCropRectStart); + rListBoxStart.InsertEntry( + pEntry->GetName(), + aCopyStart); + + aCopyEnd.Crop(aCropRectEnd); + rListBoxEnd.InsertEntry( + pEntry->GetName(), + aCopyEnd); + } + else + { + rListBoxStart.InsertEntry(pEntry->GetName()); + rListBoxEnd.InsertEntry(pEntry->GetName()); + } + } + + rListBoxStart.SetUpdateMode(true); + rListBoxEnd.SetUpdateMode(true); + } + + void FillLineStyleListBox(ListBox& rListBox, const XDashList& rList) + { + const sal_uInt32 nCount(rList.Count()); + rListBox.SetUpdateMode(false); + + rListBox.Clear(); + + // entry for 'none' + rListBox.InsertEntry(rList.GetStringForUiNoLine()); + + // entry for solid line + rListBox.InsertEntry(rList.GetStringForUiSolidLine(), rList.GetBitmapForUISolidLine()); + + for(sal_uInt32 i(0); i < nCount; i++) + { + XDashEntry* pEntry = rList.GetDash(i); + const Bitmap aBitmap = const_cast< XDashList& >(rList).GetUiBitmap(i); + + if(!aBitmap.IsEmpty()) + { + rListBox.InsertEntry( + pEntry->GetName(), + aBitmap); + // delete pBitmap; + } + else + { + rListBox.InsertEntry(pEntry->GetName()); + } + } + + rListBox.SetUpdateMode(true); + } +} // end of anonymous namespace + +// namespace open + +namespace svx { namespace sidebar { + +LinePropertyPanel::LinePropertyPanel( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings) +: Control( + pParent, + SVX_RES(RID_SIDEBAR_LINE_PANEL)), + mpFTWidth(new FixedText(this, SVX_RES(FT_WIDTH))), + mpTBWidthBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), + mpTBWidth(sfx2::sidebar::ControlFactory::CreateToolBox(mpTBWidthBackground.get(), SVX_RES(TB_WIDTH))), + mpFTColor(new FixedText(this, SVX_RES(FT_COLOR))), + mpTBColorBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), + mpTBColor(sfx2::sidebar::ControlFactory::CreateToolBox(mpTBColorBackground.get(), SVX_RES(TB_COLOR))), + mpFTStyle(new FixedText(this, SVX_RES(FT_STYLE))), + mpLBStyle(new ListBox(this, SVX_RES(LB_STYLE))), + mpFTTrancparency(new FixedText(this, SVX_RES(FT_TRANSPARENT))), + mpMFTransparent(new MetricField(this, SVX_RES(MF_TRANSPARENT))), + mpFTArrow(new FixedText(this, SVX_RES(FT_ARROW))), + mpLBStart(new ListBox(this, SVX_RES(LB_START))), + mpLBEnd(new ListBox(this, SVX_RES(LB_END))), + mpFTEdgeStyle(new FixedText(this, SVX_RES(FT_EDGESTYLE))), + mpLBEdgeStyle(new ListBox(this, SVX_RES(LB_EDGESTYLE))), + mpFTCapStyle(new FixedText(this, SVX_RES(FT_CAPSTYLE))), + mpLBCapStyle(new ListBox(this, SVX_RES(LB_CAPSTYLE))), + maStyleControl(SID_ATTR_LINE_STYLE, *pBindings, *this), + maDashControl (SID_ATTR_LINE_DASH, *pBindings, *this), + maWidthControl(SID_ATTR_LINE_WIDTH, *pBindings, *this), + maColorControl(SID_ATTR_LINE_COLOR, *pBindings, *this), + maStartControl(SID_ATTR_LINE_START, *pBindings, *this), + maEndControl(SID_ATTR_LINE_END, *pBindings, *this), + maLineEndListControl(SID_LINEEND_LIST, *pBindings, *this), + maLineStyleListControl(SID_DASH_LIST, *pBindings, *this), + maTransControl(SID_ATTR_LINE_TRANSPARENCE, *pBindings, *this), + maEdgeStyle(SID_ATTR_LINE_JOINT, *pBindings, *this), + maCapStyle(SID_ATTR_LINE_CAP, *pBindings, *this), + maColor(COL_BLACK), + mpColorUpdater(new ::svx::ToolboxButtonColorUpdater(SID_ATTR_LINE_COLOR, TBI_COLOR, mpTBColor.get(), TBX_UPDATER_MODE_CHAR_COLOR_NEW)), + mpStyleItem(), + mpDashItem(), + mnTrans(0), + meMapUnit(SFX_MAPUNIT_MM), + mnWidthCoreValue(0), + mpStartItem(0), + mpEndItem(0), + maColorPopup(this, ::boost::bind(&LinePropertyPanel::CreateColorPopupControl, this, _1)), + maLineWidthPopup(this, ::boost::bind(&LinePropertyPanel::CreateLineWidthPopupControl, this, _1)), + maIMGColor(SVX_RES(IMG_COLOR)), + maIMGNone(SVX_RES(IMG_NONE_ICON)), + mpIMGWidthIcon(), + mxFrame(rxFrame), + mpBindings(pBindings), + mbColorAvailable(true), + mbStyleAvailable(false), + mbDashAvailable(false), + mbTransAvailable(true), + mbWidthValuable(true), + mbStartAvailable(true), + mbEndAvailable(true) +{ + Initialize(); + FreeResource(); +} + + + +LinePropertyPanel::~LinePropertyPanel() +{ + // Destroy the toolboxes, then their background windows. + mpTBWidth.reset(); + mpTBColor.reset(); + + mpTBWidthBackground.reset(); + mpTBColorBackground.reset(); +} + + + +void LinePropertyPanel::Initialize() +{ + mpFTWidth->SetBackground(Wallpaper()); + mpFTColor->SetBackground(Wallpaper()); + mpFTStyle->SetBackground(Wallpaper()); + mpFTTrancparency->SetBackground(Wallpaper()); + mpFTArrow->SetBackground(Wallpaper()); + mpFTEdgeStyle->SetBackground(Wallpaper()); + mpFTCapStyle->SetBackground(Wallpaper()); + + mpIMGWidthIcon.reset(new Image[8]); + mpIMGWidthIcon[0] = Image(SVX_RES(IMG_WIDTH1_ICON)); + mpIMGWidthIcon[1] = Image(SVX_RES(IMG_WIDTH2_ICON)); + mpIMGWidthIcon[2] = Image(SVX_RES(IMG_WIDTH3_ICON)); + mpIMGWidthIcon[3] = Image(SVX_RES(IMG_WIDTH4_ICON)); + mpIMGWidthIcon[4] = Image(SVX_RES(IMG_WIDTH5_ICON)); + mpIMGWidthIcon[5] = Image(SVX_RES(IMG_WIDTH6_ICON)); + mpIMGWidthIcon[6] = Image(SVX_RES(IMG_WIDTH7_ICON)); + mpIMGWidthIcon[7] = Image(SVX_RES(IMG_WIDTH8_ICON)); + + meMapUnit = maWidthControl.GetCoreMetric(); + + mpTBColor->SetItemImage(TBI_COLOR, maIMGColor); + Size aTbxSize( mpTBColor->CalcWindowSizePixel() ); + mpTBColor->SetOutputSizePixel( aTbxSize ); + mpTBColor->SetItemBits( TBI_COLOR, mpTBColor->GetItemBits( TBI_COLOR ) | TIB_DROPDOWNONLY ); + mpTBColor->SetQuickHelpText(TBI_COLOR,String(SVX_RES(STR_QH_TB_COLOR))); //Add + mpTBColor->SetBackground(Wallpaper()); + mpTBColor->SetPaintTransparent(true); + Link aLink = LINK(this, LinePropertyPanel, ToolboxColorSelectHdl); + mpTBColor->SetDropdownClickHdl ( aLink ); + mpTBColor->SetSelectHdl ( aLink ); + + FillLineStyleList(); + SelectLineStyle(); + aLink = LINK( this, LinePropertyPanel, ChangeLineStyleHdl ); + mpLBStyle->SetSelectHdl( aLink ); + mpLBStyle->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Style"))); + mpLBStyle->SetDropDownLineCount(std::min(sal_uInt16(20), mpLBStyle->GetEntryCount())); + + mpTBWidth->SetItemImage(TBI_WIDTH, mpIMGWidthIcon[0]); + aTbxSize = mpTBWidth->CalcWindowSizePixel() ; + mpTBWidth->SetOutputSizePixel( aTbxSize ); + mpTBWidth->SetItemBits( TBI_WIDTH, mpTBWidth->GetItemBits( TBI_WIDTH ) | TIB_DROPDOWNONLY ); + mpTBWidth->SetQuickHelpText(TBI_WIDTH,String(SVX_RES(STR_QH_TB_WIDTH))); //Add + mpTBWidth->SetBackground(Wallpaper()); + mpTBWidth->SetPaintTransparent(true); + aLink = LINK(this, LinePropertyPanel, ToolboxWidthSelectHdl); + mpTBWidth->SetDropdownClickHdl ( aLink ); + mpTBWidth->SetSelectHdl ( aLink ); + + FillLineEndList(); + SelectEndStyle(true); + SelectEndStyle(false); + aLink = LINK( this, LinePropertyPanel, ChangeStartHdl ); + mpLBStart->SetSelectHdl( aLink ); + mpLBStart->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Beginning Style"))); //wj acc + mpLBStart->SetDropDownLineCount(std::min(sal_uInt16(20), mpLBStart->GetEntryCount())); + aLink = LINK( this, LinePropertyPanel, ChangeEndHdl ); + mpLBEnd->SetSelectHdl( aLink ); + mpLBEnd->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Ending Style"))); //wj acc + mpLBEnd->SetDropDownLineCount(std::min(sal_uInt16(20), mpLBEnd->GetEntryCount())); + + aLink = LINK(this, LinePropertyPanel, ChangeTransparentHdl); + mpMFTransparent->SetModifyHdl(aLink); + mpMFTransparent->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Transparency"))); //wj acc + + mpTBWidth->SetAccessibleRelationLabeledBy(mpFTWidth.get()); + mpTBColor->SetAccessibleRelationLabeledBy(mpFTColor.get()); + mpLBStyle->SetAccessibleRelationLabeledBy(mpFTStyle.get()); + mpMFTransparent->SetAccessibleRelationLabeledBy(mpFTTrancparency.get()); + mpLBStart->SetAccessibleRelationLabeledBy(mpFTArrow.get()); + mpLBEnd->SetAccessibleRelationLabeledBy(mpLBEnd.get()); + + aLink = LINK( this, LinePropertyPanel, ChangeEdgeStyleHdl ); + mpLBEdgeStyle->SetSelectHdl( aLink ); + mpLBEdgeStyle->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Corner Style"))); + + aLink = LINK( this, LinePropertyPanel, ChangeCapStyleHdl ); + mpLBCapStyle->SetSelectHdl( aLink ); + mpLBCapStyle->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Cap Style"))); +} + + + +void LinePropertyPanel::SetupIcons(void) +{ + if(Theme::GetBoolean(Theme::Bool_UseSymphonyIcons)) + { + // todo + } + else + { + // todo + } +} + + + +LinePropertyPanel* LinePropertyPanel::Create ( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings) +{ + if (pParent == NULL) + throw lang::IllegalArgumentException(A2S("no parent Window given to LinePropertyPanel::Create"), NULL, 0); + if ( ! rxFrame.is()) + throw lang::IllegalArgumentException(A2S("no XFrame given to LinePropertyPanel::Create"), NULL, 1); + if (pBindings == NULL) + throw lang::IllegalArgumentException(A2S("no SfxBindings given to LinePropertyPanel::Create"), NULL, 2); + + return new LinePropertyPanel( + pParent, + rxFrame, + pBindings); +} + + + + +void LinePropertyPanel::DataChanged( + const DataChangedEvent& rEvent) +{ + (void)rEvent; + + SetupIcons(); +} + + + + +void LinePropertyPanel::NotifyItemUpdate( + sal_uInt16 nSID, + SfxItemState eState, + const SfxPoolItem* pState) +{ + switch(nSID) + { + case SID_ATTR_LINE_COLOR: + { + if( eState == SFX_ITEM_DISABLED) + { + mpFTColor->Disable(); + mpTBColor->Disable(); + mbColorAvailable = false; + mpColorUpdater->Update(COL_WHITE); + } + else + { + mpFTColor->Enable(); + mpTBColor->Enable(); + const XLineColorItem* pItem = dynamic_cast< const XLineColorItem* >(pState); + + if(eState >= SFX_ITEM_DEFAULT && pItem) + { + maColor = pItem->GetColorValue(); + mbColorAvailable = true; + mpColorUpdater->Update(maColor); + } + else + { + mbColorAvailable = false; + mpColorUpdater->Update(COL_WHITE); + } + } + break; + } + case SID_ATTR_LINE_DASH: + case SID_ATTR_LINE_STYLE: + { + if( eState == SFX_ITEM_DISABLED) + { + mpFTStyle->Disable(); + mpLBStyle->Disable(); + } + else + { + mpFTStyle->Enable(); + mpLBStyle->Enable(); + if( eState >= SFX_ITEM_DEFAULT ) + { + if(nSID == SID_ATTR_LINE_STYLE) + { + const XLineStyleItem* pItem = dynamic_cast< const XLineStyleItem* >(pState); + + if(pItem) + { + mbStyleAvailable =true; + mpStyleItem.reset(pState ? (XLineStyleItem*)pItem->Clone() : 0); + } + } + else if(nSID == SID_ATTR_LINE_DASH) + { + const XLineDashItem* pItem = dynamic_cast< const XLineDashItem* >(pState); + + if(pItem) + { + mbDashAvailable = true; + mpDashItem.reset(pState ? (XLineDashItem*)pItem->Clone() : 0); + } + } + } + else + { + if(nSID == SID_ATTR_LINE_STYLE) + mbStyleAvailable = false; + else + mbDashAvailable = false; + } + + SelectLineStyle(); + } + break; + } + case SID_ATTR_LINE_TRANSPARENCE: + { + if( eState == SFX_ITEM_DISABLED ) + { + mpFTTrancparency->Disable(); + mpMFTransparent->Disable(); + mpMFTransparent->SetValue(0);//add + mpMFTransparent->SetText(String()); + mbTransAvailable = false; + } + else + { + mpFTTrancparency->Enable(); + mpMFTransparent->Enable(); + mbTransAvailable = true; + const XLineTransparenceItem* pItem = dynamic_cast< const XLineTransparenceItem* >(pState); + + if(eState != SFX_ITEM_DONTCARE && pItem) + { + mnTrans = pItem->GetValue(); + mpMFTransparent->SetValue(mnTrans); + } + else + { + mpMFTransparent->SetValue(0);//add + mpMFTransparent->SetText(String()); + } + } + break; + } + case SID_ATTR_LINE_WIDTH: + { + if(eState == SFX_ITEM_DISABLED) + { + mpTBWidth->Disable(); + mpFTWidth->Disable(); + } + else + { + //enable + mpTBWidth->Enable(); + mpFTWidth->Enable(); + const XLineWidthItem* pItem = dynamic_cast< const XLineWidthItem* >(pState); + + if(eState >= SFX_ITEM_AVAILABLE && pItem) + { + mnWidthCoreValue = pItem->GetValue(); + mbWidthValuable = true; + } + else + { + mbWidthValuable = false; + } + } + SetWidthIcon(); + break; + } + case SID_ATTR_LINE_START: + { + mpFTArrow->Enable(); + mpLBStart->Enable(); + + if(eState != SFX_ITEM_DONTCARE) + { + const XLineStartItem* pItem = dynamic_cast< const XLineStartItem* >(pState); + + if(pItem) + { + mbStartAvailable = true; //add + mpStartItem.reset(pItem ? (XLineStartItem*)pItem->Clone() : 0); + SelectEndStyle(true); + break; + } + } + + mpLBStart->SetNoSelection(); + mbStartAvailable = false; //add + break; + } + case SID_ATTR_LINE_END: + { + mpFTArrow->Enable(); + mpLBEnd->Enable(); + + if(eState != SFX_ITEM_DONTCARE) + { + const XLineEndItem* pItem = dynamic_cast< const XLineEndItem* >(pState); + + if(pItem) + { + mbEndAvailable = true; //add + mpEndItem.reset(pItem ? (XLineEndItem*)pItem->Clone() : 0); + SelectEndStyle(false); + break; + } + } + + mpLBEnd->SetNoSelection(); + mbEndAvailable = false; //add + break; + } + case SID_LINEEND_LIST: + { + FillLineEndList(); + SelectEndStyle(true); + SelectEndStyle(false); + break; + } + case SID_DASH_LIST: + { + FillLineStyleList(); + SelectLineStyle(); + break; + } + case SID_ATTR_LINE_JOINT: + { + if(eState == SFX_ITEM_DISABLED) + { + mpLBEdgeStyle->Disable(); + } + else + { + mpLBEdgeStyle->Enable(); + const XLineJointItem* pItem = dynamic_cast< const XLineJointItem* >(pState); + sal_uInt16 nEntryPos(0); + + if(eState >= SFX_ITEM_AVAILABLE && pItem) + { + switch(pItem->GetValue()) + { + case com::sun::star::drawing::LineJoint_MIDDLE: + case com::sun::star::drawing::LineJoint_ROUND: + { + nEntryPos = 1; + break; + } + case com::sun::star::drawing::LineJoint_NONE: + { + nEntryPos = 2; + break; + } + case com::sun::star::drawing::LineJoint_MITER: + { + nEntryPos = 3; + break; + } + case com::sun::star::drawing::LineJoint_BEVEL: + { + nEntryPos = 4; + break; + } + + default: + break; + } + } + + if(nEntryPos) + { + mpLBEdgeStyle->SelectEntryPos(nEntryPos - 1); + } + else + { + mpLBEdgeStyle->SetNoSelection(); + } + } + break; + } + case SID_ATTR_LINE_CAP: + { + if(eState == SFX_ITEM_DISABLED) + { + mpLBCapStyle->Disable(); + } + else + { + mpLBCapStyle->Enable(); + const XLineCapItem* pItem = dynamic_cast< const XLineCapItem* >(pState); + sal_uInt16 nEntryPos(0); + + if(eState >= SFX_ITEM_AVAILABLE && pItem) + { + switch(pItem->GetValue()) + { + case com::sun::star::drawing::LineCap_BUTT: + { + nEntryPos = 1; + break; + } + case com::sun::star::drawing::LineCap_ROUND: + { + nEntryPos = 2; + break; + } + case com::sun::star::drawing::LineCap_SQUARE: + { + nEntryPos = 3; + break; + } + + default: + break; + } + } + + if(nEntryPos) + { + mpLBCapStyle->SelectEntryPos(nEntryPos - 1); + } + else + { + mpLBCapStyle->SetNoSelection(); + } + } + break; + } + } +} + + + +SfxBindings* LinePropertyPanel::GetBindings() +{ + return mpBindings; +} + + + +IMPL_LINK( LinePropertyPanel, ImplPopupModeEndHdl, FloatingWindow*, EMPTYARG ) +{ + return 0; +} + + + + +IMPL_LINK(LinePropertyPanel, ToolboxColorSelectHdl,ToolBox*, pToolBox) +{ + sal_uInt16 nId = pToolBox->GetCurItemId(); + if(nId == TBI_COLOR) + { + maColorPopup.Show(*pToolBox); + maColorPopup.SetCurrentColor(maColor, mbColorAvailable); + } + return 0; +} + + + + +IMPL_LINK_NOARG(LinePropertyPanel, ChangeLineStyleHdl) +{ + const sal_uInt16 nPos(mpLBStyle->GetSelectEntryPos()); + + if(LISTBOX_ENTRY_NOTFOUND != nPos && nPos != mpLBStyle->GetSavedValue()) + { + if(0 == nPos) + { + // XLINE_NONE + const XLineStyleItem aItem(XLINE_NONE); + + GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_STYLE, SFX_CALLMODE_RECORD, &aItem, 0L); + } + else if(1 == nPos) + { + // XLINE_SOLID + const XLineStyleItem aItem(XLINE_SOLID); + + GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_STYLE, SFX_CALLMODE_RECORD, &aItem, 0L); + } + else if (mxLineStyleList.is() && mxLineStyleList->Count() > (long)(nPos - 2)) + { + // XLINE_DASH + const XLineStyleItem aItemA(XLINE_DASH); + const XLineDashItem aItemB(mpLBStyle->GetSelectEntry(), mxLineStyleList->GetDash(nPos - 2)->GetDash()); + + GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_STYLE, SFX_CALLMODE_RECORD, &aItemA, 0L); + GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_DASH, SFX_CALLMODE_RECORD, &aItemB, 0L); + } + } + + return 0; +} + + + +IMPL_LINK(LinePropertyPanel, ChangeStartHdl, void*, EMPTYARG) +{ + sal_uInt16 nPos = mpLBStart->GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND && nPos != mpLBStart->GetSavedValue() ) + { + XLineStartItem* pItem = NULL; + if( nPos == 0 ) + pItem = new XLineStartItem(); + else if( mxLineEndList.is() && mxLineEndList->Count() > (long) ( nPos - 1 ) ) + pItem = new XLineStartItem( mpLBStart->GetSelectEntry(),mxLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ); + GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINEEND_STYLE, SFX_CALLMODE_RECORD, pItem, 0L); + delete pItem; + } + return 0; +} + + + + +IMPL_LINK(LinePropertyPanel, ChangeEndHdl, void*, EMPTYARG) +{ + sal_uInt16 nPos = mpLBEnd->GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND && nPos != mpLBEnd->GetSavedValue() ) + { + XLineEndItem* pItem = NULL; + if( nPos == 0 ) + pItem = new XLineEndItem(); + else if( mxLineEndList.is() && mxLineEndList->Count() > (long) ( nPos - 1 ) ) + pItem = new XLineEndItem( mpLBEnd->GetSelectEntry(), mxLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ); + GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINEEND_STYLE, SFX_CALLMODE_RECORD, pItem, 0L); + delete pItem; + } + return 0; +} + + + + +IMPL_LINK(LinePropertyPanel, ChangeEdgeStyleHdl, void*, EMPTYARG) +{ + const sal_uInt16 nPos(mpLBEdgeStyle->GetSelectEntryPos()); + + if(LISTBOX_ENTRY_NOTFOUND != nPos && nPos != mpLBEdgeStyle->GetSavedValue()) + { + XLineJointItem* pItem = 0; + + switch(nPos) + { + case 0: // rounded + { + pItem = new XLineJointItem(com::sun::star::drawing::LineJoint_ROUND); + break; + } + case 1: // none + { + pItem = new XLineJointItem(com::sun::star::drawing::LineJoint_NONE); + break; + } + case 2: // mitered + { + pItem = new XLineJointItem(com::sun::star::drawing::LineJoint_MITER); + break; + } + case 3: // beveled + { + pItem = new XLineJointItem(com::sun::star::drawing::LineJoint_BEVEL); + break; + } + } + + GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_JOINT, SFX_CALLMODE_RECORD, pItem, 0L); + delete pItem; + } + return 0; +} + + + + +IMPL_LINK(LinePropertyPanel, ChangeCapStyleHdl, void*, EMPTYARG) +{ + const sal_uInt16 nPos(mpLBCapStyle->GetSelectEntryPos()); + + if(LISTBOX_ENTRY_NOTFOUND != nPos && nPos != mpLBCapStyle->GetSavedValue()) + { + XLineCapItem* pItem = 0; + + switch(nPos) + { + case 0: // flat + { + pItem = new XLineCapItem(com::sun::star::drawing::LineCap_BUTT); + break; + } + case 1: // round + { + pItem = new XLineCapItem(com::sun::star::drawing::LineCap_ROUND); + break; + } + case 2: // square + { + pItem = new XLineCapItem(com::sun::star::drawing::LineCap_SQUARE); + break; + } + } + + GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_CAP, SFX_CALLMODE_RECORD, pItem, 0L); + delete pItem; + } + return 0; +} + + + + +IMPL_LINK(LinePropertyPanel, ToolboxWidthSelectHdl,ToolBox*, pToolBox) +{ + if (pToolBox->GetCurItemId() == TBI_WIDTH) + { + maLineWidthPopup.SetWidthSelect(mnWidthCoreValue, mbWidthValuable, meMapUnit); + maLineWidthPopup.Show(*pToolBox); + } + return 0; +} + + + + +IMPL_LINK( LinePropertyPanel, ChangeTransparentHdl, void *, EMPTYARG ) +{ + sal_uInt16 nVal = (sal_uInt16)mpMFTransparent->GetValue(); + XLineTransparenceItem aItem( nVal ); + + GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_STYLE, SFX_CALLMODE_RECORD, &aItem, 0L); + return( 0L ); +} + + + + +PopupControl* LinePropertyPanel::CreateColorPopupControl (PopupContainer* pParent) +{ + const ResId aResId(SVX_RES(STR_AUTOMATICE)); + + return new ColorControl( + pParent, + mpBindings, + SVX_RES(RID_POPUPPANEL_LINEPAGE_COLOR), + SVX_RES(VS_COLOR), + ::boost::bind(GetTransparentColor), + ::boost::bind(&LinePropertyPanel::SetColor, this, _1, _2), + pParent, + &aResId); +} + + + + +PopupControl* LinePropertyPanel::CreateLineWidthPopupControl (PopupContainer* pParent) +{ + return new LineWidthControl(pParent, *this); +} + + + + +void LinePropertyPanel::EndLineWidthPopupMode (void) +{ + maLineWidthPopup.Hide(); +} + + + + +void LinePropertyPanel::SetWidthIcon(int n) +{ + if(n==0) + mpTBWidth->SetItemImage( TBI_WIDTH, maIMGNone); + else + mpTBWidth->SetItemImage( TBI_WIDTH, mpIMGWidthIcon[n-1]); +} + + + +void LinePropertyPanel::SetWidthIcon() +{ + if(!mbWidthValuable) + { + mpTBWidth->SetItemImage( TBI_WIDTH, maIMGNone); + return; + } + + long nVal = LogicToLogic(mnWidthCoreValue * 10,(MapUnit)meMapUnit , MAP_POINT); + + if(nVal <= 6) + mpTBWidth->SetItemImage( TBI_WIDTH, mpIMGWidthIcon[0]); + else if(nVal > 6 && nVal <= 9) + mpTBWidth->SetItemImage( TBI_WIDTH, mpIMGWidthIcon[1]); + else if(nVal > 9 && nVal <= 12) + mpTBWidth->SetItemImage( TBI_WIDTH, mpIMGWidthIcon[2]); + else if(nVal > 12 && nVal <= 19) + mpTBWidth->SetItemImage( TBI_WIDTH, mpIMGWidthIcon[3]); + else if(nVal > 19 && nVal <= 26) + mpTBWidth->SetItemImage( TBI_WIDTH, mpIMGWidthIcon[4]); + else if(nVal > 26 && nVal <= 37) + mpTBWidth->SetItemImage( TBI_WIDTH, mpIMGWidthIcon[5]); + else if(nVal > 37 && nVal <=52) + mpTBWidth->SetItemImage( TBI_WIDTH, mpIMGWidthIcon[6]); + else if(nVal > 52) + mpTBWidth->SetItemImage( TBI_WIDTH, mpIMGWidthIcon[7]); + +} + + + +void LinePropertyPanel::SetColor ( + const String& rsColorName, + const Color aColor) +{ + XLineColorItem aColorItem(rsColorName, aColor); + mpBindings->GetDispatcher()->Execute(SID_ATTR_LINE_COLOR, SFX_CALLMODE_RECORD, &aColorItem, 0L); + maColor = aColor; +} + + + +void LinePropertyPanel::SetWidth(long nWidth) +{ + mnWidthCoreValue = nWidth; + mbWidthValuable = true; +} + + + +void LinePropertyPanel::FillLineEndList() +{ + SfxObjectShell* pSh = SfxObjectShell::Current(); + if ( pSh && pSh->GetItem( SID_LINEEND_LIST ) ) + { + mpLBStart->Enable(); + SvxLineEndListItem aItem( *(const SvxLineEndListItem*)(pSh->GetItem( SID_LINEEND_LIST ) ) ); + mxLineEndList = aItem.GetLineEndList(); + + if (mxLineEndList.is()) + { + FillLineEndListBox(*mpLBStart, *mpLBEnd, *mxLineEndList); + } + + mpLBStart->SelectEntryPos(0); + mpLBEnd->SelectEntryPos(0); + } + else + { + mpLBStart->Disable(); + mpLBEnd->Disable(); + } +} + + + +void LinePropertyPanel::FillLineStyleList() +{ + SfxObjectShell* pSh = SfxObjectShell::Current(); + if ( pSh && pSh->GetItem( SID_DASH_LIST ) ) + { + mpLBStyle->Enable(); + SvxDashListItem aItem( *(const SvxDashListItem*)(pSh->GetItem( SID_DASH_LIST ) ) ); + mxLineStyleList = aItem.GetDashList(); + + if (mxLineStyleList.is()) + { + FillLineStyleListBox(*mpLBStyle, *mxLineStyleList); + } + + mpLBStyle->SelectEntryPos(0); + } + else + { + mpLBStyle->Disable(); + } +} + + + +void LinePropertyPanel::SelectLineStyle() +{ + if( !mbStyleAvailable || !mbDashAvailable ) + { + mpLBStyle->SetNoSelection(); + return; + } + + const XLineStyle eXLS(mpStyleItem ? (XLineStyle)mpStyleItem->GetValue() : XLINE_NONE); + bool bSelected(false); + + switch(eXLS) + { + case XLINE_NONE: + break; + case XLINE_SOLID: + mpLBStyle->SelectEntryPos(1); + bSelected = true; + break; + default: + if(mpDashItem && mxLineStyleList.is()) + { + const XDash& rDash = mpDashItem->GetDashValue(); + for(sal_Int32 a(0);!bSelected && a < mxLineStyleList->Count(); a++) + { + XDashEntry* pEntry = mxLineStyleList->GetDash(a); + const XDash& rEntry = pEntry->GetDash(); + if(rDash == rEntry) + { + mpLBStyle->SelectEntryPos((sal_uInt16)a + 2); + bSelected = true; + } + } + } + break; + } + + if(!bSelected) + mpLBStyle->SelectEntryPos( 0 ); +} + +void LinePropertyPanel::SelectEndStyle(bool bStart) +{ + sal_Bool bSelected(false); + + if(bStart) + { + //<<add + if( !mbStartAvailable ) + { + mpLBStart->SetNoSelection(); + return; + } + //add end>> + if (mpStartItem && mxLineEndList.is()) + { + const basegfx::B2DPolyPolygon& rItemPolygon = mpStartItem->GetLineStartValue(); + for(sal_Int32 a(0);!bSelected && a < mxLineEndList->Count(); a++) + { + XLineEndEntry* pEntry = mxLineEndList->GetLineEnd(a); + const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd(); + if(rItemPolygon == rEntryPolygon) + { + mpLBStart->SelectEntryPos((sal_uInt16)a + 1); + bSelected = true; + } + } + } + if(!bSelected) + mpLBStart->SelectEntryPos( 0 ); + } + else + { + //<<add + if( !mbEndAvailable ) + { + mpLBEnd->SetNoSelection(); + return; + } + //add end>> + if (mpEndItem && mxLineEndList.is()) + { + const basegfx::B2DPolyPolygon& rItemPolygon = mpEndItem->GetLineEndValue(); + for(sal_Int32 a(0);!bSelected && a < mxLineEndList->Count(); a++) + { + XLineEndEntry* pEntry = mxLineEndList->GetLineEnd(a); + const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd(); + if(rItemPolygon == rEntryPolygon) + { + mpLBEnd->SelectEntryPos((sal_uInt16)a + 1); + bSelected = true; + } + } + } + if(!bSelected) + mpLBEnd->SelectEntryPos( 0 ); + } +} + + +} } // end of namespace svx::sidebar + +// eof diff --git a/svx/source/sidebar/line/LinePropertyPanel.hrc b/svx/source/sidebar/line/LinePropertyPanel.hrc new file mode 100644 index 000000000000..81c9e319bb10 --- /dev/null +++ b/svx/source/sidebar/line/LinePropertyPanel.hrc @@ -0,0 +1,104 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +// RID_SIDEBAR_LINE_PANEL-------------------------------------------------------------- +#define CUSTOM_X POPUPPANEL_MARGIN_LARGE + OFFSET_X +#define CUSTOM_Y POPUPPANEL_MARGIN_SMALL + OFFSET_Y + 12 * 9 + POPUPPANEL_MARGIN_SMALL * 2 + TEXT_HEIGHT +#define CUSTOM_W 74 +#define CUSTOM_H POPUPPANEL_MARGIN_LARGE * 2 + TEXT_HEIGHT + 12 + TEXT_CONTROL_SPACING_VERTICAL + +#define FT_COLOR 1 +#define TB_COLOR 2 +#define FT_WIDTH 3 +#define TB_WIDTH 4 +#define FT_STYLE 5 +#define LB_STYLE 6 +#define FT_ARROW 7 +#define FT_TRANSPARENT 8 +#define MF_TRANSPARENT 9 +#define LB_START 10 +#define LB_END 11 +#define TBI_COLOR 12 +#define TBI_WIDTH 13 +#define TBI_STYLE 14 +#define STR_QH_TB_WIDTH 15 +#define STR_QH_TB_COLOR 16 + +#define FT_EDGESTYLE 18 +#define LB_EDGESTYLE 19 +#define FT_CAPSTYLE 20 +#define LB_CAPSTYLE 21 + +#define IMG_COLOR 23 +#define IMG_COLOR_NO 24 +#define IMG_NONE_ICON 36 + +#define IMG_WIDTH1_ICON 41 +#define IMG_WIDTH2_ICON 42 +#define IMG_WIDTH3_ICON 43 +#define IMG_WIDTH4_ICON 44 +#define IMG_WIDTH5_ICON 45 +#define IMG_WIDTH6_ICON 46 +#define IMG_WIDTH7_ICON 47 +#define IMG_WIDTH8_ICON 48 + +//color popup page +#define VS_COLOR 1 +#define STR_AUTOMATICE 2 + +//style popup page +#define VS_STYLE 1 +#define PB_OPTIONS 2 + +#define IMG_LINE1 5 +#define IMG_LINE2 7 +#define IMG_LINE3 9 +#define IMG_LINE4 11 +#define IMG_LINE5 13 +#define IMG_LINE6 15 +#define IMG_LINE7 17 +#define IMG_LINE8 19 +#define IMG_LINE9 21 +#define IMG_LINE10 23 +#define IMG_LINE11 25 + +// #define STR_STYLE_NONE_TIP 30 +#define STR_STYLE_NONE 31 +#define STR_STYLE_LINE1 32 +#define STR_STYLE_LINE2 33 +#define STR_STYLE_LINE3 34 +#define STR_STYLE_LINE4 35 +#define STR_STYLE_LINE5 36 +#define STR_STYLE_LINE6 37 +#define STR_STYLE_LINE7 38 +#define STR_STYLE_LINE8 39 +#define STR_STYLE_LINE9 40 +#define STR_STYLE_LINE10 41 +#define STR_STYLE_LINE11 42 + +//width popup page +#define VS_WIDTH 1 +#define MF_WIDTH 2 +#define FT_CUSTOME 3 +#define FT_LINE_WIDTH 4 +#define IMG_WIDTH_CUSTOM 5 +#define IMG_WIDTH_CUSTOM_GRAY 6 +#define CT_BORDER 7 +#define STR_WIDTH_LAST_CUSTOM 8 +#define STR_PT 9 + +// eof diff --git a/svx/source/sidebar/line/LinePropertyPanel.hxx b/svx/source/sidebar/line/LinePropertyPanel.hxx new file mode 100644 index 000000000000..327c18e54724 --- /dev/null +++ b/svx/source/sidebar/line/LinePropertyPanel.hxx @@ -0,0 +1,194 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SVX_PROPERTYPANEL_LINEPAGE_HXX +#define SVX_PROPERTYPANEL_LINEPAGE_HXX + +#include <svx/xdash.hxx> +#include <vcl/ctrl.hxx> +#include <sfx2/sidebar/SidebarPanelBase.hxx> +#include <sfx2/sidebar/ControllerItem.hxx> +#include <vcl/fixed.hxx> +#include <vcl/field.hxx> +#include <boost/scoped_ptr.hpp> +#include <boost/scoped_array.hpp> +#include <svx/sidebar/ColorPopup.hxx> +#include <svx/xtable.hxx> +#include "LineWidthPopup.hxx" + + +namespace svx { class ToolboxButtonColorUpdater; } +class SvxLineColorPage; +class SvxLineStylePage; +class SvxLineWidthPage; +class XLineStyleItem; +class XLineDashItem; +class XLineStartItem; +class XLineEndItem; +class XLineEndList; +class XDashList; +class ListBox; +class ToolBox; +class FloatingWindow; + +namespace { + #define SIDEBAR_LINE_WIDTH_GLOBAL_VALUE String("PopupPanel_LineWidth", 20, RTL_TEXTENCODING_ASCII_US) +} //end of anonymous namespace + +namespace svx { namespace sidebar { + +class PopupContainer; +class ColorPopup; +class LineWidthControl; + + +class LinePropertyPanel +: public Control, + public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface +{ +private: + friend class ::SvxLineStylePage; + friend class ::SvxLineWidthPage; + +public: + static LinePropertyPanel* Create( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings); + + virtual void DataChanged( + const DataChangedEvent& rEvent); + + virtual void NotifyItemUpdate( + const sal_uInt16 nSId, + const SfxItemState eState, + const SfxPoolItem* pState); + + SfxBindings* GetBindings(); + + void SetWidth(long nWidth); + void SetWidthIcon(int n); + void SetWidthIcon(); + + void EndLineWidthPopupMode (void); + +private: + //ui controls + ::boost::scoped_ptr< FixedText > mpFTWidth; + ::boost::scoped_ptr< Window > mpTBWidthBackground; + ::boost::scoped_ptr< ToolBox > mpTBWidth; + ::boost::scoped_ptr< FixedText > mpFTColor; + ::boost::scoped_ptr< Window > mpTBColorBackground; + ::boost::scoped_ptr< ToolBox > mpTBColor; + ::boost::scoped_ptr< FixedText > mpFTStyle; + ::boost::scoped_ptr< ListBox > mpLBStyle; + ::boost::scoped_ptr< FixedText > mpFTTrancparency; + ::boost::scoped_ptr< MetricField > mpMFTransparent; + ::boost::scoped_ptr< FixedText > mpFTArrow; + ::boost::scoped_ptr< ListBox > mpLBStart; + ::boost::scoped_ptr< ListBox > mpLBEnd; + ::boost::scoped_ptr< FixedText > mpFTEdgeStyle; + ::boost::scoped_ptr< ListBox > mpLBEdgeStyle; + ::boost::scoped_ptr< FixedText > mpFTCapStyle; + ::boost::scoped_ptr< ListBox > mpLBCapStyle; + + //ControllerItem + ::sfx2::sidebar::ControllerItem maStyleControl; + ::sfx2::sidebar::ControllerItem maDashControl; + ::sfx2::sidebar::ControllerItem maWidthControl; + ::sfx2::sidebar::ControllerItem maColorControl; + ::sfx2::sidebar::ControllerItem maStartControl; + ::sfx2::sidebar::ControllerItem maEndControl; + ::sfx2::sidebar::ControllerItem maLineEndListControl; + ::sfx2::sidebar::ControllerItem maLineStyleListControl; + ::sfx2::sidebar::ControllerItem maTransControl; + ::sfx2::sidebar::ControllerItem maEdgeStyle; + ::sfx2::sidebar::ControllerItem maCapStyle; + + Color maColor; + ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpColorUpdater; + ::boost::scoped_ptr< XLineStyleItem > mpStyleItem; + ::boost::scoped_ptr< XLineDashItem > mpDashItem; + sal_uInt16 mnTrans; + SfxMapUnit meMapUnit; + sal_Int32 mnWidthCoreValue; + XLineEndListRef mxLineEndList; + XDashListRef mxLineStyleList; + ::boost::scoped_ptr< XLineStartItem > mpStartItem; + ::boost::scoped_ptr< XLineEndItem > mpEndItem; + + //popup windows + ColorPopup maColorPopup; + LineWidthPopup maLineWidthPopup; + + // images from ressource + Image maIMGColor; + Image maIMGNone; + + // multi-images + ::boost::scoped_array<Image> mpIMGWidthIcon; + + cssu::Reference< css::frame::XFrame > mxFrame; + SfxBindings* mpBindings; + + /// bitfield + bool mbColorAvailable : 1; + bool mbStyleAvailable : 1; + bool mbDashAvailable : 1; + bool mbTransAvailable : 1; + bool mbWidthValuable : 1; + bool mbStartAvailable : 1; + bool mbEndAvailable : 1; + + void SetupIcons(void); + void Initialize(); + void FillLineEndList(); + void FillLineStyleList(); + void SelectEndStyle(bool bStart); + void SelectLineStyle(); + + DECL_LINK(ImplPopupModeEndHdl, FloatingWindow* ); + DECL_LINK(ImplWidthPopupModeEndHdl, FloatingWindow* ); + DECL_LINK(ToolboxColorSelectHdl, ToolBox*); + DECL_LINK(ChangeLineStyleHdl, void*); + DECL_LINK(ToolboxWidthSelectHdl, ToolBox*); + DECL_LINK(ChangeTransparentHdl , void *); + DECL_LINK(ChangeStartHdl, void *); + DECL_LINK(ChangeEndHdl, void *); + DECL_LINK(ChangeEdgeStyleHdl, void *); + DECL_LINK(ChangeCapStyleHdl, void *); + + // constructor/destuctor + LinePropertyPanel( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings); + virtual ~LinePropertyPanel(void); + + void SetColor( + const String& rsColorName, + const Color aColor); + + PopupControl* CreateColorPopupControl (PopupContainer* pParent); + PopupControl* CreateLineWidthPopupControl (PopupContainer* pParent); +}; + +} } // end of namespace svx::sidebar + +#endif + +// eof diff --git a/svx/source/sidebar/line/LinePropertyPanel.src b/svx/source/sidebar/line/LinePropertyPanel.src new file mode 100644 index 000000000000..049c9ad0df2c --- /dev/null +++ b/svx/source/sidebar/line/LinePropertyPanel.src @@ -0,0 +1,486 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "LinePropertyPanel.hrc" +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include <svx/dialogs.hrc> +#include "helpid.hrc" + +#define TOOLBOX_WIDTH 50 +#define TOOLBOX_HEIGHT 14 +#define LISTBOX_HEIGHT 99 + +Control RID_SIDEBAR_LINE_PANEL +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + Text = "Line"; + + Size = MAP_APPFONT( + PROPERTYPAGE_WIDTH, + SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT*4 + TEXT_CONTROL_SPACING_VERTICAL*4 + TOOLBOX_HEIGHT*3 + CONTROL_SPACING_VERTICAL*3 + CBOX_HEIGHT + SECTIONPAGE_MARGIN_VERTICAL_BOT ); + HelpID = HID_PROPERTYPANEL_LINE_SECTION ; + + FixedText FT_WIDTH + { + Pos = MAP_APPFONT( SECTIONPAGE_MARGIN_HORIZONTAL , SECTIONPAGE_MARGIN_VERTICAL_TOP ) ; + Size = MAP_APPFONT (TOOLBOX_WIDTH , TEXT_HEIGHT ) ; + Text [ en-US ] = "~Width:" ; + }; + ToolBox TB_WIDTH + { + SVLook = TRUE ; + Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL, SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL) ; + Size = MAP_APPFONT (TOOLBOX_WIDTH ,TOOLBOX_HEIGHT ) ; + TabStop = TRUE ; + HelpID = HID_PPROPERTYPANEL_LINE_TBX_WIDTH ; + Text = "Width"; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_WIDTH ; + DropDown = TRUE ; + Text [ en-US ] = "Width" ; + HelpID = HID_PPROPERTYPANEL_LINE_TBI_WIDTH; + }; + }; + }; + String STR_QH_TB_WIDTH + { + Text [ en-US ] = "Select the width of the line."; + }; + + FixedText FT_COLOR + { + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + TOOLBOX_WIDTH + 3, SECTIONPAGE_MARGIN_VERTICAL_TOP ) ; + Size = MAP_APPFONT (TOOLBOX_WIDTH , TEXT_HEIGHT ) ; + Text [ en-US ] = "~Color:" ; + }; + ToolBox TB_COLOR + { + SVLook = TRUE ; + Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL + TOOLBOX_WIDTH + 4, SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL) ; + Size = MAP_APPFONT (TOOLBOX_WIDTH ,TOOLBOX_HEIGHT ) ; + TabStop = TRUE ; + HelpID = HID_PPROPERTYPANEL_LINE_TBX_COLOR; + Text = "Color"; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_COLOR ; + DropDown = TRUE ; + Text [ en-US ] = "Color" ; + HelpID = HID_PPROPERTYPANEL_LINE_TBI_COLOR; + }; + }; + }; + String STR_QH_TB_COLOR + { + Text [ en-US ] = "Select the color of the line."; + }; + + FixedText FT_STYLE + { + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL , SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + TOOLBOX_HEIGHT + CONTROL_SPACING_VERTICAL) ; + Size = MAP_APPFONT (TOOLBOX_WIDTH , TEXT_HEIGHT ) ; + Text [ en-US ] = "~Style:" ; + }; + ListBox LB_STYLE + { + Border = TRUE ; + HelpID = HID_PPROPERTYPANEL_LINE_TBX_STYLE; + Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL, SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT*2 + TEXT_CONTROL_SPACING_VERTICAL*2 + TOOLBOX_HEIGHT + CONTROL_SPACING_VERTICAL) ; + Size = MAP_APPFONT (TOOLBOX_WIDTH ,LISTBOX_HEIGHT ) ; + TabStop = TRUE ; + DropDown = TRUE ; + DDExtraWidth = TRUE ; + QuickHelpText [ en-US ] = "Select the style of the line."; + }; + + FixedText FT_TRANSPARENT + { + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + TOOLBOX_WIDTH + 3 , SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + TOOLBOX_HEIGHT + CONTROL_SPACING_VERTICAL) ; + Size = MAP_APPFONT (TOOLBOX_WIDTH , TEXT_HEIGHT ) ; + Text [ en-US ] = "~Transparency:" ; + }; + MetricField MF_TRANSPARENT + { + Border = TRUE ; + HelpID = HID_PPROPERTYPANEL_LINE_MTR_TRANCEPARENCE; + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + TOOLBOX_WIDTH + 3 , SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT*2 + TEXT_CONTROL_SPACING_VERTICAL*2 + TOOLBOX_HEIGHT + CONTROL_SPACING_VERTICAL) ; + Size = MAP_APPFONT ( TOOLBOX_WIDTH + 1 , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 100 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + Last = 100 ; + SpinSize = 5 ; + QuickHelpText [ en-US ] = "Specify the transparency of the line."; + }; + + FixedText FT_ARROW + { + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL, SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT*2 + TEXT_CONTROL_SPACING_VERTICAL*2 + TOOLBOX_HEIGHT*2 + CONTROL_SPACING_VERTICAL*2) ; + Size = MAP_APPFONT (TOOLBOX_WIDTH * 2 + 3 , TEXT_HEIGHT ) ; + Text [ en-US ] = "~Arrow:" ; + }; + ListBox LB_START + { + Border = TRUE ; + HelpID = HID_PPROPERTYPANEL_LINE_LB_START; + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL , SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT*3 + TEXT_CONTROL_SPACING_VERTICAL*3 + TOOLBOX_HEIGHT*2 + CONTROL_SPACING_VERTICAL*2 ) ; + Size = MAP_APPFONT ( TOOLBOX_WIDTH , LISTBOX_HEIGHT ) ; + TabStop = TRUE ; + DropDown = TRUE ; + DDExtraWidth = TRUE ; + QuickHelpText [ en-US ] = "Select the style of the beginning arrowhead."; + }; + ListBox LB_END + { + Border = TRUE ; + HelpID = HID_PPROPERTYPANEL_LINE_LB_END; + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + TOOLBOX_WIDTH + 3 , SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT*3 + TEXT_CONTROL_SPACING_VERTICAL*3 + TOOLBOX_HEIGHT*2 + CONTROL_SPACING_VERTICAL*2 ) ; + Size = MAP_APPFONT ( TOOLBOX_WIDTH + 1, LISTBOX_HEIGHT ) ; + TabStop = TRUE ; + DropDown = TRUE ; + DDExtraWidth = TRUE ; + QuickHelpText [ en-US ] = "Select the style of the ending arrowhead."; + }; + + FixedText FT_EDGESTYLE + { + Pos = MAP_APPFONT ( + SECTIONPAGE_MARGIN_HORIZONTAL, + SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT*3 + TEXT_CONTROL_SPACING_VERTICAL*3 + TOOLBOX_HEIGHT*3 + CONTROL_SPACING_VERTICAL*3) ; + Size = MAP_APPFONT (TOOLBOX_WIDTH * 2 + 3 , TEXT_HEIGHT ) ; + Text [ en-US ] = "~Corner style" ; + }; + ListBox LB_EDGESTYLE + { + HelpID = HID_PPROPERTYPANEL_LINE_LB_EDGESTYLE; + Border = TRUE ; + Pos = MAP_APPFONT ( + SECTIONPAGE_MARGIN_HORIZONTAL , + SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT*4 + TEXT_CONTROL_SPACING_VERTICAL*4 + TOOLBOX_HEIGHT*3 + CONTROL_SPACING_VERTICAL*3 ) ; + Size = MAP_APPFONT ( TOOLBOX_WIDTH , LISTBOX_HEIGHT ) ; + TabStop = TRUE ; + DropDown = TRUE ; + DDExtraWidth = TRUE ; + QuickHelpText [ en-US ] = "Select the style of the edge connections."; + StringList [ en-US ] = + { + < "Rounded" ; Default ; > ; + < "- none -" ; > ; + < "Mitered" ; > ; + < "Beveled" ; > ; + }; + }; + FixedText FT_CAPSTYLE + { + Pos = MAP_APPFONT ( + SECTIONPAGE_MARGIN_HORIZONTAL + TOOLBOX_WIDTH + 3, + SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT*3 + TEXT_CONTROL_SPACING_VERTICAL*3 + TOOLBOX_HEIGHT*3 + CONTROL_SPACING_VERTICAL*3) ; + Size = MAP_APPFONT (TOOLBOX_WIDTH * 2 + 3 , TEXT_HEIGHT ) ; + Text [ en-US ] = "Ca~p style" ; + }; + ListBox LB_CAPSTYLE + { + HelpID = HID_PPROPERTYPANEL_LINE_LB_CAPSTYLE; + Border = TRUE ; + Pos = MAP_APPFONT ( + SECTIONPAGE_MARGIN_HORIZONTAL + TOOLBOX_WIDTH + 3, + SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT*4 + TEXT_CONTROL_SPACING_VERTICAL*4 + TOOLBOX_HEIGHT*3 + CONTROL_SPACING_VERTICAL*3 ) ; + Size = MAP_APPFONT ( TOOLBOX_WIDTH , LISTBOX_HEIGHT ) ; + TabStop = TRUE ; + DropDown = TRUE ; + DDExtraWidth = TRUE ; + QuickHelpText [ en-US ] = "Select the style of the line caps."; + StringList [ en-US ] = + { + < "Flat" ; Default ; > ; // Same string as in Excel + < "Round" ; > ; + < "Square" ; > ; + }; + }; + + Image IMG_COLOR + { + ImageBitmap = Bitmap{File = "symphony/Line_color.png";}; + }; + Image IMG_COLOR_NO + { + ImageBitmap = Bitmap{File = "symphony/no color.png";}; + }; + + Image IMG_NONE_ICON + { + ImageBitmap = Bitmap{File = "symphony/blank.png";}; + }; + + //WIDTH ICON + Image IMG_WIDTH1_ICON + { + ImageBitmap = Bitmap{File = "symphony/width1.png";}; + }; + Image IMG_WIDTH2_ICON + { + ImageBitmap = Bitmap{File = "symphony/width2.png";}; + }; + Image IMG_WIDTH3_ICON + { + ImageBitmap = Bitmap{File = "symphony/width3.png";}; + }; + Image IMG_WIDTH4_ICON + { + ImageBitmap = Bitmap{File = "symphony/width4.png";}; + }; + Image IMG_WIDTH5_ICON + { + ImageBitmap = Bitmap{File = "symphony/width5.png";}; + }; + Image IMG_WIDTH6_ICON + { + ImageBitmap = Bitmap{File = "symphony/width6.png";}; + }; + Image IMG_WIDTH7_ICON + { + ImageBitmap = Bitmap{File = "symphony/width7.png";}; + }; + Image IMG_WIDTH8_ICON + { + ImageBitmap = Bitmap{File = "symphony/width8.png";}; + }; + +}; +Control RID_POPUPPANEL_LINEPAGE_COLOR +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + Size = MAP_APPFONT( POPUP_COLOR_PICKER_WIDTH , POPUP_COLOR_PICKER_HEIGHT ); + + Control VS_COLOR + { + HelpId = HID_PPROPERTYPANEL_LINE_VS_COLOR ; + Hide = TRUE ; + Pos = MAP_APPFONT ( OFFSET_X , OFFSET_Y ); + Size = MAP_APPFONT ( POPUP_COLOR_PICKER_WIDTH - OFFSET_X * 2, POPUP_COLOR_PICKER_HEIGHT - OFFSET_Y * 2); + TabStop = TRUE ; + Text = "Color"; + }; + String STR_AUTOMATICE + { + Text [ en-US ] = "No Color"; + }; +}; +Control RID_POPUPPANEL_LINEPAGE_STYLE +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + + Size = MAP_APPFONT( + POPUPPANEL_MARGIN_SMALL * 2 + POPUP_BORDER_WIDTH , + 13 + POPUP_BORDER_HEIGHT + POPUPPANEL_MARGIN_SMALL * 2 + POPUPPANEL_MARGIN_LARGE); + + Control VS_STYLE + { + HelpId = HID_PPROPERTYPANEL_LINE_VS_STYLE ; + Hide = TRUE ; + Pos = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL + OFFSET_X , POPUPPANEL_MARGIN_SMALL + OFFSET_Y ); + Size = MAP_APPFONT ( 93 , 13 * 12); + TabStop = TRUE ; + Text = "Style"; + }; + + PushButton PB_OPTIONS + { + HelpId = HID_PPROPERTYPANEL_LINE_BTN_STYLE; + Pos = MAP_APPFONT ( POPUPPANEL_MARGIN_LARGE + OFFSET_X , POPUPPANEL_MARGIN_SMALL * 2 + OFFSET_Y ); + Size = MAP_APPFONT ( 93 , 13 ); + TabStop = TRUE; + Text [ en-US ] = "~More Options..."; + }; + + String STR_STYLE_NONE + { + Text [ en-US ] = "None"; + }; + String STR_STYLE_LINE1 + { + Text [ en-US ] = "Continuous"; + }; + String STR_STYLE_LINE2 + { + Text [ en-US ] = "Ultrafine dashed"; + }; + String STR_STYLE_LINE3 + { + Text [ en-US ] = "Dashed (variable)"; + }; + String STR_STYLE_LINE4 + { + Text [ en-US ] = "Fine dashed (variable)"; + }; + String STR_STYLE_LINE5 + { + Text [ en-US ] = "Fine dashed"; + }; + String STR_STYLE_LINE6 + { + Text [ en-US ] = "Fine dotted"; + }; + String STR_STYLE_LINE7 + { + Text [ en-US ] = "Ultrafine dotted (variable)"; + }; + String STR_STYLE_LINE8 + { + Text [ en-US ] = "3 dashes 3 dots (variable)"; + }; + String STR_STYLE_LINE9 + { + Text [ en-US ] = "2 dots 1 dash"; + }; + String STR_STYLE_LINE10 + { + Text [ en-US ] = "Ultrafine 2 dots 3 dashes"; + }; + String STR_STYLE_LINE11 + { + Text [ en-US ] = "Line with fine dots"; + }; + + Image IMG_LINE1 + { + ImageBitmap = Bitmap{File = "symphony/style_line1.png";}; + }; + Image IMG_LINE2 + { + ImageBitmap = Bitmap{File = "symphony/style_line2.png";}; + }; + Image IMG_LINE3 + { + ImageBitmap = Bitmap{File = "symphony/style_line3.png";}; + }; + Image IMG_LINE4 + { + ImageBitmap = Bitmap{File = "symphony/style_line4.png";}; + }; + Image IMG_LINE5 + { + ImageBitmap = Bitmap{File = "symphony/style_line5.png";}; + }; + Image IMG_LINE6 + { + ImageBitmap = Bitmap{File = "symphony/style_line6.png";}; + }; + Image IMG_LINE7 + { + ImageBitmap = Bitmap{File = "symphony/style_line7.png";}; + }; + Image IMG_LINE8 + { + ImageBitmap = Bitmap{File = "symphony/style_line8.png";}; + }; + Image IMG_LINE9 + { + ImageBitmap = Bitmap{File = "symphony/style_line9.png";}; + }; + Image IMG_LINE10 + { + ImageBitmap = Bitmap{File = "symphony/style_line10.png";}; + }; + Image IMG_LINE11 + { + ImageBitmap = Bitmap{File = "symphony/style_line11.png";}; + }; +}; +Control RID_POPUPPANEL_LINEPAGE_WIDTH +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + + Size = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL * 2 + POPUP_BORDER_WIDTH + 80, POPUPPANEL_MARGIN_SMALL + POPUPPANEL_MARGIN_LARGE + POPUP_BORDER_WIDTH + 12 * 9 + POPUPPANEL_MARGIN_SMALL * 2 + TEXT_HEIGHT + (POPUPPANEL_MARGIN_LARGE * 2 + TEXT_HEIGHT + 12 + TEXT_CONTROL_SPACING_VERTICAL)); + + Control VS_WIDTH + { + HelpId = HID_PPROPERTYPANEL_LINE_VS_WIDTH ; + Hide = TRUE ; + Pos = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL + OFFSET_X , POPUPPANEL_MARGIN_SMALL + OFFSET_Y ); + Size = MAP_APPFONT ( 80 , 12 * 9); + TabStop = TRUE ; + Text = "Width"; + }; + FixedText FT_CUSTOME + { + Pos = MAP_APPFONT ( POPUPPANEL_MARGIN_LARGE + OFFSET_X, POPUPPANEL_MARGIN_SMALL + OFFSET_Y + 12 * 9 + POPUPPANEL_MARGIN_SMALL ) ; + Size = MAP_APPFONT ( 80 , TEXT_HEIGHT ) ; + Text [ en-US ] = "Custom:" ; + }; + FixedText FT_LINE_WIDTH + { + Pos = MAP_APPFONT ( CUSTOM_X + POPUPPANEL_MARGIN_LARGE, CUSTOM_Y + POPUPPANEL_MARGIN_LARGE) ; + Size = MAP_APPFONT ( 74 - POPUPPANEL_MARGIN_LARGE * 2 , TEXT_HEIGHT ) ; + Text [ en-US ] = "Line ~width:" ; + }; + MetricField MF_WIDTH + { + Border = TRUE ; + HelpID = HID_PPROPERTYPANEL_LINE_MTR_WIDTH ; + Pos = MAP_APPFONT ( CUSTOM_X + POPUPPANEL_MARGIN_LARGE , CUSTOM_Y + POPUPPANEL_MARGIN_LARGE + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + Right = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 5000 ; + StrictFormat = TRUE ; + DecimalDigits = 2 ; + Value = 1 ; + Unit = FUNIT_MM ; + Last = 5000 ; + SpinSize = 10 ; + QuickHelpText [ en-US ] = "Specify the width of the line."; + }; + + Image IMG_WIDTH_CUSTOM + { + ImageBitmap = Bitmap{File = "symphony/last_custom_common.png";}; + }; + Image IMG_WIDTH_CUSTOM_GRAY + { + ImageBitmap = Bitmap{File = "symphony/last_custom_common_grey.png";}; + }; + String STR_WIDTH_LAST_CUSTOM + { + Text [ en-US ] = "Last Custom Value"; + }; + String STR_PT + { + Text [ en-US ] = "pt"; + }; +}; + +// eof diff --git a/svx/source/sidebar/line/LineStyleValueSet.cxx b/svx/source/sidebar/line/LineStyleValueSet.cxx new file mode 100644 index 000000000000..41abbc4ee8fd --- /dev/null +++ b/svx/source/sidebar/line/LineStyleValueSet.cxx @@ -0,0 +1,127 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "LineStyleValueSet.hxx" + +#include <i18nlangtag/mslangid.hxx> + + +namespace svx { namespace sidebar { + +LineStyleValueSet::LineStyleValueSet ( + Window* pParent, + const ResId& rResId) + : ValueSet( pParent, rResId ), + pVDev(NULL), + mbSelectFirst(true) +{ + SetColCount( 1 ); +} + + + + +LineStyleValueSet::~LineStyleValueSet (void) +{ + delete pVDev; +} + + + + +void LineStyleValueSet::SetFirstString(XubString str) +{ + strNone = str; +} + + + + +void LineStyleValueSet::UserDraw( const UserDrawEvent& rUDEvt ) +{ + Rectangle aRect = rUDEvt.GetRect(); + OutputDevice* pDev = rUDEvt.GetDevice(); + sal_uInt16 nItemId = rUDEvt.GetItemId(); + + long nRectHeight = aRect.GetHeight(); + //Point aBLPos = aRect.TopLeft(); + if(nItemId == 1) + { + Color aOldFillColor = pDev->GetFillColor(); + + //draw back + if( mbSelectFirst ) + { + Color aBackColor(50,107,197); + Rectangle aBackRect = aRect; + aBackRect.Top() += 3; + aBackRect.Bottom() -= 2; + pDev->SetFillColor(aBackColor); + pDev->DrawRect(aBackRect); + } + else + { + pDev->SetFillColor( COL_TRANSPARENT ); + pDev->DrawRect(aRect); + } + pDev->SetFillColor(aOldFillColor); + + //draw text + Font aOldFont = pDev->GetFont(); + Color aOldColor = pDev->GetLineColor(); + Font aFont(OutputDevice::GetDefaultFont( + DEFAULTFONT_UI_SANS, MsLangId::getSystemLanguage(), DEFAULTFONT_FLAGS_ONLYONE)); + Size aSize = aFont.GetSize(); + aSize.Height() = nRectHeight*3/5; + if( mbSelectFirst ) + aFont.SetColor(COL_WHITE); + else + //aFont.SetColor(COL_BLACK); + aFont.SetColor(GetSettings().GetStyleSettings().GetFieldTextColor()); //high contrast + aFont.SetFillColor(COL_BLUE); + aFont.SetSize( aSize ); + pDev->SetFont(aFont); +// String sText("None", 9, RTL_TEXTENCODING_ASCII_US); + + // Point aStart(aBLPos.X() + 8 , aBLPos.Y() + nRectHeight/6); + Rectangle aStrRect = aRect; + aStrRect.Top() += nRectHeight/6; + aStrRect.Bottom() -= nRectHeight/6; + aStrRect.Left() += 8; + pDev->DrawText(aStrRect, strNone, TEXT_DRAW_ENDELLIPSIS); + + pDev->SetFont(aOldFont); + pDev->SetLineColor(aOldColor); + + + } + Invalidate( aRect ); +} + + + + +void LineStyleValueSet::SetFirstSelect(bool bSel) +{ + mbSelectFirst = bSel; +} + + + +} } // end of namespace svx::sidebar + +// eof diff --git a/svx/source/sidebar/line/LineStyleValueSet.hxx b/svx/source/sidebar/line/LineStyleValueSet.hxx new file mode 100644 index 000000000000..862cf18e5842 --- /dev/null +++ b/svx/source/sidebar/line/LineStyleValueSet.hxx @@ -0,0 +1,47 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SVX_SIDEBAR_LINE_STYLE_VALUE_SET_HXX +#define SVX_SIDEBAR_LINE_STYLE_VALUE_SET_HXX + +#include <svtools/valueset.hxx> + +namespace svx { namespace sidebar { + +class LineStyleValueSet + : public ValueSet +{ +public: + LineStyleValueSet (Window* pParent, const ResId& rResId); + virtual ~LineStyleValueSet (void); + + void SetFirstSelect(bool bSel); + void SetFirstString(XubString str); + + virtual void UserDraw( const UserDrawEvent& rUDEvt ); + +private: + VirtualDevice* pVDev; + bool mbSelectFirst; + XubString strNone; +}; + +} } // end of namespace svx::sidebar + +#endif + +// eof diff --git a/svx/source/sidebar/line/LineWidthControl.cxx b/svx/source/sidebar/line/LineWidthControl.cxx new file mode 100644 index 000000000000..66c0019f655e --- /dev/null +++ b/svx/source/sidebar/line/LineWidthControl.cxx @@ -0,0 +1,372 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "LineWidthControl.hxx" +#include "LinePropertyPanel.hrc" +#include "LinePropertyPanel.hxx" + +#include <svx/dialogs.hrc> +#include <svx/dialmgr.hxx> +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include <comphelper/processfactory.hxx> +#include <vcl/svapp.hxx> +#include <unotools/viewoptions.hxx> +#include <svx/xlnwtit.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include "svx/sidebar/PopupContainer.hxx" + + +namespace svx { namespace sidebar { + +LineWidthControl::LineWidthControl ( + Window* pParent, + LinePropertyPanel& rPanel) + : svx::sidebar::PopupControl(pParent,SVX_RES(RID_POPUPPANEL_LINEPAGE_WIDTH)), + mrLinePropertyPanel(rPanel), + mpBindings(NULL), + maVSWidth( this, SVX_RES(VS_WIDTH)), + maFTCus( this, SVX_RES(FT_CUSTOME)), + maFTWidth( this, SVX_RES(FT_LINE_WIDTH)), + maMFWidth( this, SVX_RES(MF_WIDTH)), + meMapUnit(SFX_MAPUNIT_TWIP), + rStr(NULL), + mstrPT(SVX_RES(STR_PT)), + mnCustomWidth(0), + mbCustom(false), + mbColseByEdit(false), + mnTmpCusomWidth(0), + mbVSFocus(true), + maIMGCus(SVX_RES(IMG_WIDTH_CUSTOM)), + maIMGCusGray(SVX_RES(IMG_WIDTH_CUSTOM_GRAY)) +{ + Initialize(); + FreeResource(); + mpBindings = mrLinePropertyPanel.GetBindings(); +} + + + + +LineWidthControl::~LineWidthControl (void) +{ + delete[] rStr; +} + + + + +void LineWidthControl::Paint(const Rectangle& rect) +{ + svx::sidebar::PopupControl::Paint(rect); + + Color aOldLineColor = GetLineColor(); + Color aOldFillColor = GetFillColor(); + + Point aPos( LogicToPixel( Point( CUSTOM_X, CUSTOM_Y), MAP_APPFONT )); + Size aSize( LogicToPixel( Size( CUSTOM_W, CUSTOM_H ), MAP_APPFONT )); + Rectangle aRect( aPos, aSize ); + aRect.Left() -= 1; + aRect.Top() -= 1; + aRect.Right() += 1; + aRect.Bottom() += 1; + + Color aLineColor(189,201,219); + if(!GetSettings().GetStyleSettings().GetHighContrastMode()) + SetLineColor(aLineColor); + else + SetLineColor(GetSettings().GetStyleSettings().GetShadowColor()); + SetFillColor(COL_TRANSPARENT); + DrawRect(aRect); + + SetLineColor(aOldLineColor); + SetFillColor(aOldFillColor); +} + + + + +void LineWidthControl::Initialize() +{ + maVSWidth.SetStyle( maVSWidth.GetStyle()| WB_3DLOOK | WB_NO_DIRECTSELECT );// WB_NAMEFIELD | WB_ITEMBORDER |WB_DOUBLEBORDER | WB_NONEFIELD | + //for high contrast wj + if(GetSettings().GetStyleSettings().GetHighContrastMode()) + { + maVSWidth.SetColor(GetSettings().GetStyleSettings().GetMenuColor()); + // maBorder.SetBackground(GetSettings().GetStyleSettings().GetMenuColor()); + maFTWidth.SetBackground(GetSettings().GetStyleSettings().GetMenuColor()); + } + else + { + maVSWidth.SetColor(COL_WHITE); + // maBorder.SetBackground(Wallpaper(COL_WHITE)); + maFTWidth.SetBackground(Wallpaper(COL_WHITE)); + } + + sal_Int64 nFirst= maMFWidth.Denormalize( maMFWidth.GetFirst( FUNIT_TWIP ) ); + sal_Int64 nLast = maMFWidth.Denormalize( maMFWidth.GetLast( FUNIT_TWIP ) ); + sal_Int64 nMin = maMFWidth.Denormalize( maMFWidth.GetMin( FUNIT_TWIP ) ); + sal_Int64 nMax = maMFWidth.Denormalize( maMFWidth.GetMax( FUNIT_TWIP ) ); + maMFWidth.SetSpinSize( 10 ); + maMFWidth.SetUnit( FUNIT_POINT ); + if( maMFWidth.GetDecimalDigits() > 1 ) + maMFWidth.SetDecimalDigits( 1 ); + maMFWidth.SetFirst( maMFWidth.Normalize( nFirst ), FUNIT_TWIP ); + maMFWidth.SetLast( maMFWidth.Normalize( nLast ), FUNIT_TWIP ); + maMFWidth.SetMin( maMFWidth.Normalize( nMin ), FUNIT_TWIP ); + maMFWidth.SetMax( maMFWidth.Normalize( nMax ), FUNIT_TWIP ); + + rStr = new XubString[9]; + //modify, + rStr[0] = String("05", 2, RTL_TEXTENCODING_ASCII_US); + rStr[1] = String("08", 2, RTL_TEXTENCODING_ASCII_US); + rStr[2] = String("10", 2, RTL_TEXTENCODING_ASCII_US); + rStr[3] = String("15", 2, RTL_TEXTENCODING_ASCII_US); + rStr[4] = String("23", 2, RTL_TEXTENCODING_ASCII_US); + rStr[5] = String("30", 2, RTL_TEXTENCODING_ASCII_US); + rStr[6] = String("45", 2, RTL_TEXTENCODING_ASCII_US); + rStr[7] = String("60", 2, RTL_TEXTENCODING_ASCII_US); + rStr[8] = String( SVX_RES(STR_WIDTH_LAST_CUSTOM) ); + + const LocaleDataWrapper& rLocaleWrapper( Application::GetSettings().GetLocaleDataWrapper() ); + const sal_Unicode cSep = rLocaleWrapper.getNumDecimalSep()[0]; + + for(int i = 0; i <= 7 ; i++) + { + rStr[i] = rStr[i].Insert(cSep, 1);//Modify + rStr[i].Append(mstrPT); + } + //end + + for(sal_uInt16 i = 1 ; i <= 9 ; i++) + { + maVSWidth.InsertItem(i); + maVSWidth.SetItemText(i, rStr[i-1]); + } + maVSWidth.SetUnit(rStr); + maVSWidth.SetItemData(1,(void*)5); + maVSWidth.SetItemData(2,(void*)8); + maVSWidth.SetItemData(3,(void*)10); + maVSWidth.SetItemData(4,(void*)15); + maVSWidth.SetItemData(5,(void*)23); + maVSWidth.SetItemData(6,(void*)30); + maVSWidth.SetItemData(7,(void*)45); + maVSWidth.SetItemData(8,(void*)60); + maVSWidth.SetImage(maIMGCusGray); + + maVSWidth.SetSelItem(0); + Link aLink = LINK( this, LineWidthControl, VSSelectHdl ) ; + maVSWidth.SetSelectHdl(aLink); + aLink = LINK(this, LineWidthControl, MFModifyHdl); + maMFWidth.SetModifyHdl(aLink); + + maVSWidth.StartSelection(); + maVSWidth.Show(); +} + + + + +void LineWidthControl::GetFocus() +{ + if(!mbVSFocus) + maMFWidth.GrabFocus(); + else + maVSWidth.GrabFocus(); +} + + + + +ValueSet& LineWidthControl::GetValueSet() +{ + return maVSWidth; +} + + + + +void LineWidthControl::SetWidthSelect( long lValue, bool bValuable, SfxMapUnit eMapUnit) +{ + mbVSFocus = true; + maVSWidth.SetSelItem(0); + mbColseByEdit = false; + meMapUnit = eMapUnit; + SvtViewOptions aWinOpt( E_WINDOW, SIDEBAR_LINE_WIDTH_GLOBAL_VALUE ); + if ( aWinOpt.Exists() ) + { + ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt.GetUserData(); + ::rtl::OUString aTmp; + if ( aSeq.getLength()) + aSeq[0].Value >>= aTmp; + + String aWinData( aTmp ); + mnCustomWidth = aWinData.ToInt32(); + mbCustom = true; + maVSWidth.SetImage(maIMGCus); + maVSWidth.SetCusEnable(true); + + String aStrTip( OUString::number( (double)mnCustomWidth / 10)); + aStrTip.Append(mstrPT); // + maVSWidth.SetItemText(9, aStrTip); + } + else + { + mbCustom = false; + maVSWidth.SetImage(maIMGCusGray); + maVSWidth.SetCusEnable(false); + //modify + //String aStrTip(String(SVX_RES(STR_WIDTH_LAST_CUSTOM))); + //maVSWidth.SetItemText(9, aStrTip); + maVSWidth.SetItemText(9, rStr[8]); + } + + if(bValuable) + { + sal_Int64 nVal = OutputDevice::LogicToLogic( lValue, (MapUnit)eMapUnit, MAP_100TH_MM ); + nVal = maMFWidth.Normalize( nVal ); + maMFWidth.SetValue( nVal, FUNIT_100TH_MM ); + } + else + { + maMFWidth.SetText( String() ); + } + + MapUnit eOrgUnit = (MapUnit)eMapUnit; + MapUnit ePntUnit( MAP_TWIP ); + lValue = LogicToLogic( lValue , eOrgUnit, ePntUnit ); + + XubString strCurrValue = maMFWidth.GetText(); + sal_uInt16 i = 0; + for(; i < 8; i++) + if(strCurrValue == rStr[i]) + { + maVSWidth.SetSelItem(i+1); + break; + } + if (i>=8) + { + mbVSFocus = false; + maVSWidth.SetSelItem(0); + } + maVSWidth.Format(); + maVSWidth.StartSelection(); +} + + + + +IMPL_LINK(LineWidthControl, VSSelectHdl, void *, pControl) +{ + if(pControl == &maVSWidth) + { + sal_uInt16 iPos = maVSWidth.GetSelectItemId(); + if(iPos >= 1 && iPos <= 8) + { + long nVal = LogicToLogic((long)(unsigned long)maVSWidth.GetItemData( iPos ) , MAP_POINT, (MapUnit)meMapUnit); + nVal = maMFWidth.Denormalize(nVal); + XLineWidthItem aWidthItem( nVal ); + mpBindings->GetDispatcher()->Execute(SID_ATTR_LINE_WIDTH, SFX_CALLMODE_RECORD, &aWidthItem, 0L); + mrLinePropertyPanel.SetWidthIcon(iPos); + mrLinePropertyPanel.SetWidth(nVal); + mbColseByEdit = false; + mnTmpCusomWidth = 0; + } + else if(iPos == 9) + {//last custom + //modified + if(mbCustom) + { + long nVal = LogicToLogic(mnCustomWidth , MAP_POINT, (MapUnit)meMapUnit); + nVal = maMFWidth.Denormalize(nVal); + XLineWidthItem aWidthItem( nVal ); + mpBindings->GetDispatcher()->Execute(SID_ATTR_LINE_WIDTH, SFX_CALLMODE_RECORD, &aWidthItem, 0L); + mrLinePropertyPanel.SetWidth(nVal); + mbColseByEdit = false; + mnTmpCusomWidth = 0; + } + else + { + maVSWidth.SetNoSelection(); //add , set no selection and keep the last select item + maVSWidth.Format(); + Invalidate(); + maVSWidth.StartSelection(); + } + //modify end + } + if((iPos >= 1 && iPos <= 8) || (iPos == 9 && mbCustom)) //add + mrLinePropertyPanel.EndLineWidthPopupMode(); + } + return( 0L ); +} + + + + +IMPL_LINK(LineWidthControl, MFModifyHdl, void *, pControl) +{ + if(pControl == &maMFWidth) + { + if(maVSWidth.GetSelItem()) + { + maVSWidth.SetSelItem(0); + maVSWidth.Format(); + Invalidate(); + maVSWidth.StartSelection(); + } + long nTmp = static_cast<long>(maMFWidth.GetValue()); + long nVal = LogicToLogic( nTmp, MAP_POINT, (MapUnit)meMapUnit ); + sal_Int32 nNewWidth = (short)maMFWidth.Denormalize( nVal ); + XLineWidthItem aWidthItem(nNewWidth); + mpBindings->GetDispatcher()->Execute(SID_ATTR_LINE_WIDTH, SFX_CALLMODE_RECORD, &aWidthItem, 0L); + + mbColseByEdit = true; + mnTmpCusomWidth = nTmp; + /*for(sal_uInt16 i = 0; i < 8; i++) + { + if(nTmp == (sal_Int32)maVSWidth.GetItemData(i)) + { + mbColseByEdit = false; + break; + } + }*/ + + } + return( 0L ); +} + + + + +bool LineWidthControl::IsCloseByEdit() +{ + return mbColseByEdit; +} + + + + +long LineWidthControl::GetTmpCustomWidth() +{ + return mnTmpCusomWidth; +} + + + +} } // end of namespace svx::sidebar + +// eof diff --git a/svx/source/sidebar/line/LineWidthControl.hxx b/svx/source/sidebar/line/LineWidthControl.hxx new file mode 100644 index 000000000000..c31a3de16635 --- /dev/null +++ b/svx/source/sidebar/line/LineWidthControl.hxx @@ -0,0 +1,71 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "svx/sidebar/PopupControl.hxx" +#include "LineWidthValueSet.hxx" +#include <svl/poolitem.hxx> +#include <vcl/fixed.hxx> +#include <vcl/field.hxx> + +class SfxBindings; + +namespace svx { namespace sidebar { + +class LinePropertyPanel; + +class LineWidthControl + : public svx::sidebar::PopupControl +{ +public: + LineWidthControl (Window* pParent, LinePropertyPanel& rPanel); + virtual ~LineWidthControl (void); + + virtual void GetFocus(); + virtual void Paint(const Rectangle& rect); + + void SetWidthSelect( long lValue, bool bValuable, SfxMapUnit eMapUnit); + ValueSet& GetValueSet(); + bool IsCloseByEdit(); + long GetTmpCustomWidth(); + +private: + LinePropertyPanel& mrLinePropertyPanel; + SfxBindings* mpBindings; + LineWidthValueSet maVSWidth; + FixedText maFTCus; + FixedText maFTWidth; + MetricField maMFWidth; + SfxMapUnit meMapUnit; + XubString* rStr; + XubString mstrPT; // + long mnCustomWidth; + bool mbCustom; + bool mbColseByEdit; + long mnTmpCusomWidth; + bool mbVSFocus; + + Image maIMGCus; + Image maIMGCusGray; + + void Initialize(); + DECL_LINK(VSSelectHdl, void *); + DECL_LINK(MFModifyHdl, void *); +}; + +} } // end of namespace svx::sidebar + +// eof diff --git a/svx/source/sidebar/line/LineWidthPopup.cxx b/svx/source/sidebar/line/LineWidthPopup.cxx new file mode 100644 index 000000000000..49596941147a --- /dev/null +++ b/svx/source/sidebar/line/LineWidthPopup.cxx @@ -0,0 +1,83 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "LineWidthPopup.hxx" +#include "LineWidthControl.hxx" +#include "LinePropertyPanel.hxx" + +#include <unotools/viewoptions.hxx> + +#include <boost/bind.hpp> + + +namespace svx { namespace sidebar { + +LineWidthPopup::LineWidthPopup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator) + : Popup( + pParent, + rControlCreator, + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width"))) +{ + SetPopupModeEndHandler(::boost::bind(&LineWidthPopup::PopupModeEndCallback, this)); +} + + + + +LineWidthPopup::~LineWidthPopup (void) +{ +} + + + + +void LineWidthPopup::SetWidthSelect (long lValue, bool bValuable, SfxMapUnit eMapUnit) +{ + ProvideContainerAndControl(); + + LineWidthControl* pControl = dynamic_cast<LineWidthControl*>(mpControl.get()); + if (pControl != NULL) + pControl->SetWidthSelect(lValue, bValuable, eMapUnit); +} + + + + +void LineWidthPopup::PopupModeEndCallback (void) +{ + LineWidthControl* pControl = dynamic_cast<LineWidthControl*>(mpControl.get()); + if (pControl != NULL) + { + if (pControl->IsCloseByEdit()) + { + SvtViewOptions aWinOpt( E_WINDOW, SIDEBAR_LINE_WIDTH_GLOBAL_VALUE ); + ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq(1); + aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LineWidth") ); + aSeq[0].Value <<= ::rtl::OUString::number(pControl->GetTmpCustomWidth()); + aWinOpt.SetUserData( aSeq ); + } + } +} + + + +} } // end of namespace svx::sidebar + + +// eof diff --git a/svx/source/sidebar/line/LineWidthPopup.hxx b/svx/source/sidebar/line/LineWidthPopup.hxx new file mode 100644 index 000000000000..d9c3dff748e2 --- /dev/null +++ b/svx/source/sidebar/line/LineWidthPopup.hxx @@ -0,0 +1,49 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_SIDEBAR_LINE_WIDTH_POPUP_HXX_ +#define _SVX_SIDEBAR_LINE_WIDTH_POPUP_HXX_ + +#include "svx/sidebar/Popup.hxx" + +#include <svl/poolitem.hxx> + +#include <boost/function.hpp> + + +namespace svx { namespace sidebar { + +class LineWidthPopup + : public Popup +{ +public : + LineWidthPopup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator); + virtual ~LineWidthPopup (void); + + void SetWidthSelect (long lValue, bool bValuable, SfxMapUnit eMapUnit); + +private: + void PopupModeEndCallback (void); +}; + +} } // end of namespace svx::sidebar + +#endif + +// eof diff --git a/svx/source/sidebar/line/LineWidthValueSet.cxx b/svx/source/sidebar/line/LineWidthValueSet.cxx new file mode 100644 index 000000000000..ffecfb29b926 --- /dev/null +++ b/svx/source/sidebar/line/LineWidthValueSet.cxx @@ -0,0 +1,192 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "LineWidthValueSet.hxx" + +#include <i18nlangtag/mslangid.hxx> + +namespace svx { namespace sidebar { + + +LineWidthValueSet::LineWidthValueSet ( + Window* pParent, const ResId& rResId) + : ValueSet( pParent, rResId ), + pVDev(NULL), + nSelItem(0), + bCusEnable(false) +{ + strUnit = new XubString[9]; + SetColCount( 1 ); + SetLineCount( 9); +} + + + + +LineWidthValueSet::~LineWidthValueSet (void) +{ + delete pVDev; + delete[] strUnit; +} + + + + +void LineWidthValueSet::SetUnit(XubString* str) +{ + for(int i = 0; i < 9; i++) + { + strUnit[i] = str[i]; + } +} + + + +void LineWidthValueSet::SetSelItem(sal_uInt16 nSel) +{ + nSelItem = nSel; + if(nSel == 0) + { + SelectItem(1); // ,false); // 'false' nut supported by AOO + SetNoSelection(); + } + else + { + SelectItem(nSelItem); + GrabFocus(); + } +} + + + + +sal_uInt16 LineWidthValueSet::GetSelItem() +{ + return nSelItem; +} + + + + +void LineWidthValueSet::SetImage(Image img) +{ + imgCus = img; +} + + + + +void LineWidthValueSet::SetCusEnable(bool bEnable) +{ + bCusEnable = bEnable; +} + + + + +void LineWidthValueSet::UserDraw( const UserDrawEvent& rUDEvt ) +{ + Rectangle aRect = rUDEvt.GetRect(); + OutputDevice* pDev = rUDEvt.GetDevice(); + sal_uInt16 nItemId = rUDEvt.GetItemId(); + + long nRectHeight = aRect.GetHeight(); + long nRectWidth = aRect.GetWidth(); + Point aBLPos = aRect.TopLeft(); + + //const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + //Color aBackColor(0,0,200); + //const Color aTextColor = rStyleSettings.GetFieldTextColor(); + Font aOldFont = pDev->GetFont(); + Color aOldColor = pDev->GetLineColor(); + Color aOldFillColor = pDev->GetFillColor(); + + Font aFont(OutputDevice::GetDefaultFont(DEFAULTFONT_UI_SANS, MsLangId::getSystemLanguage(), DEFAULTFONT_FLAGS_ONLYONE)); + Size aSize = aFont.GetSize(); + aSize.Height() = nRectHeight*3/5; + aFont.SetSize( aSize ); + + Point aLineStart(aBLPos.X() + 5, aBLPos.Y() + ( nRectHeight - nItemId )/2); + Point aLineEnd(aBLPos.X() + nRectWidth * 7 / 9 - 10, aBLPos.Y() + ( nRectHeight - nItemId )/2); + if(nItemId == 9) + { + Point aImgStart(aBLPos.X() + 5, aBLPos.Y() + ( nRectHeight - 23 ) / 2); + pDev->DrawImage(aImgStart, imgCus); + // Point aStart(aImgStart.X() + 14 + 20 , aBLPos.Y() + nRectHeight/6); + Rectangle aStrRect = aRect; + aStrRect.Top() += nRectHeight/6; + aStrRect.Bottom() -= nRectHeight/6; + aStrRect.Left() += imgCus.GetSizePixel().Width() + 20; + if(bCusEnable) + aFont.SetColor(GetSettings().GetStyleSettings().GetFieldTextColor()); + else + aFont.SetColor(GetSettings().GetStyleSettings().GetDisableColor()); + + pDev->SetFont(aFont); + pDev->DrawText(aStrRect, strUnit[ nItemId - 1 ], TEXT_DRAW_ENDELLIPSIS); + } + else + { + if( nSelItem == nItemId ) + { + Color aBackColor(50,107,197); + Rectangle aBackRect = aRect; + aBackRect.Top() += 3; + aBackRect.Bottom() -= 2; + pDev->SetFillColor(aBackColor); + pDev->DrawRect(aBackRect); + } + else + { + pDev->SetFillColor( COL_TRANSPARENT ); + pDev->DrawRect(aRect); + } + + //draw text + if(nSelItem == nItemId ) + aFont.SetColor(COL_WHITE); + else + aFont.SetColor(GetSettings().GetStyleSettings().GetFieldTextColor()); + pDev->SetFont(aFont); + Point aStart(aBLPos.X() + nRectWidth * 7 / 9 , aBLPos.Y() + nRectHeight/6); + pDev->DrawText(aStart, strUnit[ nItemId - 1 ]); //can't set TEXT_DRAW_ENDELLIPSIS here ,or the text will disappear + + //draw line + if( nSelItem == nItemId ) + pDev->SetLineColor(COL_WHITE); + else + pDev->SetLineColor(GetSettings().GetStyleSettings().GetFieldTextColor()); + + for(sal_uInt16 i = 1; i <= nItemId; i++) + { + pDev->DrawLine(aLineStart,aLineEnd ); + aLineStart.setY(aLineStart.getY() + 1); + aLineEnd.setY (aLineEnd.getY() + 1); + } + } + + Invalidate( aRect ); + pDev->SetLineColor(aOldColor); + pDev->SetFillColor(aOldFillColor); + pDev->SetFont(aOldFont); +} + + + +} } // end of namespace svx::sidebar + +// eof diff --git a/svx/source/sidebar/line/LineWidthValueSet.hxx b/svx/source/sidebar/line/LineWidthValueSet.hxx new file mode 100644 index 000000000000..1e97af100e25 --- /dev/null +++ b/svx/source/sidebar/line/LineWidthValueSet.hxx @@ -0,0 +1,53 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SVX_SIDEBAR_LINE_WIDTH_VALUE_SET_HXX +#define SVX_SIDEBAR_LINE_WIDTH_VALUE_SET_HXX + +#include <svtools/valueset.hxx> +#include <vcl/image.hxx> + +namespace svx { namespace sidebar { + +class LineWidthValueSet + : public ValueSet +{ +public: + LineWidthValueSet (Window* pParent, const ResId& rResId); + virtual ~LineWidthValueSet (void); + + void SetUnit(XubString* str); + void SetSelItem(sal_uInt16 nSel); + sal_uInt16 GetSelItem(); + void SetImage(Image img); + void SetCusEnable(bool bEnable); + + virtual void UserDraw( const UserDrawEvent& rUDEvt ); + +protected: + VirtualDevice* pVDev; + sal_uInt16 nSelItem; + XubString* strUnit; + Image imgCus; + bool bCusEnable; +}; + +} } // end of namespace svx::sidebar + +#endif // SVX_SIDEBAR_LINE_WIDTH_VALUE_SET_HXX + +// eof diff --git a/svx/source/sidebar/nbdtmg.cxx b/svx/source/sidebar/nbdtmg.cxx new file mode 100644 index 000000000000..2acc98dc04d0 --- /dev/null +++ b/svx/source/sidebar/nbdtmg.cxx @@ -0,0 +1,2051 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include <svx/nbdtmg.hxx> +#include <svx/svxids.hrc> +#include <vcl/svapp.hxx> +#include <svl/itemset.hxx> +#include <sfx2/request.hxx> +#include <svl/stritem.hxx> +#include <editeng/unolingu.hxx> +#include <svtools/ctrltool.hxx> +#include <sfx2/objsh.hxx> +#include <editeng/flstitem.hxx> +#include <svl/itempool.hxx> +#include <vcl/outdev.hxx> +#include <svx/gallery.hxx> +#include <editeng/brushitem.hxx> +#include <svx/dialmgr.hxx> +#include <svx/dialogs.hrc> +#include <vcl/graph.hxx> + +#include <unotools/streamwrap.hxx> +#include <unotools/ucbstreamhelper.hxx> +#include <unotools/pathoptions.hxx> +#include <editeng/eeitem.hxx> + +#include <com/sun/star/text/HoriOrientation.hpp> +#include <com/sun/star/text/VertOrientation.hpp> +#include <com/sun/star/text/RelOrientation.hpp> +#include <com/sun/star/style/NumberingType.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/text/XDefaultNumberingProvider.hpp> +#include <com/sun/star/text/XNumberingFormatter.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <comphelper/processfactory.hxx> +#include <com/sun/star/text/XNumberingTypeInfo.hpp> + +using namespace com::sun::star; +using namespace com::sun::star::uno; +using namespace com::sun::star::beans; +using namespace com::sun::star::lang; +using namespace com::sun::star::text; +using namespace com::sun::star::container; +using namespace com::sun::star::style; +using rtl::OUString; + +namespace svx { namespace sidebar { +#define MAX_VALUESET_GRAPHIC 30 + +Font& lcl_GetDefaultBulletFont() +{ + static sal_Bool bInit = 0; + static Font aDefBulletFont( OUString("StarSymbol" ), + String(), Size( 0, 14 ) ); + if(!bInit) + { + aDefBulletFont.SetCharSet( RTL_TEXTENCODING_SYMBOL ); + aDefBulletFont.SetFamily( FAMILY_DONTKNOW ); + aDefBulletFont.SetPitch( PITCH_DONTKNOW ); + aDefBulletFont.SetWeight( WEIGHT_DONTKNOW ); + aDefBulletFont.SetTransparent( sal_True ); + bInit = sal_True; + } + return aDefBulletFont; +} + +static const sal_Unicode aDefaultBulletTypes[] = +{ + 0x2022, + 0x25cf, + 0xe00c, + 0xe00a, + 0x2794, + 0x27a2, + 0x2717, + 0x2714 +}; + +static const sal_Unicode aDefaultRTLBulletTypes[] = +{ + 0x2022, + 0x25cf, + 0xe00c, + 0xe00a, + 0x25c4, + 0x272b, + 0x2717, + 0x2714 +}; + +static const sal_Char sNumberingType[] = "NumberingType"; +static const sal_Char sValue[] = "Value"; +static const sal_Char sParentNumbering[] = "ParentNumbering"; +static const sal_Char sPrefix[] = "Prefix"; +static const sal_Char sSuffix[] = "Suffix"; +static const sal_Char sBulletChar[] = "BulletChar"; +static const sal_Char sBulletFontName[] = "BulletFontName"; + +NumSettings_ImplPtr lcl_CreateNumberingSettingsPtr(const Sequence<PropertyValue>& rLevelProps) +{ + const PropertyValue* pValues = rLevelProps.getConstArray(); + NumSettings_ImplPtr pNew = new NumSettings_Impl; + for(sal_Int32 j = 0; j < rLevelProps.getLength(); j++) + { + if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sNumberingType))) + pValues[j].Value >>= pNew->nNumberType; + else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sPrefix))) + pValues[j].Value >>= pNew->sPrefix; + else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sSuffix))) + pValues[j].Value >>= pNew->sSuffix; + else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sParentNumbering))) + pValues[j].Value >>= pNew->nParentNumbering; + else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sBulletChar))) + pValues[j].Value >>= pNew->sBulletChar; + else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sBulletFontName))) + pValues[j].Value >>= pNew->sBulletFont; + } + const sal_Unicode cLocalPrefix = pNew->sPrefix.getLength() ? pNew->sPrefix.getStr()[0] : 0; + const sal_Unicode cLocalSuffix = pNew->sSuffix.getLength() ? pNew->sSuffix.getStr()[0] : 0; + String aEmptyStr; + if( cLocalPrefix == ' ') pNew->sPrefix=aEmptyStr; + if( cLocalSuffix == ' ') pNew->sSuffix=aEmptyStr; + return pNew; +} + +sal_uInt16 NBOTypeMgrBase:: IsSingleLevel(sal_uInt16 nCurLevel) +{ + sal_uInt16 nLv = (sal_uInt16)0xFFFF; + sal_uInt16 nCount = 0; + sal_uInt16 nMask = 1; + for( sal_uInt16 i = 0; i < SVX_MAX_NUM; i++ ) + { + if(nCurLevel & nMask) + { + nCount++; + nLv=i; + } + nMask <<= 1 ; + } + + if ( nCount == 1) + return nLv; + else + return (sal_uInt16)0xFFFF; +} + +void NBOTypeMgrBase::StoreBulCharFmtName_impl() { + if ( pSet ) + { + SfxAllItemSet aSet(*pSet); + SFX_ITEMSET_ARG(&aSet,pBulletCharFmt,SfxStringItem,SID_BULLET_CHAR_FMT,sal_False); + + if ( pBulletCharFmt ) + { + aNumCharFmtName = String(pBulletCharFmt->GetValue()); + } + } +} +String NBOTypeMgrBase::GetBulCharFmtName() +{ + return aNumCharFmtName; +} +void NBOTypeMgrBase::ImplLoad(String filename) +{ + bIsLoading = true; + SfxMapUnit eOldCoreUnit=eCoreUnit; + eCoreUnit = SFX_MAPUNIT_100TH_MM; + INetURLObject aFile( SvtPathOptions().GetPalettePath() ); + aFile.Append( filename); + SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( aFile.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ ); + if( pIStm ) { + sal_uInt32 nVersion; + sal_Int32 nNumIndex; + *pIStm >> nVersion; + if (nVersion==DEFAULT_NUMBERING_CACHE_FORMAT_VERSION) //first version + { + *pIStm >> nNumIndex; + sal_uInt16 mLevel = 0x1; + while (nNumIndex>=0 && nNumIndex<DEFAULT_NUM_VALUSET_COUNT) { + SvxNumRule aNum(*pIStm); + //bullet color in font properties is not stored correctly. Need set tranparency bits manually + for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++) + { + SvxNumberFormat aFmt(aNum.GetLevel(i)); + if (aFmt.GetBulletFont()) { + Font aFont(*aFmt.GetBulletFont()); + Color c=aFont.GetColor(); + c.SetTransparency(0xFF); + aFont.SetColor(c); + aFmt.SetBulletFont(&aFont); + aNum.SetLevel(i, aFmt); + } + } + RelplaceNumRule(aNum,nNumIndex,mLevel); + *pIStm >> nNumIndex; + } + delete pIStm; + } + } + eCoreUnit = eOldCoreUnit; + bIsLoading = false; +} +void NBOTypeMgrBase::ImplStore(String filename) +{ + if (bIsLoading) return; + SfxMapUnit eOldCoreUnit=eCoreUnit; + eCoreUnit = SFX_MAPUNIT_100TH_MM; + INetURLObject aFile( SvtPathOptions().GetPalettePath() ); + aFile.Append( filename); + SvStream* pOStm = ::utl::UcbStreamHelper::CreateStream( aFile.GetMainURL( INetURLObject::NO_DECODE ), STREAM_WRITE ); + if( pOStm ) { + sal_uInt32 nVersion; + sal_Int32 nNumIndex; + nVersion = DEFAULT_NUMBERING_CACHE_FORMAT_VERSION; + *pOStm << nVersion; + for(sal_Int32 nItem = 0; nItem < DEFAULT_NUM_VALUSET_COUNT; nItem++ ) { + if (IsCustomized(nItem)) { + SvxNumRule aDefNumRule( NUM_BULLET_REL_SIZE|NUM_CONTINUOUS|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE|NUM_SYMBOL_ALIGNMENT,10, sal_False , + SVX_RULETYPE_NUMBERING,SvxNumberFormat::LABEL_ALIGNMENT); + sal_uInt16 mLevel = 0x1; + *pOStm << nItem; + ApplyNumRule(aDefNumRule,nItem,mLevel,false,true); + aDefNumRule.Store(*pOStm); + } + } + nNumIndex = -1; + *pOStm << nNumIndex; //write end flag + delete pOStm; + } + eCoreUnit = eOldCoreUnit; +} + +void NBOTypeMgrBase::StoreMapUnit_impl() { + if ( pSet ) + { + const SfxPoolItem* pItem; + SfxItemState eState = pSet->GetItemState(SID_ATTR_NUMBERING_RULE, sal_False, &pItem); + if(eState == SFX_ITEM_SET) + { + eCoreUnit = pSet->GetPool()->GetMetric(pSet->GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE)); + } else { + //Sym3_2508 sd use different sid for numbering rule + eState = pSet->GetItemState(EE_PARA_NUMBULLET, sal_False, &pItem); + if(eState == SFX_ITEM_SET) + { + eCoreUnit = pSet->GetPool()->GetMetric(pSet->GetPool()->GetWhich(EE_PARA_NUMBULLET)); + } + } + } +} +SfxMapUnit NBOTypeMgrBase::GetMapUnit() +{ + return eCoreUnit; +} +/*************************************************************************************************** +**********************Character Bullet Type lib********************************************************** +****************************************************************************************************/ +BulletsTypeMgr* BulletsTypeMgr::_instance = 0; +BulletsSettings_Impl* BulletsTypeMgr::pActualBullets[] ={0,0,0,0,0,0,0,0}; +sal_Unicode BulletsTypeMgr::aDynamicBulletTypes[]={' ',' ',' ',' ',' ',' ',' ',' '}; +sal_Unicode BulletsTypeMgr::aDynamicRTLBulletTypes[]={' ',' ',' ',' ',' ',' ',' ',' '}; + +BulletsTypeMgr::BulletsTypeMgr(const NBOType aType): + NBOTypeMgrBase(aType) +{ + Init(); +} + +BulletsTypeMgr::BulletsTypeMgr(const NBOType aType,const SfxItemSet* pArg): + NBOTypeMgrBase(aType,pArg) +{ + Init(); +} + +BulletsTypeMgr::BulletsTypeMgr(const BulletsTypeMgr& aTypeMgr): + NBOTypeMgrBase(aTypeMgr) +{ + for (sal_uInt16 i=0;i<DEFAULT_BULLET_TYPES;i++) + { + pActualBullets[i]->bIsCustomized = aTypeMgr.pActualBullets[i]->bIsCustomized; + pActualBullets[i]->cBulletChar = aTypeMgr.pActualBullets[i]->cBulletChar; + pActualBullets[i]->aFont = aTypeMgr.pActualBullets[i]->aFont; + pActualBullets[i]->sDescription = aTypeMgr. pActualBullets[i]->sDescription; + pActualBullets[i]->eType = aTypeMgr. pActualBullets[i]->eType; + } +} +void BulletsTypeMgr::Init() +{ + Font& rActBulletFont = lcl_GetDefaultBulletFont(); + String sName = rActBulletFont.GetName(); + if( Application::GetSettings().GetLayoutRTL() ) + { + for (sal_uInt16 i=0;i<DEFAULT_BULLET_TYPES;i++) + { + pActualBullets[i] = new BulletsSettings_Impl(eNBType::BULLETS); + pActualBullets[i]->cBulletChar = aDefaultRTLBulletTypes[i]; + pActualBullets[i]->aFont = rActBulletFont; + if (i==4 || i==5) + pActualBullets[i]->sDescription = SVX_RESSTR( RID_SVXSTR_BULLET_RTL_DESCRIPTION_4 - 4 + i ); + else + pActualBullets[i]->sDescription = SVX_RESSTR( RID_SVXSTR_BULLET_DESCRIPTION_0 + i ); + } + }else + { + for (sal_uInt16 i=0;i<DEFAULT_BULLET_TYPES;i++) + { + pActualBullets[i] = new BulletsSettings_Impl(eNBType::BULLETS); + pActualBullets[i]->cBulletChar = aDefaultBulletTypes[i]; + pActualBullets[i]->aFont =rActBulletFont; + pActualBullets[i]->sDescription = SVX_RESSTR( RID_SVXSTR_BULLET_DESCRIPTION_0 + i ); + } + } +} +sal_uInt16 BulletsTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex) +{ + if ( mLevel == (sal_uInt16)0xFFFF || mLevel == 0) + return (sal_uInt16)0xFFFF; + //if ( !lcl_IsNumFmtSet(pNR, mLevel) ) return (sal_uInt16)0xFFFF; + + sal_uInt16 nActLv = IsSingleLevel(mLevel); + + if ( nActLv == (sal_uInt16)0xFFFF ) + return (sal_uInt16)0xFFFF; + + SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); + sal_Unicode cChar = aFmt.GetBulletChar(); + //const Font* pFont = aFmt.GetBulletFont(); + //sal_uInt16 nLength = 0; + /*if( Application::GetSettings().GetLayoutRTL() ) + { + nLength = sizeof(aDynamicRTLBulletTypes)/sizeof(sal_Unicode); + for(sal_uInt16 i = 0; i < nLength; i++) + { + if ( cChar == aDynamicRTLBulletTypes[i] || + (cChar == 9830 && 57356 == aDynamicRTLBulletTypes[i]) || + (cChar == 9632 && 57354 == aDynamicRTLBulletTypes[i]) ) + { + return i+1; + } + } + } else + { + nLength = sizeof(aDynamicBulletTypes)/sizeof(sal_Unicode); + for(sal_uInt16 i = 0; i < nLength; i++) + { + if ( cChar == aDynamicBulletTypes[i] || + (cChar == 9830 && 57356 == aDynamicBulletTypes[i]) || + (cChar == 9632 && 57354 == aDynamicBulletTypes[i]) ) + { + return i+1; + } + } + }*/ + //nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl); + for(sal_uInt16 i = nFromIndex; i < DEFAULT_BULLET_TYPES; i++) + { + if ( (cChar == pActualBullets[i]->cBulletChar|| + (cChar == 9830 && 57356 == pActualBullets[i]->cBulletChar) || + (cChar == 9632 && 57354 == pActualBullets[i]->cBulletChar)))// && pFont && (pFont->GetName().CompareTo(pActualBullets[i]->aFont.GetName())==COMPARE_EQUAL)) + { + return i+1; + } + } + + return (sal_uInt16)0xFFFF; +} + +sal_Bool BulletsTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel) +{ + if ( mLevel == (sal_uInt16)0xFFFF || mLevel == 0) + return sal_False; + + if ( GetNBOIndexForNumRule(aNum,mLevel) != (sal_uInt16)0xFFFF ) + return sal_False; + + sal_uInt16 nActLv = IsSingleLevel(mLevel); + + if ( nActLv == (sal_uInt16)0xFFFF ) + return sal_False; + + SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); + sal_Unicode cChar = aFmt.GetBulletChar(); + const Font* pFont = aFmt.GetBulletFont(); + //sal_uInt16 nLength = 0; + /*if( Application::GetSettings().GetLayoutRTL() ) + { + nLength = sizeof(aDynamicRTLBulletTypes)/sizeof(sal_Unicode); + + if ( nIndex >= nLength ) + return sal_False; + + aDynamicRTLBulletTypes[nIndex] = cChar; + } else + { + nLength = sizeof(aDynamicBulletTypes)/sizeof(sal_Unicode); + + if ( nIndex >= nLength ) + return sal_False; + + aDynamicBulletTypes[nIndex] = cChar; + }*/ + //nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl); + if ( nIndex >= DEFAULT_BULLET_TYPES ) + return sal_False; + + pActualBullets[nIndex]->cBulletChar = cChar; + if ( pFont ) + pActualBullets[nIndex]->aFont = *pFont; + pActualBullets[nIndex]->bIsCustomized = sal_True; + + String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION)); + String aReplace = OUString("%LIST_NUM"); + String sNUM = OUString::number( nIndex + 1 ); + aStrFromRES.SearchAndReplace(aReplace,sNUM); + pActualBullets[nIndex]->sDescription = aStrFromRES; + + return sal_True; +} + +sal_Bool BulletsTypeMgr::ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel,sal_Bool /*isDefault*/,sal_Bool isResetSize) +{ + //if ( mLevel == (sal_uInt16)0xFFFF ) + // return sal_False; + + sal_Unicode cChar; + //sal_uInt16 nLength = 0; + /*if( Application::GetSettings().GetLayoutRTL() ) + { + nLength = sizeof(aDynamicRTLBulletTypes)/sizeof(sal_Unicode); + + if ( nIndex >= nLength ) + return sal_False; + + cChar = aDynamicRTLBulletTypes[nIndex]; + }else + { + nLength = sizeof(aDynamicBulletTypes)/sizeof(sal_Unicode); + + if ( nIndex >= nLength ) + return sal_False; + + cChar = aDynamicBulletTypes[nIndex]; + }*/ + //nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl); + if ( nIndex >= DEFAULT_BULLET_TYPES ) + return sal_False; + cChar = pActualBullets[nIndex]->cBulletChar; + //Font& rActBulletFont = lcl_GetDefaultBulletFont(); + Font rActBulletFont = pActualBullets[nIndex]->aFont; + + sal_uInt16 nMask = 1; + String sBulletCharFmtName = GetBulCharFmtName(); + for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++) + { + if(mLevel & nMask) + { + SvxNumberFormat aFmt(aNum.GetLevel(i)); + aFmt.SetNumberingType( SVX_NUM_CHAR_SPECIAL ); + aFmt.SetBulletFont(&rActBulletFont); + aFmt.SetBulletChar(cChar ); + aFmt.SetCharFmtName(sBulletCharFmtName); + if (isResetSize) aFmt.SetBulletRelSize(45); + aNum.SetLevel(i, aFmt); + } + nMask <<= 1; + } + + return sal_True; +} + +String BulletsTypeMgr::GetDescription(sal_uInt16 nIndex,sal_Bool /*isDefault*/) +{ + String sRet; + //sal_uInt16 nLength = 0; + //nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl); + + if ( nIndex >= DEFAULT_BULLET_TYPES ) + return sRet; + else + sRet = pActualBullets[nIndex]->sDescription; + + return sRet; +} +sal_Bool BulletsTypeMgr::IsCustomized(sal_uInt16 nIndex) +{ + sal_Bool bRet = sal_False; + //sal_uInt16 nLength = 0; + //nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl); + + if ( nIndex >= DEFAULT_BULLET_TYPES ) + bRet = sal_False; + else + bRet = pActualBullets[nIndex]->bIsCustomized; + + return bRet; +} + +sal_Unicode BulletsTypeMgr::GetBulChar(sal_uInt16 nIndex) +{ + sal_Unicode cChar; + //sal_uInt16 nLength = 0; + //nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl); + + if ( nIndex >= DEFAULT_BULLET_TYPES ) + cChar = ' '; + else + cChar = pActualBullets[nIndex]->cBulletChar; + + /*if( Application::GetSettings().GetLayoutRTL() ) + { + nLength = sizeof(aDynamicRTLBulletTypes)/sizeof(sal_Unicode); + + if ( nIndex >= nLength ) + cChar = ' '; + else + cChar = aDynamicRTLBulletTypes[nIndex]; + }else + { + nLength = sizeof(aDynamicBulletTypes)/sizeof(sal_Unicode); + + if ( nIndex >= nLength ) + cChar = ' '; + else + cChar = aDynamicBulletTypes[nIndex]; + }*/ + + return cChar; +} +Font BulletsTypeMgr::GetBulCharFont(sal_uInt16 nIndex) +{ + Font aRet; + if ( nIndex >= DEFAULT_BULLET_TYPES ) + aRet = lcl_GetDefaultBulletFont(); + else + aRet = pActualBullets[nIndex]->aFont; + + return aRet; +} +/*************************************************************************************************** +**********************Graphic Bullet Type lib*********************************************************** +****************************************************************************************************/ +GraphyicBulletsTypeMgr* GraphyicBulletsTypeMgr::_instance = 0; +GraphyicBulletsTypeMgr::GraphyicBulletsTypeMgr(const NBOType aType): + NBOTypeMgrBase(aType) +{ + Init(); +} + +GraphyicBulletsTypeMgr::GraphyicBulletsTypeMgr(const NBOType aType,const SfxItemSet* pArg): + NBOTypeMgrBase(aType,pArg) +{ + Init(); +} +GraphyicBulletsTypeMgr::GraphyicBulletsTypeMgr(const GraphyicBulletsTypeMgr& aTypeMgr): + NBOTypeMgrBase(aTypeMgr) +{ + for (sal_uInt16 i=0;i< aTypeMgr.aGrfDataLst.size();++i) + { + GrfBulDataRelation* pEntry = new GrfBulDataRelation(eNBType::GRAPHICBULLETS); + GrfBulDataRelation* pSrcEntry = i < aTypeMgr.aGrfDataLst.size() ? aTypeMgr.aGrfDataLst[i] : NULL; + if ( pEntry && pSrcEntry) + { + pEntry->bIsCustomized = pSrcEntry->bIsCustomized; + pEntry->nTabIndex = pSrcEntry->nTabIndex; + pEntry->nGallaryIndex = pSrcEntry->nGallaryIndex; + pEntry->sGrfName = pSrcEntry->sGrfName; + pEntry->sDescription = pSrcEntry->sDescription; + aGrfDataLst.push_back(pEntry); + } + } +} + +GraphyicBulletsTypeMgr::~GraphyicBulletsTypeMgr() +{ + for (size_t i = 0; i < aGrfDataLst.size(); ++i) + delete aGrfDataLst[i]; +} + +void GraphyicBulletsTypeMgr::Init() +{ + std::vector<String> aGrfNames; + GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, aGrfNames); + for(sal_uInt16 i = 0; i < aGrfNames.size(); i++) + { + String sGrfNm = aGrfNames[i]; + INetURLObject aObj(sGrfNm); + if(aObj.GetProtocol() == INET_PROT_FILE) + sGrfNm = aObj.PathToFileName(); + + GrfBulDataRelation* pEntry = new GrfBulDataRelation(eNBType::GRAPHICBULLETS); + pEntry->nTabIndex = i+1; + pEntry->nGallaryIndex = i; + pEntry->sGrfName = sGrfNm; + + if( i < MAX_VALUESET_GRAPHIC ) + { + pEntry->sDescription = SVX_RESSTR( RID_SVXSTR_GRAPHICS_DESCRIPTIONS + i ); + }else + { + pEntry->sDescription = sGrfNm; + } + + aGrfDataLst.push_back(pEntry); + } +} +sal_uInt16 GraphyicBulletsTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 /*nFromIndex*/) +{ + if ( mLevel == (sal_uInt16)0xFFFF || mLevel == 0) + return (sal_uInt16)0xFFFF; + + sal_uInt16 nActLv = IsSingleLevel(mLevel); + + if ( nActLv == (sal_uInt16)0xFFFF ) + return (sal_uInt16)0xFFFF; + + SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); + const SvxBrushItem* pBrsh = aFmt.GetBrush(); + const Graphic* pGrf = 0; + if ( pBrsh ) + pGrf = pBrsh->GetGraphic(); + + if ( pGrf ) + { + //const String* pGrfName = pBrsh->GetGraphicLink(); + Graphic aGraphic; + for (sal_uInt16 i=0; i < aGrfDataLst.size(); ++i) + { + GrfBulDataRelation* pEntry = aGrfDataLst[i]; + sal_Bool bExist = sal_False; + if ( pEntry) // && pEntry->sGrfName.CompareTo(*pGrfName)==COMPARE_EQUAL ) + bExist = GalleryExplorer::GetGraphicObj(GALLERY_THEME_BULLETS, pEntry->nGallaryIndex,&aGraphic); + if (bExist) { + Bitmap aSum=pGrf->GetBitmap(); + Bitmap aSum1=aGraphic.GetBitmap(); + if (aSum.IsEqual(aSum1)) + return pEntry->nTabIndex; + } + } + } + + return (sal_uInt16)0xFFFF; +} + +sal_Bool GraphyicBulletsTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel) +{ + if ( mLevel == (sal_uInt16)0xFFFF || mLevel > aNum.GetLevelCount() || mLevel == 0) + return sal_False; + + if ( GetNBOIndexForNumRule(aNum,mLevel) != (sal_uInt16)0xFFFF ) + return sal_False; + + if ( nIndex >= aGrfDataLst.size() ) + return sal_False; + + sal_uInt16 nActLv = IsSingleLevel(mLevel); + if ( nActLv == (sal_uInt16)0xFFFF ) + return sal_False; + + SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); + const SvxBrushItem* pBrsh = aFmt.GetBrush(); + const Graphic* pGrf = 0; + if ( pBrsh ) + pGrf = pBrsh->GetGraphic(); + else + return sal_False; + + String sEmpty; + if ( pGrf ) + { + const String* pGrfName = pBrsh->GetGraphicLink(); + //String* pGrfName = (String*)(pBrsh->GetGraphicLink()); + GrfBulDataRelation* pEntry = aGrfDataLst[nIndex]; + if ( pGrfName ) + pEntry->sGrfName = *pGrfName; + //pEntry->sDescription = sEmpty; + pEntry->nGallaryIndex = (sal_uInt16)0xFFFF; + pEntry->bIsCustomized = sal_True; + String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION)); + String aReplace = OUString("%LIST_NUM"); + String sNUM = OUString::number( nIndex + 1 ); + aStrFromRES.SearchAndReplace(aReplace,sNUM); + pEntry->sDescription = aStrFromRES; + }else + { + return sal_False; + } + + return sal_True; +} + +sal_Bool GraphyicBulletsTypeMgr::ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel,sal_Bool /*isDefault*/,sal_Bool /*isResetSize*/) +{ + //if ( mLevel == (sal_uInt16)0xFFFF ) + // return sal_False; + + if ( nIndex >= aGrfDataLst.size() ) + return sal_False; + + String sGrfName; + GrfBulDataRelation* pEntry = aGrfDataLst[nIndex]; + sGrfName= pEntry->sGrfName; + + sal_uInt16 nMask = 1; + String aEmptyStr; + sal_uInt16 nSetNumberingType = SVX_NUM_BITMAP; + String sNumCharFmtName = GetBulCharFmtName(); + for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++) + { + if(mLevel & nMask) + { + SvxNumberFormat aFmt(aNum.GetLevel(i)); + aFmt.SetNumberingType(nSetNumberingType); + aFmt.SetPrefix( aEmptyStr ); + aFmt.SetSuffix( aEmptyStr ); + aFmt.SetCharFmtName( sNumCharFmtName ); + + Graphic aGraphic; + if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, pEntry->nGallaryIndex, &aGraphic)) + { + Size aSize = SvxNumberFormat::GetGraphicSizeMM100(&aGraphic); + sal_Int16 eOrient = text::VertOrientation::LINE_CENTER; + aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)GetMapUnit()); + SvxBrushItem aBrush(aGraphic, GPOS_AREA, SID_ATTR_BRUSH ); + aFmt.SetGraphicBrush( &aBrush, &aSize, &eOrient ); + } + else// if(pGrfName) + aFmt.SetGraphic( sGrfName ); + + aNum.SetLevel(i, aFmt); + } + nMask <<= 1 ; + } + + return sal_True; +} +String GraphyicBulletsTypeMgr::GetDescription(sal_uInt16 nIndex,sal_Bool /*isDefault*/) +{ + String sRet; + sal_uInt16 nLength = 0; + nLength = aGrfDataLst.size(); + + if ( nIndex >= nLength ) + return sRet; + else + { + GrfBulDataRelation* pEntry = aGrfDataLst[nIndex]; + if ( pEntry ) + { + sRet = pEntry->sDescription; + }; + } + return sRet; +} +sal_Bool GraphyicBulletsTypeMgr::IsCustomized(sal_uInt16 nIndex) +{ + sal_Bool bRet = sal_False; + + sal_uInt16 nLength = 0; + nLength = aGrfDataLst.size() ; + + if ( nIndex >= nLength ) + return bRet; + else + { + GrfBulDataRelation* pEntry = aGrfDataLst[nIndex]; + if ( pEntry ) + { + bRet = pEntry->bIsCustomized; + }; + } + + return bRet; +} +String GraphyicBulletsTypeMgr::GetGrfName(sal_uInt16 nIndex) +{ + String sRet; + if ( nIndex < aGrfDataLst.size() ) + { + GrfBulDataRelation* pEntry = aGrfDataLst[nIndex]; + if ( pEntry ) + { + sRet = pEntry->sGrfName; + } + } + + return sRet; +} +/*************************************************************************************************** +**********************Mix Bullets Type lib************************************************************** +****************************************************************************************************/ +MixBulletsTypeMgr* MixBulletsTypeMgr::_instance = 0; +MixBulletsSettings_Impl* MixBulletsTypeMgr::pActualBullets[] ={0,0,0,0,0,0,0,0}; +MixBulletsSettings_Impl* MixBulletsTypeMgr::pDefaultActualBullets[] ={0,0,0,0,0,0,0,0}; + +MixBulletsTypeMgr::MixBulletsTypeMgr(const NBOType aType): + NBOTypeMgrBase(aType) +{ + Init(); + for(sal_Int32 nItem = 0; nItem < DEFAULT_BULLET_TYPES; nItem++ ) + { + pDefaultActualBullets[nItem] = pActualBullets[nItem]; + } + //Initial the first time to store the default value. Then do it again for customized value + Init(); + ImplLoad(OUString("standard.sya")); +} + +MixBulletsTypeMgr::MixBulletsTypeMgr(const NBOType aType,const SfxItemSet* pArg): + NBOTypeMgrBase(aType,pArg) +{ + Init(); + for(sal_Int32 nItem = 0; nItem < DEFAULT_BULLET_TYPES; nItem++ ) + { + pDefaultActualBullets[nItem] = pActualBullets[nItem]; + } + //Initial the first time to store the default value. Then do it again for customized value + Init(); + ImplLoad(OUString("standard.sya")); +} + +MixBulletsTypeMgr::MixBulletsTypeMgr(const MixBulletsTypeMgr& aTypeMgr): + NBOTypeMgrBase(aTypeMgr) +{ + for (sal_uInt16 i=0;i<DEFAULT_BULLET_TYPES;i++) + { + if ( aTypeMgr.pActualBullets[i]->eType == eNBType::BULLETS ) + { + pActualBullets[i]->eType = aTypeMgr.pActualBullets[i]->eType; + pActualBullets[i]->nIndex = aTypeMgr.pActualBullets[i]->nIndex; //index in the tab page display + pActualBullets[i]->nIndexDefault = aTypeMgr.pActualBullets[i]->nIndexDefault; + pActualBullets[i]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ; + ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->cBulletChar = ((BulletsSettings_Impl*)(aTypeMgr.pActualBullets[i]->pBullets))->cBulletChar; + ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->aFont = ((BulletsSettings_Impl*)(aTypeMgr.pActualBullets[i]->pBullets))->aFont; + ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->sDescription = ((BulletsSettings_Impl*)(aTypeMgr.pActualBullets[i]->pBullets))->sDescription; + ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->bIsCustomized = ((BulletsSettings_Impl*)(aTypeMgr.pActualBullets[i]->pBullets))->bIsCustomized; + ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->eType = ((BulletsSettings_Impl*)(aTypeMgr.pActualBullets[i]->pBullets))->eType; + }else if ( aTypeMgr.pActualBullets[i]->eType == eNBType::GRAPHICBULLETS ) + { + pActualBullets[i]->eType = aTypeMgr.pActualBullets[i]->eType; + pActualBullets[i]->nIndex = aTypeMgr.pActualBullets[i]->nIndex; //index in the tab page display + pActualBullets[i]->nIndexDefault = aTypeMgr.pActualBullets[i]->nIndexDefault; + pActualBullets[i]->pBullets = new GrfBulDataRelation(eNBType::GRAPHICBULLETS) ; + ((GrfBulDataRelation*)(pActualBullets[i]->pBullets))->sGrfName = ((GrfBulDataRelation*)(aTypeMgr.pActualBullets[i]->pBullets))->sGrfName; + ((GrfBulDataRelation*)(pActualBullets[i]->pBullets))->sDescription = ((GrfBulDataRelation*)(aTypeMgr.pActualBullets[i]->pBullets))->sDescription; + ((GrfBulDataRelation*)(pActualBullets[i]->pBullets))->bIsCustomized = ((GrfBulDataRelation*)(aTypeMgr.pActualBullets[i]->pBullets))->bIsCustomized; + ((GrfBulDataRelation*)(pActualBullets[i]->pBullets))->eType = ((GrfBulDataRelation*)(aTypeMgr.pActualBullets[i]->pBullets))->eType; + if ( ((GrfBulDataRelation*)(aTypeMgr.pActualBullets[i]->pBullets))->bIsCustomized && ((GrfBulDataRelation*)(aTypeMgr.pActualBullets[i]->pBullets))->pGrfObj != NULL) + { + ((GrfBulDataRelation*)(pActualBullets[i]->pBullets))->pGrfObj = ((GrfBulDataRelation*)(aTypeMgr.pActualBullets[i]->pBullets))->pGrfObj; + } + } + } + ImplLoad(OUString("standard.sya")); +} +void MixBulletsTypeMgr::Init() +{ + BulletsTypeMgr* pBTMgr = BulletsTypeMgr::GetInstance(); + if ( pBTMgr ) + { + //Index 1 + pActualBullets[0] = new MixBulletsSettings_Impl(eNBType::BULLETS); + pActualBullets[0]->eType = eNBType::BULLETS; + pActualBullets[0]->nIndex = 0+1; //index in the tab page display,decrease 1 to the index within arr + pActualBullets[0]->nIndexDefault = 2; //index in the tab page display,decrease 1 to the index within arr + pActualBullets[0]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ; + ((BulletsSettings_Impl*)(pActualBullets[0]->pBullets))->cBulletChar = pBTMgr->GetBulChar(pActualBullets[0]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[0]->pBullets))->aFont = pBTMgr->GetBulCharFont(pActualBullets[0]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[0]->pBullets))->sDescription = pBTMgr->GetDescription(pActualBullets[0]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[0]->pBullets))->bIsCustomized = pBTMgr->IsCustomized(pActualBullets[0]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[0]->pBullets))->eType = eNBType::BULLETS; + + //Index 2 + pActualBullets[1] = new MixBulletsSettings_Impl(eNBType::BULLETS); + pActualBullets[1]->eType = eNBType::BULLETS; + pActualBullets[1]->nIndex = 1+1; //index in the tab page display,decrease 1 to the index within arr + pActualBullets[1]->nIndexDefault = 3; //index in the tab page display,decrease 1 to the index within arr + pActualBullets[1]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ; + ((BulletsSettings_Impl*)(pActualBullets[1]->pBullets))->cBulletChar = pBTMgr->GetBulChar(pActualBullets[1]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[1]->pBullets))->aFont = pBTMgr->GetBulCharFont(pActualBullets[1]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[1]->pBullets))->sDescription = pBTMgr->GetDescription(pActualBullets[1]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[1]->pBullets))->bIsCustomized = pBTMgr->IsCustomized(pActualBullets[1]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[1]->pBullets))->eType = eNBType::BULLETS; + + //Index 3 + pActualBullets[2] = new MixBulletsSettings_Impl(eNBType::BULLETS); + pActualBullets[2]->eType = eNBType::BULLETS; + pActualBullets[2]->nIndex = 2+1; //index in the tab page display,decrease 1 to the index within arr + pActualBullets[2]->nIndexDefault = 4; //index in the tab page display,decrease 1 to the index within arr + pActualBullets[2]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ; + ((BulletsSettings_Impl*)(pActualBullets[2]->pBullets))->cBulletChar = pBTMgr->GetBulChar(pActualBullets[2]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[2]->pBullets))->aFont = pBTMgr->GetBulCharFont(pActualBullets[2]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[2]->pBullets))->sDescription = pBTMgr->GetDescription(pActualBullets[2]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[2]->pBullets))->bIsCustomized = pBTMgr->IsCustomized(pActualBullets[2]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[2]->pBullets))->eType = eNBType::BULLETS; + + //Index 4 + pActualBullets[3] = new MixBulletsSettings_Impl(eNBType::BULLETS); + pActualBullets[3]->eType = eNBType::BULLETS; + pActualBullets[3]->nIndex = 3+1; //index in the tab page display,decrease 1 to the index within arr + pActualBullets[3]->nIndexDefault = 5; //index in the tab page display,decrease 1 to the index within arr + pActualBullets[3]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ; + ((BulletsSettings_Impl*)(pActualBullets[3]->pBullets))->cBulletChar = pBTMgr->GetBulChar(pActualBullets[3]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[3]->pBullets))->aFont = pBTMgr->GetBulCharFont(pActualBullets[3]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[3]->pBullets))->sDescription = pBTMgr->GetDescription(pActualBullets[3]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[3]->pBullets))->bIsCustomized = pBTMgr->IsCustomized(pActualBullets[3]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[3]->pBullets))->eType = eNBType::BULLETS; + + //Index 5 + pActualBullets[4] = new MixBulletsSettings_Impl(eNBType::BULLETS); + pActualBullets[4]->eType = eNBType::BULLETS; + pActualBullets[4]->nIndex = 4+1; //index in the tab page display,decrease 1 to the index within arr + pActualBullets[4]->nIndexDefault = 6; //index in the tab page display,decrease 1 to the index within arr + pActualBullets[4]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ; + ((BulletsSettings_Impl*)(pActualBullets[4]->pBullets))->cBulletChar = pBTMgr->GetBulChar(pActualBullets[4]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[4]->pBullets))->aFont = pBTMgr->GetBulCharFont(pActualBullets[4]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[4]->pBullets))->sDescription = pBTMgr->GetDescription(pActualBullets[4]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[4]->pBullets))->bIsCustomized = pBTMgr->IsCustomized(pActualBullets[4]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[4]->pBullets))->eType = eNBType::BULLETS; + + //Index 6 + pActualBullets[5] = new MixBulletsSettings_Impl(eNBType::BULLETS); + pActualBullets[5]->eType = eNBType::BULLETS; + pActualBullets[5]->nIndex = 5+1; //index in the tab page display,decrease 1 to the index within arr + pActualBullets[5]->nIndexDefault = 8; //index in the tab page display,decrease 1 to the index within arr + pActualBullets[5]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ; + ((BulletsSettings_Impl*)(pActualBullets[5]->pBullets))->cBulletChar = pBTMgr->GetBulChar(pActualBullets[5]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[5]->pBullets))->aFont = pBTMgr->GetBulCharFont(pActualBullets[5]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[5]->pBullets))->sDescription = pBTMgr->GetDescription(pActualBullets[5]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[5]->pBullets))->bIsCustomized = pBTMgr->IsCustomized(pActualBullets[5]->nIndexDefault-1); + ((BulletsSettings_Impl*)(pActualBullets[5]->pBullets))->eType = eNBType::BULLETS; + } + + GraphyicBulletsTypeMgr* mGrfTMgr = GraphyicBulletsTypeMgr::GetInstance(); + if ( mGrfTMgr ) + { + //Index 7 + pActualBullets[6] = new MixBulletsSettings_Impl(eNBType::GRAPHICBULLETS); + pActualBullets[6]->eType = eNBType::GRAPHICBULLETS; + pActualBullets[6]->nIndex = 6+1; //index in the tab page display,decrease 1 to the index within arr + pActualBullets[6]->nIndexDefault = 9; //index in the tab page display,decrease 1 to the index within arr + pActualBullets[6]->pBullets = new GrfBulDataRelation(eNBType::GRAPHICBULLETS) ; + ((GrfBulDataRelation*)(pActualBullets[6]->pBullets))->sGrfName = mGrfTMgr->GetGrfName(pActualBullets[6]->nIndexDefault); + ((GrfBulDataRelation*)(pActualBullets[6]->pBullets))->sDescription = mGrfTMgr->GetDescription(pActualBullets[6]->nIndexDefault); + ((GrfBulDataRelation*)(pActualBullets[6]->pBullets))->bIsCustomized = mGrfTMgr->IsCustomized(pActualBullets[6]->nIndexDefault); + ((GrfBulDataRelation*)(pActualBullets[6]->pBullets))->eType = eNBType::GRAPHICBULLETS; + + //Index 8 + pActualBullets[7] = new MixBulletsSettings_Impl(eNBType::GRAPHICBULLETS); + pActualBullets[7]->eType = eNBType::GRAPHICBULLETS; + pActualBullets[7]->nIndex = 7+1; //index in the tab page display,decrease 1 to the index within arr + pActualBullets[7]->nIndexDefault = 23; //index in the tab page display,decrease 1 to the index within arr + pActualBullets[7]->pBullets = new GrfBulDataRelation(eNBType::GRAPHICBULLETS) ; + ((GrfBulDataRelation*)(pActualBullets[7]->pBullets))->sGrfName = mGrfTMgr->GetGrfName(pActualBullets[7]->nIndexDefault); + ((GrfBulDataRelation*)(pActualBullets[7]->pBullets))->sDescription = mGrfTMgr->GetDescription(pActualBullets[7]->nIndexDefault); + ((GrfBulDataRelation*)(pActualBullets[7]->pBullets))->bIsCustomized = mGrfTMgr->IsCustomized(pActualBullets[7]->nIndexDefault); + ((GrfBulDataRelation*)(pActualBullets[7]->pBullets))->eType = eNBType::GRAPHICBULLETS; + } + +} +sal_uInt16 MixBulletsTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex) +{ + if ( mLevel == (sal_uInt16)0xFFFF || mLevel == 0) + return (sal_uInt16)0xFFFF; + //if ( !lcl_IsNumFmtSet(pNR, mLevel) ) return (sal_uInt16)0xFFFF; + + sal_uInt16 nActLv = IsSingleLevel(mLevel); + + if ( nActLv == (sal_uInt16)0xFFFF ) + return (sal_uInt16)0xFFFF; + + SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); + sal_Int16 eNumType = aFmt.GetNumberingType(); + if( eNumType == SVX_NUM_CHAR_SPECIAL) + { + sal_Unicode cChar = aFmt.GetBulletChar(); + const Font* pFont = aFmt.GetBulletFont(); + String sName = pFont?pFont->GetName():String(); + + for(sal_uInt16 i = nFromIndex; i < DEFAULT_BULLET_TYPES; i++) + { + if ( pActualBullets[i]->eType == eNBType::BULLETS ) + { + String ssName = ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->aFont.GetName(); + if ( (cChar == ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->cBulletChar|| + (cChar == 9830 && 57356 == ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->cBulletChar) || + (cChar == 9632 && 57354 == ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->cBulletChar)))//&& + //(pFont && pFont->GetName().CompareTo(((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->aFont.GetName())==COMPARE_EQUAL) ) + { + return pActualBullets[i]->nIndex; + } + } + } + }else if ( (eNumType&(~LINK_TOKEN)) == SVX_NUM_BITMAP ) + { + const SvxBrushItem* pBrsh = aFmt.GetBrush(); + const Graphic* pGrf = 0; + if ( pBrsh ) + pGrf = pBrsh->GetGraphic(); + + if ( pGrf ) + { + //const String* pGrfName = pBrsh->GetGraphicLink(); + for(sal_uInt16 i = nFromIndex; i < DEFAULT_BULLET_TYPES; i++) + { + if ( pActualBullets[i]->eType == eNBType::GRAPHICBULLETS ) + { + GrfBulDataRelation* pEntry = (GrfBulDataRelation*) (pActualBullets[i]->pBullets); + //sal_Bool bExist = sal_False; + if ( pEntry && pActualBullets[i]->nIndexDefault == (sal_uInt16)0xFFFF && pEntry->pGrfObj) + { + if ( pEntry->pGrfObj->GetBitmap().IsEqual(pGrf->GetBitmap())) + { + return pActualBullets[i]->nIndex; + } + }else { //if ( pEntry && pGrfName && pEntry->sGrfName.CompareTo(*pGrfName)==COMPARE_EQUAL ) + //bExist = GalleryExplorer::GetGraphicObj(GALLERY_THEME_BULLETS, pActualBullets[i]->nIndexDefault-1,pSrGrf); + Graphic aSrGrf; + if (pEntry) + GalleryExplorer::GetGraphicObj(GALLERY_THEME_BULLETS, pActualBullets[i]->nIndexDefault,&aSrGrf); + Bitmap aSum=pGrf->GetBitmap(); + Bitmap aSum1=aSrGrf.GetBitmap(); + if (aSum.IsEqual(aSum1)) + return pActualBullets[i]->nIndex; + } + } + } + } + } + + return (sal_uInt16)0xFFFF; +} + +sal_Bool MixBulletsTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel) +{ + if ( mLevel == (sal_uInt16)0xFFFF || mLevel == 0 || nIndex>=DEFAULT_BULLET_TYPES) + return sal_False; + + //if ( GetNBOIndexForNumRule(aNum,mLevel) != (sal_uInt16)0xFFFF ) + // return sal_False; + + sal_uInt16 nActLv = IsSingleLevel(mLevel); + + if ( nActLv == (sal_uInt16)0xFFFF ) + return sal_False; + + SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); + sal_Int16 eNumType = aFmt.GetNumberingType(); + if( eNumType == SVX_NUM_CHAR_SPECIAL && pActualBullets[nIndex]->eType == eNBType::BULLETS ) + { + sal_Unicode cChar = aFmt.GetBulletChar(); + const Font* pFont = aFmt.GetBulletFont(); + BulletsSettings_Impl* pEntry = (BulletsSettings_Impl*) (pActualBullets[nIndex]->pBullets); + pEntry->cBulletChar = cChar; + pEntry->aFont = pFont?*pFont:lcl_GetDefaultBulletFont(); + pEntry->bIsCustomized = sal_True; + String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION)); + String aReplace = OUString("%LIST_NUM"); + String sNUM = OUString::number( nIndex + 1 ); + aStrFromRES.SearchAndReplace(aReplace,sNUM); + pEntry->sDescription = aStrFromRES; + + }else if ( (eNumType&(~LINK_TOKEN)) == SVX_NUM_BITMAP && pActualBullets[nIndex]->eType == eNBType::GRAPHICBULLETS ) + { + const SvxBrushItem* pBrsh = aFmt.GetBrush(); + const Graphic* pGrf = 0; + if ( pBrsh ) + pGrf = pBrsh->GetGraphic(); + else + return sal_False; + + String sEmpty; + if ( pGrf ) + { + const String* pGrfName = pBrsh->GetGraphicLink(); + GrfBulDataRelation* pEntry = (GrfBulDataRelation*) (pActualBullets[nIndex]->pBullets); + if ( pGrfName ) + pEntry->sGrfName = *pGrfName; + GraphyicBulletsTypeMgr* mGrfTMgr = GraphyicBulletsTypeMgr::GetInstance(); + if ( mGrfTMgr ) + { + //sal_uInt16 nDIndex = mGrfTMgr->GetNBOIndexForNumRule(aNum,mLevel); + //if ( nDIndex != (sal_uInt16)0xFFFF) + //{ + // pActualBullets[nIndex]->nIndexDefault = nDIndex -1; + // sEmpty = mGrfTMgr->GetDescription( nDIndex -1); + //}else + { + pActualBullets[nIndex]->nIndexDefault = (sal_uInt16)0xFFFF; + sEmpty = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION)); + String aReplace = OUString("%LIST_NUM"); + String sNUM = OUString::number( nIndex + 1 ); + sEmpty.SearchAndReplace(aReplace,sNUM); + //pEntry->pGrfObj = pGrf; + pEntry->pGrfObj = new Graphic(*pGrf); + pEntry->aSize = aFmt.GetGraphicSize(); + pEntry->aSize = OutputDevice::LogicToLogic(pEntry->aSize,(MapUnit)GetMapUnit(),MAP_100TH_MM); + sal_uInt16 nDIndex = mGrfTMgr->GetNBOIndexForNumRule(aNum,mLevel); + if (nDIndex!=(sal_uInt16)0xFFFF) pEntry->aSize=Size(0,0); + } + } + pEntry->sDescription = sEmpty; + pEntry->bIsCustomized = sal_True; + }else + { + return sal_False; + } + }else + { + delete pActualBullets[nIndex]->pBullets; + pActualBullets[nIndex]->pBullets = 0; + if ( eNumType == SVX_NUM_CHAR_SPECIAL ) + { + sal_Unicode cChar = aFmt.GetBulletChar(); + const Font* pFont = aFmt.GetBulletFont(); + pActualBullets[nIndex]->eType = eNBType::BULLETS; + pActualBullets[nIndex]->nIndex = nIndex+1; //index in the tab page display,decrease 1 to the index within arr + pActualBullets[nIndex]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ; + ((BulletsSettings_Impl*)(pActualBullets[nIndex]->pBullets))->cBulletChar = cChar; + ((BulletsSettings_Impl*)(pActualBullets[nIndex]->pBullets))->aFont = pFont?*pFont:lcl_GetDefaultBulletFont(); + ((BulletsSettings_Impl*)(pActualBullets[nIndex]->pBullets))->bIsCustomized = sal_True; + ((BulletsSettings_Impl*)(pActualBullets[nIndex]->pBullets))->eType = eNBType::BULLETS; + BulletsTypeMgr* pBTMgr = BulletsTypeMgr::GetInstance(); + if ( pBTMgr ) + { + //sal_uInt16 nDIndex = pBTMgr->GetNBOIndexForNumRule(aNum,mLevel); + //if ( nDIndex != (sal_uInt16)0xFFFF) + //{ + // pActualBullets[nIndex]->nIndexDefault = nDIndex -1; + // ((BulletsSettings_Impl*)(pActualBullets[nIndex]->pBullets))->sDescription = pBTMgr->GetDescription(nDIndex - 1); + //}else + { + pActualBullets[nIndex]->nIndexDefault = (sal_uInt16)0xFFFF; + String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION)); + String aReplace = OUString("%LIST_NUM"); + String sNUM = OUString::number( nIndex + 1 ); + aStrFromRES.SearchAndReplace(aReplace,sNUM); + ((BulletsSettings_Impl*)(pActualBullets[nIndex]->pBullets))->sDescription = aStrFromRES; + } + } + }else if ( (eNumType&(~LINK_TOKEN)) == SVX_NUM_BITMAP ) + { + const SvxBrushItem* pBrsh = aFmt.GetBrush(); + const Graphic* pGrf = 0; + if ( pBrsh ) + pGrf = pBrsh->GetGraphic(); + else + return sal_False; + + String sEmpty; + const String* pGrfName = 0; + if ( pGrf ) + { + pGrfName = pBrsh->GetGraphicLink(); + + pActualBullets[nIndex]->eType = eNBType::GRAPHICBULLETS; + pActualBullets[nIndex]->nIndex = nIndex+1; //index in the tab page display,decrease 1 to the index within arr + pActualBullets[nIndex]->pBullets = new GrfBulDataRelation(eNBType::GRAPHICBULLETS) ; + if (pGrfName) + ((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->sGrfName = *pGrfName; + ((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->bIsCustomized = sal_True; + ((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->eType = eNBType::GRAPHICBULLETS; + GraphyicBulletsTypeMgr* mGrfTMgr = GraphyicBulletsTypeMgr::GetInstance(); + if ( mGrfTMgr ) + { + //sal_uInt16 nDIndex = mGrfTMgr->GetNBOIndexForNumRule(aNum,mLevel); + //if ( nDIndex != (sal_uInt16)0xFFFF) + //{ + // pActualBullets[nIndex]->nIndexDefault = nDIndex - 1; + // ((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->sDescription = mGrfTMgr->GetDescription(nDIndex - 1); + //}else + { + pActualBullets[nIndex]->nIndexDefault = (sal_uInt16)0xFFFF; + String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION)); + String aReplace = OUString("%LIST_NUM"); + String sNUM = OUString::number( nIndex + 1 ); + aStrFromRES.SearchAndReplace(aReplace,sNUM); + ((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->sDescription = aStrFromRES; + //((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->pGrfObj = pGrf; + ((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->pGrfObj = new Graphic(*pGrf); + ((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->pGrfObj = new Graphic(*pGrf); + Size aTmpSize = aFmt.GetGraphicSize(); + aTmpSize = OutputDevice::LogicToLogic(aTmpSize,(MapUnit)GetMapUnit(),MAP_100TH_MM); + sal_uInt16 nDIndex = mGrfTMgr->GetNBOIndexForNumRule(aNum,mLevel); + if (nDIndex!=(sal_uInt16)0xFFFF) aTmpSize=Size(0,0); + ((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->aSize = aTmpSize; + + } + } + } + } + } + SvxNumRule aTmpRule1(aNum); + ApplyNumRule(aTmpRule1,nIndex,mLevel,true); + if (GetNBOIndexForNumRule(aTmpRule1,mLevel,nIndex)==nIndex+1) { + if (pActualBullets[nIndex]->eType == eNBType::BULLETS) { + BulletsSettings_Impl* pEntry = (BulletsSettings_Impl*) (pActualBullets[nIndex]->pBullets); + pEntry->bIsCustomized = false; + pEntry->sDescription = GetDescription(nIndex,true); + } + if (pActualBullets[nIndex]->eType == eNBType::GRAPHICBULLETS) { + GrfBulDataRelation* pEntry = (GrfBulDataRelation*) (pActualBullets[nIndex]->pBullets); + pEntry->bIsCustomized = false; + pEntry->sDescription = GetDescription(nIndex,true); + } + } + ImplStore(OUString("standard.sya")); + return sal_True; +} + +sal_Bool MixBulletsTypeMgr::ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel,sal_Bool isDefault,sal_Bool isResetSize) +{ + //if ( mLevel == (sal_uInt16)0xFFFF || nIndex>=DEFAULT_BULLET_TYPES ) + if ( nIndex>=DEFAULT_BULLET_TYPES ) + return sal_False; + MixBulletsSettings_Impl* pCurrentBullets = pActualBullets[nIndex]; + if (isDefault) pCurrentBullets=pDefaultActualBullets[nIndex]; + + if ( pCurrentBullets->eType == eNBType::BULLETS ) + { + sal_Unicode cChar; + cChar = ((BulletsSettings_Impl*)(pCurrentBullets->pBullets))->cBulletChar; + + //Font& rActBulletFont = lcl_GetDefaultBulletFont(); + Font rActBulletFont = ((BulletsSettings_Impl*)(pCurrentBullets->pBullets))->aFont; + sal_uInt16 nMask = 1; + String sBulletCharFmtName = GetBulCharFmtName(); + for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++) + { + if(mLevel & nMask) + { + SvxNumberFormat aFmt(aNum.GetLevel(i)); + if (SVX_NUM_CHAR_SPECIAL !=aFmt.GetNumberingType()) isResetSize=true; + aFmt.SetNumberingType( SVX_NUM_CHAR_SPECIAL ); + aFmt.SetBulletFont(&rActBulletFont); + aFmt.SetBulletChar(cChar ); + aFmt.SetCharFmtName(sBulletCharFmtName); + String aEmptyStr; + aFmt.SetPrefix( aEmptyStr ); + aFmt.SetSuffix( aEmptyStr ); + if (isResetSize) aFmt.SetBulletRelSize(45); + aNum.SetLevel(i, aFmt); + } + nMask <<= 1; + } + }else if ( pCurrentBullets->eType == eNBType::GRAPHICBULLETS ) + { + String sGrfName; + GrfBulDataRelation* pEntry = (GrfBulDataRelation*) (pCurrentBullets->pBullets); + sGrfName= pEntry->sGrfName; + + sal_uInt16 nMask = 1; + String aEmptyStr; + sal_uInt16 nSetNumberingType = SVX_NUM_BITMAP; + String sNumCharFmtName = GetBulCharFmtName(); + for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++) + { + if(mLevel & nMask) + { + SvxNumberFormat aFmt(aNum.GetLevel(i)); + if (SVX_NUM_BITMAP !=aFmt.GetNumberingType()) isResetSize=true; + aFmt.SetNumberingType(nSetNumberingType); + aFmt.SetPrefix( aEmptyStr ); + aFmt.SetSuffix( aEmptyStr ); + aFmt.SetCharFmtName( sNumCharFmtName ); + if ( pCurrentBullets->nIndexDefault == (sal_uInt16)0xFFFF && pEntry->pGrfObj ) + { + Size aSize = pEntry->aSize; + sal_Int16 eOrient = text::VertOrientation::LINE_CENTER; + if (!isResetSize && aFmt.GetGraphicSize()!=Size(0,0)) aSize=aFmt.GetGraphicSize(); + else { + if (aSize.Width()==0 && aSize.Height()==0) { + aSize = SvxNumberFormat::GetGraphicSizeMM100( pEntry->pGrfObj ); + } + aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)GetMapUnit()); + } + SvxBrushItem aBrush(*(pEntry->pGrfObj), GPOS_AREA, SID_ATTR_BRUSH ); + aFmt.SetGraphicBrush( &aBrush, &aSize, &eOrient ); + }else + { + Graphic aGraphic; + if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, pCurrentBullets->nIndexDefault, &aGraphic)) + { + Size aSize = pEntry->aSize; + sal_Int16 eOrient = text::VertOrientation::LINE_CENTER; + if (!isResetSize && aFmt.GetGraphicSize()!=Size(0,0)) aSize=aFmt.GetGraphicSize(); + else { + if (aSize.Width()==0 && aSize.Height()==0) { + aSize = SvxNumberFormat::GetGraphicSizeMM100(&aGraphic); + } + aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)GetMapUnit()); + } + SvxBrushItem aBrush(aGraphic, GPOS_AREA, SID_ATTR_BRUSH ); + aFmt.SetGraphicBrush( &aBrush, &aSize, &eOrient ); + }else + aFmt.SetGraphic( sGrfName ); + } + + aNum.SetLevel(i, aFmt); + } + nMask <<= 1 ; + } + } + + return sal_True; +} + +String MixBulletsTypeMgr::GetDescription(sal_uInt16 nIndex,sal_Bool isDefault) +{ + String sRet; + //sal_uInt16 nLength = 0; + //nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl); + + if ( nIndex >= DEFAULT_BULLET_TYPES ) + return sRet; + else + sRet = pActualBullets[nIndex]->pBullets->sDescription; + if (isDefault) sRet = pDefaultActualBullets[nIndex]->pBullets->sDescription; + return sRet; +} +sal_Bool MixBulletsTypeMgr::IsCustomized(sal_uInt16 nIndex) +{ + sal_Bool bRet = sal_False; + //sal_uInt16 nLength = 0; + //nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl); + + if ( nIndex >= DEFAULT_BULLET_TYPES ) + bRet = sal_False; + else + bRet = pActualBullets[nIndex]->pBullets->bIsCustomized; + + return bRet; +} +/*************************************************************************************************** +**********************Numbering Type lib************************************************************** +****************************************************************************************************/ +NumberingTypeMgr* NumberingTypeMgr::_instance = 0; + +NumberingTypeMgr::NumberingTypeMgr(const NBOType aType): + NBOTypeMgrBase(aType), + //pNumSettingsArr( new NumSettingsArr_Impl ), + pNumberSettingsArr (new NumberSettingsArr_Impl) +{ + Init(); + pDefaultNumberSettingsArr = pNumberSettingsArr; + pNumberSettingsArr = new NumberSettingsArr_Impl; + //Initial the first time to store the default value. Then do it again for customized value + Init(); + ImplLoad(OUString("standard.syb")); +} + +NumberingTypeMgr::NumberingTypeMgr(const NBOType aType,const SfxItemSet* pArg): + NBOTypeMgrBase(aType,pArg), + //pNumSettingsArr( new NumSettingsArr_Impl ), + pNumberSettingsArr (new NumberSettingsArr_Impl) +{ + Init(); + pDefaultNumberSettingsArr = pNumberSettingsArr; + pNumberSettingsArr = new NumberSettingsArr_Impl; + //Initial the first time to store the default value. Then do it again for customized value + Init(); + ImplLoad(OUString("standard.syb")); +} + +NumberingTypeMgr::NumberingTypeMgr(const NumberingTypeMgr& aTypeMgr): + NBOTypeMgrBase(aTypeMgr), + //pNumSettingsArr( new NumSettingsArr_Impl ), + pNumberSettingsArr (new NumberSettingsArr_Impl) +{ + /* + for(sal_uInt16 i=0;i<aTypeMgr.GetNumCount();i++) + { + NumberSettings_Impl* _pSet = aTypeMgr.GetNumSettingByIndex(i); + if ( _pSet ) + { + pNumberSettingsArr->GetObject(i)->nIndex = _pSet->nIndex; + pNumberSettingsArr->GetObject(i)->nIndexDefault = _pSet->nIndexDefault; + pNumberSettingsArr->GetObject(i)->sDescription = _pSet->sDescription; + pNumberSettingsArr->GetObject(i)->bIsCustomized = _pSet->bIsCustomized; + if ( _pSet->pNumSetting ) + { + pNumberSettingsArr->GetObject(i)->pNumSetting->nNumberType = _pSet->pNumSetting->nNumberType; + pNumberSettingsArr->GetObject(i)->pNumSetting->nParentNumbering = _pSet->pNumSetting->nParentNumbering; + pNumberSettingsArr->GetObject(i)->pNumSetting->sPrefix = _pSet->pNumSetting->sPrefix; + pNumberSettingsArr->GetObject(i)->pNumSetting->sSuffix = _pSet->pNumSetting->sSuffix; + pNumberSettingsArr->GetObject(i)->pNumSetting->sBulletChar = _pSet->pNumSetting->sBulletChar; + pNumberSettingsArr->GetObject(i)->pNumSetting->sBulletFont = _pSet->pNumSetting->sBulletFont; + + pNumberSettingsArr->GetObject(i)->pNumSetting->eLabelFollowedBy = _pSet->pNumSetting->eLabelFollowedBy; + pNumberSettingsArr->GetObject(i)->pNumSetting->nTabValue = _pSet->pNumSetting->nTabValue; + pNumberSettingsArr->GetObject(i)->pNumSetting->eNumAlign = _pSet->pNumSetting->eNumAlign; + pNumberSettingsArr->GetObject(i)->pNumSetting->nNumAlignAt = _pSet->pNumSetting->nNumAlignAt; + pNumberSettingsArr->GetObject(i)->pNumSetting->nNumIndentAt = _pSet->pNumSetting->nNumIndentAt; + } + } + } + */ + ImplLoad(OUString("standard.syb")); +} + +void NumberingTypeMgr::Init() +{ + Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); + Reference < XInterface > xI = xMSF->createInstance( + ::rtl::OUString::createFromAscii( "com.sun.star.text.DefaultNumberingProvider" ) ); + Reference<XDefaultNumberingProvider> xDefNum(xI, UNO_QUERY); + + if(xDefNum.is()) + { + Sequence< Sequence< PropertyValue > > aNumberings; + Locale aLocale(Application::GetSettings().GetLanguageTag().getLocale()); + try + { + aNumberings = xDefNum->getDefaultContinuousNumberingLevels( aLocale ); + + sal_Int32 nLength = aNumberings.getLength() > DEFAULT_NUM_VALUSET_COUNT ? DEFAULT_NUM_VALUSET_COUNT :aNumberings.getLength(); + + const Sequence<PropertyValue>* pValuesArr = aNumberings.getConstArray(); + for(sal_Int32 i = 0; i < nLength; i++) + { + NumSettings_ImplPtr pNew = lcl_CreateNumberingSettingsPtr(pValuesArr[i]); + NumberSettings_Impl* pNumEntry = new NumberSettings_Impl; + pNumEntry->nIndex = i + 1; + pNumEntry->nIndexDefault = i; + pNumEntry->pNumSetting = pNew; + //SetItemText( i + 1, SVX_RESSTR( RID_SVXSTR_SINGLENUM_DESCRIPTIONS + i )); + { + String sText; + //const OUString sValue(C2U("Value")); + Reference<XNumberingFormatter> xFormatter(xDefNum, UNO_QUERY); + if(xFormatter.is() && aNumberings.getLength() > i) + { + + for (sal_uInt16 j=0;j<3;j++) + { + Sequence<PropertyValue> aLevel = aNumberings.getConstArray()[i]; + try + { + aLevel.realloc(aLevel.getLength() + 1); + PropertyValue& rValue = aLevel.getArray()[aLevel.getLength() - 1]; + rValue.Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Value")); + rValue.Value <<= (sal_Int32)(j + 1); + + if (j!=0) + sText += OUString(" "); + + sText+=String(xFormatter->makeNumberingString( aLevel, aLocale )); + } + catch (const Exception&) + { + OSL_ENSURE(false, "Exception in DefaultNumberingProvider::makeNumberingString"); + } + } + } + String aStrFromRES(SVX_RESSTR( RID_SVXSTR_SINGLENUM_DESCRIPTIONS)); + String aReplace = OUString("%NUMBERINGSAMPLE"); + aStrFromRES.SearchAndReplace(aReplace,sText); + pNumEntry->sDescription = aStrFromRES; + } + //End modification + + //pNumEntry->sDescription = SVX_RESSTR( RID_SVXSTR_SINGLENUM_DESCRIPTION_0 + i ); + pNumberSettingsArr->push_back(boost::shared_ptr<NumberSettings_Impl>(pNumEntry)); + } + } + catch(Exception&) + { + } + } +} + +sal_uInt16 NumberingTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex) +{ + if ( mLevel == (sal_uInt16)0xFFFF || mLevel > aNum.GetLevelCount() || mLevel == 0) + return (sal_uInt16)0xFFFF; + + sal_uInt16 nActLv = IsSingleLevel(mLevel); + + if ( nActLv == (sal_uInt16)0xFFFF ) + return (sal_uInt16)0xFFFF; + + SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); + //sal_Unicode cPrefix = rtl::OUString(aFmt.GetPrefix()).getStr()[0]; + //sal_Unicode cSuffix = rtl::OUString(aFmt.GetSuffix()).getStr()[0]; + String sPreFix = aFmt.GetPrefix(); + String sLclSuffix = aFmt.GetSuffix(); + String sEmpty; + sal_Int16 eNumType = aFmt.GetNumberingType(); + + sal_uInt16 nCount = pNumberSettingsArr->size(); + for(sal_uInt16 i = nFromIndex; i < nCount; ++i) + { + NumberSettings_ImplPtr _pSet = (*pNumberSettingsArr)[i].get(); + sal_Int16 eNType = _pSet->pNumSetting->nNumberType; + String sLocalPreFix = _pSet->pNumSetting->sPrefix; + String sLocalSuffix = _pSet->pNumSetting->sSuffix; + if (sPreFix.CompareTo(sLocalPreFix)==COMPARE_EQUAL && + sLclSuffix.CompareTo(sLocalSuffix)==COMPARE_EQUAL && + eNumType == eNType ) + { + return i+1; + } + } + + + return (sal_uInt16)0xFFFF; +} + +sal_Bool NumberingTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel) +{ + //if ( mLevel == (sal_uInt16)0xFFFF || mLevel == 0) + // return sal_False; + + //if ( GetNBOIndexForNumRule(aNum,mLevel) != (sal_uInt16)0xFFFF ) + // return sal_False; + + sal_uInt16 nActLv = IsSingleLevel(mLevel); + + if ( nActLv == (sal_uInt16)0xFFFF ) + return sal_False; + + SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); + //sal_Unicode cPrefix = rtl::OUString(aFmt.GetPrefix()).getStr()[0]; + //sal_Unicode cSuffix = rtl::OUString(aFmt.GetSuffix()).getStr()[0]; + sal_Int16 eNumType = aFmt.GetNumberingType(); + + sal_uInt16 nCount = pNumberSettingsArr->size(); + if ( nIndex >= nCount ) + return sal_False; + + NumberSettings_ImplPtr _pSet = (*pNumberSettingsArr)[nIndex].get(); + + _pSet->pNumSetting->sPrefix = aFmt.GetPrefix(); + _pSet->pNumSetting->sSuffix = aFmt.GetSuffix(); + _pSet->pNumSetting->nNumberType = eNumType; + _pSet->bIsCustomized = sal_True; + + SvxNumRule aTmpRule1(aNum); + SvxNumRule aTmpRule2(aNum); + ApplyNumRule(aTmpRule1,nIndex,mLevel,true); + ApplyNumRule(aTmpRule2,nIndex,mLevel,false); + if (aTmpRule1==aTmpRule2) _pSet->bIsCustomized=false; + if (_pSet->bIsCustomized) { + String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_NUMBERING_DESCRIPTION)); + String aReplace = OUString("%LIST_NUM"); + String sNUM = OUString::number( nIndex + 1 ); + aStrFromRES.SearchAndReplace(aReplace,sNUM); + _pSet->sDescription = aStrFromRES; + } else { + _pSet->sDescription = GetDescription(nIndex,true); + } + ImplStore(OUString("standard.syb")); + return sal_True; +} + +sal_Bool NumberingTypeMgr::ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel,sal_Bool isDefault,sal_Bool isResetSize) +{ + //if ( mLevel == (sal_uInt16)0xFFFF ) + // return sal_False; + + //DBG_ASSERT(pNumSettingsArr->Count() > nIndex, "wrong index"); + if(pNumberSettingsArr->size() <= nIndex) + return sal_False; + NumberSettingsArr_Impl* pCurrentNumberSettingsArr=pNumberSettingsArr; + if (isDefault) pCurrentNumberSettingsArr=pDefaultNumberSettingsArr; + NumberSettings_ImplPtr _pSet = (*pCurrentNumberSettingsArr)[nIndex].get(); + sal_Int16 eNewType = _pSet->pNumSetting->nNumberType; + + sal_uInt16 nMask = 1; + String sNumCharFmtName = GetBulCharFmtName(); + for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++) + { + if(mLevel & nMask) + { + SvxNumberFormat aFmt(aNum.GetLevel(i)); + if (eNewType!=aFmt.GetNumberingType()) isResetSize=true; + aFmt.SetNumberingType(eNewType); + aFmt.SetPrefix(_pSet->pNumSetting->sPrefix); + aFmt.SetSuffix(_pSet->pNumSetting->sSuffix); + + aFmt.SetCharFmtName(sNumCharFmtName); + if (isResetSize) aFmt.SetBulletRelSize(100); + aNum.SetLevel(i, aFmt); + } + nMask <<= 1 ; + } + + return sal_True; +} +String NumberingTypeMgr::GetDescription(sal_uInt16 nIndex,sal_Bool isDefault) +{ + String sRet; + sal_uInt16 nLength = 0; + nLength = pNumberSettingsArr->size(); + + if ( nIndex >= nLength ) + return sRet; + else + sRet = (*pNumberSettingsArr)[nIndex]->sDescription; + if (isDefault) sRet = (*pDefaultNumberSettingsArr)[nIndex]->sDescription; + + return sRet; +} +sal_Bool NumberingTypeMgr::IsCustomized(sal_uInt16 nIndex) +{ + sal_Bool bRet = sal_False; + sal_uInt16 nLength = 0; + nLength = pNumberSettingsArr->size(); + + if ( nIndex >= nLength ) + bRet = sal_False; + else + bRet = (*pNumberSettingsArr)[nIndex]->bIsCustomized; + + return bRet; +} +sal_uInt16 NumberingTypeMgr::GetNumCount() const +{ + sal_uInt16 nRet = 0; + if ( pNumberSettingsArr ) + nRet = pNumberSettingsArr->size(); + + return nRet; +} +NumberSettings_Impl* NumberingTypeMgr::GetNumSettingByIndex(sal_uInt16 nIndex) const +{ + NumberSettings_Impl* pRet = 0; + if ( pNumberSettingsArr && nIndex< pNumberSettingsArr->size() ) + { + pRet = (*pNumberSettingsArr)[nIndex].get(); + } + return pRet; +} +/*************************************************************************************************** +**********************Multi-level /Outline Type lib******************************************************* +****************************************************************************************************/ +OutlineTypeMgr* OutlineTypeMgr::_instance = 0; + +OutlineTypeMgr::OutlineTypeMgr(const NBOType aType): + NBOTypeMgrBase(aType)//, + //pNumSettingsArrs( new NumSettingsArr_Impl[DEFAULT_NUM_VALUSET_COUNT] ) +{ + Init(); + for(sal_Int32 nItem = 0; nItem < DEFAULT_NUM_VALUSET_COUNT; nItem++ ) + { + pDefaultOutlineSettingsArrs[nItem] = pOutlineSettingsArrs[nItem]; + } + //Initial the first time to store the default value. Then do it again for customized value + Init(); + ImplLoad(OUString("standard.syc")); +} + +OutlineTypeMgr::OutlineTypeMgr(const NBOType aType,const SfxItemSet* pArg): + NBOTypeMgrBase(aType,pArg)//, + //pNumSettingsArrs( new NumSettingsArr_Impl[DEFAULT_NUM_VALUSET_COUNT]) +{ + Init(); + for(sal_Int32 nItem = 0; nItem < DEFAULT_NUM_VALUSET_COUNT; nItem++ ) + { + pDefaultOutlineSettingsArrs[nItem] = pOutlineSettingsArrs[nItem]; + } + //Initial the first time to store the default value. Then do it again for customized value + Init(); + ImplLoad(OUString("standard.syc")); +} + +OutlineTypeMgr::OutlineTypeMgr(const OutlineTypeMgr& aTypeMgr): + NBOTypeMgrBase(aTypeMgr)//, + //pNumSettingsArrs( new NumSettingsArr_Impl[DEFAULT_NUM_VALUSET_COUNT]) +{ + Init(); + for(sal_Int32 nItem = 0; nItem < DEFAULT_NUM_VALUSET_COUNT; nItem++ ) + { + pDefaultOutlineSettingsArrs[nItem] = pOutlineSettingsArrs[nItem]; + } + //Initial the first time to store the default value. Then do it again for customized value + Init(); + ImplLoad(OUString("standard.syc")); +} + +void OutlineTypeMgr::Init() +{ + Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); + Reference < XInterface > xI = xMSF->createInstance( + ::rtl::OUString::createFromAscii( "com.sun.star.text.DefaultNumberingProvider" ) ); + Reference<XDefaultNumberingProvider> xDefNum(xI, UNO_QUERY); + + if(xDefNum.is()) + { + Sequence<Reference<XIndexAccess> > aOutlineAccess; + Locale aLocale(Application::GetSettings().GetLanguageTag().getLocale()); + try + { + aOutlineAccess = xDefNum->getDefaultOutlineNumberings( aLocale ); + + SvxNumRule aDefNumRule( NUM_BULLET_REL_SIZE|NUM_CONTINUOUS|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE|NUM_SYMBOL_ALIGNMENT,10, sal_False , + SVX_RULETYPE_NUMBERING,SvxNumberFormat::LABEL_ALIGNMENT); + + for(sal_Int32 nItem = 0; + nItem < aOutlineAccess.getLength() && nItem < DEFAULT_NUM_VALUSET_COUNT; + nItem++ ) + { + pOutlineSettingsArrs[ nItem ] = new OutlineSettings_Impl; + OutlineSettings_Impl* pItemArr = pOutlineSettingsArrs[ nItem ]; + pItemArr->sDescription = SVX_RESSTR( RID_SVXSTR_OUTLINENUM_DESCRIPTION_0 + nItem ); + pItemArr->pNumSettingsArr = new NumSettingsArr_Impl; + Reference<XIndexAccess> xLevel = aOutlineAccess.getConstArray()[nItem]; + for(sal_Int32 nLevel = 0; nLevel < xLevel->getCount() && nLevel < 5; nLevel++) + { + Any aValueAny = xLevel->getByIndex(nLevel); + Sequence<PropertyValue> aLevelProps; + aValueAny >>= aLevelProps; + NumSettings_ImplPtr pNew = lcl_CreateNumberingSettingsPtr(aLevelProps); + SvxNumberFormat aNumFmt( aDefNumRule.GetLevel( nLevel) ); + pNew->eLabelFollowedBy = aNumFmt.GetLabelFollowedBy(); + pNew->nTabValue = aNumFmt.GetListtabPos(); + pNew->eNumAlign = aNumFmt.GetNumAdjust(); + pNew->nNumAlignAt = aNumFmt.GetFirstLineIndent(); + pNew->nNumIndentAt = aNumFmt.GetIndentAt(); + pItemArr->pNumSettingsArr->push_back(boost::shared_ptr<NumSettings_Impl>(pNew)); + } + } + } + catch(Exception&) + { + } + } +} + +sal_uInt16 OutlineTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 /*mLevel*/,sal_uInt16 nFromIndex) +{ + sal_uInt16 nLength = sizeof(pOutlineSettingsArrs)/sizeof(OutlineSettings_Impl*); + for(sal_uInt16 iDex = nFromIndex; iDex < nLength; iDex++) + { + sal_Bool bNotMatch = sal_False; + OutlineSettings_Impl* pItemArr = pOutlineSettingsArrs[iDex]; + sal_uInt16 nCount = pItemArr->pNumSettingsArr->size(); + for (sal_uInt16 iLevel=0;iLevel < nCount;iLevel++) + { + NumSettings_ImplPtr _pSet = (*pItemArr->pNumSettingsArr)[iLevel].get(); + sal_Int16 eNType = _pSet->nNumberType; + + SvxNumberFormat aFmt(aNum.GetLevel(iLevel)); + String sPreFix = aFmt.GetPrefix(); + String sLclSuffix = aFmt.GetSuffix(); + String sEmpty; + sal_Int16 eNumType = aFmt.GetNumberingType(); + if( eNumType == SVX_NUM_CHAR_SPECIAL) + { + sal_Unicode cChar = aFmt.GetBulletChar(); + //const Font* pFont = aFmt.GetBulletFont(); + sal_Unicode ccChar = _pSet->sBulletChar.getStr()[0]; + rtl::OUString sFont = _pSet->sBulletFont; + if ( !((cChar == ccChar) && //pFont && sFont.compareTo(pFont->GetName()) && + _pSet->eLabelFollowedBy == aFmt.GetLabelFollowedBy() && + _pSet->nTabValue == aFmt.GetListtabPos() && + _pSet->eNumAlign == aFmt.GetNumAdjust() && + _pSet->nNumAlignAt == aFmt.GetFirstLineIndent() && + _pSet->nNumIndentAt == aFmt.GetIndentAt())) + { + bNotMatch = sal_True; + break; + } + }else if ((eNumType&(~LINK_TOKEN)) == SVX_NUM_BITMAP ) { + const SvxBrushItem* pBrsh1 = aFmt.GetBrush(); + const SvxBrushItem* pBrsh2 = _pSet->pBrushItem; + sal_Bool bIsMatch = false; + if (pBrsh1==pBrsh2) bIsMatch = true; + if (pBrsh1 && pBrsh2) { + const Graphic* pGrf1 = pBrsh1->GetGraphic();; + const Graphic* pGrf2 = pBrsh2->GetGraphic();; + if (pGrf1==pGrf2) bIsMatch = true; + if (pGrf1 && pGrf2) { + if ( pGrf1->GetBitmap().IsEqual(pGrf2->GetBitmap()) && + _pSet->aSize==aFmt.GetGraphicSize()) + bIsMatch = true; + } + } + if (!bIsMatch) { + bNotMatch = sal_True; + break; + } + } else + { + if (!((sPreFix.CompareTo(_pSet->sPrefix)==COMPARE_EQUAL) && + ( sLclSuffix.CompareTo(_pSet->sSuffix)==COMPARE_EQUAL ) && + eNumType == eNType && + _pSet->eLabelFollowedBy == aFmt.GetLabelFollowedBy() && + _pSet->nTabValue == aFmt.GetListtabPos() && + _pSet->eNumAlign == aFmt.GetNumAdjust() && + _pSet->nNumAlignAt == aFmt.GetFirstLineIndent() && + _pSet->nNumIndentAt == aFmt.GetIndentAt())) + { + bNotMatch = sal_True; + break; + } + } + } + if ( !bNotMatch ) + return iDex+1; + } + + + return (sal_uInt16)0xFFFF; +} + +sal_Bool OutlineTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel) +{ + //if ( mLevel == 0 || mLevel == (sal_uInt16)0xFFFF ) + // return sal_False; + + sal_uInt16 nLength = sizeof(pOutlineSettingsArrs)/sizeof(OutlineSettings_Impl*); + if ( nIndex >= nLength ) + return sal_False; + + OutlineSettings_Impl* pItemArr = pOutlineSettingsArrs[nIndex]; + sal_uInt16 nCount = pItemArr->pNumSettingsArr->size(); + for (sal_uInt16 iLevel=0;iLevel < nCount;iLevel++) + { + SvxNumberFormat aFmt(aNum.GetLevel(iLevel)); + //sal_Unicode cPrefix = rtl::OUString(aFmt.GetPrefix()).getStr()[0]; + //sal_Unicode cSuffix = rtl::OUString(aFmt.GetSuffix()).getStr()[0]; + sal_Int16 eNumType = aFmt.GetNumberingType(); + + NumSettings_ImplPtr _pSet = (*pItemArr->pNumSettingsArr)[iLevel].get(); + + _pSet->eLabelFollowedBy = aFmt.GetLabelFollowedBy(); + _pSet->nTabValue = aFmt.GetListtabPos(); + _pSet->eNumAlign = aFmt.GetNumAdjust(); + _pSet->nNumAlignAt = aFmt.GetFirstLineIndent(); + _pSet->nNumIndentAt = aFmt.GetIndentAt(); + + if( eNumType == SVX_NUM_CHAR_SPECIAL) + { + sal_Unicode cChar = aFmt.GetBulletChar(); + OUString sChar(cChar); + _pSet->sBulletChar = sChar;//OUString(cChar); + if ( aFmt.GetBulletFont() ) + _pSet->sBulletFont = rtl::OUString(aFmt.GetBulletFont()->GetName()); + _pSet->nNumberType = eNumType; + pItemArr->bIsCustomized = sal_True; + }else if ((eNumType&(~LINK_TOKEN)) == SVX_NUM_BITMAP ) { + if (_pSet->pBrushItem) { + delete (_pSet->pBrushItem); + _pSet->pBrushItem=NULL; + } + if (aFmt.GetBrush()) + _pSet->pBrushItem = new SvxBrushItem(*aFmt.GetBrush()); + _pSet->aSize = aFmt.GetGraphicSize(); + _pSet->nNumberType = eNumType; + } else + { + _pSet->sPrefix = aFmt.GetPrefix(); + _pSet->sSuffix = aFmt.GetSuffix(); + _pSet->nNumberType = eNumType; + if ( aFmt.GetBulletFont() ) + _pSet->sBulletFont = rtl::OUString(aFmt.GetBulletFont()->GetName()); + pItemArr->bIsCustomized = sal_True; + } + } + SvxNumRule aTmpRule1(aNum); + SvxNumRule aTmpRule2(aNum); + ApplyNumRule(aTmpRule1,nIndex,mLevel,true); + ApplyNumRule(aTmpRule2,nIndex,mLevel,false); + if (aTmpRule1==aTmpRule2) pItemArr->bIsCustomized=false; + if (pItemArr->bIsCustomized) { + String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_MULTILEVEL_DESCRIPTION)); + String aReplace = OUString("%LIST_NUM"); + String sNUM = OUString::number( nIndex + 1 ); + aStrFromRES.SearchAndReplace(aReplace,sNUM); + pItemArr->sDescription = aStrFromRES; + } else { + pItemArr->sDescription = GetDescription(nIndex,true); + } + ImplStore(OUString("standard.syc")); + return sal_True; +} + +sal_Bool OutlineTypeMgr::ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 /*mLevel*/,sal_Bool isDefault,sal_Bool isResetSize) +{ + //if ( mLevel == (sal_uInt16)0xFFFF ) + // return sal_False; + + DBG_ASSERT(DEFAULT_NUM_VALUSET_COUNT > nIndex, "wrong index"); + if(DEFAULT_NUM_VALUSET_COUNT <= nIndex) + return sal_False; + + const FontList* pList = 0; + + OutlineSettings_Impl* pItemArr = pOutlineSettingsArrs[nIndex]; + if (isDefault) pItemArr=pDefaultOutlineSettingsArrs[nIndex]; + + //Font& rActBulletFont = lcl_GetDefaultBulletFont(); + NumSettingsArr_Impl *pNumSettingsArr=pItemArr->pNumSettingsArr; + + NumSettings_ImplPtr pLevelSettings = 0; + String sBulletCharFmtName = GetBulCharFmtName(); + for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++) + { + if(pNumSettingsArr->size() > i) + pLevelSettings = (*pNumSettingsArr)[i].get(); + + if(!pLevelSettings) + break; + + SvxNumberFormat aFmt(aNum.GetLevel(i)); + //aFmt.SetBulletFont(&pLevelSettings->aFont); + Font& rActBulletFont = lcl_GetDefaultBulletFont(); + if (pLevelSettings->nNumberType !=aFmt.GetNumberingType()) isResetSize=true; + aFmt.SetNumberingType( pLevelSettings->nNumberType ); + sal_uInt16 nUpperLevelOrChar = (sal_uInt16)pLevelSettings->nParentNumbering; + if(aFmt.GetNumberingType() == SVX_NUM_CHAR_SPECIAL) + { + if( pLevelSettings->sBulletFont.getLength() && + pLevelSettings->sBulletFont.compareTo(rActBulletFont.GetName())) + { + //search for the font + if(!pList) + { + SfxObjectShell* pCurDocShell = SfxObjectShell::Current(); + const SvxFontListItem* pFontListItem = (const SvxFontListItem* )pCurDocShell->GetItem( SID_ATTR_CHAR_FONTLIST ); + pList = pFontListItem ? pFontListItem->GetFontList() : 0; + } + if(pList && pList->IsAvailable( pLevelSettings->sBulletFont ) ) + { + FontInfo aInfo = pList->Get(pLevelSettings->sBulletFont,WEIGHT_NORMAL, ITALIC_NONE); + Font aFont(aInfo); + aFmt.SetBulletFont(&aFont); + } + else + { + //if it cannot be found then create a new one + Font aCreateFont( pLevelSettings->sBulletFont,String(), Size( 0, 14 ) ); + aCreateFont.SetCharSet( RTL_TEXTENCODING_DONTKNOW ); + aCreateFont.SetFamily( FAMILY_DONTKNOW ); + aCreateFont.SetPitch( PITCH_DONTKNOW ); + aCreateFont.SetWeight( WEIGHT_DONTKNOW ); + aCreateFont.SetTransparent( sal_True ); + aFmt.SetBulletFont( &aCreateFont ); + } + }else + aFmt.SetBulletFont( &rActBulletFont ); + + sal_Unicode cChar = 0; + if( pLevelSettings->sBulletChar.getLength() ) + cChar = pLevelSettings->sBulletChar.getStr()[0]; + if( Application::GetSettings().GetLayoutRTL() ) + { + if( 0 == i && cChar == BulletsTypeMgr::aDynamicBulletTypes[5] ) + cChar = BulletsTypeMgr::aDynamicRTLBulletTypes[5]; + else if( 1 == i ) + { + const SvxNumberFormat& numberFmt = aNum.GetLevel(0); + if( numberFmt.GetBulletChar() == BulletsTypeMgr::aDynamicRTLBulletTypes[5] ) + cChar = BulletsTypeMgr::aDynamicRTLBulletTypes[4]; + } + } + + aFmt.SetBulletChar(cChar); + aFmt.SetCharFmtName( sBulletCharFmtName ); + if (isResetSize) aFmt.SetBulletRelSize(45); + }else if ((aFmt.GetNumberingType()&(~LINK_TOKEN)) == SVX_NUM_BITMAP ) { + if (pLevelSettings->pBrushItem) { + const Graphic* pGrf = pLevelSettings->pBrushItem->GetGraphic();; + Size aSize = pLevelSettings->aSize; + sal_Int16 eOrient = text::VertOrientation::LINE_CENTER; + if (!isResetSize && aFmt.GetGraphicSize()!=Size(0,0)) aSize=aFmt.GetGraphicSize(); + else { + if (aSize.Width()==0 && aSize.Height()==0 && pGrf) { + aSize = SvxNumberFormat::GetGraphicSizeMM100( pGrf ); + } + } + aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)GetMapUnit()); + aFmt.SetGraphicBrush( pLevelSettings->pBrushItem, &aSize, &eOrient ); + } + } else + { + aFmt.SetIncludeUpperLevels(sal::static_int_cast< sal_uInt8 >(0 != nUpperLevelOrChar ? aNum.GetLevelCount() : 0)); + aFmt.SetCharFmtName(sBulletCharFmtName); + if (isResetSize) aFmt.SetBulletRelSize(100); + } + if(pNumSettingsArr->size() > i) { + aFmt.SetLabelFollowedBy(pLevelSettings->eLabelFollowedBy); + aFmt.SetListtabPos(pLevelSettings->nTabValue); + aFmt.SetNumAdjust(pLevelSettings->eNumAlign); + aFmt.SetFirstLineIndent(pLevelSettings->nNumAlignAt); + aFmt.SetIndentAt(pLevelSettings->nNumIndentAt); + } + aFmt.SetPrefix(pLevelSettings->sPrefix); + aFmt.SetSuffix(pLevelSettings->sSuffix); + aNum.SetLevel(i, aFmt); + } + + return sal_True; +} +String OutlineTypeMgr::GetDescription(sal_uInt16 nIndex,sal_Bool isDefault) +{ + String sRet; + sal_uInt16 nLength = 0; + nLength = sizeof(pOutlineSettingsArrs)/sizeof(OutlineSettings_Impl*); + + if ( nIndex >= nLength ) + return sRet; + else + { + OutlineSettings_Impl* pItemArr = pOutlineSettingsArrs[nIndex]; + if (isDefault) pItemArr = pDefaultOutlineSettingsArrs[nIndex]; + if ( pItemArr ) + { + sRet = pItemArr->sDescription; + }; + } + return sRet; +} +sal_Bool OutlineTypeMgr::IsCustomized(sal_uInt16 nIndex) +{ + sal_Bool bRet = sal_False; + + sal_uInt16 nLength = 0; + nLength = sizeof(pOutlineSettingsArrs)/sizeof(OutlineSettings_Impl*); + + if ( nIndex >= nLength ) + return bRet; + else + { + OutlineSettings_Impl* pItemArr = pOutlineSettingsArrs[nIndex]; + if ( pItemArr ) + { + bRet = pItemArr->bIsCustomized; + }; + } + + return bRet; +} + + +}} diff --git a/svx/source/sidebar/nbdtmgfact.cxx b/svx/source/sidebar/nbdtmgfact.cxx new file mode 100644 index 000000000000..7280d7eceabf --- /dev/null +++ b/svx/source/sidebar/nbdtmgfact.cxx @@ -0,0 +1,48 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _NBDTMGFACT_HXX +#include <svx/nbdtmgfact.hxx> +#endif +namespace svx { namespace sidebar { +NBOutlineTypeMgrFact::NBOutlineTypeMgrFact() +{ +} + +NBOTypeMgrBase* NBOutlineTypeMgrFact::CreateInstance(const NBOType aType) +{ + //NBOTypeMgrBase* pRet= 0; + if ( aType == eNBOType::BULLETS ) + { + return BulletsTypeMgr::GetInstance(); + }else if ( aType == eNBOType::GRAPHICBULLETS ) + { + return GraphyicBulletsTypeMgr::GetInstance(); + }else if ( aType == eNBOType::MIXBULLETS ) + { + return MixBulletsTypeMgr::GetInstance(); + }else if ( aType == eNBOType::NUMBERING ) + { + return NumberingTypeMgr::GetInstance(); + }else if ( aType == eNBOType::OUTLINE ) + { + return OutlineTypeMgr::GetInstance(); + } + return NULL; +} +}} + diff --git a/svx/source/sidebar/paragraph/ParaBulletsControl.cxx b/svx/source/sidebar/paragraph/ParaBulletsControl.cxx new file mode 100644 index 000000000000..89ae29d66ce0 --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaBulletsControl.cxx @@ -0,0 +1,140 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "ParaBulletsControl.hxx" +#include "ParaPropertyPanel.hrc" +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include <svx/dialogs.hrc> +#include <svx/dialmgr.hxx> +#include <unotools/viewoptions.hxx> +#include <editeng/kernitem.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/sidebar/Theme.hxx> +#include <svtools/unitconv.hxx> +#include <svx/nbdtmg.hxx> +#include <svx/nbdtmgfact.hxx> + +namespace svx { namespace sidebar { + +ParaBulletsControl::ParaBulletsControl(Window* pParent, svx::sidebar::ParaPropertyPanel& rPanel) + : PopupControl( pParent,SVX_RES(RID_POPUPPANEL_PARAPAGE_BULLETS)) + , maBulletsVS(this,SVX_RES(VS_VALUES)) + , maFISep(this,SVX_RES(IMG_SEPERATOR_BULLET)) + , maMoreButton(this,SVX_RES(CB_BULLET_MORE)) + , mrParaPropertyPanel(rPanel) + , mpBindings(NULL) +{ + FreeResource(); + mpBindings = mrParaPropertyPanel.GetBindings(); + maBulletsVS.SetColCount(3); + maBulletsVS.SetLineCount(3); + maBulletsVS.SetStyle( maBulletsVS.GetStyle() | WB_ITEMBORDER |WB_NO_DIRECTSELECT); + maBulletsVS.SetExtraSpacing(BULLET_IMAGE_SPACING); + if(GetSettings().GetStyleSettings().GetHighContrastMode()) + maBulletsVS.SetBackground(GetSettings().GetStyleSettings().GetMenuColor()); + else + maBulletsVS.SetBackground(Color(244,245,249)); + + maBulletsVS.SetItemWidth(BULLET_IMAGE_WIDTH); + maBulletsVS.SetItemHeight(BULLET_IMAGE_HEIGHT); + maBulletsVS.InsertItem( DEFAULT_NONE ); + for( sal_uInt16 nVSIdx = 1; nVSIdx <= DEFAULT_BULLET_TYPES; ++nVSIdx ) + { + maBulletsVS.InsertItem( nVSIdx ); + } + + maBulletsVS.SetItemText( DEFAULT_NONE, SVX_RESSTR( RID_SVXSTR_NUMBULLET_NONE )); + NBOTypeMgrBase* pBullets = NBOutlineTypeMgrFact::CreateInstance(eNBOType::MIXBULLETS); + if ( pBullets ) + { + for( sal_uInt16 nIndex = 0; nIndex < DEFAULT_BULLET_TYPES; ++nIndex ) + { + maBulletsVS.SetItemText( nIndex + 1, pBullets->GetDescription(nIndex) ); + } + } + + maBulletsVS.Show(); + maBulletsVS.SetSelectHdl(LINK(this, ParaBulletsControl, BulletSelectHdl_Impl)); + + /*maMoreButton.SetDefBkColor(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_DropDownBackground ));//Color(244,245,249)//for high contrast + maMoreButton.SetHoverBkColor(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ) );//Color( 93, 120, 163 ) + maMoreButton.SetHoverTxtColor( sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Color_PanelTitleFont ) );//Color( 255, 255, 255 ) + maMoreButton.SetIcoPosX( 2);*/ + maBulletsVS.SetColor(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); + maBulletsVS.SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); + + maMoreButton.SetClickHdl(LINK(this, ParaBulletsControl, MoreButtonClickHdl_Impl)); + +} + +ParaBulletsControl::~ParaBulletsControl() +{ + +} + +void ParaBulletsControl::UpdateValueSet() +{ + maBulletsVS.StateChanged(STATE_CHANGE_STYLE); + maBulletsVS.StateChanged(STATE_CHANGE_INITSHOW); +} +void ParaBulletsControl::ToGetFocus() +{ + sal_uInt16 nTypeIndex = (sal_uInt16)0xFFFF; + mrParaPropertyPanel.GetBulletTypeIndex(); + if ( nTypeIndex != (sal_uInt16)0xFFFF ) + maBulletsVS.SelectItem( nTypeIndex ); + else + { + maBulletsVS.SelectItem(0); + } + maMoreButton.GrabFocus(); +} + +IMPL_LINK(ParaBulletsControl, BulletSelectHdl_Impl, ValueSet*, EMPTYARG) +{ + sal_uInt16 nIdx = maBulletsVS.GetSelectItemId(); + SfxUInt16Item aItem(FN_SVX_SET_BULLET, nIdx); + if (mpBindings) + mpBindings->GetDispatcher()->Execute( FN_SVX_SET_BULLET, SFX_CALLMODE_RECORD, &aItem, 0L ); + + mrParaPropertyPanel.EndBulletsPopupMode(); + + return 0; +} + +IMPL_LINK(ParaBulletsControl, MoreButtonClickHdl_Impl, void*, EMPTYARG) +{ + if (mpBindings) + mpBindings->GetDispatcher()->Execute( SID_OUTLINE_BULLET, SFX_CALLMODE_ASYNCHRON ); + + mrParaPropertyPanel.EndBulletsPopupMode(); + + return 0; +} + +}} // end of namespace sidebar + + diff --git a/svx/source/sidebar/paragraph/ParaBulletsControl.hxx b/svx/source/sidebar/paragraph/ParaBulletsControl.hxx new file mode 100644 index 000000000000..6b29a605f99b --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaBulletsControl.hxx @@ -0,0 +1,58 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_SIDEBAR_BULLETS_CONTROL_HXX_ +#define _SVX_SIDEBAR_BULLETS_CONTROL_HXX_ + +#include "svx/sidebar/PopupControl.hxx" +#include "svx/sidebar/ValueSetWithTextControl.hxx" +#include <sfx2/bindings.hxx> +#include <svtools/ctrlbox.hxx> +#include <svtools/ctrltool.hxx> +#include "ParaPropertyPanel.hxx" +#include <vcl/fixed.hxx> +#include <svl/poolitem.hxx> +#include <editeng/lspcitem.hxx> +#include <sfx2/sidebar/EnumContext.hxx> +#include <vcl/button.hxx> + + +namespace svx { namespace sidebar { + +class ParaBulletsControl:public svx::sidebar::PopupControl +{ +private: + SvxNumValueSet3 maBulletsVS; + FixedImage maFISep; + PushButton maMoreButton; + ParaPropertyPanel& mrParaPropertyPanel; + SfxBindings* mpBindings; + + DECL_LINK(BulletSelectHdl_Impl, ValueSet*); + DECL_LINK(MoreButtonClickHdl_Impl, void*); + +public: + ParaBulletsControl(Window* pParent, svx::sidebar::ParaPropertyPanel& rPanel); + ~ParaBulletsControl(); + void ToGetFocus(); + void UpdateValueSet(); +}; + +}} + +#endif + diff --git a/svx/source/sidebar/paragraph/ParaBulletsPopup.cxx b/svx/source/sidebar/paragraph/ParaBulletsPopup.cxx new file mode 100644 index 000000000000..cd9314827f97 --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaBulletsPopup.cxx @@ -0,0 +1,59 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "ParaBulletsPopup.hxx" +#include "ParaBulletsControl.hxx" +#include <boost/bind.hpp> +#include <unotools/viewoptions.hxx> + +namespace svx { namespace sidebar { + +ParaBulletsPopup::ParaBulletsPopup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator) + : Popup( + pParent, + rControlCreator, + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Paragraph Bullets"))) +{ +} + + + + +ParaBulletsPopup::~ParaBulletsPopup (void) +{ +} + + + + +void ParaBulletsPopup::UpdateValueSet () +{ + ProvideContainerAndControl(); + + ParaBulletsControl* pControl = dynamic_cast<ParaBulletsControl*>(mpControl.get()); + if (pControl != NULL) + pControl->UpdateValueSet(); +} + + + +} } // end of namespace svx::sidebar + + + diff --git a/svx/source/sidebar/paragraph/ParaBulletsPopup.hxx b/svx/source/sidebar/paragraph/ParaBulletsPopup.hxx new file mode 100644 index 000000000000..c8b645b2bdf1 --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaBulletsPopup.hxx @@ -0,0 +1,49 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_SIDEBAR_BULLETS_POPUP_HXX_ +#define _SVX_SIDEBAR_BULLETS_POPUP_HXX_ + +#include "svx/sidebar/Popup.hxx" + +#include <boost/function.hpp> +#include <svl/poolitem.hxx> +#include <tools/fldunit.hxx> +#include <sfx2/sidebar/EnumContext.hxx> + +namespace svx { namespace sidebar { + +class ParaBulletsPopup + : public Popup +{ +public : + ParaBulletsPopup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator); + ~ParaBulletsPopup (void); + + void UpdateValueSet (); +//private: + //void PopupModeEndCallback (void); +}; + +} } // end of namespace svx::sidebar + +#endif + + + diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx new file mode 100644 index 000000000000..cbb93209e4f2 --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx @@ -0,0 +1,816 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "ParaLineSpacingControl.hxx" +#include "ParaPropertyPanel.hrc" +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include <svx/dialogs.hrc> +#include <svx/dialmgr.hxx> +#include <unotools/viewoptions.hxx> +#include <editeng/kernitem.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/sidebar/Theme.hxx> +#include <svtools/unitconv.hxx> + +#define _DEFAULT_LINE_SPACING 200 +#define FIX_DIST_DEF 283 +#define LINESPACE_1 100 +#define LINESPACE_15 150 +#define LINESPACE_2 200 +#define LINESPACE_115 115 + +#define LLINESPACE_1 0 +#define LLINESPACE_15 1 +#define LLINESPACE_2 2 +#define LLINESPACE_PROP 3 +#define LLINESPACE_MIN 4 +#define LLINESPACE_DURCH 5 +#define LLINESPACE_FIX 6 + +#define DO_NOT_CUSTOM 0 +#define USE_CUSTOM 1 + +namespace svx { namespace sidebar { + + +ParaLineSpacingControl::ParaLineSpacingControl(Window* pParent, svx::sidebar::ParaPropertyPanel& rPanel) + : PopupControl( pParent,SVX_RES(RID_POPUPPANEL_PARAPAGE_LINESPACING)) + , mbUseLineSPCustom (0) + , mbLineSPDisable (0) + , mrParaPropertyPanel(rPanel) + , mpBindings(NULL) + , nMinFixDist(BEGIN_VALUE) + , pActLineDistFld(&aLineDistAtPercentBox) + , maLineSpacing(ValueSetWithTextControl::IMAGE_TEXT,this, SVX_RES( LINE_SPACING ) ) + , maCustomFT ( this, SVX_RES( FT_CUSTOM ) ) + , maLSpacingFT ( this, SVX_RES( FT_LINE_SPACING ) ) + , aLineDist( this, SVX_RES( LB_LINE_SPACING )) + , maOfFT ( this, SVX_RES( FT_OF ) ) + , aLineDistAtPercentBox ( this, SVX_RES( ED_SBINDE_LINEDISTPERCENT ) ) + , aLineDistAtMetricBox ( this, SVX_RES( ED_SBINDE_LINEDISTPOINT ) ) + , maSpacing1 (SVX_RES(IMG_SPACING1)) + , maSpacing115 (SVX_RES(IMG_SPACING115)) + , maSpacing15 (SVX_RES(IMG_SPACING15)) + , maSpacing2 (SVX_RES(IMG_SPACING2)) + , maLPCustom (SVX_RES(IMG_SPACINGLCUSTOM)) + , maSelSpacing1 (SVX_RES(IMG_SEL_SPACING1)) + , maSelSpacing115 (SVX_RES(IMG_SEL_SPACING115)) + , maSelSpacing15 (SVX_RES(IMG_SEL_SPACING15)) + , maSelSpacing2 (SVX_RES(IMG_SEL_SPACING2)) + , maImgCus (SVX_RES(IMG_CUSTOM)) + , maImgCusGrey (SVX_RES(IMG_CUSTOM_GRAY)) + , maStrCus (SVX_RES(STR_LCVALUE)) + , mpImg(NULL) + , mpImgSel(NULL) + , mpStr(NULL) + , mpStrTip(NULL) + , maLine(SVX_RES(STR_LSPACING)) + , maOf(SVX_RES(STR_LS_OF)) + , maValue( 0 ) + , maPos( 0 ) +{ + initial(); + FreeResource(); + mpBindings = mrParaPropertyPanel.GetBindings(); +// m_eLNSpaceUnit = mrParaPropertyPanel.maLNSpaceControl.GetCoreMetric(); + m_eLNSpaceUnit = SFX_MAPUNIT_100TH_MM; +} +ParaLineSpacingControl::~ParaLineSpacingControl() +{ + delete[] mpImg; + delete[] mpImgSel; + delete[] mpStr; + delete[] mpStrTip; +} + +void ParaLineSpacingControl::initial() +{ + //maLineSpacing.SetStyle( maLineSpacing.GetStyle()| WB_3DLOOK | WB_NO_DIRECTSELECT ); + //maLineSpacing.SetControlBackground(GetSettings().GetStyleSettings().GetMenuColor()); + //maLineSpacing.SetColor(GetSettings().GetStyleSettings().GetMenuColor()); + //maLineSpacing.SetMinFont(); + + maLineSpacing.SetControlBackground(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); + maLineSpacing.SetColor(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); + maLineSpacing.SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); + //maFTSpacing.SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()? + //GetSettings().GetStyleSettings().GetMenuColor(): + //sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); + //maFTBy.SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()? + //GetSettings().GetStyleSettings().GetMenuColor(): + //sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); + + mpImg = new Image[4]; + mpImg[0] = maSpacing1; + mpImg[1] = maSpacing115; + mpImg[2] = maSpacing15; + mpImg[3] = maSpacing2; + + mpImgSel = new Image[4]; + mpImgSel[0] = maSelSpacing1; + mpImgSel[1] = maSelSpacing115; + mpImgSel[2] = maSelSpacing15; + mpImgSel[3] = maSelSpacing2; + + mpStr = new XubString[4]; + mpStr[0] = XubString(SVX_RES(STR_SPACING1)); + mpStr[1] = XubString(SVX_RES(STR_SPACING115)); + mpStr[2] = XubString(SVX_RES(STR_SPACING15)); + mpStr[3] = XubString(SVX_RES(STR_SPACING2)); + + mpStrTip = new XubString[4]; + mpStrTip[0] = XubString(SVX_RES(STR_LS_SINGLE)); + mpStrTip[1] = XubString(SVX_RES(STR_LS_115)); + mpStrTip[2] = XubString(SVX_RES(STR_LS_15)); + mpStrTip[3] = XubString(SVX_RES(STR_LS_DOUBLE)); + for (int i=0;i<4;i++) + maLineSpacing.AddItem(mpImg[i], &mpImgSel[i],mpStr[i],&mpStrTip[i]); + + maLineSpacing.AddItem( maImgCus, 0, maStrCus, 0 ); + + SetAllNoSel(); + Link aLink = LINK(this, ParaLineSpacingControl,VSSelHdl ); + maLineSpacing.SetSelectHdl(aLink); + maLineSpacing.StartSelection(); + maLineSpacing.Show(); + + aLink = LINK( this, ParaLineSpacingControl, LineSPDistHdl_Impl ); + aLineDist.SetSelectHdl(aLink); + aLineDist.SelectEntryPos( LLINESPACE_1 ) ; + aLink = LINK( this, ParaLineSpacingControl, LineSPDistAtHdl_Impl ); + aLineDistAtPercentBox.SetModifyHdl( aLink ); + aLineDistAtMetricBox.SetModifyHdl( aLink ); +} +void ParaLineSpacingControl::ToGetFocus(bool bType) +{ + if(!bType) + aLineDist.GrabFocus(); + else + maLineSpacing.GrabFocus(); //wj +} + +void ParaLineSpacingControl::PopupModeEndCallback() +{ + if( mbUseLineSPCustom ) + { + //maLinePos = mpLineSPPage->maPos; + //maLineValue = mpLineSPPage->maValue; + + SvtViewOptions aWinOpt( E_WINDOW, LSP_POS_GLOBAL_VALUE ); + ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq(1); + aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("maLinePos") ); + aSeq[0].Value <<= ::rtl::OUString::number(maPos); + aWinOpt.SetUserData( aSeq ); + + SvtViewOptions aWinOpt2( E_WINDOW, LSP_LV_GLOBAL_VALUE ); + aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("maLineValue") ); + aSeq[0].Value <<= ::rtl::OUString::number(maValue); + aWinOpt2.SetUserData( aSeq ); + } +} + +void ParaLineSpacingControl::Rearrange(SfxItemState currSPState,FieldUnit currMetricUnit,SvxLineSpacingItem* currSPItem,const ::sfx2::sidebar::EnumContext currentContext) +{ + SvtViewOptions aWinOpt( E_WINDOW, LSP_POS_GLOBAL_VALUE ); + if ( aWinOpt.Exists() ) + { + ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt.GetUserData(); + ::rtl::OUString aTmp; + if ( aSeq.getLength()) + aSeq[0].Value >>= aTmp; + + String aWinData( aTmp ); + maPos = (sal_uInt16)aWinData.ToInt32(); + } + + SvtViewOptions aWinOpt2( E_WINDOW, LSP_LV_GLOBAL_VALUE ); + if ( aWinOpt2.Exists() ) + { + ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt2.GetUserData(); + ::rtl::OUString aTmp; + if ( aSeq.getLength()) + aSeq[0].Value >>= aTmp; + + String aWinData( aTmp ); + maValue = (sal_uInt16)aWinData.ToInt32(); + } + String sHelpText; + switch(maPos) + { + case LLINESPACE_1: + sHelpText += mpStrTip[0]; + break; + case LLINESPACE_15: + sHelpText += mpStrTip[2]; + break; + case LLINESPACE_2: + sHelpText += mpStrTip[3]; + break; + case LLINESPACE_PROP: + sHelpText +=maLine; + sHelpText.Append(String("Proportion: ", 12, RTL_TEXTENCODING_ASCII_US)); + sHelpText += maOf; + sHelpText.Append( OUString::number( maValue )); + break; + case LLINESPACE_MIN: + sHelpText += maLine; + sHelpText.Append(String("At Least: ", 10, RTL_TEXTENCODING_ASCII_US)); + sHelpText += maOf; + sHelpText.Append( OUString::number( maValue )); + break; + case LLINESPACE_DURCH: + sHelpText += maLine; + sHelpText.Append(String("Leading: ", 9, RTL_TEXTENCODING_ASCII_US)); + sHelpText += maOf; + sHelpText.Append( OUString::number( maValue )); + break; + case LLINESPACE_FIX: + sHelpText += maLine; + sHelpText.Append(String("Fixed: ", 7, RTL_TEXTENCODING_ASCII_US)); + sHelpText += maOf; + sHelpText.Append( OUString::number( maValue )); + break; + } + if( !aWinOpt.Exists() && !aWinOpt2.Exists() ) + mbLineSPDisable = sal_True; + else + mbLineSPDisable = sal_False; + + if( mbLineSPDisable ) + maLineSpacing.ReplaceItemImages(5, maImgCusGrey,0); + else + { + maLineSpacing.ReplaceItemImages(5, maImgCus,0); + maLineSpacing.SetItemText(5,sHelpText); + } + + SfxItemState eState = currSPState; + + SetFieldUnit( aLineDistAtMetricBox, currMetricUnit ); + +// mpLineSPPage->SetAllNoSel(); + aLineDist.Enable(); + pActLineDistFld->Enable(); + pActLineDistFld->SetText( String() ); + //bool bValueSetFocus = sal_False; //wj + + if( eState >= SFX_ITEM_AVAILABLE ) + { + // SfxMapUnit eUnit = maLNSpaceControl.GetCoreMetric(); + SfxMapUnit eUnit = SFX_MAPUNIT_100TH_MM; + m_eLNSpaceUnit = eUnit; + + switch( currSPItem->GetLineSpaceRule() ) + { + case SVX_LINE_SPACE_AUTO: + { + SvxInterLineSpace eInter = currSPItem->GetInterLineSpaceRule(); + + switch( eInter ) + { + case SVX_INTER_LINE_SPACE_OFF: + { + aLineDist.SelectEntryPos( LLINESPACE_1 ); + pActLineDistFld->Disable(); + pActLineDistFld->SetText( String() ); + mbUseLineSPCustom = DO_NOT_CUSTOM; + if ( LINESPACE_1 == currSPItem->GetPropLineSpace() ) + { + maLineSpacing.SelectItem(1); + //bValueSetFocus = sal_True; //wj + } + } + break; + + case SVX_INTER_LINE_SPACE_PROP: + { + if ( LINESPACE_1 == currSPItem->GetPropLineSpace() ) + { + aLineDist.SelectEntryPos( LLINESPACE_1 ); + pActLineDistFld->Disable(); + pActLineDistFld->SetText( String() ); + mbUseLineSPCustom = DO_NOT_CUSTOM; + maLineSpacing.SelectItem(1); + //bValueSetFocus = sal_True; //wj + break; + } + if ( LINESPACE_15 == currSPItem->GetPropLineSpace() ) + { + aLineDist.SelectEntryPos( LLINESPACE_15 ); + pActLineDistFld->Disable(); + pActLineDistFld->SetText( String() ); + + mbUseLineSPCustom = DO_NOT_CUSTOM; + maLineSpacing.SelectItem(3); + //bValueSetFocus = sal_True; //wj + break; + } + if ( LINESPACE_2 == currSPItem->GetPropLineSpace() ) + { + aLineDist.SelectEntryPos( LLINESPACE_2 ); + pActLineDistFld->Disable(); + pActLineDistFld->SetText( String() ); + + mbUseLineSPCustom = DO_NOT_CUSTOM; + maLineSpacing.SelectItem(4); + //bValueSetFocus = sal_True; //wj + break; + } + + aLineDist.SelectEntryPos( LLINESPACE_PROP ); + if(pActLineDistFld != &(aLineDistAtPercentBox)) + { + pActLineDistFld->Disable(); + pActLineDistFld->Hide(); + pActLineDistFld = &(aLineDistAtPercentBox); + } + else + { + pActLineDistFld = &(aLineDistAtMetricBox); + pActLineDistFld->Disable(); + pActLineDistFld->Hide(); + pActLineDistFld = &(aLineDistAtPercentBox); + } + pActLineDistFld->Enable(); + pActLineDistFld->Show(); + aLineDistAtPercentBox. + SetValue( aLineDistAtPercentBox.Normalize( + currSPItem->GetPropLineSpace() ) ); + + if( currSPItem->GetPropLineSpace() == LINESPACE_115 ) + { + mbUseLineSPCustom = DO_NOT_CUSTOM; + maLineSpacing.SelectItem(2); + //bValueSetFocus = sal_True; //wj + } + else + { + mbUseLineSPCustom = USE_CUSTOM; + maLineSpacing.SetNoSelection(); + maLineSpacing.SelectItem(0); + } + } + break; + + case SVX_INTER_LINE_SPACE_FIX: + { + if(pActLineDistFld != &(aLineDistAtMetricBox)) + { + pActLineDistFld->Disable(); + pActLineDistFld->Hide(); + pActLineDistFld = &(aLineDistAtMetricBox); + } + else + { + pActLineDistFld = &(aLineDistAtPercentBox); + pActLineDistFld->Disable(); + pActLineDistFld->Hide(); + pActLineDistFld = &(aLineDistAtMetricBox); + } + pActLineDistFld->Enable(); + pActLineDistFld->Show(); + maLineSpacing.SetNoSelection(); + maLineSpacing.SelectItem(0); + + SetMetricValue( aLineDistAtMetricBox, + currSPItem->GetInterLineSpace(), eUnit ); + aLineDist.SelectEntryPos( LLINESPACE_DURCH ); + + mbUseLineSPCustom = USE_CUSTOM; + } + break; + default: + break; + } + } + break; + case SVX_LINE_SPACE_FIX: + { + if(pActLineDistFld != &(aLineDistAtMetricBox)) + { + pActLineDistFld->Disable(); + pActLineDistFld->Hide(); + pActLineDistFld = &(aLineDistAtMetricBox); + } + else + { + pActLineDistFld = &(aLineDistAtPercentBox); + pActLineDistFld->Disable(); + pActLineDistFld->Hide(); + pActLineDistFld = &(aLineDistAtMetricBox); + } + pActLineDistFld->Enable(); + pActLineDistFld->Show(); + maLineSpacing.SetNoSelection(); + maLineSpacing.SelectItem(0); + + SetMetricValue(aLineDistAtMetricBox, currSPItem->GetLineHeight(), eUnit); + aLineDist.SelectEntryPos( LLINESPACE_FIX ); + + mbUseLineSPCustom = USE_CUSTOM; + } + break; + + case SVX_LINE_SPACE_MIN: + { + if(pActLineDistFld != &(aLineDistAtMetricBox)) + { + pActLineDistFld->Disable(); + pActLineDistFld->Hide(); + pActLineDistFld = &(aLineDistAtMetricBox); + } + else + { + pActLineDistFld = &(aLineDistAtPercentBox); + pActLineDistFld->Disable(); + pActLineDistFld->Hide(); + pActLineDistFld = &(aLineDistAtMetricBox); + } + pActLineDistFld->Enable(); + pActLineDistFld->Show(); + maLineSpacing.SetNoSelection(); + maLineSpacing.SelectItem(0); + + SetMetricValue(aLineDistAtMetricBox, currSPItem->GetLineHeight(), eUnit); + aLineDist.SelectEntryPos( LLINESPACE_MIN ); + mbUseLineSPCustom = USE_CUSTOM; + } + break; + default: + break; + } + } + else if( eState == SFX_ITEM_DISABLED ) + { + aLineDist.Disable(); + pActLineDistFld->Enable(sal_False); + pActLineDistFld->SetText( String() ); + maLineSpacing.SetNoSelection(); + maLineSpacing.SelectItem(0); + + mbUseLineSPCustom = DO_NOT_CUSTOM; + } + else + { + pActLineDistFld->Enable(sal_False); + pActLineDistFld->SetText( String() ); + aLineDist.SetNoSelection(); + maLineSpacing.SetNoSelection(); + maLineSpacing.SelectItem(0); + mbUseLineSPCustom = DO_NOT_CUSTOM; + } + + aLineDist.SaveValue(); + + /*sal_uInt16 nID = pBox->GetCurItemId(); + pBox->SetItemDown(nID, sal_True); + + Size aFloatSz = GetOutputSizePixel(); + + GetLineSPFloatWin()->SetSizePixel( aFloatSz ); + + Point aPos=maLineSPTbx->GetPosPixel(); + aPos.setX(aPos.getX()); + aPos = OutputToScreenPixel( aPos ); + Size aSize = maLineSPTbx->GetSizePixel(); + Rectangle aRect( aPos, aSize ); + + GetLineSPFloatWin()->StartPopupMode( aRect, FLOATWIN_POPUPMODE_DOWN | FLOATWIN_POPUPMODE_NOFOCUSCLOSE); + GetLineSPFloatWin()->SetPopupModeFlags(GetLineSPFloatWin()->GetPopupModeFlags() | FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE ); + + pLineSPPage->ToGetFocus(bValueSetFocus); + */ + sal_uInt16 uCount = aLineDist.GetEntryCount(); + if( uCount == LLINESPACE_FIX + 1 ) + { + switch (currentContext.GetCombinedContext()) + { + case CombinedEnumContext(Application_Impress, Context_Table): + case CombinedEnumContext(Application_Draw, Context_Table): + case CombinedEnumContext(Application_Writer, Context_DrawText): + case CombinedEnumContext(Application_Calc, Context_DrawText): + case CombinedEnumContext(Application_Draw, Context_DrawText): + case CombinedEnumContext(Application_Impress, Context_DrawText): + case CombinedEnumContext(Application_Writer, Context_Annotation): + case CombinedEnumContext(Application_Draw, Context_Draw): + case CombinedEnumContext(Application_Draw, Context_TextObject): + case CombinedEnumContext(Application_Draw, Context_Graphic): + case CombinedEnumContext(Application_Impress, Context_Draw): + case CombinedEnumContext(Application_Impress, Context_TextObject): + case CombinedEnumContext(Application_Impress, Context_Graphic): + { + aLineDist.RemoveEntry(LLINESPACE_FIX); + } + } + } + else if( uCount == LLINESPACE_FIX) + { + switch (currentContext.GetCombinedContext()) + { + case CombinedEnumContext(Application_Writer, Context_Default): + case CombinedEnumContext(Application_Writer, Context_Text): + case CombinedEnumContext(Application_Writer, Context_Table): + { + aLineDist.InsertEntry(OUString("Fixed"), LLINESPACE_FIX); + } + } + } + maLineSpacing.Format(); + maLineSpacing.StartSelection(); +} + +void ParaLineSpacingControl::SetAllNoSel() +{ + maLineSpacing.SelectItem(1); + maLineSpacing.SetNoSelection(); +} + +IMPL_LINK( ParaLineSpacingControl, LineSPDistHdl_Impl, ListBox*, pBox ) +{ + maLineSpacing.SetNoSelection(); + maLineSpacing.SelectItem(0); + maLineSpacing.Format(); + maLineSpacing.StartSelection(); + + switch( pBox->GetSelectEntryPos() ) + { + case LLINESPACE_1: + case LLINESPACE_15: + case LLINESPACE_2: + pActLineDistFld->Enable(sal_False); + pActLineDistFld->SetText( String() ); + break; + + case LLINESPACE_DURCH: + aLineDistAtPercentBox.Hide(); + pActLineDistFld = &aLineDistAtMetricBox; + aLineDistAtMetricBox.SetMin(0); + + + if ( aLineDistAtMetricBox.GetText().isEmpty() ) + aLineDistAtMetricBox.SetValue( + aLineDistAtMetricBox.Normalize( 0 ) ); + aLineDistAtPercentBox.Hide(); + pActLineDistFld->Show(); + pActLineDistFld->Enable(); + break; + + case LLINESPACE_MIN: + aLineDistAtPercentBox.Hide(); + pActLineDistFld = &aLineDistAtMetricBox; + aLineDistAtMetricBox.SetMin(0); + + if ( aLineDistAtMetricBox.GetText().isEmpty() ) + aLineDistAtMetricBox.SetValue( + aLineDistAtMetricBox.Normalize( 0 ), FUNIT_TWIP ); + aLineDistAtPercentBox.Hide(); + pActLineDistFld->Show(); + pActLineDistFld->Enable(); + break; + + case LLINESPACE_PROP: + aLineDistAtMetricBox.Hide(); + pActLineDistFld = &aLineDistAtPercentBox; + + if ( aLineDistAtPercentBox.GetText().isEmpty() ) + aLineDistAtPercentBox.SetValue( + aLineDistAtPercentBox.Normalize( 100 ), FUNIT_TWIP ); + aLineDistAtMetricBox.Hide(); + pActLineDistFld->Show(); + pActLineDistFld->Enable(); + break; + case LLINESPACE_FIX: + { + aLineDistAtPercentBox.Hide(); + pActLineDistFld = &aLineDistAtMetricBox; + sal_Int64 nTemp = aLineDistAtMetricBox.GetValue(); + aLineDistAtMetricBox.SetMin(aLineDistAtMetricBox.Normalize(nMinFixDist), FUNIT_TWIP); + + if ( aLineDistAtMetricBox.GetValue() != nTemp ) + SetMetricValue( aLineDistAtMetricBox, + FIX_DIST_DEF, SFX_MAPUNIT_TWIP ); + aLineDistAtPercentBox.Hide(); + pActLineDistFld->Show(); + pActLineDistFld->Enable(); + } + break; + } + ExecuteLineSpace(); + return 0; +} + +IMPL_LINK_NOARG( ParaLineSpacingControl, LineSPDistAtHdl_Impl ) +{ + ExecuteLineSpace(); + return (0L); +} + +void ParaLineSpacingControl::ExecuteLineSpace() +{ + aLineDist.SaveValue(); + maLineSpacing.SetNoSelection(); + + SvxLineSpacingItem aSpacing(_DEFAULT_LINE_SPACING, SID_ATTR_PARA_LINESPACE); + sal_uInt16 nPos = aLineDist.GetSelectEntryPos(); + + switch ( nPos ) + { + case LLINESPACE_1: + case LLINESPACE_15: + case LLINESPACE_2: + { + SetLineSpace( aSpacing, nPos ); + maPos = nPos; + } + break; + + case LLINESPACE_PROP: + { + SetLineSpace( aSpacing, nPos, + aLineDistAtPercentBox.Denormalize( + (long)aLineDistAtPercentBox.GetValue() ) ); + maPos = nPos; + maValue =aLineDistAtPercentBox.GetValue(); + } + break; + + case LLINESPACE_MIN: + case LLINESPACE_DURCH: + case LLINESPACE_FIX: + { + SetLineSpace( aSpacing, nPos, + GetCoreValue( aLineDistAtMetricBox, m_eLNSpaceUnit ) ); + maPos = nPos; + maValue = GetCoreValue( aLineDistAtMetricBox, m_eLNSpaceUnit ); + } + break; + + default: + OSL_ENSURE(false, "error!!"); + break; + } + + mpBindings->GetDispatcher()->Execute( + SID_ATTR_PARA_LINESPACE, SFX_CALLMODE_RECORD, &aSpacing, 0L); + + mbUseLineSPCustom = USE_CUSTOM; +} + +void ParaLineSpacingControl::SetLineSpace( SvxLineSpacingItem& rLineSpace, + int eSpace, long lValue ) +{ + switch ( eSpace ) + { + case LLINESPACE_1: + rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO; + rLineSpace.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF; + break; + + case LLINESPACE_15: + rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO; + rLineSpace.SetPropLineSpace( LINESPACE_15 ); + break; + + case LLINESPACE_2: + rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO; + rLineSpace.SetPropLineSpace( LINESPACE_2 ); + break; + + case LLINESPACE_PROP: + rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO; + rLineSpace.SetPropLineSpace( (sal_uInt8)lValue ); + break; + + case LLINESPACE_MIN: + rLineSpace.SetLineHeight( (sal_uInt16)lValue ); + rLineSpace.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF; + break; + + case LLINESPACE_DURCH: + rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO; + rLineSpace.SetInterLineSpace( (sal_uInt16)lValue ); + break; + + case LLINESPACE_FIX: + rLineSpace.SetLineHeight((sal_uInt16)lValue); + rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_FIX; + rLineSpace.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF; + break; + } +} + +IMPL_LINK(ParaLineSpacingControl, VSSelHdl, void *, pControl) +{ + maLineSpacing.SetNoSelection(); + bool bClosePop = true; + if(pControl == &maLineSpacing) + { + sal_uInt16 iPos = maLineSpacing.GetSelectItemId(); + switch ( iPos ) + { + case 1: + ExecuteLineSpacing( 0, 0 ); + break; + case 2: + ExecuteLineSpacing( 0, 3 ); + break; + case 3: + ExecuteLineSpacing( 0, 1 ); + break; + case 4: + ExecuteLineSpacing( 0, 2 ); + break; + case 5: + { + if(!(mbLineSPDisable)) + { + //maPos = mrParaPropertyPanel.maLinePos; + aLineDist.SelectEntryPos( maPos ) ; + aLineDist.SaveValue(); + //maValue = mrParaPropertyPanel.maLineValue; + + SvxLineSpacingItem aSpacing(_DEFAULT_LINE_SPACING, SID_ATTR_PARA_LINESPACE); + switch(maPos) + { + case LLINESPACE_1: + case LLINESPACE_15: + case LLINESPACE_2: + SetLineSpace( aSpacing, maPos ); + break; + + case LLINESPACE_PROP: + SetLineSpace( aSpacing, maPos, + aLineDistAtPercentBox.Denormalize( (long)maValue ) ); + break; + + case LLINESPACE_MIN: + case LLINESPACE_DURCH: + case LLINESPACE_FIX: + SetLineSpace( aSpacing, maPos, (long)maValue ); + break; + } + + mpBindings->GetDispatcher()->Execute( + SID_ATTR_PARA_LINESPACE, SFX_CALLMODE_RECORD, &aSpacing, 0L); + + ExecuteLineSpacing( USE_CUSTOM, 0 ); + } + else + bClosePop = sal_False; + } + break; + } + } + if(bClosePop) + mrParaPropertyPanel.EndSpacingPopupMode(); + return 0; +} + +void ParaLineSpacingControl::ExecuteLineSpacing( sal_uInt16 aIsCustom, sal_uInt16 aEntry ) +{ + if( !aIsCustom ) + { + aLineDist.SelectEntryPos( aEntry ) ; + aLineDist.SaveValue(); + SvxLineSpacingItem aSpacing(_DEFAULT_LINE_SPACING, SID_ATTR_PARA_LINESPACE); + sal_uInt16 nPos = aEntry; + if( aEntry == LLINESPACE_PROP ) + SetLineSpace( aSpacing, nPos, aLineDistAtPercentBox.Denormalize( (long)115 ) ); + else + SetLineSpace( aSpacing, nPos ); + + mpBindings->GetDispatcher()->Execute( + SID_ATTR_PARA_LINESPACE, SFX_CALLMODE_RECORD, &aSpacing, 0L); + } + + if( !aIsCustom ) + { + mbUseLineSPCustom = DO_NOT_CUSTOM; + mrParaPropertyPanel.EndSpacingPopupMode(); + } + maLineSpacing.SetNoSelection(); +} + +}} // end of namespace sidebar + diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx b/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx new file mode 100644 index 000000000000..ed3f643fb406 --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx @@ -0,0 +1,113 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_SIDEBAR_LINE_SPACING_CONTROL_HXX_ +#define _SVX_SIDEBAR_LINE_SPACING_CONTROL_HXX_ + +#include "svx/sidebar/PopupControl.hxx" +#include "svx/sidebar/ValueSetWithTextControl.hxx" +#include <sfx2/bindings.hxx> +#include <svtools/ctrlbox.hxx> +#include <svtools/ctrltool.hxx> +#include "ParaPropertyPanel.hxx" +#include <vcl/fixed.hxx> +#include <svl/poolitem.hxx> +#include <editeng/lspcitem.hxx> +#include <sfx2/sidebar/EnumContext.hxx> + + +namespace svx { namespace sidebar { + +#define LSP_POS_GLOBAL_VALUE String("Line_Spacing_Pos", 16, RTL_TEXTENCODING_ASCII_US) +#define LSP_LV_GLOBAL_VALUE String("Line_Spacing_Lv", 15, RTL_TEXTENCODING_ASCII_US) +#define BEGIN_VALUE 28 +class ParaLineSpacingControl:public svx::sidebar::PopupControl +{ +public: + ParaLineSpacingControl(Window* pParent, svx::sidebar::ParaPropertyPanel& rPanel); + ~ParaLineSpacingControl(); + void ToGetFocus(bool bType); + void Rearrange(SfxItemState currSPState,FieldUnit currMetricUnit,SvxLineSpacingItem* currSPItem,const ::sfx2::sidebar::EnumContext currentContext); + //virtual void Paint(const Rectangle& rect); + + //add + short GetLastCustomState(); + long GetLastCustomValue(); + //add end + + void ExecuteLineSpace(); + void SetLineSpace( SvxLineSpacingItem& rLineSpace, + int eSpace, long lValue = 0 ); + + void ExecuteLineSpacing( sal_uInt16 aIsCustom, sal_uInt16 aEntry ); + void SetAllNoSel(); + void PopupModeEndCallback(); + +private: + bool mbUseLineSPCustom; + bool mbLineSPDisable; + SfxMapUnit m_eLNSpaceUnit; + ParaPropertyPanel& mrParaPropertyPanel; + SfxBindings* mpBindings; + + long nMinFixDist; + Edit* pActLineDistFld; + + ValueSetWithTextControl maLineSpacing; + + FixedText maCustomFT; + FixedText maLSpacingFT; + ListBox aLineDist; + + FixedText maOfFT; + MetricField aLineDistAtPercentBox; + MetricField aLineDistAtMetricBox; + + Image maSpacing1; + Image maSpacing115; + Image maSpacing15; + Image maSpacing2; + Image maLPCustom; + + Image maSelSpacing1; + Image maSelSpacing115; + Image maSelSpacing15; + Image maSelSpacing2; + Image maSelSelHanging; + Image maImgCus; + Image maImgCusGrey; + XubString maStrCus; + + Image* mpImg; + Image* mpImgSel; + XubString* mpStr; + XubString* mpStrTip; + String maLine; + String maOf; + + sal_Int64 maValue; + sal_uInt16 maPos; +private: + void initial(); + DECL_LINK(LineSPDistHdl_Impl, ListBox*); + DECL_LINK(LineSPDistAtHdl_Impl, void*); + DECL_LINK(VSSelHdl, void*); +}; +}} + +#endif + diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx b/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx new file mode 100644 index 000000000000..20f942359bda --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx @@ -0,0 +1,78 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "ParaLineSpacingPopup.hxx" +#include "ParaLineSpacingControl.hxx" +#include <boost/bind.hpp> +#include <unotools/viewoptions.hxx> + +namespace svx { namespace sidebar { + +ParaLineSpacingPopup::ParaLineSpacingPopup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator) + : Popup( + pParent, + rControlCreator, + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Paragraph Line Spacing"))) +{ + SetPopupModeEndHandler(::boost::bind(&ParaLineSpacingPopup::PopupModeEndCallback, this)); +} + + + + +ParaLineSpacingPopup::~ParaLineSpacingPopup (void) +{ +} + + + + +void ParaLineSpacingPopup::Rearrange (SfxItemState currSPState,FieldUnit currMetricUnit,SvxLineSpacingItem* currSPItem,const ::sfx2::sidebar::EnumContext currentContext) +{ + ProvideContainerAndControl(); + + ParaLineSpacingControl* pControl = dynamic_cast<ParaLineSpacingControl*>(mpControl.get()); + if (pControl != NULL) + pControl->Rearrange(currSPState,currMetricUnit, currSPItem,currentContext); +} + +void ParaLineSpacingPopup::PopupModeEndCallback (void) +{ + ProvideContainerAndControl(); + ParaLineSpacingControl* pControl = dynamic_cast<ParaLineSpacingControl*>(mpControl.get()); + if (pControl == NULL) + return; + + pControl->PopupModeEndCallback(); + + /*if( pControl->GetLastCustomState() == SPACING_CLOSE_BY_CUS_EDIT) + { + SvtViewOptions aWinOpt( E_WINDOW, SIDEBAR_SPACING_GLOBAL_VALUE ); + ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq(1); + aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Spacing") ); + aSeq[0].Value <<= ::rtl::OUString( String::CreateFromInt32( pControl->GetLastCustomValue() )); + aWinOpt.SetUserData( aSeq ); + + }*/ +} + + +} } // end of namespace svx::sidebar + + diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingPopup.hxx b/svx/source/sidebar/paragraph/ParaLineSpacingPopup.hxx new file mode 100644 index 000000000000..b040ac393b70 --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaLineSpacingPopup.hxx @@ -0,0 +1,49 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_SIDEBAR_LINE_SPACING_POPUP_HXX_ +#define _SVX_SIDEBAR_LINE_SPACING_POPUP_HXX_ + +#include "svx/sidebar/Popup.hxx" + +#include <boost/function.hpp> +#include <svl/poolitem.hxx> +#include <tools/fldunit.hxx> +#include <editeng/lspcitem.hxx> +#include <sfx2/sidebar/EnumContext.hxx> + +namespace svx { namespace sidebar { + +class ParaLineSpacingPopup + : public Popup +{ +public : + ParaLineSpacingPopup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator); + ~ParaLineSpacingPopup (void); + + void Rearrange (SfxItemState currSPState,FieldUnit currMetricUnit,SvxLineSpacingItem* currSPItem ,const ::sfx2::sidebar::EnumContext currentContext); +private: + void PopupModeEndCallback (void); +}; + +} } // end of namespace svx::sidebar + +#endif + + diff --git a/svx/source/sidebar/paragraph/ParaNumberingControl.cxx b/svx/source/sidebar/paragraph/ParaNumberingControl.cxx new file mode 100644 index 000000000000..266cb7a49a82 --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaNumberingControl.cxx @@ -0,0 +1,165 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "ParaNumberingControl.hxx" +#include "ParaPropertyPanel.hrc" +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include <svx/dialogs.hrc> +#include <svx/dialmgr.hxx> +#include <unotools/viewoptions.hxx> +#include <editeng/kernitem.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/sidebar/Theme.hxx> +#include <svtools/unitconv.hxx> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/text/XDefaultNumberingProvider.hpp> +#include <com/sun/star/text/XNumberingFormatter.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <comphelper/processfactory.hxx> +#include <svx/nbdtmg.hxx> +#include <svx/nbdtmgfact.hxx> +#include <editeng/unolingu.hxx> +using namespace com::sun::star; +using namespace com::sun::star::uno; +using namespace com::sun::star::beans; +using namespace com::sun::star::lang; +using namespace com::sun::star::text; + +namespace svx { namespace sidebar { + +Reference<XDefaultNumberingProvider> lcl_GetNumberingProvider() +{ + Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); + Reference < XInterface > xI = xMSF->createInstance( + ::rtl::OUString::createFromAscii( "com.sun.star.text.DefaultNumberingProvider" ) ); + Reference<XDefaultNumberingProvider> xRet(xI, UNO_QUERY); +// DBG_ASSERT(xRet.is(), "service missing: \"com.sun.star.text.DefaultNumberingProvider\"") + + return xRet; +} + +ParaNumberingControl::ParaNumberingControl(Window* pParent, svx::sidebar::ParaPropertyPanel& rPanel): + PopupControl( pParent,SVX_RES(RID_POPUPPANEL_PARAPAGE_NUMBERING)), + maNumberVS(this,SVX_RES(VS_NUMBERING)), + maFISep(this,SVX_RES(IMG_SEPERATOR_NUMBERING)), + maMoreButton(this,SVX_RES(CB_NUMBERING_MORE) ), + mrParaPropertyPanel(rPanel), + mpBindings(NULL) +{ + FreeResource(); + mpBindings = mrParaPropertyPanel.GetBindings(); + + maNumberVS.SetStyle(maNumberVS.GetStyle() | WB_NO_DIRECTSELECT); + maNumberVS.SetExtraSpacing(NUM_IMAGE_SPACING); + //add by wj for sym2_7246 high contrast + if(GetSettings().GetStyleSettings().GetHighContrastMode()) + maNumberVS.SetBackground(GetSettings().GetStyleSettings().GetMenuColor()); + else + maNumberVS.SetBackground(Color(244,245,249)); + + maNumberVS.SetItemWidth(NUM_IMAGE_WIDTH); + maNumberVS.SetItemHeight(NUM_IMAGE_HEIGHT); + + Reference<XDefaultNumberingProvider> xDefNum = lcl_GetNumberingProvider(); + if(xDefNum.is()) + { + Sequence< Sequence< PropertyValue > > aNumberings; + Locale aLocale = GetSettings().GetLanguageTag().getLocale(); + try + { + aNumberings = + xDefNum->getDefaultContinuousNumberingLevels( aLocale ); + } + catch(Exception&) + { + } + Reference<XNumberingFormatter> xFormat(xDefNum, UNO_QUERY); + maNumberVS.SetNumberingSettings(aNumberings, xFormat, aLocale); + } + + maNumberVS.Show(); + maNumberVS.SetSelectHdl(LINK(this, ParaNumberingControl, NumSelectHdl_Impl)); + + /*maMoreButton.SetDefBkColor(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_DropDownBackground ));//Color(244,245,249)//for high contrast + maMoreButton.SetHoverBkColor(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ) );//Color( 93, 120, 163 ) + maMoreButton.SetHoverTxtColor( sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Color_PanelTitleFont ) );//Color( 255, 255, 255 ) + maMoreButton.SetIcoPosX( 2);*/ + maNumberVS.SetColor(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); + maNumberVS.SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); + + maMoreButton.SetClickHdl(LINK(this, ParaNumberingControl, MoreButtonClickHdl_Impl)); + +} + +ParaNumberingControl::~ParaNumberingControl() +{ +} + + +IMPL_LINK(ParaNumberingControl, NumSelectHdl_Impl, ValueSet*, EMPTYARG) +{ + sal_uInt16 nIdx = maNumberVS.GetSelectItemId(); + SfxUInt16Item aItem(FN_SVX_SET_NUMBER, nIdx); + if (mpBindings) + mpBindings->GetDispatcher()->Execute( FN_SVX_SET_NUMBER, SFX_CALLMODE_RECORD, &aItem, 0L ); + + mrParaPropertyPanel.EndNumberingPopupMode(); + + return 0; +} + +IMPL_LINK(ParaNumberingControl, MoreButtonClickHdl_Impl, void*, EMPTYARG) +{ + if (mpBindings) + mpBindings->GetDispatcher()->Execute( SID_OUTLINE_BULLET, SFX_CALLMODE_ASYNCHRON ); + + mrParaPropertyPanel.EndNumberingPopupMode(); + + return 0; +} + +void ParaNumberingControl::UpdateValueSet() +{ + maNumberVS.StateChanged(STATE_CHANGE_STYLE); + maNumberVS.StateChanged(STATE_CHANGE_INITSHOW); +} + +void ParaNumberingControl::ToGetFocus() +{ + sal_uInt16 nTypeIndex = mrParaPropertyPanel.GetNumTypeIndex(); + if ( nTypeIndex != (sal_uInt16)0xFFFF ) + maNumberVS.SelectItem( nTypeIndex ); + else + { + maNumberVS.SelectItem(0); + } + maMoreButton.GrabFocus(); +} + +}} // end of namespace sidebar + + + diff --git a/svx/source/sidebar/paragraph/ParaNumberingControl.hxx b/svx/source/sidebar/paragraph/ParaNumberingControl.hxx new file mode 100644 index 000000000000..89392bf67662 --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaNumberingControl.hxx @@ -0,0 +1,62 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_SIDEBAR_NUMBERING_CONTROL_HXX_ +#define _SVX_SIDEBAR_NUMBERING_CONTROL_HXX_ + + +#include "svx/sidebar/PopupControl.hxx" +#include "svx/sidebar/ValueSetWithTextControl.hxx" +#include <sfx2/bindings.hxx> +#include <svtools/ctrlbox.hxx> +#include <svtools/ctrltool.hxx> +#include "ParaPropertyPanel.hxx" +#include <vcl/fixed.hxx> +#include <svl/poolitem.hxx> +#include <editeng/lspcitem.hxx> +#include <sfx2/sidebar/EnumContext.hxx> +#include <vcl/button.hxx> + + +namespace svx { namespace sidebar { + + +class ParaNumberingControl:public svx::sidebar::PopupControl +{ +private: + SvxNumValueSet2 maNumberVS; + FixedImage maFISep; + PushButton maMoreButton; + ParaPropertyPanel& mrParaPropertyPanel; + SfxBindings* mpBindings; + + DECL_LINK(NumSelectHdl_Impl, ValueSet*); + DECL_LINK(MoreButtonClickHdl_Impl, void*); + +public: + ParaNumberingControl(Window* pParent, svx::sidebar::ParaPropertyPanel& rPanel); + ~ParaNumberingControl(); + void ToGetFocus(); + void UpdateValueSet(); + +}; + + +}} + +#endif + diff --git a/svx/source/sidebar/paragraph/ParaNumberingPopup.cxx b/svx/source/sidebar/paragraph/ParaNumberingPopup.cxx new file mode 100644 index 000000000000..de4bc5c5e9a5 --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaNumberingPopup.cxx @@ -0,0 +1,60 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "ParaNumberingPopup.hxx" +#include "ParaNumberingControl.hxx" +#include <boost/bind.hpp> +#include <unotools/viewoptions.hxx> + +namespace svx { namespace sidebar { + +ParaNumberingPopup::ParaNumberingPopup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator) + : Popup( + pParent, + rControlCreator, + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Paragraph Numbering"))) +{ +} + + + + +ParaNumberingPopup::~ParaNumberingPopup (void) +{ +} + + + + +void ParaNumberingPopup::UpdateValueSet () +{ + ProvideContainerAndControl(); + + ParaNumberingControl* pControl = dynamic_cast<ParaNumberingControl*>(mpControl.get()); + if (pControl != NULL) + pControl->UpdateValueSet(); +} + + + +} } // end of namespace svx::sidebar + + + + diff --git a/svx/source/sidebar/paragraph/ParaNumberingPopup.hxx b/svx/source/sidebar/paragraph/ParaNumberingPopup.hxx new file mode 100644 index 000000000000..b682ba66a7e5 --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaNumberingPopup.hxx @@ -0,0 +1,50 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_SIDEBAR_NUMBERING_POPUP_HXX_ +#define _SVX_SIDEBAR_NUMBERING_POPUP_HXX_ + +#include "svx/sidebar/Popup.hxx" + +#include <boost/function.hpp> +#include <svl/poolitem.hxx> +#include <tools/fldunit.hxx> +#include <sfx2/sidebar/EnumContext.hxx> + +namespace svx { namespace sidebar { + +class ParaNumberingPopup + : public Popup +{ +public : + ParaNumberingPopup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator); + ~ParaNumberingPopup (void); + + void UpdateValueSet (); +//private: + //void PopupModeEndCallback (void); +}; + +} } // end of namespace svx::sidebar + +#endif + + + + diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx new file mode 100644 index 000000000000..ff268382ae45 --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx @@ -0,0 +1,1674 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include <svx/sidebar/ColorControl.hxx> + +#include "ParaPropertyPanel.hxx" +#include "ParaPropertyPanel.hrc" + +#include "ParaLineSpacingPopup.hxx" +#include "ParaLineSpacingControl.hxx" +#include "ParaBulletsPopup.hxx" +#include "ParaBulletsControl.hxx" +#include "ParaNumberingPopup.hxx" +#include "ParaNumberingControl.hxx" +#include <sfx2/sidebar/Theme.hxx> +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include <sfx2/sidebar/ControlFactory.hxx> +#include <svx/sidebar/PopupContainer.hxx> +#include <sfx2/dispatch.hxx> +#include <editeng/colritem.hxx> +#include <editeng/brushitem.hxx> +#include <editeng/lrspitem.hxx> +#include <editeng/ulspitem.hxx> +#include <vcl/toolbox.hxx> +#include <vcl/fixed.hxx> +#include <vcl/svapp.hxx> +#include <svx/svxids.hrc> +#include <svl/intitem.hxx> +#include "svx/dialmgr.hxx" +#include <sfx2/objsh.hxx> +#include <svtools/unitconv.hxx> +#include <boost/bind.hpp> +using namespace css; +using namespace cssu; +using ::sfx2::sidebar::Theme; +using ::sfx2::sidebar::ControlFactory; + +#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) + + +namespace svx {namespace sidebar { +#define DEFAULT_VALUE 0 +#define TOOLBOX_ITEM1 1 +#define TOOLBOX_ITEM2 2 +#define TOOLBOX_ITEM3 3 +#define TOOLBOX_ITEM4 4 + +#define MAX_DURCH 5670 + +#define INDENT_INCREMENT 1 +#define INDENT_DECREMENT 2 +#define INDENT_STEP 706 +#define UL_STEP 58 +#define UL_INCREMENT 1 +#define UL_DECREMENT 2 + +#define MAX_SW 1709400 +#define MAX_SC_SD 116220200 +#define NEGA_MAXVALUE -10000000 + +#define POS_FT_PARA_SPACE Point(LogicToPixel(Point(FT_PARA_SPACE_X,FT_PARA_SPACE_Y), MAP_APPFONT)) +#define POS_FT_PARA_SPACE2 Point(LogicToPixel(Point(FT_PARA_SPACE_X,FT_PARA_SPACE_Y2), MAP_APPFONT)) +#define POS_TBX_PARA_SPACE_INC_DEC Point(LogicToPixel(Point(TBX_PARA_SPACE_INC_DEC_X,TBX_PARA_SPACE_INC_DEC_Y), MAP_APPFONT)) +#define POS_TBX_PARA_SPACE_INC_DEC2 Point(LogicToPixel(Point(TBX_PARA_SPACE_INC_DEC_X,TBX_PARA_SPACE_INC_DEC_Y2), MAP_APPFONT)) +#define POS_FT_PARA_INDENT Point(LogicToPixel(Point(FT_PARA_INDENT_X,FT_PARA_INDENT_Y), MAP_APPFONT)) +#define POS_FT_PARA_INDENT2 Point(LogicToPixel(Point(FT_PARA_INDENT_X,FT_PARA_INDENT_Y2), MAP_APPFONT)) +#define POS_TBX_PARA_INDENT_INC_DEC Point(LogicToPixel(Point(TBX_PARA_INDENT_INC_DEC_X,TBX_PARA_INDENT_INC_DEC_Y), MAP_APPFONT)) +#define POS_TBX_PARA_INDENT_INC_DEC2 Point(LogicToPixel(Point(TBX_PARA_INDENT_INC_DEC_X,TBX_PARA_INDENT_INC_DEC_Y2), MAP_APPFONT)) +#define POS_MBX_TOP_DIST Point(LogicToPixel(Point(MBX_TOP_DIST_X,MBX_TOP_DIST_Y), MAP_APPFONT)) +#define POS_MBX_TOP_DIST2 Point(LogicToPixel(Point(MBX_TOP_DIST_X,MBX_TOP_DIST_Y2), MAP_APPFONT)) +#define POS_MBX_BOT_DIST Point(LogicToPixel(Point(MBX_BOT_DIST_X,MBX_BOT_DIST_Y), MAP_APPFONT)) +#define POS_MBX_BOT_DIST2 Point(LogicToPixel(Point(MBX_BOT_DIST_X,MBX_BOT_DIST_Y2), MAP_APPFONT)) +#define POS_MBX_LEFT_DIST Point(LogicToPixel(Point(MBX_LEFT_DIST_X,MBX_LEFT_DIST_Y), MAP_APPFONT)) +#define POS_MBX_LEFT_DIST2 Point(LogicToPixel(Point(MBX_LEFT_DIST_X,MBX_LEFT_DIST_Y2), MAP_APPFONT)) +#define POS_MBX_RIGHT_DIST Point(LogicToPixel(Point(MBX_RIGHT_DIST_X,MBX_RIGHT_DIST_Y), MAP_APPFONT)) +#define POS_MBX_RIGHT_DIST2 Point(LogicToPixel(Point(MBX_RIGHT_DIST_X,MBX_RIGHT_DIST_Y2), MAP_APPFONT)) +#define POS_MBX_FLINE_DIST Point(LogicToPixel(Point(MBX_FLINE_DIST_X,MBX_FLINE_DIST_Y), MAP_APPFONT)) +#define POS_MBX_FLINE_DIST2 Point(LogicToPixel(Point(MBX_FLINE_DIST_X,MBX_FLINE_DIST_Y2), MAP_APPFONT)) +#define POS_IMG_SPACE1 Point(LogicToPixel(Point(IMG_SPACE_X,IMG_SPACE1_Y), MAP_APPFONT)) +#define POS_IMG_SPACE12 Point(LogicToPixel(Point(IMG_SPACE_X,IMG_SPACE1_Y2), MAP_APPFONT)) +#define POS_IMG_SPACE2 Point(LogicToPixel(Point(IMG_SPACE_X,IMG_SPACE2_Y), MAP_APPFONT)) +#define POS_IMG_SPACE22 Point(LogicToPixel(Point(IMG_SPACE_X,IMG_SPACE2_Y2), MAP_APPFONT)) +#define POS_IMG_INDENT1 Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT1_Y), MAP_APPFONT)) +#define POS_IMG_INDENT12 Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT1_Y2), MAP_APPFONT)) +#define POS_IMG_INDENT2 Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT2_Y), MAP_APPFONT)) +#define POS_IMG_INDENT22 Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT2_Y2), MAP_APPFONT)) +#define POS_IMG_INDENT3 Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT3_Y), MAP_APPFONT)) +#define POS_IMG_INDENT32 Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT3_Y2), MAP_APPFONT)) +#define TBX_LINE_SPACE Point(LogicToPixel(Point(TBX_LINE_SPACE_X,TBX_LINE_SPACE_Y), MAP_APPFONT)) +#define TBX_LINE_SPACE2 Point(LogicToPixel(Point(TBX_LINE_SPACE_X,TBX_LINE_SPACE_Y2), MAP_APPFONT)) + +ParaPropertyPanel* ParaPropertyPanel::Create ( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings, + const cssu::Reference<css::ui::XSidebar>& rxSidebar) +{ + if (pParent == NULL) + throw lang::IllegalArgumentException(A2S("no parent Window given to ParaPropertyPanel::Create"), NULL, 0); + if ( ! rxFrame.is()) + throw lang::IllegalArgumentException(A2S("no XFrame given to ParaPropertyPanel::Create"), NULL, 1); + if (pBindings == NULL) + throw lang::IllegalArgumentException(A2S("no SfxBindings given to ParaPropertyPanel::Create"), NULL, 2); + + return new ParaPropertyPanel( + pParent, + rxFrame, + pBindings, + rxSidebar); +} + +void ParaPropertyPanel::HandleContextChange ( + const ::sfx2::sidebar::EnumContext aContext) +{ + if (maContext == aContext) + { + // Nothing to do. + return; + } + + maContext = aContext; + switch (maContext.GetCombinedContext_DI()) + { + case CombinedEnumContext(Application_Calc, Context_DrawText): + maTBxVertAlign->Show(); + maTBxVertAlignBackground->Show(); + maTBxBackColor->Hide(); + maTBxBackColorBackground->Hide(); + maTBxNumBullet->Hide(); + maTBxNumBulletBackground->Hide(); + ReSize(false); + maTbxIndent_IncDec->Show(); + maTbxIndent_IncDecBackground->Show(); + maTbxProDemote->Hide(); + maTbxProDemoteBackground->Hide(); + break; + + case CombinedEnumContext(Application_DrawImpress, Context_Draw): + case CombinedEnumContext(Application_DrawImpress, Context_TextObject): + case CombinedEnumContext(Application_DrawImpress, Context_Graphic): + maTBxVertAlign->Hide(); + maTBxVertAlignBackground->Hide(); + maTBxBackColor->Hide(); + maTBxBackColorBackground->Hide(); + maTBxNumBullet->Show(); + maTBxNumBulletBackground->Show(); + ReSize(true); + maTbxIndent_IncDec->Hide(); + maTbxIndent_IncDecBackground->Hide(); + maTbxProDemote->Show(); + maTbxProDemoteBackground->Show(); + break; + + case CombinedEnumContext(Application_DrawImpress, Context_DrawText): + maTBxVertAlign->Show(); + maTBxVertAlignBackground->Show(); + maTBxBackColor->Hide(); + maTBxBackColorBackground->Hide(); + maTBxNumBullet->Show(); + maTBxNumBulletBackground->Show(); + ReSize(true); + maTbxIndent_IncDec->Hide(); + maTbxIndent_IncDecBackground->Hide(); + maTbxProDemote->Show(); + maTbxProDemoteBackground->Show(); + break; + + case CombinedEnumContext(Application_DrawImpress, Context_Table): + maTBxVertAlign->Show(); + maTBxVertAlignBackground->Show(); + maTBxBackColor->Hide(); + maTBxBackColorBackground->Hide(); + maTBxNumBullet->Show(); + maTBxNumBulletBackground->Show(); + ReSize(true); + maTbxIndent_IncDec->Hide(); + maTbxIndent_IncDecBackground->Hide(); + maTbxProDemote->Show(); + maTbxProDemoteBackground->Show(); + break; + + case CombinedEnumContext(Application_WriterAndWeb, Context_Default): + case CombinedEnumContext(Application_WriterAndWeb, Context_Text): + maTBxVertAlign->Hide(); + maTBxVertAlignBackground->Hide(); + maTBxBackColor->Show(); + maTBxBackColorBackground->Show(); + maTBxNumBullet->Show(); + + maTBxNumBulletBackground->Show(); + ReSize(true); + maTbxIndent_IncDec->Show(); + maTbxIndent_IncDecBackground->Show(); + maTbxProDemote->Hide(); + maTbxProDemoteBackground->Hide(); + break; + + case CombinedEnumContext(Application_WriterAndWeb, Context_Table): + maTBxVertAlign->Show(); + maTBxVertAlignBackground->Show(); + maTBxBackColor->Show(); + maTBxBackColorBackground->Show(); + maTBxNumBullet->Show(); + maTBxNumBulletBackground->Show(); + ReSize(true); + maTbxIndent_IncDec->Show(); + maTbxIndent_IncDecBackground->Show(); + maTbxProDemote->Hide(); + maTbxProDemoteBackground->Hide(); + break; + + case CombinedEnumContext(Application_WriterAndWeb, Context_DrawText): + maTBxVertAlign->Show(); + maTBxVertAlignBackground->Show(); + maTBxBackColor->Hide(); + maTBxBackColorBackground->Hide(); + maTBxNumBullet->Hide(); + maTBxNumBulletBackground->Hide(); + ReSize(false); + maTbxIndent_IncDec->Show(); + maTbxIndent_IncDecBackground->Show(); + maTbxProDemote->Hide(); + maTbxProDemoteBackground->Hide(); + break; + + case CombinedEnumContext(Application_WriterAndWeb, Context_Annotation): + maTBxVertAlign->Hide(); + maTBxVertAlignBackground->Hide(); + maTBxBackColor->Hide(); + maTBxBackColorBackground->Hide(); + maTBxNumBullet->Hide(); + maTBxNumBulletBackground->Hide(); + ReSize(false); + maTbxIndent_IncDec->Show(); + maTbxIndent_IncDecBackground->Show(); + maTbxProDemote->Hide(); + maTbxProDemoteBackground->Hide(); + break; + + case CombinedEnumContext(Application_Calc, Context_EditCell): + case CombinedEnumContext(Application_Calc, Context_Cell): + case CombinedEnumContext(Application_Calc, Context_Pivot): + case CombinedEnumContext(Application_DrawImpress, Context_Text): + case CombinedEnumContext(Application_DrawImpress, Context_OutlineText): + /*{ + mpToolBoxScriptSw->Hide(); + mpToolBoxScript->Show(); + mpToolBoxSpacing->Show(); + mpToolBoxHighlight->Hide(); + + Size aSize(PROPERTYPAGE_WIDTH,TEXT_SECTIONPAGE_HEIGHT); + aSize = LogicToPixel( aSize,MapMode(MAP_APPFONT) ); + aSize.setWidth(GetOutputSizePixel().Width()); + SetSizePixel(aSize); + }*/ + break; + + default: + break; + } +} + +SfxBindings* ParaPropertyPanel::GetBindings() +{ + return mpBindings; +} + +void ParaPropertyPanel::SetupIcons (void) +{ + if (Theme::GetBoolean(Theme::Bool_UseSymphonyIcons)) + { + } + else + { + } +} + +void ParaPropertyPanel::DataChanged (const DataChangedEvent& rEvent) +{ + (void)rEvent; + + SetupIcons(); +} + +ParaPropertyPanel::~ParaPropertyPanel() +{ + delete mpLnSPItem; +} + +void ParaPropertyPanel::ReSize(bool bSize) +{ + if(bSize) + { + //Paragraph spacing + maFTUL->SetPosPixel(POS_FT_PARA_SPACE); + maTbxUL_IncDec->SetPosPixel(POS_TBX_PARA_SPACE_INC_DEC); + maTopDist->SetPosPixel(POS_MBX_TOP_DIST); + maBottomDist->SetPosPixel(POS_MBX_BOT_DIST); + //Indent + maFTIndent->SetPosPixel(POS_FT_PARA_INDENT); + maTbxIndent_IncDec->SetPosPixel(POS_TBX_PARA_INDENT_INC_DEC); + maTbxProDemote->SetPosPixel(POS_TBX_PARA_INDENT_INC_DEC); + maLeftIndent->SetPosPixel(POS_MBX_LEFT_DIST); + maRightIndent->SetPosPixel(POS_MBX_RIGHT_DIST); + maFLineIndent->SetPosPixel(POS_MBX_FLINE_DIST); + //Line spacing + maLineSPTbx->SetPosPixel(TBX_LINE_SPACE); + //image + maFISpace1.SetPosPixel(POS_IMG_SPACE1); + maFISpace2.SetPosPixel(POS_IMG_SPACE2); + maFIndent1.SetPosPixel(POS_IMG_INDENT1); + maFIndent2.SetPosPixel(POS_IMG_INDENT2); + maFIndent3.SetPosPixel(POS_IMG_INDENT3); + Size aSize(GetOutputSizePixel().Width(),PARA_SECTIONPAGE_HEIGHT); + aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) ); + aSize.setWidth(GetOutputSizePixel().Width()); + SetSizePixel(aSize); + } + else + { + //Paragraph spacing + maFTUL->SetPosPixel(POS_FT_PARA_SPACE2); + maTbxUL_IncDec->SetPosPixel(POS_TBX_PARA_SPACE_INC_DEC2); + maTopDist->SetPosPixel(POS_MBX_TOP_DIST2); + maBottomDist->SetPosPixel(POS_MBX_BOT_DIST2); + //Indent + maFTIndent->SetPosPixel(POS_FT_PARA_INDENT2); + maTbxIndent_IncDec->SetPosPixel(POS_TBX_PARA_INDENT_INC_DEC2); + maTbxProDemote->SetPosPixel(POS_TBX_PARA_INDENT_INC_DEC2); + maLeftIndent->SetPosPixel(POS_MBX_LEFT_DIST2); + maRightIndent->SetPosPixel(POS_MBX_RIGHT_DIST2); + maFLineIndent->SetPosPixel(POS_MBX_FLINE_DIST2); + //Line spacing + maLineSPTbx->SetPosPixel(TBX_LINE_SPACE2); + //image + maFISpace1.SetPosPixel(POS_IMG_SPACE12); + maFISpace2.SetPosPixel(POS_IMG_SPACE22); + maFIndent1.SetPosPixel(POS_IMG_INDENT12); + maFIndent2.SetPosPixel(POS_IMG_INDENT22); + maFIndent3.SetPosPixel(POS_IMG_INDENT32); + Size aSize(GetOutputSizePixel().Width(),PARA_SECTIONPAGE_HEIGHT_2); + aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) ); + aSize.setWidth(GetOutputSizePixel().Width()); + SetSizePixel(aSize); + } + + if (mxSidebar.is()) + mxSidebar->requestLayout(); +} + +void ParaPropertyPanel::EndSpacingPopupMode (void) +{ + maLineSpacePopup.Hide(); +} + +void ParaPropertyPanel::EndBulletsPopupMode (void) +{ + //maUnderlinePopup.Hide(); +} + +void ParaPropertyPanel::EndNumberingPopupMode (void) +{ + //maUnderlinePopup.Hide(); +} + + +void ParaPropertyPanel::InitToolBoxAlign() +{ + maAlignToolBox->SetItemImage(TOOLBOX_ITEM1,maLeftPara); + maAlignToolBox->SetItemImage(TOOLBOX_ITEM2,maCentPara); + maAlignToolBox->SetItemImage(TOOLBOX_ITEM3,maRightPara); + maAlignToolBox->SetItemImage(TOOLBOX_ITEM4,maJusPara); + Link aLink = LINK( this, ParaPropertyPanel, AlignStyleModifyHdl_Impl ); + maAlignToolBox->SetSelectHdl( aLink ); + Size aTbxSize (maAlignToolBox->CalcWindowSizePixel()); + maAlignToolBox->SetOutputSizePixel( aTbxSize ); +} + +void ParaPropertyPanel::InitToolBoxVertAlign() +{ + InitImageList(maTBxVertAlign, maVertImageList, maVertImageListH); + maTBxVertAlign->SetSelectHdl(LINK(this,ParaPropertyPanel,VertTbxSelectHandler)); + Size aTbxSize (maTBxVertAlign->CalcWindowSizePixel()); + maTBxVertAlign->SetOutputSizePixel( aTbxSize ); +} + + +void ParaPropertyPanel::InitToolBoxIndent() +{ + Link aLink = LINK( this, ParaPropertyPanel, ModifyIndentHdl_Impl ); + maLeftIndent->SetModifyHdl( aLink ); + maRightIndent->SetModifyHdl( aLink ); + maFLineIndent->SetModifyHdl( aLink ); + + if( Application::GetSettings().GetLayoutRTL()) + { + maTbxIndent_IncDec->SetItemImage(TOOLBOX_ITEM1,maIndInc_BD); + maTbxIndent_IncDec->SetItemImage(TOOLBOX_ITEM2,maIndDec_BD); + } + else + { + maTbxIndent_IncDec->SetItemImage(TOOLBOX_ITEM1,maIndInc); + maTbxIndent_IncDec->SetItemImage(TOOLBOX_ITEM2,maIndDec); + } + maTbxIndent_IncDec->SetItemImage(TOOLBOX_ITEM3,maIndHang); + aLink = LINK( this, ParaPropertyPanel, ClickIndent_IncDec_Hdl_Impl ); + maTbxIndent_IncDec->SetSelectHdl(aLink); + m_eLRSpaceUnit = maLRSpaceControl.GetCoreMetric(); + Size aTbxSize = maTbxIndent_IncDec->CalcWindowSizePixel(); + maTbxIndent_IncDec->SetOutputSizePixel( aTbxSize ); + + if( Application::GetSettings().GetLayoutRTL()) + { + maTbxProDemote->SetItemImage(TOOLBOX_ITEM1,maIndInc_BD); + maTbxProDemote->SetItemImage(TOOLBOX_ITEM2,maIndDec_BD); + } + else + { + maTbxProDemote->SetItemImage(TOOLBOX_ITEM1,maIndInc); + maTbxProDemote->SetItemImage(TOOLBOX_ITEM2,maIndDec); + } + maTbxProDemote->SetItemImage(TOOLBOX_ITEM3,maIndHang); + aLink = LINK( this, ParaPropertyPanel, ClickProDemote_Hdl_Impl ); + maTbxProDemote->SetSelectHdl(aLink); + m_eLRSpaceUnit = maLRSpaceControl.GetCoreMetric(); + aTbxSize = maTbxProDemote->CalcWindowSizePixel(); + maTbxProDemote->SetOutputSizePixel( aTbxSize ); +} + +void ParaPropertyPanel::InitToolBoxBGColor() +{ + mpColorUpdater.reset(new ::svx::ToolboxButtonColorUpdater(SID_BACKGROUND_COLOR, TBI_BACK_COLOR, maTBxBackColor.get(), TBX_UPDATER_MODE_CHAR_COLOR_NEW )); + + maTBxBackColor->SetItemImage(TBI_BACK_COLOR, GetDisplayBackground().GetColor().IsDark()? maImgBackColorHigh : maImgBackColor); + maTBxBackColor->SetItemBits( TBI_BACK_COLOR, maTBxBackColor->GetItemBits( TBI_BACK_COLOR ) | TIB_DROPDOWNONLY ); + + Link aLink = LINK(this, ParaPropertyPanel, ToolBoxBackColorDDHandler); + maTBxBackColor->SetDropdownClickHdl ( aLink ); + maTBxBackColor->SetSelectHdl ( aLink ); + Size aTbxSize (maTBxBackColor->CalcWindowSizePixel()); + maTBxBackColor->SetOutputSizePixel( aTbxSize ); +} + +void ParaPropertyPanel::InitToolBoxBulletsNumbering() +{ + if( Application::GetSettings().GetLayoutRTL()) + { + maTBxNumBullet->SetItemImage( IID_BULLET, maNumBImageListRTL.GetImage( IID_BULLET ) ); + maTBxNumBullet->SetItemImage( IID_NUMBER, maNumBImageListRTL.GetImage( IID_NUMBER ) ); + } + else + InitImageList(maTBxNumBullet, maNumBImageList, maNumBImageListH); + + maTBxNumBullet->SetDropdownClickHdl(LINK(this,ParaPropertyPanel,NumBTbxDDHandler)); + maTBxNumBullet->SetSelectHdl(LINK(this,ParaPropertyPanel,NumBTbxSelectHandler)); + Size aTbxSize (maTBxNumBullet->CalcWindowSizePixel()); + maTBxNumBullet->SetOutputSizePixel( aTbxSize ); +} +void ParaPropertyPanel::InitToolBoxSpacing() +{ + Link aLink = LINK( this, ParaPropertyPanel, ULSpaceHdl_Impl ); + maTopDist->SetModifyHdl(aLink); + maBottomDist->SetModifyHdl( aLink ); + + maTbxUL_IncDec->SetItemImage(TOOLBOX_ITEM1,maParInc); + maTbxUL_IncDec->SetItemImage(TOOLBOX_ITEM2,maParDec); + aLink = LINK( this, ParaPropertyPanel, ClickUL_IncDec_Hdl_Impl ); + maTbxUL_IncDec->SetSelectHdl(aLink); + m_eULSpaceUnit = maULSpaceControl.GetCoreMetric(); + Size aTbxSize = maTbxUL_IncDec->CalcWindowSizePixel(); + maTbxUL_IncDec->SetOutputSizePixel( aTbxSize ); +} +void ParaPropertyPanel::InitToolBoxLineSpacing() +{ + Link aLink = LINK( this, ParaPropertyPanel, ClickLineSPDropDownHdl_Impl ); + maLineSPTbx->SetDropdownClickHdl( aLink ); + maLineSPTbx->SetSelectHdl( aLink ); //support keyinput "ENTER" + maLineSPTbx->SetItemBits( TOOLBOX_ITEM1, maLineSPTbx->GetItemBits( TOOLBOX_ITEM1 ) | TIB_DROPDOWNONLY ); + maLineSPTbx->SetItemImage(TOOLBOX_ITEM1,maSpace3); + Size aTbxSize = maLineSPTbx->CalcWindowSizePixel(); + maLineSPTbx->SetOutputSizePixel( aTbxSize ); +} + +void ParaPropertyPanel::initial() +{ + maFTUL->SetBackground(Wallpaper()); + maFTIndent->SetBackground(Wallpaper()); + maFISpace1.SetBackground(Wallpaper()); + maFISpace2.SetBackground(Wallpaper()); + maFIndent1.SetBackground(Wallpaper()); + maFIndent2.SetBackground(Wallpaper()); + maFIndent3.SetBackground(Wallpaper()); + + maFISpace1.SetImage(maSpace1); + maFISpace2.SetImage(maSpace2); + maFIndent1.SetImage(maIndent3); + maFIndent2.SetImage(maIndent2); + maFIndent3.SetImage(maIndent1); + + GetBindings()->Invalidate(SID_ATTR_PARA_ADJUST_LEFT,sal_True,sal_False); + GetBindings()->Invalidate(SID_ATTR_PARA_ADJUST_CENTER,sal_True,sal_False); + GetBindings()->Invalidate(SID_ATTR_PARA_ADJUST_RIGHT,sal_True,sal_False); + GetBindings()->Invalidate(SID_ATTR_PARA_ADJUST_BLOCK,sal_True,sal_False); + + //toolbox + SetupIcons(); + InitToolBoxAlign(); + InitToolBoxVertAlign(); + InitToolBoxIndent(); + InitToolBoxBGColor(); + InitToolBoxBulletsNumbering(); + InitToolBoxSpacing(); + InitToolBoxLineSpacing(); + +#ifdef HAS_IA2 + maAlignToolBox->SetAccRelationLabeledBy(&maAlignToolBox); + maTBxVertAlign->SetMpSubEditAccLableBy(&maTBxVertAlign); + maTBxNumBullet->SetAccRelationLabeledBy(&maTBxNumBullet); + maTBxBackColor->SetMpSubEditAccLableBy(&maTBxBackColor); + maFTUL->SetAccRelationLabeledBy(&maFTUL); + maTbxUL_IncDec->SetAccRelationLabeledBy(&maTbxUL_IncDec); + maTopDist->SetAccRelationLabeledBy(&maTopDist); + maBottomDist->SetAccRelationLabeledBy(&maBottomDist); + maLineSPTbx->SetAccRelationLabeledBy(&maLineSPTbx); + maFTIndent->SetAccRelationLabeledBy(&maFTIndent); + maTbxIndent_IncDec->SetAccRelationLabeledBy(&maTbxIndent_IncDec); + maTbxProDemote->SetAccRelationLabeledBy(&maTbxProDemote); + maLeftIndent->SetAccRelationLabeledBy(&maLeftIndent); + maRightIndent->SetAccRelationLabeledBy(&maRightIndent); + maFLineIndent->SetAccRelationLabeledBy(&maFLineIndent); + mpColorUpdater->SetAccRelationLabeledBy(&mpColorUpdater); +#endif +} + +void ParaPropertyPanel::InitImageList(::boost::scoped_ptr<ToolBox>& rTbx, ImageList& rImglst, ImageList& rImgHlst) +{ + sal_Bool bHighContrast = GetDisplayBackground().GetColor().IsDark(); + + ImageList& rImgLst = bHighContrast ? rImgHlst : rImglst; + + sal_uInt16 nCount = rTbx->GetItemCount(); + for (sal_uInt16 i = 0; i < nCount; i++) + { + sal_uInt16 nId = rTbx->GetItemId(i); + rTbx->SetItemImage( nId, rImgLst.GetImage( nId ) ); + } +} + +//===========================for Numbering & Bullet================================================ + + + +IMPL_LINK(ParaPropertyPanel, NumBTbxDDHandler, ToolBox*, pToolBox) +{ + sal_uInt16 nId = pToolBox->GetCurItemId(); + + EndTracking(); + pToolBox->SetItemDown( nId, sal_True ); + + if (nId == 1) + { + maBulletsPopup.UpdateValueSet(); + maBulletsPopup.Show(*pToolBox); + } + else if (nId == 2) + { + maNumberingPopup.UpdateValueSet(); + maNumberingPopup.Show(*pToolBox); + } + pToolBox->SetItemDown( nId, sal_False ); + return 0; +} + +IMPL_LINK(ParaPropertyPanel, NumBTbxSelectHandler, ToolBox*, pToolBox) +{ + sal_uInt16 nId = pToolBox->GetCurItemId(); + sal_uInt16 nSID = SID_TABLE_VERT_NONE; + + EndTracking(); + if (nId == 1) + { + nSID = FN_NUM_BULLET_ON; + } + else if ( nId == 2) + { + nSID = FN_NUM_NUMBERING_ON; + } + SfxBoolItem aBoolItem(nSID, sal_True); + GetBindings()->GetDispatcher()->Execute(nSID, SFX_CALLMODE_RECORD, &aBoolItem, 0L); + + return 0; +} + + +//================================for Vertical Alignment======================================== + + + +IMPL_LINK(ParaPropertyPanel, VertTbxSelectHandler, ToolBox*, pToolBox) +{ + sal_uInt16 nId = pToolBox->GetCurItemId(); + sal_uInt16 nSID = SID_TABLE_VERT_NONE; + EndTracking(); + if (nId == 1) + { + nSID = SID_TABLE_VERT_NONE; + maTBxVertAlign->SetItemState(1, STATE_CHECK); + maTBxVertAlign->SetItemState(2, STATE_NOCHECK); + maTBxVertAlign->SetItemState(3, STATE_NOCHECK); + } + else if (nId == 2) + { + nSID = SID_TABLE_VERT_CENTER; + maTBxVertAlign->SetItemState(1, STATE_NOCHECK); + maTBxVertAlign->SetItemState(2, STATE_CHECK); + maTBxVertAlign->SetItemState(3, STATE_NOCHECK); + } + else if (nId == 3) + { + nSID = SID_TABLE_VERT_BOTTOM; + maTBxVertAlign->SetItemState(1, STATE_NOCHECK); + maTBxVertAlign->SetItemState(2, STATE_NOCHECK); + maTBxVertAlign->SetItemState(3, STATE_CHECK); + } + SfxBoolItem aBoolItem(nSID, sal_True); + GetBindings()->GetDispatcher()->Execute(nSID, SFX_CALLMODE_RECORD, &aBoolItem, 0L); + + return 0; +} + +void ParaPropertyPanel::VertStateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState) +{ + if (eState < SFX_ITEM_DONTCARE) + { + maTBxVertAlign->SetItemState(1, STATE_NOCHECK); + maTBxVertAlign->SetItemState(2, STATE_NOCHECK); + maTBxVertAlign->SetItemState(3, STATE_NOCHECK); + maTBxVertAlign->EnableItem(1, sal_False); + maTBxVertAlign->EnableItem(2, sal_False); + maTBxVertAlign->EnableItem(3, sal_False); + } + else + { + maTBxVertAlign->EnableItem(1, sal_True); + maTBxVertAlign->EnableItem(2, sal_True); + maTBxVertAlign->EnableItem(3, sal_True); + if ( (eState >= SFX_ITEM_DEFAULT) && (pState->ISA(SfxBoolItem))) + { + const SfxBoolItem* pItem= (const SfxBoolItem*)pState; + sal_Bool aBool = (sal_Bool)pItem->GetValue(); + + if (aBool) + { + if (nSID == SID_TABLE_VERT_NONE) + { + maTBxVertAlign->SetItemState(1, STATE_CHECK); + maTBxVertAlign->SetItemState(2, STATE_NOCHECK); + maTBxVertAlign->SetItemState(3, STATE_NOCHECK); + } + else if (nSID == SID_TABLE_VERT_CENTER) + { + maTBxVertAlign->SetItemState(1, STATE_NOCHECK); + maTBxVertAlign->SetItemState(2, STATE_CHECK); + maTBxVertAlign->SetItemState(3, STATE_NOCHECK); + } + else if (nSID == SID_TABLE_VERT_BOTTOM) + { + maTBxVertAlign->SetItemState(1, STATE_NOCHECK); + maTBxVertAlign->SetItemState(2, STATE_NOCHECK); + maTBxVertAlign->SetItemState(3, STATE_CHECK); + } + } + else + { + if (nSID == SID_TABLE_VERT_NONE) + { + maTBxVertAlign->SetItemState(1, STATE_NOCHECK); + } + else if (nSID == SID_TABLE_VERT_CENTER) + { + maTBxVertAlign->SetItemState(2, STATE_NOCHECK); + } + else if (nSID == SID_TABLE_VERT_BOTTOM) + { + maTBxVertAlign->SetItemState(3, STATE_NOCHECK); + } + } + } + else + { + maTBxVertAlign->SetItemState(1, STATE_NOCHECK); + maTBxVertAlign->SetItemState(2, STATE_NOCHECK); + maTBxVertAlign->SetItemState(3, STATE_NOCHECK); + } + } +} +//==================================for Background color===================== + +IMPL_LINK(ParaPropertyPanel, ToolBoxBackColorDDHandler,ToolBox*, pToolBox) +{ + sal_uInt16 nId = pToolBox->GetCurItemId(); + OSL_ASSERT(nId == TBI_BACK_COLOR); + if(nId == TBI_BACK_COLOR) + { + pToolBox->SetItemDown( nId, true ); + maBGColorPopup.Show(*pToolBox); + maBGColorPopup.SetCurrentColor(maColor, mbColorAvailable); + } + return 0; +} + +IMPL_LINK( ParaPropertyPanel, ImplPopupModeEndHdl, FloatingWindow*, EMPTYARG ) +{ + return 0; +} + +void ParaPropertyPanel::ShowMenu (void) +{ + if (mpBindings != NULL) + { + SfxDispatcher* pDispatcher = mpBindings->GetDispatcher(); + if (pDispatcher != NULL) + pDispatcher->Execute(SID_PARA_DLG, SFX_CALLMODE_ASYNCHRON); + } +} + +void ParaPropertyPanel::ParaBKGStateChanged(sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* pState) +{ + if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxColorItem)) + { + const SvxColorItem* pItem = (const SvxColorItem*)pState; + maColor = pItem->GetValue(); + mbColorAvailable = sal_True; + mpColorUpdater->Update(maColor); + } + else + { + mbColorAvailable = sal_False; + maColor.SetColor(COL_AUTO); + mpColorUpdater->Update(maColor); + } +} + +Color ParaPropertyPanel::GetBGColor (void) const +{ + return maColor; +} + +void ParaPropertyPanel::SetBGColor ( + const String& /*rsColorName*/, + const Color aColor) +{ + SvxColorItem aColorItem(aColor, SID_BACKGROUND_COLOR); + mpBindings->GetDispatcher()->Execute(SID_BACKGROUND_COLOR, SFX_CALLMODE_RECORD, &aColorItem, 0L); + maColor = aColor; +} + +//==================================for Paragraph Alignment===================== +IMPL_LINK( ParaPropertyPanel, AlignStyleModifyHdl_Impl, ToolBox*, pBox ) +{ + switch (pBox->GetCurItemId()) + { + case BT_SUBSTLEFT: + { + pBox->SetItemState(BT_SUBSTLEFT,STATE_CHECK); + pBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK); + pBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK); + pBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK); + SfxBoolItem aBoolItem( SID_ATTR_PARA_ADJUST_LEFT, sal_True ); + GetBindings()->GetDispatcher()->Execute(SID_ATTR_PARA_ADJUST_LEFT, SFX_CALLMODE_RECORD, &aBoolItem, 0L); + } + break; + case BT_SUBSTCENTER: + { + pBox->SetItemState(BT_SUBSTCENTER,STATE_CHECK); + pBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK); + pBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK); + pBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK); + SfxBoolItem aBoolItem( SID_ATTR_PARA_ADJUST_CENTER, sal_True ); + GetBindings()->GetDispatcher()->Execute(SID_ATTR_PARA_ADJUST_CENTER, SFX_CALLMODE_RECORD, &aBoolItem, 0L); + } + break; + case BT_SUBSTRIGHT: + { + pBox->SetItemState(BT_SUBSTRIGHT,STATE_CHECK); + pBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK); + pBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK); + pBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK); + SfxBoolItem aBoolItem( SID_ATTR_PARA_ADJUST_RIGHT, sal_True ); + GetBindings()->GetDispatcher()->Execute(SID_ATTR_PARA_ADJUST_RIGHT, SFX_CALLMODE_RECORD, &aBoolItem, 0L); + } + break; + case BT_SUBSTJUSTIFY: + { + pBox->SetItemState(BT_SUBSTJUSTIFY,STATE_CHECK); + pBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK); + pBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK); + pBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK); + SfxBoolItem aBoolItem( SID_ATTR_PARA_ADJUST_BLOCK, sal_True ); + GetBindings()->GetDispatcher()->Execute(SID_ATTR_PARA_ADJUST_BLOCK, SFX_CALLMODE_RECORD, &aBoolItem, 0L); + } + break; + } + + return 0; +} +//==================================for Paragraph Indent===================== +IMPL_LINK_NOARG( ParaPropertyPanel, ModifyIndentHdl_Impl) +{ + SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE ); + aMargin.SetTxtLeft( (const long)GetCoreValue( *maLeftIndent.get(), m_eLRSpaceUnit ) ); + aMargin.SetRight( (const long)GetCoreValue( *maRightIndent.get(), m_eLRSpaceUnit ) ); + aMargin.SetTxtFirstLineOfst( (const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ) ); + + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L); + return 0; +} + +IMPL_LINK(ParaPropertyPanel, ClickIndent_IncDec_Hdl_Impl, ToolBox *, pControl) +{ + switch (pControl->GetCurItemId()) + { + case INDENT_INCREMENT: + { + switch (maContext.GetCombinedContext()) + { + case CombinedEnumContext(Application_Writer, Context_Default): + case CombinedEnumContext(Application_Writer, Context_Text): + case CombinedEnumContext(Application_Writer, Context_Table): + { + SfxBoolItem aMargin( SID_INC_INDENT, sal_True ); + GetBindings()->GetDispatcher()->Execute( + SID_INC_INDENT, SFX_CALLMODE_RECORD, &aMargin, 0L); + } + break; + default: + { + SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE ); + + maTxtLeft += INDENT_STEP; + sal_Int64 nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); + nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit ); + aMargin.SetTxtLeft( (const long)nVal ); + aMargin.SetRight( (const long)GetCoreValue( *maRightIndent.get(), m_eLRSpaceUnit ) ); + aMargin.SetTxtFirstLineOfst( (const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ) ); + + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L); + } + } + } + break; + case INDENT_DECREMENT: + { + switch (maContext.GetCombinedContext()) + { + case CombinedEnumContext(Application_Writer, Context_Default): + case CombinedEnumContext(Application_Writer, Context_Text): + case CombinedEnumContext(Application_Writer, Context_Table): + { + SfxBoolItem aMargin( SID_DEC_INDENT, sal_True ); + GetBindings()->GetDispatcher()->Execute( + SID_DEC_INDENT, SFX_CALLMODE_RECORD, &aMargin, 0L); + } + break; + default: + { + if((maTxtLeft - INDENT_STEP) < 0) + maTxtLeft = DEFAULT_VALUE; + else + maTxtLeft -= INDENT_STEP; + + SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE ); + + sal_Int64 nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); + nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit ); + + aMargin.SetTxtLeft( (const long)nVal ); + aMargin.SetRight( (const long)GetCoreValue( *maRightIndent.get(), m_eLRSpaceUnit ) ); + aMargin.SetTxtFirstLineOfst( (const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ) ); + + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L); + } + } + } + break; + case ID_HANGING_INDENT: + { + SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE ); + aMargin.SetTxtLeft( (const long)GetCoreValue( *maLeftIndent.get(), m_eLRSpaceUnit ) + (const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ) ); + aMargin.SetRight( (const long)GetCoreValue( *maRightIndent.get(), m_eLRSpaceUnit ) ); + aMargin.SetTxtFirstLineOfst( ((const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ))*(-1) ); + + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L); + } + break; + } + return( 0L ); +} + +IMPL_LINK(ParaPropertyPanel, ClickProDemote_Hdl_Impl, ToolBox *, pControl) +{ + switch (pControl->GetCurItemId()) + { + case BT_TBX_INDENT_PROMOTE: + { + SvxLRSpaceItem aMargin( SID_ATTR_PARA_RIGHT ); + + maTxtLeft += INDENT_STEP; + sal_Int64 nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); + nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit ); + aMargin.SetTxtLeft( (const long)nVal ); + aMargin.SetRight( (const long)GetCoreValue( *maRightIndent.get(), m_eLRSpaceUnit ) ); + aMargin.SetTxtFirstLineOfst( (const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ) ); + + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_PARA_RIGHT, SFX_CALLMODE_RECORD, &aMargin, 0L); + } + break; + case BT_TBX_INDENT_DEMOTE: + { + if((maTxtLeft - INDENT_STEP) < 0) + maTxtLeft = DEFAULT_VALUE; + else + maTxtLeft -= INDENT_STEP; + + SvxLRSpaceItem aMargin( SID_ATTR_PARA_LEFT ); + + sal_Int64 nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); + nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit ); + + aMargin.SetTxtLeft( (const long)nVal ); + aMargin.SetRight( (const long)GetCoreValue( *maRightIndent.get(), m_eLRSpaceUnit ) ); + aMargin.SetTxtFirstLineOfst( (const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ) ); + + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_PARA_LEFT, SFX_CALLMODE_RECORD, &aMargin, 0L); + } + break; + case SD_HANGING_INDENT: + { + SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE ); + aMargin.SetTxtLeft( (const long)GetCoreValue( *maLeftIndent.get(), m_eLRSpaceUnit ) + (const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ) ); + aMargin.SetRight( (const long)GetCoreValue( *maRightIndent.get(), m_eLRSpaceUnit ) ); + aMargin.SetTxtFirstLineOfst( ((const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ))*(-1) ); + + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L); + } + break; + } + return( 0L ); +} +//==================================for Paragraph Line Spacing===================== + +IMPL_LINK( ParaPropertyPanel, ClickLineSPDropDownHdl_Impl, ToolBox*, pBox ) +{ + + const sal_uInt16 nId = pBox->GetCurItemId(); + OSL_ASSERT(nId == TOOLBOX_ITEM1); + if(nId == TOOLBOX_ITEM1) + { + pBox->SetItemDown( nId, true ); + maLineSpacePopup.Rearrange(meLnSpState,m_eMetricUnit,mpLnSPItem,maContext); + maLineSpacePopup.Show(*pBox); + + } + return (0L); +} + +//==================================for Paragraph Spacing===================== +IMPL_LINK_NOARG( ParaPropertyPanel, ULSpaceHdl_Impl) +{ + SvxULSpaceItem aMargin( SID_ATTR_PARA_ULSPACE ); + aMargin.SetUpper( (sal_uInt16)GetCoreValue( *maTopDist.get(), m_eULSpaceUnit ) ); + aMargin.SetLower( (sal_uInt16)GetCoreValue( *maBottomDist.get(), m_eULSpaceUnit ) ); + + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_PARA_ULSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L); + return 0L; +} + +IMPL_LINK(ParaPropertyPanel, ClickUL_IncDec_Hdl_Impl, ToolBox *, pControl) +{ + switch (pControl->GetCurItemId()) + { + case UL_INCREMENT: + { + SvxULSpaceItem aMargin( SID_ATTR_PARA_ULSPACE ); + + maUpper += UL_STEP; + sal_Int64 nVal = OutputDevice::LogicToLogic( maUpper, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); + nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit ); + aMargin.SetUpper( (const sal_uInt16)nVal ); + + maLower += UL_STEP; + nVal = OutputDevice::LogicToLogic( maLower, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); + nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit ); + aMargin.SetLower( (const sal_uInt16)nVal ); + + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_PARA_ULSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L); + } + break; + case UL_DECREMENT: + { + SvxULSpaceItem aMargin( SID_ATTR_PARA_ULSPACE ); + + if( maUpper >= UL_STEP ) + { + maUpper -= UL_STEP; + sal_Int64 nVal = OutputDevice::LogicToLogic( maUpper, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); + nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit ); + aMargin.SetUpper( (const sal_uInt16)nVal ); + } + else + aMargin.SetUpper( DEFAULT_VALUE ); + if( maLower >= UL_STEP ) + { + maLower -= UL_STEP; + sal_Int64 nVal = OutputDevice::LogicToLogic( maLower, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); + nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit ); + aMargin.SetLower( (const sal_uInt16)nVal ); + } + else + aMargin.SetLower( DEFAULT_VALUE ); + + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_PARA_ULSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L); + } + break; + } + return( 0L ); +} + +//==================================for Paragraph State change===================== +void ParaPropertyPanel::NotifyItemUpdate( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) +{ + if( nSID == SID_ATTR_METRIC ) + { + m_eMetricUnit = GetCurrentUnit(eState,pState); + if( m_eMetricUnit!=m_last_eMetricUnit ) + { + SetFieldUnit( *maLeftIndent.get(), m_eMetricUnit ); + SetFieldUnit( *maRightIndent.get(), m_eMetricUnit ); + SetFieldUnit( *maFLineIndent.get(), m_eMetricUnit ); + SetFieldUnit( *maTopDist.get(), m_eMetricUnit ); + SetFieldUnit( *maBottomDist.get(), m_eMetricUnit ); + } + m_last_eMetricUnit = m_eMetricUnit; + } + + if( nSID == SID_ATTR_PARA_LRSPACE ) + StateChangedIndentImpl( nSID, eState, pState ); + + if( nSID == SID_ATTR_PARA_LINESPACE ) + StateChangedLnSPImpl( nSID, eState, pState ); + + if( nSID == SID_ATTR_PARA_ULSPACE) + StateChangedULImpl( nSID, eState, pState ); + + if (nSID==SID_ATTR_PARA_ADJUST_LEFT || nSID==SID_ATTR_PARA_ADJUST_CENTER || nSID==SID_ATTR_PARA_ADJUST_RIGHT || nSID==SID_ATTR_PARA_ADJUST_BLOCK) + StateChangedAlignmentImpl( nSID, eState, pState ); + + if (nSID==SID_OUTLINE_LEFT || nSID==SID_OUTLINE_RIGHT) + StateChangeOutLineImpl( nSID, eState, pState ); + + if (nSID==SID_INC_INDENT || nSID==SID_DEC_INDENT) + StateChangeIncDecImpl( nSID, eState, pState ); + // Add toggle state for numbering and bullet icons + if (nSID==FN_NUM_NUMBERING_ON || nSID==FN_NUM_BULLET_ON) + StateChangeBulletNumImpl( nSID, eState, pState ); + + //Get the num rule index data of the current selection + if ( nSID == FN_BUL_NUM_RULE_INDEX ||nSID == FN_NUM_NUM_RULE_INDEX) + StateChangeBulletNumRuleImpl( nSID, eState, pState ); + + if ((nSID == SID_TABLE_VERT_NONE)||(nSID == SID_TABLE_VERT_CENTER)||(nSID == SID_TABLE_VERT_BOTTOM)) + { + VertStateChanged( nSID, eState, pState); + } + else if (nSID == SID_BACKGROUND_COLOR) + { + ParaBKGStateChanged(nSID, eState, pState); + } +} + +void ParaPropertyPanel::StateChangedAlignmentImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) +{ + if( eState >= SFX_ITEM_AVAILABLE ) + { + const SfxBoolItem* pItem = (const SfxBoolItem*)pState; + bool IsChecked = (bool)pItem->GetValue(); + switch (nSID) + { + case SID_ATTR_PARA_ADJUST_LEFT: + { + if(IsChecked) + { + maAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_CHECK); + maAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK); + maAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK); + maAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK); + } + else + maAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK); + } + break; + case SID_ATTR_PARA_ADJUST_CENTER: + { + if(IsChecked) + { + maAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_CHECK); + maAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK); + maAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK); + maAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK); + } + else + maAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK); + } + break; + case SID_ATTR_PARA_ADJUST_RIGHT: + { + if(IsChecked) + { + maAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_CHECK); + maAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK); + maAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK); + maAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK); + } + else + maAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK); + } + break; + case SID_ATTR_PARA_ADJUST_BLOCK: + { + if(IsChecked) + { + maAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_CHECK); + maAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK); + maAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK); + maAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK); + } + else + maAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK); + } + break; + } + } + else if( eState == SFX_ITEM_DISABLED ) + { + } + else if ( eState == SFX_ITEM_DONTCARE ) + { + switch (nSID) + { + case SID_ATTR_PARA_ADJUST_LEFT: + maAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK); + break; + case SID_ATTR_PARA_ADJUST_CENTER: + maAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK); + break; + case SID_ATTR_PARA_ADJUST_RIGHT: + maAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK); + break; + case SID_ATTR_PARA_ADJUST_BLOCK: + maAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK); + break; + } + } +} + +void ParaPropertyPanel::StateChangedIndentImpl( sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* pState ) +{ + switch (maContext.GetCombinedContext()) + { + + case CombinedEnumContext(Application_Writer, Context_DrawText): + case CombinedEnumContext(Application_Calc, Context_DrawText): + case CombinedEnumContext(Application_Writer, Context_Annotation): + { + maLeftIndent->SetMin( DEFAULT_VALUE ); + maRightIndent->SetMin( DEFAULT_VALUE ); + maFLineIndent->SetMin( DEFAULT_VALUE ); + maTbxIndent_IncDec->Show(); + maTbxProDemote->Hide(); + } + break; + case CombinedEnumContext(Application_Draw, Context_DrawText): + case CombinedEnumContext(Application_Impress, Context_DrawText): + case CombinedEnumContext(Application_Draw, Context_Draw): + case CombinedEnumContext(Application_Draw, Context_TextObject): + case CombinedEnumContext(Application_Draw, Context_Graphic): + case CombinedEnumContext(Application_Impress, Context_Draw): + case CombinedEnumContext(Application_Impress, Context_TextObject): + case CombinedEnumContext(Application_Impress, Context_Graphic): + case CombinedEnumContext(Application_Impress, Context_Table): + case CombinedEnumContext(Application_Draw, Context_Table): + { + maLeftIndent->SetMin( DEFAULT_VALUE ); + maRightIndent->SetMin( DEFAULT_VALUE ); + maFLineIndent->SetMin( DEFAULT_VALUE ); + maTbxIndent_IncDec->Hide(); + maTbxProDemote->Show(); + } + break; + case CombinedEnumContext(Application_Writer, Context_Default): + case CombinedEnumContext(Application_Writer, Context_Text): + case CombinedEnumContext(Application_Writer, Context_Table): + { + maLeftIndent->SetMin( NEGA_MAXVALUE, FUNIT_100TH_MM ); + maRightIndent->SetMin( NEGA_MAXVALUE, FUNIT_100TH_MM ); + maFLineIndent->SetMin( NEGA_MAXVALUE, FUNIT_100TH_MM ); + maTbxIndent_IncDec->Show(); + maTbxProDemote->Hide(); + } + break; + } + + if( pState && eState >= SFX_ITEM_AVAILABLE ) + { + SvxLRSpaceItem* pSpace = ( SvxLRSpaceItem*)pState; + maTxtLeft = pSpace->GetTxtLeft(); + maTxtLeft = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)m_eLRSpaceUnit, MAP_100TH_MM ); + maTxtLeft = OutputDevice::LogicToLogic( maTxtLeft, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) ); + + long aTxtRight = pSpace->GetRight(); + aTxtRight = OutputDevice::LogicToLogic( aTxtRight, (MapUnit)m_eLRSpaceUnit, MAP_100TH_MM ); + aTxtRight = OutputDevice::LogicToLogic( aTxtRight, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) ); + + long aTxtFirstLineOfst = pSpace->GetTxtFirstLineOfst(); + aTxtFirstLineOfst = OutputDevice::LogicToLogic( aTxtFirstLineOfst, (MapUnit)m_eLRSpaceUnit, MAP_100TH_MM ); + aTxtFirstLineOfst = OutputDevice::LogicToLogic( aTxtFirstLineOfst, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) ); + + long nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); + nVal = (long)maLeftIndent->Normalize( (long)nVal ); + maLeftIndent->SetValue( nVal, FUNIT_100TH_MM ); + + if(maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text) && + maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) && + maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Table)) + { + maFLineIndent->SetMin( nVal*(-1), FUNIT_100TH_MM ); + } + + long nrVal = OutputDevice::LogicToLogic( aTxtRight, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); + nrVal = (long)maRightIndent->Normalize( (long)nrVal ); + maRightIndent->SetValue( nrVal, FUNIT_100TH_MM ); + + long nfVal = OutputDevice::LogicToLogic( aTxtFirstLineOfst, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); + nfVal = (long)maFLineIndent->Normalize( (long)nfVal ); + maFLineIndent->SetValue( nfVal, FUNIT_100TH_MM ); + + switch (maContext.GetCombinedContext()) + { + case CombinedEnumContext(Application_Writer, Context_DrawText): + case CombinedEnumContext(Application_Writer, Context_Text): + case CombinedEnumContext(Application_Writer, Context_Default): + case CombinedEnumContext(Application_Writer, Context_Table): + case CombinedEnumContext(Application_Writer, Context_Annotation): + { + maLeftIndent->SetMax( MAX_SW - nrVal, FUNIT_100TH_MM ); + maRightIndent->SetMax( MAX_SW - nVal, FUNIT_100TH_MM ); + maFLineIndent->SetMax( MAX_SW - nVal - nrVal, FUNIT_100TH_MM ); + } + break; + case CombinedEnumContext(Application_Draw, Context_DrawText): + case CombinedEnumContext(Application_Draw, Context_Draw): + case CombinedEnumContext(Application_Draw, Context_Table): + case CombinedEnumContext(Application_Draw, Context_TextObject): + case CombinedEnumContext(Application_Draw, Context_Graphic): + case CombinedEnumContext(Application_Impress, Context_TextObject): + case CombinedEnumContext(Application_Impress, Context_DrawText): + case CombinedEnumContext(Application_Impress, Context_Table): + case CombinedEnumContext(Application_Impress, Context_Draw): + case CombinedEnumContext(Application_Impress, Context_Graphic): + { + maLeftIndent->SetMax( MAX_SC_SD - nrVal, FUNIT_100TH_MM ); + maRightIndent->SetMax( MAX_SC_SD - nVal, FUNIT_100TH_MM ); + maFLineIndent->SetMax( MAX_SC_SD - nVal - nrVal, FUNIT_100TH_MM ); + } + } + + maTbxIndent_IncDec->Enable(); + maTbxIndent_IncDec->EnableItem(ID_HANGING_INDENT, sal_True); + if(maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text) + && maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) + && maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Table)) + { + maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_INC, sal_True); + maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_DEC, sal_True); + } + +// maTbxProDemote->Enable(); +// if( !mbOutLineRight && !mbOutLineLeft ) +// maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_True); + maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_True); + } + else if( eState == SFX_ITEM_DISABLED ) + { + maLeftIndent-> Disable(); + maRightIndent->Disable(); + maFLineIndent->Disable(); + maTbxIndent_IncDec->Disable(); + if( maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text) && + maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) && + maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Table) ) + maTbxIndent_IncDec->Disable(); + else + maTbxIndent_IncDec->EnableItem(ID_HANGING_INDENT, sal_False); + +// maTbxProDemote->Disable(); + maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_False); + } + else + { + maLeftIndent->SetEmptyFieldValue(); + maRightIndent->SetEmptyFieldValue(); + maFLineIndent->SetEmptyFieldValue(); + if( maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text) && + maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) && + maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Table) ) + maTbxIndent_IncDec->Disable(); + else + maTbxIndent_IncDec->EnableItem(ID_HANGING_INDENT, sal_False); +// maTbxProDemote->Disable(); + maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_False); + } +} + +void ParaPropertyPanel::StateChangedLnSPImpl( sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* pState ) +{ + meLnSpState = eState; + + if( pState && eState >= SFX_ITEM_AVAILABLE ) + { + if(mpLnSPItem) + delete mpLnSPItem; + mpLnSPItem = ( SvxLineSpacingItem *)pState->Clone(); + } +} + +void ParaPropertyPanel::StateChangedULImpl( sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* pState ) +{ + maTopDist->SetMax( maTopDist->Normalize( MAX_DURCH ), MapToFieldUnit(m_eULSpaceUnit) ); + maBottomDist->SetMax( maBottomDist->Normalize( MAX_DURCH ), MapToFieldUnit(m_eULSpaceUnit) ); + + if( pState && eState >= SFX_ITEM_AVAILABLE ) + { + SvxULSpaceItem* pOldItem = (SvxULSpaceItem*)pState; + + maUpper = pOldItem->GetUpper(); + maUpper = OutputDevice::LogicToLogic( maUpper, (MapUnit)m_eULSpaceUnit, MAP_100TH_MM ); + maUpper = OutputDevice::LogicToLogic( maUpper, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) ); + + maLower = pOldItem->GetLower(); + maLower = OutputDevice::LogicToLogic( maLower, (MapUnit)m_eULSpaceUnit, MAP_100TH_MM ); + maLower = OutputDevice::LogicToLogic( maLower, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) ); + + sal_Int64 nVal = OutputDevice::LogicToLogic( maUpper, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); + nVal = maTopDist->Normalize( nVal ); + maTopDist->SetValue( nVal, FUNIT_100TH_MM ); + + nVal = OutputDevice::LogicToLogic( maLower, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); + nVal = maBottomDist->Normalize( nVal ); + maBottomDist->SetValue( nVal, FUNIT_100TH_MM ); + maTbxUL_IncDec->Enable(); + } + else if(eState == SFX_ITEM_DISABLED ) + { + maTopDist->Disable(); + maBottomDist->Disable(); + maTbxUL_IncDec->Disable(); + } + else + { + maTopDist->SetEmptyFieldValue(); + maBottomDist->SetEmptyFieldValue(); + maTbxUL_IncDec->Disable(); + } +} + +void ParaPropertyPanel::StateChangeOutLineImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) +{ + if (nSID==SID_OUTLINE_LEFT) + { + if( pState && eState == SFX_ITEM_UNKNOWN ) + mbOutLineLeft = 1; + else + mbOutLineLeft = 0; + } + if (nSID==SID_OUTLINE_RIGHT) + { + if( pState && eState == SFX_ITEM_UNKNOWN ) + mbOutLineRight = 1; + else + mbOutLineRight = 0; + } + if(mbOutLineLeft) + maTbxProDemote->EnableItem(BT_TBX_INDENT_DEMOTE, sal_True); + else + maTbxProDemote->EnableItem(BT_TBX_INDENT_DEMOTE, sal_False); + + if(mbOutLineRight) + maTbxProDemote->EnableItem(BT_TBX_INDENT_PROMOTE, sal_True); + else + maTbxProDemote->EnableItem(BT_TBX_INDENT_PROMOTE, sal_False); + +// if( !mbOutLineRight && !mbOutLineLeft ) +// { +// maTbxProDemote->EnableItem(BT_TBX_INDENT_PROMOTE, sal_True); +// maTbxProDemote->EnableItem(BT_TBX_INDENT_DEMOTE, sal_True); +// maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_True); +// } +// else +// maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_False); +} + +void ParaPropertyPanel::StateChangeIncDecImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) +{ + if (nSID==SID_INC_INDENT) + { + if( pState && eState == SFX_ITEM_UNKNOWN ) + maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_INC, sal_True); + else + if( maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text) && + maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) && + maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Table) ) + maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_INC, sal_False); + } + if (nSID==SID_DEC_INDENT) + { + if( pState && eState == SFX_ITEM_UNKNOWN ) + maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_DEC, sal_True); + else + if( maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text) && + maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) && + maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Table) ) + maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_DEC, sal_False); + } +} +// Add toggle state for numbering and bullet icons +void ParaPropertyPanel::StateChangeBulletNumImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) +{ + if (nSID==FN_NUM_NUMBERING_ON) + { + if ( (eState >= SFX_ITEM_DEFAULT) && (pState->ISA(SfxBoolItem))) + { + const SfxBoolItem* pItem= (const SfxBoolItem*)pState; + sal_Bool aBool = (sal_Bool)pItem->GetValue(); + if (aBool) { + maTBxNumBullet->SetItemState(IID_NUMBER, STATE_CHECK); + } else { + maTBxNumBullet->SetItemState(IID_NUMBER, STATE_NOCHECK); + } + } + } + if (nSID==FN_NUM_BULLET_ON) + { + if ( (eState >= SFX_ITEM_DEFAULT) && (pState->ISA(SfxBoolItem))) + { + const SfxBoolItem* pItem= (const SfxBoolItem*)pState; + sal_Bool aBool = (sal_Bool)pItem->GetValue(); + if (aBool) { + maTBxNumBullet->SetItemState(IID_BULLET, STATE_CHECK); + } else { + maTBxNumBullet->SetItemState(IID_BULLET, STATE_NOCHECK); + } + } + } +} +//Modified for Numbering&Bullets Dialog UX Enh(Story 992) by chengjh,2011.7.5 +//Handing the transferred the num rule index data of the current selection +void ParaPropertyPanel::StateChangeBulletNumRuleImpl( sal_uInt16 nSID, SfxItemState /*eState*/, const SfxPoolItem* pState ) +{ + + const SfxUInt16Item* pIt = (const SfxUInt16Item*)pState; + sal_uInt16 nValue = (sal_uInt16)0xFFFF; + if ( pIt ) + nValue = pIt->GetValue(); + + if ( nSID == FN_BUL_NUM_RULE_INDEX ) + { + mnBulletTypeIndex = nValue; + }else if ( nSID == FN_NUM_NUM_RULE_INDEX ) + { + mnNumTypeIndex = nValue; + } +} +//End +FieldUnit ParaPropertyPanel::GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState ) +{ + FieldUnit eUnit = FUNIT_NONE; + + if ( pState && eState >= SFX_ITEM_DEFAULT ) + eUnit = (FieldUnit)( (const SfxUInt16Item*)pState )->GetValue(); + else + { + SfxViewFrame* pFrame = SfxViewFrame::Current(); + SfxObjectShell* pSh = NULL; + if ( pFrame ) + pSh = pFrame->GetObjectShell(); + if ( pSh ) //the object shell is not always available during reload + { + SfxModule* pModule = pSh->GetModule(); + if ( pModule ) + { + const SfxPoolItem* pItem = pModule->GetItem( SID_ATTR_METRIC ); + if ( pItem ) + eUnit = (FieldUnit)( (SfxUInt16Item*)pItem )->GetValue(); + } + else + { + DBG_ERRORFILE( "GetModuleFieldUnit(): no module found" ); + } + } + } + + return eUnit; +} +//new FixedText(this, SVX_RES(FT_COLOR)) + +PopupControl* ParaPropertyPanel::CreateLineSpacingControl (PopupContainer* pParent) +{ + return new ParaLineSpacingControl(pParent, *this); +} + +PopupControl* ParaPropertyPanel::CreateBulletsPopupControl (PopupContainer* pParent) +{ + return new ParaBulletsControl(pParent, *this); +} + +PopupControl* ParaPropertyPanel::CreateNumberingPopupControl (PopupContainer* pParent) +{ + return new ParaNumberingControl(pParent, *this); +} + +PopupControl* ParaPropertyPanel::CreateBGColorPopupControl (PopupContainer* pParent) +{ + return new ColorControl( + pParent, + mpBindings, + SVX_RES(RID_POPUPPANEL_TEXTPAGE_FONT_COLOR), + SVX_RES(VS_FONT_COLOR), + ::boost::bind(&ParaPropertyPanel::GetBGColor, this), + ::boost::bind(&ParaPropertyPanel::SetBGColor, this, _1,_2), + pParent, + 0); +} + + +ParaPropertyPanel::ParaPropertyPanel(Window* pParent, + const cssu::Reference<css::frame::XFrame>& /*rxFrame*/, + SfxBindings* pBindings, + const cssu::Reference<css::ui::XSidebar>& rxSidebar) + : Control(pParent, SVX_RES(RID_SIDEBAR_PARA_PANEL)), + maAlignToolBoxBackground(ControlFactory::CreateToolBoxBackground(this)), + maAlignToolBox (ControlFactory::CreateToolBox(maAlignToolBoxBackground.get(),SVX_RES(TBX_HORIZONTALALIGNMENT))), + maTBxVertAlignBackground(ControlFactory::CreateToolBoxBackground(this)), + maTBxVertAlign (ControlFactory::CreateToolBox(maTBxVertAlignBackground.get(),SVX_RES(TBX_VERT_ALIGN))), + maTBxNumBulletBackground(ControlFactory::CreateToolBoxBackground(this)), + maTBxNumBullet (ControlFactory::CreateToolBox(maTBxNumBulletBackground.get(),SVX_RES(TBX_NUM_BULLET))), + maTBxBackColorBackground(ControlFactory::CreateToolBoxBackground(this)), + maTBxBackColor (ControlFactory::CreateToolBox(maTBxBackColorBackground.get(),SVX_RES(TBX_BACK_COLOR))), + maFTUL (new FixedText(this, SVX_RES(FT_SPACING))), + maTbxUL_IncDecBackground(ControlFactory::CreateToolBoxBackground(this)), + maTbxUL_IncDec (ControlFactory::CreateToolBox(maTbxUL_IncDecBackground.get(),SVX_RES(TBX_UL_INC_DEC))), + maTopDist (new SvxRelativeField(this, SVX_RES(MF_ABOVE_PARASPACING))), + maBottomDist (new SvxRelativeField(this, SVX_RES(MF_BELOW_PARASPACING))), + maLineSPTbxBackground(ControlFactory::CreateToolBoxBackground(this)), + maLineSPTbx (ControlFactory::CreateToolBox(maLineSPTbxBackground.get(),SVX_RES(TBX_LINESP))), + maFTIndent (new FixedText(this, SVX_RES(FT_INDENT))), + maTbxIndent_IncDecBackground(ControlFactory::CreateToolBoxBackground(this)), + maTbxIndent_IncDec (ControlFactory::CreateToolBox(maTbxIndent_IncDecBackground.get(),SVX_RES(TBX_INDENT_INC_DEC))), + maTbxProDemoteBackground(ControlFactory::CreateToolBoxBackground(this)), + maTbxProDemote (ControlFactory::CreateToolBox(maTbxProDemoteBackground.get(),SVX_RES(TBX_INDENT_PRO_DEMOTE))), + maLeftIndent (new SvxRelativeField(this, SVX_RES(MF_BEFORE_INDENT))), + maRightIndent (new SvxRelativeField(this, SVX_RES(MF_AFTER_INDENT))), + maFLineIndent (new SvxRelativeField(this, SVX_RES(MF_FL_INDENT))), + mpColorUpdater (), + maFISpace1 ( this, SVX_RES( FI_SPACE1)), + maFISpace2 ( this, SVX_RES( FI_SPACE2)), + maFIndent1 ( this, SVX_RES( FI_INDENT1)), + maFIndent2 ( this, SVX_RES( FI_INDENT2)), + maFIndent3 ( this, SVX_RES( FI_INDENT3)), + maSpace1 (SVX_RES(IMG_SPACE1)), + maSpace2 (SVX_RES(IMG_SPACE2)), + maSpace3 (SVX_RES(IMG_SPACE3)), + maIndent1 (SVX_RES(IMG_INDENT1)), + maIndent2 (SVX_RES(IMG_INDENT2)), + maIndent3 (SVX_RES(IMG_INDENT3)), + maLeftPara (SVX_RES(IMG_LEFT_PARA)), + maCentPara (SVX_RES(IMG_CENTER_PARA)), + maRightPara (SVX_RES(IMG_RIGHT_PARA)), + maJusPara (SVX_RES(IMG_JUSTIFY_PARA)), + maIndInc (SVX_RES(IMG_INDENT_INC)), + maIndDec (SVX_RES(IMG_INDENT_DEC)), + maIndInc_BD (SVX_RES(IMG_INDENT_INC_BD)), + maIndDec_BD (SVX_RES(IMG_INDENT_DEC_BD)), + maIndHang (SVX_RES(IMG_INDENT_HANG)), + maParInc (SVX_RES(IMG_PARA_INC)), + maParDec (SVX_RES(IMG_PARA_DEC)), + maVertImageList (SVX_RES(IL_VERT_ALIGN)), + maVertImageListH (SVX_RES(IL_VERT_ALIGN)), + maNumBImageList (SVX_RES(IL_NUM_BULLET)), + maNumBImageListH (SVX_RES(ILH_NUM_BULLET)), + maNumBImageListRTL (SVX_RES(IL_NUM_BULLET_RTL)), + maImgBackColorHigh (SVX_RES(IMG_BACK_COLOR_H)), + maImgBackColor (SVX_RES(IMG_BACK_COLOR)), + maTxtLeft (0), + mpLnSPItem (NULL), + meLnSpState (SFX_ITEM_DONTCARE), + mbOutLineLeft (false), + mbOutLineRight (false), + maUpper (0), + maLower (0), + mnBulletTypeIndex ((sal_uInt16)0xFFFF), + mnNumTypeIndex ((sal_uInt16)0xFFFF), + maColor (COL_AUTO), + mbColorAvailable (true), + //, m_eMetricUnit (FUNIT_INCH) +//, m_last_eMetricUnit (FUNIT_INCH) + m_eLRSpaceUnit(), + m_eULSpaceUnit(), + maLeftAlignControl (SID_ATTR_PARA_ADJUST_LEFT, *pBindings,*this), + maCenterAlignControl (SID_ATTR_PARA_ADJUST_CENTER, *pBindings,*this), + maRightAlignControl (SID_ATTR_PARA_ADJUST_RIGHT, *pBindings,*this), + maJustifyAlignControl (SID_ATTR_PARA_ADJUST_BLOCK, *pBindings,*this), + maLRSpaceControl (SID_ATTR_PARA_LRSPACE,*pBindings,*this), + maLNSpaceControl (SID_ATTR_PARA_LINESPACE, *pBindings,*this), + maULSpaceControl (SID_ATTR_PARA_ULSPACE, *pBindings,*this), + maOutLineLeftControl (SID_OUTLINE_LEFT, *pBindings,*this), + maOutLineRightControl (SID_OUTLINE_RIGHT, *pBindings,*this), + maDecIndentControl (SID_DEC_INDENT, *pBindings,*this), + maIncIndentControl (SID_INC_INDENT, *pBindings,*this), + maVertTop (SID_TABLE_VERT_NONE, *pBindings,*this), + maVertCenter (SID_TABLE_VERT_CENTER, *pBindings,*this), + maVertBottom (SID_TABLE_VERT_BOTTOM,*pBindings,*this), + maBulletOnOff (FN_NUM_BULLET_ON, *pBindings,*this), + maNumberOnOff (FN_NUM_NUMBERING_ON, *pBindings,*this), + maBackColorControl (SID_BACKGROUND_COLOR, *pBindings,*this), + m_aMetricCtl (SID_ATTR_METRIC, *pBindings,*this), + maBulletNumRuleIndex (FN_BUL_NUM_RULE_INDEX, *pBindings,*this), + maNumNumRuleIndex (FN_NUM_NUM_RULE_INDEX, *pBindings,*this), + maContext(), + mpBindings(pBindings), + maLineSpacePopup(this, ::boost::bind(&ParaPropertyPanel::CreateLineSpacingControl, this, _1)), + maBulletsPopup(this, ::boost::bind(&ParaPropertyPanel::CreateBulletsPopupControl, this, _1)), + maNumberingPopup(this, ::boost::bind(&ParaPropertyPanel::CreateNumberingPopupControl, this, _1)), + maBGColorPopup(this, ::boost::bind(&ParaPropertyPanel::CreateBGColorPopupControl, this, _1)), + mxSidebar(rxSidebar) +{ + initial(); + FreeResource(); +} + +} } // end of namespace svx::sidebar diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.hrc b/svx/source/sidebar/paragraph/ParaPropertyPanel.hrc new file mode 100644 index 000000000000..317ce5ed4cb3 --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.hrc @@ -0,0 +1,372 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "svx/dialogs.hrc" + +#define BT_SUBSTLEFT 1 +#define BT_SUBSTCENTER 2 +#define BT_SUBSTRIGHT 3 +#define BT_SUBSTJUSTIFY 4 +#define BT_BTX_LINESP 1 +#define BT_TBX_INDENT_INC 1 +#define BT_TBX_INDENT_DEC 2 +#define BT_TBX_UL_INC 1 +#define BT_TBX_UL_DEC 2 +#define ID_HANGING_INDENT 3 +#define BT_TBX_INDENT_PROMOTE 1 +#define BT_TBX_INDENT_DEMOTE 2 +#define SD_HANGING_INDENT 3 +#define MF_BEFORE_INDENT 2 +#define MF_AFTER_INDENT 4 +#define MF_FL_INDENT 6 +#define TBX_HORIZONTALALIGNMENT 5 +#define IMG_LEFT_PARA 7 +#define IMG_CENTER_PARA 8 +#define IMG_RIGHT_PARA 9 +#define IMG_JUSTIFY_PARA 10 +#define IMG_INDENT_INC 11 +#define IMG_INDENT_DEC 12 +#define IMG_PARA_INC 13 +#define IMG_PARA_DEC 14 +#define IMG_INDENT_HANG 15 +#define FT_INDENT 16 +#define TBX_INDENT_INC_DEC 17 +#define FI_SPACE1 18 +#define FI_SPACE2 19 +#define FI_INDENT1 20 +#define FI_INDENT2 21 +#define FI_INDENT3 22 +#define IMG_SPACE3 23 +#define TBX_LINESP 25 +#define IMG_SPACE1 26 +#define IMG_INDENT1 27 +#define IMG_INDENT2 28 +#define IMG_SPACE2 29 +#define IMG_INDENT3 30 +#define FT_SPACING 31 +#define TBX_UL_INC_DEC 33 +#define MF_ABOVE_PARASPACING 32 +#define MF_BELOW_PARASPACING 34 +#define TBX_INDENT_PRO_DEMOTE 35 +#define TBX_VERT_ALIGN 40 +#define IL_VERT_ALIGN 41 +#define ILH_VERT_ALIGN 42 +#define TBX_NUM_BULLET 44 +#define IL_NUM_BULLET 45 +#define ILH_NUM_BULLET 46 +#define FT_BACK_COLOR 47 +#define TBX_BACK_COLOR 48 +#define TBI_BACK_COLOR 49 +#define IMG_BACK_COLOR 50 +#define IMG_BACK_COLOR_H 51 +#define IL_NUM_BULLET_RTL 52 //sym2_7380 +#define TBI_VERT_ALIGN_TOP 60 +#define TBI_VERT_ALIGN_CENTER 61 +#define TBI_VERT_ALIGN_BOT 62 +#define TBI_NUMBERING 63 +#define TBI_BULLET 64 +#define TBI_HOR_ALIGN_LEFT 65 +#define TBI_HOR_ALIGN_CENTER 66 +#define TBI_HOR_ALIGN_RIGHT 67 +#define TBI_HOR_ALIGN_JUSTIFY 68 +#define TBI_INDENT_INC 69 +#define TBI_INDENT_DEC 70 +#define TBI_UL_INC 71 +#define TBI_UL_DEC 72 +#define IMG_INDENT_INC_BD 73 +#define IMG_INDENT_DEC_BD 74 + +//for vertical alignment +#define IID_VERT_TOP 1 +#define IID_VERT_CENTER 2 +#define IID_VERT_BOTTOM 3 + +//for numbering and bullett +#define IID_BULLET 1 +#define IID_NUMBER 2 +//============================== popup bullet and numbering & back color ========================= +#define VS_VALUES 1 +#define IL_BULLET_BITMAPS 2 +#define CB_BULLET_MORE 4 +#define BMP_BULLET_MORE 5 +#define IMG_SEPERATOR_BULLET 7 + +#define VS_NUMBERING 10 +#define CB_NUMBERING_MORE 12 +#define BMP_NUMERING_MORE 13 +#define IMG_SEPERATOR_NUMBERING 15 +#define VS_FONT_COLOR 1 +#define STR_NOFILL 2 + +//============================== line space popup page ============================== + +#define LB_LINE_SPACING 1 +#define ED_SBINDE_LINEDISTPERCENT 2 +#define ED_SBINDE_LINEDISTPOINT 3 + +#define FT_CUSTOM 14 +#define FT_LINE_SPACING 15 +#define FT_OF 16 +#define IMG_SPACING1 18 +#define IMG_SPACING115 19 +#define IMG_SPACING15 20 +#define IMG_SPACING2 21 +#define IMG_SPACINGLCUSTOM 22 +#define IMG_SEL_SPACING1 23 +#define IMG_SEL_SPACING115 24 +#define IMG_SEL_SPACING15 25 +#define IMG_SEL_SPACING2 26 +#define IMG_LPCUSTOMNOBORDER 27 +#define FI_CUSTOM_NOBORDER_LSPACE 28 +#define LINE_SPACING 29 +#define STR_SPACING1 30 +#define STR_SPACING115 31 +#define STR_SPACING15 32 +#define STR_SPACING2 33 +#define IMG_CUSTOM 34 +#define IMG_CUSTOM_GRAY 35 +#define STR_LCVALUE 36 +#define STR_LS_SINGLE 37 +#define STR_LS_115 38 +#define STR_LS_15 39 +#define STR_LS_DOUBLE 40 +#define STR_LSPACING 41 +#define STR_LS_OF 42 + +//============================== Help ID ============================== +#define HID_TBX_HORIZONTALALIGNMENT "HID_TBX_HORIZONTALALIGNMENT" +#define HID_TBI_HOR_ALIGN_LEFT "HID_TBI_HOR_ALIGN_LEFT" +#define HID_TBI_HOR_ALIGN_CENTER "HID_TBI_HOR_ALIGN_CENTER" +#define HID_TBI_HOR_ALIGN_RIGHT "HID_TBI_HOR_ALIGN_RIGHT" +#define HID_TBI_HOR_ALIGN_JUSTIFY "HID_TBI_HOR_ALIGN_JUSTIFY" + +#define HID_TBX_VERT_ALIGN "HID_TBX_VERT_ALIGN" +#define HID_TBI_VERT_ALIGN_TOP "HID_TBI_VERT_ALIGN_TOP" +#define HID_TBI_VERT_ALIGN_CENTER "HID_TBI_VERT_ALIGN_CENTER" +#define HID_TBI_VERT_ALIGN_BOT "HID_TBI_VERT_ALIGN_BOT" + +#define HID_TBX_INDENT "HID_TBX_INDENT" +#define HID_TBI_INDENT "HID_TBI_INDENT" +//#define HID_TBX_LINESP 705263129 +//#define HID_TBI_LINESP 705262617 +#define HID_TBX_GRSPACE "HID_TBX_GRSPACE" +#define HID_TBI_GRSPACE "HID_TBI_GRSPACE" +#define HID_TBX_BACK_COLOR "HID_TBX_BACK_COLOR" +#define HID_TBI_BACK_COLOR "HID_TBI_BACK_COLOR" + +//#define HID_TBX_INDENT_INC_DEC 705263121 +//#define HID_TBI_INDENT_DEC 705262662 +//#define HID_TBI_INDENT_INC 705262661 +//#define HID_TBX_UL_INC_DEC 705263137 +//#define HID_TBI_UL_INC 705262663 +//#define HID_TBI_UL_DEC 705262664 + +//#define HID_TBX_NUM_BULLET 705263148 +//#define HID_TBI_NUMBERING 705262655 +//#define HID_TBI_BULLET 705262656 + +#define HID_POPUP_BULLET_CB_BULLET_MORE "HID_POPUP_BULLET_CB_BULLET_MORE" +#define HID_POPUP_BULLET_VS_VALUES "HID_POPUP_BULLET_VS_VALUES" +#define HID_POPUP_NUM_CB_NUMBERING_MORE "HID_POPUP_NUM_CB_NUMBERING_MORE" +#define HID_POPUP_NUM_VS_NUMBERING "HID_POPUP_NUM_VS_NUMBERING" + +#define HID_POPUP_INDENT_ED_INDENT_LEFTINDENT "HID_POPUP_INDENT_ED_INDENT_LEFTINDENT" +#define HID_POPUP_INDENT_ED_INDENT_RIGHTINDENT "HID_POPUP_INDENT_ED_INDENT_RIGHTINDENT" +#define HID_POPUP_INDENT_ED_INDENT_FLINDENT "HID_POPUP_INDENT_ED_INDENT_FLINDENT" +#define HID_POPUP_INDENT_TBX_INDENT_NONE "HID_POPUP_INDENT_TBX_INDENT_NONE" +#define HID_POPUP_INDENT_TBI_INDENT_NONE "HID_POPUP_INDENT_TBI_INDENT_NONE" +#define HID_POPUP_INDENT_TBX_INDENT_BEFORE1 "HID_POPUP_INDENT_TBX_INDENT_BEFORE1" +#define HID_POPUP_INDENT_TBI_INDENT_BEFORE1 "HID_POPUP_INDENT_TBI_INDENT_BEFORE1" +#define HID_POPUP_INDENT_TBX_INDENT_BEFORE2 "HID_POPUP_INDENT_TBX_INDENT_BEFORE2" +#define HID_POPUP_INDENT_TBI_INDENT_BEFORE2 "HID_POPUP_INDENT_TBI_INDENT_BEFORE2" +#define HID_POPUP_INDENT_TBX_INDENT_FLINE "HID_POPUP_INDENT_TBX_INDENT_FLINE" +#define HID_POPUP_INDENT_TBI_INDENT_FLINE "HID_POPUP_INDENT_TBI_INDENT_FLINE" +#define HID_POPUP_INDENT_TBX_INDENT_HANGING "HID_POPUP_INDENT_TBX_INDENT_HANGING" +#define HID_POPUP_INDENT_TBI_INDENT_HANGING "HID_POPUP_INDENT_TBI_INDENT_HANGING" +#define HID_POPUP_INDENT_TBX_INDENT_LCUSTOM "HID_POPUP_INDENT_TBX_INDENT_LCUSTOM" +#define HID_POPUP_INDENT_TBI_INDENT_LCUSTOM "HID_POPUP_INDENT_TBI_INDENT_LCUSTOM" + +#define HID_POPUP_LS_LB_LINE_SPACING "HID_POPUP_LS_LB_LINE_SPACING" +#define HID_POPUP_LS_ED_SBINDE_LINEDISTPERCENT "HID_POPUP_LS_ED_SBINDE_LINEDISTPERCENT" +#define HID_POPUP_LS_ED_SBINDE_LINEDISTPOINT "HID_POPUP_LS_ED_SBINDE_LINEDISTPOINT" +#define HID_POPUP_LS_TBX_LINESP_1 "HID_POPUP_LS_TBX_LINESP_1" +#define HID_POPUP_LS_TBI_LINESP_1 "HID_POPUP_LS_TBI_LINESP_1" +#define HID_POPUP_LS_TBX_LINESP_15 "HID_POPUP_LS_TBX_LINESP_15" +#define HID_POPUP_LS_TBI_LINESP_15 "HID_POPUP_LS_TBI_LINESP_15" +#define HID_POPUP_LS_TBX_LINESP_2 "HID_POPUP_LS_TBX_LINESP_2" +#define HID_POPUP_LS_TBI_LINESP_2 "HID_POPUP_LS_TBI_LINESP_2" +#define HID_POPUP_LS_TBX_LINESP_115 "HID_POPUP_LS_TBX_LINESP_115" +#define HID_POPUP_LS_TBI_LINESP_115 "HID_POPUP_LS_TBI_LINESP_115" +#define HID_POPUP_LS_TBX_LINESP_LCUSTOM "HID_POPUP_LS_TBX_LINESP_LCUSTOM" +#define HID_POPUP_LS_TBI_LINESP_LCUSTOM "HID_POPUP_LS_TBI_LINESP_LCUSTOM" + +#define HID_POPUP_PS_ED_SBINDE_TOPDIST "HID_POPUP_PS_ED_SBINDE_TOPDIST" +#define HID_POPUP_PS_ED_SBINDE_BOTTOMDIST "HID_POPUP_PS_ED_SBINDE_BOTTOMDIST" +#define HID_POPUP_PS_TBX_NORMAL "HID_POPUP_PS_TBX_NORMAL" +#define HID_POPUP_PS_TBI_NORMAL "HID_POPUP_PS_TBI_NORMAL" +#define HID_POPUP_PS_TBX_NARROW "HID_POPUP_PS_TBX_NARROW" +#define HID_POPUP_PS_TBI_NARROW "HID_POPUP_PS_TBI_NARROW" +#define HID_POPUP_PS_TBX_WIDE "HID_POPUP_PS_TBX_WIDE" +#define HID_POPUP_PS_TBI_WIDE "HID_POPUP_PS_TBI_WIDE" +#define HID_POPUP_PS_TBX_LASTCUSTOM "HID_POPUP_PS_TBX_LASTCUSTOM" +#define HID_POPUP_PS_TBI_LASTCUSTOM "HID_POPUP_PS_TBI_LASTCUSTOM" + +//============================== Property ============================== +#define _FIXED_TEXT_HEIGHT 9 +#define _FIXED_TEXT_WIDTH 40 +#define CONTROL_HEIGHT 15 +#define CONTROL_WIDTH 45 +#define ALIGNMENT_TBX_HEIGHT 17 +#define ALIGNMENT_TBX_WIDTH 13 +#define LISTBOX_HEIGHT 80 +#define IMAGE_SIZE 16 +#define POPUP_TOOLBOX_SIZE 32 +#define TOOLBOX_HEIGHT 22 +#define TOOLBOX_WIDTH 23 +#define TEXT_SPACING_VERTICAL 2 +#define BUTTON_SPACING 18 +//#define TOOLBOX_ITEM_HEIGHT 17 +#define VS_SPACING_WIDTH 78 + +//==============================Section page position============================== + +#define TBX_HORI_ALIGN_X SECTIONPAGE_MARGIN_HORIZONTAL + TBX_OUT_BORDER_OFFSET_X/2 +#define TBX_HORI_ALIGN_Y SECTIONPAGE_MARGIN_VERTICAL_TOP + +#define TBX_VERT_ALIGN_X TBX_HORI_ALIGN_X + TBX_OUT_BORDER_OFFSET_X*2 + TOOLBOX_ITEM_WIDTH * 4 + CONTROL_SPACING_HORIZONTAL +#define TBX_VERT_ALIGN_Y TBX_HORI_ALIGN_Y + +#define TBX_NUM_BULLET_X TBX_HORI_ALIGN_X +#define TBX_NUM_BULLET_Y TBX_HORI_ALIGN_Y + TOOLBOX_ITEM_HEIGHT + CONTROL_SPACING_VERTICAL - 1 + +#define TBX_BACK_COLOR_X TBX_HORI_ALIGN_X + TBX_OUT_BORDER_OFFSET_X*2 + TOOLBOX_ITEM_WIDTH * 3 + CONTROL_SPACING_HORIZONTAL +#define TBX_BACK_COLOR_Y TBX_NUM_BULLET_Y + +#define FT_PARA_SPACE_X SECTIONPAGE_MARGIN_HORIZONTAL +#define FT_PARA_SPACE_Y TBX_NUM_BULLET_Y + TOOLBOX_ITEM_HEIGHT + CONTROL_SPACING_VERTICAL - 3 +#define FT_PARA_SPACE_Y2 TBX_HORI_ALIGN_Y + TOOLBOX_ITEM_HEIGHT + CONTROL_SPACING_VERTICAL - 2 + +#define TBX_PARA_SPACE_INC_DEC_X TBX_HORI_ALIGN_X +#define TBX_PARA_SPACE_INC_DEC_Y FT_PARA_SPACE_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL +#define TBX_PARA_SPACE_INC_DEC_Y2 FT_PARA_SPACE_Y2 + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + +#define FT_PARA_INDENT_X TBX_VERT_ALIGN_X +#define FT_PARA_INDENT_Y FT_PARA_SPACE_Y +#define FT_PARA_INDENT_Y2 FT_PARA_SPACE_Y2 + +#define TBX_PARA_INDENT_INC_DEC_X TBX_VERT_ALIGN_X +#define TBX_PARA_INDENT_INC_DEC_Y TBX_PARA_SPACE_INC_DEC_Y +#define TBX_PARA_INDENT_INC_DEC_Y2 TBX_PARA_SPACE_INC_DEC_Y2 + +#define MBX_TOP_DIST_X FT_PARA_SPACE_X + TOOLBOX_ITEM_WIDTH +#define MBX_TOP_DIST_Y TBX_PARA_SPACE_INC_DEC_Y + TOOLBOX_ITEM_WIDTH + CONTROL_SPACING_VERTICAL + 4*TBX_OUT_BORDER_OFFSET_Y - 1 +#define MBX_TOP_DIST_Y2 TBX_PARA_SPACE_INC_DEC_Y2 + TOOLBOX_ITEM_WIDTH + CONTROL_SPACING_VERTICAL + 4*TBX_OUT_BORDER_OFFSET_Y - 1 +#define MBX_BOT_DIST_X MBX_TOP_DIST_X +#define MBX_BOT_DIST_Y MBX_TOP_DIST_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL +#define MBX_BOT_DIST_Y2 MBX_TOP_DIST_Y2 + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL + +#define IMG_SPACE_X FT_PARA_SPACE_X - 3 +#define IMG_SPACE1_Y MBX_TOP_DIST_Y - 1 +#define IMG_SPACE2_Y MBX_BOT_DIST_Y - 1 +#define IMG_SPACE1_Y2 MBX_TOP_DIST_Y2 - 1 +#define IMG_SPACE2_Y2 MBX_BOT_DIST_Y2 - 1 + +#define MBX_LEFT_DIST_X FT_PARA_INDENT_X + TOOLBOX_ITEM_WIDTH +#define MBX_LEFT_DIST_Y MBX_TOP_DIST_Y +#define MBX_LEFT_DIST_Y2 MBX_TOP_DIST_Y2 +#define MBX_RIGHT_DIST_X MBX_LEFT_DIST_X +#define MBX_RIGHT_DIST_Y MBX_BOT_DIST_Y +#define MBX_RIGHT_DIST_Y2 MBX_BOT_DIST_Y2 +#define MBX_FLINE_DIST_X MBX_LEFT_DIST_X +#define MBX_FLINE_DIST_Y MBX_RIGHT_DIST_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL +#define MBX_FLINE_DIST_Y2 MBX_RIGHT_DIST_Y2 + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL + +#define IMG_INDENT_X FT_PARA_INDENT_X - 4 +#define IMG_INDENT1_Y MBX_LEFT_DIST_Y - 1 +#define IMG_INDENT2_Y MBX_RIGHT_DIST_Y - 1 +#define IMG_INDENT3_Y MBX_FLINE_DIST_Y - 1 +#define IMG_INDENT1_Y2 MBX_LEFT_DIST_Y2 - 1 +#define IMG_INDENT2_Y2 MBX_RIGHT_DIST_Y2- 1 +#define IMG_INDENT3_Y2 MBX_FLINE_DIST_Y2- 1 + +#define TBX_LINE_SPACE_X TBX_HORI_ALIGN_X +#define TBX_LINE_SPACE_Y MBX_FLINE_DIST_Y +#define TBX_LINE_SPACE_Y2 MBX_FLINE_DIST_Y2 + +#define PARA_SECTIONPAGE_HEIGHT MBX_FLINE_DIST_Y + TOOLBOX_ITEM_HEIGHT + SECTIONPAGE_MARGIN_VERTICAL_BOT +#define PARA_SECTIONPAGE_HEIGHT_2 MBX_FLINE_DIST_Y2 + TOOLBOX_ITEM_HEIGHT + SECTIONPAGE_MARGIN_VERTICAL_BOT + +#define LINE_X_WHITE FT_PARA_INDENT_X - 5 +#define LINE_TOP_Y FT_PARA_INDENT_Y + 1 +#define LINE_TOP_Y2 FT_PARA_INDENT_Y2 + 1 +#define LINE_BOT_Y TBX_LINE_SPACE_Y + TOOLBOX_ITEM_HEIGHT - 1 +#define LINE_BOT_Y2 TBX_LINE_SPACE_Y2 + TOOLBOX_ITEM_HEIGHT - 1 + +//==============================numbering and bullet============================== +#define NB_MARGIN_VERTICAL POPUPPANEL_MARGIN_VERTICAL +#define NB_MARGIN_HORIZONTAL POPUPPANEL_MARGIN_HORIZONTAL +#define SPACING_VERTICAL_S3 8 +//#define SPACING_VERTICAL_S1 12 +#define POPUPPANEL_MARGIN_NB 4 + +#define NB_IMAGE_WIDTH 25 +#define NB_IMAGE_HEIGHT 25 +#define NB_IMAGE_SPACING 5 + +#define BULLET_IMAGE_WIDTH NB_IMAGE_WIDTH +#define BULLET_IMAGE_HEIGHT NB_IMAGE_HEIGHT +#define BULLET_IMAGE_SPACING NB_IMAGE_SPACING + +#define NUM_IMAGE_WIDTH 25 +#define NUM_IMAGE_HEIGHT 35 +#define NUM_IMAGE_SPACING NB_IMAGE_SPACING + +#define FIXED_TEXT_HEIGHT 13 +#define FIXED_TEXT_WIDTH 80 +#define CUST_MORE_BUTTON_HEIGHT 15 + +#define VS_WIDTH_BULLET BULLET_IMAGE_WIDTH*3+BULLET_IMAGE_SPACING*2 +#define VS_HEIGHT_BULLET BULLET_IMAGE_HEIGHT*4+BULLET_IMAGE_SPACING*3 +#define VS_WIDTH_NUM NUM_IMAGE_WIDTH*3+NB_IMAGE_SPACING*2 +#define VS_HEIGHT_NUM NUM_IMAGE_HEIGHT*3+NB_IMAGE_SPACING*2 + +#define POPUP_WIDTH_BULLET VS_WIDTH_BULLET + POPUPPANEL_MARGIN_NB * 2 +#define POPUP_HEIGHT_BULLET VS_HEIGHT_BULLET + POPUPPANEL_MARGIN_NB * 3 + CUST_MORE_BUTTON_HEIGHT +#define POPUP_WIDTH_NUM VS_WIDTH_NUM + POPUPPANEL_MARGIN_NB * 2 +#define POPUP_HEIGHT_NUM VS_HEIGHT_NUM + POPUPPANEL_MARGIN_NB * 3 + CUST_MORE_BUTTON_HEIGHT + +#define CUST_MORE_BUTTON_X 1 +#define CUST_MORE_BUTTON_IMG_OFF_X 2 //NB_MARGIN_HORIZONTAL - CUST_MORE_BUTTON_X + OFFSET_X + +//==============================Line Spacing popup page======================= + +#define POPUP_PAGE_HEIGHT POP_BORDER_Y + BD_HEIGHT + POPUPPANEL_MARGIN_NB + OFFSET_Y +#define POP_FT_CUSTOM_X POPUPPANEL_MARGIN_NB + OFFSET_X +#define POP_FT_CUSTOM_Y POPUPPANEL_MARGIN_SMALL * 2 + 17 * 5 +#define POP_BORDER_X POPUPPANEL_MARGIN_NB + OFFSET_X + 1 +#define POP_BORDER_Y POPUPPANEL_MARGIN_SMALL * 3 + 17 * 5 + TEXT_HEIGHT +#define BD_WIDTH VS_SPACING_WIDTH - 6 +#define BD_HEIGHT TEXT_HEIGHT*2 + CONTROL_HEIGHT*2 + CONTROL_SPACING_VERTICAL*3 + TEXT_CONTROL_SPACING_VERTICAL*2 - 4 + +#define FT_1_X POP_BORDER_X + POPUPPANEL_MARGIN_LARGE +#define FT_1_Y POP_BORDER_Y + CONTROL_SPACING_VERTICAL +#define EDIT_1_X FT_1_X +#define EDIT_1_Y FT_1_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL +#define FT_2_X FT_1_X +#define FT_2_Y EDIT_1_Y + CONTROL_HEIGHT + CONTROL_SPACING_VERTICAL - 3 +#define EDIT_2_X FT_1_X +#define EDIT_2_Y FT_2_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx new file mode 100644 index 000000000000..16db5dbfae00 --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx @@ -0,0 +1,286 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SVX_SIDEBAR_PARA_PROPERTY_PANEL_HXX +#define SVX_SIDEBAR_PARA_PROPERTY_PANEL_HXX + +#include <vcl/ctrl.hxx> +#include <sfx2/sidebar/ControllerItem.hxx> +#include <sfx2/sidebar/IContextChangeReceiver.hxx> +#include <editeng/lspcitem.hxx> +#include <svtools/ctrlbox.hxx> +#include <svx/tbxcolorupdate.hxx> +#include <svx/relfld.hxx> +#include <editeng/svxenum.hxx> +#include <editeng/fhgtitem.hxx> + +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/ui/XSidebar.hpp> + +#include <boost/scoped_ptr.hpp> + +#include <svx/sidebar/ColorPopup.hxx> +#include <vcl/vclenum.hxx> +#include <vcl/fixed.hxx> +#include <svl/poolitem.hxx> +#include <tools/fldunit.hxx> + +#include "ParaBulletsPopup.hxx" +#include "ParaNumberingPopup.hxx" +#include "ParaLineSpacingPopup.hxx" + +class FloatingWindow; +class ToolBox; + +namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; + + +namespace svx { namespace sidebar { + +class PopupControl; +class PopupContainer; + +class ParaPropertyPanel + : public Control, + public ::sfx2::sidebar::IContextChangeReceiver, + public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface +{ +public: + static ParaPropertyPanel* Create ( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings, + const cssu::Reference<css::ui::XSidebar>& rxSidebar); + + virtual void DataChanged (const DataChangedEvent& rEvent); + SfxBindings* GetBindings(); + + virtual void HandleContextChange ( + const ::sfx2::sidebar::EnumContext aContext); + + virtual void NotifyItemUpdate( + const sal_uInt16 nSId, + const SfxItemState eState, + const SfxPoolItem* pState); + + void ShowMenu (void); + sal_uInt16 GetBulletTypeIndex(){ return mnBulletTypeIndex; } + void SetBulletTypeIndex(sal_uInt16 nInd){ mnBulletTypeIndex = nInd; } + sal_uInt16 GetNumTypeIndex(){ return mnNumTypeIndex; } + void SetNumTypeIndex(sal_uInt16 nInd){ mnNumTypeIndex = nInd; } + FieldUnit GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState ); + + void EndSpacingPopupMode (void); + void EndBulletsPopupMode (void); + void EndNumberingPopupMode (void); + +private: + /********************************************************** + ** + ** UI controls + ** + ***********************************************************/ + //Alignment + ::boost::scoped_ptr<Window> maAlignToolBoxBackground; + ::boost::scoped_ptr<ToolBox> maAlignToolBox; + ::boost::scoped_ptr<Window> maTBxVertAlignBackground; + ::boost::scoped_ptr<ToolBox> maTBxVertAlign; + //NumBullet&Backcolor + ::boost::scoped_ptr<Window> maTBxNumBulletBackground; + ::boost::scoped_ptr<ToolBox> maTBxNumBullet; + ::boost::scoped_ptr<Window> maTBxBackColorBackground; + ::boost::scoped_ptr<ToolBox> maTBxBackColor; + //Paragraph spacing + ::boost::scoped_ptr<FixedText> maFTUL; + ::boost::scoped_ptr<Window> maTbxUL_IncDecBackground; + ::boost::scoped_ptr<ToolBox> maTbxUL_IncDec; + ::boost::scoped_ptr<SvxRelativeField> maTopDist; + ::boost::scoped_ptr<SvxRelativeField> maBottomDist; + //Line spacing + ::boost::scoped_ptr<Window> maLineSPTbxBackground; + ::boost::scoped_ptr<ToolBox> maLineSPTbx; + //Indent + ::boost::scoped_ptr<FixedText> maFTIndent; + ::boost::scoped_ptr<Window> maTbxIndent_IncDecBackground; + ::boost::scoped_ptr<ToolBox> maTbxIndent_IncDec; + ::boost::scoped_ptr<Window> maTbxProDemoteBackground; + ::boost::scoped_ptr<ToolBox> maTbxProDemote; + ::boost::scoped_ptr<SvxRelativeField> maLeftIndent; + ::boost::scoped_ptr<SvxRelativeField> maRightIndent; + ::boost::scoped_ptr<SvxRelativeField> maFLineIndent; + ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpColorUpdater; + + /********************************************************** + ** + ** Resources + ** + ***********************************************************/ + FixedImage maFISpace1; + FixedImage maFISpace2; + FixedImage maFIndent1; + FixedImage maFIndent2; + FixedImage maFIndent3; + + Image maSpace1; + Image maSpace2; + Image maSpace3; + Image maIndent1; + Image maIndent2; + Image maIndent3; + + Image maLeftPara; + Image maCentPara; + Image maRightPara; + Image maJusPara; + + Image maIndInc; + Image maIndDec; + Image maIndInc_BD; + Image maIndDec_BD; + Image maIndHang; + Image maParInc; + Image maParDec; + + ImageList maVertImageList; + ImageList maVertImageListH; + ImageList maNumBImageList; + ImageList maNumBImageListH; + ImageList maNumBImageListRTL; + Image maImgBackColorHigh; + Image maImgBackColor; + + /**************************************************************** + ** + ** Data Member + ** + *****************************************************************/ + long maTxtLeft; + //Line spacing + SvxLineSpacingItem *mpLnSPItem; + SfxItemState meLnSpState; + bool mbOutLineLeft; + bool mbOutLineRight; + long maUpper; + long maLower; + + sal_uInt16 mnBulletTypeIndex; + sal_uInt16 mnNumTypeIndex; + Color maColor; + bool mbColorAvailable; + FieldUnit m_eMetricUnit; + FieldUnit m_last_eMetricUnit; + SfxMapUnit m_eLRSpaceUnit; + SfxMapUnit m_eULSpaceUnit; + /**************************************************************** + ** + ** Controll Items + ** + *****************************************************************/ + + ::sfx2::sidebar::ControllerItem maLeftAlignControl; + ::sfx2::sidebar::ControllerItem maCenterAlignControl; + ::sfx2::sidebar::ControllerItem maRightAlignControl; + ::sfx2::sidebar::ControllerItem maJustifyAlignControl; + ::sfx2::sidebar::ControllerItem maLRSpaceControl; + ::sfx2::sidebar::ControllerItem maLNSpaceControl; + ::sfx2::sidebar::ControllerItem maULSpaceControl; + ::sfx2::sidebar::ControllerItem maOutLineLeftControl; + ::sfx2::sidebar::ControllerItem maOutLineRightControl; + ::sfx2::sidebar::ControllerItem maDecIndentControl; + ::sfx2::sidebar::ControllerItem maIncIndentControl; + ::sfx2::sidebar::ControllerItem maVertTop; + ::sfx2::sidebar::ControllerItem maVertCenter; + ::sfx2::sidebar::ControllerItem maVertBottom; + ::sfx2::sidebar::ControllerItem maBulletOnOff; + ::sfx2::sidebar::ControllerItem maNumberOnOff; + ::sfx2::sidebar::ControllerItem maBackColorControl; + ::sfx2::sidebar::ControllerItem m_aMetricCtl; + ::sfx2::sidebar::ControllerItem maBulletNumRuleIndex; + ::sfx2::sidebar::ControllerItem maNumNumRuleIndex; + + ::sfx2::sidebar::EnumContext maContext; + SfxBindings* mpBindings; + ParaLineSpacingPopup maLineSpacePopup; + ParaBulletsPopup maBulletsPopup; + ParaNumberingPopup maNumberingPopup; + ColorPopup maBGColorPopup; + cssu::Reference<css::ui::XSidebar> mxSidebar; + + + ParaPropertyPanel ( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings, + const cssu::Reference<css::ui::XSidebar>& rxSidebar); + virtual ~ParaPropertyPanel (void); + + void InitImageList(::boost::scoped_ptr<ToolBox>& rTbx, ImageList& rImglst, ImageList& rImgHlst); + + DECL_LINK(AlignStyleModifyHdl_Impl, ToolBox*); + DECL_LINK(VertTbxSelectHandler, ToolBox*); + DECL_LINK(NumBTbxSelectHandler, ToolBox*); + DECL_LINK(ModifyIndentHdl_Impl, void*); + DECL_LINK(ClickIndent_IncDec_Hdl_Impl, ToolBox*); + DECL_LINK(ClickProDemote_Hdl_Impl, ToolBox*); + DECL_LINK(ULSpaceHdl_Impl, void*); + DECL_LINK(ClickUL_IncDec_Hdl_Impl, ToolBox*); + DECL_LINK(ImplPopupModeEndHdl, FloatingWindow* ); + + void VertStateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState); + void ParaBKGStateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState); + void StateChangedAlignmentImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ); + void StateChangedIndentImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ); + void StateChangedLnSPImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ); + void StateChangedULImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ); + void StateChangeOutLineImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ); + void StateChangeIncDecImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ); + // Add toggle state for numbering and bullet icons + void StateChangeBulletNumImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ); + //Modified for Numbering&Bullets Dialog UX Enh + //Handing the transferred the num rule index data of the current selection + void StateChangeBulletNumRuleImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ); + + void initial(); + void ReSize(bool bSize); + + + PopupControl* CreateLineSpacingControl (PopupContainer* pParent); + PopupControl* CreateBulletsPopupControl (PopupContainer* pParent); + PopupControl* CreateNumberingPopupControl (PopupContainer* pParent); + PopupControl* CreateBGColorPopupControl (PopupContainer* pParent); + DECL_LINK(ClickLineSPDropDownHdl_Impl, ToolBox*); + DECL_LINK(NumBTbxDDHandler, ToolBox*); + DECL_LINK(ToolBoxBackColorDDHandler, ToolBox *); + + void SetupIcons (void); + void InitToolBoxAlign(); + void InitToolBoxVertAlign(); + void InitToolBoxIndent(); + void InitToolBoxBGColor(); + void InitToolBoxBulletsNumbering(); + void InitToolBoxSpacing(); + void InitToolBoxLineSpacing(); + + Color GetBGColor (void) const; + void SetBGColor (const String& rsColorName, const Color aColor); +}; + +} } // end of namespace ::svx::sidebar + +#endif + diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.src b/svx/source/sidebar/paragraph/ParaPropertyPanel.src new file mode 100644 index 000000000000..cd82977ee9c6 --- /dev/null +++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.src @@ -0,0 +1,970 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "ParaPropertyPanel.hrc" +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include "helpid.hrc" + +#define MASKCOLOR MaskColor = Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; }; + +#define SVX_PROPERTYPANEL_PARA_VERT_IDLIST \ + IdList = \ + { \ + IID_VERT_TOP ; \ + IID_VERT_CENTER ; \ + IID_VERT_BOTTOM ; \ + }; \ + IdCount = { 3 ; }; + +#define SVX_PROPERTYPANEL_PARA_NUMBULLET_IDLIST \ + IdList = \ + { \ + IID_BULLET ; \ + IID_NUMBER ; \ + }; \ + IdCount = { 2 ; }; + +//add by wj for sym2_7380 +#define SVX_PROPERTYPANEL_PARA_NUMBULLET_IDLIST_RTL \ + IdList = \ + { \ + IID_BULLET ; \ + IID_NUMBER ; \ + }; \ + IdCount = { 2 ; }; + +Control RID_SIDEBAR_PARA_PANEL +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + Size = MAP_APPFONT( PROPERTYPAGE_WIDTH, PARA_SECTIONPAGE_HEIGHT ); + HelpID = HID_PROPERTYPANEL_PARA_SECTION ; + Text = "Paragraph"; + + ToolBox TBX_HORIZONTALALIGNMENT + { + Pos = MAP_APPFONT ( TBX_HORI_ALIGN_X , TBX_HORI_ALIGN_Y ); + Size = MAP_APPFONT ( ALIGNMENT_TBX_WIDTH*4 ,ALIGNMENT_TBX_HEIGHT); + SVLook = TRUE ; + Border = FALSE ; + HelpID = HID_PPROPERTYPANEL_PARA_TBX_HALIGN; + Text = "Horizontal Alignment"; + ItemList = + { + ToolBoxItem + { + Identifier = BT_SUBSTLEFT ; + HelpID = HID_PPROPERTYPANEL_PARA_TBI_HALIGN_LEFT; + Text [ en-US ] = "Align Left" ; + ItemBitmap = Bitmap + { + File = "symphony/AlignTextLeft_16x16.png"; + }; + }; + ToolBoxItem + { + Identifier = BT_SUBSTCENTER ; + HelpID = HID_PPROPERTYPANEL_PARA_TBI_HALIGN_CENTER; + Text [ en-US ] = "Align Center" ; + ItemBitmap = Bitmap + { + File = "symphony/AlignTextCenter_16x16.png"; + }; + }; + ToolBoxItem + { + Identifier = BT_SUBSTRIGHT ; + HelpID = HID_PPROPERTYPANEL_PARA_TBI_HALIGN_RIGHT; + Text [ en-US ] = "Align Right" ; + ItemBitmap = Bitmap + { + File = "symphony/AlignTextRight_16x16.png"; + }; + }; + ToolBoxItem + { + Identifier = BT_SUBSTJUSTIFY ; + HelpID = HID_PPROPERTYPANEL_PARA_TBI_HALIGN_JUSTIFY; + Text [ en-US ] = "Align Justified" ; + ItemBitmap = Bitmap + { + File = "symphony/AlignTextJustified_16x16.png"; + }; + }; + }; + }; + ToolBox TBX_VERT_ALIGN + { + HelpID = HID_PPROPERTYPANEL_PARA_TBX_VALIGN; + SVLook = TRUE ; + Border = FALSE ; + Pos = MAP_APPFONT ( TBX_VERT_ALIGN_X, TBX_VERT_ALIGN_Y ) ; + Size = MAP_APPFONT ( TOOLBOX_ITEM_WIDTH * 3 , TOOLBOX_ITEM_HEIGHT) ; + TabStop = TRUE ; + Text = "Vertical Alignment"; + ItemList = + { + ToolBoxItem + { + Identifier = IID_VERT_TOP ; + HelpID = HID_PPROPERTYPANEL_PARA_TBI_VALIGN_TOP; + Text [ en-US ] = "Align Top" ; + }; + + ToolBoxItem + { + Identifier = IID_VERT_CENTER ; + HelpID = HID_PPROPERTYPANEL_PARA_TBI_VALIGN_CENTER; + Text [ en-US ] = "Align Center Vertically" ; + }; + + ToolBoxItem + { + Identifier = IID_VERT_BOTTOM ; + HelpID = HID_PPROPERTYPANEL_PARA_TBI_VALIGN_BOT; + Text [ en-US ] = "Align Bottom" ; + }; + }; + }; + + ToolBox TBX_NUM_BULLET + { + HelpID = HID_PPROPERTYPANEL_PARA_TBX_NUM_BULLET; + Border = FALSE ; + Pos = MAP_APPFONT ( TBX_NUM_BULLET_X , TBX_NUM_BULLET_Y ) ; + Size = MAP_APPFONT ( TOOLBOX_ITEM_DD_WIDTH * 2 , TOOLBOX_ITEM_HEIGHT) ; + TabStop = TRUE ; + Text = "Bullets and Numbering"; + ItemList = + { + ToolBoxItem + { + Identifier = IID_BULLET ; + HelpID = HID_PPROPERTYPANEL_PARA_TBI_BULLET ; + Text [ en-US ] = "Bullets" ; + DropDown = TRUE ; + }; + ToolBoxItem + { + Identifier = IID_NUMBER ; + HelpID = HID_PPROPERTYPANEL_PARA_TBI_NUM ; + Text [ en-US ] = "Numbering" ; + DropDown = TRUE ; + }; + }; + }; + ToolBox TBX_BACK_COLOR + { + SVLook = TRUE ; + Pos = MAP_APPFONT (TBX_BACK_COLOR_X, TBX_BACK_COLOR_Y) ; + Size = MAP_APPFONT (TOOLBOX_WIDTH,TOOLBOX_HEIGHT ) ; + TabStop = TRUE ; + HelpID = HID_PPROPERTYPANEL_PARA_TBX_BACK_COLOR; + Text = "Paragraph Background Color" ; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_BACK_COLOR ; + HelpID = HID_PPROPERTYPANEL_PARA_TBI_BACK_COLOR; + DropDown = TRUE ; + Text [ en-US ] = "Paragraph Background Color" ; + }; + }; + }; + FixedText FT_SPACING + { + Pos = MAP_APPFONT ( FT_PARA_SPACE_X, FT_PARA_SPACE_Y ); + Size = MAP_APPFONT ( FT_PARA_INDENT_X - 7 - FT_PARA_SPACE_X, _FIXED_TEXT_HEIGHT) ; + Text [ en-US ] = "~Spacing:"; + }; + ToolBox TBX_UL_INC_DEC + { + Pos = MAP_APPFONT ( TBX_PARA_SPACE_INC_DEC_X,TBX_PARA_SPACE_INC_DEC_Y ); + Size = MAP_APPFONT (ALIGNMENT_TBX_WIDTH*2,ALIGNMENT_TBX_HEIGHT); + SVLook = TRUE ; + Border = FALSE ; + HelpID = HID_PPROPERTYPANEL_PARA_TBX_INC_DEC ; + Text = "Spacing"; + ItemList = + { + ToolBoxItem + { + Identifier = BT_TBX_UL_INC ; + HelpID = HID_PPROPERTYPANEL_PARA_TBI_INC ; + Text [ en-US ] = "Increase Spacing" ; + ItemBitmap = Bitmap + { + File = "symphony/IncreaseSpace_16x16.png"; + }; + }; + ToolBoxItem + { + Identifier = BT_TBX_UL_DEC ; + HelpID = HID_PPROPERTYPANEL_PARA_TBI_DEC ; + Text [ en-US ] = "Decrease Spacing" ; + ItemBitmap = Bitmap + { + File = "symphony/DecreaseSpace_16x16.png"; + }; + }; + }; + }; + MetricField MF_ABOVE_PARASPACING + { + HelpID = HID_POPUP_PS_ED_SBINDE_TOPDIST ; + Border = TRUE; + Pos = MAP_APPFONT ( MBX_TOP_DIST_X, MBX_TOP_DIST_Y ); + Size = MAP_APPFONT ( CONTROL_WIDTH -10 ,MBOX_HEIGHT ) ; + QuickHelpText [ en-US ] = "Above Paragraph Spacing"; + TabStop = TRUE; + Repeat = TRUE; + Spin = TRUE; + Maximum = 999; + Unit = FUNIT_INCH; + Last = 999; + SpinSize = 1; + + }; + MetricField MF_BELOW_PARASPACING + { + Border = TRUE; + Pos = MAP_APPFONT ( MBX_BOT_DIST_X, MBX_BOT_DIST_Y ); + Size = MAP_APPFONT ( CONTROL_WIDTH -10,MBOX_HEIGHT ) ; + QuickHelpText [ en-US ] = "Below Paragraph Spacing"; + HelpID = HID_POPUP_PS_ED_SBINDE_BOTTOMDIST ; + Repeat = TRUE; + Spin = TRUE; + Maximum = 999; + Unit = FUNIT_INCH; + Last = 999; + SpinSize = 1; + }; + FixedText FT_INDENT + { + Pos = MAP_APPFONT ( FT_PARA_INDENT_X, FT_PARA_INDENT_Y ); + Size = MAP_APPFONT ( _FIXED_TEXT_WIDTH + 50, _FIXED_TEXT_HEIGHT) ; + Text [ en-US ] = "~Indent:"; + }; + ToolBox TBX_INDENT_INC_DEC + { + Pos = MAP_APPFONT ( TBX_PARA_INDENT_INC_DEC_X, TBX_PARA_INDENT_INC_DEC_Y ); + Size = MAP_APPFONT (ALIGNMENT_TBX_WIDTH*2,ALIGNMENT_TBX_HEIGHT); + SVLook = TRUE ; + Border = FALSE ; + HelpID = HID_PPROPERTYPANEL_PARA_TBX_INDENT_INC_DEC ; + Text = "Indent"; + ItemList = + { + ToolBoxItem + { + Identifier = BT_TBX_INDENT_INC ; + HelpID = HID_PPROPERTYPANEL_PARA_TBI_INDENT_INC ; + Text [ en-US ] = "Increase Indent" ; + ItemBitmap = Bitmap + { + File = "symphony/Indent_16x16.png"; + }; + }; + ToolBoxItem + { + Identifier = BT_TBX_INDENT_DEC ; + HelpID = HID_PPROPERTYPANEL_PARA_TBI_INDENT_DEC ; + Text [ en-US ] = "Decrease Indent" ; + ItemBitmap = Bitmap + { + File = "symphony/Outdent_16x16.png"; + }; + }; + ToolBoxItem + { + Identifier = ID_HANGING_INDENT ; + Text [ en-US ] = "Switch to Hanging Indent" ; + HelpID = HID_PPROPERTYPANEL_PARA_TBI_INDENT_HANG ; + ItemBitmap = Bitmap + { + File = "symphony/Indent_Hanging.png"; + }; + }; + }; + }; + ToolBox TBX_INDENT_PRO_DEMOTE + { + Pos = MAP_APPFONT ( TBX_PARA_INDENT_INC_DEC_X, TBX_PARA_INDENT_INC_DEC_Y ); + Size = MAP_APPFONT (ALIGNMENT_TBX_WIDTH*2,ALIGNMENT_TBX_HEIGHT); + SVLook = TRUE ; + Border = FALSE ; + HelpID = HID_PPROPERTYPANEL_PARA_TBX_INDENTP_INC_DEC ; + Text = "Indent"; + ItemList = + { + ToolBoxItem + { + Identifier = BT_TBX_INDENT_PROMOTE ; + HelpID = HID_PPROPERTYPANEL_PARA_TBI_INDENTP_INC ; + Text [ en-US ] = "Increase Indent" ; + ItemBitmap = Bitmap + { + File = "symphony/Indent_16x16.png"; + }; + }; + ToolBoxItem + { + Identifier = BT_TBX_INDENT_DEMOTE ; + HelpID = HID_PPROPERTYPANEL_PARA_TBI_INDENTP_DEC ; + Text [ en-US ] = "Decrease Indent" ; + ItemBitmap = Bitmap + { + File = "symphony/Outdent_16x16.png"; + }; + }; + ToolBoxItem + { + Identifier = SD_HANGING_INDENT ; + Text [ en-US ] = "Switch to Hanging Indent" ; + HelpID = HID_PPROPERTYPANEL_PARA_TBI_INDENTP_HANG ; + ItemBitmap = Bitmap + { + File = "symphony/Indent_Hanging.png"; + }; + }; + }; + }; + MetricField MF_BEFORE_INDENT + { + Border = TRUE ; + Pos = MAP_APPFONT ( MBX_LEFT_DIST_X, MBX_LEFT_DIST_Y ); + Size = MAP_APPFONT ( CONTROL_WIDTH - 10,MBOX_HEIGHT ) ; + QuickHelpText [ en-US ] = "Before Text Indent"; + HelpID = HID_POPUP_INDENT_ED_INDENT_LEFTINDENT ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 9999 ; + StrictFormat = TRUE ; + Unit = FUNIT_INCH; + Last = 9999 ; + SpinSize = 2 ; + }; + MetricField MF_AFTER_INDENT + { + Border = TRUE ; + Pos = MAP_APPFONT ( MBX_RIGHT_DIST_X, MBX_RIGHT_DIST_Y ); + Size = MAP_APPFONT ( CONTROL_WIDTH -10 ,MBOX_HEIGHT ) ; + QuickHelpText [ en-US ] = "After Text Indent"; + HelpID = HID_POPUP_INDENT_ED_INDENT_RIGHTINDENT ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 9999 ; + StrictFormat = TRUE ; + Unit = FUNIT_INCH; + Last = 9999 ; + SpinSize = 2 ; + }; + MetricField MF_FL_INDENT + { + Border = TRUE ; + Pos = MAP_APPFONT ( MBX_FLINE_DIST_X, MBX_FLINE_DIST_Y ); + Size = MAP_APPFONT ( CONTROL_WIDTH -10 ,MBOX_HEIGHT ) ; + QuickHelpText [ en-US ] = "First Line Indent"; + HelpID = HID_POPUP_INDENT_ED_INDENT_FLINDENT ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = -9999; + Maximum = 9999 ; + DecimalDigits = 2; + Unit = FUNIT_INCH; + First = -9999; + Last = 9999 ; + SpinSize = 2 ; + }; + ToolBox TBX_LINESP + { + Pos = MAP_APPFONT ( TBX_LINE_SPACE_X, TBX_LINE_SPACE_Y); + SVLook = TRUE ; + Border = FALSE ; + Size = MAP_APPFONT (TOOLBOX_WIDTH, TOOLBOX_HEIGHT); + HelpID = HID_PPROPERTYPANEL_PARA_TBX_LINESP ; + Text = "Line Spacing" ; + ItemList = + { + ToolBoxItem + { + Identifier = BT_BTX_LINESP ; + HelpID = HID_PPROPERTYPANEL_PARA_TBI_LINESP ; + Text [ en-US ] = "Line Spacing" ; + ItemBitmap = Bitmap + { + File = "symphony/lpsmall-spacing-1.png" ; + }; + DropDown = TRUE; + }; + }; + }; + FixedImage FI_INDENT1 + { + Pos = MAP_APPFONT( IMG_SPACE_X, IMG_SPACE1_Y ); + Size = MAP_APPFONT( IMAGE_SIZE, IMAGE_SIZE ); + }; + FixedImage FI_INDENT2 + { + Pos = MAP_APPFONT( IMG_SPACE_X, IMG_SPACE2_Y ); + Size = MAP_APPFONT( IMAGE_SIZE, IMAGE_SIZE ); + }; + FixedImage FI_INDENT3 + { + Pos = MAP_APPFONT( IMG_INDENT_X, IMG_INDENT1_Y ); + Size = MAP_APPFONT( IMAGE_SIZE, IMAGE_SIZE ); + }; + FixedImage FI_SPACE1 + { + Pos = MAP_APPFONT( IMG_INDENT_X, IMG_INDENT2_Y ); + Size = MAP_APPFONT( IMAGE_SIZE, IMAGE_SIZE ); + }; + FixedImage FI_SPACE2 + { + Pos = MAP_APPFONT( IMG_INDENT_X, IMG_INDENT3_Y ); + Size = MAP_APPFONT( IMAGE_SIZE, IMAGE_SIZE ); + }; + + ImageList IL_VERT_ALIGN + { + Prefix = "symphony/para_vert"; + MaskColor = STD_MASKCOLOR ; + SVX_PROPERTYPANEL_PARA_VERT_IDLIST + }; + ImageList ILH_VERT_ALIGN + { + Prefix = "symphony/para_verth"; + MaskColor = STD_MASKCOLOR ; + SVX_PROPERTYPANEL_PARA_VERT_IDLIST + }; + + ImageList IL_NUM_BULLET + { + Prefix = "symphony/para_numbullet"; + MaskColor = STD_MASKCOLOR ; + SVX_PROPERTYPANEL_PARA_NUMBULLET_IDLIST + }; + ImageList ILH_NUM_BULLET + { + Prefix = "symphony/para_numbulleth"; + MaskColor = STD_MASKCOLOR ; + SVX_PROPERTYPANEL_PARA_NUMBULLET_IDLIST + }; + //for sym2_7380 + ImageList IL_NUM_BULLET_RTL + { + Prefix = "symphony/para_numbullet_rtl"; + MaskColor = STD_MASKCOLOR ; + SVX_PROPERTYPANEL_PARA_NUMBULLET_IDLIST_RTL + }; + //end + Image IMG_BACK_COLOR + { + ImageBitmap = Bitmap{File = "symphony/sc_backgroundcolor.bmp";}; + }; + Image IMG_BACK_COLOR_H + { + ImageBitmap = Bitmap{File = "symphony/sch_backgroundcolor.bmp";}; + }; + Image IMG_SPACE1 + { + ImageBitmap = Bitmap{File = "symphony/spacing1.png";}; + }; + Image IMG_SPACE2 + { + ImageBitmap = Bitmap{File = "symphony/spacing2.png";}; + }; + Image IMG_SPACE3 + { + ImageBitmap = Bitmap{File = "symphony/spacing3.png";}; + }; + Image IMG_INDENT1 + { + ImageBitmap = Bitmap{File = "symphony/Indent2.png";}; + }; + Image IMG_INDENT2 + { + ImageBitmap = Bitmap{File = "symphony/Indent3.png";}; + }; + Image IMG_INDENT3 + { + ImageBitmap = Bitmap{File = "symphony/Indent4.png";}; + }; + Image IMG_LEFT_PARA + { + ImageBitmap = Bitmap{File = "symphony/AlignTextLeft_16x16.png";}; + }; + Image IMG_CENTER_PARA + { + ImageBitmap = Bitmap{File = "symphony/AlignTextCenter_16x16.png";}; + }; + Image IMG_RIGHT_PARA + { + ImageBitmap = Bitmap{File = "symphony/AlignTextRight_16x16.png";}; + }; + Image IMG_JUSTIFY_PARA + { + ImageBitmap = Bitmap{File = "symphony/AlignTextJustified_16x16.png";}; + }; + Image IMG_INDENT_INC + { + ImageBitmap = Bitmap{File = "symphony/Indent_16x16.png";}; + }; + Image IMG_INDENT_DEC + { + ImageBitmap = Bitmap{File = "symphony/Outdent_16x16.png";}; + }; + Image IMG_INDENT_INC_BD + { + ImageBitmap = Bitmap{File = "symphony/rte_Indent_16x16.png";}; + }; + Image IMG_INDENT_DEC_BD + { + ImageBitmap = Bitmap{File = "symphony/rte_Outdent_16x16.png";}; + }; + Image IMG_INDENT_HANG + { + ImageBitmap = Bitmap{File = "symphony/Indent_Hanging.png";}; + }; + Image IMG_PARA_INC + { + ImageBitmap = Bitmap{File = "symphony/IncreaseSpace_16x16.png";}; + }; + Image IMG_PARA_DEC + { + ImageBitmap = Bitmap{File = "symphony/DecreaseSpace_16x16.png";}; + }; +}; + +//===========================================Back color page============================== +/* +Control RID_POPUPPANEL_PARAPAGE_BACK_COLOR +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + + Size = MAP_APPFONT( POPUP_COLOR_PICKER_WIDTH + POPUP_BORDER_WIDTH , POPUP_COLOR_PICKER_HEIGHT +POPUP_BORDER_HEIGHT ); + + Control VS_FONT_COLOR + { + HelpID = HID_PPROPERTYPANEL_PARA_BACK_COLOR_VS ; + Hide = TRUE ; + Pos = MAP_APPFONT ( OFFSET_X , OFFSET_Y ); + Size = MAP_APPFONT ( POPUP_COLOR_PICKER_WIDTH , POPUP_COLOR_PICKER_HEIGHT ); + TabStop = TRUE ; + Text = "Color Picker"; + }; + + String STR_NOFILL + { + Text [ en-US ] = "No Color"; + }; + +};*/ + +//===========================================Bullet popup page============================== +Control RID_POPUPPANEL_PARAPAGE_BULLETS +{ + DialogControl = TRUE; + OutputSize = TRUE; + Border = FALSE; + + Size = MAP_APPFONT ( POPUP_WIDTH_BULLET , POPUP_HEIGHT_BULLET) ; + Control VS_VALUES + { + Pos = MAP_APPFONT ( POPUPPANEL_MARGIN_NB , POPUPPANEL_MARGIN_NB ) ; + Size = MAP_APPFONT ( VS_WIDTH_BULLET , VS_HEIGHT_BULLET) ; + HelpID = HID_POPUP_BULLET_VS_VALUES ; + TabStop = TRUE ; + Text = "Bullet"; + }; + PushButton CB_BULLET_MORE + { + Pos = MAP_APPFONT (CUST_MORE_BUTTON_X + POPUPPANEL_MARGIN_NB, VS_HEIGHT_BULLET + POPUPPANEL_MARGIN_NB * 2 ) ; + Size = MAP_APPFONT (POPUP_WIDTH_BULLET - 2*CUST_MORE_BUTTON_X - POPUPPANEL_MARGIN_NB*2, CUST_MORE_BUTTON_HEIGHT ) ; + HelpID = HID_POPUP_BULLET_CB_BULLET_MORE ; + TabStop = TRUE ; + Text [ en-US ] = "~More Options"; + }; + Bitmap BMP_BULLET_MORE + { + File = "symphony/__morebutton.bmp"; + }; +}; + +String RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS_0 +{ + Text [en-US] = "large square bullets"; +}; + +String RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS_1 +{ + Text [en-US] = "graphic bullets"; +}; + +String RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS_2 +{ + Text [en-US] = "graphic bullets"; +}; + +String RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS_3 +{ + Text [en-US] = "graphic bullets"; +}; + +String RID_SVXSTR_SIDEBAR_BULLET_DESCRIPTIONS_4 +{ + Text [en-US] = "graphic bullets"; +}; + +//===========================================Numbering popup page============================== +Control RID_POPUPPANEL_PARAPAGE_NUMBERING +{ + SVLook = TRUE ; + DialogControl = TRUE; + OutputSize = TRUE; + Border = FALSE; + + Size = MAP_APPFONT ( POPUP_WIDTH_NUM , POPUP_HEIGHT_NUM) ; + Control VS_NUMBERING + { + Pos = MAP_APPFONT ( POPUPPANEL_MARGIN_NB, POPUPPANEL_MARGIN_NB ) ; + Size = MAP_APPFONT ( VS_WIDTH_NUM , VS_HEIGHT_NUM) ; + HelpID = HID_POPUP_NUM_VS_NUMBERING ; + TabStop = TRUE ; + Text = "Numbering"; + }; + PushButton CB_NUMBERING_MORE + { + Pos = MAP_APPFONT (CUST_MORE_BUTTON_X + POPUPPANEL_MARGIN_NB, VS_HEIGHT_NUM + POPUPPANEL_MARGIN_NB * 2 ) ; + Size = MAP_APPFONT (POPUP_WIDTH_NUM - 2*CUST_MORE_BUTTON_X - POPUPPANEL_MARGIN_NB*2, CUST_MORE_BUTTON_HEIGHT ) ; + HelpID = HID_POPUP_NUM_CB_NUMBERING_MORE ; + TabStop = TRUE ; + Text [ en-US ] = "~More Options"; + }; + Bitmap BMP_NUMERING_MORE + { + File = "symphony/__morebutton.bmp"; + }; +}; + +//===========================================Line Space popup page============================== +Control RID_POPUPPANEL_PARAPAGE_LINESPACING +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + + Size = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL * 2 + POPUP_BORDER_WIDTH + VS_SPACING_WIDTH, POPUP_PAGE_HEIGHT ); + + Control LINE_SPACING + { + Pos = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL + OFFSET_X , POPUPPANEL_MARGIN_SMALL + OFFSET_Y ); + Size = MAP_APPFONT ( VS_SPACING_WIDTH , 17 * 5); + TabStop = TRUE ; + Text = "Line Spacing"; + }; + + FixedText FT_CUSTOM + { + Pos = MAP_APPFONT ( POP_FT_CUSTOM_X, POP_FT_CUSTOM_Y ); + Size = MAP_APPFONT ( _FIXED_TEXT_WIDTH + 50 , _FIXED_TEXT_HEIGHT) ; + Text [ en-US ] = "Custom:"; + }; + FixedText FT_LINE_SPACING + { + Pos = MAP_APPFONT ( FT_1_X, FT_1_Y ); + Size = MAP_APPFONT ( _FIXED_TEXT_WIDTH + 10, _FIXED_TEXT_HEIGHT) ; + Text [ en-US ] = "~Line Spacing:"; + }; + + FixedText FT_OF + { + Pos = MAP_APPFONT ( FT_2_X, FT_2_Y ); + Size = MAP_APPFONT ( _FIXED_TEXT_WIDTH , _FIXED_TEXT_HEIGHT) ; + Text [ en-US ] = "~Of:"; + }; + + ListBox LB_LINE_SPACING + { + Border = TRUE ; + Pos = MAP_APPFONT ( EDIT_1_X, EDIT_1_Y ); + Size = MAP_APPFONT ( BD_WIDTH - POPUPPANEL_MARGIN_LARGE * 2,LISTBOX_HEIGHT ) ; + TabStop = TRUE ; + DropDown = TRUE ; + HelpID = HID_POPUP_LS_LB_LINE_SPACING ; + StringList [ en-US ] = + { + < "Single" ; Default ; > ; + < "1.5 Lines" ; Default ; > ; + < "Double" ; Default ; > ; + < "Proportional" ; Default ; > ; + < "At least" ; Default ; > ; + < "Leading" ; Default ; > ; + < "Fixed" ; Default ; > ; + }; + }; + MetricField ED_SBINDE_LINEDISTPERCENT + { + Disable = TRUE; + Border = TRUE; + Pos = MAP_APPFONT ( EDIT_2_X, EDIT_2_Y ); + Size = MAP_APPFONT ( BD_WIDTH - POPUPPANEL_MARGIN_LARGE * 2,MBOX_HEIGHT ) ; + HelpID = HID_POPUP_LS_ED_SBINDE_LINEDISTPERCENT ; + Repeat = TRUE; + Spin = TRUE; + Minimum = 50; + Maximum = 200; + Value = 100; + StrictFormat = TRUE; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%"; + First = 50; + Last = 200; + SpinSize = 1; + }; + MetricField ED_SBINDE_LINEDISTPOINT + { + Disable = TRUE; + Border = TRUE; + Pos = MAP_APPFONT ( EDIT_2_X, EDIT_2_Y ); + Size = MAP_APPFONT ( BD_WIDTH - POPUPPANEL_MARGIN_LARGE * 2, MBOX_HEIGHT ) ; + HelpID = HID_POPUP_LS_ED_SBINDE_LINEDISTPOINT ; + Repeat = TRUE; + Spin = TRUE; + Maximum = 9999; + DecimalDigits = 2; + StrictFormat = TRUE ; + Unit = FUNIT_INCH; + Last = 9999; + SpinSize = 2; + }; + Image IMG_SPACING1 + { + ImageBitmap = Bitmap{File = "symphony/lpspacing-1.png";}; + }; + Image IMG_SPACING115 + { + ImageBitmap = Bitmap{File = "symphony/lpspacing-1_15.png";}; + }; + Image IMG_SPACING15 + { + ImageBitmap = Bitmap{File = "symphony/lpspacing-1_5.png";}; + }; + Image IMG_SPACING2 + { + ImageBitmap = Bitmap{File = "symphony/lpspacing-2.png";}; + }; + Image IMG_SEL_SPACING1 + { + ImageBitmap = Bitmap{File = "symphony/lpselected-spacing-1.png";}; + }; + Image IMG_SEL_SPACING115 + { + ImageBitmap = Bitmap{File = "symphony/lpselected-spacing-1_15.png";}; + }; + Image IMG_SEL_SPACING15 + { + ImageBitmap = Bitmap{File = "symphony/lpselected-spacing-1_5.png";}; + }; + Image IMG_SEL_SPACING2 + { + ImageBitmap = Bitmap{File = "symphony/lpselected-spacing-2.png";}; + }; + Image IMG_CUSTOM + { + ImageBitmap = Bitmap{File = "symphony/last_custom_common.png";}; + }; + Image IMG_CUSTOM_GRAY + { + ImageBitmap = Bitmap{File = "symphony/last_custom_common_grey.png";}; + }; + String STR_LS_SINGLE + { + Text [ en-US ] = "Line spacing: Single"; + }; + String STR_LS_115 + { + Text [ en-US ] = "Line spacing: 1.15 Lines"; + }; + String STR_LS_15 + { + Text [ en-US ] = "Line spacing: 1.5 Lines"; + }; + String STR_LS_DOUBLE + { + Text [ en-US ] = "Line spacing: Double"; + }; + String STR_LSPACING + { + Text [ en-US ] = "Line spacing:"; + }; + String STR_LS_OF + { + Text [ en-US ] = "of:"; + }; + String STR_SPACING1 + { + Text [ en-US ] = "Spacing: 1"; + }; + String STR_SPACING115 + { + Text [ en-US ] = "Spacing: 1.15"; + }; + String STR_SPACING15 + { + Text [ en-US ] = "Spacing: 1.5"; + }; + String STR_SPACING2 + { + Text [ en-US ] = "Spacing: 2"; + }; + String STR_LCVALUE + { + Text [ en-US ] = "Last Custom Value"; + }; + +}; + +String RID_SVXSTR_NUMBULLET_NONE +{ + Text [en-US] = "None"; +}; + +String RID_SVXSTR_GRAPHICS_DESCRIPTION_0 +{ + Text [en-US] = "Dark Red Circle"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_1 +{ + Text [en-US] = "Blue Ball"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_2 +{ + Text [en-US] = "Green Ball"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_3 +{ + Text [en-US] = "Black Square"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_4 +{ + Text [en-US] = "Orange"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_5 +{ + Text [en-US] = "Purple Square"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_6 +{ + Text [en-US] = "Diamond Blue"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_7 +{ + Text [en-US] = "Light Blue Diamond"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_8 +{ + Text [en-US] = "Red Diamond"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_9 +{ + Text [en-US] = "Yellow Star"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_10 +{ + Text [en-US] = "Blue Star"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_11 +{ + Text [en-US] = "Blue Triangle"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_12 +{ + Text [en-US] = "Dark Green Triangle"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_13 +{ + Text [en-US] = "Red Arrow"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_14 +{ + Text [en-US] = "Blue Arrow"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_15 +{ + Text [en-US] = "Blue Box"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_16 +{ + Text [en-US] = "Red Box"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_17 +{ + Text [en-US] = "Light Blue Asterisk"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_18 +{ + Text [en-US] = "Red Leaves"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_19 +{ + Text [en-US] = "Blue Target"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_20 +{ + Text [en-US] = "Blue Arrow"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_21 +{ + Text [en-US] = "Dark Blue Arrow"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_22 +{ + Text [en-US] = "Brown Arrow"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_23 +{ + Text [en-US] = "Red Flag"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_24 +{ + Text [en-US] = "Green Flag"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_25 +{ + Text [en-US] = "Red X"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_26 +{ + Text [en-US] = "Black X"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_27 +{ + Text [en-US] = "Green Checkmark"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_28 +{ + Text [en-US] = "Blue Checkmark"; +}; +String RID_SVXSTR_GRAPHICS_DESCRIPTION_29 +{ + Text [en-US] = "Dark Red Square"; +}; diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx new file mode 100644 index 000000000000..032537352e67 --- /dev/null +++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx @@ -0,0 +1,1222 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include <sfx2/sidebar/Theme.hxx> +#include <sfx2/sidebar/ControlFactory.hxx> +#include "PosSizePropertyPanel.hxx" +#include "PosSizePropertyPanel.hrc" +#include <svx/sidebar/SidebarDialControl.hxx> +#include <svx/dialogs.hrc> +#include <svx/dialmgr.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/viewsh.hxx> +#include <sfx2/objsh.hxx> +#include <svx/dlgutil.hxx> +#include <unotools/viewoptions.hxx> +#include <vcl/virdev.hxx> +#include <vcl/svapp.hxx> +#include <vcl/field.hxx> +#include <vcl/fixed.hxx> +#include <vcl/toolbox.hxx> +#include <svx/svdview.hxx> +#include <svl/aeitem.hxx> + +using namespace css; +using namespace cssu; +using ::sfx2::sidebar::Theme; + +#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) +#define USERITEM_NAME rtl::OUString::createFromAscii("FitItem") + + +namespace svx { namespace sidebar { + + + +PosSizePropertyPanel::PosSizePropertyPanel( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings, + const cssu::Reference<css::ui::XSidebar>& rxSidebar) +: Control( + pParent, + SVX_RES(RID_SIDEBAR_POSSIZE_PANEL)), + mpFtPosX(new FixedText(this, SVX_RES(FT_SBSHAPE_HORIZONTAL))), + mpMtrPosX(new MetricField(this, SVX_RES(MF_SBSHAPE_HORIZONTAL))), + mpFtPosY(new FixedText(this, SVX_RES(FT_SBSHAPE_VERTICAL))), + mpMtrPosY(new MetricField(this, SVX_RES(MF_SBSHAPE_VERTICAL))), + mpFtWidth(new FixedText(this, SVX_RES(FT_WIDTH))), + mpMtrWidth(new MetricField(this, SVX_RES(MTR_FLD_WIDTH))), + mpFtHeight(new FixedText(this, SVX_RES(FT_HEIGHT))), + mpMtrHeight(new MetricField(this, SVX_RES(MTR_FLD_HEIGHT))), + mpCbxScale(new CheckBox(this, SVX_RES(CBX_SCALE))), + mpFtAngle(new FixedText(this, SVX_RES(FT_ANGLE))), + mpMtrAngle(new MetricBox(this, SVX_RES(MTR_FLD_ANGLE))), + mpDial(new SidebarDialControl(this, SVX_RES(DIAL_CONTROL))), + mpFtFlip(new FixedText(this, SVX_RES(FT_FLIP))), + mpFlipTbxBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), + mpFlipTbx(sfx2::sidebar::ControlFactory::CreateToolBox(mpFlipTbxBackground.get(), SVX_RES(TBX_FLIP))), + maRect(), + mpView(0), + mlOldWidth(1), + mlOldHeight(1), + meRP(RP_LT), + maAnchorPos(), + mlRotX(0), + mlRotY(0), + maUIScale(), + mePoolUnit(), + meDlgUnit(), + maTransfPosXControl(SID_ATTR_TRANSFORM_POS_X, *pBindings, *this), + maTransfPosYControl(SID_ATTR_TRANSFORM_POS_Y, *pBindings, *this), + maTransfWidthControl(SID_ATTR_TRANSFORM_WIDTH, *pBindings, *this), + maTransfHeightControl(SID_ATTR_TRANSFORM_HEIGHT, *pBindings, *this), + maSvxAngleControl( SID_ATTR_TRANSFORM_ANGLE, *pBindings, *this), + maRotXControl(SID_ATTR_TRANSFORM_ROT_X, *pBindings, *this), + maRotYControl(SID_ATTR_TRANSFORM_ROT_Y, *pBindings, *this), + maProPosControl(SID_ATTR_TRANSFORM_PROTECT_POS, *pBindings, *this), + maProSizeControl(SID_ATTR_TRANSFORM_PROTECT_SIZE, *pBindings, *this), + maAutoWidthControl(SID_ATTR_TRANSFORM_AUTOWIDTH, *pBindings, *this), + maAutoHeightControl(SID_ATTR_TRANSFORM_AUTOHEIGHT, *pBindings, *this), + m_aMetricCtl(SID_ATTR_METRIC, *pBindings, *this), + maImgFlipHori(SVX_RES(IMG_HORI_FLIP)), + maImgFlipVert(SVX_RES(IMG_VERT_FLIP)), + mxFrame(rxFrame), + maContext(), + mpBindings(pBindings), + mbMtrPosXMirror(false), + mbSizeProtected(false), + mbPositionProtected(false), + mbAutoWidth(false), + mbAutoHeight(false), + mbAdjustEnabled(false), + mbIsFlip(false), + mbInDestructor(false), + mxSidebar(rxSidebar) +{ + Initialize(); + FreeResource(); + + mpBindings->Update( SID_ATTR_TRANSFORM_WIDTH ); + mpBindings->Update( SID_ATTR_TRANSFORM_HEIGHT ); + mpBindings->Update( SID_ATTR_TRANSFORM_PROTECT_SIZE ); + mpBindings->Update( SID_ATTR_METRIC ); +} + + + +PosSizePropertyPanel::~PosSizePropertyPanel() +{ + mbInDestructor = true; + + // Destroy the background windows of the toolboxes. + mpFlipTbx.reset(); + mpFlipTbxBackground.reset(); +} + + + +void PosSizePropertyPanel::ShowMenu (void) +{ + if (mpBindings != NULL) + { + SfxDispatcher* pDispatcher = mpBindings->GetDispatcher(); + if (pDispatcher != NULL) + pDispatcher->Execute(SID_ATTR_TRANSFORM, SFX_CALLMODE_ASYNCHRON); + } +} + + + +void PosSizePropertyPanel::Initialize() +{ + mpFtPosX->SetBackground(Wallpaper()); + mpFtPosY->SetBackground(Wallpaper()); + mpFtWidth->SetBackground(Wallpaper()); + mpFtHeight->SetBackground(Wallpaper()); + mpFtAngle->SetBackground(Wallpaper()); + mpFtFlip->SetBackground(Wallpaper()); + + //Position : Horizontal / Vertical + mpMtrPosX->SetModifyHdl( LINK( this, PosSizePropertyPanel, ChangePosXHdl ) ); + mpMtrPosY->SetModifyHdl( LINK( this, PosSizePropertyPanel, ChangePosYHdl ) ); + mpMtrPosX->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Horizontal"))); //wj acc + mpMtrPosY->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Vertical"))); //wj acc + + //Size : Width / Height + mpMtrWidth->SetModifyHdl( LINK( this, PosSizePropertyPanel, ChangeWidthHdl ) ); + mpMtrHeight->SetModifyHdl( LINK( this, PosSizePropertyPanel, ChangeHeightHdl ) ); + mpMtrWidth->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width"))); //wj acc + mpMtrHeight->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Height"))); //wj acc + + //Size : Keep ratio + mpCbxScale->SetClickHdl( LINK( this, PosSizePropertyPanel, ClickAutoHdl ) ); + + //rotation: + mpMtrAngle->SetModifyHdl(LINK( this, PosSizePropertyPanel, AngleModifiedHdl)); + mpMtrAngle->EnableAutocomplete( false ); + mpMtrAngle->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Rotation"))); //wj acc + + //rotation control + mpDial->SetModifyHdl(LINK( this, PosSizePropertyPanel, RotationHdl)); + + //flip: + mpFlipTbx->SetSelectHdl( LINK( this, PosSizePropertyPanel, FlipHdl) ); + mpFlipTbx->SetItemImage(FLIP_HORIZONTAL,maImgFlipHori); + mpFlipTbx->SetItemImage(FLIP_VERTICAL,maImgFlipVert); + mpFlipTbx->SetQuickHelpText(FLIP_HORIZONTAL,String(SVX_RES(STR_QH_HORI_FLIP))); //Add + mpFlipTbx->SetQuickHelpText(FLIP_VERTICAL,String(SVX_RES(STR_QH_VERT_FLIP))); //Add + + mpMtrPosX->SetAccessibleRelationLabeledBy(mpFtPosX.get()); + mpMtrPosY->SetAccessibleRelationLabeledBy(mpFtPosY.get()); + mpMtrWidth->SetAccessibleRelationLabeledBy(mpFtWidth.get()); + mpMtrHeight->SetAccessibleRelationLabeledBy(mpFtHeight.get()); + mpMtrAngle->SetAccessibleRelationLabeledBy(mpFtAngle.get()); +#ifdef HAS_IA2 + mpMtrAngle->SetMpSubEditAccLableBy(mpFtAngle.get()); +#endif + mpFlipTbx->SetAccessibleRelationLabeledBy(mpFtFlip.get()); + + mpMtrAngle->InsertValue(0, FUNIT_CUSTOM); + mpMtrAngle->InsertValue(4500, FUNIT_CUSTOM); + mpMtrAngle->InsertValue(9000, FUNIT_CUSTOM); + mpMtrAngle->InsertValue(13500, FUNIT_CUSTOM); + mpMtrAngle->InsertValue(18000, FUNIT_CUSTOM); + mpMtrAngle->InsertValue(22500, FUNIT_CUSTOM); + mpMtrAngle->InsertValue(27000, FUNIT_CUSTOM); + mpMtrAngle->InsertValue(31500, FUNIT_CUSTOM); + mpMtrAngle->SetDropDownLineCount(mpMtrAngle->GetEntryCount()); + + SfxViewShell* pCurSh = SfxViewShell::Current(); + if ( pCurSh ) + mpView = pCurSh->GetDrawView(); + else + mpView = NULL; + + if ( mpView != NULL ) + { + maUIScale = mpView->GetModel()->GetUIScale(); + + const SdrMarkList& rMarkList = mpView->GetMarkedObjectList(); + if(1 == rMarkList.GetMarkCount()) + { + const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); + const SdrObjKind eKind((SdrObjKind)pObj->GetObjIdentifier()); + + if((pObj->GetObjInventor() == SdrInventor) && (OBJ_TEXT == eKind || OBJ_TITLETEXT == eKind || OBJ_OUTLINETEXT == eKind) && ((SdrTextObj*)pObj)->HasText()) + { + mbAdjustEnabled = true; + } + } + } + + mePoolUnit = maTransfWidthControl.GetCoreMetric(); + meDlgUnit = GetModuleFieldUnit(); + SetFieldUnit( *mpMtrPosX, meDlgUnit, true ); + SetFieldUnit( *mpMtrPosY, meDlgUnit, true ); + SetFieldUnit( *mpMtrWidth, meDlgUnit, true ); + SetFieldUnit( *mpMtrHeight, meDlgUnit, true ); +} + + + +void PosSizePropertyPanel::SetupIcons(void) +{ + if(Theme::GetBoolean(Theme::Bool_UseSymphonyIcons)) + { + // todo + } + else + { + // todo + } +} + + + +PosSizePropertyPanel* PosSizePropertyPanel::Create ( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings, + const cssu::Reference<css::ui::XSidebar>& rxSidebar) +{ + if (pParent == NULL) + throw lang::IllegalArgumentException(A2S("no parent Window given to PosSizePropertyPanel::Create"), NULL, 0); + if ( ! rxFrame.is()) + throw lang::IllegalArgumentException(A2S("no XFrame given to PosSizePropertyPanel::Create"), NULL, 1); + if (pBindings == NULL) + throw lang::IllegalArgumentException(A2S("no SfxBindings given to PosSizePropertyPanel::Create"), NULL, 2); + + return new PosSizePropertyPanel( + pParent, + rxFrame, + pBindings, + rxSidebar); +} + + + +void PosSizePropertyPanel::DataChanged( + const DataChangedEvent& rEvent) +{ + (void)rEvent; + + SetupIcons(); +} + + + +void PosSizePropertyPanel::HandleContextChange( + const ::sfx2::sidebar::EnumContext aContext) +{ + if(maContext == aContext) + { + // Nothing to do. + return; + } + + maContext = aContext; + + sal_Int32 nLayoutMode (0); + switch (maContext.GetCombinedContext_DI()) + { + case CombinedEnumContext(Application_WriterAndWeb, Context_Draw): + nLayoutMode = 0; + break; + + case CombinedEnumContext(Application_WriterAndWeb, Context_Graphic): + case CombinedEnumContext(Application_WriterAndWeb, Context_Media): + case CombinedEnumContext(Application_WriterAndWeb, Context_Frame): + case CombinedEnumContext(Application_WriterAndWeb, Context_OLE): + case CombinedEnumContext(Application_WriterAndWeb, Context_Form): + nLayoutMode = 1; + break; + + case CombinedEnumContext(Application_Calc, Context_Draw): + case CombinedEnumContext(Application_Calc, Context_Graphic): + case CombinedEnumContext(Application_DrawImpress, Context_Draw): + case CombinedEnumContext(Application_DrawImpress, Context_TextObject): + case CombinedEnumContext(Application_DrawImpress, Context_Graphic): + nLayoutMode = 2; + break; + + case CombinedEnumContext(Application_Calc, Context_Chart): + case CombinedEnumContext(Application_Calc, Context_Form): + case CombinedEnumContext(Application_Calc, Context_Media): + case CombinedEnumContext(Application_Calc, Context_OLE): + case CombinedEnumContext(Application_Calc, Context_MultiObject): + case CombinedEnumContext(Application_DrawImpress, Context_Media): + case CombinedEnumContext(Application_DrawImpress, Context_Form): + case CombinedEnumContext(Application_DrawImpress, Context_OLE): + case CombinedEnumContext(Application_DrawImpress, Context_3DObject): + case CombinedEnumContext(Application_DrawImpress, Context_MultiObject): + nLayoutMode = 3; + break; + } + switch (nLayoutMode) + { + case 0: + { + mpMtrWidth->SetMin( 2 ); + mpMtrHeight->SetMin( 2 ); + mpFtPosX->Hide(); + mpMtrPosX->Hide(); + mpFtPosY->Hide(); + mpMtrPosY->Hide(); + + //rotation + mpFtAngle->Show(); + mpMtrAngle->Show(); + mpDial->Show(); + + //flip + mpFtFlip->Show(); + mpFlipTbx->Show(); + Size aTbxSize = mpFlipTbx->CalcWindowSizePixel(); + mpFlipTbx->SetOutputSizePixel( aTbxSize ); + mbIsFlip = true; + + mpFtWidth->SetPosPixel(Point(LogicToPixel(Point(FT_POSITION_X_X,FT_POSITION_X_Y), MAP_APPFONT))); + mpMtrWidth->SetPosPixel(Point(LogicToPixel(Point(MF_POSITION_X_X,MF_POSITION_X_Y), MAP_APPFONT))); + mpFtHeight->SetPosPixel(Point(LogicToPixel(Point(FT_POSITION_Y_X,FT_POSITION_Y_Y), MAP_APPFONT))); + mpMtrHeight->SetPosPixel(Point(LogicToPixel(Point(MF_POSITION_Y_X,MF_POSITION_Y_Y), MAP_APPFONT))); + mpCbxScale->SetPosPixel(Point(LogicToPixel(Point(FT_WIDTH_X,FT_WIDTH_Y), MAP_APPFONT))); + + mpFtAngle->SetPosPixel(Point(LogicToPixel(Point(FT_ANGLE_X,FT_ANGLE_Y), MAP_APPFONT))); + mpMtrAngle->SetPosPixel(Point(LogicToPixel(Point(MF_ANGLE_X2,MF_ANGLE_Y2), MAP_APPFONT))); + mpFlipTbx->SetPosPixel(Point(LogicToPixel(Point(FLIP_HORI_X2,FLIP_HORI_Y2), MAP_APPFONT))); + mpDial->SetPosPixel(Point(LogicToPixel(Point(ROTATE_CONTROL_X2,ROTATE_CONTROL_Y2), MAP_APPFONT))); + mpFtFlip->SetPosPixel(Point(LogicToPixel(Point(FT_FLIP_X2,FT_FLIP_Y2), MAP_APPFONT))); + + Size aSize(GetOutputSizePixel().Width(),PS_SECTIONPAGE_HEIGHT2); + aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) ); + SetSizePixel(aSize); + if (mxSidebar.is()) + mxSidebar->requestLayout(); + } + break; + + case 1: + { + mpMtrWidth->SetMin( 2 ); + mpMtrHeight->SetMin( 2 ); + mpFtPosX->Hide(); + mpMtrPosX->Hide(); + mpFtPosY->Hide(); + mpMtrPosY->Hide(); + + //rotation + mpFtAngle->Hide(); + mpMtrAngle->Hide(); + mpDial->Hide(); + + //flip + mpFlipTbx->Hide(); + mpFtFlip->Hide(); + mbIsFlip = false; + + mpFtWidth->SetPosPixel(Point(LogicToPixel(Point(FT_POSITION_X_X,FT_POSITION_X_Y), MAP_APPFONT))); + mpMtrWidth->SetPosPixel(Point(LogicToPixel(Point(MF_POSITION_X_X,MF_POSITION_X_Y), MAP_APPFONT))); + mpFtHeight->SetPosPixel(Point(LogicToPixel(Point(FT_POSITION_Y_X,FT_POSITION_Y_Y), MAP_APPFONT))); + mpMtrHeight->SetPosPixel(Point(LogicToPixel(Point(MF_POSITION_Y_X,MF_POSITION_Y_Y), MAP_APPFONT))); + mpCbxScale->SetPosPixel(Point(LogicToPixel(Point(FT_WIDTH_X,FT_WIDTH_Y), MAP_APPFONT))); + + Size aSize(GetOutputSizePixel().Width(),PS_SECTIONPAGE_HEIGHT3); + aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) ); + SetSizePixel(aSize); + if (mxSidebar.is()) + mxSidebar->requestLayout(); + } + break; + + case 2: + { + mpMtrWidth->SetMin( 1 ); + mpMtrHeight->SetMin( 1 ); + mpFtPosX->Show(); + mpMtrPosX->Show(); + mpFtPosY->Show(); + mpMtrPosY->Show(); + + //rotation + mpFtAngle->Show(); + mpMtrAngle->Show(); + mpDial->Show(); + + //flip + mpFlipTbx->Show(); + mpFtFlip->Show(); + Size aTbxSize = mpFlipTbx->CalcWindowSizePixel(); + mpFlipTbx->SetOutputSizePixel( aTbxSize ); + mbIsFlip = true; + + Size aSize(GetOutputSizePixel().Width(),PS_SECTIONPAGE_HEIGHT); + aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) ); + SetSizePixel(aSize); + if (mxSidebar.is()) + mxSidebar->requestLayout(); + } + break; + + case 3: + { + mpMtrWidth->SetMin( 1 ); + mpMtrHeight->SetMin( 1 ); + mpFtPosX->Show(); + mpMtrPosX->Show(); + mpFtPosY->Show(); + mpMtrPosY->Show(); + + //rotation + mpFtAngle->Hide(); + mpMtrAngle->Hide(); + mpDial->Hide(); + + //flip + mpFlipTbx->Hide(); + mpFtFlip->Hide(); + mbIsFlip = false; + + Size aSize(GetOutputSizePixel().Width(),PS_SECTIONPAGE_HEIGHT4); + aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) ); + SetSizePixel(aSize); + if (mxSidebar.is()) + mxSidebar->requestLayout(); + } + break; + } + + //Added for windows classic theme + mpFlipTbx->SetBackground(Wallpaper()); + mpFlipTbx->SetPaintTransparent(true); +} + + + +IMPL_LINK( PosSizePropertyPanel, ChangeWidthHdl, void*, /*pBox*/ ) +{ + if( mpCbxScale->IsChecked() && + mpCbxScale->IsEnabled() ) + { + long nHeight = (long) ( ((double) mlOldHeight * (double) mpMtrWidth->GetValue()) / (double) mlOldWidth ); + if( nHeight <= mpMtrHeight->GetMax( FUNIT_NONE ) ) + { + mpMtrHeight->SetUserValue( nHeight, FUNIT_NONE ); + } + else + { + nHeight = (long)mpMtrHeight->GetMax( FUNIT_NONE ); + mpMtrHeight->SetUserValue( nHeight ); + const long nWidth = (long) ( ((double) mlOldWidth * (double) nHeight) / (double) mlOldHeight ); + mpMtrWidth->SetUserValue( nWidth, FUNIT_NONE ); + } + } + executeSize(); + return 0; +} + + + +IMPL_LINK( PosSizePropertyPanel, ChangeHeightHdl, void *, EMPTYARG ) +{ + if( mpCbxScale->IsChecked() && + mpCbxScale->IsEnabled() ) + { + long nWidth = (long) ( ((double)mlOldWidth * (double)mpMtrHeight->GetValue()) / (double)mlOldHeight ); + if( nWidth <= mpMtrWidth->GetMax( FUNIT_NONE ) ) + { + mpMtrWidth->SetUserValue( nWidth, FUNIT_NONE ); + } + else + { + nWidth = (long)mpMtrWidth->GetMax( FUNIT_NONE ); + mpMtrWidth->SetUserValue( nWidth ); + const long nHeight = (long) ( ((double)mlOldHeight * (double)nWidth) / (double)mlOldWidth ); + mpMtrHeight->SetUserValue( nHeight, FUNIT_NONE ); + } + } + executeSize(); + return 0; +} + + + +IMPL_LINK( PosSizePropertyPanel, ChangePosXHdl, void *, EMPTYARG ) +{ + executePosX(); + return 0; +} + + + +IMPL_LINK( PosSizePropertyPanel, ChangePosYHdl, void *, EMPTYARG ) +{ + executePosY(); + return 0; +} + + + +IMPL_LINK( PosSizePropertyPanel, ClickAutoHdl, void *, EMPTYARG ) +{ + if ( mpCbxScale->IsChecked() ) + { + mlOldWidth = std::max( GetCoreValue( *mpMtrWidth, mePoolUnit ), 1L ); + mlOldHeight = std::max( GetCoreValue( *mpMtrHeight, mePoolUnit ), 1L ); + } + + // mpCbxScale must synchronized with that on Position and Size tabpage on Shape Properties dialog + SvtViewOptions aPageOpt( E_TABPAGE, OUString::number( RID_SVXPAGE_POSITION_SIZE ) ); + aPageOpt.SetUserItem( USERITEM_NAME, ::com::sun::star::uno::makeAny( ::rtl::OUString::number( mpCbxScale->IsChecked() ) ) ); + + return 0; +} + + + +IMPL_LINK( PosSizePropertyPanel, AngleModifiedHdl, void *, EMPTYARG ) +{ + OUString sTmp = mpMtrAngle->GetText(); + bool bNegative = 0; + sal_Unicode nChar = sTmp[0]; + + if( nChar == '-' ) + { + bNegative = 1; + nChar = sTmp[1]; + } + + if( (nChar < '0') || (nChar > '9') ) + return 0; + double dTmp = sTmp.toDouble(); + if(bNegative) + { + while(dTmp<0) + dTmp += 360; + } + sal_Int64 nTmp = dTmp*100; + + SfxInt32Item aAngleItem( SID_ATTR_TRANSFORM_ANGLE,(sal_uInt32) nTmp); + SfxInt32Item aRotXItem( SID_ATTR_TRANSFORM_ROT_X,(sal_uInt32) mlRotX); + SfxInt32Item aRotYItem( SID_ATTR_TRANSFORM_ROT_Y,(sal_uInt32) mlRotY); + + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_TRANSFORM, SFX_CALLMODE_RECORD, &aAngleItem, &aRotXItem, &aRotYItem, 0L ); + + return 0; +} + + + +IMPL_LINK( PosSizePropertyPanel, RotationHdl, void *, EMPTYARG ) +{ + sal_Int32 nTmp = mpDial->GetRotation(); + + SfxInt32Item aAngleItem( SID_ATTR_TRANSFORM_ANGLE,(sal_uInt32) nTmp); + SfxInt32Item aRotXItem( SID_ATTR_TRANSFORM_ROT_X,(sal_uInt32) mlRotX); + SfxInt32Item aRotYItem( SID_ATTR_TRANSFORM_ROT_Y,(sal_uInt32) mlRotY); + + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_TRANSFORM, SFX_CALLMODE_RECORD, &aAngleItem, &aRotXItem, &aRotYItem, 0L ); + + return 0; +} + + + +IMPL_LINK( PosSizePropertyPanel, FlipHdl, ToolBox*, pBox ) +{ + switch (pBox->GetCurItemId()) + { + case FLIP_HORIZONTAL: + { + SfxVoidItem aHoriItem (SID_FLIP_HORIZONTAL); + GetBindings()->GetDispatcher()->Execute( + SID_FLIP_HORIZONTAL, SFX_CALLMODE_RECORD, &aHoriItem, 0L ); + } + break; + case FLIP_VERTICAL: + { + SfxVoidItem aVertItem (SID_FLIP_VERTICAL ); + GetBindings()->GetDispatcher()->Execute( + SID_FLIP_VERTICAL, SFX_CALLMODE_RECORD, &aVertItem, 0L ); + } + break; + } + return 0; +} + + + +void PosSizePropertyPanel::NotifyItemUpdate( + sal_uInt16 nSID, + SfxItemState eState, + const SfxPoolItem* pState) +{ + mpFtAngle->Enable(); + mpMtrAngle->Enable(); + mpDial->Enable(); + mpFtFlip->Enable(); + mpFlipTbx->Enable(); + + const SfxUInt32Item* pWidthItem; + const SfxUInt32Item* pHeightItem; + + SfxViewShell* pCurSh = SfxViewShell::Current(); + if ( pCurSh ) + mpView = pCurSh->GetDrawView(); + else + mpView = NULL; + + if ( mpView == NULL ) + return; + + const SdrMarkList& rMarkList = mpView->GetMarkedObjectList(); + + if(1 == rMarkList.GetMarkCount()) + { + const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); + const SdrObjKind eKind((SdrObjKind)pObj->GetObjIdentifier()); + + if((pObj->GetObjInventor() == SdrInventor) && (OBJ_TEXT == eKind || OBJ_TITLETEXT == eKind || OBJ_OUTLINETEXT == eKind) && ((SdrTextObj*)pObj)->HasText()) + mbAdjustEnabled = true; + else + mbAdjustEnabled = false; + } + else + mbAdjustEnabled = false; + + switch (nSID) + { + case SID_ATTR_TRANSFORM_WIDTH: + if ( SFX_ITEM_AVAILABLE == eState ) + { + pWidthItem = dynamic_cast< const SfxUInt32Item* >(pState); + + if(pWidthItem) + { + long mlOldWidth1 = pWidthItem->GetValue(); + + mlOldWidth1 = Fraction( mlOldWidth1 ) / maUIScale; + SetMetricValue( *mpMtrWidth, mlOldWidth1, mePoolUnit ); + mlOldWidth = mlOldWidth1; + break; + } + } + + mpMtrWidth->SetText( String()); + break; + + case SID_ATTR_TRANSFORM_HEIGHT: + if ( SFX_ITEM_AVAILABLE == eState ) + { + pHeightItem = dynamic_cast< const SfxUInt32Item* >(pState); + + if(pHeightItem) + { + long mlOldHeight1 = pHeightItem->GetValue(); + + mlOldHeight1 = Fraction( mlOldHeight1 ) / maUIScale; + SetMetricValue( *mpMtrHeight, mlOldHeight1, mePoolUnit ); + mlOldHeight = mlOldHeight1; + break; + } + } + + mpMtrHeight->SetText( String()); + break; + + case SID_ATTR_TRANSFORM_POS_X: + if(SFX_ITEM_AVAILABLE == eState) + { + const SfxInt32Item* pItem = dynamic_cast< const SfxInt32Item* >(pState); + + if(pItem) + { + long nTmp = pItem->GetValue(); + nTmp = Fraction( nTmp ) / maUIScale; + SetMetricValue( *mpMtrPosX, nTmp, mePoolUnit ); + break; + } + } + + mpMtrPosX->SetText( String()); + break; + + case SID_ATTR_TRANSFORM_POS_Y: + if(SFX_ITEM_AVAILABLE == eState) + { + const SfxInt32Item* pItem = dynamic_cast< const SfxInt32Item* >(pState); + + if(pItem) + { + long nTmp = pItem->GetValue(); + nTmp = Fraction( nTmp ) / maUIScale; + SetMetricValue( *mpMtrPosY, nTmp, mePoolUnit ); + break; + } + } + + mpMtrPosY->SetText( String()); + break; + + case SID_ATTR_TRANSFORM_ROT_X: + if (SFX_ITEM_AVAILABLE == eState) + { + const SfxInt32Item* pItem = dynamic_cast< const SfxInt32Item* >(pState); + + if(pItem) + { + mlRotX = pItem->GetValue(); + mlRotX = Fraction( mlRotX ) / maUIScale; + } + } + break; + + case SID_ATTR_TRANSFORM_ROT_Y: + if (SFX_ITEM_AVAILABLE == eState) + { + const SfxInt32Item* pItem = dynamic_cast< const SfxInt32Item* >(pState); + + if(pItem) + { + mlRotY = pItem->GetValue(); + mlRotY = Fraction( mlRotY ) / maUIScale; + } + } + break; + + case SID_ATTR_TRANSFORM_PROTECT_POS: + if(SFX_ITEM_AVAILABLE == eState) + { + const SfxBoolItem* pItem = dynamic_cast< const SfxBoolItem* >(pState); + + if(pItem) + { + // record the state of position protect + mbPositionProtected = pItem->GetValue(); + break; + } + } + + mbPositionProtected = false; + break; + + case SID_ATTR_TRANSFORM_PROTECT_SIZE: + if(SFX_ITEM_AVAILABLE == eState) + { + const SfxBoolItem* pItem = dynamic_cast< const SfxBoolItem* >(pState); + + if(pItem) + { + // record the state of size protect + mbSizeProtected = pItem->GetValue(); + break; + } + } + + mbSizeProtected = false; + break; + + case SID_ATTR_TRANSFORM_AUTOWIDTH: + if(SFX_ITEM_AVAILABLE == eState) + { + const SfxBoolItem* pItem = dynamic_cast< const SfxBoolItem* >(pState); + + if(pItem) + { + mbAutoWidth = pItem->GetValue(); + } + } + break; + + case SID_ATTR_TRANSFORM_AUTOHEIGHT: + if(SFX_ITEM_AVAILABLE == eState) + { + const SfxBoolItem* pItem = dynamic_cast< const SfxBoolItem* >(pState); + + if(pItem) + { + mbAutoHeight = pItem->GetValue(); + } + } + break; + + case SID_ATTR_TRANSFORM_ANGLE: + if (eState >= SFX_ITEM_AVAILABLE) + { + const SfxInt32Item* pItem = dynamic_cast< const SfxInt32Item* >(pState); + + if(pItem) + { + long nTmp = pItem->GetValue(); + + mpMtrAngle->SetValue( nTmp ); + mpDial->SetRotation( nTmp ); + + switch(nTmp) + { + case 0: + mpMtrAngle->SelectEntryPos(0); + break; + case 4500: + mpMtrAngle->SelectEntryPos(1); + break; + case 9000: + mpMtrAngle->SelectEntryPos(2); + break; + case 13500: + mpMtrAngle->SelectEntryPos(3); + break; + case 18000: + mpMtrAngle->SelectEntryPos(4); + break; + case 22500: + mpMtrAngle->SelectEntryPos(5); + break; + case 27000: + mpMtrAngle->SelectEntryPos(6); + break; + case 315000: + mpMtrAngle->SelectEntryPos(7); + } + + break; + } + } + + mpMtrAngle->SetText( String() ); + mpDial->SetRotation( 0 ); + break; + + case SID_ATTR_METRIC: + MetricState( eState, pState ); + break; + + default: + break; + } + + const sal_Int32 nCombinedContext(maContext.GetCombinedContext_DI()); + + switch (rMarkList.GetMarkCount()) + { + case 0: + break; + + case 1: + { + const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); + const SdrObjKind eKind((SdrObjKind)pObj->GetObjIdentifier()); + + if(((nCombinedContext == CombinedEnumContext(Application_DrawImpress, Context_Draw) + || nCombinedContext == CombinedEnumContext(Application_DrawImpress, Context_TextObject) + ) && OBJ_EDGE == eKind) + || OBJ_CAPTION == eKind) + { + mpFtAngle->Disable(); + mpMtrAngle->Disable(); + mpDial->Disable(); + mpFlipTbx->Disable(); + mpFtFlip->Disable(); + } + break; + } + + default: + { + sal_uInt16 nMarkObj = 0; + bool isNoEdge = true; + while(rMarkList.GetMark(nMarkObj)) + { + const SdrObject* pObj = rMarkList.GetMark(nMarkObj)->GetMarkedSdrObj(); + const SdrObjKind eKind((SdrObjKind)pObj->GetObjIdentifier()); + + if(((nCombinedContext == CombinedEnumContext(Application_DrawImpress, Context_Draw) + || nCombinedContext == CombinedEnumContext(Application_DrawImpress, Context_TextObject) + ) && OBJ_EDGE == eKind) + || OBJ_CAPTION == eKind) + { + isNoEdge = false; + break; + } + nMarkObj++; + } + if(!isNoEdge) + { + mpFtAngle->Disable(); + mpMtrAngle->Disable(); + mpDial->Disable(); + mpFlipTbx->Disable(); + mpFtFlip->Disable(); + } + break; + } + } + + if(nCombinedContext == CombinedEnumContext(Application_DrawImpress, Context_TextObject)) + { + mpFlipTbx->Disable(); + mpFtFlip->Disable(); + } + + DisableControls(); + + // mpCbxScale must synchronized with that on Position and Size tabpage on Shape Properties dialog + SvtViewOptions aPageOpt( E_TABPAGE, OUString::number( RID_SVXPAGE_POSITION_SIZE ) ); + String sUserData; + ::com::sun::star::uno::Any aUserItem = aPageOpt.GetUserItem( USERITEM_NAME ); + ::rtl::OUString aTemp; + if ( aUserItem >>= aTemp ) + sUserData = String( aTemp ); + mpCbxScale->Check( (bool)sUserData.ToInt32() ); +} + + + +SfxBindings* PosSizePropertyPanel::GetBindings() +{ + return mpBindings; +} + + + +void PosSizePropertyPanel::executeSize() +{ + if ( mpMtrWidth->IsValueModified() || mpMtrHeight->IsValueModified()) + { + Fraction aUIScale = mpView->GetModel()->GetUIScale(); + + // get Width + double nWidth = (double)mpMtrWidth->GetValue( meDlgUnit ); + nWidth = MetricField::ConvertDoubleValue( nWidth, mpMtrWidth->GetBaseValue(), mpMtrWidth->GetDecimalDigits(), meDlgUnit, FUNIT_100TH_MM ); + long lWidth = (long)(nWidth * (double)aUIScale); + lWidth = OutputDevice::LogicToLogic( lWidth, MAP_100TH_MM, (MapUnit)mePoolUnit ); + lWidth = (long)mpMtrWidth->Denormalize( lWidth ); + + // get Height + double nHeight = (double)mpMtrHeight->GetValue( meDlgUnit ); + nHeight = MetricField::ConvertDoubleValue( nHeight, mpMtrHeight->GetBaseValue(), mpMtrHeight->GetDecimalDigits(), meDlgUnit, FUNIT_100TH_MM ); + long lHeight = (long)(nHeight * (double)aUIScale); + lHeight = OutputDevice::LogicToLogic( lHeight, MAP_100TH_MM, (MapUnit)mePoolUnit ); + lHeight = (long)mpMtrWidth->Denormalize( lHeight ); + + // put Width & Height to itemset + SfxUInt32Item aWidthItem( SID_ATTR_TRANSFORM_WIDTH, (sal_uInt32) lWidth); + SfxUInt32Item aHeightItem( SID_ATTR_TRANSFORM_HEIGHT, (sal_uInt32) lHeight); + SfxAllEnumItem aPointItem (SID_ATTR_TRANSFORM_SIZE_POINT, (sal_uInt16)meRP); + const sal_Int32 nCombinedContext(maContext.GetCombinedContext()); + + if( nCombinedContext == CombinedEnumContext(Application_Writer, Context_Graphic) // mnContextId == PROPERTY_CONTEXT_SW_GRAPHIC + || nCombinedContext == CombinedEnumContext(Application_Writer, Context_OLE) //mnContextId == PROPERTY_CONTEXT_SW_OLE + ) + // if( mnContextId == PROPERTY_CONTEXT_SW_GRAPHIC || mnContextId == PROPERTY_CONTEXT_SW_OLE ) + { + GetBindings()->GetDispatcher()->Execute(SID_ATTR_TRANSFORM, SFX_CALLMODE_RECORD, &aWidthItem, &aHeightItem, &aPointItem, 0L ); + } + else + { + if ( (mpMtrWidth->IsValueModified()) && (mpMtrHeight->IsValueModified())) + GetBindings()->GetDispatcher()->Execute(SID_ATTR_TRANSFORM, SFX_CALLMODE_RECORD, &aWidthItem, &aHeightItem, &aPointItem, 0L ); + else if( mpMtrWidth->IsValueModified()) + GetBindings()->GetDispatcher()->Execute(SID_ATTR_TRANSFORM, SFX_CALLMODE_RECORD, &aWidthItem, &aPointItem, 0L ); + else if ( mpMtrHeight->IsValueModified()) + GetBindings()->GetDispatcher()->Execute(SID_ATTR_TRANSFORM, SFX_CALLMODE_RECORD, &aHeightItem, &aPointItem, 0L ); + } + } +} + + + +void PosSizePropertyPanel::executePosX() +{ + if ( mpMtrPosX->IsValueModified()) + { + long lX = GetCoreValue( *mpMtrPosX, mePoolUnit ); + if( mbMtrPosXMirror ) + lX = -lX; + long lY = GetCoreValue( *mpMtrPosY, mePoolUnit ); + + Size aPageSize; + Rectangle aRect; + maRect = mpView->GetAllMarkedRect(); + aRect = mpView->GetAllMarkedRect(); + + Fraction aUIScale = mpView->GetModel()->GetUIScale(); + lX += maAnchorPos.X(); + lX = Fraction( lX ) * aUIScale; + lY += maAnchorPos.Y(); + lY = Fraction( lY ) * aUIScale; + + SfxInt32Item aPosXItem( SID_ATTR_TRANSFORM_POS_X,(sal_uInt32) lX); + SfxInt32Item aPosYItem( SID_ATTR_TRANSFORM_POS_Y,(sal_uInt32) lY); + + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_TRANSFORM, SFX_CALLMODE_RECORD, &aPosXItem, 0L ); + } +} + + + +void PosSizePropertyPanel::executePosY() +{ + if ( mpMtrPosY->IsValueModified() ) + { + long lX = GetCoreValue( *mpMtrPosX, mePoolUnit ); + long lY = GetCoreValue( *mpMtrPosY, mePoolUnit ); + + Size aPageSize; + Rectangle aRect; + maRect = mpView->GetAllMarkedRect(); + aRect = mpView->GetAllMarkedRect(); + + Fraction aUIScale = mpView->GetModel()->GetUIScale(); + lX += maAnchorPos.X(); + lX = Fraction( lX ) * aUIScale; + lY += maAnchorPos.Y(); + lY = Fraction( lY ) * aUIScale; + + SfxInt32Item aPosXItem( SID_ATTR_TRANSFORM_POS_X,(sal_uInt32) lX); + SfxInt32Item aPosYItem( SID_ATTR_TRANSFORM_POS_Y,(sal_uInt32) lY); + + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_TRANSFORM, SFX_CALLMODE_RECORD, &aPosYItem, 0L ); + } +} + + + +void PosSizePropertyPanel::MetricState( SfxItemState eState, const SfxPoolItem* pState ) +{ + bool bPosXBlank = false; + bool bPosYBlank = false; + bool bWidthBlank = false; + bool bHeightBlank = false; + meDlgUnit = GetCurrentUnit(eState,pState); + + if (mpMtrPosX->GetText().isEmpty()) + bPosXBlank = true; + SetFieldUnit( *mpMtrPosX, meDlgUnit, true ); + if(bPosXBlank) + mpMtrPosX->SetText(String()); + + if (mpMtrPosY->GetText().isEmpty()) + bPosYBlank = true; + SetFieldUnit( *mpMtrPosY, meDlgUnit, true ); + if(bPosYBlank) + mpMtrPosY->SetText(String()); + + if (mpMtrWidth->GetText().isEmpty()) + bWidthBlank = true; + SetFieldUnit( *mpMtrWidth, meDlgUnit, true ); + if(bWidthBlank) + mpMtrWidth->SetText(String()); + + if (mpMtrHeight->GetText().isEmpty()) + bHeightBlank = true; + SetFieldUnit( *mpMtrHeight, meDlgUnit, true ); + if(bHeightBlank) + mpMtrHeight->SetText(String()); +} + + + +FieldUnit PosSizePropertyPanel::GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState ) +{ + FieldUnit eUnit = FUNIT_NONE; + + if ( pState && eState >= SFX_ITEM_DEFAULT ) + { + eUnit = (FieldUnit)( (const SfxUInt16Item*)pState )->GetValue(); + } + else + { + SfxViewFrame* pFrame = SfxViewFrame::Current(); + SfxObjectShell* pSh = NULL; + if ( pFrame ) + pSh = pFrame->GetObjectShell(); + if ( pSh ) + { + SfxModule* pModule = pSh->GetModule(); + if ( pModule ) + { + const SfxPoolItem* pItem = pModule->GetItem( SID_ATTR_METRIC ); + if ( pItem ) + eUnit = (FieldUnit)( (SfxUInt16Item*)pItem )->GetValue(); + } + else + { + DBG_ERRORFILE( "GetModuleFieldUnit(): no module found" ); + } + } + } + + return eUnit; +} + + + +void PosSizePropertyPanel::DisableControls() +{ + if( mbPositionProtected ) + { + // the position is protected("Position protect" option in modal dialog is checked), + // disable all the Position controls in sidebar + mpFtPosX->Disable(); + mpMtrPosX->Disable(); + mpFtPosY->Disable(); + mpMtrPosY->Disable(); + mpFtAngle->Disable(); + mpMtrAngle->Disable(); + mpDial->Disable(); + mpFtFlip->Disable(); + mpFlipTbx->Disable(); + + mpFtWidth->Disable(); + mpMtrWidth->Disable(); + mpFtHeight->Disable(); + mpMtrHeight->Disable(); + mpCbxScale->Disable(); + } + else + { + mpFtPosX->Enable(); + mpMtrPosX->Enable(); + mpFtPosY->Enable(); + mpMtrPosY->Enable(); + + //mpFtAngle->Enable(); + //mpMtrAngle->Enable(); + //mpDial->Enable(); + //mpFtFlip->Enable(); + //mpFlipTbx->Enable(); + + if( mbSizeProtected ) + { + mpFtWidth->Disable(); + mpMtrWidth->Disable(); + mpFtHeight->Disable(); + mpMtrHeight->Disable(); + mpCbxScale->Disable(); + } + else + { + if( mbAdjustEnabled ) + { + if( mbAutoWidth ) + { + mpFtWidth->Disable(); + mpMtrWidth->Disable(); + mpCbxScale->Disable(); + } + else + { + mpFtWidth->Enable(); + mpMtrWidth->Enable(); + } + if( mbAutoHeight ) + { + mpFtHeight->Disable(); + mpMtrHeight->Disable(); + mpCbxScale->Disable(); + } + else + { + mpFtHeight->Enable(); + mpMtrHeight->Enable(); + } + if( !mbAutoWidth && !mbAutoHeight ) + mpCbxScale->Enable(); + } + else + { + mpFtWidth->Enable(); + mpMtrWidth->Enable(); + mpFtHeight->Enable(); + mpMtrHeight->Enable(); + mpCbxScale->Enable(); + } + } + } +} + + +} } // end of namespace svx::sidebar + +// eof diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.hrc b/svx/source/sidebar/possize/PosSizePropertyPanel.hrc new file mode 100644 index 000000000000..8a4cabad21a3 --- /dev/null +++ b/svx/source/sidebar/possize/PosSizePropertyPanel.hrc @@ -0,0 +1,104 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +// RID_SIDEBAR_POSSIZE_PANEL-------------------------------------------------------------- +#define FT_WIDTH 1 +#define MTR_FLD_WIDTH 2 +#define FT_HEIGHT 3 +#define MTR_FLD_HEIGHT 4 +#define CBX_SCALE 5 +#define FT_SBSHAPE_HORIZONTAL 7 +#define MF_SBSHAPE_HORIZONTAL 8 +#define FT_SBSHAPE_VERTICAL 9 +#define MF_SBSHAPE_VERTICAL 10 +#define FT_SBSHAPE_POSREFERENCE 11 +#define CTL_SBSHAPE_POSREFERENCE 12 +#define FT_ANGLE 13 +#define MTR_FLD_ANGLE 14 +#define TBX_FLIP 15 +#define DIAL_CONTROL 17 +#define FLIP_HORIZONTAL 18 +#define FLIP_VERTICAL 19 +#define IMG_HORI_FLIP 20 +#define IMG_VERT_FLIP 21 +#define FT_FLIP 22 +#define STR_QH_HORI_FLIP 23 +#define STR_QH_VERT_FLIP 24 + +#define MBOX_WIDTH 50 +#define TEXT_WIDTH 40 +#define FLIP_BUTTON_SIZE 13 +#define ALIGNMENT_TBX_HEIGHT 17 +#define ALIGNMENT_TBX_WIDTH 13 + +#define FT_POSITION_X_X SECTIONPAGE_MARGIN_HORIZONTAL +#define FT_POSITION_X_Y SECTIONPAGE_MARGIN_VERTICAL_TOP +#define MF_POSITION_X_X FT_POSITION_X_X +#define MF_POSITION_X_Y FT_POSITION_X_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL +#define FT_POSITION_Y_X FT_POSITION_X_X + MBOX_WIDTH + CONTROL_SPACING_HORIZONTAL +#define FT_POSITION_Y_Y FT_POSITION_X_Y +#define MF_POSITION_Y_X FT_POSITION_Y_X +#define MF_POSITION_Y_Y MF_POSITION_X_Y + +#define FT_WIDTH_X SECTIONPAGE_MARGIN_HORIZONTAL +#define FT_WIDTH_Y MF_POSITION_X_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL +#define FLD_WIDTH_X FT_WIDTH_X +#define FLD_WIDTH_Y FT_WIDTH_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL +#define FT_HEIGHT_X FT_WIDTH_X + MBOX_WIDTH + CONTROL_SPACING_HORIZONTAL +#define FT_HEIGHT_Y FT_WIDTH_Y +#define FLD_HEIGHT_X FT_HEIGHT_X +#define FLD_HEIGHT_Y FLD_WIDTH_Y +#define CBX_X FT_WIDTH_X +#define CBX_Y FLD_WIDTH_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL +///////////////////// +#define FT_ROTATION_X FT_WIDTH_X +#define FT_ROTATION_Y CBX_Y + CONTROL_SPACING_VERTICAL + TEXT_HEIGHT + +#define MF_ROTATION_X FT_ROTATION_X + 40 + CONTROL_SPACING_HORIZONTAL +#define MF_ROTATION_Y FT_ROTATION_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + +#define ROTATE_CONTROL_X FT_ROTATION_X +#define ROTATE_CONTROL_Y MF_ROTATION_Y + 4 + +#define FT_FLIP_X MF_ROTATION_X +#define FT_FLIP_Y MF_ROTATION_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL + 5 + +#define BTN_FLIP_HORI_X PROPERTYPAGE_WIDTH - SECTIONPAGE_MARGIN_HORIZONTAL - TOOLBOX_ITEM_WIDTH * 2 - 1 // wj for 7926 +#define BTN_FLIP_HORI_Y FT_FLIP_Y - 5 +//////////////////////////////// + +#define FT_ANGLE_X FLD_WIDTH_X +#define FT_ANGLE_Y FLD_WIDTH_Y + 4 + +#define MF_ANGLE_X2 MF_ROTATION_X +#define MF_ANGLE_Y2 FT_ANGLE_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + +#define ROTATE_CONTROL_X2 FT_ANGLE_X +#define ROTATE_CONTROL_Y2 MF_ANGLE_Y2 + 4 + +#define FT_FLIP_X2 MF_ANGLE_X2 +#define FT_FLIP_Y2 MF_ANGLE_Y2 + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL + 5 + +#define FLIP_HORI_X2 PROPERTYPAGE_WIDTH - SECTIONPAGE_MARGIN_HORIZONTAL - TOOLBOX_ITEM_WIDTH * 2 //FT_FLIP_X2 + 22 +#define FLIP_HORI_Y2 FT_FLIP_Y2 - 5 + +#define PS_SECTIONPAGE_HEIGHT BTN_FLIP_HORI_Y + ALIGNMENT_TBX_HEIGHT + SECTIONPAGE_MARGIN_VERTICAL_BOT + 2 +#define PS_SECTIONPAGE_HEIGHT2 FLIP_HORI_Y2 + ALIGNMENT_TBX_HEIGHT + SECTIONPAGE_MARGIN_VERTICAL_BOT + 2 +#define PS_SECTIONPAGE_HEIGHT3 FT_WIDTH_Y + TEXT_HEIGHT + SECTIONPAGE_MARGIN_VERTICAL_BOT +#define PS_SECTIONPAGE_HEIGHT4 CBX_Y + CBOX_HEIGHT + SECTIONPAGE_MARGIN_VERTICAL_BOT + +// eof diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.hxx b/svx/source/sidebar/possize/PosSizePropertyPanel.hxx new file mode 100644 index 000000000000..bbdff17e41c3 --- /dev/null +++ b/svx/source/sidebar/possize/PosSizePropertyPanel.hxx @@ -0,0 +1,178 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SVX_PROPERTYPANEL_POSIZEPAGE_HXX +#define SVX_PROPERTYPANEL_POSIZEPAGE_HXX + +#include <vcl/ctrl.hxx> +#include <sfx2/sidebar/SidebarPanelBase.hxx> +#include <sfx2/sidebar/ControllerItem.hxx> +#include <sfx2/sidebar/IContextChangeReceiver.hxx> +#include <boost/scoped_ptr.hpp> +#include <svx/rectenum.hxx> +#include <svl/poolitem.hxx> +#include <tools/fldunit.hxx> +#include <com/sun/star/ui/XSidebar.hpp> + +class DialControl; +class SdrView; +class FixedText; +class MetricField; +class CheckBox; +class MetricBox; + + +namespace svx { namespace sidebar { + +class SidebarDialControl; + +class PosSizePropertyPanel +: public Control, + public ::sfx2::sidebar::IContextChangeReceiver, + public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface +{ +public: + static PosSizePropertyPanel* Create( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings, + const cssu::Reference<css::ui::XSidebar>& rxSidebar); + + virtual void DataChanged( + const DataChangedEvent& rEvent); + + virtual void HandleContextChange( + const ::sfx2::sidebar::EnumContext aContext); + + virtual void NotifyItemUpdate( + const sal_uInt16 nSId, + const SfxItemState eState, + const SfxPoolItem* pState); + + SfxBindings* GetBindings(); + void ShowMenu (void); + +private: + //Position + ::boost::scoped_ptr< FixedText > mpFtPosX; + ::boost::scoped_ptr< MetricField > mpMtrPosX; + ::boost::scoped_ptr< FixedText > mpFtPosY; + ::boost::scoped_ptr< MetricField > mpMtrPosY; + + // size + ::boost::scoped_ptr< FixedText > mpFtWidth; + ::boost::scoped_ptr< MetricField > mpMtrWidth; + ::boost::scoped_ptr< FixedText > mpFtHeight; + ::boost::scoped_ptr< MetricField > mpMtrHeight; + ::boost::scoped_ptr< CheckBox > mpCbxScale; + + //rotation + ::boost::scoped_ptr< FixedText > mpFtAngle; + ::boost::scoped_ptr< MetricBox > mpMtrAngle; + + //rotation control + ::boost::scoped_ptr<SidebarDialControl> mpDial; + + //flip + ::boost::scoped_ptr< FixedText > mpFtFlip; + ::boost::scoped_ptr< Window > mpFlipTbxBackground; + ::boost::scoped_ptr< ToolBox > mpFlipTbx; + + // Internal variables + Rectangle maRect; + const SdrView* mpView; + sal_uInt32 mlOldWidth; + sal_uInt32 mlOldHeight; + RECT_POINT meRP; + Point maAnchorPos; //anchor position + long mlRotX; + long mlRotY; + Fraction maUIScale; + SfxMapUnit mePoolUnit; + FieldUnit meDlgUnit; + + // Controller Items + ::sfx2::sidebar::ControllerItem maTransfPosXControl; + ::sfx2::sidebar::ControllerItem maTransfPosYControl; + ::sfx2::sidebar::ControllerItem maTransfWidthControl; + ::sfx2::sidebar::ControllerItem maTransfHeightControl; + + ::sfx2::sidebar::ControllerItem maSvxAngleControl; + ::sfx2::sidebar::ControllerItem maRotXControl; + ::sfx2::sidebar::ControllerItem maRotYControl; + ::sfx2::sidebar::ControllerItem maProPosControl; + ::sfx2::sidebar::ControllerItem maProSizeControl; + ::sfx2::sidebar::ControllerItem maAutoWidthControl; + ::sfx2::sidebar::ControllerItem maAutoHeightControl; + ::sfx2::sidebar::ControllerItem m_aMetricCtl; + + // images from ressource + Image maImgFlipHori; + Image maImgFlipVert; + + cssu::Reference< css::frame::XFrame > mxFrame; + ::sfx2::sidebar::EnumContext maContext; + SfxBindings* mpBindings; + + /// bitfield + bool mbMtrPosXMirror : 1; + bool mbSizeProtected : 1; + bool mbPositionProtected : 1; + bool mbAutoWidth : 1; + bool mbAutoHeight : 1; + bool mbAdjustEnabled : 1; + bool mbIsFlip : 1; + bool mbInDestructor : 1; + + cssu::Reference<css::ui::XSidebar> mxSidebar; + + DECL_LINK( ChangePosXHdl, void * ); + DECL_LINK( ChangePosYHdl, void * ); + DECL_LINK( ChangeWidthHdl, void * ); + DECL_LINK( ChangeHeightHdl, void * ); + DECL_LINK( ClickAutoHdl, void * ); + DECL_LINK( AngleModifiedHdl, void * ); + DECL_LINK( RotationHdl, void * ); + DECL_LINK( FlipHdl, ToolBox * ); + + void SetupIcons(void); + void Initialize(); + void executePosX(); + void executePosY(); + void executeSize(); + + // constructor/destuctor + PosSizePropertyPanel( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings, + const cssu::Reference<css::ui::XSidebar>& rxSidebar); + virtual ~PosSizePropertyPanel(); + + void MetricState( SfxItemState eState, const SfxPoolItem* pState ); + FieldUnit GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState ); + void DisableControls(); +}; + + +} } // end of namespace svx::sidebar + + + +#endif // SVX_PROPERTYPANEL_POSIZEPAGE_HXX + +// eof diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.src b/svx/source/sidebar/possize/PosSizePropertyPanel.src new file mode 100644 index 000000000000..fd5996f51ce9 --- /dev/null +++ b/svx/source/sidebar/possize/PosSizePropertyPanel.src @@ -0,0 +1,223 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "PosSizePropertyPanel.hrc" +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include <svx/dialogs.hrc> +#include "helpid.hrc" + +#define TOOLBOX_HEIGHT 14 + +Control RID_SIDEBAR_POSSIZE_PANEL +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + + Size = MAP_APPFONT( + PROPERTYPAGE_WIDTH, + BTN_FLIP_HORI_Y + TOOLBOX_HEIGHT + SECTIONPAGE_MARGIN_VERTICAL_BOT); + HelpID = HID_PROPERTYPANEL_POSIZE_SECTION ; + Text = "Position and Size"; + + FixedText FT_WIDTH + { + Pos = MAP_APPFONT ( FT_WIDTH_X, FT_WIDTH_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH , TEXT_HEIGHT) ; + Text [ en-US ] = "~Width:"; + }; + MetricField MTR_FLD_WIDTH + { + Border = TRUE ; + Pos = MAP_APPFONT ( FLD_WIDTH_X, FLD_WIDTH_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH, MBOX_HEIGHT ) ; + QuickHelpText [ en-US ] = "Enter a width for the selected object."; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 9999 ; + StrictFormat = TRUE ; + Unit = FUNIT_INCH; + Last = 9999 ; + SpinSize = 2 ; + HelpID = HID_PROPERTY_PANEL_POSIZE_MTR_FLD_WIDTH; + }; + FixedText FT_HEIGHT + { + Pos = MAP_APPFONT ( FT_HEIGHT_X, FT_HEIGHT_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH , TEXT_HEIGHT) ; + Text [ en-US ] = "H~eight:"; + }; + MetricField MTR_FLD_HEIGHT + { + Border = TRUE ; + Pos = MAP_APPFONT ( FLD_HEIGHT_X, FLD_HEIGHT_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH + 1, MBOX_HEIGHT ) ; + QuickHelpText [ en-US ] = "Enter a height for the selected object."; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 9999 ; + StrictFormat = TRUE ; + Unit = FUNIT_INCH; + Last = 9999 ; + SpinSize = 2 ; + HelpID = HID_PROPERTY_PANEL_POSIZE_MTR_FLD_HEIGHT; + }; + CheckBox CBX_SCALE + { + Pos = MAP_APPFONT ( CBX_X , CBX_Y ) ; + Size = MAP_APPFONT ( MBOX_WIDTH + 30 , CBOX_HEIGHT ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Keep ratio" ; + QuickHelpText [ en-US ] = "Maintain proportions when you resize the selected object."; + HelpID = HID_PROPERTY_PANEL_POSIZE_CBX_SCALE; + }; + //------------ Position ------------ + FixedText FT_SBSHAPE_HORIZONTAL + { + Pos = MAP_APPFONT ( FT_POSITION_X_X, FT_POSITION_X_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH , TEXT_HEIGHT) ; + Text [ en-US ] = "~Horizontal:"; + }; + MetricField MF_SBSHAPE_HORIZONTAL + { + Border = TRUE; + Pos = MAP_APPFONT ( MF_POSITION_X_X , MF_POSITION_X_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH, MBOX_HEIGHT ) ; + QuickHelpText [ en-US ] = "Enter the value for the horizontal position."; + TabStop = TRUE; + Repeat = TRUE; + Spin = TRUE; + Minimum = -120000; + Maximum = 240000; + StrictFormat = TRUE; + DecimalDigits = 2; + Unit = FUNIT_MM; + SpinSize = 10; + HelpID = HID_PROPERTY_PANEL_POSIZE_MF_HORIZONTAL; + }; + FixedText FT_SBSHAPE_VERTICAL + { + Pos = MAP_APPFONT ( FT_POSITION_Y_X , FT_POSITION_Y_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH , TEXT_HEIGHT) ; + Text [ en-US ] = "~Vertical:"; + }; + MetricField MF_SBSHAPE_VERTICAL + { + Border = TRUE; + Pos = MAP_APPFONT ( MF_POSITION_Y_X , MF_POSITION_Y_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH, MBOX_HEIGHT ) ; + QuickHelpText [ en-US ] = "Enter the value for the vertical position."; + TabStop = TRUE; + Repeat = TRUE; + Spin = TRUE; + Minimum = -120000; + Maximum = 240000; + StrictFormat = TRUE; + DecimalDigits = 2; + Unit = FUNIT_MM; + SpinSize = 10; + HelpID = HID_PROPERTY_PANEL_POSIZE_MF_VERTICAL; + }; + FixedText FT_ANGLE + { + Pos = MAP_APPFONT ( FT_ROTATION_X , FT_ROTATION_Y ); + Size = MAP_APPFONT ( TEXT_WIDTH + 50, TEXT_HEIGHT) ; + Text [ en-US ] = "~Rotation:"; + }; + + MetricBox MTR_FLD_ANGLE + { + Border = TRUE ; + Pos = MAP_APPFONT ( MF_ROTATION_X , MF_ROTATION_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH + 10, MBOX_HEIGHT ) ; + QuickHelpText [ en-US ] = "Select the angle for rotation."; + Unit = FUNIT_CUSTOM ; + CustomUnitText [ en-US ] = " degrees"; + DecimalDigits = 2; + Minimum = -18000; // set minmun value or it will be 0 as default + TabStop = TRUE ; + DropDown = TRUE ; + HelpID = HID_PROPERTY_PANEL_POSIZE_MTR_FLD_ANGLE; + }; + + FixedText FT_FLIP + { + Pos = MAP_APPFONT ( FT_FLIP_X , FT_FLIP_Y ); + Size = MAP_APPFONT ( PROPERTYPAGE_WIDTH - SECTIONPAGE_MARGIN_HORIZONTAL*2 - 40 - CONTROL_SPACING_HORIZONTAL - TOOLBOX_ITEM_WIDTH * 2 , TEXT_HEIGHT) ;//20 wj + Text [ en-US ] = "~Flip:"; + }; + + ToolBox TBX_FLIP + { + Pos = MAP_APPFONT ( BTN_FLIP_HORI_X , BTN_FLIP_HORI_Y ); + Size = MAP_APPFONT ( TOOLBOX_ITEM_WIDTH * 2, TOOLBOX_HEIGHT); + SVLook = TRUE ; + Border = FALSE ; + HelpID = HID_PROPERTY_PANEL_POSIZE_TBX_FLIP; + Text = "Flip"; + ItemList = + { + ToolBoxItem + { + Identifier = FLIP_VERTICAL ; + Text [ en-US ] = "Flip Vertically" ; + HelpID = HID_PROPERTY_PANEL_POSIZE_FLIP_VERTICAL; + ItemBitmap = Bitmap + { + File = "symphony/FlipVertically_16x16.png"; + }; + }; + ToolBoxItem + { + Identifier = FLIP_HORIZONTAL ; + Text [ en-US ] = "Flip Horizontally" ; + HelpID = HID_PROPERTY_PANEL_POSIZE_FLIP_HORIZONTAL; + ItemBitmap = Bitmap + { + File = "symphony/FlipHorizontally_16x16.png"; + }; + }; + }; + }; + + String STR_QH_HORI_FLIP + { + Text [ en-US ] = "Flip the selected object horizontally."; + }; + String STR_QH_VERT_FLIP + { + Text [ en-US ] = "Flip the selected object vertically."; + }; + + Image IMG_HORI_FLIP + { + ImageBitmap = Bitmap{File = "symphony/FlipHorizontally_16x16.png";}; + }; + Image IMG_VERT_FLIP + { + ImageBitmap = Bitmap{File = "symphony/FlipVertically_16x16.png";}; + }; + + Control DIAL_CONTROL + { + Pos = MAP_APPFONT ( ROTATE_CONTROL_X , ROTATE_CONTROL_Y ); + Size = MAP_PIXEL( 50, 50 ); + HelpID = HID_PROPERTY_PANEL_POSIZE_DIAL_CONTROL; + }; +}; + +// eof diff --git a/svx/source/sidebar/possize/SidebarDialControl.cxx b/svx/source/sidebar/possize/SidebarDialControl.cxx new file mode 100644 index 000000000000..374c9051375a --- /dev/null +++ b/svx/source/sidebar/possize/SidebarDialControl.cxx @@ -0,0 +1,82 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include <svx/sidebar/SidebarDialControl.hxx> +#include "SidebarDialControlBmp.hxx" + +#include <vcl/svapp.hxx> + +namespace svx { namespace sidebar { + +SidebarDialControl::SidebarDialControl ( + Window* pParent, + const ResId& rResId) + : svx::DialControl(pParent, rResId) +{ + mpImpl->mpBmpEnabled.reset(new SidebarDialControlBmp(*this)); + mpImpl->mpBmpDisabled.reset(new SidebarDialControlBmp(*this)); + mpImpl->mpBmpBuffered.reset(new SidebarDialControlBmp(*this)); + Init(GetOutputSizePixel()); +} + + + + +SidebarDialControl::~SidebarDialControl (void) +{ +} + + + + +void SidebarDialControl::MouseButtonDown( const MouseEvent& rMEvt ) +{ + if( rMEvt.IsLeft() ) + { + GrabFocus(); + CaptureMouse(); + mpImpl->mnOldAngle = mpImpl->mnAngle; + HandleMouseEvent( rMEvt.GetPosPixel(), true ); + } +} + + + + +void SidebarDialControl::HandleMouseEvent( const Point& rPos, bool bInitial ) +{ + long nX = rPos.X() - mpImpl->mnCenterX; + long nY = mpImpl->mnCenterY - rPos.Y(); + double fH = sqrt( static_cast< double >( nX ) * nX + static_cast< double >( nY ) * nY ); + if( fH != 0.0 ) + { + double fAngle = acos( nX / fH ); + sal_Int32 nAngle = static_cast< sal_Int32 >( fAngle / F_PI180 * 100.0 ); + if( nY < 0 ) + nAngle = 36000 - nAngle; + if( bInitial ) // round to entire 15 degrees + nAngle = ((nAngle + 750) / 1500) * 1500; + + if (Application::GetSettings().GetLayoutRTL()) + nAngle = 18000 - nAngle; + SetRotation( nAngle, true ); + } +} + +} } // end of namespace svx::sidebar + +// eof diff --git a/svx/source/sidebar/possize/SidebarDialControlBmp.cxx b/svx/source/sidebar/possize/SidebarDialControlBmp.cxx new file mode 100644 index 000000000000..f702632250a2 --- /dev/null +++ b/svx/source/sidebar/possize/SidebarDialControlBmp.cxx @@ -0,0 +1,87 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "SidebarDialControlBmp.hxx" + +#include <sfx2/sidebar/Theme.hxx> + +#include <vcl/svapp.hxx> + +#include "PosSizePropertyPanel.hrc" +#include <svx/dialogs.hrc> +#include <svx/dialmgr.hxx> +#include <svx/svdstr.hrc> + +namespace svx { namespace sidebar { + +SidebarDialControlBmp::SidebarDialControlBmp (Window& rParent) + : DialControlBmp(rParent) +{ +} + + + + +SidebarDialControlBmp::~SidebarDialControlBmp (void) +{ +} + + + + +void SidebarDialControlBmp::DrawElements ( + const String& /*rText*/, + sal_Int32 nAngle) +{ + if (Application::GetSettings().GetLayoutRTL()) + nAngle = 18000 - nAngle; + double fAngle = nAngle * F_PI180 / 100.0; + double fSin = sin( fAngle ); + double fCos = cos( fAngle ); + DrawText( maRect, String(), mbEnabled ? 0 : TEXT_DRAW_DISABLE ); + const sal_Int32 nDx (fCos * (maRect.GetWidth()-4) / 2); + const sal_Int32 nDy (-fSin * (maRect.GetHeight()-4) / 2); + Point pt1( maRect.Center() ); + Point pt2( pt1.X() + nDx, pt1.Y() + nDy); + if ( ! sfx2::sidebar::Theme::IsHighContrastMode()) + SetLineColor( Color( 60, 93, 138 ) ); + else + SetLineColor(COL_BLACK);//Application::GetSettings().GetStyleSettings().GetFieldTextColor() + DrawLine( pt1, pt2 ); +} + + + + +void SidebarDialControlBmp::DrawBackground() +{ + SetLineColor(); + SetFillColor(sfx2::sidebar::Theme::GetColor(sfx2::sidebar::Theme::Paint_PanelBackground)); + DrawRect(maRect); + + const BitmapEx aBitmapEx(SVX_RES(IMG_DIALCONTROL)); + // Size aImageSize(aBitmapEx.GetSizePixel()); + // aImageSize.Width() -= 1; + // aImageSize.Height() -= 1; + SetAntialiasing(ANTIALIASING_ENABLE_B2DDRAW | ANTIALIASING_PIXELSNAPHAIRLINE); + DrawBitmapEx(maRect.TopLeft(), /*aImageSize,*/ aBitmapEx); +} + + +} } // end of namespace svx::sidebar + +// eof diff --git a/svx/source/sidebar/possize/SidebarDialControlBmp.hxx b/svx/source/sidebar/possize/SidebarDialControlBmp.hxx new file mode 100644 index 000000000000..d1cb6be9db26 --- /dev/null +++ b/svx/source/sidebar/possize/SidebarDialControlBmp.hxx @@ -0,0 +1,43 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SVX_SIDEBAR_POSSIZE_DIAL_CONTROL_BMP_HXX +#define SVX_SIDEBAR_POSSIZE_DIAL_CONTROL_BMP_HXX + +#include <svx/dialcontrol.hxx> + +namespace svx { namespace sidebar { + + +class SidebarDialControlBmp + : public svx::DialControlBmp +{ +public: + explicit SidebarDialControlBmp( Window& rParent); + virtual ~SidebarDialControlBmp (void); + + virtual void DrawElements( const String& rText, sal_Int32 nAngle ); + virtual void DrawBackground(); + +private: +}; + +} } // end of namespace svx::sidebar + +#endif + +// eof diff --git a/svx/source/sidebar/text/SvxSBFontNameBox.cxx b/svx/source/sidebar/text/SvxSBFontNameBox.cxx new file mode 100644 index 000000000000..c60ece605b4e --- /dev/null +++ b/svx/source/sidebar/text/SvxSBFontNameBox.cxx @@ -0,0 +1,171 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "SvxSBFontNameBox.hxx" + +#include <unotools/fontoptions.hxx> +#include <sfx2/objsh.hxx> +#include <sfx2/dispatch.hxx> +#include <editeng/flstitem.hxx> +#include <editeng/editids.hrc> +#include <editeng/fontitem.hxx> + + +const static sal_uInt16 MAX_MRU_FONTNAME_ENTRIES = 5; + + +namespace svx { namespace sidebar { + +namespace { + bool GetDocFontList_Impl( const FontList** ppFontList, SvxSBFontNameBox* pBox ) + { + bool bChanged = false; + const SfxObjectShell* pDocSh = SfxObjectShell::Current(); + SvxFontListItem* pFontListItem = NULL; + + if ( pDocSh ) + pFontListItem = + (SvxFontListItem*)pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST ); + + if ( pFontListItem ) + { + const FontList* pNewFontList = pFontListItem->GetFontList(); + DBG_ASSERT( pNewFontList, "Doc-FontList not available!" ); + + if ( !*ppFontList ) + { + *ppFontList = pNewFontList; + bChanged = true; + } + else + { + bChanged = ( *ppFontList != pNewFontList ); + if( !bChanged && pBox!=NULL ) + bChanged = ( pBox->GetListCount() != pNewFontList->GetFontNameCount() ); + //HACK(vergleich ist unvollstaendig) + if ( bChanged ) + *ppFontList = pNewFontList; + } + + if ( pBox ) + pBox->Enable(); + } + else if ( pBox ) + pBox->Disable(); + + // in die FontBox ggf. auch die neue Liste f"ullen + if ( pBox && bChanged ) + { + if ( *ppFontList ) + pBox->Fill( *ppFontList ); + else + pBox->Clear(); + } + return bChanged; + } +} + + + + +SvxSBFontNameBox::SvxSBFontNameBox( Window* pParent, const ResId& rResId ) : + FontNameBox ( pParent, rResId ) +, pFontList ( NULL ) +, nFtCount ( 0 ) +, bInput(false) +, pBindings(NULL) +{ + EnableControls_Impl(); +// StartListening( *SFX_APP() ); +} + +void SvxSBFontNameBox::EnableControls_Impl() +{ + SvtFontOptions aFontOpt; + bool bEnable = aFontOpt.IsFontHistoryEnabled(); + sal_uInt16 nEntries = bEnable ? MAX_MRU_FONTNAME_ENTRIES : 0; + if ( GetMaxMRUCount() != nEntries ) + { + // refill in the next GetFocus-Handler + pFontList = NULL; + Clear(); + SetMaxMRUCount( nEntries ); + } + + bEnable = aFontOpt.IsFontWYSIWYGEnabled(); + EnableWYSIWYG( bEnable ); +} + +void SvxSBFontNameBox::FillList() +{ + Selection aOldSel = GetSelection(); + GetDocFontList_Impl( &pFontList, this ); + aCurText = GetText(); + SetSelection( aOldSel ); +} + +long SvxSBFontNameBox::PreNotify( NotifyEvent& rNEvt ) +{ + const sal_uInt16 nType (rNEvt.GetType()); + + if ( EVENT_MOUSEBUTTONDOWN == nType || EVENT_GETFOCUS == nType ) + FillList(); + return FontNameBox::PreNotify( rNEvt ); +} +//<<modify +long SvxSBFontNameBox::Notify( NotifyEvent& rNEvt) //SfxBroadcaster& rBC, const SfxHint& rHint +{ + //SfxItemSetHint* pHint = PTR_CAST(SfxItemSetHint, &rHint); + //if ( pHint ) + // EnableControls_Impl(); + bool bHandle = 0; + if ( rNEvt.GetType() == EVENT_KEYINPUT ) + { + const sal_uInt16 nCode (rNEvt.GetKeyEvent()->GetKeyCode().GetCode()); + + if( nCode == KEY_RETURN) + { + bHandle = 1; + Select(); + } + } + + return bHandle ? bHandle : FontNameBox::Notify( rNEvt ); +} +void SvxSBFontNameBox::Select() +{ + FontNameBox::Select(); + + if ( !IsTravelSelect() ) + { + FillList(); + FontInfo aInfo( pFontList->Get( GetText(),WEIGHT_NORMAL, ITALIC_NORMAL ) );//meWeight, meItalic + + SvxFontItem aFontItem( aInfo.GetFamily(), aInfo.GetName(), aInfo.GetStyleName(), + aInfo.GetPitch(), aInfo.GetCharSet(), SID_ATTR_CHAR_FONT ); + + pBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONT, SFX_CALLMODE_RECORD, &aFontItem, 0L ); + pBindings->Invalidate(SID_ATTR_CHAR_FONT,true,false); + } +} +void SvxSBFontNameBox::SetBindings(SfxBindings* pB) +{ + pBindings = pB; +} + +} } // end of namespace svx::sidebar diff --git a/svx/source/sidebar/text/SvxSBFontNameBox.hxx b/svx/source/sidebar/text/SvxSBFontNameBox.hxx new file mode 100644 index 000000000000..65fcc109fb8e --- /dev/null +++ b/svx/source/sidebar/text/SvxSBFontNameBox.hxx @@ -0,0 +1,76 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SVX_SIDEBAR_SB_FONT_NAME_BOX_HXX +#define SVX_SIDEBAR_SB_FONT_NAME_BOX_HXX + +#include <sfx2/bindings.hxx> +#include <svtools/ctrlbox.hxx> +#include <svtools/ctrltool.hxx> + +/* +#include <sfx2/sectionpage.hxx> +#include <svx/svxdllapi.h> +#include <vcl/fixed.hxx> + +#include <vcl/button.hxx> +#include <svl/lstner.hxx> +#include <vcl/toolbox.hxx> + +#include <svx/tbxcolorupdate.hxx> +#include <svx/svxenum.hxx> +#include <svx/fhgtitem.hxx> + +#define FONT_COLOR 1 +#define BACK_COLOR 2 +*/ +namespace svx +{ + class ToolboxButtonColorUpdater; +} + +namespace svx { namespace sidebar { + +class SvxSBFontNameBox : public FontNameBox//, public SfxListener +{ +private: + const FontList* pFontList; + Font aCurFont; + String aCurText; + sal_uInt16 nFtCount; + bool bInput; + void EnableControls_Impl(); + SfxBindings* pBindings;// +protected: + virtual void Select(); + +public: + SvxSBFontNameBox( Window* pParent, const ResId& rResId ); + void FillList(); + sal_uInt16 GetListCount() { return nFtCount; } + void Clear() { FontNameBox::Clear(); nFtCount = 0; } + void Fill( const FontList* pList ) + { FontNameBox::Fill( pList ); + nFtCount = pList->GetFontNameCount(); } + void SetBindings(SfxBindings* pBinding);// + virtual long PreNotify( NotifyEvent& rNEvt ); + virtual long Notify( NotifyEvent& rNEvt );// +}; + +} } // end of namespace svx::sidebar + +#endif diff --git a/svx/source/sidebar/text/TextCharacterSpacingControl.cxx b/svx/source/sidebar/text/TextCharacterSpacingControl.cxx new file mode 100644 index 000000000000..59fdfdc0a5d1 --- /dev/null +++ b/svx/source/sidebar/text/TextCharacterSpacingControl.cxx @@ -0,0 +1,463 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "TextCharacterSpacingControl.hxx" +#include "TextPropertyPanel.hrc" +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include <svx/dialogs.hrc> +#include <svx/dialmgr.hxx> +#include <unotools/viewoptions.hxx> +#include <editeng/kernitem.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/sidebar/Theme.hxx> + +namespace svx { namespace sidebar { +TextCharacterSpacingControl::TextCharacterSpacingControl(Window* pParent, svx::sidebar::TextPropertyPanel& rPanel) +: PopupControl( pParent,SVX_RES(RID_POPUPPANEL_TEXTPAGE_SPACING)) +, mrTextPropertyPanel(rPanel) +, mpBindings(NULL) +, maVSSpacing (ValueSetWithTextControl::IMAGE_TEXT,this, SVX_RES(VS_SPACING)) +, maLastCus (this, SVX_RES(FT_LASTCUSTOM)) +//, maBorder (this, SVX_RES(CT_BORDER)) +, maFTSpacing (this, SVX_RES(FT_SPACING)) +, maLBKerning (this, SVX_RES(LB_KERNING)) +, maFTBy (this, SVX_RES(FT_BY)) +, maEditKerning (this, SVX_RES(ED_KERNING)) + +, mpImg (NULL) +, mpImgSel (NULL) +, mpStr (NULL) +, mpStrTip (NULL) + +, maImgCus (SVX_RES(IMG_CUSTOM)) +, maImgCusGrey (SVX_RES(IMG_CUSTOM_GRAY)) +, maStrCus (SVX_RES(STR_CUSTOM)) +, maStrCusE (SVX_RES(STR_CUSTOM_E_TIP)) //add +, maStrCusC (SVX_RES(STR_CUSTOM_C_TIP)) //add +, maStrCusN (SVX_RES(STR_NORMAL_TIP)) //add +, maStrUnit (SVX_RES(STR_PT)) //add + +, mnCustomKern(0) +, mnLastCus ( SPACING_NOCUSTOM ) +, mbCusEnable(false) +, mbVS(true) +{ + initial(); + FreeResource(); + mpBindings = mrTextPropertyPanel.GetBindings(); + Link aLink = LINK(this, TextCharacterSpacingControl, KerningSelectHdl); + maLBKerning.SetSelectHdl(aLink); + aLink =LINK(this, TextCharacterSpacingControl, KerningModifyHdl); + maEditKerning.SetModifyHdl(aLink); + +} +TextCharacterSpacingControl::~TextCharacterSpacingControl() +{ + delete[] mpImg; + delete[] mpImgSel; + delete[] mpStr; + delete[] mpStrTip; +} + +void TextCharacterSpacingControl::initial() +{ + maVSSpacing.SetStyle( maVSSpacing.GetStyle()| WB_3DLOOK | WB_NO_DIRECTSELECT ); + { + maVSSpacing.SetControlBackground(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); + maVSSpacing.SetColor(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); + maVSSpacing.SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); + maFTSpacing.SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); + maFTBy.SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); + } + mpImg = new Image[5]; + mpImg[0] = Image(SVX_RES(IMG_VERY_TIGHT)); + mpImg[1] = Image(SVX_RES(IMG_TIGHT)); + mpImg[2] = Image(SVX_RES(IMG_NORMAL)); + mpImg[3] = Image(SVX_RES(IMG_LOOSE)); + mpImg[4] = Image(SVX_RES(IMG_VERY_LOOSE)); + + mpImgSel = new Image[5]; + mpImgSel[0] = Image(SVX_RES(IMG_VERY_TIGHT_S)); + mpImgSel[1] = Image(SVX_RES(IMG_TIGHT_S)); + mpImgSel[2] = Image(SVX_RES(IMG_NORMAL_S)); + mpImgSel[3] = Image(SVX_RES(IMG_LOOSE_S)); + mpImgSel[4] = Image(SVX_RES(IMG_VERY_LOOSE_S)); + + mpStr = new XubString[5]; + mpStr[0] = XubString(SVX_RES(STR_VERY_TIGHT)); + mpStr[1] = XubString(SVX_RES(STR_TIGHT)); + mpStr[2] = XubString(SVX_RES(STR_NORMAL)); + mpStr[3] = XubString(SVX_RES(STR_LOOSE)); + mpStr[4] = XubString(SVX_RES(STR_VERY_LOOSE)); + + + mpStrTip = new XubString[5]; + mpStrTip[0] = XubString(SVX_RES(STR_VERY_TIGHT_TIP)); + mpStrTip[1] = XubString(SVX_RES(STR_TIGHT_TIP)); + mpStrTip[2] = XubString(SVX_RES(STR_NORMAL_TIP)); + mpStrTip[3] = XubString(SVX_RES(STR_LOOSE_TIP)); + mpStrTip[4] = XubString(SVX_RES(STR_VERY_LOOSE_TIP)); + + for (int i=0;i<5;i++) + maVSSpacing.AddItem(mpImg[i], &mpImgSel[i],mpStr[i],&mpStrTip[i]); + + maVSSpacing.AddItem( maImgCus, 0, maStrCus, 0 ); + + maVSSpacing.SetNoSelection(); + Link aLink = LINK(this, TextCharacterSpacingControl,VSSelHdl ); + maVSSpacing.SetSelectHdl(aLink); + maVSSpacing.StartSelection(); + maVSSpacing.Show(); +} +void TextCharacterSpacingControl::ToGetFocus() +{ + if(!mbVS) + maLBKerning.GrabFocus(); + else + maVSSpacing.GrabFocus(); +} + +void TextCharacterSpacingControl::Rearrange(bool bLBAvailable,bool bAvailable, long nKerning) +{ + mbVS = true; + maVSSpacing.SetNoSelection(); + SvtViewOptions aWinOpt( E_WINDOW, SIDEBAR_SPACING_GLOBAL_VALUE ); + if ( aWinOpt.Exists() ) + { + ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt.GetUserData(); + ::rtl::OUString aTmp; + if ( aSeq.getLength()) + aSeq[0].Value >>= aTmp; + + String aWinData( aTmp ); + mnCustomKern = aWinData.ToInt32(); + mnLastCus = SPACING_CLOSE_BY_CUS_EDIT; + mbCusEnable = true; + } + else + { + mnLastCus = SPACING_NOCUSTOM; + mbCusEnable = false; + } + + if( !mnLastCus ) + { + maVSSpacing.ReplaceItemImages(6, maImgCusGrey,0); + } + else + { + //set custom tips + maVSSpacing.ReplaceItemImages(6, maImgCus,0); + if(mnCustomKern > 0) + { + String aStrTip( maStrCusE); //LAST CUSTOM no tip defect //add + aStrTip.Append( OUString::number( (double)mnCustomKern / 10)); + aStrTip.Append(maStrUnit); // modify + maVSSpacing.SetItemText(6,aStrTip); + } + else if(mnCustomKern < 0) + { + String aStrTip(maStrCusC) ; //LAST CUSTOM no tip defect //add + aStrTip.Append( OUString::number( (double)-mnCustomKern / 10)); + aStrTip.Append(maStrUnit); // modify + maVSSpacing.SetItemText( 6, aStrTip ); + } + else + { + String aStrTip(maStrCusN) ; //LAST CUSTOM no tip defect //add + maVSSpacing.SetItemText( 6, aStrTip ); + } + + } + + if(bLBAvailable && bAvailable) + { + maLBKerning.Enable(); + maFTSpacing.Enable(); + + SfxMapUnit eUnit = mrTextPropertyPanel.GetSpaceController().GetCoreMetric(); + MapUnit eOrgUnit = (MapUnit)eUnit; + MapUnit ePntUnit( MAP_POINT ); + long nBig = maEditKerning.Normalize(nKerning); + nKerning = LogicToLogic( nBig, eOrgUnit, ePntUnit ); + + if ( nKerning > 0 ) + { + maFTBy.Enable(); + maEditKerning.Enable(); + maEditKerning.SetMax( 9999 ); + maEditKerning.SetLast( 9999 ); + maEditKerning.SetValue( nKerning ); + maLBKerning.SelectEntryPos( SIDEBAR_SPACE_EXPAND ); + if(nKerning == 30) + { + maVSSpacing.SelectItem(4); + } + else if(nKerning == 60) + { + maVSSpacing.SelectItem(5); + } + else + { + maVSSpacing.SetNoSelection(); + maVSSpacing.SelectItem(0); + mbVS = false; + } + } + else if ( nKerning < 0 ) + { + maFTBy.Enable(); + maEditKerning.Enable(); + maEditKerning.SetValue( -nKerning ); + maLBKerning.SelectEntryPos( SIDEBAR_SPACE_CONDENSED ); + long nMax = mrTextPropertyPanel.GetSelFontSize()/6; + maEditKerning.SetMax( maEditKerning.Normalize( nMax ), FUNIT_POINT ); + maEditKerning.SetLast( maEditKerning.GetMax( maEditKerning.GetUnit() ) ); + if( nKerning == -30 ) + { + maVSSpacing.SelectItem(1); + } + else if( nKerning == -15 ) + { + maVSSpacing.SelectItem(2); + } + else + { + maVSSpacing.SetNoSelection(); + maVSSpacing.SelectItem(0); + mbVS = false; + } + } + else + { + maVSSpacing.SelectItem(3); + maLBKerning.SelectEntryPos( SIDEBAR_SPACE_NORMAL ); + maFTBy.Disable(); + maEditKerning.Disable(); + maEditKerning.SetValue( 0 ); + maEditKerning.SetMax( 9999 ); + maEditKerning.SetLast( 9999 ); + } + } + else if(bLBAvailable && !bAvailable) + { + //modified + maVSSpacing.SetNoSelection(); + maVSSpacing.SelectItem(0); + mbVS = false; + maLBKerning.Enable(); + maFTSpacing.Enable(); + maLBKerning.SetNoSelection(); + maEditKerning.SetText(String()); + maEditKerning.Disable(); + maFTBy.Disable(); + } + else + { + maVSSpacing.SetNoSelection(); + maVSSpacing.SelectItem(0); + mbVS = false; + maEditKerning.SetText(String()); + maLBKerning.SetNoSelection(); + maLBKerning.Disable(); + maFTSpacing.Disable(); + maEditKerning.Disable(); + maFTBy.Disable(); + } + GetFocus(); + maVSSpacing.Format(); + maVSSpacing.StartSelection(); +} +IMPL_LINK(TextCharacterSpacingControl, VSSelHdl, void *, pControl) +{ + mnLastCus = SPACING_CLOSE_BY_CLICK_ICON; + + if(pControl == &maVSSpacing) + { + sal_uInt16 iPos = maVSSpacing.GetSelectItemId(); + short nKern = 0; + SfxMapUnit eUnit = mrTextPropertyPanel.GetSpaceController().GetCoreMetric(); + long nVal = 0; + if(iPos == 1) + { + nVal = LogicToLogic(30, MAP_POINT, (MapUnit)eUnit); + nKern = (short)maEditKerning.Denormalize(nVal); + SvxKerningItem aKernItem(-nKern, SID_ATTR_CHAR_KERNING); + mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SFX_CALLMODE_RECORD, &aKernItem, 0L); + mrTextPropertyPanel.SetSpacing(-nKern); + mnLastCus = SPACING_CLOSE_BY_CLICK_ICON; + } + else if(iPos == 2) + { + nVal = LogicToLogic(15, MAP_POINT, (MapUnit)eUnit); + nKern = (short)maEditKerning.Denormalize(nVal); + SvxKerningItem aKernItem(-nKern, SID_ATTR_CHAR_KERNING); + mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SFX_CALLMODE_RECORD, &aKernItem, 0L); + mrTextPropertyPanel.SetSpacing(-nKern); + mnLastCus = SPACING_CLOSE_BY_CLICK_ICON; + } + else if(iPos == 3) + { + SvxKerningItem aKernItem(0, SID_ATTR_CHAR_KERNING); + mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SFX_CALLMODE_RECORD, &aKernItem, 0L); + mrTextPropertyPanel.SetSpacing(0); + mnLastCus = SPACING_CLOSE_BY_CLICK_ICON; + } + else if(iPos == 4) + { + nVal = LogicToLogic(30, MAP_POINT, (MapUnit)eUnit); + nKern = (short)maEditKerning.Denormalize(nVal); + SvxKerningItem aKernItem(nKern, SID_ATTR_CHAR_KERNING); + mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SFX_CALLMODE_RECORD, &aKernItem, 0L); + mrTextPropertyPanel.SetSpacing(nKern); + mnLastCus = SPACING_CLOSE_BY_CLICK_ICON; + } + else if(iPos == 5) + { + nVal = LogicToLogic(60, MAP_POINT, (MapUnit)eUnit); + nKern = (short)maEditKerning.Denormalize(nVal); + SvxKerningItem aKernItem(nKern, SID_ATTR_CHAR_KERNING); + mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SFX_CALLMODE_RECORD, &aKernItem, 0L); + mrTextPropertyPanel.SetSpacing(nKern); + mnLastCus = SPACING_CLOSE_BY_CLICK_ICON; + } + else if(iPos == 6) + { + //modified + if(mbCusEnable) + { + nVal = LogicToLogic(mnCustomKern, MAP_POINT, (MapUnit)eUnit); + nKern = (short)maEditKerning.Denormalize(nVal); + SvxKerningItem aKernItem(nKern , SID_ATTR_CHAR_KERNING); + mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SFX_CALLMODE_RECORD, &aKernItem, 0L); + mrTextPropertyPanel.SetSpacing(nKern); + mnLastCus = SPACING_CLOSE_BY_CLICK_ICON; + } + else + { + maVSSpacing.SetNoSelection(); //add , set no selection and keep the last select item + maVSSpacing.Format(); + Invalidate(); + maVSSpacing.StartSelection(); + } + //modify end + } + + if(iPos < 6 || (iPos == 6 && mbCusEnable)) //add + mrTextPropertyPanel.EndSpacingPopupMode(); + } + + + + return 0; +} + +IMPL_LINK(TextCharacterSpacingControl, KerningSelectHdl, ListBox*, EMPTYARG) +{ + if ( maLBKerning.GetSelectEntryPos() > 0 ) + { + maFTBy.Enable(); + maEditKerning.Enable(); + } + else + { + maEditKerning.SetValue( 0 ); + maFTBy.Disable(); + maEditKerning.Disable(); + } + + if ( maVSSpacing.GetSelectItemId() > 0 ) + { + maVSSpacing.SetNoSelection(); + maVSSpacing.SelectItem(0); + maVSSpacing.Format(); + Invalidate(); + maVSSpacing.StartSelection(); + } + KerningModifyHdl( NULL ); + return 0; +} +IMPL_LINK(TextCharacterSpacingControl, KerningModifyHdl, MetricField*, EMPTYARG) +{ + if ( maVSSpacing.GetSelectItemId() > 0 ) + { + maVSSpacing.SetNoSelection(); + maVSSpacing.SelectItem(0); + maVSSpacing.Format(); + Invalidate(); + maVSSpacing.StartSelection(); + } + sal_uInt16 nPos = maLBKerning.GetSelectEntryPos(); + short nKern = 0; + SfxMapUnit eUnit = mrTextPropertyPanel.GetSpaceController().GetCoreMetric(); + mnLastCus = SPACING_CLOSE_BY_CUS_EDIT; + if ( nPos == SIDEBAR_SPACE_EXPAND || nPos == SIDEBAR_SPACE_CONDENSED ) + { + long nTmp = static_cast<long>(maEditKerning.GetValue()); + if ( nPos == SIDEBAR_SPACE_CONDENSED ) + { + long nMax = mrTextPropertyPanel.GetSelFontSize()/6; + maEditKerning.SetMax( maEditKerning.Normalize( nMax ), FUNIT_TWIP ); + maEditKerning.SetLast( maEditKerning.GetMax( maEditKerning.GetUnit() ) ); + if(nTmp > maEditKerning.GetMax()) + nTmp = maEditKerning.GetMax(); + mnCustomKern = -nTmp; + long nVal = LogicToLogic( nTmp, MAP_POINT, (MapUnit)eUnit ); + nKern = (short)maEditKerning.Denormalize( nVal ); + nKern *= - 1; + } + else + { + maEditKerning.SetMax( 9999 ); + maEditKerning.SetLast( 9999 ); + if(nTmp > maEditKerning.GetMax(FUNIT_TWIP)) + nTmp = maEditKerning.GetMax(FUNIT_TWIP); + mnCustomKern = nTmp; + long nVal = LogicToLogic( nTmp, MAP_POINT, (MapUnit)eUnit ); + nKern = (short)maEditKerning.Denormalize( nVal ); + } + } + else + { + mnCustomKern = 0; + } + SvxKerningItem aKernItem(nKern, SID_ATTR_CHAR_KERNING); + mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SFX_CALLMODE_RECORD, &aKernItem, 0L); + mrTextPropertyPanel.SetSpacing(nKern); + return 0; +} +short TextCharacterSpacingControl::GetLastCustomState() +{ + return mnLastCus; +} +long TextCharacterSpacingControl::GetLastCustomValue() +{ + return mnCustomKern; +} + +}} // end of namespace sidebar diff --git a/svx/source/sidebar/text/TextCharacterSpacingControl.hxx b/svx/source/sidebar/text/TextCharacterSpacingControl.hxx new file mode 100644 index 000000000000..89c07031da94 --- /dev/null +++ b/svx/source/sidebar/text/TextCharacterSpacingControl.hxx @@ -0,0 +1,93 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_SIDEBAR_CHARACTER_SPACING_CONTROL_HXX_ +#define _SVX_SIDEBAR_CHARACTER_SPACING_CONTROL_HXX_ + +#include "svx/sidebar/PopupControl.hxx" +#include "svx/sidebar/ValueSetWithTextControl.hxx" +#include <sfx2/bindings.hxx> +#include <svtools/ctrlbox.hxx> +#include <svtools/ctrltool.hxx> +#include "TextPropertyPanel.hxx" +#include <vcl/fixed.hxx> + + +namespace svx { namespace sidebar { +#define SPACING_NOCUSTOM 0 +#define SPACING_CLOSE_BY_CLICK_ICON -1 +#define SPACING_CLOSE_BY_CUS_EDIT 1 + +#define SIDEBAR_SPACING_GLOBAL_VALUE String("PopupPanal_Spacing", 18, RTL_TEXTENCODING_ASCII_US) + +#define SIDEBAR_SPACE_NORMAL 0 +#define SIDEBAR_SPACE_EXPAND 1 +#define SIDEBAR_SPACE_CONDENSED 2 +class TextCharacterSpacingControl:public svx::sidebar::PopupControl +{ +public: + TextCharacterSpacingControl(Window* pParent, svx::sidebar::TextPropertyPanel& rPanel); + ~TextCharacterSpacingControl(); + void ToGetFocus(); + void Rearrange(bool bLBAvailable,bool bAvailable, long nKerning); + //virtual void Paint(const Rectangle& rect); + + //add + short GetLastCustomState(); + long GetLastCustomValue(); + //add end + +private: + svx::sidebar::TextPropertyPanel& mrTextPropertyPanel; + SfxBindings* mpBindings; + + ValueSetWithTextControl maVSSpacing; + + FixedText maLastCus; +// Control maBorder; + + FixedText maFTSpacing; + ListBox maLBKerning; + FixedText maFTBy; + MetricField maEditKerning; + + Image* mpImg; + Image* mpImgSel; + XubString* mpStr; + XubString* mpStrTip; + + Image maImgCus; + Image maImgCusGrey; + XubString maStrCus; + XubString maStrCusE; //add + XubString maStrCusC; //add + XubString maStrCusN; //add + XubString maStrUnit; //add + + long mnCustomKern; + short mnLastCus; + bool mbCusEnable; + bool mbVS; + + void initial(); + DECL_LINK(VSSelHdl, void*); + DECL_LINK(KerningSelectHdl, ListBox*); + DECL_LINK(KerningModifyHdl, MetricField*); +}; +}} + +#endif diff --git a/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx b/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx new file mode 100644 index 000000000000..56d8e8882f73 --- /dev/null +++ b/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx @@ -0,0 +1,75 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "TextCharacterSpacingPopup.hxx" +#include "TextCharacterSpacingControl.hxx" +#include <boost/bind.hpp> +#include <unotools/viewoptions.hxx> + +namespace svx { namespace sidebar { + +TextCharacterSpacingPopup::TextCharacterSpacingPopup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator) + : Popup( + pParent, + rControlCreator, + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Character Spacing"))) +{ + SetPopupModeEndHandler(::boost::bind(&TextCharacterSpacingPopup::PopupModeEndCallback, this)); +} + + + + +TextCharacterSpacingPopup::~TextCharacterSpacingPopup (void) +{ +} + + + + +void TextCharacterSpacingPopup::Rearrange (bool bLBAvailable,bool bAvailable, long nKerning) +{ + ProvideContainerAndControl(); + + TextCharacterSpacingControl* pControl = dynamic_cast<TextCharacterSpacingControl*>(mpControl.get()); + if (pControl != NULL) + pControl->Rearrange(bLBAvailable,bAvailable,nKerning); +} + +void TextCharacterSpacingPopup::PopupModeEndCallback (void) +{ + ProvideContainerAndControl(); + TextCharacterSpacingControl* pControl = dynamic_cast<TextCharacterSpacingControl*>(mpControl.get()); + if (pControl == NULL) + return; + + if( pControl->GetLastCustomState() == SPACING_CLOSE_BY_CUS_EDIT) + { + SvtViewOptions aWinOpt( E_WINDOW, SIDEBAR_SPACING_GLOBAL_VALUE ); + ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq(1); + aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Spacing") ); + aSeq[0].Value <<= ::rtl::OUString::number(pControl->GetLastCustomValue()); + aWinOpt.SetUserData( aSeq ); + + } +} + + +} } // end of namespace svx::sidebar + diff --git a/svx/source/sidebar/text/TextCharacterSpacingPopup.hxx b/svx/source/sidebar/text/TextCharacterSpacingPopup.hxx new file mode 100644 index 000000000000..5aa78dc7a6c8 --- /dev/null +++ b/svx/source/sidebar/text/TextCharacterSpacingPopup.hxx @@ -0,0 +1,44 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_SIDEBAR_CHARACTER_SPACING_POPUP_HXX_ +#define _SVX_SIDEBAR_CHARACTER_SPACING_POPUP_HXX_ + +#include "svx/sidebar/Popup.hxx" + +#include <boost/function.hpp> + +namespace svx { namespace sidebar { + +class TextCharacterSpacingPopup + : public Popup +{ +public : + TextCharacterSpacingPopup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator); + ~TextCharacterSpacingPopup (void); + + void Rearrange (bool bLBAvailable,bool bAvailable, long nKerning); +private: + void PopupModeEndCallback (void); +}; + +} } // end of namespace svx::sidebar + +#endif + diff --git a/svx/source/sidebar/text/TextPropertyPanel.cxx b/svx/source/sidebar/text/TextPropertyPanel.cxx new file mode 100644 index 000000000000..c0d0f3782fa8 --- /dev/null +++ b/svx/source/sidebar/text/TextPropertyPanel.cxx @@ -0,0 +1,1572 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "TextPropertyPanel.hrc" +#include "TextPropertyPanel.hxx" +#include "SvxSBFontNameBox.hxx" + +#include "svx/dialmgr.hxx" + +#include <editeng/brushitem.hxx> +#include <editeng/colritem.hxx> +#include <editeng/crossedoutitem.hxx> +#include <editeng/escapementitem.hxx> +#include <editeng/flstitem.hxx> +#include <editeng/fontitem.hxx> +#include <editeng/kernitem.hxx> +#include <editeng/postitem.hxx> +#include <editeng/shdditem.hxx> +#include <editeng/udlnitem.hxx> +#include <editeng/wghtitem.hxx> +#include <rtl/ref.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/objsh.hxx> +#include <sfx2/viewsh.hxx> +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include <sfx2/sidebar/ControlFactory.hxx> +#include <sfx2/sidebar/Theme.hxx> +#include "sfx2/imagemgr.hxx" +#include <svtools/ctrltool.hxx> +#include <svtools/unitconv.hxx> + +#include <vcl/gradient.hxx> +#include <vcl/svapp.hxx> +#include <vcl/toolbox.hxx> +#include "TextCharacterSpacingControl.hxx" +#include "TextCharacterSpacingPopup.hxx" +#include "TextUnderlineControl.hxx" +#include "TextUnderlinePopup.hxx" +#include <svx/sidebar/ColorControl.hxx> +#include <svx/sidebar/PopupContainer.hxx> + + +#include <boost/bind.hpp> + +using namespace css; +using namespace cssu; +using ::sfx2::sidebar::Theme; +using ::sfx2::sidebar::ControlFactory; + +#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) + +namespace svx { namespace sidebar { + +#undef HAS_IA2 + + +#define TEXT_SECTIONPAGE_HEIGHT_S SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + ( TOOLBOX_ITEM_HEIGHT + 2 ) + CONTROL_SPACING_VERTICAL * 1 + SECTIONPAGE_MARGIN_VERTICAL_BOT +#define TEXT_SECTIONPAGE_HEIGHT SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + ( TOOLBOX_ITEM_HEIGHT + 2 ) * 2 + CONTROL_SPACING_VERTICAL * 2 + SECTIONPAGE_MARGIN_VERTICAL_BOT + +// + +//end +PopupControl* TextPropertyPanel::CreateCharacterSpacingControl (PopupContainer* pParent) +{ + return new TextCharacterSpacingControl(pParent, *this); +} + +PopupControl* TextPropertyPanel::CreateUnderlinePopupControl (PopupContainer* pParent) +{ + return new TextUnderlineControl(pParent, *this); +} + +PopupControl* TextPropertyPanel::CreateFontColorPopupControl (PopupContainer* pParent) +{ + return new ColorControl( + pParent, + mpBindings, + SVX_RES(RID_POPUPPANEL_TEXTPAGE_FONT_COLOR), + SVX_RES(VS_FONT_COLOR), + ::boost::bind(&TextPropertyPanel::GetFontColor, this), + ::boost::bind(&TextPropertyPanel::SetFontColor, this, _1,_2), + pParent, + 0); +} + +PopupControl* TextPropertyPanel::CreateBrushColorPopupControl (PopupContainer* pParent) +{ + return new ColorControl( + pParent, + mpBindings, + SVX_RES(RID_POPUPPANEL_TEXTPAGE_FONT_COLOR), + SVX_RES(VS_FONT_COLOR), + ::boost::bind(&TextPropertyPanel::GetBrushColor, this), + ::boost::bind(&TextPropertyPanel::SetBrushColor, this, _1,_2), + pParent, + 0); +} + +long TextPropertyPanel::GetSelFontSize() +{ + long nH = 240; + SfxMapUnit eUnit = maSpacingControl.GetCoreMetric(); + if (mpHeightItem) + nH = LogicToLogic( mpHeightItem->GetHeight(), (MapUnit)eUnit, MAP_TWIP ); + return nH; +} + + +TextPropertyPanel* TextPropertyPanel::Create ( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings, + const cssu::Reference<css::ui::XSidebar>& rxSidebar) +{ + if (pParent == NULL) + throw lang::IllegalArgumentException(A2S("no parent Window given to TextPropertyPanel::Create"), NULL, 0); + if ( ! rxFrame.is()) + throw lang::IllegalArgumentException(A2S("no XFrame given to TextPropertyPanel::Create"), NULL, 1); + if (pBindings == NULL) + throw lang::IllegalArgumentException(A2S("no SfxBindings given to TextPropertyPanel::Create"), NULL, 2); + + return new TextPropertyPanel( + pParent, + rxFrame, + pBindings, + rxSidebar); +} + + +::sfx2::sidebar::ControllerItem& TextPropertyPanel::GetSpaceController() +{ + return maSpacingControl; +} + +TextPropertyPanel::TextPropertyPanel ( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings, + const cssu::Reference<css::ui::XSidebar>& rxSidebar) + : Control(pParent, SVX_RES(RID_SIDEBAR_TEXT_PANEL)), + mpFontNameBox (new SvxSBFontNameBox(this, SVX_RES(CB_SBFONT_FONT))), + maFontSizeBox (this, SVX_RES(MB_SBFONT_FONTSIZE)), + mpToolBoxIncDecBackground(ControlFactory::CreateToolBoxBackground(this)), + mpToolBoxIncDec(ControlFactory::CreateToolBox( + mpToolBoxIncDecBackground.get(), + SVX_RES(TB_INCREASE_DECREASE))), + mpToolBoxFontBackground(ControlFactory::CreateToolBoxBackground(this)), + mpToolBoxFont(ControlFactory::CreateToolBox( + mpToolBoxFontBackground.get(), + SVX_RES(TB_FONT))), + mpToolBoxFontColorBackground(ControlFactory::CreateToolBoxBackground(this)), + mpToolBoxFontColor(ControlFactory::CreateToolBox( + mpToolBoxFontColorBackground.get(), + SVX_RES(TB_FONTCOLOR))), + mpToolBoxScriptBackground(ControlFactory::CreateToolBoxBackground(this)), + mpToolBoxScript(ControlFactory::CreateToolBox( + mpToolBoxScriptBackground.get(), + SVX_RES(TB_SCRIPT))), + mpToolBoxScriptSwBackground(ControlFactory::CreateToolBoxBackground(this)), + mpToolBoxScriptSw(ControlFactory::CreateToolBox( + mpToolBoxScriptSwBackground.get(), + SVX_RES(TB_SCRIPT_SW))), + mpToolBoxSpacingBackground(ControlFactory::CreateToolBoxBackground(this)), + mpToolBoxSpacing(ControlFactory::CreateToolBox( + mpToolBoxSpacingBackground.get(), + SVX_RES(TB_SPACING))), + mpToolBoxHighlightBackground(ControlFactory::CreateToolBoxBackground(this)), + mpToolBoxHighlight(ControlFactory::CreateToolBox( + mpToolBoxHighlightBackground.get(), + SVX_RES(TB_HIGHLIGHT))), + + mpFontColorUpdater(), + mpHighlightUpdater(), + + maFontNameControl (SID_ATTR_CHAR_FONT, *pBindings, *this), + maFontSizeControl (SID_ATTR_CHAR_FONTHEIGHT, *pBindings, *this), + maWeightControl (SID_ATTR_CHAR_WEIGHT, *pBindings, *this), + maItalicControl (SID_ATTR_CHAR_POSTURE, *pBindings, *this), + maUnderlineControl (SID_ATTR_CHAR_UNDERLINE, *pBindings, *this), + maStrikeControl (SID_ATTR_CHAR_STRIKEOUT, *pBindings, *this), + maShadowControl (SID_ATTR_CHAR_SHADOWED, *pBindings, *this), + maFontColorControl (SID_ATTR_CHAR_COLOR, *pBindings, *this), + maScriptControlSw (SID_ATTR_CHAR_ESCAPEMENT, *pBindings, *this), //for sw + maSuperScriptControl (SID_SET_SUPER_SCRIPT, *pBindings, *this), + maSubScriptControl (SID_SET_SUB_SCRIPT, *pBindings, *this), + maSpacingControl (SID_ATTR_CHAR_KERNING, *pBindings, *this), + maHighlightControl (SID_ATTR_BRUSH_CHAR, *pBindings, *this), + maSDFontGrow (SID_GROW_FONT_SIZE, *pBindings, *this), + maSDFontShrink (SID_SHRINK_FONT_SIZE, *pBindings, *this), + + maImgIncrease (SVX_RES( IMG_INCREASE)), + maImgDecrease (SVX_RES( IMG_DECREASE)), + maImgBold (SVX_RES( IMG_BOLD )), + maImgItalic (SVX_RES( IMG_ITALIC )), + maImgUnderline (SVX_RES( IMG_UNDERLINE )), + maImgStrike (SVX_RES( IMG_STRIKEOUT )), + maImgShadow (SVX_RES( IMG_SHADOWED )), + maImgFontColor (SVX_RES( IMG_FONTCOLOR)), + maImgSupScript (SVX_RES( IMG_SUPSCRIPT)), + maImgSubScript (SVX_RES( IMG_SUBSCRIPT)), + maImgHighlight (SVX_RES( IMG_HIGHLIGHT)), + + maImgNormalIcon (SVX_RES( IMG_SPACING_D)), + + mpFontList (NULL), + mbMustDelete (false), + mbFocusOnFontSizeCtrl(false), + + maCharSpacePopup(this, ::boost::bind(&TextPropertyPanel::CreateCharacterSpacingControl, this, _1)), + maUnderlinePopup(this, ::boost::bind(&TextPropertyPanel::CreateUnderlinePopupControl, this, _1)), + maFontColorPopup(this, ::boost::bind(&TextPropertyPanel::CreateFontColorPopupControl, this, _1)), + maBrushColorPopup(this, ::boost::bind(&TextPropertyPanel::CreateBrushColorPopupControl, this, _1)), + + + mxFrame(rxFrame), + maContext(), + mpBindings(pBindings), + mxSidebar(rxSidebar) +{ + Initialize(); + FreeResource(); +} + + + + +TextPropertyPanel::~TextPropertyPanel (void) +{ + if(mbMustDelete) + delete mpFontList; + + // Destroy the toolbox windows. + mpToolBoxIncDec.reset(); + mpToolBoxFont.reset(); + mpToolBoxFontColor.reset(); + mpToolBoxScript.reset(); + mpToolBoxScriptSw.reset(); + mpToolBoxSpacing.reset(); + mpToolBoxHighlight.reset(); + + // Destroy the background windows of the toolboxes. + mpToolBoxIncDecBackground.reset(); + mpToolBoxFontBackground.reset(); + mpToolBoxFontColorBackground.reset(); + mpToolBoxScriptBackground.reset(); + mpToolBoxScriptSwBackground.reset(); + mpToolBoxSpacingBackground.reset(); + mpToolBoxHighlightBackground.reset(); +} + + + + +Image TextPropertyPanel::GetIcon (const ::rtl::OUString& rsURL) +{ + return GetImage(mxFrame, rsURL, sal_False); +} + + +void TextPropertyPanel::SetSpacing(long nKern) +{ + mlKerning = nKern; +} + + +void TextPropertyPanel::HandleContextChange ( + const ::sfx2::sidebar::EnumContext aContext) +{ + if (maContext == aContext) + { + // Nothing to do. + return; + } + + maContext = aContext; + switch (maContext.GetCombinedContext_DI()) + { + case CombinedEnumContext(Application_Calc, Context_Cell): + case CombinedEnumContext(Application_Calc, Context_Pivot): + { + mpToolBoxScript->Hide(); + mpToolBoxScriptSw->Hide(); + mpToolBoxSpacing->Hide(); + mpToolBoxHighlight->Hide(); + + Size aSize(PROPERTYPAGE_WIDTH,TEXT_SECTIONPAGE_HEIGHT_S); + aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) ); + aSize.setWidth(GetOutputSizePixel().Width()); + SetSizePixel(aSize); + if (mxSidebar.is()) + mxSidebar->requestLayout(); + break; + } + + case CombinedEnumContext(Application_WriterAndWeb, Context_Text): + case CombinedEnumContext(Application_WriterAndWeb, Context_Table): + { + mpToolBoxScriptSw->Show(); + mpToolBoxScript->Hide(); + mpToolBoxHighlight->Show(); + mpToolBoxSpacing->Show(); + + Size aSize(PROPERTYPAGE_WIDTH, TEXT_SECTIONPAGE_HEIGHT); + aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) ); + aSize.setWidth(GetOutputSizePixel().Width()); + SetSizePixel(aSize); + if (mxSidebar.is()) + mxSidebar->requestLayout(); + break; + } + + case CombinedEnumContext(Application_Writer, Context_DrawText): + case CombinedEnumContext(Application_Writer, Context_Annotation): + { + mpToolBoxScriptSw->Show(); + mpToolBoxScript->Hide(); + mpToolBoxSpacing->Show(); + mpToolBoxHighlight->Hide(); + + Size aSize(PROPERTYPAGE_WIDTH,TEXT_SECTIONPAGE_HEIGHT); + aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) ); + aSize.setWidth(GetOutputSizePixel().Width()); + SetSizePixel(aSize); + if (mxSidebar.is()) + mxSidebar->requestLayout(); + break; + } + + case CombinedEnumContext(Application_Calc, Context_EditCell): + case CombinedEnumContext(Application_Calc, Context_DrawText): + case CombinedEnumContext(Application_DrawImpress, Context_DrawText): + case CombinedEnumContext(Application_DrawImpress, Context_Text): + case CombinedEnumContext(Application_DrawImpress, Context_Table): + case CombinedEnumContext(Application_DrawImpress, Context_OutlineText): + case CombinedEnumContext(Application_DrawImpress, Context_Draw): + case CombinedEnumContext(Application_DrawImpress, Context_TextObject): + case CombinedEnumContext(Application_DrawImpress, Context_Graphic): + { + mpToolBoxScriptSw->Hide(); + mpToolBoxScript->Show(); + mpToolBoxSpacing->Show(); + mpToolBoxHighlight->Hide(); + + Size aSize(PROPERTYPAGE_WIDTH,TEXT_SECTIONPAGE_HEIGHT); + aSize = LogicToPixel( aSize,MapMode(MAP_APPFONT) ); + aSize.setWidth(GetOutputSizePixel().Width()); + SetSizePixel(aSize); + if (mxSidebar.is()) + mxSidebar->requestLayout(); + break; + } + + default: + break; + } +} + +SfxBindings* TextPropertyPanel::GetBindings() +{ + return mpBindings; +} + + +void TextPropertyPanel::DataChanged (const DataChangedEvent& rEvent) +{ + (void)rEvent; + + SetupIcons(); +} + + + +void TextPropertyPanel::Initialize (void) +{ + //<<modify fill font list + SfxObjectShell* pDocSh = SfxObjectShell::Current(); + const SfxPoolItem* pItem = NULL; + + if (pDocSh != NULL) + pItem = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST ); + if (pItem != NULL) + mpFontList = ( (SvxFontListItem*)pItem )->GetFontList(); + else + { + mpFontList = new FontList( Application::GetDefaultDevice() ); + mbMustDelete = 1; + } + + mpFontNameBox->SetAccessibleName(mpFontNameBox->GetQuickHelpText()); + const FontInfo aFontInfo (mpFontList->Get( OUString( "" ), OUString( "" ))); + maFontSizeBox.Fill(&aFontInfo,mpFontList); + maFontSizeBox.SetAccessibleName(maFontSizeBox.GetQuickHelpText()); + + //toolbox + SetupIcons(); + InitToolBoxIncDec(); + InitToolBoxFont(); + InitToolBoxFontColor(); + InitToolBoxScript(); + InitToolBoxSpacing(); + InitToolBoxHighlight(); + +#ifdef HAS_IA2 + mpFontNameBox->SetAccRelationLabeledBy(&mpFontNameBox); + mpFontNameBox->SetMpSubEditAccLableBy(&mpFontNameBox); + maFontSizeBox.SetAccRelationLabeledBy(&maFontSizeBox); + maFontSizeBox.SetMpSubEditAccLableBy(&maFontSizeBox); + mpToolBoxFont.SetAccRelationLabeledBy(&mpToolBoxFont); + mpToolBoxIncDec.SetAccRelationLabeledBy(&mpToolBoxIncDec); + mpToolBoxFontColor.SetAccRelationLabeledBy(&mpToolBoxFontColor); + mpToolBoxScript.SetAccRelationLabeledBy(&mpToolBoxScript); + mpToolBoxScriptSw.SetAccRelationLabeledBy(&mpToolBoxScriptSw); + mpToolBoxSpacing.SetAccRelationLabeledBy(&mpToolBoxSpacing); + mpToolBoxHighlight.SetAccRelationLabeledBy(&mpToolBoxHighlight); +#endif + + //init state + mpHeightItem = NULL; + meWeight = WEIGHT_NORMAL; + meItalic = ITALIC_NONE; + mbShadow = false; + meStrike = STRIKEOUT_NONE; + mbPostureAvailable = true; + mbWeightAvailable = true; + meUnderline = UNDERLINE_NONE; + meUnderlineColor = COL_AUTO; // + maColor = COL_BLACK; + mbColorAvailable = true; + maBackColor = COL_AUTO; + mbBackColorAvailable = true; + meColorType = FONT_COLOR; + meEscape = SVX_ESCAPEMENT_OFF; + mbSuper = false; + mbSub = false; + mbKernAvailable = true; + mbKernLBAvailable = true; + mlKerning = 0; + mpFontColorUpdater.reset(new ToolboxButtonColorUpdater( + SID_ATTR_CHAR_COLOR, + TBI_FONTCOLOR, + mpToolBoxFontColor.get(), + TBX_UPDATER_MODE_CHAR_COLOR_NEW)); + mpHighlightUpdater.reset(new ToolboxButtonColorUpdater( + SID_ATTR_BRUSH_CHAR, + TBI_HIGHLIGHT, + mpToolBoxHighlight.get(), + TBX_UPDATER_MODE_CHAR_COLOR_NEW)); + + //set handler + mpFontNameBox->SetBindings(mpBindings); + //add + Link aLink = LINK(this, TextPropertyPanel, FontSelHdl); + mpFontNameBox->SetSelectHdl(aLink); + //add end + + aLink = LINK(this, TextPropertyPanel, FontSizeModifyHdl); + maFontSizeBox.SetModifyHdl(aLink); + //add + aLink = LINK(this, TextPropertyPanel, FontSizeSelHdl); + maFontSizeBox.SetSelectHdl(aLink); + //add end + aLink = LINK(this, TextPropertyPanel, FontSizeLoseFocus); + maFontSizeBox.SetLoseFocusHdl(aLink); + + // add + long aSizeBoxHeight = maFontSizeBox.GetSizePixel().getHeight();; + Point aPosFontSize = maFontSizeBox.GetPosPixel(); + long aPosY = aPosFontSize.getY(); + Point pTBIncDec = mpToolBoxIncDec->GetPosPixel(); + long aIncDecHeight = mpToolBoxIncDec->GetSizePixel().getHeight(); + pTBIncDec.setY(aPosY+aSizeBoxHeight/2-aIncDecHeight/2); + mpToolBoxIncDec->SetPosPixel(pTBIncDec); + //end +} + +void TextPropertyPanel::EndSpacingPopupMode (void) +{ + maCharSpacePopup.Hide(); +} + +void TextPropertyPanel::EndUnderlinePopupMode (void) +{ + maUnderlinePopup.Hide(); +} + + +void TextPropertyPanel::InitToolBoxFont() +{ + mpToolBoxFont->SetQuickHelpText(TBI_BOLD,String(SVX_RES(STR_QH_BOLD))); //Add + mpToolBoxFont->SetQuickHelpText(TBI_ITALIC,String(SVX_RES(STR_QH_ITALIC))); //Add + mpToolBoxFont->SetQuickHelpText(TBI_UNDERLINE,String(SVX_RES(STR_QH_UNDERLINE))); //Add + mpToolBoxFont->SetBackground(Wallpaper()); + mpToolBoxFont->SetPaintTransparent(true); + + Size aTbxSize( mpToolBoxFont->CalcWindowSizePixel() ); + mpToolBoxFont->SetOutputSizePixel( aTbxSize ); + + Link aLink = LINK(this, TextPropertyPanel, ToolboxFontSelectHandler); + mpToolBoxFont->SetSelectHdl ( aLink ); + aLink = LINK(this, TextPropertyPanel, ToolBoxUnderlineClickHdl); + mpToolBoxFont->SetDropdownClickHdl(aLink); +} + + + + +void TextPropertyPanel::InitToolBoxIncDec() +{ + Size aTbxSize( mpToolBoxIncDec->CalcWindowSizePixel() ); + mpToolBoxIncDec->SetOutputSizePixel( aTbxSize ); + + Link aLink = LINK(this, TextPropertyPanel, ToolboxIncDecSelectHdl); + mpToolBoxIncDec->SetSelectHdl ( aLink ); +} + + + + +void TextPropertyPanel::InitToolBoxFontColor() +{ + Size aTbxSize( mpToolBoxFontColor->CalcWindowSizePixel() ); + mpToolBoxFontColor->SetOutputSizePixel( aTbxSize ); + mpToolBoxFontColor->SetItemBits( TBI_FONTCOLOR, mpToolBoxFontColor->GetItemBits( TBI_FONTCOLOR ) | TIB_DROPDOWNONLY ); + + Link aLink = LINK(this, TextPropertyPanel, ToolBoxFontColorDropHdl); + mpToolBoxFontColor->SetDropdownClickHdl ( aLink ); + mpToolBoxFontColor->SetSelectHdl ( aLink ); + +} +void TextPropertyPanel::InitToolBoxScript() +{ + Size aTbxSize( mpToolBoxScriptSw->CalcWindowSizePixel() ); + mpToolBoxScriptSw->SetOutputSizePixel( aTbxSize ); + + Link aLink = LINK(this, TextPropertyPanel, ToolBoxSwScriptSelectHdl); + mpToolBoxScriptSw->SetSelectHdl ( aLink ); + + aTbxSize = mpToolBoxScript->CalcWindowSizePixel() ; + mpToolBoxScript->SetOutputSizePixel( aTbxSize ); + + aLink = LINK(this, TextPropertyPanel, ToolBoxScriptSelectHdl); + mpToolBoxScript->SetSelectHdl ( aLink ); +} +void TextPropertyPanel::InitToolBoxSpacing() +{ + Size aTbxSize( mpToolBoxSpacing->CalcWindowSizePixel() ); + mpToolBoxSpacing->SetOutputSizePixel( aTbxSize ); + mpToolBoxSpacing->SetItemBits( TBI_SPACING, mpToolBoxSpacing->GetItemBits( TBI_SPACING ) | TIB_DROPDOWNONLY ); + + Link aLink = LINK(this, TextPropertyPanel, SpacingClickHdl); + mpToolBoxSpacing->SetDropdownClickHdl ( aLink ); + mpToolBoxSpacing->SetSelectHdl( aLink ); +} +void TextPropertyPanel::InitToolBoxHighlight() +{ + Size aTbxSize( mpToolBoxHighlight->CalcWindowSizePixel() ); + mpToolBoxHighlight->SetOutputSizePixel( aTbxSize ); + mpToolBoxHighlight->SetItemBits( TBI_HIGHLIGHT, mpToolBoxHighlight->GetItemBits( TBI_HIGHLIGHT ) | TIB_DROPDOWNONLY ); + + Link aLink = LINK(this, TextPropertyPanel, ToolBoxHighlightDropHdl); + mpToolBoxHighlight->SetDropdownClickHdl ( aLink ); + mpToolBoxHighlight->SetSelectHdl( aLink ); +} + + + + +void TextPropertyPanel::SetupIcons (void) +{ + if (Theme::GetBoolean(Theme::Bool_UseSymphonyIcons)) + { + mpToolBoxIncDec->SetItemImage(TBI_INCREASE, maImgIncrease); + mpToolBoxIncDec->SetItemImage(TBI_DECREASE, maImgDecrease); + mpToolBoxFont->SetItemImage(TBI_BOLD, maImgBold); + mpToolBoxFont->SetItemImage(TBI_ITALIC, maImgItalic); + mpToolBoxFont->SetItemImage(TBI_UNDERLINE, maImgUnderline); + mpToolBoxFont->SetItemImage(TBI_STRIKEOUT, maImgStrike); + mpToolBoxFont->SetItemImage(TBI_SHADOWED, maImgShadow); + + mpToolBoxFontColor->SetItemImage(TBI_FONTCOLOR, maImgFontColor); + //for sw + mpToolBoxScriptSw->SetItemImage(TBI_SUPER_SW, maImgSupScript); + mpToolBoxScriptSw->SetItemImage(TBI_SUB_SW, maImgSubScript); + //for sc and sd + mpToolBoxScript->SetItemImage(TBI_SUPER, maImgSupScript); + mpToolBoxScript->SetItemImage(TBI_SUB, maImgSubScript); + mpToolBoxSpacing->SetItemImage(TBI_SPACING, maImgNormalIcon); + mpToolBoxHighlight->SetItemImage(TBI_HIGHLIGHT, maImgHighlight); + } + else + { + mpToolBoxIncDec->SetItemImage(TBI_INCREASE, GetIcon(A2S(".uno:Grow"))); + mpToolBoxIncDec->SetItemImage(TBI_DECREASE, GetIcon(A2S(".uno:Shrink"))); + mpToolBoxFont->SetItemImage(TBI_BOLD, GetIcon(A2S(".uno:Bold"))); + mpToolBoxFont->SetItemImage(TBI_ITALIC, GetIcon(A2S(".uno:Italic"))); + mpToolBoxFont->SetItemImage(TBI_UNDERLINE, GetIcon(A2S(".uno:Underline"))); + mpToolBoxFont->SetItemImage(TBI_STRIKEOUT, GetIcon(A2S(".uno:Strikeout"))); + mpToolBoxFont->SetItemImage(TBI_SHADOWED, GetIcon(A2S(".uno:Shadowed"))); + + mpToolBoxFontColor->SetItemImage(TBI_FONTCOLOR, GetIcon(A2S(".uno:FontColor"))); + //for sw + mpToolBoxScriptSw->SetItemImage(TBI_SUPER_SW, GetIcon(A2S(".uno:SuperScript"))); + mpToolBoxScriptSw->SetItemImage(TBI_SUB_SW, GetIcon(A2S(".uno:SubScript"))); + //for sc and sd + mpToolBoxScript->SetItemImage(TBI_SUPER, GetIcon(A2S(".uno:SuperScript"))); + mpToolBoxScript->SetItemImage(TBI_SUB, GetIcon(A2S(".uno:SubScript"))); + mpToolBoxSpacing->SetItemImage(TBI_SPACING, GetIcon(A2S(".uno:FontworkCharacterSpacingFloater"))); + mpToolBoxHighlight->SetItemImage(TBI_HIGHLIGHT, GetIcon(A2S(".uno:BackColor"))); + } +} + + + + +IMPL_LINK( TextPropertyPanel, FontSelHdl, FontNameBox*, pBox ) +{ + if ( !pBox->IsTravelSelect() ) + { + if( SfxViewShell::Current() ) + { + Window* pShellWnd = SfxViewShell::Current()->GetWindow(); + + if ( pShellWnd ) + pShellWnd->GrabFocus(); + } + } + return 0; +} +//add end +IMPL_LINK( TextPropertyPanel, FontSizeModifyHdl, FontSizeBox*, pSizeBox ) +{ + if (pSizeBox == &maFontSizeBox) + { + long nSize = pSizeBox->GetValue(); + mbFocusOnFontSizeCtrl = true; + + float fSize = (float)nSize / 10; + SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric(); + SvxFontHeightItem aItem( CalcToUnit( fSize, eUnit ), 100, SID_ATTR_CHAR_FONTHEIGHT ) ; + + mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L ); + mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false); + } + return 0; +} +//add +IMPL_LINK( TextPropertyPanel, FontSizeSelHdl, FontSizeBox*, pSizeBox ) +{ + if ( !pSizeBox->IsTravelSelect() ) + { + if( SfxViewShell::Current() ) + { + Window* pShellWnd = SfxViewShell::Current()->GetWindow(); + + if ( pShellWnd ) + pShellWnd->GrabFocus(); + } + } + + return 0; +} +//add end +IMPL_LINK(TextPropertyPanel, FontSizeLoseFocus, FontSizeBox*, pSizeBox) +{ + if(pSizeBox == &maFontSizeBox) + { + mbFocusOnFontSizeCtrl = false; + } + return 0; +} + +IMPL_LINK(TextPropertyPanel, ToolboxFontSelectHandler, ToolBox*, pToolBox) +{ + const sal_uInt16 nId = pToolBox->GetCurItemId(); + + //Bold + if(nId == TBI_BOLD) + { + EndTracking(); + if(meWeight != WEIGHT_BOLD) + meWeight = WEIGHT_BOLD; + else + meWeight = WEIGHT_NORMAL; + SvxWeightItem aWeightItem(meWeight, SID_ATTR_CHAR_WEIGHT); + mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_WEIGHT, SFX_CALLMODE_RECORD, &aWeightItem, 0L); + UpdateFontBold(); + } + //Italic + else if(nId == TBI_ITALIC) + { + EndTracking(); + if(meItalic != ITALIC_NORMAL) + meItalic = ITALIC_NORMAL; + else + meItalic = ITALIC_NONE; + SvxPostureItem aPostureItem(meItalic, SID_ATTR_CHAR_POSTURE); + mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_POSTURE, SFX_CALLMODE_RECORD, &aPostureItem, 0L); + UpdateFontItalic(); + } + //underline + else if(nId == TBI_UNDERLINE) + { + EndTracking(); + //add , keep underline's color + if(meUnderline == UNDERLINE_NONE) + { + //AF: meUnderline = GetDefaultUnderline(); + meUnderline = UNDERLINE_SINGLE; + //<<modify + //SvxTextLineItem aLineItem(meUnderline, SID_ATTR_CHAR_UNDERLINE); + SvxUnderlineItem aLineItem(meUnderline, SID_ATTR_CHAR_UNDERLINE); + //modify end>> + aLineItem.SetColor(meUnderlineColor); + mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_UNDERLINE, SFX_CALLMODE_RECORD, &aLineItem, 0L); + } + else + { + meUnderline = UNDERLINE_NONE; + //<<modify + //SvxTextLineItem aLineItem(meUnderline, SID_ATTR_CHAR_UNDERLINE); + SvxUnderlineItem aLineItem(meUnderline, SID_ATTR_CHAR_UNDERLINE); + //modify end>> + mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_UNDERLINE, SFX_CALLMODE_RECORD, &aLineItem, 0L); + } + UpdateFontUnderline(); + //add end + } + //strike out + else if(nId == TBI_STRIKEOUT) + { + EndTracking(); + if(meStrike != STRIKEOUT_NONE && meStrike != STRIKEOUT_DONTKNOW) + meStrike = STRIKEOUT_NONE; + else + meStrike = STRIKEOUT_SINGLE; + SvxCrossedOutItem aStrikeItem(meStrike,SID_ATTR_CHAR_STRIKEOUT); + mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_STRIKEOUT, SFX_CALLMODE_RECORD, &aStrikeItem, 0L); + UpdateFontStrikeOut(); + } + //shadowed + else if(nId == TBI_SHADOWED) + { + EndTracking(); + mbShadow = !mbShadow; + SvxShadowedItem aShadowItem(mbShadow, SID_ATTR_CHAR_SHADOWED); + mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_SHADOWED, SFX_CALLMODE_RECORD, &aShadowItem, 0L); + UpdateFontShadowed(); + } + return 0; +} + + + + +IMPL_LINK(TextPropertyPanel, ToolboxIncDecSelectHdl, ToolBox*, pToolBox) +{ + const sal_uInt16 nId = pToolBox->GetCurItemId(); + + // font size +/- enhancement in sd + switch (maContext.GetCombinedContext()) + { + case CombinedEnumContext(Application_Draw, Context_DrawText): + case CombinedEnumContext(Application_Draw, Context_Text): + case CombinedEnumContext(Application_Draw, Context_Table): + case CombinedEnumContext(Application_Draw, Context_OutlineText): + case CombinedEnumContext(Application_Draw, Context_Draw): + case CombinedEnumContext(Application_Draw, Context_TextObject): + case CombinedEnumContext(Application_Draw, Context_Graphic): + case CombinedEnumContext(Application_Impress, Context_DrawText): + case CombinedEnumContext(Application_Impress, Context_Text): + case CombinedEnumContext(Application_Impress, Context_Table): + case CombinedEnumContext(Application_Impress, Context_OutlineText): + case CombinedEnumContext(Application_Impress, Context_Draw): + case CombinedEnumContext(Application_Impress, Context_TextObject): + case CombinedEnumContext(Application_Impress, Context_Graphic): + if(nId == TBI_INCREASE) + { + EndTracking(); + SfxVoidItem aItem(SID_GROW_FONT_SIZE); + mpBindings->GetDispatcher()->Execute( SID_GROW_FONT_SIZE, SFX_CALLMODE_RECORD, &aItem, 0L ); + } + else if(nId == TBI_DECREASE) + { + EndTracking(); + SfxVoidItem aItem(SID_SHRINK_FONT_SIZE); + mpBindings->GetDispatcher()->Execute( SID_SHRINK_FONT_SIZE, SFX_CALLMODE_RECORD, &aItem, 0L ); + } + break; + + default: + if(nId == TBI_INCREASE) + { + EndTracking(); + mbFocusOnFontSizeCtrl = false; + sal_Int64 iValue = maFontSizeBox.GetValue(); + int iPos = maFontSizeBox.GetValuePos(iValue, FUNIT_NONE); + long nSize = iValue; + if(iPos != LISTBOX_ENTRY_NOTFOUND) + nSize = maFontSizeBox.GetValue(iPos+1 , FUNIT_NONE); + else if(iValue >= 100 && iValue < 105) + nSize = 105; + else if(iValue >= 105 && iValue < 110) + nSize = 110; + else if(iValue < 960) + { + nSize = (nSize / 10) * 10 + 10; + while(maFontSizeBox.GetValuePos(nSize, FUNIT_NONE) == LISTBOX_ENTRY_NOTFOUND) + nSize += 10; + } + else + { + nSize = iValue; + } + + float fSize = (float)nSize / 10; + + SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric(); + SvxFontHeightItem aItem( CalcToUnit( fSize, eUnit ), 100, SID_ATTR_CHAR_FONTHEIGHT ) ; + + mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L ); + mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false); + //add , update ASAP + maFontSizeBox.SetValue( nSize ); + if(nSize >= 960) + { + mpToolBoxIncDec->EnableItem(TBI_INCREASE,false); + mpToolBoxIncDec->EnableItem(TBI_DECREASE,true); + } + else if(nSize <= 60) + { + mpToolBoxIncDec->EnableItem(TBI_INCREASE,true); + mpToolBoxIncDec->EnableItem(TBI_DECREASE,false); + } + else + { + mpToolBoxIncDec->EnableItem(TBI_INCREASE,true); + mpToolBoxIncDec->EnableItem(TBI_DECREASE,true); + } + //add end + } + else if(nId == TBI_DECREASE) + { + EndTracking(); + mbFocusOnFontSizeCtrl = false; + sal_Int64 iValue = maFontSizeBox.GetValue(); + int iPos = maFontSizeBox.GetValuePos(iValue, FUNIT_NONE); + long nSize = iValue; + if(iPos != LISTBOX_ENTRY_NOTFOUND) + nSize = maFontSizeBox.GetValue(iPos-1 , FUNIT_NONE); + else if(iValue > 100 && iValue <= 105) + nSize = 100; + else if(iValue > 105 && iValue <= 110) + nSize = 105; + else if(iValue > 960) + { + nSize = 960; + } + else if(iValue > 60) + { + nSize = (nSize / 10) * 10 ; + while(maFontSizeBox.GetValuePos(nSize, FUNIT_NONE) == LISTBOX_ENTRY_NOTFOUND) + nSize -= 10; + } + else + { + nSize = iValue; + } + + float fSize = (float)nSize / 10; + + SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric(); + SvxFontHeightItem aItem( CalcToUnit( fSize, eUnit ), 100, SID_ATTR_CHAR_FONTHEIGHT ) ; + + mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L ); + mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false); + //add + maFontSizeBox.SetValue( nSize ); + if(nSize >= 960) + { + mpToolBoxIncDec->EnableItem(TBI_INCREASE,false); + mpToolBoxIncDec->EnableItem(TBI_DECREASE,true); + } + else if(nSize <= 60) + { + mpToolBoxIncDec->EnableItem(TBI_INCREASE,true); + mpToolBoxIncDec->EnableItem(TBI_DECREASE,false); + } + else + { + mpToolBoxIncDec->EnableItem(TBI_INCREASE,true); + mpToolBoxIncDec->EnableItem(TBI_DECREASE,true); + } + //add end + } + } + return 0; +} + + + +IMPL_LINK(TextPropertyPanel, ToolBoxUnderlineClickHdl, ToolBox*, pToolBox) +{ + const sal_uInt16 nId = pToolBox->GetCurItemId(); + OSL_ASSERT(nId == TBI_UNDERLINE); + if(nId == TBI_UNDERLINE) + { + pToolBox->SetItemDown( nId, true ); + maUnderlinePopup.Rearrange(meUnderline); + maUnderlinePopup.Show(*pToolBox); + + } + return 0L; +} + + + + +IMPL_LINK(TextPropertyPanel, ToolBoxFontColorDropHdl,ToolBox*, pToolBox) +{ + const sal_uInt16 nId = pToolBox->GetCurItemId(); + if(nId == TBI_FONTCOLOR) + { + meColorType = FONT_COLOR; + + pToolBox->SetItemDown( nId, true ); + + maFontColorPopup.Show(*pToolBox); + maFontColorPopup.SetCurrentColor(maColor, mbColorAvailable); + } + return 0; +} + + + + +IMPL_LINK(TextPropertyPanel, ToolBoxSwScriptSelectHdl, ToolBox*, pToolBox) +{ + const sal_uInt16 nId = pToolBox->GetCurItemId(); + if( nId == TBI_SUPER_SW ) + { + if(meEscape != SVX_ESCAPEMENT_SUPERSCRIPT) + { + meEscape = SVX_ESCAPEMENT_SUPERSCRIPT; + SvxEscapementItem aSupItem(DFLT_ESC_SUPER, DFLT_ESC_PROP, SID_ATTR_CHAR_ESCAPEMENT); + mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aSupItem, 0L ); + } + else + { + meEscape = SVX_ESCAPEMENT_OFF; + SvxEscapementItem aNoneItem(0, 100, SID_ATTR_CHAR_ESCAPEMENT); + mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aNoneItem, 0L ); + } + } + else if(TBI_SUB_SW == nId) + { + if(meEscape != SVX_ESCAPEMENT_SUBSCRIPT) + { + meEscape = (SvxEscapement)SVX_ESCAPEMENT_SUBSCRIPT; + SvxEscapementItem aSubItem(DFLT_ESC_SUB, DFLT_ESC_PROP, SID_ATTR_CHAR_ESCAPEMENT); + mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aSubItem, 0L ); + } + else + { + meEscape = SVX_ESCAPEMENT_OFF; + SvxEscapementItem aNoneItem(0, 100, SID_ATTR_CHAR_ESCAPEMENT); + mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aNoneItem, 0L ); + } + } + UpdateFontScript(); + + return 0; +} + + + + +IMPL_LINK(TextPropertyPanel, ToolBoxScriptSelectHdl, ToolBox*, pToolBox) +{ + const sal_uInt16 nId = pToolBox->GetCurItemId(); + if( nId == TBI_SUPER ) + { + mbSuper = !mbSuper; + SfxBoolItem aSupItem(SID_SET_SUPER_SCRIPT, mbSuper); + mpBindings->GetDispatcher()->Execute( SID_SET_SUPER_SCRIPT, SFX_CALLMODE_RECORD, &aSupItem, 0L ); + } + else if(TBI_SUB == nId) + { + + mbSub = !mbSub; + SfxBoolItem aSubItem(SID_SET_SUB_SCRIPT, mbSub ); + mpBindings->GetDispatcher()->Execute( SID_SET_SUB_SCRIPT, SFX_CALLMODE_RECORD, &aSubItem, 0L ); + } + UpdateFontScript(); + return 0; +} + + + + +IMPL_LINK(TextPropertyPanel, ToolBoxHighlightDropHdl, ToolBox*, pToolBox) +{ + const sal_uInt16 nId = pToolBox->GetCurItemId(); + if(nId == TBI_HIGHLIGHT) + { + meColorType = BACK_COLOR; + + pToolBox->SetItemDown( nId, true ); + maBrushColorPopup.Show(*pToolBox); + maBrushColorPopup.SetCurrentColor(maBackColor, mbBackColorAvailable); + + } + return 0; +} + + + +IMPL_LINK(TextPropertyPanel, SpacingClickHdl, ToolBox*, pToolBox) +{ + const sal_uInt16 nId = pToolBox->GetCurItemId(); + OSL_ASSERT(nId == TBI_SPACING); + if(nId == TBI_SPACING) + { + pToolBox->SetItemDown( nId, true ); + maCharSpacePopup.Rearrange(mbKernLBAvailable,mbKernAvailable,mlKerning); + maCharSpacePopup.Show(*pToolBox); + + } + return 0L; +} + + + + +IMPL_LINK( TextPropertyPanel, ImplPopupModeEndHdl, FloatingWindow*, EMPTYARG ) +{ + return 0; +} + + + + + + + + +void TextPropertyPanel::NotifyItemUpdate ( + const sal_uInt16 nSID, + const SfxItemState eState, + const SfxPoolItem* pState) +{ + switch(nSID) + { + case SID_ATTR_CHAR_FONT: + if ( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxFontItem) ) + { + mpFontNameBox->Enable(); + const SvxFontItem* pFontItem = (const SvxFontItem*)pState; + mpFontNameBox->SetText( pFontItem->GetFamilyName() ); + } + else + { + mpFontNameBox->SetText( String() ); + if (SFX_ITEM_DISABLED == eState) + { + mpFontNameBox->Disable(); + } + } + break; + case SID_ATTR_CHAR_FONTHEIGHT: + if ( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxFontHeightItem) ) + { + mpHeightItem = (SvxFontHeightItem*)pState;//const SvxFontHeightItem* + SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric(); + long iValue = (long)CalcToPoint( mpHeightItem->GetHeight(), eUnit, 10 ); + mpToolBoxIncDec->Enable(); + + // font size +/- enhancement in sd + switch(maContext.GetCombinedContext()) + { + case CombinedEnumContext(Application_Draw, Context_DrawText): + case CombinedEnumContext(Application_Draw, Context_Text): + case CombinedEnumContext(Application_Draw, Context_Table): + case CombinedEnumContext(Application_Draw, Context_OutlineText): + case CombinedEnumContext(Application_Draw, Context_Draw): + case CombinedEnumContext(Application_Draw, Context_TextObject): + case CombinedEnumContext(Application_Draw, Context_Graphic): + case CombinedEnumContext(Application_Impress, Context_DrawText): + case CombinedEnumContext(Application_Impress, Context_Text): + case CombinedEnumContext(Application_Impress, Context_Table): + case CombinedEnumContext(Application_Impress, Context_OutlineText): + case CombinedEnumContext(Application_Impress, Context_Draw): + case CombinedEnumContext(Application_Impress, Context_TextObject): + case CombinedEnumContext(Application_Impress, Context_Graphic): + break; + + default: + if(iValue > 60 && iValue < 960 ) + { + mpToolBoxIncDec->EnableItem(TBI_INCREASE,true); + mpToolBoxIncDec->EnableItem(TBI_DECREASE,true); + } + else if (iValue <= 60) + { + mpToolBoxIncDec->EnableItem(TBI_INCREASE,true); + mpToolBoxIncDec->EnableItem(TBI_DECREASE,false); + } + else if (iValue >= 960) + { + mpToolBoxIncDec->EnableItem(TBI_INCREASE,false); + mpToolBoxIncDec->EnableItem(TBI_DECREASE,true); + } + } + mpToolBoxIncDec->SetItemState(TBI_INCREASE, STATE_NOCHECK); + mpToolBoxIncDec->SetItemState(TBI_DECREASE, STATE_NOCHECK); + + if( mbFocusOnFontSizeCtrl ) + return; + + maFontSizeBox.Enable( ); + maFontSizeBox.SetValue( iValue ); + maFontSizeBox.LoseFocus(); + } + else + { + mpHeightItem = NULL; + maFontSizeBox.SetText( String() ); + //increase decrease diabled when multi-seletion have different font size + + // font size +/- enhancement in sd + switch(maContext.GetCombinedContext()) + { + case CombinedEnumContext(Application_Draw, Context_DrawText): + case CombinedEnumContext(Application_Draw, Context_Text): + case CombinedEnumContext(Application_Draw, Context_Table): + case CombinedEnumContext(Application_Draw, Context_OutlineText): + case CombinedEnumContext(Application_Draw, Context_Draw): + case CombinedEnumContext(Application_Draw, Context_TextObject): + case CombinedEnumContext(Application_Draw, Context_Graphic): + case CombinedEnumContext(Application_Impress, Context_DrawText): + case CombinedEnumContext(Application_Impress, Context_Text): + case CombinedEnumContext(Application_Impress, Context_Table): + case CombinedEnumContext(Application_Impress, Context_OutlineText): + case CombinedEnumContext(Application_Impress, Context_Draw): + case CombinedEnumContext(Application_Impress, Context_TextObject): + case CombinedEnumContext(Application_Impress, Context_Graphic): + break; + + default: + mpToolBoxIncDec->Disable(); + } + if ( eState <= SFX_ITEM_READONLY ) + { + maFontSizeBox.Disable( ); + } + } + break; + case SID_ATTR_CHAR_WEIGHT: + mbWeightAvailable = (eState >= SFX_ITEM_DONTCARE); + if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxWeightItem)) + { + const SvxWeightItem* pItem = (const SvxWeightItem*)pState; + meWeight = (FontWeight)pItem->GetValue(); + TextStyleChanged(); + } + else + { + meWeight = WEIGHT_NORMAL; + TextStyleChanged(); + } + break; + case SID_ATTR_CHAR_POSTURE: + mbPostureAvailable = (eState >= SFX_ITEM_DONTCARE); + if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxPostureItem)) + { + const SvxPostureItem* pItem = (const SvxPostureItem*)pState; + meItalic = (FontItalic)pItem->GetValue(); + TextStyleChanged(); + } + else + { + meItalic = ITALIC_NONE; + TextStyleChanged(); + } + break; + case SID_ATTR_CHAR_UNDERLINE: + if( eState >= SFX_ITEM_DEFAULT) //SvxUnderlineItem + { + //<<delete + //if(pState->ISA(SvxTextLineItem)) + //{ + // const SvxTextLineItem* pItem = (const SvxTextLineItem*)pState; + // meUnderline = (FontUnderline)pItem->GetValue(); + // //add , need to record the underline's color, if not the color will turn to auto + // meUnderlineColor = pItem->GetColor(); + // //add end + //} + //else + //delete end>> + if(pState->ISA(SvxUnderlineItem)) + { + const SvxUnderlineItem* pItem = (const SvxUnderlineItem*)pState; + meUnderline = (FontUnderline)pItem->GetValue(); + //add + meUnderlineColor = pItem->GetColor(); + //add end + } + TextStyleChanged(); + } + else + { + meUnderline = UNDERLINE_NONE; + TextStyleChanged(); + } + break; + case SID_ATTR_CHAR_SHADOWED: + if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxShadowedItem)) + { + const SvxShadowedItem* pItem = (const SvxShadowedItem*)pState; + mbShadow = pItem->GetValue(); + TextStyleChanged(); + } + else + { + mbShadow = false; + TextStyleChanged(); + } + break; + case SID_ATTR_CHAR_STRIKEOUT: + if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxCrossedOutItem)) + { + const SvxCrossedOutItem* pItem = (const SvxCrossedOutItem*)pState; + meStrike = (FontStrikeout)pItem->GetValue(); + + TextStyleChanged(); + } + else + { + meStrike = STRIKEOUT_NONE; + TextStyleChanged(); + } + break; + case SID_ATTR_CHAR_COLOR: + if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxColorItem)) + { + const SvxColorItem* pItem = (const SvxColorItem*)pState; + maColor = pItem->GetValue(); + mbColorAvailable = true; + if (mpFontColorUpdater) + mpFontColorUpdater->Update(maColor); + } + else + { + mbColorAvailable = false; + maColor.SetColor(COL_AUTO); + if (mpFontColorUpdater) + mpFontColorUpdater->Update(maColor); + } + break; + case SID_ATTR_BRUSH_CHAR: + if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxBrushItem)) + { + const SvxBrushItem* pItem = (const SvxBrushItem*)pState; + maBackColor = pItem->GetColor(); + mbBackColorAvailable = true; + if (mpHighlightUpdater) + mpHighlightUpdater->Update(maBackColor); + } + else + { + mbBackColorAvailable = false; + maBackColor.SetColor(COL_AUTO); + if (mpHighlightUpdater) + mpHighlightUpdater->Update(maBackColor); + } + break; + case SID_ATTR_CHAR_ESCAPEMENT: + if( eState == SFX_ITEM_AVAILABLE) + { + if( pState->ISA(SvxEscapementItem)) + { + const SvxEscapementItem* pItem = (const SvxEscapementItem *)pState; + short nEsc = pItem->GetEsc(); + if(nEsc == 0) + meEscape = SVX_ESCAPEMENT_OFF; + else if(nEsc > 0) + meEscape = SVX_ESCAPEMENT_SUPERSCRIPT; + else + meEscape = SVX_ESCAPEMENT_SUBSCRIPT; + } + else + { + meEscape = SVX_ESCAPEMENT_OFF; + } + TextStyleChanged(); + } + else if(eState == SFX_ITEM_DISABLED) + { + mpToolBoxScriptSw->EnableItem(TBI_SUPER,false); + mpToolBoxScriptSw->EnableItem(TBI_SUB,false); + } + else + { + meEscape = SVX_ESCAPEMENT_OFF; + TextStyleChanged(); + } + break; + case SID_SET_SUB_SCRIPT: + if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SfxBoolItem)) + { + const SfxBoolItem* pItem = (const SfxBoolItem*)pState; + mbSub = pItem->GetValue(); + TextStyleChanged(); + } + else + { + mbSub = false; + TextStyleChanged(); + } + break; + case SID_SET_SUPER_SCRIPT: + if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SfxBoolItem)) + { + const SfxBoolItem* pItem = (const SfxBoolItem*)pState; + mbSuper = pItem->GetValue(); + TextStyleChanged(); + } + else + { + mbSuper = false; + TextStyleChanged(); + } + break; + case SID_ATTR_CHAR_KERNING: + if ( SFX_ITEM_AVAILABLE == eState ) + { + mbKernLBAvailable = true; + + if(pState->ISA(SvxKerningItem)) + { + const SvxKerningItem* pKerningItem = (const SvxKerningItem*)pState; + mlKerning = (long)pKerningItem->GetValue(); + mbKernAvailable = true; + } + else + { + mlKerning = 0; + mbKernAvailable =false; + } + } + else if (SFX_ITEM_DISABLED == eState) + { + mbKernLBAvailable = false; + mbKernAvailable = false; + mlKerning = 0; + } + else + { + mbKernLBAvailable = true; + mbKernAvailable = false; + mlKerning = 0; + } + break; + + // font size +/- enhancement in sd + case SID_SHRINK_FONT_SIZE: + case SID_GROW_FONT_SIZE: + switch(maContext.GetCombinedContext()) + { + case CombinedEnumContext(Application_Draw, Context_DrawText): + case CombinedEnumContext(Application_Draw, Context_Text): + case CombinedEnumContext(Application_Draw, Context_Table): + case CombinedEnumContext(Application_Draw, Context_OutlineText): + case CombinedEnumContext(Application_Draw, Context_Draw): + case CombinedEnumContext(Application_Draw, Context_TextObject): + case CombinedEnumContext(Application_Draw, Context_Graphic): + case CombinedEnumContext(Application_Impress, Context_DrawText): + case CombinedEnumContext(Application_Impress, Context_Text): + case CombinedEnumContext(Application_Impress, Context_Table): + case CombinedEnumContext(Application_Impress, Context_OutlineText): + case CombinedEnumContext(Application_Impress, Context_Draw): + case CombinedEnumContext(Application_Impress, Context_TextObject): + case CombinedEnumContext(Application_Impress, Context_Graphic): + if(eState == SFX_ITEM_DISABLED) + { + mpToolBoxIncDec->Disable(); + } + else + { + mpToolBoxIncDec->Enable(); + } + break; + } + break; + } +} + + + + +void TextPropertyPanel::TextStyleChanged() +{ + if( !mbWeightAvailable ) + mpToolBoxFont->EnableItem(TBI_BOLD,false); + else + mpToolBoxFont->EnableItem(TBI_BOLD,true); + + if(!mbPostureAvailable ) + mpToolBoxFont->EnableItem(TBI_ITALIC,false); + else + mpToolBoxFont->EnableItem(TBI_ITALIC,true); + + UpdateFontBold(); + UpdateFontItalic(); + UpdateFontUnderline(); + UpdateFontStrikeOut(); + UpdateFontShadowed(); + UpdateFontScript(); +} + + + + +void TextPropertyPanel::UpdateFontBold() +{ + if( meWeight == WEIGHT_BOLD ) + { + mpToolBoxFont->SetItemState(TBI_BOLD, STATE_CHECK); + } + else + { + mpToolBoxFont->SetItemState(TBI_BOLD, STATE_NOCHECK); + } +} +void TextPropertyPanel::UpdateFontItalic() +{ + if(meItalic == ITALIC_NORMAL) + { + mpToolBoxFont->SetItemState(TBI_ITALIC, STATE_CHECK); + } + else + { + mpToolBoxFont->SetItemState(TBI_ITALIC, STATE_NOCHECK); + } +} +void TextPropertyPanel::UpdateFontUnderline() +{ + if(meUnderline == UNDERLINE_NONE) + { + mpToolBoxFont->SetItemState(TBI_UNDERLINE, STATE_NOCHECK); + } + else + { + mpToolBoxFont->SetItemState(TBI_UNDERLINE, STATE_CHECK); + } +} +void TextPropertyPanel::UpdateFontStrikeOut() +{ + if(meStrike != STRIKEOUT_NONE && meStrike != STRIKEOUT_DONTKNOW) + { + mpToolBoxFont->SetItemState(TBI_STRIKEOUT, STATE_CHECK); + } + else + { + mpToolBoxFont->SetItemState(TBI_STRIKEOUT, STATE_NOCHECK); + } +} +void TextPropertyPanel::UpdateFontShadowed() +{ + if(mbShadow) + { + mpToolBoxFont->SetItemState(TBI_SHADOWED, STATE_CHECK); + } + else + { + mpToolBoxFont->SetItemState(TBI_SHADOWED, STATE_NOCHECK); + } +} +void TextPropertyPanel::UpdateFontScript() +{ + //script for sw + mpToolBoxScriptSw->EnableItem(TBI_SUPER,true); + mpToolBoxScriptSw->EnableItem(TBI_SUB,true); + if(meEscape == SVX_ESCAPEMENT_SUPERSCRIPT) + { + mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_CHECK); + mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_NOCHECK); + } + else if(meEscape == SVX_ESCAPEMENT_SUBSCRIPT) + { + mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_NOCHECK); + mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_CHECK); + } + else + { + mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_NOCHECK); + mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_NOCHECK); + } + + //script for sc sd + mpToolBoxScript->EnableItem(TBI_SUPER,true); + mpToolBoxScript->EnableItem(TBI_SUB,true); + if(mbSuper) + { + mpToolBoxScript->SetItemState(TBI_SUPER, STATE_CHECK); + mpToolBoxScript->SetItemState(TBI_SUB, STATE_NOCHECK); + } + else if(mbSub) + { + mpToolBoxScript->SetItemState(TBI_SUPER, STATE_NOCHECK); + mpToolBoxScript->SetItemState(TBI_SUB, STATE_CHECK); + } + else + { + mpToolBoxScript->SetItemState(TBI_SUPER, STATE_NOCHECK); + mpToolBoxScript->SetItemState(TBI_SUB, STATE_NOCHECK); + } +} + +Color TextPropertyPanel::GetFontColor (void) const +{ + return maColor; +} + +void TextPropertyPanel::SetFontColor ( + const String& /*rsColorName*/, + const Color aColor) +{ + SvxColorItem aColorItem(aColor, SID_ATTR_CHAR_COLOR); + mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_COLOR, SFX_CALLMODE_RECORD, &aColorItem, 0L); + maColor = aColor; +} + +Color TextPropertyPanel::GetBrushColor (void) const +{ + return maBackColor; +} + +void TextPropertyPanel::SetBrushColor ( + const String& /*rsColorName*/, + const Color aColor) +{ + SvxBrushItem aBrushItem(aColor, SID_ATTR_BRUSH_CHAR); + mpBindings->GetDispatcher()->Execute(SID_ATTR_BRUSH_CHAR, SFX_CALLMODE_RECORD, &aBrushItem, 0L); + maBackColor = aColor; +} + +Color& TextPropertyPanel::GetUnderlineColor() +{ + return meUnderlineColor; +} + +void TextPropertyPanel::SetUnderline(FontUnderline eUnderline) +{ + meUnderline = eUnderline; +} + +} } // end of namespace svx::sidebar diff --git a/svx/source/sidebar/text/TextPropertyPanel.hrc b/svx/source/sidebar/text/TextPropertyPanel.hrc new file mode 100644 index 000000000000..bfa0c821644b --- /dev/null +++ b/svx/source/sidebar/text/TextPropertyPanel.hrc @@ -0,0 +1,199 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "svx/dialogs.hrc" + +#define VS_SPACING_WIDTH 80 +#define CUSTOM_HEIGHT CBOX_HEIGHT + MBOX_HEIGHT + POPUPPANEL_MARGIN_LARGE * 3 + POPUPPANEL_MARGIN_SMALL * 2 + TEXT_HEIGHT * 2 +#define CUSTOM_WIDTH VS_SPACING_WIDTH - 8 +#define CUSTOM_X POPUPPANEL_MARGIN_LARGE + OFFSET_X + 1 +#define CUSTOM_Y OFFSET_Y + POPUPPANEL_MARGIN_SMALL * 3 + 15 * 6 + TEXT_HEIGHT +#define VS_UNDERLINE_WIDTH 57 +#define VS_UNDERLINE_HEIGHT 12 * 10 +//#define FT_TEST 1 +#define CB_SBFONT_FONT 2 +#define MB_SBFONT_FONTSIZE 3 +#define TB_FONT 4 +#define TB_INCREASE_DECREASE 5 +#define TB_FONTCOLOR 6 +#define TB_SCRIPT_SW 7 +#define TB_HIGHLIGHT 8 +#define TB_SPACING 9 +#define TB_SCRIPT 10 + + +#define IMG_INCREASE 11 +#define IMG_DECREASE 13 +#define IMG_BOLD 15 +#define IMG_ITALIC 17 +#define IMG_UNDERLINE 19 +#define IMG_STRIKEOUT 21 +#define IMG_SHADOWED 23 +#define IMG_FONTCOLOR 25 +#define IMG_SUPSCRIPT 27 +#define IMG_SUBSCRIPT 29 +//#define IMG_SPACING 31 +#define IMG_HIGHLIGHT 33 + +#define TBI_FONTCOLOR 50 +#define TBI_BOLD 51 +#define TBI_ITALIC 52 +#define TBI_UNDERLINE 53 +#define TBI_STRIKEOUT 54 +#define TBI_SHADOWED 55 +#define TBI_INCREASE 56 +#define TBI_DECREASE 57 +#define TBI_HIGHLIGHT 58 +#define TBI_SUPER 59 +#define TBI_SUB 60 +#define TBI_SUPER_SW 61 +#define TBI_SUB_SW 62 +#define TBI_SPACING 63 + +#define IMG_SPACING_D 71 + +//popup window underline +#define VS_UNDERLINE 1 +#define PB_OPTIONS 2 +#define BMP_UNDERLINE_MORE 3 + +#define IMG_SINGLE 10 +#define IMG_DOUBLE 11 +#define IMG_BOLD2 12 +#define IMG_DOT 13 +#define IMG_DOT_BOLD 14 +#define IMG_DASH 15 +#define IMG_DASH_LONG 16 +#define IMG_DASH_DOT 17 +#define IMG_DASH_DOT_DOT 18 +#define IMG_WAVE 19 + +#define STR_SINGLE 20 +#define STR_DOUBLE 21 +#define STR_BOLD 22 +#define STR_DOT 23 +#define STR_DOT_BOLD 24 +#define STR_DASH 25 +#define STR_DASH_LONG 26 +#define STR_DASH_DOT 27 +#define STR_DASH_DOT_DOT 28 +#define STR_WAVE 29 + +#define IMG_SINGLE_SEL 40 +#define IMG_DOUBLE_SEL 41 +#define IMG_BOLD2_SEL 42 +#define IMG_DOT_SEL 43 +#define IMG_DOT_BOLD_SEL 44 +#define IMG_DASH_SEL 45 +#define IMG_DASH_LONG_SEL 46 +#define IMG_DASH_DOT_SEL 47 +#define IMG_DASH_DOT_DOT_SEL 48 +#define IMG_WAVE_SEL 49 + +//popup window font color +#define VS_FONT_COLOR 1 +#define STR_AUTOMATICE 2 + +//POPUP WINDOW OF SPACING +#define VS_SPACING 1 + +#define CT_BORDER 7 +#define LB_KERNING 8 +#define ED_KERNING 9 + +#define FT_SPACING 18 +#define FT_BY 19 +#define FT_LASTCUSTOM 20 + +#define IMG_NORMAL 31 +#define IMG_VERY_TIGHT 32 +#define IMG_TIGHT 33 +#define IMG_LOOSE 34 +#define IMG_VERY_LOOSE 35 +#define IMG_CUSTOM 36 +#define IMG_CUSTOM_GRAY 37 + +#define IMG_NORMAL_S 51 +#define IMG_VERY_TIGHT_S 52 +#define IMG_TIGHT_S 53 +#define IMG_LOOSE_S 54 +#define IMG_VERY_LOOSE_S 55 + +#define STR_VERY_TIGHT 61 +#define STR_TIGHT 62 +#define STR_NORMAL 63 +#define STR_LOOSE 64 +#define STR_VERY_LOOSE 65 +#define STR_CUSTOM 66 + +#define STR_VERY_TIGHT_TIP 67 +#define STR_TIGHT_TIP 68 +#define STR_NORMAL_TIP 69 +#define STR_LOOSE_TIP 70 +#define STR_VERY_LOOSE_TIP 71 + +#define STR_CUSTOM_C_TIP 72 +#define STR_CUSTOM_E_TIP 73 +#define STR_PT 74 +#define STR_QH_BOLD 75 +#define STR_QH_ITALIC 76 +#define STR_QH_UNDERLINE 77 + +//help ids +#define HID_COMBO_FONT_NAME "SVX_HID_COMBO_FONT_NAME" +#define HID_METRIC_FONT_SIZE "SVX_HID_METRIC_FONT_SIZE" +#define HID_TB_INCREASE_DECREASE "SVX_HID_TB_INCREASE_DECREASE" +#define HID_TBI_INCREASE "SVX_HID_TBI_INCREASE" +#define HID_TBI_DECREASE "SVX_HID_TBI_DECREASE" +#define HID_TB_FONT "SVX_HID_TB_FONT" +#define HID_TBI_FONT_BOLD "SVX_HID_TBI_FONT_BOLD" +#define HID_TBI_FONT_ITALIC "SVX_HID_TBI_FONT_ITALIC" +#define HID_TBI_FONT_UNDERLINE "SVX_HID_TBI_FONT_UNDERLINE" +#define HID_TBI_FONT_STRIKEOUT "SVX_HID_TBI_FONT_STRIKEOUT" +#define HID_TBI_FONT_SHADOWED "SVX_HID_TBI_FONT_SHADOWED" +#define HID_TB_COLOR "SVX_HID_TB_COLOR" +#define HID_TBI_COLOR "SVX_HID_TBI_COLOR" +#define HID_TB_SCRIPT "SVX_HID_TB_SCRIPT" +#define HID_TBI_SCRIPT_SUPER "SVX_HID_TBI_SCRIPT_SUPER" +#define HID_TBI_SCRIPT_SUB "SVX_HID_TBI_SCRIPT_SUB" +#define HID_TB_SCRIPT_SW "SVX_HID_TB_SCRIPT_SW" +#define HID_TBI_SCRIPT_SW_SUPER "SVX_HID_TBI_SCRIPT_SW_SUPER" +#define HID_TBI_SCRIPT_SW_SUB "SVX_HID_TBI_SCRIPT_SW_SUB" +#define HID_TB_SPACING "SVX_HID_TB_SPACING" +#define HID_TBI_SPACING "SVX_HID_TBI_SPACING" +#define HID_TB_HIGHLIGHT "SVX_HID_TB_HIGHLIGHT" +#define HID_TBI_HIGHLIGHT "SVX_HID_TBI_HIGHLIGHT" + +#define HID_UNDERLINE_VS "SVX_HID_UNDERLINE_VS" +#define HID_UNDERLINE_BTN "SVX_HID_UNDERLINE_BTN" + +#define HID_COLOR_VS "SVX_HID_COLOR_VS" + +#define HID_SPACING_TB_VERY_LOOSE "SVX_HID_SPACING_TB_VERY_LOOSE" +#define HID_SPACING_TBI_VERY_LOOSE "SVX_HID_SPACING_TBI_VERY_LOOSE" +#define HID_SPACING_TB_LOOSE "SVX_HID_SPACING_TB_LOOSE" +#define HID_SPACING_TBI_LOOSE "SVX_HID_SPACING_TBI_LOOSE" +#define HID_SPACING_TB_NORMAL "SVX_HID_SPACING_TB_NORMAL" +#define HID_SPACING_TBI_NORMAL "SVX_HID_SPACING_TBI_NORMAL" +#define HID_SPACING_TB_TIGHT "SVX_HID_SPACING_TB_TIGHT" +#define HID_SPACING_TBI_TIGHT "SVX_HID_SPACING_TBI_TIGHT" +#define HID_SPACING_TB_VERY_TIGHT "SVX_HID_SPACING_TB_VERY_TIGHT" +#define HID_SPACING_TBI_VERY_TIGHT "SVX_HID_SPACING_TBI_VERY_TIGHT" +#define HID_SPACING_TB_CUSTOM "SVX_HID_SPACING_TB_CUSTOM" +#define HID_SPACING_TBI_CUSTOM "SVX_HID_SPACING_TBI_CUSTOM" +#define HID_SPACING_CB_KERN "SVX_HID_SPACING_CB_KERN" +#define HID_SPACING_MB_KERN "SVX_HID_SPACING_MB_KERN" diff --git a/svx/source/sidebar/text/TextPropertyPanel.hxx b/svx/source/sidebar/text/TextPropertyPanel.hxx new file mode 100644 index 000000000000..546eb72b6157 --- /dev/null +++ b/svx/source/sidebar/text/TextPropertyPanel.hxx @@ -0,0 +1,230 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SVX_SIDEBAR_TEXT_PROPERTY_PAGE_HXX +#define SVX_SIDEBAR_TEXT_PROPERTY_PAGE_HXX + +#include <vcl/ctrl.hxx> +#include <sfx2/sidebar/SidebarPanelBase.hxx> +#include <sfx2/sidebar/ControllerItem.hxx> +#include <sfx2/sidebar/IContextChangeReceiver.hxx> + +#include <svtools/ctrlbox.hxx> +#include <svx/tbxcolorupdate.hxx> +#include <editeng/svxenum.hxx> +#include <editeng/fhgtitem.hxx> + +//#include <com/sun/star/ui/XUIElement.hpp> +#include <com/sun/star/ui/XSidebar.hpp> + +#include <boost/scoped_ptr.hpp> +#include "TextCharacterSpacingPopup.hxx" +#include "TextUnderlinePopup.hxx" +#include <svx/sidebar/ColorPopup.hxx> +#include <vcl/vclenum.hxx> + +class FloatingWindow; +class ToolBox; + +namespace svx { namespace sidebar { + +class SvxSBFontNameBox; +class PopupControl; +class PopupContainer; + +class TextPropertyPanel + : public Control, + public ::sfx2::sidebar::IContextChangeReceiver, + public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface +{ +public: + static TextPropertyPanel* Create ( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings, + const cssu::Reference<css::ui::XSidebar>& rxSidebar); + + virtual void DataChanged (const DataChangedEvent& rEvent); + SfxBindings* GetBindings(); + ::sfx2::sidebar::ControllerItem& GetSpaceController(); + long GetSelFontSize(); + void SetSpacing(long nKern); + void EndSpacingPopupMode (void); + void EndUnderlinePopupMode (void); + Color GetFontColor (void) const; + void SetFontColor (const String& rsColorName,const Color aColor); + Color GetBrushColor (void) const; + void SetBrushColor (const String& rsColorName,const Color aColor); + void SetUnderline(FontUnderline eUnderline); + Color& GetUnderlineColor(); + void SetDefaultUnderline(FontUnderline eUnderline); + + + enum ColorType + { + FONT_COLOR = 1, + BACK_COLOR = 2 + }; + + virtual void HandleContextChange ( + const ::sfx2::sidebar::EnumContext aContext); + + virtual void NotifyItemUpdate( + const sal_uInt16 nSId, + const SfxItemState eState, + const SfxPoolItem* pState); + +private: + //ui controls + ::boost::scoped_ptr<SvxSBFontNameBox> mpFontNameBox; + FontSizeBox maFontSizeBox; + ::boost::scoped_ptr<Window> mpToolBoxIncDecBackground; + ::boost::scoped_ptr<ToolBox> mpToolBoxIncDec; + ::boost::scoped_ptr<Window> mpToolBoxFontBackground; + ::boost::scoped_ptr<ToolBox> mpToolBoxFont; + ::boost::scoped_ptr<Window> mpToolBoxFontColorBackground; + ::boost::scoped_ptr<ToolBox> mpToolBoxFontColor; + ::boost::scoped_ptr<Window> mpToolBoxScriptBackground; + ::boost::scoped_ptr<ToolBox> mpToolBoxScript; + ::boost::scoped_ptr<Window> mpToolBoxScriptSwBackground; + ::boost::scoped_ptr<ToolBox> mpToolBoxScriptSw; + ::boost::scoped_ptr<Window> mpToolBoxSpacingBackground; + ::boost::scoped_ptr<ToolBox> mpToolBoxSpacing; + ::boost::scoped_ptr<Window> mpToolBoxHighlightBackground; + ::boost::scoped_ptr<ToolBox> mpToolBoxHighlight; + ::boost::scoped_ptr<ToolboxButtonColorUpdater> mpFontColorUpdater; + ::boost::scoped_ptr<ToolboxButtonColorUpdater> mpHighlightUpdater; + + //control items + ::sfx2::sidebar::ControllerItem maFontNameControl; + ::sfx2::sidebar::ControllerItem maFontSizeControl; + ::sfx2::sidebar::ControllerItem maWeightControl; + ::sfx2::sidebar::ControllerItem maItalicControl; + ::sfx2::sidebar::ControllerItem maUnderlineControl; + ::sfx2::sidebar::ControllerItem maStrikeControl; + ::sfx2::sidebar::ControllerItem maShadowControl; + ::sfx2::sidebar::ControllerItem maFontColorControl; + ::sfx2::sidebar::ControllerItem maScriptControlSw; + ::sfx2::sidebar::ControllerItem maSuperScriptControl; + ::sfx2::sidebar::ControllerItem maSubScriptControl; + ::sfx2::sidebar::ControllerItem maSpacingControl; + ::sfx2::sidebar::ControllerItem maHighlightControl; + ::sfx2::sidebar::ControllerItem maSDFontGrow; + ::sfx2::sidebar::ControllerItem maSDFontShrink; + + //Images + Image maImgIncrease; + Image maImgDecrease; + Image maImgBold; + Image maImgItalic; + Image maImgUnderline; + Image maImgStrike; + Image maImgShadow; + Image maImgFontColor; + Image maImgSupScript; + Image maImgSubScript; + Image maImgHighlight; + + Image maImgNormalIcon; + + FontWeight meWeight; + FontItalic meItalic; + FontUnderline meUnderline; + Color meUnderlineColor; // + bool mbShadow; + FontStrikeout meStrike; + bool mbWeightAvailable; + bool mbPostureAvailable; + Color maColor; + bool mbColorAvailable; + Color maBackColor; + bool mbBackColorAvailable; + ColorType meColorType; + SvxEscapement meEscape; //for sw + bool mbSuper; + bool mbSub; + bool mbKernAvailable; + bool mbKernLBAvailable; + long mlKerning; + SvxFontHeightItem* mpHeightItem; + + const FontList* mpFontList; + bool mbMustDelete; + bool mbFocusOnFontSizeCtrl; + TextCharacterSpacingPopup maCharSpacePopup; + TextUnderlinePopup maUnderlinePopup; + ColorPopup maFontColorPopup; + ColorPopup maBrushColorPopup; + + cssu::Reference<css::frame::XFrame> mxFrame; + ::sfx2::sidebar::EnumContext maContext; + SfxBindings* mpBindings; + cssu::Reference<css::ui::XSidebar> mxSidebar; + + TextPropertyPanel ( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings, + const cssu::Reference<css::ui::XSidebar>& rxSidebar); + virtual ~TextPropertyPanel (void); + + + PopupControl* CreateCharacterSpacingControl (PopupContainer* pParent); + PopupControl* CreateFontColorPopupControl (PopupContainer* pParent); + PopupControl* CreateBrushColorPopupControl (PopupContainer* pParent); + PopupControl* CreateUnderlinePopupControl (PopupContainer* pParent); + DECL_LINK(SpacingClickHdl, ToolBox*); + DECL_LINK(ToolBoxFontColorDropHdl, ToolBox *); //for new color picker + DECL_LINK(ToolBoxHighlightDropHdl, ToolBox *); + DECL_LINK(ToolBoxUnderlineClickHdl, ToolBox* ); + + void Initialize (void); + void SetupIcons (void); + void InitToolBoxFont(); + void InitToolBoxIncDec(); + void InitToolBoxFontColor(); + void InitToolBoxScript(); + void InitToolBoxHighlight(); + void InitToolBoxSpacing(); + + void UpdateFontBold(); + void UpdateFontItalic(); + void UpdateFontUnderline(); + void UpdateFontStrikeOut(); + void UpdateFontShadowed(); + void UpdateFontScript(); + + DECL_LINK(FontSelHdl, FontNameBox *); + DECL_LINK(FontSizeModifyHdl, FontSizeBox *); + DECL_LINK(FontSizeSelHdl, FontSizeBox *); + DECL_LINK(FontSizeLoseFocus, FontSizeBox *); + DECL_LINK(ToolboxFontSelectHandler, ToolBox *); + DECL_LINK(ToolboxIncDecSelectHdl, ToolBox *); + DECL_LINK(ImplPopupModeEndHdl, FloatingWindow* ); + DECL_LINK(ToolBoxSwScriptSelectHdl, ToolBox *); + DECL_LINK(ToolBoxScriptSelectHdl, ToolBox *); + + + + void TextStyleChanged(); + + Image GetIcon (const ::rtl::OUString& rsURL); +}; + +} } // end of namespace ::svx::sidebar + +#endif diff --git a/svx/source/sidebar/text/TextPropertyPanel.src b/svx/source/sidebar/text/TextPropertyPanel.src new file mode 100644 index 000000000000..6ced5c7b10ac --- /dev/null +++ b/svx/source/sidebar/text/TextPropertyPanel.src @@ -0,0 +1,702 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "TextPropertyPanel.hrc" +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include "helpid.hrc" + +#define CONTROL_HEIGHT_FONT_NAME 250 +#define CONTROL_HEIGHT_FONT_SIZE 180 +#define FONTNAME_WIDTH TOOLBOX_ITEM_WIDTH * 2 + TOOLBOX_ITEM_DD_WIDTH +#define FONTSIZE_WIDTH TOOLBOX_ITEM_WIDTH * 2 + +#define TB_SPACE 18 +#define TB_SPACE_V 4 +#define TEXT_WIDTH TOOLBOX_42_42_ITEM_DD_WIDTH + TB_SPACE - 3 + +#define FT_TB_SPACE 1 +#define BK_IMG 20 + +Control RID_SIDEBAR_TEXT_PANEL +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + + Size = MAP_APPFONT( PROPERTYPAGE_WIDTH, SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + TOOLBOX_ITEM_HEIGHT * 2 + CONTROL_SPACING_VERTICAL * 2 + SECTIONPAGE_MARGIN_VERTICAL_BOT ); + HelpID = HID_PROPERTYPANEL_TEXT_SECTION ; + Text = "Text"; + + ComboBox CB_SBFONT_FONT + { + Border = TRUE; + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL , SECTIONPAGE_MARGIN_VERTICAL_TOP ); + Size = MAP_APPFONT ( FONTNAME_WIDTH , CONTROL_HEIGHT_FONT_NAME ); + TabStop = TRUE; + DropDown = TRUE; + HelpID = HID_COMBO_FONT_NAME ; + QuickHelpText [ en-US ] = "Font"; + }; + MetricBox MB_SBFONT_FONTSIZE + { + Border = TRUE; + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + FONTNAME_WIDTH + 2, SECTIONPAGE_MARGIN_VERTICAL_TOP); + Size = MAP_APPFONT ( FONTSIZE_WIDTH - 1, CONTROL_HEIGHT_FONT_SIZE ); + TabStop = TRUE; + DropDown = TRUE; + HelpID = HID_METRIC_FONT_SIZE; + QuickHelpText [ en-US ] = "Font Size"; + }; + + ToolBox TB_INCREASE_DECREASE + { + SVLook = TRUE ; + Pos = MAP_APPFONT ( PROPERTYPAGE_WIDTH - SECTIONPAGE_MARGIN_HORIZONTAL - TOOLBOX_ITEM_WIDTH * 2, SECTIONPAGE_MARGIN_VERTICAL_TOP) ; + Size = MAP_APPFONT ( TOOLBOX_ITEM_WIDTH * 2 ,TOOLBOX_ITEM_HEIGHT ) ; + TabStop = TRUE ; +// HelpID = HID_TB_INCREASE_DECREASE; + HelpID = HID_PPROPERTYPANEL_TEXT_TBX_FONTSIZE_INDE; + Text = "Font Size Adjusting" ; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_INCREASE; + Text [ en-US ] = "Increase Font Size" ; +// HelpID = HID_TBI_INCREASE; + HelpID = HID_PPROPERTYPANEL_TEXT_TBI_INCREASE; + }; + ToolBoxItem + { + Identifier = TBI_DECREASE; + Text [ en-US ] = "Decrease Font Size" ; +// HelpID = HID_TBI_DECREASE; + HelpID = HID_PPROPERTYPANEL_TEXT_TBI_DECREASE; + }; + }; + }; + ToolBox TB_FONT + { + SVLook = TRUE ; + Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL + 1, SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL + 1) ; + Size = MAP_APPFONT ( TOOLBOX_ITEM_WIDTH * 4 + TOOLBOX_ITEM_DD_WIDTH, TOOLBOX_ITEM_HEIGHT ) ; + TabStop = TRUE ; +// HelpID = HID_TB_FONT; + HelpID = HID_PPROPERTYPANEL_TEXT_TBX_FONT; + Text = "Font Effects" ; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_BOLD; + Text [ en-US ] = "Bold" ; +// HelpID = HID_TBI_FONT_BOLD; + HelpID = HID_PPROPERTYPANEL_TEXT_TBI_BOLD; + }; + ToolBoxItem + { + Identifier = TBI_ITALIC; + Text [ en-US ] = "Italic" ; +// HelpID = HID_TBI_FONT_ITALIC; + HelpID = HID_PPROPERTYPANEL_TEXT_TBI_ITALIC; + }; + ToolBoxItem + { + Identifier = TBI_UNDERLINE; + DropDown = TRUE ; + Text [ en-US ] = "Underline" ; +// HelpID = HID_TBI_FONT_UNDERLINE; + HelpID = HID_PPROPERTYPANEL_TEXT_TBI_UNDERLINE; + }; + ToolBoxItem + { + Identifier = TBI_STRIKEOUT; + Text [ en-US ] = "Strikethrough" ; +// HelpID = HID_TBI_FONT_STRIKEOUT; + HelpID = HID_PPROPERTYPANEL_TEXT_TBI_STRIKEOUT; + }; + ToolBoxItem + { + Identifier = TBI_SHADOWED; + Text [ en-US ] = "Shadow" ; +// HelpID = HID_TBI_FONT_SHADOWED; + HelpID = HID_PPROPERTYPANEL_TEXT_TBI_SHADOWED; + }; + }; + }; + + String STR_QH_BOLD + { + Text [ en-US ] = "Bold (Ctrl+B)"; + }; + String STR_QH_ITALIC + { + Text [ en-US ] = "Italic (Ctrl+I)"; + }; + String STR_QH_UNDERLINE + { + Text [ en-US ] = "Underline (Ctrl+U)"; + }; + + + ToolBox TB_FONTCOLOR + { +// HelpID = HID_TB_COLOR; + HelpID = HID_PPROPERTYPANEL_TEXT_TBX_FONT_COLOR; + SVLook = TRUE ; + Pos = MAP_APPFONT (PROPERTYPAGE_WIDTH - SECTIONPAGE_MARGIN_HORIZONTAL - TOOLBOX_ITEM_WIDTH * 2, SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL + 1) ; + Size = MAP_APPFONT (TOOLBOX_ITEM_DD_WIDTH ,TOOLBOX_ITEM_HEIGHT ) ; + TabStop = TRUE ; + Text = "Font Color" ; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_FONTCOLOR ; +// HelpID = HID_TBI_COLOR; + HelpID = HID_PPROPERTYPANEL_TEXT_TBI_FONT_COLOR; + DropDown = TRUE ; + Text [ en-US ] = "Font Color" ; + }; + }; + }; + + ToolBox TB_HIGHLIGHT + { + SVLook = TRUE ; + Pos = MAP_APPFONT (PROPERTYPAGE_WIDTH - SECTIONPAGE_MARGIN_HORIZONTAL - TOOLBOX_ITEM_WIDTH * 2 , SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + (TOOLBOX_ITEM_HEIGHT + 2) + CONTROL_SPACING_VERTICAL * 2 + 1) ; + Size = MAP_APPFONT (TOOLBOX_ITEM_DD_WIDTH ,TOOLBOX_ITEM_HEIGHT ) ; + TabStop = TRUE ; +// HelpID = HID_TB_HIGHLIGHT; + HelpID = HID_PPROPERTYPANEL_TEXT_TBX_HIGHLIGHT_COLOR; + Text = "Highlight Color" ; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_HIGHLIGHT ; +// HelpID = HID_TBI_HIGHLIGHT; + HelpID = HID_PPROPERTYPANEL_TEXT_TBI_HIGHLIGHT_COLOR; + DropDown = TRUE ; + Text [ en-US ] = "Highlight Color" ; + }; + }; + }; + + ToolBox TB_SCRIPT_SW + { + SVLook = TRUE ; + Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL + 1 , SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL * 2 + (TOOLBOX_ITEM_HEIGHT + 2) + 1) ; + Size = MAP_APPFONT (TOOLBOX_ITEM_WIDTH * 2 ,TOOLBOX_ITEM_HEIGHT ) ; + TabStop = TRUE ; +// HelpID = HID_TB_SCRIPT_SW; + HelpID = HID_PPROPERTYPANEL_TEXT_TBX_SCRIPT_SW; + Text = "Font Position" ; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_SUPER_SW; + Text [ en-US ] = "Superscript" ; +// HelpID = HID_TBI_SCRIPT_SW_SUPER; + HelpID = HID_PPROPERTYPANEL_TEXT_TBI_SUPER_SW; + }; + ToolBoxItem + { + Identifier = TBI_SUB_SW; + Text [ en-US ] = "Subscript" ; +// HelpID = HID_TBI_SCRIPT_SW_SUB; + HelpID = HID_PPROPERTYPANEL_TEXT_TBI_SUB_SW; + }; + }; + }; + ToolBox TB_SCRIPT + { + SVLook = TRUE ; + Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL + 1 , SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL * 2 + (TOOLBOX_ITEM_HEIGHT + 2) + 1) ; + Size = MAP_APPFONT (TOOLBOX_ITEM_WIDTH * 2 ,TOOLBOX_ITEM_HEIGHT ) ; + TabStop = TRUE ; +// HelpID = HID_TB_SCRIPT; + HelpID = HID_PPROPERTYPANEL_TEXT_TBX_SCRIPT; + Text = "Font Position" ; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_SUPER; + Text [ en-US ] = "Superscript" ; +// HelpID = HID_TBI_SCRIPT_SUPER; + HelpID = HID_PPROPERTYPANEL_TEXT_TBI_SUPER; + }; + ToolBoxItem + { + Identifier = TBI_SUB; + Text [ en-US ] = "Subscript" ; +// HelpID = HID_TBI_SCRIPT_SUB; + HelpID = HID_PPROPERTYPANEL_TEXT_TBI_SUB; + }; + }; + }; + + ToolBox TB_SPACING + { + SVLook = TRUE ; + Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL + 1 + TOOLBOX_ITEM_WIDTH * 2 + 4 , SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL * 2 + (TOOLBOX_ITEM_HEIGHT + 2) + 1) ; + Size = MAP_APPFONT (TOOLBOX_24_16_ITEM_DD_WIDTH, TOOLBOX_24_16_ITEM_HEIGHT ) ; + TabStop = TRUE ; + HelpID = HID_TB_SPACING; + Text = "Character Spacing" ; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_SPACING; + DropDown = TRUE ; + Text [ en-US ] = "Character Spacing" ; + HelpID = HID_TBI_SPACING; + }; + }; + }; + + Image IMG_INCREASE + { + ImageBitmap = Bitmap{File = "symphony/enlarge font.png";}; + // MaskColor = IMAGE_MASK_COLOR; + }; + Image IMG_DECREASE + { + ImageBitmap = Bitmap{File = "symphony/decrease font.png";}; + }; + Image IMG_BOLD + { + ImageBitmap = Bitmap{File = "symphony/sc_bold.png";};//sc_bold.bmp + }; + Image IMG_ITALIC + { + ImageBitmap = Bitmap{File = "symphony/sc_italic.png";};//sc_italic.bmp + }; + Image IMG_UNDERLINE + { + ImageBitmap = Bitmap{File = "symphony/sc_underline.png";};//sc_underline.png + }; + Image IMG_STRIKEOUT + { + ImageBitmap = Bitmap{File = "symphony/sc_strikeout.png";};//sc_strikeout.png + }; + Image IMG_SHADOWED + { + ImageBitmap = Bitmap{File = "symphony/sc_shadowed.png";};//sc_shadowed.png + }; + Image IMG_FONTCOLOR + { + ImageBitmap = Bitmap{File = "symphony/sc_color.png";}; + }; + Image IMG_SUPSCRIPT + { + ImageBitmap = Bitmap{File = "symphony/sc_superscript.png";}; + }; + Image IMG_SUBSCRIPT + { + ImageBitmap = Bitmap{File = "symphony/sc_subscript.png";}; + }; +// Image IMG_SPACING +// { +// ImageBitmap = Bitmap{File = "symphony/icon_normal.png";}; +// }; + Image IMG_HIGHLIGHT + { + ImageBitmap = Bitmap{File = "symphony/Highlight.png";};//sc_backcolor + }; + + //small icon for spacing + Image IMG_SPACING_D + { + ImageBitmap = Bitmap{File = "symphony/icon_normal.png";}; + }; +}; + +Control RID_POPUPPANEL_TEXTPAGE_UNDERLINE +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + + Size = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL * 2 + POPUP_BORDER_WIDTH + VS_UNDERLINE_WIDTH, 13+ VS_UNDERLINE_HEIGHT + POPUP_BORDER_HEIGHT + POPUPPANEL_MARGIN_SMALL * 2 + POPUPPANEL_MARGIN_LARGE); + Control VS_UNDERLINE + { +// HelpID = HID_UNDERLINE_VS ; + HelpID = HID_PPROPERTYPANEL_TEXT_UNDERLINE_VS; + Hide = TRUE ; + Pos = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL + OFFSET_X , POPUPPANEL_MARGIN_SMALL + OFFSET_Y ); + Size = MAP_APPFONT ( VS_UNDERLINE_WIDTH ,VS_UNDERLINE_HEIGHT); + TabStop = TRUE ; + Text = "Underline"; + }; + + PushButton PB_OPTIONS + { + HelpID = HID_UNDERLINE_BTN; + Pos = MAP_APPFONT ( POPUPPANEL_MARGIN_SMALL + OFFSET_X , POPUPPANEL_MARGIN_SMALL * 2 + OFFSET_Y + VS_UNDERLINE_HEIGHT ); + Size = MAP_APPFONT ( VS_UNDERLINE_WIDTH, 13 ); + TabStop = TRUE; + Text [ en-US ] = "~More Options..."; + }; + + + Image IMG_SINGLE + { + ImageBitmap = Bitmap{File = "symphony/line1.bmp";}; + }; + Image IMG_DOUBLE + { + ImageBitmap = Bitmap{File = "symphony/line2.bmp";}; + }; + Image IMG_BOLD2 + { + ImageBitmap = Bitmap{File = "symphony/line3.bmp";}; + }; + Image IMG_DOT + { + ImageBitmap = Bitmap{File = "symphony/line4.bmp";}; + }; + Image IMG_DOT_BOLD + { + ImageBitmap = Bitmap{File = "symphony/line5.bmp";}; + }; + Image IMG_DASH + { + ImageBitmap = Bitmap{File = "symphony/line6.bmp";}; + }; + Image IMG_DASH_LONG + { + ImageBitmap = Bitmap{File = "symphony/line7.bmp";}; + }; + Image IMG_DASH_DOT + { + ImageBitmap = Bitmap{File = "symphony/line8.bmp";}; + }; + Image IMG_DASH_DOT_DOT + { + ImageBitmap = Bitmap{File = "symphony/line9.bmp";}; + }; + Image IMG_WAVE + { + ImageBitmap = Bitmap{File = "symphony/line10.bmp";}; + }; + + //image when selected + Image IMG_SINGLE_SEL + { + ImageBitmap = Bitmap{File = "symphony/selected-line1.bmp";}; + }; + Image IMG_DOUBLE_SEL + { + ImageBitmap = Bitmap{File = "symphony/selected-line2.bmp";}; + }; + Image IMG_BOLD2_SEL + { + ImageBitmap = Bitmap{File = "symphony/selected-line3.bmp";}; + }; + Image IMG_DOT_SEL + { + ImageBitmap = Bitmap{File = "symphony/selected-line4.bmp";}; + }; + Image IMG_DOT_BOLD_SEL + { + ImageBitmap = Bitmap{File = "symphony/selected-line5.bmp";}; + }; + Image IMG_DASH_SEL + { + ImageBitmap = Bitmap{File = "symphony/selected-line6.bmp";}; + }; + Image IMG_DASH_LONG_SEL + { + ImageBitmap = Bitmap{File = "symphony/selected-line7.bmp";}; + }; + Image IMG_DASH_DOT_SEL + { + ImageBitmap = Bitmap{File = "symphony/selected-line8.bmp";}; + }; + Image IMG_DASH_DOT_DOT_SEL + { + ImageBitmap = Bitmap{File = "symphony/selected-line9.bmp";}; + }; + Image IMG_WAVE_SEL + { + ImageBitmap = Bitmap{File = "symphony/selected-line10.bmp";}; + }; + +// //more button bmps +// Bitmap BMP_UNDERLINE_MORE +// { +// File = "symphony/morebutton.bmp"; +// }; + + //tips + String STR_SINGLE + { + Text [ en-US ] = "Single"; + }; + String STR_DOUBLE + { + Text [ en-US ] = "Double"; + }; + String STR_BOLD + { + Text [ en-US ] = "Bold"; + }; + String STR_DOT + { + Text [ en-US ] = "Dotted"; + }; + String STR_DOT_BOLD + { + Text [ en-US ] = "Dotted (Bold)"; + }; + String STR_DASH + { + Text [ en-US ] = "Dash"; + }; + String STR_DASH_LONG + { + Text [ en-US ] = "Long Dash"; + }; + String STR_DASH_DOT + { + Text [ en-US ] = "Dot Dash"; + }; + String STR_DASH_DOT_DOT + { + Text [ en-US ] = "Dot Dot Dash"; + }; + String STR_WAVE + { + Text [ en-US ] = "Wave"; + }; + +}; + + +Control RID_POPUPPANEL_TEXTPAGE_FONT_COLOR +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + Size = MAP_APPFONT( POPUP_COLOR_PICKER_WIDTH , POPUP_COLOR_PICKER_HEIGHT ); + + Control VS_FONT_COLOR + { +// HelpID = HID_COLOR_VS ; + HelpID = HID_PPROPERTYPANEL_TEXT_COLOR_VS; + Hide = TRUE ; + Pos = MAP_APPFONT ( OFFSET_X , OFFSET_Y ); + Size = MAP_APPFONT ( POPUP_COLOR_PICKER_WIDTH - OFFSET_X * 2, POPUP_COLOR_PICKER_HEIGHT - OFFSET_Y * 2); + TabStop = TRUE ; + Text = "Color Picker"; + }; + String STR_AUTOMATICE + { + Text [ en-US ] = "Automatic"; + }; + +}; + +Control RID_POPUPPANEL_TEXTPAGE_SPACING +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + + Size = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL * 2 + POPUP_BORDER_WIDTH + VS_SPACING_WIDTH , POPUPPANEL_MARGIN_SMALL * 3 + 15 * 6 + CUSTOM_HEIGHT + TEXT_HEIGHT + POPUPPANEL_MARGIN_LARGE + POPUP_BORDER_WIDTH + 1); + + Control VS_SPACING + { + HelpId = HID_PPROPERTYPANEL_TEXT_SPACING_VS ; + Hide = TRUE ; + Pos = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL + OFFSET_X , POPUPPANEL_MARGIN_SMALL + OFFSET_Y ); + Size = MAP_APPFONT ( VS_SPACING_WIDTH , 15 * 6); + TabStop = TRUE ; + Text = "Character Spacing"; + }; + + FixedText FT_LASTCUSTOM + { + Pos = MAP_APPFONT ( POPUPPANEL_MARGIN_LARGE + OFFSET_X ,POPUPPANEL_MARGIN_SMALL + OFFSET_Y + POPUPPANEL_MARGIN_SMALL + 15 * 6) ; + Size = MAP_APPFONT ( CUSTOM_WIDTH , TEXT_HEIGHT ); + Left = TRUE ; + Text [ en-US ] = "Custom:" ; + }; + //custom area +// Control CT_BORDER +// { +// Pos = MAP_APPFONT ( POPUPPANEL_MARGIN_LARGE + OFFSET_X + 1 , OFFSET_Y + POPUPPANEL_MARGIN_SMALL * 3 + 15 * 6 + TEXT_HEIGHT) ; +// Size = MAP_APPFONT (CUSTOM_WIDTH , CUSTOM_HEIGHT ) ;// TOOLBOX_42_42_ITEM_DD_WIDTH * 2 + TB_SPACE * 2 - 5 + TEXT_WIDTH - 2 +// DialogControl = TRUE; +// }; + FixedText FT_SPACING + { + Pos = MAP_APPFONT ( CUSTOM_X + POPUPPANEL_MARGIN_LARGE, CUSTOM_Y + POPUPPANEL_MARGIN_LARGE); + Size = MAP_APPFONT ( CUSTOM_WIDTH - POPUPPANEL_MARGIN_LARGE * 2 , TEXT_HEIGHT ); + Left = TRUE ; + Text [ en-US ] = "~Character spacing: " ; + }; + ListBox LB_KERNING + { + Border = TRUE; + Pos = MAP_APPFONT ( CUSTOM_X + POPUPPANEL_MARGIN_LARGE, CUSTOM_Y + POPUPPANEL_MARGIN_LARGE + TEXT_HEIGHT + POPUPPANEL_MARGIN_SMALL);//20 + Size = MAP_APPFONT ( CUSTOM_WIDTH - POPUPPANEL_MARGIN_LARGE * 2 , 80 ) ; + TabStop = TRUE; + DropDown = TRUE ; + HelpID = HID_SPACING_CB_KERN; + StringList [ en-US ] = + { + < "Default" ; Default ; > ; + < "Expanded" ; Default ; > ; + < "Condensed" ; Default ; > ; + }; + }; + FixedText FT_BY + { + Pos = MAP_APPFONT ( CUSTOM_X + POPUPPANEL_MARGIN_LARGE, CUSTOM_Y + POPUPPANEL_MARGIN_LARGE * 2 + TEXT_HEIGHT + POPUPPANEL_MARGIN_SMALL + CBOX_HEIGHT ); + Size = MAP_APPFONT ( CUSTOM_WIDTH - POPUPPANEL_MARGIN_LARGE * 2 , TEXT_HEIGHT ); + Left = TRUE ; + Text [ en-US ] = "Change ~by: " ; + }; + MetricField ED_KERNING + { + HelpID = HID_SPACING_MB_KERN; + Border = TRUE; + Pos = MAP_APPFONT ( CUSTOM_X + POPUPPANEL_MARGIN_LARGE, CUSTOM_Y + POPUPPANEL_MARGIN_LARGE * 2 + TEXT_HEIGHT * 2 + POPUPPANEL_MARGIN_SMALL * 2 + CBOX_HEIGHT);//60 + Size = MAP_APPFONT ( CUSTOM_WIDTH - POPUPPANEL_MARGIN_LARGE * 2 , MBOX_HEIGHT ); + TabStop = TRUE; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 9999 ; + DecimalDigits = 1 ; + Unit = FUNIT_POINT ; + SpinSize = 10 ; + }; + + Image IMG_NORMAL + { + ImageBitmap = Bitmap{File = "symphony/spacing_normal.bmp" ;};//"spacing_normal.bmp" + }; + Image IMG_VERY_TIGHT + { + ImageBitmap = Bitmap{File = "symphony/spacing_very tight.bmp";}; + }; + Image IMG_TIGHT + { + ImageBitmap = Bitmap{File = "symphony/spacing_tight.bmp";}; + }; + Image IMG_LOOSE + { + ImageBitmap = Bitmap{File = "symphony/spacing_loose.bmp";}; + }; + Image IMG_VERY_LOOSE + { + ImageBitmap = Bitmap{File = "symphony/spacing_very loose.bmp";}; + }; + + Image IMG_NORMAL_S + { + ImageBitmap = Bitmap{File = "symphony/spacing_normal_s.bmp";}; + }; + Image IMG_VERY_TIGHT_S + { + ImageBitmap = Bitmap{File = "symphony/spacing_very tight_s.bmp";}; + }; + Image IMG_TIGHT_S + { + ImageBitmap = Bitmap{File = "symphony/spacing_tight_s.bmp";}; + }; + Image IMG_LOOSE_S + { + ImageBitmap = Bitmap{File = "symphony/spacing_loose_s.bmp";}; + }; + Image IMG_VERY_LOOSE_S + { + ImageBitmap = Bitmap{File = "symphony/spacing_very loose_s.bmp";}; + }; + + Image IMG_CUSTOM + { + ImageBitmap = Bitmap{File = "symphony/last_custom_common.png";}; + }; + Image IMG_CUSTOM_GRAY + { + ImageBitmap = Bitmap{File = "symphony/last_custom_common_grey.png";}; + }; + + String STR_VERY_TIGHT + { + Text [ en-US ] = "Very Tight"; + }; + String STR_TIGHT + { + Text [ en-US ] = "Tight"; + }; + String STR_NORMAL + { + Text [ en-US ] = "Normal"; + }; + String STR_LOOSE + { + Text [ en-US ] = "Loose"; + }; + String STR_VERY_LOOSE + { + Text [ en-US ] = "Very Loose"; + }; + String STR_CUSTOM + { + Text [ en-US ] = "Last Custom Value"; + }; + + String STR_VERY_TIGHT_TIP + { + Text [ en-US ] = " Spacing: Condensed By: 3pt"; + }; + String STR_TIGHT_TIP + { + Text [ en-US ] = " Spacing: Condensed By: 1.5pt"; + }; + String STR_NORMAL_TIP + { + Text [ en-US ] = " Spacing: Normal"; + }; + String STR_LOOSE_TIP + { + Text [ en-US ] = " Spacing: Expanded By: 3pt"; + }; + String STR_VERY_LOOSE_TIP + { + Text [ en-US ] = " Spacing: Expanded By: 6pt"; + }; + String STR_CUSTOM_C_TIP + { + Text [ en-US ] = " Spacing: Condensed By: "; + }; + String STR_CUSTOM_E_TIP + { + Text [ en-US ] = " Spacing: Expanded By: "; + }; + String STR_PT + { + Text[ en-US ] = "pt"; + }; +}; diff --git a/svx/source/sidebar/text/TextUnderlineControl.cxx b/svx/source/sidebar/text/TextUnderlineControl.cxx new file mode 100644 index 000000000000..17e0c4b96a91 --- /dev/null +++ b/svx/source/sidebar/text/TextUnderlineControl.cxx @@ -0,0 +1,264 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "TextUnderlineControl.hxx" +#include "TextPropertyPanel.hrc" +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include <svx/dialogs.hrc> +#include <svx/dialmgr.hxx> +#include <unotools/viewoptions.hxx> +#include <editeng/kernitem.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/sidebar/Theme.hxx> +#include <editeng/udlnitem.hxx> + +namespace svx { namespace sidebar { + +TextUnderlineControl::TextUnderlineControl(Window* pParent, svx::sidebar::TextPropertyPanel& rPanel) +: svx::sidebar::PopupControl( pParent,SVX_RES(RID_POPUPPANEL_TEXTPAGE_UNDERLINE)) +, mrTextPropertyPanel(rPanel) +, mpBindings(NULL) +, maVSUnderline( this, SVX_RES(VS_UNDERLINE)) +, maPBOptions (this, SVX_RES(PB_OPTIONS) ) + +, maIMGSingle (SVX_RES(IMG_SINGLE)) +, maIMGDouble (SVX_RES(IMG_DOUBLE)) +, maIMGBold (SVX_RES(IMG_BOLD2)) +, maIMGDot (SVX_RES(IMG_DOT)) +, maIMGDotBold (SVX_RES(IMG_DOT_BOLD)) +, maIMGDash (SVX_RES(IMG_DASH)) +, maIMGDashLong (SVX_RES(IMG_DASH_LONG)) +, maIMGDashDot (SVX_RES(IMG_DASH_DOT)) +, maIMGDashDotDot (SVX_RES(IMG_DASH_DOT_DOT)) +, maIMGWave (SVX_RES(IMG_WAVE)) + +, maIMGSingleSel (SVX_RES(IMG_SINGLE_SEL)) +, maIMGDoubleSel (SVX_RES(IMG_DOUBLE_SEL)) +, maIMGBoldSel (SVX_RES(IMG_BOLD2_SEL)) +, maIMGDotSel (SVX_RES(IMG_DOT_SEL)) +, maIMGDotBoldSel (SVX_RES(IMG_DOT_BOLD_SEL)) +, maIMGDashSel (SVX_RES(IMG_DASH_SEL)) +, maIMGDashLongSel (SVX_RES(IMG_DASH_LONG_SEL)) +, maIMGDashDotSel (SVX_RES(IMG_DASH_DOT_SEL)) +, maIMGDashDotDotSel (SVX_RES(IMG_DASH_DOT_DOT_SEL)) +, maIMGWaveSel (SVX_RES(IMG_WAVE_SEL)) + +{ + initial(); + FreeResource(); + mpBindings = mrTextPropertyPanel.GetBindings(); +} + +void TextUnderlineControl::initial() +{ + /*maPBOptions.SetDefBkColor(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_DropDownBackground ));//Color(244,245,249)//for high contrast + maPBOptions.SetHoverBkColor(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ) );//Color( 93, 120, 163 ) + maPBOptions.SetHoverTxtColor( sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Color_PanelTitleFont ) );//Color( 255, 255, 255 ) + maPBOptions.SetIcoPosX( 2);*/ + maVSUnderline.SetColor(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); + maVSUnderline.SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); + + Link aLink = LINK( this, TextUnderlineControl, PBClickHdl ) ; + maPBOptions.SetClickHdl(aLink); + + maVSUnderline.SetStyle( maVSUnderline.GetStyle()| WB_3DLOOK | WB_NO_DIRECTSELECT );// WB_NAMEFIELD | WB_ITEMBORDER |WB_DOUBLEBORDER | WB_NONEFIELD | + + maVSUnderline.InsertItem(1, maIMGSingle ,String(SVX_RES(STR_SINGLE))); + maVSUnderline.SetItemData(1, (void*)(sal_uInt64)UNDERLINE_SINGLE); + + maVSUnderline.InsertItem(2, maIMGDouble ,String(SVX_RES(STR_DOUBLE))); + maVSUnderline.SetItemData(2, (void*)(sal_uInt64)UNDERLINE_DOUBLE); + + maVSUnderline.InsertItem(3, maIMGBold, String(SVX_RES(STR_BOLD))); + maVSUnderline.SetItemData(3,(void*)(sal_uInt64)UNDERLINE_BOLD); + + maVSUnderline.InsertItem(4, maIMGDot, String(SVX_RES(STR_DOT))); + maVSUnderline.SetItemData(4,(void*)(sal_uInt64)UNDERLINE_DOTTED); + + maVSUnderline.InsertItem(5, maIMGDotBold, String(SVX_RES(STR_DOT_BOLD))); + maVSUnderline.SetItemData(5,(void*)(sal_uInt64)UNDERLINE_BOLDDOTTED); + + maVSUnderline.InsertItem(6, maIMGDash, String(SVX_RES(STR_DASH))); + maVSUnderline.SetItemData(6,(void*)(sal_uInt64)UNDERLINE_DASH); + + maVSUnderline.InsertItem(7, maIMGDashLong,String(SVX_RES(STR_DASH_LONG))); + maVSUnderline.SetItemData(7,(void*)(sal_uInt64)UNDERLINE_LONGDASH); + + maVSUnderline.InsertItem(8, maIMGDashDot, String(SVX_RES(STR_DASH_DOT))); + maVSUnderline.SetItemData(8,(void*)(sal_uInt64)UNDERLINE_DASHDOT); + + maVSUnderline.InsertItem(9, maIMGDashDotDot, String(SVX_RES(STR_DASH_DOT_DOT))); + maVSUnderline.SetItemData(9,(void*)(sal_uInt64)UNDERLINE_DASHDOTDOT); + + maVSUnderline.InsertItem(10, maIMGWave, String(SVX_RES(STR_WAVE))); + maVSUnderline.SetItemData(10,(void*)(sal_uInt64)UNDERLINE_WAVE); + + maVSUnderline.SetColCount( 1 ); + aLink = LINK( this, TextUnderlineControl, VSSelectHdl ) ; + maVSUnderline.SetSelectHdl(aLink); + + maVSUnderline.StartSelection(); + maVSUnderline.Show(); +} + +void TextUnderlineControl::GetFocus() +{ + maVSUnderline.GrabFocus(); +} +void TextUnderlineControl::Rearrange(FontUnderline eLine) +{ + // high contrast + maVSUnderline.SetItemImage(1, maIMGSingle); + maVSUnderline.SetItemImage(2, maIMGDouble ); + maVSUnderline.SetItemImage(3, maIMGBold); + maVSUnderline.SetItemImage(4, maIMGDot); + maVSUnderline.SetItemImage(5, maIMGDotBold); + maVSUnderline.SetItemImage(6, maIMGDash); + maVSUnderline.SetItemImage(7, maIMGDashLong); + maVSUnderline.SetItemImage(8, maIMGDashDot); + maVSUnderline.SetItemImage(9, maIMGDashDotDot); + maVSUnderline.SetItemImage(10, maIMGWave); +// maVSUnderline.SelectItem(0); //delete +// maVSUnderline.SetNoSelection(); + + switch(eLine) + { + case UNDERLINE_SINGLE: + maVSUnderline.SetItemImage(1, maIMGSingleSel); + maVSUnderline.SelectItem(1); //add + maVSUnderline.GrabFocus(); + break; + case UNDERLINE_DOUBLE: + maVSUnderline.SetItemImage(2, maIMGDoubleSel); + maVSUnderline.SelectItem(2); //add + maVSUnderline.GrabFocus(); + break; + case UNDERLINE_BOLD: + maVSUnderline.SetItemImage(3, maIMGBoldSel); + maVSUnderline.SelectItem(3); //add + maVSUnderline.GrabFocus(); + break; + case UNDERLINE_DOTTED: + maVSUnderline.SetItemImage(4, maIMGDotSel); + maVSUnderline.SelectItem(4); //add + maVSUnderline.GrabFocus(); + break; + case UNDERLINE_BOLDDOTTED: + maVSUnderline.SetItemImage(5, maIMGDotBoldSel); + maVSUnderline.SelectItem(5); //add + maVSUnderline.GrabFocus(); + break; + case UNDERLINE_DASH: + maVSUnderline.SetItemImage(6, maIMGDashSel); + maVSUnderline.SelectItem(6); //add + maVSUnderline.GrabFocus(); + break; + case UNDERLINE_LONGDASH: + maVSUnderline.SetItemImage(7, maIMGDashLongSel); + maVSUnderline.SelectItem(7); //add + maVSUnderline.GrabFocus(); + break; + case UNDERLINE_DASHDOT: + maVSUnderline.SetItemImage(8, maIMGDashDotSel); + maVSUnderline.SelectItem(8); //add + maVSUnderline.GrabFocus(); + break; + case UNDERLINE_DASHDOTDOT: + maVSUnderline.SetItemImage(9, maIMGDashDotDotSel); + maVSUnderline.SelectItem(9); //add + maVSUnderline.GrabFocus(); + break; + case UNDERLINE_WAVE: + maVSUnderline.SetItemImage(10, maIMGWaveSel); + maVSUnderline.SelectItem(10); //add + maVSUnderline.GrabFocus(); + break; + case UNDERLINE_NONE: + default: + maVSUnderline.SelectItem(1); + maVSUnderline.SetNoSelection();//add + maPBOptions.GrabFocus(); + } + maVSUnderline.StartSelection(); + //removed + //if(mpPage->meContextType == PROPERTY_CONTEXT_SC_CELL) + // maPBOptions.Disable(); + //else + // maPBOptions.Enable(); + //removed end +} +ValueSet& TextUnderlineControl::GetValueSet() +{ + return maVSUnderline; +} +Control& TextUnderlineControl::GetPB() +{ + return maPBOptions; +} +IMPL_LINK(TextUnderlineControl, VSSelectHdl, void *, pControl) +{ + if(pControl == &maVSUnderline) + { + sal_uInt16 iPos = maVSUnderline.GetSelectItemId(); + FontUnderline eUnderline = (FontUnderline)(sal_uInt64)maVSUnderline.GetItemData( iPos ); + + //<<modified + //SvxTextLineItem aLineItem(eUnderline, SID_ATTR_CHAR_UNDERLINE); + SvxUnderlineItem aLineItem(eUnderline, SID_ATTR_CHAR_UNDERLINE); + //modify end>> + + //<<add , this line of code will keep the new underline use pre-color + aLineItem.SetColor(mrTextPropertyPanel.GetUnderlineColor()); + //add end>> + mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_UNDERLINE, SFX_CALLMODE_RECORD, &aLineItem, 0L); + + //add , for the popup page not update immediately + mrTextPropertyPanel.SetUnderline(eUnderline); + //add end + //mrTextPropertyPanel.SetDefaultUnderline(eUnderline); + + mrTextPropertyPanel.EndUnderlinePopupMode(); + } + return( 0L ); +} + +IMPL_LINK(TextUnderlineControl, PBClickHdl, PushButton *, pPBtn) +{ + if(pPBtn == &maPBOptions) + { + if (mpBindings) + { + SfxDispatcher* pDisp = mpBindings->GetDispatcher(); + pDisp->Execute( SID_CHAR_DLG_EFFECT, SFX_CALLMODE_ASYNCHRON ); + } + //add + mrTextPropertyPanel.EndUnderlinePopupMode(); + //add end + } + return 0; +} + +}} diff --git a/svx/source/sidebar/text/TextUnderlineControl.hxx b/svx/source/sidebar/text/TextUnderlineControl.hxx new file mode 100644 index 000000000000..82bb9bec28d5 --- /dev/null +++ b/svx/source/sidebar/text/TextUnderlineControl.hxx @@ -0,0 +1,79 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_SIDEBAR_UNDERLINE_CONTROL_HXX_ +#define _SVX_SIDEBAR_UNDERLINE_CONTROL_HXX_ + +#include "svx/sidebar/PopupControl.hxx" +#include <sfx2/bindings.hxx> +#include <svtools/ctrlbox.hxx> +#include <svtools/ctrltool.hxx> +#include "TextPropertyPanel.hxx" +#include <vcl/fixed.hxx> +#include <vcl/button.hxx> + +#include <vcl/vclenum.hxx> +#include <svtools/valueset.hxx> + +namespace svx{ namespace sidebar { + +class TextUnderlineControl:public svx::sidebar::PopupControl +{ +public: + TextUnderlineControl(Window* pParent, svx::sidebar::TextPropertyPanel& rPanel); + void GetFocus(); + void Rearrange(FontUnderline eLine); + ValueSet& GetValueSet(); + Control& GetPB(); +private: + svx::sidebar::TextPropertyPanel& mrTextPropertyPanel; + SfxBindings* mpBindings; + ValueSet maVSUnderline; + PushButton maPBOptions; + + Image maIMGSingle; + Image maIMGDouble; + Image maIMGBold; + Image maIMGDot; + Image maIMGDotBold; + Image maIMGDash; + Image maIMGDashLong; + Image maIMGDashDot; + Image maIMGDashDotDot; + Image maIMGWave; + + Image maIMGSingleSel; + Image maIMGDoubleSel; + Image maIMGBoldSel; + Image maIMGDotSel; + Image maIMGDotBoldSel; + Image maIMGDashSel; + Image maIMGDashLongSel; + Image maIMGDashDotSel; + Image maIMGDashDotDotSel; + Image maIMGWaveSel; + + void initial(); + + DECL_LINK( PBClickHdl, PushButton *); + DECL_LINK(VSSelectHdl, void *); +}; +}} + + +#endif + diff --git a/svx/source/sidebar/text/TextUnderlinePopup.cxx b/svx/source/sidebar/text/TextUnderlinePopup.cxx new file mode 100644 index 000000000000..76fc10a1d29a --- /dev/null +++ b/svx/source/sidebar/text/TextUnderlinePopup.cxx @@ -0,0 +1,56 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "TextUnderlinePopup.hxx" +#include "TextUnderlineControl.hxx" + + +namespace svx { namespace sidebar { + +TextUnderlinePopup::TextUnderlinePopup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator) + : Popup( + pParent, + rControlCreator, + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Character Spacing"))) +{ +} + + + + +TextUnderlinePopup::~TextUnderlinePopup (void) +{ +} + + + + +void TextUnderlinePopup::Rearrange (FontUnderline eLine) +{ + ProvideContainerAndControl(); + + TextUnderlineControl* pControl = dynamic_cast<TextUnderlineControl*>(mpControl.get()); + if (pControl != NULL) + pControl->Rearrange(eLine); +} + + +} } // end of namespace svx::sidebar + + diff --git a/svx/source/sidebar/text/TextUnderlinePopup.hxx b/svx/source/sidebar/text/TextUnderlinePopup.hxx new file mode 100644 index 000000000000..966c6cef8947 --- /dev/null +++ b/svx/source/sidebar/text/TextUnderlinePopup.hxx @@ -0,0 +1,43 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SVX_SIDEBAR_UNDERLINE_POPUP_HXX_ +#define _SVX_SIDEBAR_UNDERLINE_POPUP_HXX_ + +#include "svx/sidebar/Popup.hxx" + +#include <boost/function.hpp> +#include <vcl/vclenum.hxx> +namespace svx { namespace sidebar { + +class TextUnderlinePopup + : public Popup +{ +public : + TextUnderlinePopup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator); + ~TextUnderlinePopup (void); + + void Rearrange (FontUnderline eLine); +}; + +} } // end of namespace svx::sidebar + +#endif + + diff --git a/svx/source/sidebar/tools/ColorControl.cxx b/svx/source/sidebar/tools/ColorControl.cxx new file mode 100644 index 000000000000..85d3f3539fcf --- /dev/null +++ b/svx/source/sidebar/tools/ColorControl.cxx @@ -0,0 +1,223 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <svx/sidebar/ColorControl.hxx> +#include "svx/svxids.hrc" +#include "svx/drawitem.hxx" +#include "svx/xtable.hxx" +#include "svx/dialmgr.hxx" +#include "svx/xflclit.hxx" +#include <tools/resid.hxx> +#include <sfx2/sidebar/Theme.hxx> +#include <sfx2/objsh.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <vcl/floatwin.hxx> +#include <unotools/pathoptions.hxx> +#include <editeng/editrids.hrc> + +using ::sfx2::sidebar::Theme; + +namespace svx { namespace sidebar { + +namespace { + short GetItemId_Imp( ValueSet& rValueSet, const Color& rCol ) + { + if(rCol == COL_AUTO) + return 0; + + bool bFound = false; + sal_uInt16 nCount = rValueSet.GetItemCount(); + sal_uInt16 n = 1; + + while ( !bFound && n <= nCount ) + { + Color aValCol = rValueSet.GetItemColor(n); + + bFound = ( aValCol.GetRed() == rCol.GetRed() + && aValCol.GetGreen() == rCol.GetGreen() + && aValCol.GetBlue() == rCol.GetBlue() ); + + if ( !bFound ) + n++; + } + return bFound ? n : -1; + } + class JustReleaseDeleter {public: + void operator() (XColorList*) const {/* release but don't delete pointer */} + }; + XColorListRef GetColorTable (void) + { + SfxObjectShell* pDocSh = SfxObjectShell::Current(); + DBG_ASSERT(pDocSh!=NULL, "DocShell not found!"); + if (pDocSh != NULL) + { + const SfxPoolItem* pItem = pDocSh->GetItem(SID_COLOR_TABLE); + if (pItem != NULL) + { + XColorListRef xTable = ((SvxColorListItem*)pItem)->GetColorList(); + if (xTable.is()) + return xTable; + } + } + + return XColorList::GetStdColorList(); + } +} // end of anonymous namespace + + + + +ColorControl::ColorControl ( + Window* pParent, + SfxBindings* pBindings, + const ResId& rControlResId, + const ResId& rValueSetResId, + const ::boost::function<Color(void)>& rNoColorGetter, + const ::boost::function<void(String&,Color)>& rColorSetter, + FloatingWindow* pFloatingWindow, + const ResId* pNoColorStringResId) // const sal_uInt32 nNoColorStringResId) + : PopupControl(pParent, rControlResId), + mpBindings(pBindings), + maVSColor(this, rValueSetResId), + mpFloatingWindow(pFloatingWindow), + msNoColorString( + pNoColorStringResId + ? String(*pNoColorStringResId) + : String()), + maNoColorGetter(rNoColorGetter), + maColorSetter(rColorSetter) +{ + FreeResource(); +} + + + +ColorControl::~ColorControl (void) +{ +} + + + + +void ColorControl::FillColors (void) +{ + XColorListRef xColorTable (GetColorTable()); + + if (xColorTable.is()) + { + const long nColorCount (xColorTable->Count()); + if (nColorCount <= 0) + return; + const sal_Int32 nColumnCount (ceil(sqrt(double(nColorCount)))); + const sal_Int32 nRowCount (ceil(double(nColorCount)/nColumnCount)); + maVSColor.SetColCount(nColumnCount); + maVSColor.SetLineCount(nRowCount); + const sal_Int32 nItemSize (15*12 / ::std::max<sal_Int32>(nColumnCount, nRowCount)); + maVSColor.CalcWindowSizePixel(Size(nItemSize,nItemSize)); + Link aLink = LINK(this, ColorControl, VSSelectHdl); + maVSColor.SetSelectHdl(aLink); + maVSColor.SetStyle( + (maVSColor.GetStyle() + | WB_TABSTOP | WB_ITEMBORDER | WB_NAMEFIELD// | WB_FLATVALUESET + | WB_NO_DIRECTSELECT | WB_MENUSTYLEVALUESET | WB_NO_DIRECTSELECT) + & ~WB_VSCROLL); + + if (msNoColorString.Len() > 0) + { + maVSColor.SetStyle(maVSColor.GetStyle() | WB_NONEFIELD); + maVSColor.SetText(msNoColorString); + } + + // Now, after all calls to SetStyle, we can change the + // background color. + maVSColor.SetBackground(Theme::GetWallpaper(Theme::Paint_DropDownBackground)); + + maVSColor.Clear(); + XColorEntry* pEntry = NULL; + for (sal_Int32 nIndex=0; nIndex<nColorCount; ++nIndex) + { + pEntry = xColorTable->GetColor(nIndex); + maVSColor.InsertItem(nIndex+1, pEntry->GetColor(), pEntry->GetName() ); + } + } + + maVSColor.Show(); +} + + + + +void ColorControl::GetFocus (void) +{ + maVSColor.GrabFocus(); +} + + + + +void ColorControl::SetCurColorSelect (Color aCol, bool bAvailable) +{ + FillColors(); + short nCol = GetItemId_Imp( maVSColor, aCol ); + if(! bAvailable) + { + maVSColor.SetNoSelection(); + return; + } + + //if not found + if( nCol == -1) + { + maVSColor.SetNoSelection(); + } + else + { + maVSColor.SelectItem( nCol ); + } +} + + + + +IMPL_LINK(ColorControl, VSSelectHdl, void *, pControl) +{ + if(pControl == &maVSColor) + { + sal_uInt16 iPos = maVSColor.GetSelectItemId(); + Color aColor = maVSColor.GetItemColor( iPos ); + String aTmpStr = maVSColor.GetItemText( iPos ); + + // react when the WB_NONEFIELD created entry is selected + if (aColor.GetColor() == 0 && aTmpStr.Len() == 0) + { + if (maNoColorGetter) + aColor = maNoColorGetter(); + } + if (maColorSetter) + maColorSetter(aTmpStr, aColor); + + if (mpFloatingWindow!=NULL && mpFloatingWindow->IsInPopupMode()) + mpFloatingWindow->EndPopupMode(); + } + + return 0; +} + + +} } // end of namespace svx::sidebar diff --git a/svx/source/sidebar/tools/ColorPopup.cxx b/svx/source/sidebar/tools/ColorPopup.cxx new file mode 100644 index 000000000000..ed51592e6b9b --- /dev/null +++ b/svx/source/sidebar/tools/ColorPopup.cxx @@ -0,0 +1,56 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include <svx/sidebar/ColorPopup.hxx> +#include <svx/sidebar/ColorControl.hxx> + + +namespace svx { namespace sidebar { + +ColorPopup::ColorPopup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator) + : Popup( + pParent, + rControlCreator, + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Color"))) +{ +} + + + + +ColorPopup::~ColorPopup (void) +{ +} + + + + +void ColorPopup::SetCurrentColor ( + const Color aCurrentColor, + const bool bIsColorAvailable) +{ + ProvideContainerAndControl(); + + ColorControl* pColorControl = dynamic_cast<ColorControl*>(mpControl.get()); + if (pColorControl != NULL) + pColorControl->SetCurColorSelect(aCurrentColor, bIsColorAvailable); +} + + +} } // end of namespace svx::sidebar diff --git a/svx/source/sidebar/tools/Popup.cxx b/svx/source/sidebar/tools/Popup.cxx new file mode 100644 index 000000000000..70c1e8665c5a --- /dev/null +++ b/svx/source/sidebar/tools/Popup.cxx @@ -0,0 +1,144 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "svx/sidebar/Popup.hxx" +#include "svx/sidebar/PopupContainer.hxx" +#include "svx/sidebar/PopupControl.hxx" + +#include <vcl/toolbox.hxx> + + +namespace svx { namespace sidebar { + +Popup::Popup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator, + const ::rtl::OUString& rsAccessibleName) + : mpControl(), + mpParent(pParent), + maControlCreator(rControlCreator), + maPopupModeEndCallback(), + msAccessibleName(rsAccessibleName), + mpContainer() +{ + OSL_ASSERT(mpParent!=NULL); + OSL_ASSERT(maControlCreator); +} + + + + +Popup::~Popup (void) +{ + mpControl.reset(); + mpContainer.reset(); +} + + + + +void Popup::Show (ToolBox& rToolBox) +{ + rToolBox.SetItemDown(rToolBox.GetCurItemId(), true); + + ProvideContainerAndControl(); + if ( ! (mpContainer && mpControl)) + { + OSL_ASSERT(mpContainer); + OSL_ASSERT(mpControl); + return; + } + + if ( !mpContainer->IsInPopupMode() ) + { + mpContainer->SetSizePixel(mpControl->GetOutputSizePixel()); + + const Point aPos (mpParent->OutputToScreenPixel(rToolBox.GetPosPixel())); + const Size aSize (rToolBox.GetSizePixel()); + const Rectangle aRect (aPos, aSize); + + mpContainer->StartPopupMode( + aRect, + FLOATWIN_POPUPMODE_NOFOCUSCLOSE|FLOATWIN_POPUPMODE_DOWN); + mpContainer->SetPopupModeFlags( + mpContainer->GetPopupModeFlags() + | FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE); + + mpControl->GetFocus(); + } +} + + + + +void Popup::Hide (void) +{ + if (mpContainer) + if (mpContainer->IsInPopupMode()) + mpContainer->EndPopupMode(); +} + + + + +void Popup::SetPopupModeEndHandler (const ::boost::function<void(void)>& rCallback) +{ + maPopupModeEndCallback = rCallback; + if (mpContainer) + mpContainer->SetPopupModeEndHdl(LINK(this, Popup, PopupModeEndHandler)); +} + + + + +void Popup::ProvideContainerAndControl (void) +{ + if ( ! (mpContainer && mpControl) + && mpParent!=NULL + && maControlCreator) + { + CreateContainerAndControl(); + } +} + + + + +void Popup::CreateContainerAndControl (void) +{ + mpContainer.reset(new PopupContainer(mpParent)); + mpContainer->SetAccessibleName(msAccessibleName); + if (maPopupModeEndCallback) + mpContainer->SetPopupModeEndHdl(LINK(this, Popup, PopupModeEndHandler)); + mpContainer->SetBorderStyle(mpContainer->GetBorderStyle() | WINDOW_BORDER_MENU); + + mpControl.reset(maControlCreator(mpContainer.get())); +} + + + + +IMPL_LINK(Popup, PopupModeEndHandler, void*, EMPTYARG) +{ + if (maPopupModeEndCallback) + maPopupModeEndCallback(); + return 0; +} + + + +} } // end of namespace svx::sidebar diff --git a/svx/source/sidebar/tools/PopupContainer.cxx b/svx/source/sidebar/tools/PopupContainer.cxx new file mode 100644 index 000000000000..3ff8ad425355 --- /dev/null +++ b/svx/source/sidebar/tools/PopupContainer.cxx @@ -0,0 +1,53 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "svx/sidebar/PopupContainer.hxx" +#include <sfx2/sidebar/Theme.hxx> +#include <vcl/gradient.hxx> + +namespace svx { namespace sidebar { + +PopupContainer::PopupContainer (Window* pParent) + : FloatingWindow(pParent, WB_SYSTEMWINDOW | WB_3DLOOK) // | WB_POPUP_FOCUSWIN) +{ +} + + + + +PopupContainer::~PopupContainer (void) +{ +} + + + + +long PopupContainer::Notify (NotifyEvent& rEvent) +{ + if (rEvent.GetType() == EVENT_LOSEFOCUS) + { + if ( ! HasChildPathFocus(true)) + { + EndPopupMode(); + } + } + + return FloatingWindow::Notify(rEvent); +} + + +} } // end of namespace svx::sidebar diff --git a/svx/source/sidebar/tools/PopupControl.cxx b/svx/source/sidebar/tools/PopupControl.cxx new file mode 100644 index 000000000000..a65245d587ad --- /dev/null +++ b/svx/source/sidebar/tools/PopupControl.cxx @@ -0,0 +1,58 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "svx/sidebar/PopupControl.hxx" +#include <sfx2/sidebar/Theme.hxx> +#include <vcl/gradient.hxx> + +using ::sfx2::sidebar::Theme; + +namespace svx { namespace sidebar { + +PopupControl::PopupControl ( + Window* pParent, + const ResId& rResId) + : Control( pParent,rResId) +{ + EnableChildTransparentMode(true); + SetControlBackground(); + + SetBackground(Theme::GetWallpaper(Theme::Paint_DropDownBackground)); +} + + + + +PopupControl::~PopupControl (void) +{ +} + + + + +void PopupControl::Paint (const Rectangle& rBox) +{ + Control::Paint(rBox); + + // The background is taken care of by setting the background color + // in the constructor. Here we just paint the border. + SetFillColor(); + SetLineColor(Theme::GetColor(Theme::Color_DropDownBorder)); + DrawRect(Rectangle(Point(0,0), GetOutputSizePixel())); +} + +} } // end of namespace svx::sidebar diff --git a/svx/source/sidebar/tools/ValueSetWithTextControl.cxx b/svx/source/sidebar/tools/ValueSetWithTextControl.cxx new file mode 100644 index 000000000000..8be260602851 --- /dev/null +++ b/svx/source/sidebar/tools/ValueSetWithTextControl.cxx @@ -0,0 +1,524 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "svx/sidebar/ValueSetWithTextControl.hxx" +#include <svx/dialogs.hrc> +#include <svx/dialmgr.hxx> +#include <sfx2/sidebar/Theme.hxx> + +#include <limits.h> +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/uno/Sequence.h> +#include <com/sun/star/lang/Locale.hpp> +#include <com/sun/star/style/NumberingType.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/text/XDefaultNumberingProvider.hpp> +#include <com/sun/star/text/XNumberingFormatter.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <comphelper/processfactory.hxx> +#include <com/sun/star/text/XNumberingTypeInfo.hpp> +#include <i18nlangtag/mslangid.hxx> +#include <svtools/valueset.hxx> +#include <editeng/brushitem.hxx> +#include <vcl/graph.hxx> +#include <svx/nbdtmg.hxx> +#include <svx/nbdtmgfact.hxx> + +using namespace com::sun::star::uno; +using namespace com::sun::star::beans; +using namespace com::sun::star::lang; +using namespace com::sun::star::i18n; +using namespace com::sun::star::text; +using namespace com::sun::star::container; +using namespace com::sun::star::style; +using rtl::OUString; + +#define C2U(cChar) OUString::createFromAscii(cChar) + +namespace svx { namespace sidebar { +static const sal_Char cValue[] = "Value"; + +static Font& lcl_GetDefaultBulletFont() +{ + static sal_Bool bInit = 0; + static Font aDefBulletFont( OUString( "StarSymbol" ), + OUString(), Size( 0, 14 ) ); + if(!bInit) + { + aDefBulletFont.SetCharSet( RTL_TEXTENCODING_SYMBOL ); + aDefBulletFont.SetFamily( FAMILY_DONTKNOW ); + aDefBulletFont.SetPitch( PITCH_DONTKNOW ); + aDefBulletFont.SetWeight( WEIGHT_DONTKNOW ); + aDefBulletFont.SetTransparent( sal_True ); + bInit = sal_True; + } + return aDefBulletFont; +} + +ValueSetWithTextControl::ValueSetWithTextControl( + const tControlType eControlType, + Window* pParent, + const ResId& rResId) + : ValueSet( pParent, rResId ) + , meControlType( eControlType ) + , maItems() +{ + SetColCount( 1 ); +} + + +ValueSetWithTextControl::~ValueSetWithTextControl(void) +{ +} + + +void ValueSetWithTextControl::AddItem( + const Image& rItemImage, + const Image* pSelectedItemImage, + const XubString& rItemText, + const XubString* pItemHelpText ) +{ + if ( meControlType != IMAGE_TEXT ) + { + return; + } + + ValueSetWithTextItem aItem; + aItem.maItemImage = rItemImage; + aItem.maSelectedItemImage = (pSelectedItemImage != 0) + ? *pSelectedItemImage + : rItemImage; + aItem.maItemText = rItemText; + + maItems.push_back( aItem ); + + InsertItem( maItems.size() ); + SetItemText( maItems.size(), + (pItemHelpText != 0) ? *pItemHelpText : rItemText ); +} + + +void ValueSetWithTextControl::AddItem( + const XubString& rItemText, + const XubString& rItemText2, + const XubString* pItemHelpText ) +{ + if ( meControlType != TEXT_TEXT ) + { + return; + } + + ValueSetWithTextItem aItem; + aItem.maItemText = rItemText; + aItem.maItemText2 = rItemText2; + + maItems.push_back( aItem ); + + InsertItem( maItems.size() ); + SetItemText( maItems.size(), + (pItemHelpText != 0) ? *pItemHelpText : rItemText ); +} + + +void ValueSetWithTextControl::ReplaceItemImages( + const sal_uInt16 nItemId, + const Image& rItemImage, + const Image* pSelectedItemImage ) +{ + if ( meControlType != IMAGE_TEXT ) + { + return; + } + + if ( nItemId == 0 || + nItemId > maItems.size() ) + { + return; + } + + maItems[nItemId-1].maItemImage = rItemImage; + maItems[nItemId-1].maSelectedItemImage = (pSelectedItemImage != 0) + ? *pSelectedItemImage + : rItemImage; +} + + +void ValueSetWithTextControl::UserDraw( const UserDrawEvent& rUDEvt ) +{ + const Rectangle aRect = rUDEvt.GetRect(); + OutputDevice* pDev = rUDEvt.GetDevice(); + pDev->Push( PUSH_ALL ); + const sal_uInt16 nItemId = rUDEvt.GetItemId(); + + const long nRectHeight = aRect.GetHeight(); + const Point aBLPos = aRect.TopLeft(); + + Font aFont(OutputDevice::GetDefaultFont(DEFAULTFONT_UI_SANS, MsLangId::getSystemLanguage(), DEFAULTFONT_FLAGS_ONLYONE)); + { + Size aSize = aFont.GetSize(); + aSize.Height() = (nRectHeight*4)/9; + aFont.SetSize( aSize ); + } + + { + //draw backgroud + if ( GetSelectItemId() == nItemId ) + { + Rectangle aBackRect = aRect; + aBackRect.Top() += 3; + aBackRect.Bottom() -= 2; + pDev->SetFillColor( sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Color_Highlight ) ); + pDev->DrawRect(aBackRect); + } + else + { + pDev->SetFillColor( COL_TRANSPARENT ); + pDev->DrawRect(aRect); + } + + //draw image + text resp. text + text + Image* pImage = 0; + if ( GetSelectItemId() == nItemId ) + { + aFont.SetColor( sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Color_HighlightText ) ); + pImage = &maItems[nItemId-1].maSelectedItemImage; + } + else + { + aFont.SetColor( GetSettings().GetStyleSettings().GetFieldTextColor() ); + pImage = &maItems[nItemId-1].maItemImage; + } + + Rectangle aStrRect = aRect; + aStrRect.Top() += nRectHeight/4; + aStrRect.Bottom() -= nRectHeight/4; + + switch ( meControlType ) + { + case IMAGE_TEXT: + { + Point aImgStart( + aBLPos.X() + 4, + aBLPos.Y() + ( ( nRectHeight - pImage->GetSizePixel().Height() ) / 2 ) ); + pDev->DrawImage( aImgStart, *pImage ); + + aStrRect.Left() += pImage->GetSizePixel().Width() + 12; + pDev->SetFont(aFont); + pDev->DrawText(aStrRect, maItems[nItemId-1].maItemText, TEXT_DRAW_ENDELLIPSIS); + } + break; + case TEXT_TEXT: + { + const long nRectWidth = aRect.GetWidth(); + aStrRect.Left() += 8; + aStrRect.Right() -= (nRectWidth*2)/3; + pDev->SetFont(aFont); + pDev->DrawText(aStrRect, maItems[nItemId-1].maItemText, TEXT_DRAW_ENDELLIPSIS); + aStrRect.Left() += nRectWidth/3; + aStrRect.Right() += (nRectWidth*2)/3; + pDev->DrawText(aStrRect, maItems[nItemId-1].maItemText2, TEXT_DRAW_ENDELLIPSIS); + } + break; + } + } + + Invalidate( aRect ); + pDev->Pop(); +} + +SvxNumValueSet2::SvxNumValueSet2( Window* pParent, const ResId& rResId) : + ValueSet( pParent, rResId ), + aLineColor ( COL_LIGHTGRAY ), + pVDev ( NULL ) +{ + SetColCount( 3 ); + SetLineCount( 3 ); + SetStyle( GetStyle() | WB_ITEMBORDER ); +} + + SvxNumValueSet2::~SvxNumValueSet2() +{ + delete pVDev; +} + +void SvxNumValueSet2::SetNumberingSettings( + const Sequence<Sequence<PropertyValue> >& aNum, + Reference<XNumberingFormatter>& xFormat, + const Locale& rLocale ) +{ + aNumSettings = aNum; + xFormatter = xFormat; + aLocale = rLocale; + if(aNum.getLength() > 9) + SetStyle( GetStyle()|WB_VSCROLL); + InsertItem( DEFAULT_NONE, DEFAULT_NONE - 1 ); + SetItemText( DEFAULT_NONE, SVX_RESSTR( RID_SVXSTR_NUMBULLET_NONE )); + + for ( sal_Int32 i = 0; i < aNum.getLength(); i++ ) + { + InsertItem( i + 1); + if( i < 8 ) + { + NBOTypeMgrBase* pNumbering = NBOutlineTypeMgrFact::CreateInstance(eNBOType::NUMBERING); + if ( pNumbering ) + { + SetItemText( i + 1, pNumbering->GetDescription(i)); + } + } + } +} + +void SvxNumValueSet2::UserDraw( const UserDrawEvent& rUDEvt ) +{ + const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + const Color aBackColor = rStyleSettings.GetFieldColor(); + const Color aTextColor = rStyleSettings.GetFieldTextColor(); + + OutputDevice* pDev = rUDEvt.GetDevice(); + Rectangle aRect = rUDEvt.GetRect(); + sal_uInt32 nItemId = rUDEvt.GetItemId(); + long nRectWidth = aRect.GetWidth(); + long nRectHeight = aRect.GetHeight(); + Size aRectSize(nRectWidth, aRect.GetHeight()); + Point aBLPos = aRect.TopLeft(); + Font aOldFont = pDev->GetFont(); + Color aOldColor = pDev->GetLineColor(); + pDev->SetLineColor(aBackColor); + Font aFont(OutputDevice::GetDefaultFont( + DEFAULTFONT_UI_SANS, MsLangId::getSystemLanguage(), DEFAULTFONT_FLAGS_ONLYONE)); + + Size aSize = aFont.GetSize(); + aSize.Height() = nRectHeight/5; + aFont.SetColor(aTextColor); + aFont.SetFillColor(aBackColor); + aFont.SetSize( aSize ); + pDev->SetFont(aFont); + pDev->SetLineColor(aTextColor); + if(!pVDev) + { + // Die Linien werden nur einmalig in das VirtualDevice gepainted + // nur die Gliederungspage bekommt es aktuell + pVDev = new VirtualDevice(*pDev); + pVDev->SetMapMode(pDev->GetMapMode()); + pVDev->EnableRTL( IsRTLEnabled() ); + pVDev->SetOutputSize( aRectSize ); + aOrgRect = aRect; + + pVDev->SetLineColor( aBackColor ); + pVDev->SetFillColor( aBackColor ); + pVDev->DrawRect(aOrgRect); + + if(aBackColor == aLineColor) + aLineColor.Invert(); + if(GetSettings().GetStyleSettings().GetHighContrastMode()) + pVDev->SetLineColor(aTextColor); + else + pVDev->SetLineColor(aLineColor); + // Linien nur einmalig Zeichnen + Point aStart(aBLPos.X() + nRectWidth *30 / 100,0); + Point aEnd(aBLPos.X() + nRectWidth * 9 / 10,0); + for( sal_uInt32 i = 11; i < 100; i += 33) + { + aStart.Y() = aEnd.Y() = aBLPos.Y() + nRectHeight * i / 100; + pVDev->DrawLine(aStart, aEnd); + aStart.Y() = aEnd.Y() = aBLPos.Y() + nRectHeight * (i + 11) / 100; + pVDev->DrawLine(aStart, aEnd); + } + } + if ( nItemId != DEFAULT_NONE) + pDev->DrawOutDev( aRect.TopLeft(), aRectSize, + aOrgRect.TopLeft(), aRectSize, + *pVDev ); + const OUString sValue(C2U(cValue)); + + Point aStart(aBLPos.X() + nRectWidth / 9,0); + if ( nItemId == DEFAULT_NONE) + { + String sText(SVX_RESSTR( RID_SVXSTR_NUMBULLET_NONE)); + Font aLclFont = pDev->GetFont(); + Size aLclSize = aLclFont.GetSize(); + aLclSize.Height() = nRectHeight/4; + aLclFont.SetSize( aLclSize ); + pDev->SetFont(aLclFont); + long nTextWidth = pDev->GetTextWidth(sText); + long nTextHeight = pDev->GetTextHeight(); + //GVT refine + while (nTextWidth>nRectWidth && aLclSize.Height()>4) { + aLclSize.Height() = aLclSize.Height()*0.9; + aLclFont.SetSize( aLclSize ); + pDev->SetFont(aLclFont); + nTextWidth = pDev->GetTextWidth(sText); + } + Point aSStart(aBLPos.X()+(nRectWidth-nTextWidth)/2, aBLPos.Y() +(nRectHeight-nTextHeight)/2); + pDev->DrawText(aSStart, sText); + pDev->SetFont(aOldFont); + } + else + { + NBOTypeMgrBase* pNumbering = NBOutlineTypeMgrFact::CreateInstance(eNBOType::NUMBERING); + if ( pNumbering && nItemId <= DEFAULT_BULLET_TYPES ) + { + for( sal_uInt32 i = 0; i < 3; i++ ) + { + sal_uInt32 nY = 11 + i * 33; + aStart.Y() = aBLPos.Y() + nRectHeight * nY / 100; + String sText; + sal_uInt16 nLvl = 0; + SvxNumRule aTempRule( 0, 10, false ); + pNumbering->ApplyNumRule(aTempRule,nItemId -1,1<<nLvl); + SvxNumberFormat aNumFmt(aTempRule.GetLevel(nLvl)); + sText=aNumFmt.GetNumStr(i+1); + sText.Insert( aNumFmt.GetPrefix(), 0 ); + sText += aNumFmt.GetSuffix(); + aStart.X() = aBLPos.X() + 2; + aStart.Y() -= pDev->GetTextHeight()/2; + pDev->DrawText(aStart, sText); + } + } + pDev->SetFont(aOldFont); + pDev->SetLineColor(aOldColor); + } + //End +} + +//=============================================================================================== + +static const long aOffsetX[] = +{ + -1,//1, + 3,//4, + 4,//5, + -3,//0, + -1,//0, + 3 +}; + +SvxNumValueSet3::SvxNumValueSet3( Window* pParent, const ResId& rResId) : + ValueSet( pParent, rResId ) +{ + SetColCount( 3 ); + SetLineCount( 4 ); + SetStyle( GetStyle() | WB_ITEMBORDER ); +} + + SvxNumValueSet3::~SvxNumValueSet3() +{ +} + +void SvxNumValueSet3::UserDraw( const UserDrawEvent& rUDEvt ) +{ + Rectangle aRect = rUDEvt.GetRect(); + OutputDevice* pDev = rUDEvt.GetDevice(); + sal_uInt32 nItemId = rUDEvt.GetItemId(); + + long nRectHeight = aRect.GetHeight(); + long nRectWidth = aRect.GetWidth(); + Point aBLPos = aRect.TopLeft(); + NBOTypeMgrBase* pBullets = NBOutlineTypeMgrFact::CreateInstance(eNBOType::MIXBULLETS); + if ( pBullets ) + { + if ( nItemId <= DEFAULT_BULLET_TYPES ) { + sal_uInt16 nLvl = 0; + SvxNumRule aTempRule( 0, 10, false ); + pBullets->ApplyNumRule(aTempRule,nItemId -1,1<<nLvl); + SvxNumberFormat aFmt(aTempRule.GetLevel(nLvl)); + sal_Int16 eNumType = aFmt.GetNumberingType(); + if( eNumType == SVX_NUM_CHAR_SPECIAL) + { + sal_Unicode cChar = aFmt.GetBulletChar(); + //End + const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + const Color aBackColor = rStyleSettings.GetFieldColor(); + const Color aTextColor = rStyleSettings.GetFieldTextColor(); + + Font aOldFont = pDev->GetFont(); + Font aFont( lcl_GetDefaultBulletFont() ); + + Size aSize = aFont.GetSize(); + aSize.Height() = nRectHeight*3/6; + aFont.SetColor(aTextColor); + aFont.SetFillColor(aBackColor); + aFont.SetSize( aSize ); + pDev->SetFont(aFont); + pDev->SetFillColor( aBackColor ); //wj + + String sText; + sText = cChar; + Font aOldBulletFont = pDev->GetFont(); + Font aBulletFnt(aFmt.GetBulletFont() ? *aFmt.GetBulletFont() : aOldBulletFont); + Size aBulSize = aOldBulletFont.GetSize(); + aBulletFnt.SetSize(aBulSize); + pDev->SetFont(aBulletFnt); + long nTextWidth = pDev->GetTextWidth(sText); + long nTextHeight = pDev->GetTextHeight(); + Point aStart(aBLPos.X()+(nRectWidth-nTextWidth)/2, aBLPos.Y() +(nRectHeight-nTextHeight)/2); + pDev->DrawText(aStart, sText); + pDev->SetFont(aOldFont); + }else if ( eNumType == SVX_NUM_BITMAP ) + { + const SvxBrushItem* pBrushItem = aFmt.GetBrush(); + if(pBrushItem) + { + const Graphic* pGrf = pBrushItem->GetGraphic(); + if(pGrf) + { + Size aSize(nRectHeight*6/20, nRectHeight*6/20); + Point aStart(aBLPos.X() + nRectWidth*7/20, aBLPos.Y() + nRectHeight*7/20); + + pGrf->Draw( pDev, aStart, aSize ); + } + } + } + }else if ( nItemId == DEFAULT_NONE) + { + const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + const Color aBackColor = rStyleSettings.GetFieldColor(); + const Color aTextColor = rStyleSettings.GetFieldTextColor(); + + Font aOldFont = pDev->GetFont(); + Font aFont(OutputDevice::GetDefaultFont(DEFAULTFONT_UI_SANS, MsLangId::getSystemLanguage(), DEFAULTFONT_FLAGS_ONLYONE)); + Size aSize = aFont.GetSize(); + //aSize.Height() = nRectHeight/5; + aSize.Height() = nRectHeight/4; + aFont.SetColor(aTextColor); + aFont.SetFillColor(aBackColor); + aFont.SetSize( aSize ); + pDev->SetFont(aFont); + pDev->SetFillColor( aBackColor ); + + String sText(SVX_RESSTR( RID_SVXSTR_NUMBULLET_NONE)); + + long nTextWidth = pDev->GetTextWidth(sText); + long nTextHeight = pDev->GetTextHeight(); + //GVT refine + while (nTextWidth>nRectWidth && aSize.Height()>4) { + aSize.Height() = aSize.Height()*0.9; + aFont.SetSize( aSize ); + pDev->SetFont(aFont); + nTextWidth = pDev->GetTextWidth(sText); + } + Point aStart(aBLPos.X()+(nRectWidth-nTextWidth)/2, aBLPos.Y() +(nRectHeight-nTextHeight)/2); + pDev->DrawText(aStart, sText); + + pDev->SetFont(aOldFont); + } + } + +} + +} } // end of namespace svx::sidebar diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx index fcf7dd7ea49d..6a1c62e5a269 100644 --- a/svx/source/svdraw/svdedtv1.cxx +++ b/svx/source/svdraw/svdedtv1.cxx @@ -46,6 +46,9 @@ #include <svx/sdr/contact/viewcontact.hxx> #include <svx/e3dsceneupdater.hxx> #include <svx/obj3d.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <svx/AffineMatrixItem.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -230,23 +233,77 @@ void SdrEditView::ResizeMarkedObj(const Point& rRef, const Fraction& xFact, cons if( bUndo ) EndUndo(); } - -long SdrEditView::GetMarkedObjRotate() const +void SdrEditView::ResizeMultMarkedObj(const Point& rRef, + const Fraction& xFact, + const Fraction& yFact, + const bool bCopy, + const bool bWdh, + const bool bHgt) { - bool b1st=true; - bool bOk=true; - long nWink=0; + const bool bUndo = IsUndoEnabled(); + if( bUndo ) + { + XubString aStr; + ImpTakeDescriptionStr(STR_EditResize,aStr); + if (bCopy) + aStr+=ImpGetResStr(STR_EditWithCopy); + BegUndo(aStr); + } + + if (bCopy) + CopyMarkedObj(); + sal_uIntPtr nMarkAnz=GetMarkedObjectCount(); - for (sal_uIntPtr nm=0; nm<nMarkAnz && bOk; nm++) { + for (sal_uIntPtr nm=0; nm<nMarkAnz; nm++) + { SdrMark* pM=GetSdrMarkByIndex(nm); SdrObject* pO=pM->GetMarkedSdrObj(); - long nWink2=pO->GetRotateAngle(); - if (b1st) nWink=nWink2; - else if (nWink2!=nWink) bOk=false; - b1st=false; + if( bUndo ) + { + std::vector< SdrUndoAction* > vConnectorUndoActions( CreateConnectorUndo( *pO ) ); + AddUndoActions( vConnectorUndoActions ); + AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO)); + } + + Fraction aFrac(1,1); + if (bWdh && bHgt) + pO->Resize(rRef, xFact, yFact); + else if (bWdh) + pO->Resize(rRef, xFact, aFrac); + else if (bHgt) + pO->Resize(rRef, aFrac, yFact); } - if (!bOk) nWink=0; - return nWink; + if( bUndo ) + EndUndo(); +} + +long SdrEditView::GetMarkedObjRotate() const +{ + long nRetval(0); + + if(GetMarkedObjectCount()) + { + SdrMark* pM = GetSdrMarkByIndex(0); + SdrObject* pO = pM->GetMarkedSdrObj(); + + nRetval = pO->GetRotateAngle(); + } + + return nRetval; + //sal_Bool b1st=sal_True; + //sal_Bool bOk=sal_True; + //long nWink=0; + //sal_uIntPtr nMarkAnz=GetMarkedObjectCount(); + //for (sal_uIntPtr nm=0; nm<nMarkAnz && bOk; nm++) { + // SdrMark* pM=GetSdrMarkByIndex(nm); + // SdrObject* pO=pM->GetMarkedSdrObj(); + // long nWink2=pO->GetRotateAngle(); + // if (b1st) nWink=nWink2; + // else if (nWink2!=nWink) bOk=sal_False; + // b1st=sal_False; + //} + //if (!bOk) nWink=0; + //return nWink; } void SdrEditView::RotateMarkedObj(const Point& rRef, long nWink, bool bCopy) @@ -1174,13 +1231,15 @@ sal_Bool SdrEditView::SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRe SfxItemSet SdrEditView::GetGeoAttrFromMarked() const { SfxItemSet aRetSet(pMod->GetItemPool(), // SID_ATTR_TRANSFORM_... from s:svxids.hrc - SID_ATTR_TRANSFORM_POS_X,SID_ATTR_TRANSFORM_ANGLE, - SID_ATTR_TRANSFORM_PROTECT_POS,SID_ATTR_TRANSFORM_AUTOHEIGHT, - SDRATTR_ECKENRADIUS,SDRATTR_ECKENRADIUS, - 0); - if (AreObjectsMarked()) { + SID_ATTR_TRANSFORM_POS_X, SID_ATTR_TRANSFORM_ANGLE, + SID_ATTR_TRANSFORM_PROTECT_POS, SID_ATTR_TRANSFORM_AUTOHEIGHT, + SDRATTR_ECKENRADIUS, SDRATTR_ECKENRADIUS, + 0); + + if (AreObjectsMarked()) + { SfxItemSet aMarkAttr(GetAttrFromMarked(sal_False)); // because of AutoGrowHeight and corner radius - Rectangle aRect(GetMarkedObjRect() ); + Rectangle aRect(GetMarkedObjRect()); // restore position to that before calc hack aRect -= GetGridOffset(); @@ -1242,7 +1301,8 @@ SfxItemSet SdrEditView::GetGeoAttrFromMarked() const bool bSizProt=pObj->IsResizeProtect(); bool bPosProtDontCare=false; bool bSizProtDontCare=false; - for (sal_uIntPtr i=1; i<nMarkCount && (!bPosProtDontCare || !bSizProtDontCare); i++) { + for (sal_uIntPtr i=1; i<nMarkCount && (!bPosProtDontCare || !bSizProtDontCare); i++) + { pObj=rMarkList.GetMark(i)->GetMarkedSdrObj(); if (bPosProt!=pObj->IsMoveProtect()) bPosProtDontCare=true; if (bSizProt!=pObj->IsResizeProtect()) bSizProtDontCare=true; @@ -1284,7 +1344,48 @@ SfxItemSet SdrEditView::GetGeoAttrFromMarked() const aRetSet.Put(SdrEckenradiusItem(nRadius)); } + basegfx::B2DHomMatrix aTransformation; + + if(nMarkCount > 1) + { + // multiple objects, range is collected in aRect + aTransformation = basegfx::tools::createScaleTranslateB2DHomMatrix( + aRect.Left(), aRect.Top(), + aRect.getWidth(), aRect.getHeight()); + } + else if(pObj) + { + // single object, get homogen transformation + basegfx::B2DPolyPolygon aPolyPolygon; + + pObj->TRGetBaseGeometry(aTransformation, aPolyPolygon); + } + + if(aTransformation.isIdentity()) + { + aRetSet.InvalidateItem(SID_ATTR_TRANSFORM_MATRIX); + } + else + { + com::sun::star::geometry::AffineMatrix2D aAffineMatrix2D; + Point aPageOffset(0, 0); + + if(GetSdrPageView()) + { + aPageOffset = GetSdrPageView()->GetPageOrigin(); + } + + aAffineMatrix2D.m00 = aTransformation.get(0, 0); + aAffineMatrix2D.m01 = aTransformation.get(0, 1); + aAffineMatrix2D.m02 = aTransformation.get(0, 2) - aPageOffset.X(); + aAffineMatrix2D.m10 = aTransformation.get(1, 0); + aAffineMatrix2D.m11 = aTransformation.get(1, 1); + aAffineMatrix2D.m12 = aTransformation.get(1, 2) - aPageOffset.Y(); + + aRetSet.Put(AffineMatrixItem(&aAffineMatrix2D)); + } } + return aRetSet; } @@ -1351,6 +1452,8 @@ void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& rAttr) bool bChgPos=false; bool bChgSiz=false; + bool bChgWdh=false; + bool bChgHgt=false; bool bRotate=false; bool bShear =false; @@ -1372,6 +1475,7 @@ void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& rAttr) if (SFX_ITEM_SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_WIDTH,sal_True,&pPoolItem)) { nSizX=((const SfxUInt32Item*)pPoolItem)->GetValue(); bChgSiz=true; + bChgWdh=true; } if (SFX_ITEM_SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_HEIGHT,sal_True,&pPoolItem)) { nSizY=((const SfxUInt32Item*)pPoolItem)->GetValue(); @@ -1463,7 +1567,7 @@ void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& rAttr) GetSdrPageView()->PagePosToLogic(aRef); } - ResizeMarkedObj(aRef,aWdt,aHgt); + ResizeMultMarkedObj(aRef, aWdt, aHgt, false, bChgWdh, bChgHgt); } // rotate diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index cb1c00feb61d..6134278eddb8 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -1810,6 +1810,38 @@ void SdrObjEditView::OnEndPasteOrDrop( PasteOrDropInfos* ) // applications can derive from these virtual methods to do something before a drop or paste operation } +sal_uInt16 SdrObjEditView::GetSelectionLevel() const +{ + sal_uInt16 nLevel = 0xFFFF; + if( IsTextEdit() ) + { + DBG_ASSERT(pTextEditOutlinerView!=NULL,"SdrObjEditView::GetAttributes(): pTextEditOutlinerView=NULL"); + DBG_ASSERT(pTextEditOutliner!=NULL,"SdrObjEditView::GetAttributes(): pTextEditOutliner=NULL"); + if( pTextEditOutlinerView ) + { + //start and end position + ESelection aSelect = pTextEditOutlinerView->GetSelection(); + sal_uInt16 nStartPara = ::std::min( aSelect.nStartPara, aSelect.nEndPara ); + sal_uInt16 nEndPara = ::std::max( aSelect.nStartPara, aSelect.nEndPara ); + //get level from each paragraph + nLevel = 0; + for( sal_uInt16 nPara = nStartPara; nPara <= nEndPara; nPara++ ) + { + sal_uInt16 nParaDepth = 1 << pTextEditOutliner->GetDepth( nPara ); + if( !(nLevel & nParaDepth) ) + nLevel += nParaDepth; + } + //reduce one level for Outliner Object + //if( nLevel > 0 && GetTextEditObject()->GetObjIdentifier() == OBJ_OUTLINETEXT ) + // nLevel = nLevel >> 1; + //no bullet paragraph selected + if( nLevel == 0) + nLevel = 0xFFFF; + } + } + return nLevel; +} + bool SdrObjEditView::SupportsFormatPaintbrush( sal_uInt32 nObjectInventor, sal_uInt16 nObjectIdentifier ) const { if( nObjectInventor != SdrInventor && nObjectInventor != E3dInventor ) diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx index b6a2f7159aec..0789a39f3af5 100644 --- a/svx/source/svdraw/svdfmtf.cxx +++ b/svx/source/svdraw/svdfmtf.cxx @@ -343,19 +343,19 @@ void ImpSdrGDIMetaFileImport::SetAttributes(SdrObject* pObj, bool bForceTextAttr switch(maLineJoin) { default : // basegfx::B2DLINEJOIN_NONE - mpLineAttr->Put(XLineJointItem(XLINEJOINT_NONE)); + mpLineAttr->Put(XLineJointItem(com::sun::star::drawing::LineJoint_NONE)); break; case basegfx::B2DLINEJOIN_MIDDLE: - mpLineAttr->Put(XLineJointItem(XLINEJOINT_MIDDLE)); + mpLineAttr->Put(XLineJointItem(com::sun::star::drawing::LineJoint_MIDDLE)); break; case basegfx::B2DLINEJOIN_BEVEL: - mpLineAttr->Put(XLineJointItem(XLINEJOINT_BEVEL)); + mpLineAttr->Put(XLineJointItem(com::sun::star::drawing::LineJoint_BEVEL)); break; case basegfx::B2DLINEJOIN_MITER: - mpLineAttr->Put(XLineJointItem(XLINEJOINT_MITER)); + mpLineAttr->Put(XLineJointItem(com::sun::star::drawing::LineJoint_MITER)); break; case basegfx::B2DLINEJOIN_ROUND: - mpLineAttr->Put(XLineJointItem(XLINEJOINT_ROUND)); + mpLineAttr->Put(XLineJointItem(com::sun::star::drawing::LineJoint_ROUND)); break; } diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index 67bd0a5f7b9e..babab98398e0 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -2991,7 +2991,7 @@ void SdrObjCustomShape::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, aGeo.RecalcTan(); // force metric to pool metric - SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0); + const SfxMapUnit eMapUnit(GetObjectMapUnit()); if(eMapUnit != SFX_MAPUNIT_100TH_MM) { switch(eMapUnit) @@ -3140,7 +3140,7 @@ sal_Bool SdrObjCustomShape::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, ba } // force MapUnit to 100th mm - SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0); + const SfxMapUnit eMapUnit(GetObjectMapUnit()); if(eMapUnit != SFX_MAPUNIT_100TH_MM) { switch(eMapUnit) diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index fca7f2a926a2..7052004d5242 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -2020,6 +2020,23 @@ const SfxPoolItem& SdrObject::GetObjectItem(const sal_uInt16 nWhich) const return GetObjectItemSet().Get(nWhich); } +SfxMapUnit SdrObject::GetObjectMapUnit() const +{ + SfxMapUnit aRetval(SFX_MAPUNIT_100TH_MM); + SdrItemPool* pPool = GetObjectItemPool(); + + if(pPool) + { + aRetval = pPool->GetMetric(0); + } + else + { + OSL_ENSURE(pPool, "SdrObjects always need a pool (!)"); + } + + return aRetval; +} + const SfxPoolItem& SdrObject::GetMergedItem(const sal_uInt16 nWhich) const { return GetMergedItemSet().Get(nWhich); @@ -3073,7 +3090,7 @@ sal_Bool SdrObject::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B } // force MapUnit to 100th mm - SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0); + const SfxMapUnit eMapUnit(GetObjectMapUnit()); if(eMapUnit != SFX_MAPUNIT_100TH_MM) { switch(eMapUnit) @@ -3124,7 +3141,7 @@ void SdrObject::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const ba } // force metric to pool metric - SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0); + const SfxMapUnit eMapUnit(GetObjectMapUnit()); if(eMapUnit != SFX_MAPUNIT_100TH_MM) { switch(eMapUnit) diff --git a/svx/source/svdraw/svdogrp.cxx b/svx/source/svdraw/svdogrp.cxx index 99040493f555..eeeba0a39e65 100644 --- a/svx/source/svdraw/svdogrp.cxx +++ b/svx/source/svdraw/svdogrp.cxx @@ -76,8 +76,6 @@ SdrObjGroup::SdrObjGroup() pSub->SetOwnerObj(this); pSub->SetListKind(SDROBJLIST_GROUPOBJ); bRefPoint=sal_False; - nDrehWink=0; - nShearWink=0; bClosedObj=sal_False; } @@ -288,8 +286,6 @@ SdrObjGroup& SdrObjGroup::operator=(const SdrObjGroup& rObj) pSub->CopyObjects(*rObj.GetSubList()); // copy local parameters - nDrehWink = rObj.nDrehWink; - nShearWink = rObj.nShearWink; aRefPoint = rObj.aRefPoint; bRefPoint = rObj.bRefPoint; return *this; @@ -368,13 +364,33 @@ bool SdrObjGroup::BegCreate(SdrDragStat& /*rStat*/) long SdrObjGroup::GetRotateAngle() const { - return nDrehWink; + const sal_uInt32 nObjCount(pSub->GetObjCount()); + long nRetval(0); + + if(nObjCount) + { + SdrObject* pObj = pSub->GetObj(0); + + nRetval = pObj->GetRotateAngle(); + } + + return nRetval; } long SdrObjGroup::GetShearAngle(bool /*bVertical*/) const { - return nShearWink; + const sal_uInt32 nObjCount(pSub->GetObjCount()); + long nRetval(0); + + if(nObjCount) + { + SdrObject* pObj = pSub->GetObj(0); + + nRetval = pObj->GetShearAngle(); + } + + return nRetval; } @@ -456,7 +472,6 @@ void SdrObjGroup::NbcResize(const Point& rRef, const Fraction& xFact, const Frac void SdrObjGroup::NbcRotate(const Point& rRef, long nWink, double sn, double cs) { SetGlueReallyAbsolute(sal_True); - nDrehWink=NormAngle360(nDrehWink+nWink); RotatePoint(aRefPoint,rRef,sn,cs); SdrObjList* pOL=pSub; sal_uIntPtr nObjAnz=pOL->GetObjCount(); @@ -487,7 +502,6 @@ void SdrObjGroup::NbcMirror(const Point& rRef1, const Point& rRef2) void SdrObjGroup::NbcShear(const Point& rRef, long nWink, double tn, bool bVShear) { SetGlueReallyAbsolute(sal_True); - nShearWink+=nWink; ShearPoint(aRefPoint,rRef,tn); SdrObjList* pOL=pSub; sal_uIntPtr nObjAnz=pOL->GetObjCount(); @@ -625,7 +639,6 @@ void SdrObjGroup::Rotate(const Point& rRef, long nWink, double sn, double cs) if (nWink!=0) { SetGlueReallyAbsolute(sal_True); Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect(); - nDrehWink=NormAngle360(nDrehWink+nWink); RotatePoint(aRefPoint,rRef,sn,cs); // move the connectors first, everything else afterwards SdrObjList* pOL=pSub; @@ -678,7 +691,6 @@ void SdrObjGroup::Shear(const Point& rRef, long nWink, double tn, bool bVShear) if (nWink!=0) { SetGlueReallyAbsolute(sal_True); Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect(); - nShearWink+=nWink; ShearPoint(aRefPoint,rRef,tn); // move the connectors first, everything else afterwards SdrObjList* pOL=pSub; diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx index da8a767956ee..dbbaaef0cd99 100644 --- a/svx/source/svdraw/svdopath.cxx +++ b/svx/source/svdraw/svdopath.cxx @@ -2938,7 +2938,7 @@ sal_Bool SdrPathObj::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx:: } // force MapUnit to 100th mm - SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0); + const SfxMapUnit eMapUnit(GetObjectMapUnit()); if(eMapUnit != SFX_MAPUNIT_100TH_MM) { switch(eMapUnit) @@ -3008,7 +3008,7 @@ void SdrPathObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const b aGeo.RecalcTan(); // force metric to pool metric - SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0); + const SfxMapUnit eMapUnit(GetObjectMapUnit()); if(eMapUnit != SFX_MAPUNIT_100TH_MM) { switch(eMapUnit) diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx index 6496e9f2d833..efb522796697 100644 --- a/svx/source/svdraw/svdotext.cxx +++ b/svx/source/svdraw/svdotext.cxx @@ -1592,7 +1592,7 @@ sal_Bool SdrTextObj::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx:: } // force MapUnit to 100th mm - SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0); + const SfxMapUnit eMapUnit(GetObjectMapUnit()); if(eMapUnit != SFX_MAPUNIT_100TH_MM) { switch(eMapUnit) @@ -1654,7 +1654,7 @@ void SdrTextObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const b aGeo.RecalcTan(); // force metric to pool metric - SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0); + const SfxMapUnit eMapUnit(GetObjectMapUnit()); if(eMapUnit != SFX_MAPUNIT_100TH_MM) { switch(eMapUnit) diff --git a/svx/source/svdraw/svdstr.src b/svx/source/svdraw/svdstr.src index d7c03823b6ba..fe0e3f239901 100644 --- a/svx/source/svdraw/svdstr.src +++ b/svx/source/svdraw/svdstr.src @@ -2817,6 +2817,12 @@ Bitmap SIP_SA_CROP_MARKERS File = "cropmarkers.png"; }; +// DialControl bitmaps +Bitmap IMG_DIALCONTROL +{ + File = "rotation.png"; +}; + String STR_ObjNameSingulFONTWORK { Text [ en-US ] = "font work" ; diff --git a/svx/source/table/accessibletableshape.cxx b/svx/source/table/accessibletableshape.cxx index 0bd4d8b27ab7..a5e910e4e692 100644 --- a/svx/source/table/accessibletableshape.cxx +++ b/svx/source/table/accessibletableshape.cxx @@ -27,7 +27,7 @@ #include <vcl/svapp.hxx> #include <svx/AccessibleTableShape.hxx> -#include "tablecontroller.hxx" +#include <svx/sdr/table/tablecontroller.hxx> #include "accessiblecell.hxx" #include <algorithm> diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx index 5faf3fe2b61b..a56159024175 100644 --- a/svx/source/table/tablecontroller.cxx +++ b/svx/source/table/tablecontroller.cxx @@ -18,7 +18,8 @@ */ -#include "tablecontroller.hxx" +#include <svx/sdr/table/tablecontroller.hxx> +#include <tablemodel.hxx> #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> #include <com/sun/star/container/XIndexAccess.hpp> diff --git a/svx/source/tbxctrls/fillctrl.cxx b/svx/source/tbxctrls/fillctrl.cxx index 7dd6574fd01f..29e3e3b8a59e 100644 --- a/svx/source/tbxctrls/fillctrl.cxx +++ b/svx/source/tbxctrls/fillctrl.cxx @@ -120,14 +120,6 @@ void SvxFillToolBoxControl::StateChanged( delete pStyleItem; pStyleItem = (XFillStyleItem*) pState->Clone(); pFillTypeLB->Enable(); - - eLastXFS = pFillTypeLB->GetSelectEntryPos(); - bUpdate = sal_True; - - XFillStyle eXFS = (XFillStyle)pStyleItem->GetValue(); - pFillTypeLB->SelectEntryPos( - sal::static_int_cast< sal_uInt16 >( eXFS ) ); - pFillAttrLB->Enable(); } else if( pStyleItem ) { @@ -166,6 +158,27 @@ void SvxFillToolBoxControl::StateChanged( bEnableControls = true; } } + + if( pStyleItem ) + { + // ensure that the correct entry is selected in pFillTypeLB. It + // might have been changed by nSID == SID_ATTR_FILL_STYLE, but + // it might also be in an in-between state when user had started to + // change fillstyle, but not yet changed fillvalue for new style + // and when nSID == SID_ATTR_FILL_COLOR/SID_ATTR_FILL_GRADIENT/ + // SID_ATTR_FILL_HATCH/SID_ATTR_FILL_BITMAP value change is triggered + eLastXFS = pFillTypeLB->GetSelectEntryPos(); + XFillStyle eXFS = (XFillStyle)pStyleItem->GetValue(); + + if(eLastXFS != eXFS) + { + bUpdate = sal_True; + pFillTypeLB->SelectEntryPos( sal::static_int_cast< sal_uInt16 >( eXFS ) ); + } + + pFillAttrLB->Enable(); + } + if( bEnableControls ) { //pFillTypeLB->Enable(); @@ -311,13 +324,13 @@ void SvxFillToolBoxControl::Update( const SfxPoolItem* pState ) XGradientList aGradientList( aEmptyString ); aGradientList.Insert( pEntry ); aGradientList.SetDirty( sal_False ); - Bitmap* pBmp = aGradientList.CreateBitmapForUI( 0 ); + const Bitmap aBmp = aGradientList.GetUiBitmap( 0 ); - if( pBmp ) + if( !aBmp.IsEmpty() ) { - ( (ListBox*)pFillAttrLB )->InsertEntry( pEntry->GetName(), *pBmp ); + ( (ListBox*)pFillAttrLB )->InsertEntry( pEntry->GetName(), aBmp ); pFillAttrLB->SelectEntryPos( pFillAttrLB->GetEntryCount() - 1 ); - delete pBmp; + //delete pBmp; } aGradientList.Remove( 0 ); @@ -361,13 +374,13 @@ void SvxFillToolBoxControl::Update( const SfxPoolItem* pState ) XHatchList aHatchList( aEmptyString ); aHatchList.Insert( pEntry ); aHatchList.SetDirty( sal_False ); - Bitmap* pBmp = aHatchList.CreateBitmapForUI( 0 ); + const Bitmap aBmp = aHatchList.GetUiBitmap( 0 ); - if( pBmp ) + if( !aBmp.IsEmpty() ) { - ( (ListBox*)pFillAttrLB )->InsertEntry( pEntry->GetName(), *pBmp ); + ( (ListBox*)pFillAttrLB )->InsertEntry( pEntry->GetName(), aBmp ); pFillAttrLB->SelectEntryPos( pFillAttrLB->GetEntryCount() - 1 ); - delete pBmp; + //delete pBmp; } aHatchList.Remove( 0 ); diff --git a/svx/source/tbxctrls/itemwin.cxx b/svx/source/tbxctrls/itemwin.cxx index da87d2314622..dbc2ede40d91 100644 --- a/svx/source/tbxctrls/itemwin.cxx +++ b/svx/source/tbxctrls/itemwin.cxx @@ -42,8 +42,6 @@ #include "svx/linectrl.hxx" #include <svtools/colorcfg.hxx> -#include "linectrl.hrc" - using namespace ::com::sun::star::uno; using namespace ::com::sun::star::frame; using namespace ::com::sun::star::util; @@ -244,7 +242,7 @@ void SvxLineBox::DataChanged( const DataChangedEvent& rDCEvt ) void SvxLineBox::FillControl() { - FillStyles(); + // FillStyles(); if ( !mpSh ) mpSh = SfxObjectShell::Current(); diff --git a/svx/source/tbxctrls/linectrl.cxx b/svx/source/tbxctrls/linectrl.cxx index b5fa71776b22..6d90f5c73329 100644 --- a/svx/source/tbxctrls/linectrl.cxx +++ b/svx/source/tbxctrls/linectrl.cxx @@ -497,7 +497,6 @@ void SvxLineEndWindow::FillValueSet() if( pLineEndList.is() ) { XLineEndEntry* pEntry = NULL; - Bitmap* pBmp = NULL; VirtualDevice aVD; long nCount = pLineEndList->Count(); @@ -507,16 +506,16 @@ void SvxLineEndWindow::FillValueSet() basegfx::B2DPolyPolygon aNothing; pLineEndList->Insert( new XLineEndEntry( aNothing, SVX_RESSTR( RID_SVXSTR_NONE ) ) ); pEntry = pLineEndList->GetLineEnd( nCount ); - pBmp = pLineEndList->GetBitmap( nCount ); - DBG_ASSERT( pBmp, "UI-Bitmap wurde nicht erzeugt" ); + Bitmap aBmp = pLineEndList->GetUiBitmap( nCount ); + OSL_ENSURE( !aBmp.IsEmpty(), "UI-Bitmap wurde nicht erzeugt" ); - aBmpSize = pBmp->GetSizePixel(); + aBmpSize = aBmp.GetSizePixel(); aVD.SetOutputSizePixel( aBmpSize, sal_False ); aBmpSize.Width() = aBmpSize.Width() / 2; Point aPt0( 0, 0 ); Point aPt1( aBmpSize.Width(), 0 ); - aVD.DrawBitmap( Point(), *pBmp ); + aVD.DrawBitmap( Point(), aBmp ); aLineEndSet.InsertItem( 1, aVD.GetBitmap( aPt0, aBmpSize ), pEntry->GetName() ); aLineEndSet.InsertItem( 2, aVD.GetBitmap( aPt1, aBmpSize ), pEntry->GetName() ); @@ -526,10 +525,10 @@ void SvxLineEndWindow::FillValueSet() { pEntry = pLineEndList->GetLineEnd( i ); DBG_ASSERT( pEntry, "Konnte auf LineEndEntry nicht zugreifen" ); - pBmp = pLineEndList->GetBitmap( i ); - DBG_ASSERT( pBmp, "UI-Bitmap wurde nicht erzeugt" ); + aBmp = pLineEndList->GetUiBitmap( i ); + OSL_ENSURE( !aBmp.IsEmpty(), "UI-Bitmap wurde nicht erzeugt" ); - aVD.DrawBitmap( aPt0, *pBmp ); + aVD.DrawBitmap( aPt0, aBmp ); aLineEndSet.InsertItem( (sal_uInt16)((i+1L)*2L+1L), aVD.GetBitmap( aPt0, aBmpSize ), pEntry->GetName() ); aLineEndSet.InsertItem( (sal_uInt16)((i+2L)*2L), aVD.GetBitmap( aPt1, aBmpSize ), pEntry->GetName() ); } diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index ec3af2bd7424..981e9fbdc1df 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -1269,7 +1269,7 @@ void SvxColorWindow_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eState, co long nCount = pColorList->Count(); XColorEntry* pEntry = NULL; ::Color aColWhite( COL_WHITE ); - String aStrWhite( SVX_RES( RID_SVXITEMS_COLOR_WHITE ) ); + String aStrWhite( EditResId(RID_SVXITEMS_COLOR_WHITE) ); // ScrollBar on or off WinBits nBits = aColorSet.GetStyle(); diff --git a/svx/source/tbxctrls/tbxcolorupdate.cxx b/svx/source/tbxctrls/tbxcolorupdate.cxx index 14e2480974ed..179af8e6c907 100644 --- a/svx/source/tbxctrls/tbxcolorupdate.cxx +++ b/svx/source/tbxctrls/tbxcolorupdate.cxx @@ -98,7 +98,7 @@ namespace svx { BitmapEx aBmpEx( aImage.GetBitmapEx() ); Bitmap aBmp( aBmpEx.GetBitmap() ); - BitmapWriteAccess* pBmpAcc = aBmp.AcquireWriteAccess(); + BitmapWriteAccess* pBmpAcc = aBmp.IsEmpty() ? NULL : aBmp.AcquireWriteAccess(); maBmpSize = aBmp.GetSizePixel(); @@ -131,6 +131,20 @@ namespace svx { if( maBmpSize.Width() <= 16 ) maUpdRect = Rectangle( Point( 0,12 ), Size( maBmpSize.Width(), 4 ) ); + else if(76 == maBmpSize.Width() && 12 == maBmpSize.Height()) + { + maUpdRect.Left() = 22; + maUpdRect.Top() = 2; + maUpdRect.Right() = 73; + maUpdRect.Bottom() = 9; + } + else if(30 == maBmpSize.Width() && 16 == maBmpSize.Height()) + { + maUpdRect.Left() = 17; + maUpdRect.Top() = 2; + maUpdRect.Right() = 27; + maUpdRect.Bottom() = 13; + } else maUpdRect = Rectangle( Point( 1, maBmpSize.Height() - 7 ), Size( maBmpSize.Width() - 2 ,6 ) ); } diff --git a/svx/source/unodraw/unoctabl.cxx b/svx/source/unodraw/unoctabl.cxx index 0ea4b3a60a39..60002a42a37f 100644 --- a/svx/source/unodraw/unoctabl.cxx +++ b/svx/source/unodraw/unoctabl.cxx @@ -231,6 +231,8 @@ uno::Reference< uno::XInterface > SAL_CALL create_EnhancedCustomShapeEngine( con #include "cppuhelper/factory.hxx" #include "uno/lbnames.h" #include <svx/sdr/primitive2d/primitiveFactory2d.hxx> +#include "sidebar/PanelFactory.hxx" + extern "C" { @@ -351,6 +353,15 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL svx_component_getFactory ( ::svx::SvXMLGraphicExportHelper_createInstance, ::svx::SvXMLGraphicExportHelper_getSupportedServiceNames() ); } + else if (::svx::sidebar::PanelFactory::getImplementationName().equalsAscii(pImplName)) + { + xFactory = ::cppu::createSingleFactory( + reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), + ::svx::sidebar::PanelFactory::getImplementationName(), + ::svx::sidebar::PanelFactory::createInstance, + ::svx::sidebar::PanelFactory::getSupportedServiceNames()); + } + if( xFactory.is()) { xFactory->acquire(); diff --git a/svx/source/xoutdev/XPropertyEntry.cxx b/svx/source/xoutdev/XPropertyEntry.cxx new file mode 100644 index 000000000000..ca42908e835f --- /dev/null +++ b/svx/source/xoutdev/XPropertyEntry.cxx @@ -0,0 +1,38 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <svx/XPropertyEntry.hxx> + +XPropertyEntry::XPropertyEntry(const String& rName) +: maName(rName), + maUiBitmap() +{ +} + +XPropertyEntry::XPropertyEntry(const XPropertyEntry& rOther) +: maName(rOther.maName), + maUiBitmap(rOther.maUiBitmap) +{ +} + +XPropertyEntry::~XPropertyEntry() +{ +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx index ed595af66092..540941f5f74e 100644 --- a/svx/source/xoutdev/xattr.cxx +++ b/svx/source/xoutdev/xattr.cxx @@ -3318,7 +3318,7 @@ SvStream& XFillGradientItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) co /************************************************************************* |* -|* const XGradient& XFillGradientItem::GetValue(const XGradientTable* pTable) +|* const XGradient& XFillGradientItem::GetValue(const XGradientList* pTable) |* const |* *************************************************************************/ @@ -3913,7 +3913,7 @@ SvStream& XFillHatchItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const /************************************************************************* |* -|* const XHatch& XFillHatchItem::GetValue(const XHatchTable* pTable) const +|* const XHatch& XFillHatchItem::GetValue(const XHatchList* pTable) const |* *************************************************************************/ diff --git a/svx/source/xoutdev/xattr2.cxx b/svx/source/xoutdev/xattr2.cxx index 5e2fa6ba2a2d..a697fba53b32 100644 --- a/svx/source/xoutdev/xattr2.cxx +++ b/svx/source/xoutdev/xattr2.cxx @@ -27,6 +27,7 @@ #include <svx/dialmgr.hxx> #include <editeng/itemtype.hxx> #include <svx/xdef.hxx> +#include <svx/AffineMatrixItem.hxx> /************************************************************************/ @@ -113,7 +114,7 @@ TYPEINIT1_AUTOFACTORY(XLineJointItem, SfxEnumItem); // ----------------------------------------------------------------------------- -XLineJointItem::XLineJointItem( XLineJoint eLineJoint ) : +XLineJointItem::XLineJointItem( com::sun::star::drawing::LineJoint eLineJoint ) : SfxEnumItem(XATTR_LINEJOINT, sal::static_int_cast< sal_uInt16 >(eLineJoint)) { } @@ -139,7 +140,7 @@ SfxPoolItem* XLineJointItem::Create( SvStream& rIn, sal_uInt16 nVer ) const XLineJointItem* pRet = new XLineJointItem( rIn ); if(nVer < 1) - pRet->SetValue(XLINEJOINT_ROUND); + pRet->SetValue(com::sun::star::drawing::LineJoint_ROUND); return pRet; } @@ -154,7 +155,7 @@ SfxPoolItem* XLineJointItem::Clone(SfxItemPool* /*pPool*/) const // ----------------------------------------------------------------------------- SfxItemPresentation XLineJointItem::GetPresentation( SfxItemPresentation ePres, SfxMapUnit /*eCoreUnit*/, - SfxMapUnit /*ePresUnit*/, OUString& rText, const IntlWrapper*) const + SfxMapUnit /*ePresUnit*/, OUString& rText, const IntlWrapper*) const { rText = OUString(); @@ -169,26 +170,27 @@ SfxItemPresentation XLineJointItem::GetPresentation( SfxItemPresentation ePres, switch( GetValue() ) { - case( XLINEJOINT_NONE ): + case( com::sun::star::drawing::LineJoint_MAKE_FIXED_SIZE ): + case( com::sun::star::drawing::LineJoint_NONE ): nId = RID_SVXSTR_LINEJOINT_NONE; break; - case( XLINEJOINT_MIDDLE ): + case( com::sun::star::drawing::LineJoint_MIDDLE ): nId = RID_SVXSTR_LINEJOINT_MIDDLE; break; - case( XLINEJOINT_BEVEL ): + case( com::sun::star::drawing::LineJoint_BEVEL ): nId = RID_SVXSTR_LINEJOINT_BEVEL; break; - case( XLINEJOINT_MITER ): + case( com::sun::star::drawing::LineJoint_MITER ): nId = RID_SVXSTR_LINEJOINT_MITER; break; - case( XLINEJOINT_ROUND ): + case( com::sun::star::drawing::LineJoint_ROUND ): nId = RID_SVXSTR_LINEJOINT_ROUND; break; } @@ -207,28 +209,7 @@ SfxItemPresentation XLineJointItem::GetPresentation( SfxItemPresentation ePres, bool XLineJointItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const { - ::com::sun::star::drawing::LineJoint eJoint = ::com::sun::star::drawing::LineJoint_NONE; - - switch( GetValue() ) - { - case XLINEJOINT_NONE: - break; - case XLINEJOINT_MIDDLE: - eJoint = ::com::sun::star::drawing::LineJoint_MIDDLE; - break; - case XLINEJOINT_BEVEL: - eJoint = ::com::sun::star::drawing::LineJoint_BEVEL; - break; - case XLINEJOINT_MITER: - eJoint = ::com::sun::star::drawing::LineJoint_MITER; - break; - case XLINEJOINT_ROUND: - eJoint = ::com::sun::star::drawing::LineJoint_ROUND; - break; - default: - OSL_FAIL( "Unknown LineJoint enum value!" ); - } - + const ::com::sun::star::drawing::LineJoint eJoint = GetValue(); rVal <<= eJoint; return true; } @@ -237,7 +218,6 @@ bool XLineJointItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*n bool XLineJointItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) { - XLineJoint eJoint = XLINEJOINT_NONE; ::com::sun::star::drawing::LineJoint eUnoJoint; if(!(rVal >>= eUnoJoint)) @@ -249,25 +229,7 @@ bool XLineJointItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 eUnoJoint = (::com::sun::star::drawing::LineJoint)nLJ; } - switch( eUnoJoint ) - { - case ::com::sun::star::drawing::LineJoint_MIDDLE: - eJoint = XLINEJOINT_MIDDLE; - break; - case ::com::sun::star::drawing::LineJoint_BEVEL: - eJoint = XLINEJOINT_BEVEL; - break; - case ::com::sun::star::drawing::LineJoint_MITER: - eJoint = XLINEJOINT_MITER; - break; - case ::com::sun::star::drawing::LineJoint_ROUND: - eJoint = XLINEJOINT_ROUND; - break; - default: - break; - } - - SetValue( sal::static_int_cast< sal_uInt16 >( eJoint ) ); + SetValue( sal::static_int_cast< sal_uInt16 >( eUnoJoint ) ); return true; } @@ -280,6 +242,116 @@ sal_uInt16 XLineJointItem::GetValueCount() const return 5; } +//--------------------- +// class AffineMatrixItem +//--------------------- + +TYPEINIT1_AUTOFACTORY(AffineMatrixItem, SfxPoolItem); + +AffineMatrixItem::AffineMatrixItem(const com::sun::star::geometry::AffineMatrix2D* pMatrix) +: SfxPoolItem(SID_ATTR_TRANSFORM_MATRIX) +{ + if(pMatrix) + { + maMatrix = *pMatrix; + } + else + { + maMatrix.m00 = 1.0; + maMatrix.m01 = 0.0; + maMatrix.m02 = 0.0; + maMatrix.m10 = 0.0; + maMatrix.m11 = 1.0; + maMatrix.m12 = 0.0; + } +} + +AffineMatrixItem::AffineMatrixItem(SvStream& rIn) +: SfxPoolItem(SID_ATTR_TRANSFORM_MATRIX) +{ + rIn >> maMatrix.m00; + rIn >> maMatrix.m01; + rIn >> maMatrix.m02; + rIn >> maMatrix.m10; + rIn >> maMatrix.m11; + rIn >> maMatrix.m12; +} + +AffineMatrixItem::AffineMatrixItem(const AffineMatrixItem& rRef) +: SfxPoolItem(SID_ATTR_TRANSFORM_MATRIX) +{ + maMatrix = rRef.maMatrix; +} + +AffineMatrixItem::~AffineMatrixItem() +{ +} + +int AffineMatrixItem::operator==(const SfxPoolItem& rRef) const +{ + if(!SfxPoolItem::operator==(rRef)) + { + return 0; + } + + const AffineMatrixItem* pRef = dynamic_cast< const AffineMatrixItem* >(&rRef); + + if(!pRef) + { + return 0; + } + + return (maMatrix.m00 == pRef->maMatrix.m00 + && maMatrix.m01 == pRef->maMatrix.m01 + && maMatrix.m02 == pRef->maMatrix.m02 + && maMatrix.m10 == pRef->maMatrix.m10 + && maMatrix.m11 == pRef->maMatrix.m11 + && maMatrix.m12 == pRef->maMatrix.m12); +} + +SfxPoolItem* AffineMatrixItem::Clone( SfxItemPool* /*pPool*/ ) const +{ + return new AffineMatrixItem(*this); +} + +SfxPoolItem* AffineMatrixItem::Create( SvStream& rIn, sal_uInt16 /*nVer*/ ) const +{ + return new AffineMatrixItem(rIn); +} + +SvStream& AffineMatrixItem::Store(SvStream &rStream, sal_uInt16 /*nItemVersion*/ ) const +{ + rStream << maMatrix.m00; + rStream << maMatrix.m01; + rStream << maMatrix.m02; + rStream << maMatrix.m10; + rStream << maMatrix.m11; + rStream << maMatrix.m12; + return rStream; +} + +bool AffineMatrixItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const +{ + rVal <<= maMatrix; + return true; +} + +bool AffineMatrixItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) +{ + if (rVal >>= maMatrix) + { + return true; + } + + OSL_ENSURE(false, "AffineMatrixItem::PutValue - Wrong type!"); + return false; +} + +const com::sun::star::geometry::AffineMatrix2D& AffineMatrixItem::GetAffineMatrix2D() const +{ + return maMatrix; +} + //----------------------- // class XLineCapItem - //----------------------- diff --git a/svx/source/xoutdev/xpool.cxx b/svx/source/xoutdev/xpool.cxx index 5a04d3c38c3c..677c2b8d9c2e 100644 --- a/svx/source/xoutdev/xpool.cxx +++ b/svx/source/xoutdev/xpool.cxx @@ -157,6 +157,13 @@ XOutdevItemPool::XOutdevItemPool( mpLocalItemInfos[XATTR_FORMTXTSTDFORM -XATTR_START]._nSID = SID_FORMTEXT_STDFORM; mpLocalItemInfos[XATTR_FORMTXTHIDEFORM -XATTR_START]._nSID = SID_FORMTEXT_HIDEFORM; + // associate new slots for panels with known items + mpLocalItemInfos[XATTR_FILLTRANSPARENCE - XATTR_START]._nSID = SID_ATTR_FILL_TRANSPARENCE; + mpLocalItemInfos[XATTR_FILLFLOATTRANSPARENCE - XATTR_START]._nSID = SID_ATTR_FILL_FLOATTRANSPARENCE; + mpLocalItemInfos[XATTR_LINETRANSPARENCE - XATTR_START]._nSID = SID_ATTR_LINE_TRANSPARENCE; + mpLocalItemInfos[XATTR_LINEJOINT - XATTR_START]._nSID = SID_ATTR_LINE_JOINT; + mpLocalItemInfos[XATTR_LINECAP - XATTR_START]._nSID = SID_ATTR_LINE_CAP; + // if it's my own creation level, set Defaults and ItemInfos if(XATTR_START == GetFirstWhich() && XATTR_END == GetLastWhich()) { diff --git a/svx/source/xoutdev/xtabbtmp.cxx b/svx/source/xoutdev/xtabbtmp.cxx index a3657018472d..328366a6c3ed 100644 --- a/svx/source/xoutdev/xtabbtmp.cxx +++ b/svx/source/xoutdev/xtabbtmp.cxx @@ -94,14 +94,9 @@ sal_Bool XBitmapList::Create() return sal_True; } -sal_Bool XBitmapList::CreateBitmapsForUI() +Bitmap XBitmapList::CreateBitmapForUI( long /*nIndex*/ ) { - return sal_False; -} - -Bitmap* XBitmapList::CreateBitmapForUI( long /*nIndex*/, sal_Bool /*bDelete*/) -{ - return NULL; + return Bitmap(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/xoutdev/xtabcolr.cxx b/svx/source/xoutdev/xtabcolr.cxx index 47a2e05cf6a6..b4628c68d404 100644 --- a/svx/source/xoutdev/xtabcolr.cxx +++ b/svx/source/xoutdev/xtabcolr.cxx @@ -353,14 +353,9 @@ sal_Bool XColorList::Create() return Count() == 104; } -sal_Bool XColorList::CreateBitmapsForUI() +Bitmap XColorList::CreateBitmapForUI( long /*nIndex*/ ) { - return sal_False; -} - -Bitmap* XColorList::CreateBitmapForUI( long /*nIndex*/, sal_Bool /*bDelete*/) -{ - return NULL; + return Bitmap(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/xoutdev/xtabdash.cxx b/svx/source/xoutdev/xtabdash.cxx index e96b8a5b5037..40eac343d2c9 100644 --- a/svx/source/xoutdev/xtabdash.cxx +++ b/svx/source/xoutdev/xtabdash.cxx @@ -82,11 +82,12 @@ void XDashList::impCreate() VirtualDevice* pVirDev = new VirtualDevice; OSL_ENSURE(0 != pVirDev, "XDashList: no VirtualDevice created!" ); pVirDev->SetMapMode(MAP_100TH_MM); - const Size aSize(pVirDev->PixelToLogic(Size(BITMAP_WIDTH * 2, BITMAP_HEIGHT))); + const Size aSize(pVirDev->PixelToLogic(Size(getUiBitmapWidth() * 2, getUiBitmapHeight()))); pVirDev->SetOutputSize(aSize); pVirDev->SetDrawMode(rStyleSettings.GetHighContrastMode() ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT : DRAWMODE_DEFAULT); + pVirDev->SetBackground(rStyleSettings.GetFieldColor()); SdrModel* pSdrModel = new SdrModel(); OSL_ENSURE(0 != pSdrModel, "XDashList: no SdrModel created!" ); @@ -110,8 +111,8 @@ void XDashList::impCreate() pLineObject->SetModel(pSdrModel); pLineObject->SetMergedItem(XLineStyleItem(XLINE_DASH)); pLineObject->SetMergedItem(XLineColorItem(String(), rStyleSettings.GetFieldTextColor())); - pLineObject->SetMergedItem(XLineWidthItem(30)); - + const Size aLineWidth(pVirDev->PixelToLogic(Size(getUiBitmapLineWidth(), 0))); + pLineObject->SetMergedItem(XLineWidthItem(aLineWidth.getWidth())); mpData = new impXDashList(pVirDev, pSdrModel, pBackgroundObject, pLineObject); OSL_ENSURE(0 != mpData, "XDashList: data creation went wrong!" ); } @@ -123,12 +124,13 @@ void XDashList::impDestroy() mpData = 0; } -XDashList::XDashList( const String& rPath, - XOutdevItemPool* pInPool) : - XPropertyList( XDASH_LIST, rPath, pInPool ), - mpData(0) +XDashList::XDashList(const String& rPath, XOutdevItemPool* pInPool ) +: XPropertyList( XDASH_LIST, rPath, pInPool ), + mpData(0), + maBitmapSolidLine(), + maStringSolidLine(), + maStringNoLine() { - pBmpList = new BitmapList_impl(); } XDashList::~XDashList() @@ -173,38 +175,21 @@ sal_Bool XDashList::Create() return sal_True; } -sal_Bool XDashList::CreateBitmapsForUI() -{ - impCreate(); - - for( long i = 0; i < Count(); i++) - { - Bitmap* pBmp = CreateBitmapForUI( i, sal_False ); - DBG_ASSERT( pBmp, "XDashList: Bitmap(UI) konnte nicht erzeugt werden!" ); - - if( pBmp ) - { - if ( (size_t)i < pBmpList->size() ) { - pBmpList->insert( pBmpList->begin() + i, pBmp ); - } else { - pBmpList->push_back( pBmp ); - } - } - } - - impDestroy(); - - return sal_True; -} - -Bitmap* XDashList::CreateBitmapForUI( long nIndex, sal_Bool bDelete ) +Bitmap XDashList::ImpCreateBitmapForXDash(const XDash* pDash) { impCreate(); VirtualDevice* pVD = mpData->getVirtualDevice(); SdrObject* pLine = mpData->getLineObject(); - pLine->SetMergedItem(XLineStyleItem(XLINE_DASH)); - pLine->SetMergedItem(XLineDashItem(String(), GetDash(nIndex)->GetDash())); + if(pDash) + { + pLine->SetMergedItem(XLineStyleItem(XLINE_DASH)); + pLine->SetMergedItem(XLineDashItem(String(), *pDash)); + } + else + { + pLine->SetMergedItem(XLineStyleItem(XLINE_SOLID)); + } sdr::contact::SdrObjectVector aObjectVector; aObjectVector.push_back(mpData->getBackgroundObject()); @@ -212,15 +197,50 @@ Bitmap* XDashList::CreateBitmapForUI( long nIndex, sal_Bool bDelete ) sdr::contact::ObjectContactOfObjListPainter aPainter(*pVD, aObjectVector, 0); sdr::contact::DisplayInfo aDisplayInfo; + pVD->Erase(); aPainter.ProcessDisplay(aDisplayInfo); const Point aZero(0, 0); - Bitmap* pBitmap = new Bitmap(pVD->GetBitmap(aZero, pVD->GetOutputSize())); + return pVD->GetBitmap(aZero, pVD->GetOutputSize()); +} + +Bitmap XDashList::CreateBitmapForUI( long nIndex ) +{ + const XDash& rDash = GetDash(nIndex)->GetDash(); + + return ImpCreateBitmapForXDash(&rDash); +} + +Bitmap XDashList::GetBitmapForUISolidLine() const +{ + if(maBitmapSolidLine.IsEmpty()) + { + const_cast< XDashList* >(this)->maBitmapSolidLine = const_cast< XDashList* >(this)->ImpCreateBitmapForXDash(0); + } + + return maBitmapSolidLine; +} - if(bDelete) - impDestroy(); +String XDashList::GetStringForUiSolidLine() const +{ + if(!maStringSolidLine.Len()) + { + const_cast< XDashList* >(this)->maStringSolidLine = String(ResId(RID_SVXSTR_SOLID, DIALOG_MGR())); + } + + return maStringSolidLine; +} + +String XDashList::GetStringForUiNoLine() const +{ + if(!maStringNoLine.Len()) + { + // formally was RID_SVXSTR_INVISIBLE, but tomake equal + // everywhere, use RID_SVXSTR_NONE + const_cast< XDashList* >(this)->maStringNoLine = String(ResId(RID_SVXSTR_NONE, DIALOG_MGR())); + } - return pBitmap; + return maStringNoLine; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/xoutdev/xtabgrdt.cxx b/svx/source/xoutdev/xtabgrdt.cxx index 12ed959ddd74..c753e6e0a33c 100644 --- a/svx/source/xoutdev/xtabgrdt.cxx +++ b/svx/source/xoutdev/xtabgrdt.cxx @@ -73,11 +73,12 @@ void XGradientList::impCreate() VirtualDevice* pVirDev = new VirtualDevice; OSL_ENSURE(0 != pVirDev, "XGradientList: no VirtualDevice created!" ); pVirDev->SetMapMode(MAP_100TH_MM); - const Size aSize(pVirDev->PixelToLogic(Size(BITMAP_WIDTH, BITMAP_HEIGHT))); + const Size aSize(pVirDev->PixelToLogic(Size(getUiBitmapWidth(), getUiBitmapHeight()))); pVirDev->SetOutputSize(aSize); pVirDev->SetDrawMode(rStyleSettings.GetHighContrastMode() ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT : DRAWMODE_DEFAULT); + pVirDev->SetBackground(rStyleSettings.GetFieldColor()); SdrModel* pSdrModel = new SdrModel(); OSL_ENSURE(0 != pSdrModel, "XGradientList: no SdrModel created!" ); @@ -91,7 +92,7 @@ void XGradientList::impCreate() pBackgroundObject->SetMergedItem(XFillStyleItem(XFILL_GRADIENT)); pBackgroundObject->SetMergedItem(XLineStyleItem(XLINE_SOLID)); pBackgroundObject->SetMergedItem(XLineColorItem(String(), Color(COL_BLACK))); - pBackgroundObject->SetMergedItem(XGradientStepCountItem(sal_uInt16((BITMAP_WIDTH + BITMAP_HEIGHT) / 3))); + pBackgroundObject->SetMergedItem(XGradientStepCountItem(sal_uInt16((getUiBitmapWidth() + getUiBitmapHeight()) / 3))); mpData = new impXGradientList(pVirDev, pSdrModel, pBackgroundObject); OSL_ENSURE(0 != mpData, "XGradientList: data creation went wrong!" ); @@ -107,11 +108,10 @@ void XGradientList::impDestroy() } } -XGradientList::XGradientList( const String& rPath, XOutdevItemPool* pInPool ) : - XPropertyList( XGRADIENT_LIST, rPath, pInPool ), - mpData( NULL ) +XGradientList::XGradientList( const String& rPath, XOutdevItemPool* pInPool ) +: XPropertyList( XGRADIENT_LIST, rPath, pInPool ), + mpData(0) { - pBmpList = new BitmapList_impl(); } XGradientList::~XGradientList() @@ -167,31 +167,7 @@ sal_Bool XGradientList::Create() return( sal_True ); } -sal_Bool XGradientList::CreateBitmapsForUI() -{ - impCreate(); - - for( long i = 0; i < Count(); i++) - { - Bitmap* pBmp = CreateBitmapForUI( i, sal_False ); - DBG_ASSERT( pBmp, "XGradientList: Bitmap(UI) konnte nicht erzeugt werden!" ); - - if( pBmp ) - { - if ( (size_t)i < pBmpList->size() ) { - pBmpList->insert( pBmpList->begin() + i, pBmp ); - } else { - pBmpList->push_back( pBmp ); - } - } - } - - impDestroy(); - - return( sal_False ); -} - -Bitmap* XGradientList::CreateBitmapForUI( long nIndex, sal_Bool bDelete ) +Bitmap XGradientList::CreateBitmapForUI( long nIndex ) { impCreate(); VirtualDevice* pVD = mpData->getVirtualDevice(); @@ -205,17 +181,11 @@ Bitmap* XGradientList::CreateBitmapForUI( long nIndex, sal_Bool bDelete ) sdr::contact::ObjectContactOfObjListPainter aPainter(*pVD, aObjectVector, 0); sdr::contact::DisplayInfo aDisplayInfo; + pVD->Erase(); aPainter.ProcessDisplay(aDisplayInfo); const Point aZero(0, 0); - Bitmap* pBitmap = new Bitmap(pVD->GetBitmap(aZero, pVD->GetOutputSize())); - - if(bDelete) - { - impDestroy(); - } - - return pBitmap; + return pVD->GetBitmap(aZero, pVD->GetOutputSize()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/xoutdev/xtabhtch.cxx b/svx/source/xoutdev/xtabhtch.cxx index 4ec8530bd43f..da88b3271179 100644 --- a/svx/source/xoutdev/xtabhtch.cxx +++ b/svx/source/xoutdev/xtabhtch.cxx @@ -79,11 +79,12 @@ void XHatchList::impCreate() VirtualDevice* pVirDev = new VirtualDevice; OSL_ENSURE(0 != pVirDev, "XDashList: no VirtualDevice created!" ); pVirDev->SetMapMode(MAP_100TH_MM); - const Size aSize(pVirDev->PixelToLogic(Size(BITMAP_WIDTH, BITMAP_HEIGHT))); + const Size aSize(pVirDev->PixelToLogic(Size(getUiBitmapWidth(), getUiBitmapHeight()))); pVirDev->SetOutputSize(aSize); pVirDev->SetDrawMode(rStyleSettings.GetHighContrastMode() ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT : DRAWMODE_DEFAULT); + pVirDev->SetBackground(rStyleSettings.GetFieldColor()); SdrModel* pSdrModel = new SdrModel(); OSL_ENSURE(0 != pSdrModel, "XDashList: no SdrModel created!" ); @@ -116,12 +117,10 @@ void XHatchList::impDestroy() mpData = NULL; } -XHatchList::XHatchList( const String& rPath, - XOutdevItemPool* pInPool ) +XHatchList::XHatchList(const String& rPath, XOutdevItemPool* pInPool) : XPropertyList( XHATCH_LIST, rPath, pInPool ), - mpData( NULL ) + mpData(0) { - pBmpList = new BitmapList_impl(); } XHatchList::~XHatchList() @@ -167,31 +166,7 @@ sal_Bool XHatchList::Create() return( sal_True ); } -sal_Bool XHatchList::CreateBitmapsForUI() -{ - impCreate(); - - for( long i = 0; i < Count(); i++) - { - Bitmap* pBmp = CreateBitmapForUI( i, sal_False ); - DBG_ASSERT( pBmp, "XHatchList: Bitmap(UI) konnte nicht erzeugt werden!" ); - - if( pBmp ) - { - if ( (size_t)i < pBmpList->size() ) { - pBmpList->insert( pBmpList->begin() + i, pBmp ); - } else { - pBmpList->push_back( pBmp ); - } - } - } - - impDestroy(); - - return( sal_True ); -} - -Bitmap* XHatchList::CreateBitmapForUI( long nIndex, sal_Bool bDelete ) +Bitmap XHatchList::CreateBitmapForUI( long nIndex ) { impCreate(); VirtualDevice* pVD = mpData->getVirtualDevice(); @@ -206,15 +181,11 @@ Bitmap* XHatchList::CreateBitmapForUI( long nIndex, sal_Bool bDelete ) sdr::contact::ObjectContactOfObjListPainter aPainter(*pVD, aObjectVector, 0); sdr::contact::DisplayInfo aDisplayInfo; + pVD->Erase(); aPainter.ProcessDisplay(aDisplayInfo); const Point aZero(0, 0); - Bitmap* pBitmap = new Bitmap(pVD->GetBitmap(aZero, pVD->GetOutputSize())); - - if(bDelete) - impDestroy(); - - return pBitmap; + return pVD->GetBitmap(aZero, pVD->GetOutputSize()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/xoutdev/xtable.cxx b/svx/source/xoutdev/xtable.cxx index 03dfa29447c2..3999ba25721f 100644 --- a/svx/source/xoutdev/xtable.cxx +++ b/svx/source/xoutdev/xtable.cxx @@ -24,6 +24,8 @@ #include <tools/urlobj.hxx> #include <svx/xtable.hxx> #include <svx/xpool.hxx> +#include <svx/svdobj.hxx> +#include <svx/svdpool.hxx> using namespace com::sun::star; @@ -41,156 +43,106 @@ XPropertyList::XPropertyList( XPropertyListType type, const String& rPath, XOutdevItemPool* pInPool -) : eType ( type ), - aName ( RTL_CONSTASCII_USTRINGPARAM( "standard" ) ), - aPath ( rPath ), - pXPool ( pInPool ), - pBmpList ( NULL ), - bListDirty ( true ), - bBitmapsDirty ( true ), - bOwnPool ( false ), - bEmbedInDocument( false ) +) : meType ( type ), + maName ( RTL_CONSTASCII_USTRINGPARAM( "standard" ) ), + maPath ( rPath ), + mpXPool ( pInPool ), + mbListDirty ( true ), + mbEmbedInDocument( false ) { - if( !pXPool ) + if( !mpXPool ) { - bOwnPool = true; - pXPool = new XOutdevItemPool; - DBG_ASSERT( pXPool, "XOutPool konnte nicht erzeugt werden!" ); + mpXPool = static_cast< XOutdevItemPool* >(&SdrObject::GetGlobalDrawObjectItemPool()); } -// fprintf (stderr, "Create type %d count %d\n", (int)eType, count++); +// fprintf (stderr, "Create type %d count %d\n", (int)meType, count++); } XPropertyList::~XPropertyList() { -// fprintf (stderr, "Destroy type %d count %d\n", (int)eType, --count); - for( size_t i = 0, n = aList.size(); i < n; ++i ) - delete aList[ i ]; +// fprintf (stderr, "Destroy type %d count %d\n", (int)meType, --count); + for( size_t i = 0, n = maList.size(); i < n; ++i ) + delete maList[ i ]; - aList.clear(); - - if( pBmpList ) - { - for ( size_t i = 0, n = pBmpList->size(); i < n; ++i ) { - delete (*pBmpList)[ i ]; - } - pBmpList->clear(); - delete pBmpList; - pBmpList = NULL; - } - - if( bOwnPool && pXPool ) - SfxItemPool::Free(pXPool); + maList.clear(); } long XPropertyList::Count() const { - if( bListDirty ) + if( mbListDirty ) { if( !( (XPropertyList*) this )->Load() ) ( (XPropertyList*) this )->Create(); } - return( aList.size() ); + return maList.size(); } XPropertyEntry* XPropertyList::Get( long nIndex, sal_uInt16 /*nDummy*/) const { - if( bListDirty ) + if( mbListDirty ) { if( !( (XPropertyList*) this )->Load() ) ( (XPropertyList*) this )->Create(); } - return ( (size_t)nIndex < aList.size() ) ? aList[ nIndex ] : NULL; + return ( (size_t)nIndex < maList.size() ) ? maList[ nIndex ] : NULL; } long XPropertyList::Get(const XubString& rName) { - if( bListDirty ) + if( mbListDirty ) { if( !Load() ) Create(); } - for( long i = 0, n = aList.size(); i < n; ++i ) { - if ( aList[ i ]->GetName() == rName ) { + for( long i = 0, n = maList.size(); i < n; ++i ) { + if ( maList[ i ]->GetName() == rName ) { return i; } } return -1; } -Bitmap* XPropertyList::GetBitmap( long nIndex ) const +Bitmap XPropertyList::GetUiBitmap( long nIndex ) const { - if( pBmpList ) + Bitmap aRetval; + XPropertyEntry* pEntry = ( (size_t)nIndex < maList.size() ) ? maList[ nIndex ] : NULL; + if(pEntry) { - if( bBitmapsDirty ) + aRetval = pEntry->GetUiBitmap(); + + if(aRetval.IsEmpty()) { - ( (XPropertyList*) this )->bBitmapsDirty = false; - ( (XPropertyList*) this )->CreateBitmapsForUI(); + aRetval = const_cast< XPropertyList* >(this)->CreateBitmapForUI(nIndex); + pEntry->SetUiBitmap(aRetval); } - if( (size_t)nIndex < pBmpList->size() ) - return (*pBmpList)[ nIndex ]; } - return NULL; + return aRetval; } void XPropertyList::Insert( XPropertyEntry* pEntry, long nIndex ) { - if ( (size_t)nIndex < aList.size() ) { - aList.insert( aList.begin() + nIndex, pEntry ); + if ( (size_t)nIndex < maList.size() ) { + maList.insert( maList.begin() + nIndex, pEntry ); } else { - aList.push_back( pEntry ); - } - - if( pBmpList && !bBitmapsDirty ) - { - Bitmap* pBmp = CreateBitmapForUI( - (size_t)nIndex < aList.size() ? nIndex : aList.size() - 1 - ); - if ( (size_t)nIndex < pBmpList->size() ) { - pBmpList->insert( pBmpList->begin() + nIndex, pBmp ); - } else { - pBmpList->push_back( pBmp ); - } + maList.push_back( pEntry ); } } XPropertyEntry* XPropertyList::Replace( XPropertyEntry* pEntry, long nIndex ) { - XPropertyEntry* pOldEntry = (size_t)nIndex < aList.size() ? aList[ nIndex ] : NULL; + XPropertyEntry* pOldEntry = (size_t)nIndex < maList.size() ? maList[ nIndex ] : NULL; if ( pOldEntry ) { - aList[ nIndex ] = pEntry; - } - - if( pBmpList && !bBitmapsDirty ) - { - Bitmap* pBmp = CreateBitmapForUI( (sal_uIntPtr) nIndex ); - if ( (size_t)nIndex < pBmpList->size() ) - { - delete (*pBmpList)[ nIndex ]; - (*pBmpList)[ nIndex ] = pBmp; - } - else { - pBmpList->push_back( pBmp ); - } + maList[ nIndex ] = pEntry; } return pOldEntry; } XPropertyEntry* XPropertyList::Remove( long nIndex ) { - if( pBmpList && !bBitmapsDirty ) - { - if ( (size_t)nIndex < pBmpList->size() ) - { - delete (*pBmpList)[ nIndex ]; - pBmpList->erase( pBmpList->begin() + nIndex ); - } - } - XPropertyEntry* pEntry = NULL; - if ( (size_t)nIndex < aList.size() ) { - pEntry = aList[ nIndex ]; - aList.erase( aList.begin() + nIndex ); + if ( (size_t)nIndex < maList.size() ) { + pEntry = maList[ nIndex ]; + maList.erase( maList.begin() + nIndex ); } return pEntry; } @@ -199,25 +151,25 @@ void XPropertyList::SetName( const String& rString ) { if(rString.Len()) { - aName = rString; + maName = rString; } } bool XPropertyList::Load() { - if( bListDirty ) + if( mbListDirty ) { - bListDirty = false; + mbListDirty = false; - INetURLObject aURL( aPath ); + INetURLObject aURL( maPath ); if( INET_PROT_NOT_VALID == aURL.GetProtocol() ) { - DBG_ASSERT( !aPath.Len(), "invalid URL" ); + DBG_ASSERT( !maPath.Len(), "invalid URL" ); return false; } - aURL.Append( aName ); + aURL.Append( maName ); if( aURL.getExtension().isEmpty() ) aURL.setExtension( GetDefaultExt() ); @@ -225,7 +177,6 @@ bool XPropertyList::Load() return SvxXMLXTableImport::load( aURL.GetMainURL( INetURLObject::NO_DECODE ), uno::Reference < embed::XStorage >(), createInstance(), NULL ); - } return false; } @@ -233,23 +184,23 @@ bool XPropertyList::Load() bool XPropertyList::LoadFrom( const uno::Reference < embed::XStorage > &xStorage, const OUString &rURL ) { - if( !bListDirty ) + if( !mbListDirty ) return false; - bListDirty = false; - return SvxXMLXTableImport::load( rURL, xStorage, createInstance(), &bEmbedInDocument ); + mbListDirty = false; + return SvxXMLXTableImport::load( rURL, xStorage, createInstance(), &mbEmbedInDocument ); } bool XPropertyList::Save() { - INetURLObject aURL( aPath ); + INetURLObject aURL( maPath ); if( INET_PROT_NOT_VALID == aURL.GetProtocol() ) { - DBG_ASSERT( !aPath.Len(), "invalid URL" ); + DBG_ASSERT( !maPath.Len(), "invalid URL" ); return false; } - aURL.Append( aName ); + aURL.Append( maName ); if( aURL.getExtension().isEmpty() ) aURL.setExtension( GetDefaultExt() ); @@ -285,7 +236,7 @@ XPropertyListRef XPropertyList::CreatePropertyList( XPropertyListType t, break; } #undef MAP - OSL_ASSERT( !pRet.is() || pRet->eType == t ); + OSL_ASSERT( !pRet.is() || pRet->meType == t ); return pRet; } @@ -348,4 +299,25 @@ OUString XPropertyList::GetDefaultExtFilter( XPropertyListType t ) return aFilter + GetDefaultExt( t ); } +sal_uInt32 XPropertyList::getUiBitmapWidth() const +{ + static sal_uInt32 nWidth = 32; // alternative: 42; + + return nWidth; +} + +sal_uInt32 XPropertyList::getUiBitmapHeight() const +{ + static sal_uInt32 nHeight = 12; // alternative: 16; + + return nHeight; +} + +sal_uInt32 XPropertyList::getUiBitmapLineWidth() const +{ + static sal_uInt32 nLineWidth = 3; + + return nLineWidth; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/xoutdev/xtablend.cxx b/svx/source/xoutdev/xtablend.cxx index ddd1489dbce9..1003c1d70847 100644 --- a/svx/source/xoutdev/xtablend.cxx +++ b/svx/source/xoutdev/xtablend.cxx @@ -45,6 +45,7 @@ #include <svx/svdmodel.hxx> #include <svx/sdr/contact/objectcontactofobjlistpainter.hxx> #include <svx/sdr/contact/displayinfo.hxx> +#include <svx/xlnwtit.hxx> using namespace com::sun::star; @@ -86,11 +87,13 @@ void XLineEndList::impCreate() VirtualDevice* pVirDev = new VirtualDevice; OSL_ENSURE(0 != pVirDev, "XLineEndList: no VirtualDevice created!" ); - const Size aSize(BITMAP_WIDTH * 2, BITMAP_HEIGHT); + pVirDev->SetMapMode(MAP_100TH_MM); + const Size aSize(pVirDev->PixelToLogic(Size(getUiBitmapWidth() * 2, getUiBitmapHeight()))); pVirDev->SetOutputSize(aSize); pVirDev->SetDrawMode(rStyleSettings.GetHighContrastMode() ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT : DRAWMODE_DEFAULT); + pVirDev->SetBackground(rStyleSettings.GetFieldColor()); SdrModel* pSdrModel = new SdrModel(); OSL_ENSURE(0 != pSdrModel, "XLineEndList: no SdrModel created!" ); @@ -112,8 +115,11 @@ void XLineEndList::impCreate() SdrObject* pLineObject = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aPolygon)); OSL_ENSURE(0 != pLineObject, "XLineEndList: no LineObject created!" ); pLineObject->SetModel(pSdrModel); - pLineObject->SetMergedItem(XLineStartWidthItem(aSize.Height() - 2)); // fdo#48536: prevent the lineend from - pLineObject->SetMergedItem(XLineEndWidthItem(aSize.Height() - 2)); // exceeding the background area + const Size aLineWidth(pVirDev->PixelToLogic(Size(getUiBitmapLineWidth(), 0))); + pLineObject->SetMergedItem(XLineWidthItem(aLineWidth.getWidth())); + const sal_uInt32 nArrowHeight((aSize.Height() * 8) / 10); + pLineObject->SetMergedItem(XLineStartWidthItem(nArrowHeight)); + pLineObject->SetMergedItem(XLineEndWidthItem(nArrowHeight)); pLineObject->SetMergedItem(XLineColorItem(String(), rStyleSettings.GetFieldTextColor())); mpData = new impXLineEndList(pVirDev, pSdrModel, pBackgroundObject, pLineObject); @@ -131,7 +137,6 @@ XLineEndList::XLineEndList( const String& rPath, XOutdevItemPool* _pXPool ) : XPropertyList( XLINE_END_LIST, rPath, _pXPool ), mpData(NULL) { - pBmpList = new BitmapList_impl(); } XLineEndList::~XLineEndList() @@ -178,31 +183,7 @@ sal_Bool XLineEndList::Create() return sal_True; } -sal_Bool XLineEndList::CreateBitmapsForUI() -{ - impCreate(); - - for( long i = 0; i < Count(); i++) - { - Bitmap* pBmp = CreateBitmapForUI( i, sal_False ); - OSL_ENSURE(0 != pBmp, "XLineEndList: Bitmap(UI) could not be created!" ); - - if( pBmp ) - { - if ( (size_t)i < pBmpList->size() ) { - pBmpList->insert( pBmpList->begin() + i, pBmp ); - } else { - pBmpList->push_back( pBmp ); - } - } - } - - impDestroy(); - - return sal_True; -} - -Bitmap* XLineEndList::CreateBitmapForUI( long nIndex, sal_Bool bDelete ) +Bitmap XLineEndList::CreateBitmapForUI( long nIndex ) { impCreate(); VirtualDevice* pVD = mpData->getVirtualDevice(); @@ -218,15 +199,11 @@ Bitmap* XLineEndList::CreateBitmapForUI( long nIndex, sal_Bool bDelete ) sdr::contact::ObjectContactOfObjListPainter aPainter(*pVD, aObjectVector, 0); sdr::contact::DisplayInfo aDisplayInfo; + pVD->Erase(); aPainter.ProcessDisplay(aDisplayInfo); const Point aZero(0, 0); - Bitmap* pBitmap = new Bitmap(pVD->GetBitmap(aZero, pVD->GetOutputSize())); - - if(bDelete) - impDestroy(); - - return pBitmap; + return pVD->GetBitmap(aZero, pVD->GetOutputSize()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/util/svx.component b/svx/util/svx.component index ea9f39cdd074..8745a592a2a1 100644 --- a/svx/util/svx.component +++ b/svx/util/svx.component @@ -67,4 +67,7 @@ <implementation name="com.sun.star.svx.ExitFindbarToolboxController"> <service name="com.sun.star.frame.ToolbarController"/> </implementation> + <implementation name="org.apache.openoffice.comp.svx.sidebar.PanelFactory"> + <service name="com.sun.star.ui.UIElementFactory"/> + </implementation> </component> 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> diff --git a/vcl/inc/window.h b/vcl/inc/window.h index 230e1b07d068..34fe78c52f18 100644 --- a/vcl/inc/window.h +++ b/vcl/inc/window.h @@ -396,7 +396,8 @@ public: mbVexpand:1, mbExpand:1, mbFill:1, - mbSecondary:1; + mbSecondary:1, + mbIsThemingEnabled:1; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxDNDListenerContainer; }; diff --git a/vcl/source/window/split.cxx b/vcl/source/window/split.cxx index f174696b9000..92a637e93ee2 100644 --- a/vcl/source/window/split.cxx +++ b/vcl/source/window/split.cxx @@ -17,7 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - #include <tools/rc.h> #include <tools/poly.hxx> @@ -66,32 +65,39 @@ void Splitter::ImplInitSplitterData() // ----------------------------------------------------------------------- -void Splitter::ImplInit( Window* pParent, WinBits nWinStyle ) +void Splitter::ImplInitHorVer(bool bNew) { - Window::ImplInit( pParent, nWinStyle, NULL ); - - mpRefWin = pParent; + if(bNew != (bool)mbHorzSplit) + { + mbHorzSplit = bNew; - const StyleSettings& rSettings = GetSettings().GetStyleSettings(); - long nA = rSettings.GetScrollBarSize(); - long nB = rSettings.GetSplitSize(); + PointerStyle ePointerStyle; + const StyleSettings& rSettings = GetSettings().GetStyleSettings(); - PointerStyle ePointerStyle; + if ( mbHorzSplit ) + { + ePointerStyle = POINTER_HSPLIT; + SetSizePixel( Size( rSettings.GetSplitSize(), rSettings.GetScrollBarSize() ) ); + } + else + { + ePointerStyle = POINTER_VSPLIT; + SetSizePixel( Size( rSettings.GetScrollBarSize(), rSettings.GetSplitSize() ) ); + } - if ( nWinStyle & WB_HSCROLL ) - { - ePointerStyle = POINTER_HSPLIT; - mbHorzSplit = sal_True; - SetSizePixel( Size( nB, nA ) ); - } - else - { - ePointerStyle = POINTER_VSPLIT; - mbHorzSplit = sal_False; - SetSizePixel( Size( nA, nB ) ); + SetPointer( Pointer( ePointerStyle ) ); } +} - SetPointer( Pointer( ePointerStyle ) ); +// ----------------------------------------------------------------------- + +void Splitter::ImplInit( Window* pParent, WinBits nWinStyle ) +{ + Window::ImplInit( pParent, nWinStyle, NULL ); + + mpRefWin = pParent; + + ImplInitHorVer(nWinStyle & WB_HSCROLL); if( GetSettings().GetStyleSettings().GetFaceColor().IsDark() ) SetBackground( ImplWhiteWall::get() ); @@ -182,6 +188,16 @@ Splitter::~Splitter() // ----------------------------------------------------------------------- +void Splitter::SetHorizontal(bool bNew) +{ + if(bNew != (bool)mbHorzSplit) + { + ImplInitHorVer(bNew); + } +} + +// ----------------------------------------------------------------------- + void Splitter::SetKeyboardStepSize( long nStepSize ) { mnKeyboardStepSize = nStepSize; diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 3950596733c8..1018bb80efcd 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -297,6 +297,7 @@ WindowImpl::WindowImpl( WindowType nType ) mbExpand = false; mbFill = true; mbSecondary = false; + mbIsThemingEnabled = true; } WindowImpl::~WindowImpl() @@ -757,7 +758,10 @@ void Window::ImplInit( Window* pParent, WinBits nStyle, SystemParentData* pSyste nBorderTypeStyle |= BORDERWINDOW_STYLE_FRAME; nStyle |= WB_BORDER; } - ImplBorderWindow* pBorderWin = new ImplBorderWindow( pParent, nStyle & (WB_BORDER | WB_DIALOGCONTROL | WB_NODIALOGCONTROL | WB_NEEDSFOCUS), nBorderTypeStyle ); + ImplBorderWindow* pBorderWin = + mpWindowImpl->mbIsThemingEnabled + ? CreateBorderWindow( pParent, nStyle & (WB_BORDER | WB_DIALOGCONTROL | WB_NODIALOGCONTROL | WB_NEEDSFOCUS), nBorderTypeStyle ) + : new ImplBorderWindow( pParent, nStyle & (WB_BORDER | WB_DIALOGCONTROL | WB_NODIALOGCONTROL | WB_NEEDSFOCUS), nBorderTypeStyle ); ((Window*)pBorderWin)->mpWindowImpl->mpClientWindow = this; pBorderWin->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder ); mpWindowImpl->mpBorderWindow = pBorderWin; diff --git a/vcl/source/window/window3.cxx b/vcl/source/window/window3.cxx index 00919acce11a..fd656f967239 100644 --- a/vcl/source/window/window3.cxx +++ b/vcl/source/window/window3.cxx @@ -18,9 +18,11 @@ */ +#include "vcl/button.hxx" #include "vcl/window.hxx" #include "vcl/waitobj.hxx" -#include "vcl/button.hxx" +#include "brdwin.hxx" +#include "window.h" // ----------------------------------------------------------------------- @@ -63,4 +65,22 @@ void Window::ImplAdjustNWFSizes() } } +void Window::EnableThemeSupport (void) +{ + mpWindowImpl->mbIsThemingEnabled = sal_True; +} + +void Window::DisableThemeSupport (void) +{ + mpWindowImpl->mbIsThemingEnabled = sal_False; +} + +ImplBorderWindow* Window::CreateBorderWindow ( + Window* pParent, + const WinBits nStyle, + const sal_uInt16 nTypeStyle) +{ + return new ImplBorderWindow(pParent, nStyle, nTypeStyle); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |