diff options
Diffstat (limited to 'sc/source/ui')
-rw-r--r-- | sc/source/ui/app/inputwin.cxx | 92 | ||||
-rw-r--r-- | sc/source/ui/cctrl/checklistmenu.cxx | 21 | ||||
-rw-r--r-- | sc/source/ui/dbgui/tpsubt.cxx | 22 | ||||
-rw-r--r-- | sc/source/ui/drawfunc/drawsh2.cxx | 124 | ||||
-rw-r--r-- | sc/source/ui/drawfunc/futext.cxx | 30 |
5 files changed, 145 insertions, 144 deletions
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index 926157e71d83..c7beb52ed9e6 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -995,34 +995,34 @@ void ScInputBarGroup::DecrementVerticalSize() void ScInputWindow::MenuHdl(std::string_view command) { - if (!command.empty()) - { - bool bSubTotal = false; - bool bRangeFinder = false; - OpCode eCode = ocSum; - if ( command == "sum" ) - { - eCode = ocSum; - } - else if ( command == "average" ) - { - eCode = ocAverage; - } - else if ( command == "max" ) - { - eCode = ocMax; - } - else if ( command == "min" ) - { - eCode = ocMin; - } - else if ( command == "count" ) - { - eCode = ocCount; - } + if (command.empty()) + return; - AutoSum( bRangeFinder, bSubTotal, eCode ); + bool bSubTotal = false; + bool bRangeFinder = false; + OpCode eCode = ocSum; + if ( command == "sum" ) + { + eCode = ocSum; + } + else if ( command == "average" ) + { + eCode = ocAverage; } + else if ( command == "max" ) + { + eCode = ocMax; + } + else if ( command == "min" ) + { + eCode = ocMin; + } + else if ( command == "count" ) + { + eCode = ocCount; + } + + AutoSum( bRangeFinder, bSubTotal, eCode ); } IMPL_LINK_NOARG(ScInputWindow, DropdownClickHdl, ToolBox *, void) @@ -1340,31 +1340,31 @@ int ScTextWnd::GetEditEngTxtHeight() const void ScTextWnd::SetScrollBarRange() { - if (m_xEditView) - { - OutputDevice& rDevice = GetDrawingArea()->get_ref_device(); - Size aOutputSize = rDevice.GetOutputSize(); + if (!m_xEditView) + return; - int nUpper = GetEditEngTxtHeight(); - int nCurrentDocPos = m_xEditView->GetVisArea().Top(); - int nStepIncrement = GetTextHeight(); - int nPageIncrement = aOutputSize.Height(); - int nPageSize = aOutputSize.Height(); + OutputDevice& rDevice = GetDrawingArea()->get_ref_device(); + Size aOutputSize = rDevice.GetOutputSize(); - /* limit the page size to below nUpper because gtk's gtk_scrolled_window_start_deceleration has - effectively... + int nUpper = GetEditEngTxtHeight(); + int nCurrentDocPos = m_xEditView->GetVisArea().Top(); + int nStepIncrement = GetTextHeight(); + int nPageIncrement = aOutputSize.Height(); + int nPageSize = aOutputSize.Height(); - lower = gtk_adjustment_get_lower - upper = gtk_adjustment_get_upper - gtk_adjustment_get_page_size + /* limit the page size to below nUpper because gtk's gtk_scrolled_window_start_deceleration has + effectively... - and requires that upper > lower or the deceleration animation never ends - */ - nPageSize = std::min(nPageSize, nUpper); + lower = gtk_adjustment_get_lower + upper = gtk_adjustment_get_upper - gtk_adjustment_get_page_size - weld::ScrolledWindow& rVBar = mrGroupBar.GetScrollWin(); - rVBar.vadjustment_configure(nCurrentDocPos, 0, nUpper, - nStepIncrement, nPageIncrement, nPageSize); - } + and requires that upper > lower or the deceleration animation never ends + */ + nPageSize = std::min(nPageSize, nUpper); + + weld::ScrolledWindow& rVBar = mrGroupBar.GetScrollWin(); + rVBar.vadjustment_configure(nCurrentDocPos, 0, nUpper, + nStepIncrement, nPageIncrement, nPageSize); } void ScTextWnd::DoScroll() diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx index 44f64b8bc4a7..201313f0e41e 100644 --- a/sc/source/ui/cctrl/checklistmenu.cxx +++ b/sc/source/ui/cctrl/checklistmenu.cxx @@ -1395,17 +1395,18 @@ void ScCheckListMenuControl::launch(const tools::Rectangle& rRect) void ScCheckListMenuControl::NotifyCloseLOK() { VclPtr<vcl::Window> aNotifierWindow = mxFrame->GetParentWithLOKNotifier(); - if (aNotifierWindow) { - const vcl::ILibreOfficeKitNotifier* pNotifier = aNotifierWindow->GetLOKNotifier(); - if (pNotifier) - { - tools::JsonWriter aJsonWriter; - aJsonWriter.put("jsontype", "autofilter"); - aJsonWriter.put("action", "close"); + if (!aNotifierWindow) + return; - const std::string message = aJsonWriter.extractAsStdString(); - pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, message.c_str()); - } + const vcl::ILibreOfficeKitNotifier* pNotifier = aNotifierWindow->GetLOKNotifier(); + if (pNotifier) + { + tools::JsonWriter aJsonWriter; + aJsonWriter.put("jsontype", "autofilter"); + aJsonWriter.put("action", "close"); + + const std::string message = aJsonWriter.extractAsStdString(); + pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, message.c_str()); } } diff --git a/sc/source/ui/dbgui/tpsubt.cxx b/sc/source/ui/dbgui/tpsubt.cxx index b5acbc6cdb60..4b8c2e1396be 100644 --- a/sc/source/ui/dbgui/tpsubt.cxx +++ b/sc/source/ui/dbgui/tpsubt.cxx @@ -590,19 +590,19 @@ IMPL_LINK(ScTpSubTotalOptions, CheckHdl, weld::Button&, rBox, void) IMPL_LINK(ScTpSubTotalGroup, CheckBoxHdl, weld::Button&, rBox, void) { - if (&rBox == mxLbSelectAllColumns.get()) - { - bool bChecked = mxLbSelectAllColumns->get_active(); + if (&rBox != mxLbSelectAllColumns.get()) + return; - mxLbColumns->all_foreach([&](const weld::TreeIter& rEntry) { - if ( bChecked ) - mxLbColumns->set_toggle(rEntry, TRISTATE_TRUE); - else - mxLbColumns->set_toggle(rEntry, TRISTATE_FALSE); + bool bChecked = mxLbSelectAllColumns->get_active(); - return false; - }); - } + mxLbColumns->all_foreach([&](const weld::TreeIter& rEntry) { + if ( bChecked ) + mxLbColumns->set_toggle(rEntry, TRISTATE_TRUE); + else + mxLbColumns->set_toggle(rEntry, TRISTATE_FALSE); + + return false; + }); } ScTpSubTotalGroup1::~ScTpSubTotalGroup1() diff --git a/sc/source/ui/drawfunc/drawsh2.cxx b/sc/source/ui/drawfunc/drawsh2.cxx index 1b2ef3240c1e..22f28e52efe8 100644 --- a/sc/source/ui/drawfunc/drawsh2.cxx +++ b/sc/source/ui/drawfunc/drawsh2.cxx @@ -311,69 +311,69 @@ void ScDrawShell::GetDrawFuncState( SfxItemSet& rSet ) // disable functions static void setupFillColorForChart(SfxViewShell* pShell, SfxItemSet& rSet) { - if (pShell) + if (!pShell) + return; + + SfxInPlaceClient* pIPClient = pShell->GetIPClient(); + if (!pIPClient) + return; + + const css::uno::Reference<::css::embed::XEmbeddedObject>& xEmbObj = pIPClient->GetObject(); + if( !xEmbObj.is() ) + return; + + ::css::uno::Reference<::css::chart2::XChartDocument> xChart( xEmbObj->getComponent(), uno::UNO_QUERY ); + if( !xChart.is() ) + return; + + css::uno::Reference<css::beans::XPropertySet> xPropSet = xChart->getPageBackground(); + if (!xPropSet.is()) + return; + + css::uno::Reference<css::beans::XPropertySetInfo> xInfo(xPropSet->getPropertySetInfo()); + if (!xInfo.is()) + return; + + if (xInfo->hasPropertyByName("FillColor")) { - SfxInPlaceClient* pIPClient = pShell->GetIPClient(); - if (pIPClient) - { - const css::uno::Reference<::css::embed::XEmbeddedObject>& xEmbObj = pIPClient->GetObject(); - if( xEmbObj.is() ) - { - ::css::uno::Reference<::css::chart2::XChartDocument> xChart( xEmbObj->getComponent(), uno::UNO_QUERY ); - if( xChart.is() ) - { - css::uno::Reference<css::beans::XPropertySet> xPropSet = xChart->getPageBackground(); - if (xPropSet.is()) - { - css::uno::Reference<css::beans::XPropertySetInfo> xInfo(xPropSet->getPropertySetInfo()); - if (xInfo.is()) - { - if (xInfo->hasPropertyByName("FillColor")) - { - sal_uInt32 nFillColor = 0; - xPropSet->getPropertyValue("FillColor") >>= nFillColor; - - XFillColorItem aFillColorItem("", Color(ColorTransparency, nFillColor)); - rSet.Put(aFillColorItem); - - if (comphelper::LibreOfficeKit::isActive()) - pShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, - (".uno:FillColor=" + std::to_string(nFillColor)).c_str()); - } - - if (comphelper::LibreOfficeKit::isActive() && xInfo->hasPropertyByName("FillGradientName")) - { - OUString aGradientName; - xPropSet->getPropertyValue("FillGradientName") >>= aGradientName; - - ::css::uno::Reference< ::css::frame::XController > xChartController = xChart->getCurrentController(); - if( xChartController.is() ) - { - css::uno::Reference<css::lang::XMultiServiceFactory> xFact(xChartController->getModel(), css::uno::UNO_QUERY); - - if (xFact.is()) - { - css::uno::Reference<css::container::XNameAccess> xNameAccess( - xFact->createInstance("com.sun.star.drawing.GradientTable"), css::uno::UNO_QUERY); - - if (xNameAccess.is() && xNameAccess->hasByName(aGradientName)) - { - css::uno::Any aAny = xNameAccess->getByName(aGradientName); - - XFillGradientItem aItem; - aItem.SetName(aGradientName); - aItem.PutValue(aAny, MID_FILLGRADIENT); - - rSet.Put(aItem); - } - } - } - } - } - } - } - } - } + sal_uInt32 nFillColor = 0; + xPropSet->getPropertyValue("FillColor") >>= nFillColor; + + XFillColorItem aFillColorItem("", Color(ColorTransparency, nFillColor)); + rSet.Put(aFillColorItem); + + if (comphelper::LibreOfficeKit::isActive()) + pShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, + (".uno:FillColor=" + std::to_string(nFillColor)).c_str()); + } + + if (!(comphelper::LibreOfficeKit::isActive() && xInfo->hasPropertyByName("FillGradientName"))) + return; + + OUString aGradientName; + xPropSet->getPropertyValue("FillGradientName") >>= aGradientName; + + ::css::uno::Reference< ::css::frame::XController > xChartController = xChart->getCurrentController(); + if( !xChartController.is() ) + return; + + css::uno::Reference<css::lang::XMultiServiceFactory> xFact(xChartController->getModel(), css::uno::UNO_QUERY); + + if (!xFact.is()) + return; + + css::uno::Reference<css::container::XNameAccess> xNameAccess( + xFact->createInstance("com.sun.star.drawing.GradientTable"), css::uno::UNO_QUERY); + + if (xNameAccess.is() && xNameAccess->hasByName(aGradientName)) + { + css::uno::Any aAny = xNameAccess->getByName(aGradientName); + + XFillGradientItem aItem; + aItem.SetName(aGradientName); + aItem.PutValue(aAny, MID_FILLGRADIENT); + + rSet.Put(aItem); } } diff --git a/sc/source/ui/drawfunc/futext.cxx b/sc/source/ui/drawfunc/futext.cxx index 9e412449917c..30ab23371d2f 100644 --- a/sc/source/ui/drawfunc/futext.cxx +++ b/sc/source/ui/drawfunc/futext.cxx @@ -600,23 +600,23 @@ void FuText::SetInEditMode(SdrObject* pObj, const Point* pMousePixel, return; OutlinerView* pOLV = pView->GetTextEditOutlinerView(); - if (pOLV) - { - if ( pMousePixel ) - { - MouseEvent aEditEvt( *pMousePixel, 1, MouseEventModifiers::SYNTHETIC, MOUSE_LEFT, 0 ); - pOLV->MouseButtonDown(aEditEvt); - pOLV->MouseButtonUp(aEditEvt); - } - else if ( bCursorToEnd ) - { - ESelection aNewSelection(EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND, EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND); - pOLV->SetSelection(aNewSelection); - } + if (!pOLV) + return; - if ( pInitialKey ) - pOLV->PostKeyEvent( *pInitialKey ); + if ( pMousePixel ) + { + MouseEvent aEditEvt( *pMousePixel, 1, MouseEventModifiers::SYNTHETIC, MOUSE_LEFT, 0 ); + pOLV->MouseButtonDown(aEditEvt); + pOLV->MouseButtonUp(aEditEvt); } + else if ( bCursorToEnd ) + { + ESelection aNewSelection(EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND, EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND); + pOLV->SetSelection(aNewSelection); + } + + if ( pInitialKey ) + pOLV->PostKeyEvent( *pInitialKey ); } // Create default drawing objects via keyboard |