/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include extern int foo(); extern int bar(int = 0); class Class {}; void top1() { if (foo() == 1) { // expected-note {{if condition here [loplugin:flatten]}} foo(); } else { throw std::exception(); // expected-error {{unconditional throw in else branch, rather invert the condition, throw early, and flatten the normal case [loplugin:flatten]}} } if (foo() == 1) { Class aClass; (void)aClass; } else { throw std::exception(); // no warning expected } if (foo() == 1) { // expected-note {{if condition here [loplugin:flatten]}} Class aClass; (void)aClass; } else { throw std::exception(); // expected-error {{unconditional throw in else branch, rather invert the condition, throw early, and flatten the normal case [loplugin:flatten]}} } } void top2() { if (foo() == 2) { throw std::exception(); // expected-error {{unconditional throw in then branch, just flatten the else [loplugin:flatten]}} } else { foo(); } if (foo() == 2) { throw std::exception(); // no warning expected } else { Class aClass; (void)aClass; } if (foo() == 2) { throw std::exception(); // expected-error {{unconditional throw in then branch, just flatten the else [loplugin:flatten]}} } else { Class aClass; (void)aClass; } } void top3() { // no warning expected if (foo() == 2) { throw std::exception(); } else { Class aClass; (void)aClass; } int x = 1; (void)x; } void top4() { // no warning expected if (foo() == 2) { Class aClass; (void)aClass; } else { throw std::exception(); } int x = 1; (void)x; } void top5() { #if 1 if (foo() == 2) { if (foo() == 3) { // expected-note {{if condition here [loplugin:flatten]}} bar(); } else { throw std::exception(); // expected-error {{unconditional throw in else branch, rather invert the condition, throw early, and flatten the normal case [loplugin:flatten]}} } } else #endif throw std::exception(); // no warning expected } int main() { // no warning expected if (bar() == 3) { throw std::exception(); } else { throw std::exception(); } } void top6() { // no warning expected if (foo() == 2) { Class aClass; (void)aClass; } else if (foo() == 2) { Class aClass; (void)aClass; } else { throw std::exception(); } int x = 1; (void)x; } void top7() { // no warning expected if (foo() == 1) { throw std::exception(); } else if (foo() == 2) { throw std::exception(); } else { throw std::exception(); } } void top8() { if (foo() == 1) { if (foo() == 2) { throw std::exception(); // expected-error {{unconditional throw in then branch, just flatten the else [loplugin:flatten]}} } else { bar(); } } else if (foo() == 2) { bar(1); } else { bar(2); } } void top9() { if (foo() == 1) { // expected-error {{large if statement at end of function, rather invert the condition and exit early, and flatten the function [loplugin:flatten]}} Class aClass1; (void)aClass1; Class aClass2; (void)aClass2; Class aClass3; (void)aClass3; Class aClass4; (void)aClass4; Class aClass5; (void)aClass5; Class aClass6; (void)aClass6; } } void top10() { // no warning expected if (foo() == 2) { if (foo() == 1) { Class aClass1; (void)aClass1; Class aClass2; (void)aClass2; Class aClass3; (void)aClass3; } } } int top11() { // no warning expected if (foo() == 1) { Class aClass1; (void)aClass1; Class aClass2; (void)aClass2; Class aClass3; (void)aClass3; Class aClass4; (void)aClass4; Class aClass5; (void)aClass5; Class aClass6; (void)aClass6; } return 1; } /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ bora/cp-6.0-29 LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
path: root/include/sfx2/sidebar/TabBar.hxx
AgeCommit message (Collapse)Author
2016-06-03Resolves: tdf#96008 crash when an extension with legacy decks is installedCaolán McNamara
ReadLegacyAddons modifies its vectors of maDecks and maPanels in this case, but a load of things have (c++) references contents of the original contents. Its such a rats nest that the easiest thing seems to be to make them vectors of shared_ptrs and hold DeckDescriptor and PanelDescriptor by shared_ptr and it all works out Change-Id: I3f628e12c7d5f4224d14d5e0769e450ce893fb54
2015-11-04remove unused boost headerNoel Grandin
Change-Id: Ie9e036a119af144fe9690393fc68f7bdb3577941 Reviewed-on: https://gerrit.libreoffice.org/19776 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
2015-10-12Replace "SAL_OVERRIDE" with "override" in LIBO_INTERNAL_ONLY codeStephan Bergmann
Change-Id: I2ea407acd763ef2d7dae2d3b8f32525523ac8274
2015-09-14boost->stdCaolán McNamara
Change-Id: I3fd9e1599c5ad812879a58cf1dabbcd393105e1c Reviewed-on: https://gerrit.libreoffice.org/18564 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2015-08-26Convert vcl Button Link<> click handler to typed Link<Button*,void>Noel Grandin
Change-Id: Ie80dfb003118d40741549c41ebcc7eda4819f05b
2015-08-11Related: tdf#78111 Try to guard against too wide panel layoutsMaxim Monastirsky
The sidebar has width limit, so a panel shouldn't attempt to resize more than that. Otherwise we'll get an endless loop. Change-Id: Ia36535637e3585595c673c7fc46a1a7b162b74ba
2015-07-31sfx2: replace boost::function with std::functionMichael Stahl
Change-Id: I72acc5f396553eb464338a395ef40f95ed57a07e
2015-07-16loplugin:unusedmethods sfx2(part2)Noel Grandin
Change-Id: I82223b72ddb6a9df1ee52a300b083002234602dc Reviewed-on: https://gerrit.libreoffice.org/17075 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2015-06-22new uno sidebar api tdf#91806Laurent Godard
the entry point is SfxBaseController::getSidebar() the Decks and panels are now per SidebarController and not global anymore ' macro example Sub testSidebarApi controller = thisComponent.currentcontroller frameIni = thisComponent.currentcontroller.frame sidebar = thisComponent.currentcontroller.getSidebar() sidebar.setVisible(true) frame = sidebar.getFrame() decks = sidebar.getdecks() c = decks.count h = decks.hasElements() e = decks.getElementNames() a = decks.hasByName("MyDeck") deck = decks.getByName("MyDeck") deck.activate(true) t = deck.getTitle() deck.setTitle("new deck title") deck.moveFirst() deck.moveLast() deck.moveUp() deck.moveDown() index = deck.getOrderIndex() panels = deck.getPanels() ep = panels.getElementnames() ap = panels.hasByName("aPanelName") panel = panels.getByName("aPanelName") panel.setTitle("new panel title") panel.collapse() panel.expand(true) ' expand and collapse other index = panel.getOrderIndex() panel.moveLast() panel.moveFirst() panel.moveDown() panel.moveUp() End Sub Change-Id: I7a4b953f2277dea483bb296ba6ead35de7205ace Reviewed-on: https://gerrit.libreoffice.org/15856 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> Tested-by: Tomaž Vajngerl <quikee@gmail.com>