diff options
Diffstat (limited to 'extensions/source/propctrlr/propcontroller.cxx')
-rw-r--r-- | extensions/source/propctrlr/propcontroller.cxx | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/extensions/source/propctrlr/propcontroller.cxx b/extensions/source/propctrlr/propcontroller.cxx index d9166b64dff6..f6a37893a11b 100644 --- a/extensions/source/propctrlr/propcontroller.cxx +++ b/extensions/source/propctrlr/propcontroller.cxx @@ -37,7 +37,7 @@ #include <com/sun/star/lang/XSingleServiceFactory.hpp> #include <com/sun/star/util/VetoException.hpp> #include <tools/debug.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <vcl/svapp.hxx> #include <vcl/weld.hxx> @@ -55,9 +55,7 @@ namespace pcr using namespace ::com::sun::star::uno; using namespace ::com::sun::star::awt; using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::script; using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::container; using namespace ::com::sun::star::frame; using namespace ::com::sun::star::util; using namespace ::com::sun::star::inspection; @@ -208,7 +206,7 @@ namespace pcr // inspect again, if we already have inspectees if ( !m_aInspectedObjects.empty() ) - impl_rebindToInspectee_nothrow( m_aInspectedObjects ); + impl_rebindToInspectee_nothrow( std::vector(m_aInspectedObjects) ); } @@ -340,14 +338,14 @@ namespace pcr if (weld::TransportAsXWindow* pTunnel = dynamic_cast<weld::TransportAsXWindow*>(xContainerWindow.get())) { - xBuilder.reset(Application::CreateBuilder(pTunnel->getWidget(), sUIFile)); + xBuilder = Application::CreateBuilder(pTunnel->getWidget(), sUIFile); } else { VclPtr<vcl::Window> pParentWin = VCLUnoHelper::GetWindow(xContainerWindow); if (!pParentWin) throw RuntimeException("The frame is invalid. Unable to extract the container window.",*this); - xBuilder.reset(Application::CreateInterimBuilder(pParentWin, sUIFile, true)); + xBuilder = Application::CreateInterimBuilder(pParentWin, sUIFile, true); } Construct(xContainerWindow, std::move(xBuilder)); @@ -443,7 +441,7 @@ namespace pcr Any SAL_CALL OPropertyBrowserController::getViewData( ) { - return makeAny( m_sPageSelection ); + return Any( m_sPageSelection ); } @@ -490,6 +488,9 @@ namespace pcr m_aInspectedObjects.clear(); impl_bindToNewModel_nothrow( nullptr ); + m_xModel.clear(); + m_xInteractiveHandler.clear(); + m_xFrame.clear(); } void SAL_CALL OPropertyBrowserController::addEventListener( const Reference< XEventListener >& _rxListener ) @@ -643,7 +644,7 @@ namespace pcr // Even if they had an API for this, we do not know whether they were // originally created read-only, or if they are read-only just because // the model was. - impl_rebindToInspectee_nothrow( m_aInspectedObjects ); + impl_rebindToInspectee_nothrow( std::vector(m_aInspectedObjects) ); return; } @@ -754,8 +755,8 @@ namespace pcr case PropertyControlType::DateField: { std::unique_ptr<weld::Builder> xBuilder(PropertyHandlerHelper::makeBuilder("modules/spropctrlr/ui/datefield.ui", m_xContext)); - auto pMenuButton = xBuilder->weld_menu_button("datefield"); - rtl::Reference<ODateControl> pControl = new ODateControl(std::make_unique<SvtCalendarBox>(std::move(pMenuButton)), std::move(xBuilder), bCreateReadOnly); + auto pContainer = xBuilder->weld_container("datefield"); + rtl::Reference<ODateControl> pControl = new ODateControl(std::move(pContainer), std::move(xBuilder), bCreateReadOnly); pControl->SetModifyHandler(); xControl = pControl; break; @@ -907,7 +908,7 @@ namespace pcr } - void OPropertyBrowserController::impl_rebindToInspectee_nothrow( const InterfaceArray& _rObjects ) + void OPropertyBrowserController::impl_rebindToInspectee_nothrow( InterfaceArray&& _rObjects ) { try { @@ -915,7 +916,7 @@ namespace pcr stopInspection( true ); // inspect the new object(s) - m_aInspectedObjects = _rObjects; + m_aInspectedObjects = std::move(_rObjects); doInspection(); // update the user interface @@ -956,17 +957,17 @@ namespace pcr } // append these properties to our "all properties" array - aProperties.reserve( aProperties.size() + aThisHandlersProperties.size() ); - for (const auto & aThisHandlersPropertie : aThisHandlersProperties) + aProperties.reserve( std::max<size_t>(aProperties.size() + aThisHandlersProperties.size(), aProperties.size() * 2) ); + for (const auto & aThisHandlersProperty : aThisHandlersProperties) { auto noPrevious = std::none_of( aProperties.begin(), aProperties.end(), - FindPropertyByName( aThisHandlersPropertie.Name ) + FindPropertyByName( aThisHandlersProperty.Name ) ); if ( noPrevious ) { - aProperties.push_back( aThisHandlersPropertie ); + aProperties.push_back( aThisHandlersProperty ); continue; } @@ -979,7 +980,7 @@ namespace pcr // which means it can give it a completely different meaning than the previous // handler for this property is prepared for. std::pair< PropertyHandlerMultiRepository::iterator, PropertyHandlerMultiRepository::iterator > - aDepHandlers = m_aDependencyHandlers.equal_range( aThisHandlersPropertie.Name ); + aDepHandlers = m_aDependencyHandlers.equal_range( aThisHandlersProperty.Name ); m_aDependencyHandlers.erase( aDepHandlers.first, aDepHandlers.second ); } @@ -1003,9 +1004,9 @@ namespace pcr // remember this handler for every of the properties which it is responsible // for - for (const auto & aThisHandlersPropertie : aThisHandlersProperties) + for (const auto & aThisHandlersProperty : aThisHandlersProperties) { - m_aPropertyHandlers[ aThisHandlersPropertie.Name ] = *aHandler; + m_aPropertyHandlers[ aThisHandlersProperty.Name ] = *aHandler; // note that this implies that if two handlers support the same property, // the latter wins } @@ -1111,7 +1112,7 @@ namespace pcr { weld::Widget* m_pControlWindow = pTunnel->getWidget(); if (m_pControlWindow) - m_pControlWindow->set_buildable_name(m_pControlWindow->get_buildable_name() + "-" + _rDescriptor.DisplayName.toUtf8()); + m_pControlWindow->set_buildable_name(m_pControlWindow->get_buildable_name() + "-" + _rDescriptor.DisplayName); } } @@ -1178,7 +1179,7 @@ namespace pcr // this category does not yet exist. This is allowed, as an inspector model might be lazy, and not provide // any category information of its own. In this case, we have a fallback ... m_aPageIds[ aDescriptor.Category ] = - getPropertyBox().AppendPage( aDescriptor.Category, OString() ); + getPropertyBox().AppendPage(aDescriptor.Category, {}); nTargetPageId = impl_getPageIdForCategory_nothrow( aDescriptor.Category ); } @@ -1398,7 +1399,7 @@ namespace pcr if ( m_xModel.is() ) aHandlerFactories = m_xModel->getHandlerFactories(); - for ( auto const & handlerFactory : std::as_const(aHandlerFactories) ) + for (auto const& handlerFactory : aHandlerFactories) { if ( _rObjects.size() == 1 ) { // we're inspecting only one object -> one handler @@ -1428,7 +1429,7 @@ namespace pcr // then create a handler which composes information out of those single handlers if ( !aSingleHandlers.empty() ) - _rHandlers.push_back( new PropertyComposer( aSingleHandlers ) ); + _rHandlers.push_back( new PropertyComposer( std::move(aSingleHandlers) ) ); } } |