diff options
Diffstat (limited to 'framework/source/layoutmanager/helpers.cxx')
-rw-r--r-- | framework/source/layoutmanager/helpers.cxx | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/framework/source/layoutmanager/helpers.cxx b/framework/source/layoutmanager/helpers.cxx index d3b58351d95c..ccce1b3e8673 100644 --- a/framework/source/layoutmanager/helpers.cxx +++ b/framework/source/layoutmanager/helpers.cxx @@ -32,6 +32,7 @@ #include <comphelper/propertyvalue.hxx> #include <unotools/mediadescriptor.hxx> #include <vcl/svapp.hxx> +#include <o3tl/string_view.hxx> #include <toolkit/helper/vclunohelper.hxx> using namespace com::sun::star; @@ -88,7 +89,7 @@ OUString retrieveToolbarNameFromHelpURL( vcl::Window* pWindow ) ToolBox* pToolBox = dynamic_cast<ToolBox *>( pWindow ); if ( pToolBox ) { - aToolbarName = OStringToOUString( pToolBox->GetHelpId(), RTL_TEXTENCODING_UTF8 ); + aToolbarName = pToolBox->GetHelpId(); sal_Int32 i = aToolbarName.lastIndexOf( ':' ); if ( !aToolbarName.isEmpty() && ( i > 0 ) && (( i + 1 ) < aToolbarName.getLength() )) aToolbarName = aToolbarName.copy( i+1 ); // Remove ".HelpId:" protocol from toolbar name @@ -153,7 +154,7 @@ bool lcl_checkUIElement(const uno::Reference< ui::XUIElement >& xUIElement, awt: return bRet; } -uno::Reference< awt::XWindowPeer > createToolkitWindow( const uno::Reference< uno::XComponentContext >& rxContext, const uno::Reference< awt::XWindowPeer >& rParent, const char* pService ) +uno::Reference< awt::XVclWindowPeer > createToolkitWindow( const uno::Reference< uno::XComponentContext >& rxContext, const uno::Reference< awt::XVclWindowPeer >& rParent, const char* pService ) { uno::Reference< awt::XToolkit2 > xToolkit = awt::Toolkit::create( rxContext ); @@ -168,8 +169,9 @@ uno::Reference< awt::XWindowPeer > createToolkitWindow( const uno::Reference< un // create an awt window uno::Reference< awt::XWindowPeer > xPeer = xToolkit->createWindow( aDescriptor ); - - return xPeer; + uno::Reference< awt::XVclWindowPeer > xVclPeer(xPeer, uno::UNO_QUERY); + assert(xVclPeer || !xPeer); + return xVclPeer; } // convert alignment constant to vcl's WindowAlign type @@ -185,26 +187,24 @@ WindowAlign ImplConvertAlignment( ui::DockingArea aAlignment ) return WindowAlign::Bottom; } -OUString getElementTypeFromResourceURL( const OUString& aResourceURL ) +std::u16string_view getElementTypeFromResourceURL( std::u16string_view aResourceURL ) { - OUString aUIResourceURL( UIRESOURCE_URL ); - if ( aResourceURL.startsWith( aUIResourceURL ) ) + if ( o3tl::starts_with(aResourceURL, UIRESOURCE_URL ) ) { - sal_Int32 nIndex{ aUIResourceURL.getLength() }; - return aResourceURL.getToken( 1, '/', nIndex ); + sal_Int32 nIndex{ UIRESOURCE_URL.getLength() }; + return o3tl::getToken(aResourceURL, 1, '/', nIndex ); } - return OUString(); + return std::u16string_view(); } -void parseResourceURL( const OUString& aResourceURL, OUString& aElementType, OUString& aElementName ) +void parseResourceURL( std::u16string_view aResourceURL, OUString& aElementType, OUString& aElementName ) { - OUString aUIResourceURL( UIRESOURCE_URL ); - if ( aResourceURL.startsWith( aUIResourceURL ) ) + if ( o3tl::starts_with(aResourceURL, UIRESOURCE_URL) ) { - sal_Int32 nIndex{ aUIResourceURL.getLength() }; - aElementType = aResourceURL.getToken( 1, '/', nIndex ); - aElementName = aResourceURL.getToken( 0, '/', nIndex ); + sal_Int32 nIndex{ UIRESOURCE_URL.getLength() }; + aElementType = o3tl::getToken(aResourceURL, 1, '/', nIndex ); + aElementName = o3tl::getToken(aResourceURL, 0, '/', nIndex ); } } @@ -287,9 +287,9 @@ bool implts_isFrameOrWindowTop( const uno::Reference< frame::XFrame >& xFrame ) return false; } -void impl_setDockingWindowVisibility( const css::uno::Reference< css::uno::XComponentContext>& rxContext, const css::uno::Reference< css::frame::XFrame >& rFrame, const OUString& rDockingWindowName, bool bVisible ) +void impl_setDockingWindowVisibility( const css::uno::Reference< css::uno::XComponentContext>& rxContext, const css::uno::Reference< css::frame::XFrame >& rFrame, std::u16string_view rDockingWindowName, bool bVisible ) { - sal_Int32 nID = rDockingWindowName.toInt32(); + sal_Int32 nID = o3tl::toInt32(rDockingWindowName); sal_Int32 nIndex = nID - DOCKWIN_ID_BASE; css::uno::Reference< css::frame::XDispatchProvider > xProvider(rFrame, css::uno::UNO_QUERY); |