From ff5ce47439a32d3fe3b6f5461a8e10441d54a8c9 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 27 May 2016 14:08:53 +0200 Subject: [PATCH] Revert "remove unused RSC_DOCKWINDOW flags" This reverts commit c8754b38ce205845aad5cde3c5ad4070ce38f7d5. This causes toolkit.AccessibleDropDownListBox to fail with: LOG> ImplementationName Unknown, does not implement XServiceInfo Exception while getting Environment Couldn't create a test object --- include/tools/rc.h | 6 ++++++ rsc/inc/rscdb.hxx | 3 ++- rsc/source/parser/rscicpx.cxx | 17 ++++++++++++++++- rsc/source/parser/rscinit.cxx | 2 +- vcl/source/window/dockwin.cxx | 33 ++++++++++++++++++++++++++++++++- 5 files changed, 57 insertions(+), 4 deletions(-) diff --git a/include/tools/rc.h b/include/tools/rc.h index bb6cb3b9f46c..cd09254b4dc4 100644 --- a/include/tools/rc.h +++ b/include/tools/rc.h @@ -137,6 +137,12 @@ namespace o3tl { #define RSC_TOOLBOX_ITEMIMAGELIST 0x40 #define RSC_TOOLBOX_ITEMLIST 0x80 +// For "DockingWindow" resources: +#define RSC_DOCKINGWINDOW_XYMAPMODE 0x01 +#define RSC_DOCKINGWINDOW_X 0x02 +#define RSC_DOCKINGWINDOW_Y 0x04 +#define RSC_DOCKINGWINDOW_FLOATING 0x08 + // For "ImageButtons": enum class RscImageButtonFlags { Image = 0x01, diff --git a/rsc/inc/rscdb.hxx b/rsc/inc/rscdb.hxx index adf801f38573..1fbbb1850881 100644 --- a/rsc/inc/rscdb.hxx +++ b/rsc/inc/rscdb.hxx @@ -205,7 +205,8 @@ class RscTypCont RscTop * InitClassNumericField( RscTop * pSuper ); RscTop * InitClassMetricField( RscTop * pSuper ); - RscTop * InitClassDockingWindow( RscTop * pSuper ); + RscTop * InitClassDockingWindow( RscTop * pSuper, + RscEnum * pMapUnit ); RscTop * InitClassToolBoxItem( RscTop * pSuper, RscTop * pClassBitmap, RscTop * pClassImage, RscEnum * pTriState ); diff --git a/rsc/source/parser/rscicpx.cxx b/rsc/source/parser/rscicpx.cxx index 30a56b499977..ae3b865b481a 100644 --- a/rsc/source/parser/rscicpx.cxx +++ b/rsc/source/parser/rscicpx.cxx @@ -897,7 +897,8 @@ RscTop * RscTypCont::InitClassMetricField( RscTop * pSuper ) return pClassMetricField; } -RscTop * RscTypCont::InitClassDockingWindow( RscTop * pSuper ) +RscTop * RscTypCont::InitClassDockingWindow( RscTop * pSuper, + RscEnum * pMapUnit ) { Atom nId; RscTop * pClassDockWindow; @@ -908,6 +909,20 @@ RscTop * RscTypCont::InitClassDockingWindow( RscTop * pSuper ) pClassDockWindow->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); aNmTb.Put( nId, CLASSNAME, pClassDockWindow ); + // initialize variables + nId = aNmTb.Put( "_FloatingPosMapMode", VARNAME ); + pClassDockWindow->SetVariable( nId, pMapUnit, nullptr, 0, + RSC_DOCKINGWINDOW_XYMAPMODE ); + nId = aNmTb.Put( "_FloatingPosX", VARNAME ); + pClassDockWindow->SetVariable( nId, &aShort, nullptr, 0, + RSC_DOCKINGWINDOW_X ); + nId = aNmTb.Put( "_FloatingPosY", VARNAME ); + pClassDockWindow->SetVariable( nId, &aShort, nullptr, 0, + RSC_DOCKINGWINDOW_Y ); + nId = aNmTb.Put( "FloatingMode", VARNAME ); + pClassDockWindow->SetVariable( nId, &aBool, nullptr, 0, + RSC_DOCKINGWINDOW_FLOATING ); + INS_WINBIT(pClassDockWindow,Moveable) INS_WINBIT(pClassDockWindow,Sizeable) INS_WINBIT(pClassDockWindow,EnableResizing) diff --git a/rsc/source/parser/rscinit.cxx b/rsc/source/parser/rscinit.cxx index 10b5f31c61a9..0cec6cb720c0 100644 --- a/rsc/source/parser/rscinit.cxx +++ b/rsc/source/parser/rscinit.cxx @@ -409,7 +409,7 @@ void RscTypCont::Init() } } { - RscTop* pClassDockingWindow = InitClassDockingWindow( pClassWindow ); + RscTop* pClassDockingWindow = InitClassDockingWindow( pClassWindow, pMapUnit ); pRoot->Insert( pClassDockingWindow ); RscTop* pClassToolBoxItem = InitClassToolBoxItem( pClassMgr, pClassBitmap, diff --git a/vcl/source/window/dockwin.cxx b/vcl/source/window/dockwin.cxx index ddcd0798174e..984d713959f6 100644 --- a/vcl/source/window/dockwin.cxx +++ b/vcl/source/window/dockwin.cxx @@ -380,7 +380,38 @@ void DockingWindow::ImplLoadRes( const ResId& rResId ) { Window::ImplLoadRes( rResId ); - ReadLongRes(); + const sal_uInt32 nMask = ReadLongRes(); + + if ( (RSC_DOCKINGWINDOW_XYMAPMODE | RSC_DOCKINGWINDOW_X | + RSC_DOCKINGWINDOW_Y) & nMask ) + { + // use Sizes of the Resource + Point aPos; + MapUnit ePosMap = MAP_PIXEL; + + if ( RSC_DOCKINGWINDOW_XYMAPMODE & nMask ) + ePosMap = (MapUnit)ReadLongRes(); + + if ( RSC_DOCKINGWINDOW_X & nMask ) + { + aPos.X() = ReadShortRes(); + aPos.X() = ImplLogicUnitToPixelX( aPos.X(), ePosMap ); + } + + if ( RSC_DOCKINGWINDOW_Y & nMask ) + { + aPos.Y() = ReadShortRes(); + aPos.Y() = ImplLogicUnitToPixelY( aPos.Y(), ePosMap ); + } + + SetFloatingPos( aPos ); + } + + if ( nMask & RSC_DOCKINGWINDOW_FLOATING ) + { + if ( ReadShortRes() != 0 ) + SetFloatingMode( true ); + } } DockingWindow::DockingWindow( WindowType nType ) :