bin/count-todo-dialogs | 4 include/sfx2/basedlgs.hxx | 4 include/sfx2/tbxctrl.hxx | 4 include/tools/rc.h | 6 include/tools/rcid.h | 2 include/vcl/floatwin.hxx | 2 rsc/inc/rscdb.hxx | 2 rsc/source/parser/rscicpx.cxx | 34 ---- rsc/source/parser/rscinit.cxx | 5 sfx2/source/appl/childwin.cxx | 4 sfx2/source/dialog/basedlgs.cxx | 20 -- sfx2/source/toolbox/tbxitem.cxx | 17 -- starmath/UIConfig_smath.mk | 1 starmath/inc/helpids.h | 12 - starmath/inc/starmath.hrc | 10 + starmath/inc/toolbox.hxx | 16 +- starmath/source/toolbox.cxx | 148 ++++++++---------- starmath/source/toolbox.hrc | 12 - starmath/source/toolbox.src | 94 ------------ starmath/uiconfig/smath/ui/floatingelements.ui | 195 +++++++++++++++++++++++++ tools/source/rc/resmgr.cxx | 2 vcl/source/window/floatwin.cxx | 42 ----- 22 files changed, 293 insertions(+), 343 deletions(-)
New commits: commit 0a8bf4b534775bb64e6baa228dce881c5c0d65a5 Author: Caolán McNamara <[email protected]> Date: Fri Sep 5 21:10:57 2014 +0100 FloatingWindows are no longer loaded from resource files Change-Id: I2705bbb4db52779e0065400f09604384fd9cf151 diff --git a/bin/count-todo-dialogs b/bin/count-todo-dialogs index 4c1678b..09f85c9 100755 --- a/bin/count-todo-dialogs +++ b/bin/count-todo-dialogs @@ -20,7 +20,7 @@ infoboxes=0 queryboxes=0 warningboxes=0 msgboxes=0 -floatingwindows=`git grep -h FloatingWindow -- *.src|grep -v HelpID|cut -d' ' -f2- |sort|uniq|wc -l` +floatingwindows=0 dockingwindows=`git grep -h DockingWindow -- *.src|grep -v HelpID|grep -v hrc|cut -d' ' -f2- |sort|uniq|wc -l` echo There are $dialogs unconverted dialogs @@ -33,7 +33,7 @@ echo There are $msgboxes unconverted msgboxes echo There are $floatingwindows unconverted floatingwindows echo There are $dockingwindows unconverted dockingwindows -num=$(($floatingwindows + dockingwindows)) +num=$dockingwindows echo An estimated additional $num .ui are required percent=$(($converted * 100 / ($num + $converted))) diff --git a/include/sfx2/basedlgs.hxx b/include/sfx2/basedlgs.hxx index cef733f..6c4c1f4 100644 --- a/include/sfx2/basedlgs.hxx +++ b/include/sfx2/basedlgs.hxx @@ -137,10 +137,6 @@ protected: SfxFloatingWindow( SfxBindings *pBindings, SfxChildWindow *pCW, Window* pParent, - const ResId& rResId); - SfxFloatingWindow( SfxBindings *pBindings, - SfxChildWindow *pCW, - Window* pParent, const OString& rID, const OUString& rUIXMLDescription, const css::uno::Reference<css::frame::XFrame> &rFrame = css::uno::Reference<css::frame::XFrame>()); virtual ~SfxFloatingWindow(); diff --git a/include/sfx2/tbxctrl.hxx b/include/sfx2/tbxctrl.hxx index 7b68212..27bcb9e 100644 --- a/include/sfx2/tbxctrl.hxx +++ b/include/sfx2/tbxctrl.hxx @@ -150,10 +150,6 @@ public: const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow, WinBits nBits ); - SfxPopupWindow( sal_uInt16 nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* pParentWindow, - const ResId &rId ); virtual ~SfxPopupWindow(); virtual SfxPopupWindow* Clone() const; diff --git a/include/tools/rc.h b/include/tools/rc.h index 3c77bdc..d76e5e8 100644 --- a/include/tools/rc.h +++ b/include/tools/rc.h @@ -150,12 +150,6 @@ typedef short RSWND_STYLE; #define RSC_TOOLBOX_ITEMIMAGELIST 0x40 #define RSC_TOOLBOX_ITEMLIST 0x80 -// For "FloatingWindow" resources: -#define RSC_FLOATINGWINDOW_WHMAPMODE 0x01 -#define RSC_FLOATINGWINDOW_WIDTH 0x02 -#define RSC_FLOATINGWINDOW_HEIGHT 0x04 -#define RSC_FLOATINGWINDOW_ZOOMIN 0x08 - // For "DockingWindow" resources: #define RSC_DOCKINGWINDOW_XYMAPMODE 0x01 #define RSC_DOCKINGWINDOW_X 0x02 diff --git a/include/tools/rcid.h b/include/tools/rcid.h index f9ad6ed..16ab69b 100644 --- a/include/tools/rcid.h +++ b/include/tools/rcid.h @@ -51,8 +51,6 @@ #define RSC_SYSWINDOW (RSC_NOTYPE + 0x36) #define RSC_WORKWIN (RSC_NOTYPE + 0x37) -#define RSC_FLOATINGWINDOW (RSC_NOTYPE + 0x39) - #define RSC_CONTROL (RSC_NOTYPE + 0x44) #define RSC_BUTTON (RSC_NOTYPE + 0x45) #define RSC_PUSHBUTTON (RSC_NOTYPE + 0x46) diff --git a/include/vcl/floatwin.hxx b/include/vcl/floatwin.hxx index 2d4981e..580c6c1 100644 --- a/include/vcl/floatwin.hxx +++ b/include/vcl/floatwin.hxx @@ -103,7 +103,6 @@ protected: using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE void ImplInitSettings(); - SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); public: SAL_DLLPRIVATE FloatingWindow* ImplFloatHitTest( Window* pReference, const Point& rPos, HitTest& rHitTest ); @@ -123,7 +122,6 @@ public: explicit FloatingWindow(Window* pParent, WinBits nStyle = WB_STDFLOATWIN); explicit FloatingWindow(Window* pParent, const OString& rID, const OUString& rUIXMLDescription, const css::uno::Reference<css::frame::XFrame> &rFrame = css::uno::Reference<css::frame::XFrame>()); - explicit FloatingWindow( Window* pParent, const ResId& ); virtual ~FloatingWindow(); virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE; diff --git a/rsc/inc/rscdb.hxx b/rsc/inc/rscdb.hxx index 456c82d..74e46e4 100644 --- a/rsc/inc/rscdb.hxx +++ b/rsc/inc/rscdb.hxx @@ -213,8 +213,6 @@ class RscTypCont RscEnum * pTriState ); RscTop * InitClassToolBox( RscTop * pSuper, RscTop * pClassToolBoxItem, RscTop * pClassImageList ); - RscTop * InitClassFloatingWindow( RscTop * pSuper, - RscEnum * pMapUnit ); RscTop * InitClassSfxStyleFamilyItem( RscTop * pSuper, RscTop * pClassBitmap, RscTop * pClassImage, diff --git a/rsc/source/parser/rscicpx.cxx b/rsc/source/parser/rscicpx.cxx index 8b79d82..62561de 100644 --- a/rsc/source/parser/rscicpx.cxx +++ b/rsc/source/parser/rscicpx.cxx @@ -1480,40 +1480,6 @@ RscTop * RscTypCont::InitClassToolBox( RscTop * pSuper, return pClassToolBox; } -RscTop * RscTypCont::InitClassFloatingWindow( RscTop * pSuper, - RscEnum * pMapUnit ) -{ - Atom nId; - RscTop * pClassFloatingWindow; - - // Klasse anlegen - nId = pHS->getID( "FloatingWindow" ); - pClassFloatingWindow = new RscClass( nId, RSC_FLOATINGWINDOW, pSuper ); - pClassFloatingWindow->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); - aNmTb.Put( nId, CLASSNAME, pClassFloatingWindow ); - - // Variablen anlegen - nId = aNmTb.Put( "_ZoomInMapMode", VARNAME ); - pClassFloatingWindow->SetVariable( nId, pMapUnit, NULL, 0, - RSC_FLOATINGWINDOW_WHMAPMODE ); - nId = aNmTb.Put( "_ZoomInWidth", VARNAME ); - pClassFloatingWindow->SetVariable( nId, &aShort, NULL, 0, - RSC_FLOATINGWINDOW_WIDTH ); - nId = aNmTb.Put( "_ZoomInHeight", VARNAME ); - pClassFloatingWindow->SetVariable( nId, &aShort, NULL, 0, - RSC_FLOATINGWINDOW_HEIGHT ); - nId = aNmTb.Put( "ZoomIn", VARNAME ); - pClassFloatingWindow->SetVariable( nId, &aBool, NULL, 0, - RSC_FLOATINGWINDOW_ZOOMIN ); - - INS_WINBIT(pClassFloatingWindow,Zoomable) - INS_WINBIT(pClassFloatingWindow,HideWhenDeactivate) - INS_WINBIT(pClassFloatingWindow,EnableResizing) - INS_WINBIT(pClassFloatingWindow,StdPopup) - - return pClassFloatingWindow; -} - RscTop * RscTypCont::InitClassSfxStyleFamilyItem( RscTop * pSuper, RscTop * pClassBitmap, RscTop * pClassImage, diff --git a/rsc/source/parser/rscinit.cxx b/rsc/source/parser/rscinit.cxx index 211490a..0805674 100644 --- a/rsc/source/parser/rscinit.cxx +++ b/rsc/source/parser/rscinit.cxx @@ -100,7 +100,6 @@ void RscTypCont::Init() RscTop * pClassDockingWindow; RscTop * pClassToolBoxItem; RscTop * pClassToolBox; - RscTop * pClassFloatingWindow; RscTop * pClassFixedLine; RscTop * pClassSfxStyleFamilyItem; RscTop * pClassSfxTemplateDialog; @@ -511,10 +510,6 @@ void RscTypCont::Init() pClassImageList ); pRoot->Insert( pClassToolBox ); - pClassFloatingWindow = InitClassFloatingWindow( pClassSystemWindow, - pMapUnit ); - pRoot->Insert( pClassFloatingWindow ); - // Klasse anlegen nId = pHS->getID( "FixedLine" ); pClassFixedLine = diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx index a15dd99..59ea7c2 100644 --- a/sfx2/source/dialog/basedlgs.cxx +++ b/sfx2/source/dialog/basedlgs.cxx @@ -460,26 +460,6 @@ SfxFloatingWindow::SfxFloatingWindow( SfxBindings *pBindinx, pImp->aMoveTimer.SetTimeoutHdl(LINK(this,SfxFloatingWindow,TimerHdl)); } - - -SfxFloatingWindow::SfxFloatingWindow( SfxBindings *pBindinx, - SfxChildWindow *pCW, - Window* pParent, - const ResId& rResId) : - FloatingWindow(pParent, rResId), - pBindings(pBindinx), - pImp( new SfxFloatingWindow_Impl ) -{ - pImp->pMgr = pCW; - pImp->bConstructed = false; - SetUniqueId( GetHelpId() ); - SetHelpId(""); - if ( pBindinx ) - pImp->StartListening( *pBindinx ); - pImp->aMoveTimer.SetTimeout(50); - pImp->aMoveTimer.SetTimeoutHdl(LINK(this,SfxFloatingWindow,TimerHdl)); -} - SfxFloatingWindow::SfxFloatingWindow( SfxBindings *pBindinx, SfxChildWindow *pCW, Window* pParent, diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx index 6aa1c9c..71af418 100644 --- a/sfx2/source/toolbox/tbxitem.cxx +++ b/sfx2/source/toolbox/tbxitem.cxx @@ -1174,23 +1174,6 @@ SfxPopupWindow::SfxPopupWindow( SfxPopupWindow::SfxPopupWindow( sal_uInt16 nId, - const Reference< XFrame >& rFrame, - Window* pParentWindow, - const ResId &rId ) : - FloatingWindow( pParentWindow, rId ) - , m_bFloating( false ) - , m_bCascading( false ) - , m_nId( nId ) - , m_xFrame( rFrame ) - , m_pStatusListener( 0 ) -{ - Window* pWindow = GetTopMostParentSystemWindow( this ); - if ( pWindow ) - ((SystemWindow *)pWindow)->GetTaskPaneList()->AddWindow( this ); -} - -SfxPopupWindow::SfxPopupWindow( - sal_uInt16 nId, Window* pParentWindow, const OString& rID, const OUString& rUIXMLDescription, const Reference< XFrame >& rFrame ) : diff --git a/starmath/inc/helpids.h b/starmath/inc/helpids.h index 977b44e..caa3029 100644 --- a/starmath/inc/helpids.h +++ b/starmath/inc/helpids.h @@ -134,7 +134,6 @@ #define HID_SMA_ATTRIBUTES_TBX "STARMATH_HID_SMA_ATTRIBUTES_TBX" #define HID_SMA_BRACKETS_TBX "STARMATH_HID_SMA_BRACKETS_TBX" #define HID_SMA_FORMAT_TBX "STARMATH_HID_SMA_FORMAT_TBX" -#define HID_SMA_SELECTION_TBX "STARMATH_HID_SMA_SELECTION_TBX" #define HID_SMA_COMMAND_WIN "STARMATH_HID_SMA_COMMAND_WIN" #define HID_SMA_MISC_MENU "STARMATH_HID_SMA_MISC_MENU" #define HID_SMA_FUNCTIONSOTHER1_MENU "STARMATH_HID_SMA_FUNCTIONSOTHER1_MENU" diff --git a/tools/source/rc/resmgr.cxx b/tools/source/rc/resmgr.cxx index 73194cf..b3cd18e 100644 --- a/tools/source/rc/resmgr.cxx +++ b/tools/source/rc/resmgr.cxx @@ -1460,7 +1460,6 @@ OString ResMgr::GetAutoHelpId() switch( pRC->pResource->GetRT() ) { case RSC_DOCKINGWINDOW: aHID.append( "DockingWindow" ); break; case RSC_WORKWIN: aHID.append( "WorkWindow" ); break; - case RSC_FLOATINGWINDOW: aHID.append( "FloatingWindow" ); break; default: return OString(); } } @@ -1471,7 +1470,6 @@ OString ResMgr::GetAutoHelpId() switch( pRC1->pResource->GetRT() ) { case RSC_DOCKINGWINDOW: case RSC_WORKWIN: - case RSC_FLOATINGWINDOW: // intentionally no breaks! // auto help ids for controls switch( pRC->pResource->GetRT() ) { diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx index 05b806f..718683f 100644 --- a/vcl/source/window/floatwin.cxx +++ b/vcl/source/window/floatwin.cxx @@ -152,18 +152,6 @@ FloatingWindow::FloatingWindow( Window* pParent, WinBits nStyle ) : ImplInit( pParent, nStyle ); } -FloatingWindow::FloatingWindow( Window* pParent, const ResId& rResId ) : - SystemWindow( WINDOW_FLOATINGWINDOW ) -{ - rResId.SetRT( RSC_FLOATINGWINDOW ); - WinBits nStyle = ImplInitRes( rResId ); - ImplInit( pParent, nStyle ); - ImplLoadRes( rResId ); - - if ( !(nStyle & WB_HIDE) ) - Show(); -} - FloatingWindow::FloatingWindow(Window* pParent, const OString& rID, const OUString& rUIXMLDescription, const css::uno::Reference<css::frame::XFrame> &rFrame) : SystemWindow(WINDOW_FLOATINGWINDOW) { @@ -179,36 +167,6 @@ void FloatingWindow::doDeferredInit(WinBits nBits) mbIsDefferedInit = false; } -void FloatingWindow::ImplLoadRes( const ResId& rResId ) -{ - SystemWindow::ImplLoadRes( rResId ); - - sal_uLong nObjMask = ReadLongRes(); - - if ( (RSC_FLOATINGWINDOW_WHMAPMODE | RSC_FLOATINGWINDOW_WIDTH | - RSC_FLOATINGWINDOW_HEIGHT) & nObjMask ) - { - // use Sizes from the Resource - Size aSize; - MapUnit eSizeMap = MAP_PIXEL; - - if ( RSC_FLOATINGWINDOW_WHMAPMODE & nObjMask ) - eSizeMap = (MapUnit) ReadShortRes(); - if ( RSC_FLOATINGWINDOW_WIDTH & nObjMask ) - aSize.Width() = ReadShortRes(); - if ( RSC_FLOATINGWINDOW_HEIGHT & nObjMask ) - aSize.Height() = ReadShortRes(); - - SetRollUpOutputSizePixel( LogicToPixel( aSize, eSizeMap ) ); - } - - if (nObjMask & RSC_FLOATINGWINDOW_ZOOMIN ) - { - if ( ReadShortRes() ) - RollUp(); - } -} - FloatingWindow::~FloatingWindow() { if( mbPopupModeCanceled ) commit 5ae49477396c1a0d7dd2d387bf46ac8c02cbeb53 Author: Caolán McNamara <[email protected]> Date: Fri Sep 5 21:23:11 2014 +0100 Window::GetType returns WindowType not ResourceType yikes! Change-Id: I5aba88fbc1e452c85fb4a75260bc3518bdf5facc diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx index 50634e7..cc56952 100644 --- a/sfx2/source/appl/childwin.cxx +++ b/sfx2/source/appl/childwin.cxx @@ -511,11 +511,11 @@ SfxChildWindowContext::~SfxChildWindowContext() FloatingWindow* SfxChildWindowContext::GetFloatingWindow() const { Window *pParent = pWindow->GetParent(); - if ( pParent->GetType() == RSC_DOCKINGWINDOW || pParent->GetType() == RSC_TOOLBOX ) + if (pParent->GetType() == WINDOW_DOCKINGWINDOW || pParent->GetType() == WINDOW_TOOLBOX) { return ((DockingWindow*)pParent)->GetFloatingWindow(); } - else if ( pParent->GetType() == RSC_FLOATINGWINDOW ) + else if (pParent->GetType() == WINDOW_FLOATINGWINDOW) { return (FloatingWindow*) pParent; } commit 13bbb6f56d49bf891f6b6f075c1d75100fbc1a63 Author: Caolán McNamara <[email protected]> Date: Fri Sep 5 20:55:29 2014 +0100 convert floating RID_TOOLBOXWINDOW to .ui well the dialog itself and the top toolbar, the other toolbars remain as resources as now Change-Id: If2bc5b2c108af0efb88fb018896806531cdafe60 diff --git a/starmath/UIConfig_smath.mk b/starmath/UIConfig_smath.mk index 82b9518..0841d47 100644 --- a/starmath/UIConfig_smath.mk +++ b/starmath/UIConfig_smath.mk @@ -26,6 +26,7 @@ $(eval $(call gb_UIConfig_add_toolbarfiles,modules/smath,\ $(eval $(call gb_UIConfig_add_uifiles,modules/smath,\ starmath/uiconfig/smath/ui/alignmentdialog \ starmath/uiconfig/smath/ui/catalogdialog \ + starmath/uiconfig/smath/ui/floatingelements \ starmath/uiconfig/smath/ui/fontdialog \ starmath/uiconfig/smath/ui/fontsizedialog \ starmath/uiconfig/smath/ui/fonttypedialog \ diff --git a/starmath/inc/helpids.h b/starmath/inc/helpids.h index 66d8189..977b44e 100644 --- a/starmath/inc/helpids.h +++ b/starmath/inc/helpids.h @@ -126,17 +126,6 @@ #define HID_SMA_NOTPRECEDES "STARMATH_HID_SMA_NOTPRECEDES" #define HID_SMA_NOTSUCCEEDS "STARMATH_HID_SMA_NOTSUCCEEDS" -#define HID_SMA_MISC_CAT "STARMATH_HID_SMA_MISC_CAT" -#define HID_SMA_UNBINOPS_CAT "STARMATH_HID_SMA_UNBINOPS_CAT" -#define HID_SMA_RELATIONS_CAT "STARMATH_HID_SMA_RELATIONS_CAT" -#define HID_SMA_SETOPERATIONS_CAT "STARMATH_HID_SMA_SETOPERATIONS_CAT" -#define HID_SMA_FUNCTIONS_CAT "STARMATH_HID_SMA_FUNCTIONS_CAT" -#define HID_SMA_OPERATORS_CAT "STARMATH_HID_SMA_OPERATORS_CAT" -#define HID_SMA_ATTRIBUTES_CAT "STARMATH_HID_SMA_ATTRIBUTES_CAT" -#define HID_SMA_BRACKETS_CAT "STARMATH_HID_SMA_BRACKETS_CAT" -#define HID_SMA_FORMAT_CAT "STARMATH_HID_SMA_FORMAT_CAT" - -#define HID_SMA_OPERATOR_WIN "STARMATH_HID_SMA_OPERATOR_WIN" #define HID_SMA_UNBINOPS_TBX "STARMATH_HID_SMA_UNBINOPS_TBX" #define HID_SMA_RELATIONS_TBX "STARMATH_HID_SMA_RELATIONS_TBX" #define HID_SMA_SETOPERATIONS_TBX "STARMATH_HID_SMA_SETOPERATIONS_TBX" diff --git a/starmath/inc/starmath.hrc b/starmath/inc/starmath.hrc index 768c9be..ae9cafb 100644 --- a/starmath/inc/starmath.hrc +++ b/starmath/inc/starmath.hrc @@ -680,6 +680,16 @@ #define RID_ALIGNCX_HELP (RID_APP_START + 4276) #define RID_ALIGNRX_HELP (RID_APP_START + 4277) +#define TOOLBOX_CAT_A (RID_APP_START + 4278) +#define TOOLBOX_CAT_B (RID_APP_START + 4279) +#define TOOLBOX_CAT_C (RID_APP_START + 4280) +#define TOOLBOX_CAT_D (RID_APP_START + 4281) +#define TOOLBOX_CAT_E (RID_APP_START + 4282) +#define TOOLBOX_CAT_F (RID_APP_START + 4283) +#define TOOLBOX_CAT_G (RID_APP_START + 4284) +#define TOOLBOX_CAT_H (RID_APP_START + 4285) +#define TOOLBOX_CAT_I (RID_APP_START + 4286) + // 342 == SCH_IF_SMAVIEWSHELL, because SFX_INTERFACE_LIB is no // Define but latterly an Enum #define HID_SMA_VIEWSHELL_DOCUMENT (342) diff --git a/starmath/inc/toolbox.hxx b/starmath/inc/toolbox.hxx index 6e4f037..8f50a05 100644 --- a/starmath/inc/toolbox.hxx +++ b/starmath/inc/toolbox.hxx @@ -32,8 +32,16 @@ class SmToolBoxWindow : public SfxFloatingWindow { protected: - ToolBox aToolBoxCat; - FixedLine aToolBoxCat_Delim; // to visually separate the catalog part + ToolBox* m_pToolBoxCat; + sal_uInt16 m_nUnbinopsId; + sal_uInt16 m_nRelationsId; + sal_uInt16 m_nSetoperationsId; + sal_uInt16 m_nFunctionsId; + sal_uInt16 m_nOperatorsId; + sal_uInt16 m_nAttributesId; + sal_uInt16 m_nBracketsId; + sal_uInt16 m_nFormatId; + sal_uInt16 m_nMiscId; ToolBox *pToolBoxCmd; ToolBox *vToolBoxCategories[NUM_TBX_CATEGORIES]; ImageList *aImageLists [NUM_TBX_CATEGORIES + 1]; /* regular */ @@ -50,6 +58,8 @@ protected: SmViewShell * GetView(); const ImageList * GetImageList( sal_uInt16 nResId ); + sal_uInt16 MapToolbarIdToCategory(sal_uInt16 nId) const; + public: SmToolBoxWindow(SfxBindings *pBindings, SfxChildWindow *pChildWindow, @@ -60,7 +70,7 @@ public: virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE; virtual void DataChanged( const DataChangedEvent &rEvt ) SAL_OVERRIDE; - void AdjustPosSize( bool bSetPos ); + void AdjustPos(); void SetCategory(sal_uInt16 nCategory); }; diff --git a/starmath/source/toolbox.cxx b/starmath/source/toolbox.cxx index 7a67763..f9357c0 100644 --- a/starmath/source/toolbox.cxx +++ b/starmath/source/toolbox.cxx @@ -91,38 +91,43 @@ static sal_uInt16 GetCategoryRID( sal_uInt16 nResId ) case RID_IL_FORMAT : nRes = RID_FORMAT_CAT; break; case RID_IL_MISC : nRes = RID_MISC_CAT; break; default : - if (nResId != RID_IL_CATALOG) - { -#if OSL_DEBUG_LEVEL > 1 - SAL_WARN( "starmath", "unknown category" ); -#endif - } + SAL_WARN( "starmath", "unknown category" ); + break; } return nRes; } - - - - SmToolBoxWindow::SmToolBoxWindow(SfxBindings *pTmpBindings, SfxChildWindow *pChildWindow, - Window *pParent) : - SfxFloatingWindow(pTmpBindings, pChildWindow, pParent, SmResId(RID_TOOLBOXWINDOW)), - aToolBoxCat(this, SmResId(TOOLBOX_CATALOG)), - aToolBoxCat_Delim(this, SmResId( FL_TOOLBOX_CAT_DELIM )) + Window *pParent) + : SfxFloatingWindow(pTmpBindings, pChildWindow, pParent, "FloatingElements", + "modules/smath/ui/floatingelements.ui") { + get(m_pToolBoxCat, "catalog"); + m_nUnbinopsId = m_pToolBoxCat->GetItemId("RID_UNBINOPS_CAT"); + m_nRelationsId = m_pToolBoxCat->GetItemId("RID_RELATIONS_CAT"); + m_nSetoperationsId = m_pToolBoxCat->GetItemId("RID_SETOPERATIONS_CAT"); + m_nFunctionsId = m_pToolBoxCat->GetItemId("RID_FUNCTIONS_CAT"); + m_nOperatorsId = m_pToolBoxCat->GetItemId("RID_OPERATORS_CAT"); + m_nAttributesId = m_pToolBoxCat->GetItemId("RID_ATTRIBUTES_CAT"); + m_nBracketsId = m_pToolBoxCat->GetItemId("RID_BRACKETS_CAT"); + m_nFormatId = m_pToolBoxCat->GetItemId("RID_FORMAT_CAT"); + m_nMiscId = m_pToolBoxCat->GetItemId("RID_MISC_CAT"); + m_pToolBoxCat->InsertSpace(7); + m_pToolBoxCat->InsertBreak(5); + m_pToolBoxCat->SetLineCount(2); + // allow for cursor travelling between toolbox and sub-categories SetStyle( GetStyle() | WB_DIALOGCONTROL ); nActiveCategoryRID = USHRT_MAX; - aToolBoxCat.SetClickHdl(LINK(this, SmToolBoxWindow, CategoryClickHdl)); + m_pToolBoxCat->SetClickHdl(LINK(this, SmToolBoxWindow, CategoryClickHdl)); sal_uInt16 i; for (i = 0; i < NUM_TBX_CATEGORIES; ++i) { - ToolBox *pBox = new ToolBox(this, SmResId( TOOLBOX_CAT_A + i )); + ToolBox *pBox = new ToolBox(get<Window>("box"), SmResId( TOOLBOX_CAT_A + i )); vToolBoxCategories[i] = pBox; pBox->SetSelectHdl(LINK(this, SmToolBoxWindow, CmdSelectHdl)); } @@ -130,8 +135,6 @@ SmToolBoxWindow::SmToolBoxWindow(SfxBindings *pTmpBindings, for (i = 0; i <= NUM_TBX_CATEGORIES; ++i) aImageLists [i] = 0; - - FreeResource(); } SmToolBoxWindow::~SmToolBoxWindow() @@ -146,14 +149,12 @@ SmToolBoxWindow::~SmToolBoxWindow() delete aImageLists[i]; } - SmViewShell * SmToolBoxWindow::GetView() { SfxViewShell *pView = GetBindings().GetDispatcher()->GetFrame()->GetViewShell(); return PTR_CAST(SmViewShell, pView); } - const ImageList * SmToolBoxWindow::GetImageList( sal_uInt16 nResId ) { // creates the image list via its resource id and stores that @@ -164,8 +165,6 @@ const ImageList * SmToolBoxWindow::GetImageList( sal_uInt16 nResId ) // get index to use sal_uInt16 nCategoryRID = GetCategoryRID( nResId ); sal_Int16 nIndex = GetToolBoxCategoriesIndex( nCategoryRID ); - if (nIndex == -1 && (nResId == RID_IL_CATALOG)) - nIndex = NUM_TBX_CATEGORIES; if (nIndex >= 0) { @@ -182,16 +181,10 @@ const ImageList * SmToolBoxWindow::GetImageList( sal_uInt16 nResId ) void SmToolBoxWindow::ApplyImageLists( sal_uInt16 nCategoryRID ) { - // set image list for toolbox 'catalog' - const ImageList *pImageList = GetImageList( RID_IL_CATALOG ); - OSL_ENSURE( pImageList, "image list missing" ); - if (pImageList) - aToolBoxCat.SetImageList( *pImageList ); - // set image list for active (visible) category of 'catalog' sal_Int16 nIdx = GetToolBoxCategoriesIndex( nCategoryRID ); sal_uInt16 nResId = GetImageListRID( nCategoryRID ); - pImageList = GetImageList( nResId ); + const ImageList *pImageList = GetImageList( nResId ); OSL_ENSURE( pImageList && nIdx >= 0, "image list or index missing" ); if (pImageList && nIdx >= 0) vToolBoxCategories[ nIdx ]->SetImageList( *pImageList ); @@ -213,59 +206,35 @@ void SmToolBoxWindow::StateChanged( StateChangedType nStateChange ) SetCategory( nActiveCategoryRID == USHRT_MAX ? RID_UNBINOPS_CAT : nActiveCategoryRID ); // calculate initial position to be used after creation of the window... - AdjustPosSize( bSetPosition ); - bSetPosition = false; + if (bSetPosition) + { + AdjustPos(); + bSetPosition = false; + } } //... otherwise the base class will remember the last position of the window SfxFloatingWindow::StateChanged( nStateChange ); } - -void SmToolBoxWindow::AdjustPosSize( bool bSetPos ) +void SmToolBoxWindow::AdjustPos() { - Size aCatSize( aToolBoxCat.CalcWindowSizePixel( 2 ) ); - Size aCmdSize( pToolBoxCmd->CalcWindowSizePixel( 7 /* see nLines in SetCategory*/ ) ); - OSL_ENSURE( aCatSize.Width() == aCmdSize.Width(), "width mismatch" ); - - // catalog settings - aToolBoxCat.SetPosPixel( Point(0, 3) ); - aToolBoxCat.SetSizePixel( aCatSize ); - // settings for catalog / category delimiter - Point aP( aToolBoxCat_Delim.GetPosPixel() ); - aP.X() = 0; - aToolBoxCat_Delim.SetPosPixel( aP ); - aToolBoxCat_Delim.SetSizePixel( Size( aCatSize.Width(), aToolBoxCat_Delim.GetSizePixel().Height() ) ); - // category settings - aP.Y() += aToolBoxCat_Delim.GetSizePixel().Height(); - for (int i = 0; i < NUM_TBX_CATEGORIES; ++i) + SmViewShell *pView = GetView(); + OSL_ENSURE( pView, "view shell missing" ); + Point aPos( 50, 75 ); + if (pView) { - vToolBoxCategories[i]->SetPosPixel( aP ); - vToolBoxCategories[i]->SetSizePixel( aCmdSize ); - } - // main window settings - Size aWndSize ( aCatSize.Width(), pToolBoxCmd->GetPosPixel().Y() + pToolBoxCmd->GetSizePixel().Height() + 3); - SetOutputSizePixel( aWndSize ); - - if (bSetPos) - { - SmViewShell *pView = GetView(); - OSL_ENSURE( pView, "view shell missing" ); - Point aPos( 50, 75 ); - if (pView) - { - SmGraphicWindow &rWin = pView->GetGraphicWindow(); - aPos = Point( rWin.OutputToScreenPixel( - Point( rWin.GetSizePixel().Width() - aWndSize.Width(), 0) ) ); - } - if (aPos.X() < 0) - aPos.X() = 0; - if (aPos.Y() < 0) - aPos.Y() = 0; - SetPosPixel( aPos ); + Size aWndSize(GetOutputSizePixel()); + SmGraphicWindow &rWin = pView->GetGraphicWindow(); + aPos = Point( rWin.OutputToScreenPixel( + Point( rWin.GetSizePixel().Width() - aWndSize.Width(), 0) ) ); } + if (aPos.X() < 0) + aPos.X() = 0; + if (aPos.Y() < 0) + aPos.Y() = 0; + SetPosPixel( aPos ); } - bool SmToolBoxWindow::Close() { SmViewShell *pViewSh = GetView(); @@ -280,7 +249,7 @@ void SmToolBoxWindow::GetFocus() { // give focus to category toolbox // (allow for cursor travelling when a category is selected with the mouse) - aToolBoxCat.GrabFocus(); + m_pToolBoxCat->GrabFocus(); } void SmToolBoxWindow::SetCategory(sal_uInt16 nCategoryRID) @@ -314,7 +283,7 @@ void SmToolBoxWindow::SetCategory(sal_uInt16 nCategoryRID) pToolBoxCmd = vToolBoxCategories[nIdx]; // calculate actual size of window to use - Size aCatSize( aToolBoxCat.CalcWindowSizePixel( 2 ) ); + Size aCatSize( m_pToolBoxCat->CalcWindowSizePixel( 2 ) ); Size aCmdSize( pToolBoxCmd->CalcWindowSizePixel( nLines ) ); OSL_ENSURE( aCatSize.Width() == aCmdSize.Width(), "width mismatch" ); // main window settings @@ -322,23 +291,44 @@ void SmToolBoxWindow::SetCategory(sal_uInt16 nCategoryRID) SetOutputSizePixel( aWndSize ); if (nActiveCategoryRID) - aToolBoxCat.CheckItem(nActiveCategoryRID, false); + m_pToolBoxCat->CheckItem(nActiveCategoryRID, false); nActiveCategoryRID = nCategoryRID; - aToolBoxCat.CheckItem(nActiveCategoryRID, true); + m_pToolBoxCat->CheckItem(nActiveCategoryRID, true); pToolBoxCmd->Show(); } +sal_uInt16 SmToolBoxWindow::MapToolbarIdToCategory(sal_uInt16 nId) const +{ + if (nId == m_nUnbinopsId) + return RID_UNBINOPS_CAT; + if (nId == m_nRelationsId) + return RID_RELATIONS_CAT; + if (nId == m_nSetoperationsId) + return RID_SETOPERATIONS_CAT; + if (nId == m_nFunctionsId) + return RID_FUNCTIONS_CAT; + if (nId == m_nOperatorsId) + return RID_OPERATORS_CAT; + if (nId == m_nAttributesId) + return RID_ATTRIBUTES_CAT; + if (nId == m_nBracketsId) + return RID_BRACKETS_CAT; + if (nId == m_nFormatId) + return RID_FORMAT_CAT; + return RID_MISC_CAT; +} IMPL_LINK( SmToolBoxWindow, CategoryClickHdl, ToolBox*, pToolBox) { - int nItemId = pToolBox->GetCurItemId(); + sal_uInt16 nItemId = pToolBox->GetCurItemId(); if (nItemId != 0) - SetCategory( sal::static_int_cast< sal_uInt16 >(nItemId) ); + { + SetCategory(MapToolbarIdToCategory(nItemId)); + } return 0; } - IMPL_LINK( SmToolBoxWindow, CmdSelectHdl, ToolBox*, pToolBox) { SmViewShell *pViewSh = GetView(); diff --git a/starmath/source/toolbox.hrc b/starmath/source/toolbox.hrc index 38b143f..d9aa6cc 100644 --- a/starmath/source/toolbox.hrc +++ b/starmath/source/toolbox.hrc @@ -20,17 +20,7 @@ #ifndef _TOOLBOX_HRC_ #define _TOOLBOX_HRC_ -#define FL_TOOLBOX_CAT_DELIM 1 -#define TOOLBOX_CATALOG 10 -#define TOOLBOX_CAT_A 11 -#define TOOLBOX_CAT_B 12 -#define TOOLBOX_CAT_C 13 -#define TOOLBOX_CAT_D 14 -#define TOOLBOX_CAT_E 15 -#define TOOLBOX_CAT_F 16 -#define TOOLBOX_CAT_G 17 -#define TOOLBOX_CAT_H 18 -#define TOOLBOX_CAT_I 19 +#include "starmath.hrc" #define NUM_TBX_CATEGORIES (TOOLBOX_CAT_I - TOOLBOX_CAT_A + 1) diff --git a/starmath/source/toolbox.src b/starmath/source/toolbox.src index 65c99be..fa4102b 100644 --- a/starmath/source/toolbox.src +++ b/starmath/source/toolbox.src @@ -24,99 +24,6 @@ #define IMAGE_STDBTN_COLOR Color { Red = 0xff00; Green = 0x0000; Blue = 0xff00; } -FloatingWindow RID_TOOLBOXWINDOW -{ - HelpId = HID_SMA_OPERATOR_WIN ; - Border = TRUE ; - Moveable = TRUE ; - Closeable = TRUE ; - Hide = TRUE ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 0 , 0 ) ; // to be calculated programmatically - Text [ en-US ] = "Elements" ; - - ToolBox TOOLBOX_CATALOG - { - // main menu of selection-window - HelpId = HID_SMA_SELECTION_TBX ; - Pos = MAP_APPFONT ( 0 , 0 ) ; - Size = MAP_APPFONT ( 65 , 38 ) ; - SVLook = TRUE ; - LineCount = 2 ; - ItemList = - { - ToolBoxItem - { - Identifier = RID_UNBINOPS_CAT ; - HelpId = HID_SMA_UNBINOPS_CAT ; - Text [ en-US ] = "Unary/Binary Operators" ; - }; - ToolBoxItem - { - Identifier = RID_RELATIONS_CAT ; - HelpId = HID_SMA_RELATIONS_CAT ; - Text [ en-US ] = "Relations" ; - }; - ToolBoxItem - { - Identifier = RID_SETOPERATIONS_CAT ; - HelpId = HID_SMA_SETOPERATIONS_CAT ; - Text [ en-US ] = "Set Operations" ; - }; - ToolBoxItem - { - Identifier = RID_FUNCTIONS_CAT ; - HelpId = HID_SMA_FUNCTIONS_CAT ; - Text [ en-US ] = "Functions" ; - }; - ToolBoxItem - { - Identifier = RID_OPERATORS_CAT ; - HelpId = HID_SMA_OPERATORS_CAT ; - Text [ en-US ] = "Operators" ; - }; - ToolBoxItem - { - Type = TOOLBOXITEM_BREAK ; - }; - ToolBoxItem - { - Identifier = RID_ATTRIBUTES_CAT ; - HelpId = HID_SMA_ATTRIBUTES_CAT ; - Text [ en-US ] = "Attributes" ; - }; - ToolBoxItem - { - Identifier = RID_MISC_CAT ; - HelpId = HID_SMA_MISC_CAT ; - Text [ en-US ] = "Others"; - }; - ToolBoxItem - { - Type = TOOLBOXITEM_SPACE ; - }; - ToolBoxItem - { - Identifier = RID_BRACKETS_CAT ; - HelpId = HID_SMA_BRACKETS_CAT ; - Text [ en-US ] = "Brackets" ; - }; - ToolBoxItem - { - Identifier = RID_FORMAT_CAT ; - HelpId = HID_SMA_FORMAT_CAT ; - Text [ en-US ] = "Formats" ; - }; - }; - }; - - FixedLine FL_TOOLBOX_CAT_DELIM - { - Pos = MAP_APPFONT ( 0 , 44 ) ; - Size = MAP_APPFONT ( 65 , 8 ) ; - }; - ToolBox TOOLBOX_CAT_A { // unary/binary operators @@ -1503,7 +1410,6 @@ FloatingWindow RID_TOOLBOXWINDOW }; }; }; -}; #define UNBINOPS_IDLIST \ IdList = \ diff --git a/starmath/uiconfig/smath/ui/floatingelements.ui b/starmath/uiconfig/smath/ui/floatingelements.ui new file mode 100644 index 0000000..899644a --- /dev/null +++ b/starmath/uiconfig/smath/ui/floatingelements.ui @@ -0,0 +1,195 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.16.1 --> +<interface> + <requires lib="gtk+" version="3.0"/> + <object class="GtkWindow" id="FloatingElements"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="border_width">6</property> + <property name="title" translatable="yes">Elements</property> + <property name="resizable">False</property> + <property name="type_hint">utility</property> + <property name="has_resize_grip">False</property> + <child> + <object class="GtkGrid" id="grid1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="row_spacing">12</property> + <child> + <object class="GtkSeparator" id="separator1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkToolbar" id="catalog"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="toolbar_style">icons</property> + <property name="show_arrow">False</property> + <child> + <object class="GtkToolButton" id="RID_UNBINOPS_CAT"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="action_name">RID_UNBINOPS_CAT</property> + <property name="label" translatable="yes">Unary/Binary Operators</property> + <property name="use_underline">True</property> + <property name="icon_name">starmath/res/im21101.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkToolButton" id="RID_RELATIONS_CAT"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="action_name">RID_RELATIONS_CAT</property> + <property name="label" translatable="yes">Relations</property> + <property name="use_underline">True</property> + <property name="icon_name">starmath/res/im21102.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkToolButton" id="RID_SETOPERATIONS_CAT"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="action_name">RID_SETOPERATIONS_CAT</property> + <property name="label" translatable="yes">Set Operations</property> + <property name="use_underline">True</property> + <property name="icon_name">starmath/res/im21103.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkToolButton" id="RID_FUNCTIONS_CAT"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="action_name">RID_FUNCTIONS_CAT</property> + <property name="label" translatable="yes">Functions</property> + <property name="use_underline">True</property> + <property name="icon_name">starmath/res/im21104.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkToolButton" id="RID_OPERATORS_CAT"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="action_name">RID_OPERATORS_CAT</property> + <property name="label" translatable="yes">Operators</property> + <property name="use_underline">True</property> + <property name="icon_name">starmath/res/im21105.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkToolButton" id="RID_ATTRIBUTES_CAT"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="action_name">RID_ATTRIBUTES_CAT</property> + <property name="label" translatable="yes">Attributes</property> + <property name="use_underline">True</property> + <property name="icon_name">starmath/res/im21106.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkToolButton" id="RID_MISC_CAT"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="action_name">RID_MISC_CAT</property> + <property name="label" translatable="yes">Others</property> + <property name="use_underline">True</property> + <property name="icon_name">starmath/res/im21117.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkToolButton" id="RID_BRACKETS_CAT"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="action_name">RID_BRACKETS_CAT</property> + <property name="label" translatable="yes">Brackets</property> + <property name="use_underline">True</property> + <property name="icon_name">starmath/res/im21107.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkToolButton" id="RID_FORMAT_CAT"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="action_name">RID_FORMAT_CAT</property> + <property name="label" translatable="yes">Formats</property> + <property name="use_underline">True</property> + <property name="icon_name">starmath/res/im21108.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="orientation">vertical</property> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">2</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + </object> + </child> + </object> +</interface>
_______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
