drawinglayer/qa/unit/border.cxx | 98 ++++++------------- framework/qa/cppunit/dispatchtest.cxx | 69 +++++++------ include/comphelper/propertyvalue.hxx | 4 solenv/clang-format/blacklist | 5 starmath/source/wordexportbase.cxx | 171 ++++++++++++++++------------------ starmath/source/wordexportbase.hxx | 38 +++---- 6 files changed, 179 insertions(+), 206 deletions(-)
New commits: commit 6cc4aa93baed7916705b43ddce5dbb7c031e9997 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Mon May 18 15:01:28 2020 +0200 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Mon May 18 22:51:45 2020 +0200 comphelper, drawinglayer, framework, starmath: clang-format these files I added these files more or less recently and they have long lines. Use clang-format to break at a sane column limit. Change-Id: Id608fffbbc0673c9bc350dd696cb0a31906840d3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94423 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Tested-by: Jenkins diff --git a/drawinglayer/qa/unit/border.cxx b/drawinglayer/qa/unit/border.cxx index 8209d5172926..8c4e6e08419b 100644 --- a/drawinglayer/qa/unit/border.cxx +++ b/drawinglayer/qa/unit/border.cxx @@ -28,7 +28,6 @@ using namespace com::sun::star; namespace { - class DrawinglayerBorderTest : public test::BootstrapFixture { }; @@ -50,37 +49,21 @@ CPPUNIT_TEST_FIXTURE(DrawinglayerBorderTest, testDoubleDecompositionSolid) basegfx::BColor aColorLeft; const std::vector<double> aDashing(svtools::GetLineDashing(SvxBorderLineStyle::DOUBLE, 10.0)); const drawinglayer::attribute::StrokeAttribute aStrokeAttribute(aDashing); - std::vector< drawinglayer::primitive2d::BorderLine > aBorderlines; - - aBorderlines.push_back( - drawinglayer::primitive2d::BorderLine( - drawinglayer::attribute::LineAttribute( - aColorLeft, - fLeftWidth), - fExtendLeftStart, - fExtendLeftStart, - fExtendLeftEnd, - fExtendLeftEnd)); - - aBorderlines.push_back( - drawinglayer::primitive2d::BorderLine(fDistance)); - - aBorderlines.push_back( - drawinglayer::primitive2d::BorderLine( - drawinglayer::attribute::LineAttribute( - aColorRight, - fRightWidth), - fExtendRightStart, - fExtendRightStart, - fExtendRightEnd, - fExtendRightEnd)); + std::vector<drawinglayer::primitive2d::BorderLine> aBorderlines; + + aBorderlines.push_back(drawinglayer::primitive2d::BorderLine( + drawinglayer::attribute::LineAttribute(aColorLeft, fLeftWidth), fExtendLeftStart, + fExtendLeftStart, fExtendLeftEnd, fExtendLeftEnd)); + + aBorderlines.push_back(drawinglayer::primitive2d::BorderLine(fDistance)); + + aBorderlines.push_back(drawinglayer::primitive2d::BorderLine( + drawinglayer::attribute::LineAttribute(aColorRight, fRightWidth), fExtendRightStart, + fExtendRightStart, fExtendRightEnd, fExtendRightEnd)); rtl::Reference<drawinglayer::primitive2d::BorderLinePrimitive2D> aBorder( - new drawinglayer::primitive2d::BorderLinePrimitive2D( - aStart, - aEnd, - aBorderlines, - aStrokeAttribute)); + new drawinglayer::primitive2d::BorderLinePrimitive2D(aStart, aEnd, aBorderlines, + aStrokeAttribute)); // Decompose it into polygons. drawinglayer::geometry::ViewInformation2D aView; @@ -91,14 +74,16 @@ CPPUNIT_TEST_FIXTURE(DrawinglayerBorderTest, testDoubleDecompositionSolid) CPPUNIT_ASSERT_EQUAL(static_cast<std::size_t>(2), aContainer.size()); // Get the inside line, now a PolygonStrokePrimitive2D - auto pInside = dynamic_cast<const drawinglayer::primitive2d::PolygonStrokePrimitive2D*>(aContainer[0].get()); + auto pInside = dynamic_cast<const drawinglayer::primitive2d::PolygonStrokePrimitive2D*>( + aContainer[0].get()); CPPUNIT_ASSERT(pInside); // Make sure the inside line's height is fLeftWidth. const double fLineWidthFromDecompose = pInside->getLineAttribute().getWidth(); // This was 2.47, i.e. the width of the inner line was 1 unit (in the bugdoc's case: 1 pixel) wider than expected. - CPPUNIT_ASSERT_DOUBLES_EQUAL(fLeftWidth, fLineWidthFromDecompose, basegfx::fTools::getSmallValue()); + CPPUNIT_ASSERT_DOUBLES_EQUAL(fLeftWidth, fLineWidthFromDecompose, + basegfx::fTools::getSmallValue()); } CPPUNIT_TEST_FIXTURE(DrawinglayerBorderTest, testDoublePixelProcessing) @@ -106,7 +91,8 @@ CPPUNIT_TEST_FIXTURE(DrawinglayerBorderTest, testDoublePixelProcessing) // Create a pixel processor. ScopedVclPtrInstance<VirtualDevice> pDev; drawinglayer::geometry::ViewInformation2D aView; - std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor(drawinglayer::processor2d::createBaseProcessor2DFromOutputDevice(*pDev, aView)); + std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor( + drawinglayer::processor2d::createBaseProcessor2DFromOutputDevice(*pDev, aView)); CPPUNIT_ASSERT(pProcessor); GDIMetaFile aMetaFile; // Start recording after the processor is created, so we can test the pixel processor. @@ -127,37 +113,21 @@ CPPUNIT_TEST_FIXTURE(DrawinglayerBorderTest, testDoublePixelProcessing) basegfx::BColor aColorLeft; const std::vector<double> aDashing(svtools::GetLineDashing(SvxBorderLineStyle::DOUBLE, 10.0)); const drawinglayer::attribute::StrokeAttribute aStrokeAttribute(aDashing); - std::vector< drawinglayer::primitive2d::BorderLine > aBorderlines; - - aBorderlines.push_back( - drawinglayer::primitive2d::BorderLine( - drawinglayer::attribute::LineAttribute( - aColorLeft, - fLeftWidth), - fExtendLeftStart, - fExtendLeftStart, - fExtendLeftEnd, - fExtendLeftEnd)); - - aBorderlines.push_back( - drawinglayer::primitive2d::BorderLine(fDistance)); - - aBorderlines.push_back( - drawinglayer::primitive2d::BorderLine( - drawinglayer::attribute::LineAttribute( - aColorRight, - fRightWidth), - fExtendRightStart, - fExtendRightStart, - fExtendRightEnd, - fExtendRightEnd)); + std::vector<drawinglayer::primitive2d::BorderLine> aBorderlines; + + aBorderlines.push_back(drawinglayer::primitive2d::BorderLine( + drawinglayer::attribute::LineAttribute(aColorLeft, fLeftWidth), fExtendLeftStart, + fExtendLeftStart, fExtendLeftEnd, fExtendLeftEnd)); + + aBorderlines.push_back(drawinglayer::primitive2d::BorderLine(fDistance)); + + aBorderlines.push_back(drawinglayer::primitive2d::BorderLine( + drawinglayer::attribute::LineAttribute(aColorRight, fRightWidth), fExtendRightStart, + fExtendRightStart, fExtendRightEnd, fExtendRightEnd)); rtl::Reference<drawinglayer::primitive2d::BorderLinePrimitive2D> aBorder( - new drawinglayer::primitive2d::BorderLinePrimitive2D( - aStart, - aEnd, - aBorderlines, - aStrokeAttribute)); + new drawinglayer::primitive2d::BorderLinePrimitive2D(aStart, aEnd, aBorderlines, + aStrokeAttribute)); drawinglayer::primitive2d::Primitive2DContainer aPrimitives; aPrimitives.push_back(drawinglayer::primitive2d::Primitive2DReference(aBorder.get())); @@ -180,7 +150,8 @@ CPPUNIT_TEST_FIXTURE(DrawinglayerBorderTest, testDoublePixelProcessing) { auto pMPLAction = static_cast<MetaPolyLineAction*>(pAction); - if (0 != pMPLAction->GetLineInfo().GetWidth() && LineStyle::Solid == pMPLAction->GetLineInfo().GetStyle()) + if (0 != pMPLAction->GetLineInfo().GetWidth() + && LineStyle::Solid == pMPLAction->GetLineInfo().GetStyle()) { nPolyLineActionCount++; } @@ -202,7 +173,6 @@ CPPUNIT_TEST_FIXTURE(DrawinglayerBorderTest, testDoublePixelProcessing) CPPUNIT_ASSERT_EQUAL(nExpectedNumPolyLineActions, nPolyLineActionCount); } - } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/framework/qa/cppunit/dispatchtest.cxx b/framework/qa/cppunit/dispatchtest.cxx index 2fa209e82f63..0dd6b4cfc33d 100644 --- a/framework/qa/cppunit/dispatchtest.cxx +++ b/framework/qa/cppunit/dispatchtest.cxx @@ -23,13 +23,9 @@ using namespace ::com::sun::star; namespace { - /// Sample interception implementation that asserts getInterceptedURLs() and queryDispatch() is in sync. -class MyInterceptor : public cppu::WeakImplHelper - < - frame::XDispatchProviderInterceptor, - frame::XInterceptorInfo - > +class MyInterceptor + : public cppu::WeakImplHelper<frame::XDispatchProviderInterceptor, frame::XInterceptorInfo> { uno::Reference<frame::XDispatchProvider> m_xMaster; uno::Reference<frame::XDispatchProvider> m_xSlave; @@ -49,20 +45,25 @@ public: virtual uno::Sequence<OUString> SAL_CALL getInterceptedURLs() override; // frame::XDispatchProviderInterceptor - virtual void SAL_CALL setMasterDispatchProvider(const uno::Reference<frame::XDispatchProvider>& xNewSupplier) override; + virtual void SAL_CALL setMasterDispatchProvider( + const uno::Reference<frame::XDispatchProvider>& xNewSupplier) override; virtual uno::Reference<frame::XDispatchProvider> SAL_CALL getMasterDispatchProvider() override; - virtual void SAL_CALL setSlaveDispatchProvider(const uno::Reference<frame::XDispatchProvider>& xNewSupplier) override; + virtual void SAL_CALL + setSlaveDispatchProvider(const uno::Reference<frame::XDispatchProvider>& xNewSupplier) override; virtual uno::Reference<frame::XDispatchProvider> SAL_CALL getSlaveDispatchProvider() override; // frame::XDispatchProvider - virtual uno::Sequence<uno::Reference<frame::XDispatch>> SAL_CALL queryDispatches(const uno::Sequence<frame::DispatchDescriptor>& rRequests) override; - virtual uno::Reference<frame::XDispatch> SAL_CALL queryDispatch(const util::URL& rURL, const OUString& rTargetFrameName, sal_Int32 SearchFlags) override; + virtual uno::Sequence<uno::Reference<frame::XDispatch>> SAL_CALL + queryDispatches(const uno::Sequence<frame::DispatchDescriptor>& rRequests) override; + virtual uno::Reference<frame::XDispatch> + SAL_CALL queryDispatch(const util::URL& rURL, const OUString& rTargetFrameName, + sal_Int32 SearchFlags) override; }; MyInterceptor::MyInterceptor() - : m_aDisabledCommands {".uno:Bold"}, - m_nExpected(0), - m_nUnexpected(0) + : m_aDisabledCommands{ ".uno:Bold" } + , m_nExpected(0) + , m_nUnexpected(0) { } @@ -80,12 +81,10 @@ int MyInterceptor::getUnexpected() return nRet; } -uno::Sequence<OUString> MyInterceptor::getInterceptedURLs() -{ - return m_aDisabledCommands; -} +uno::Sequence<OUString> MyInterceptor::getInterceptedURLs() { return m_aDisabledCommands; } -void MyInterceptor::setMasterDispatchProvider(const uno::Reference<frame::XDispatchProvider>& xNewSupplier) +void MyInterceptor::setMasterDispatchProvider( + const uno::Reference<frame::XDispatchProvider>& xNewSupplier) { m_xMaster = xNewSupplier; } @@ -95,7 +94,8 @@ uno::Reference<frame::XDispatchProvider> MyInterceptor::getMasterDispatchProvide return m_xMaster; } -void MyInterceptor::setSlaveDispatchProvider(const uno::Reference<frame::XDispatchProvider>& xNewSupplier) +void MyInterceptor::setSlaveDispatchProvider( + const uno::Reference<frame::XDispatchProvider>& xNewSupplier) { m_xSlave = xNewSupplier; } @@ -105,21 +105,26 @@ uno::Reference<frame::XDispatchProvider> MyInterceptor::getSlaveDispatchProvider return m_xSlave; } -uno::Sequence<uno::Reference<frame::XDispatch>> MyInterceptor::queryDispatches(const uno::Sequence<frame::DispatchDescriptor>& rRequests) +uno::Sequence<uno::Reference<frame::XDispatch>> +MyInterceptor::queryDispatches(const uno::Sequence<frame::DispatchDescriptor>& rRequests) { uno::Sequence<uno::Reference<frame::XDispatch>> aResult(rRequests.getLength()); for (sal_Int32 i = 0; i < rRequests.getLength(); ++i) { - aResult[i] = queryDispatch(rRequests[i].FeatureURL, rRequests[i].FrameName, rRequests[i].SearchFlags); + aResult[i] = queryDispatch(rRequests[i].FeatureURL, rRequests[i].FrameName, + rRequests[i].SearchFlags); } return aResult; } -uno::Reference<frame::XDispatch> MyInterceptor::queryDispatch(const util::URL& rURL, const OUString& /*rTargetFrameName*/, sal_Int32 /*SearchFlags*/) +uno::Reference<frame::XDispatch> MyInterceptor::queryDispatch(const util::URL& rURL, + const OUString& /*rTargetFrameName*/, + sal_Int32 /*SearchFlags*/) { - if (std::find(m_aDisabledCommands.begin(), m_aDisabledCommands.end(), rURL.Complete) != m_aDisabledCommands.end()) + if (std::find(m_aDisabledCommands.begin(), m_aDisabledCommands.end(), rURL.Complete) + != m_aDisabledCommands.end()) ++m_nExpected; else ++m_nUnexpected; @@ -132,7 +137,9 @@ class DispatchTest : public test::BootstrapFixture, public unotest::MacrosTest { protected: uno::Reference<lang::XComponent> mxComponent; - void dispatchCommand(const uno::Reference<lang::XComponent>& xComponent, const OUString& rCommand, const uno::Sequence<beans::PropertyValue>& rPropertyValues); + void dispatchCommand(const uno::Reference<lang::XComponent>& xComponent, + const OUString& rCommand, + const uno::Sequence<beans::PropertyValue>& rPropertyValues); public: virtual void setUp() override; @@ -154,9 +161,12 @@ void DispatchTest::tearDown() test::BootstrapFixture::tearDown(); } -void DispatchTest::dispatchCommand(const uno::Reference<lang::XComponent>& xComponent, const OUString& rCommand, const uno::Sequence<beans::PropertyValue>& rPropertyValues) +void DispatchTest::dispatchCommand(const uno::Reference<lang::XComponent>& xComponent, + const OUString& rCommand, + const uno::Sequence<beans::PropertyValue>& rPropertyValues) { - uno::Reference<frame::XController> xController = uno::Reference<frame::XModel>(xComponent, uno::UNO_QUERY_THROW)->getCurrentController(); + uno::Reference<frame::XController> xController + = uno::Reference<frame::XModel>(xComponent, uno::UNO_QUERY_THROW)->getCurrentController(); CPPUNIT_ASSERT(xController.is()); uno::Reference<frame::XDispatchProvider> xFrame(xController->getFrame(), uno::UNO_QUERY); CPPUNIT_ASSERT(xFrame.is()); @@ -175,11 +185,13 @@ CPPUNIT_TEST_FIXTURE(DispatchTest, testInterception) uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY); CPPUNIT_ASSERT(xModel.is()); - uno::Reference<frame::XDispatchProviderInterception> xRegistration(xModel->getCurrentController()->getFrame(), uno::UNO_QUERY); + uno::Reference<frame::XDispatchProviderInterception> xRegistration( + xModel->getCurrentController()->getFrame(), uno::UNO_QUERY); CPPUNIT_ASSERT(xRegistration.is()); rtl::Reference<MyInterceptor> pInterceptor(new MyInterceptor()); - xRegistration->registerDispatchProviderInterceptor(uno::Reference<frame::XDispatchProviderInterceptor>(pInterceptor.get())); + xRegistration->registerDispatchProviderInterceptor( + uno::Reference<frame::XDispatchProviderInterceptor>(pInterceptor.get())); dispatchCommand(mxComponent, ".uno:Bold", {}); CPPUNIT_ASSERT_EQUAL(1, pInterceptor->getExpected()); @@ -189,7 +201,6 @@ CPPUNIT_TEST_FIXTURE(DispatchTest, testInterception) // This was 1: MyInterceptor::queryDispatch() was called for .uno:Italic. CPPUNIT_ASSERT_EQUAL(0, pInterceptor->getUnexpected()); } - } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/include/comphelper/propertyvalue.hxx b/include/comphelper/propertyvalue.hxx index 3415d2304f83..85f3d67385c6 100644 --- a/include/comphelper/propertyvalue.hxx +++ b/include/comphelper/propertyvalue.hxx @@ -18,7 +18,6 @@ namespace comphelper { - /** * Creates a beans::PropertyValue easily, i.e. you can write: * @@ -26,14 +25,13 @@ namespace comphelper * * instead of writing 3 extra lines to set the name and value of the beans::PropertyValue. */ -template<typename T> css::beans::PropertyValue makePropertyValue(const OUString& rName, T&& rValue) +template <typename T> css::beans::PropertyValue makePropertyValue(const OUString& rName, T&& rValue) { css::beans::PropertyValue aValue; aValue.Name = rName; aValue.Value = css::uno::toAny(std::forward<T>(rValue)); return aValue; } - } #endif // INCLUDED_COMPHELPER_PROPERTYVALUE_HXX diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist index 0a1f66334c8c..26ee7d8c4f54 100644 --- a/solenv/clang-format/blacklist +++ b/solenv/clang-format/blacklist @@ -3642,7 +3642,6 @@ drawinglayer/inc/processor3d/zbufferprocessor3d.hxx drawinglayer/inc/texture/texture.hxx drawinglayer/inc/texture/texture3d.hxx drawinglayer/inc/wmfemfhelper.hxx -drawinglayer/qa/unit/border.cxx drawinglayer/source/animation/animationtiming.cxx drawinglayer/source/attribute/fillgradientattribute.cxx drawinglayer/source/attribute/fillgraphicattribute.cxx @@ -4980,7 +4979,6 @@ framework/inc/xml/statusbardocumenthandler.hxx framework/inc/xml/toolboxconfigurationdefines.hxx framework/inc/xml/toolboxdocumenthandler.hxx framework/inc/xml/xmlnamespaces.hxx -framework/qa/cppunit/dispatchtest.cxx framework/source/accelerators/acceleratorconfiguration.cxx framework/source/accelerators/documentacceleratorconfiguration.cxx framework/source/accelerators/globalacceleratorconfiguration.cxx @@ -5658,7 +5656,6 @@ include/comphelper/propertysequence.hxx include/comphelper/propertysethelper.hxx include/comphelper/propertysetinfo.hxx include/comphelper/propertystatecontainer.hxx -include/comphelper/propertyvalue.hxx include/comphelper/propmultiplex.hxx include/comphelper/propstate.hxx include/comphelper/proxyaggregation.hxx @@ -12784,8 +12781,6 @@ starmath/source/unomodel.cxx starmath/source/utility.cxx starmath/source/view.cxx starmath/source/visitors.cxx -starmath/source/wordexportbase.cxx -starmath/source/wordexportbase.hxx stoc/source/corereflection/base.hxx stoc/source/corereflection/crarray.cxx stoc/source/corereflection/crbase.cxx diff --git a/starmath/source/wordexportbase.cxx b/starmath/source/wordexportbase.cxx index 1f802e2e6e92..7f4699dfb952 100644 --- a/starmath/source/wordexportbase.cxx +++ b/starmath/source/wordexportbase.cxx @@ -21,84 +21,85 @@ SmWordExportBase::~SmWordExportBase() = default; void SmWordExportBase::HandleNode(const SmNode* pNode, int nLevel) { - SAL_INFO("starmath.wordbase", "Node: " << nLevel << " " << int(pNode->GetType()) << " " << pNode->GetNumSubNodes()); + SAL_INFO("starmath.wordbase", + "Node: " << nLevel << " " << int(pNode->GetType()) << " " << pNode->GetNumSubNodes()); switch (pNode->GetType()) { - case SmNodeType::Attribut: - HandleAttribute(static_cast< const SmAttributNode* >(pNode), nLevel); - break; - case SmNodeType::Text: - HandleText(pNode,nLevel); - break; - case SmNodeType::VerticalBrace: - HandleVerticalBrace(static_cast< const SmVerticalBraceNode* >(pNode), nLevel); - break; - case SmNodeType::Brace: - HandleBrace(static_cast< const SmBraceNode* >(pNode), nLevel); - break; - case SmNodeType::Oper: - HandleOperator(static_cast< const SmOperNode* >(pNode), nLevel); - break; - case SmNodeType::UnHor: - HandleUnaryOperation(static_cast< const SmUnHorNode* >(pNode), nLevel); - break; - case SmNodeType::BinHor: - HandleBinaryOperation(static_cast< const SmBinHorNode* >(pNode), nLevel); - break; - case SmNodeType::BinVer: - HandleFractions(pNode,nLevel,nullptr); - break; - case SmNodeType::Root: - HandleRoot(static_cast< const SmRootNode* >(pNode), nLevel); - break; - case SmNodeType::Special: - { - auto pText= static_cast<const SmTextNode*>(pNode); - //if the token str and the result text are the same then this - //is to be seen as text, else assume it's a mathchar - if (pText->GetText() == pText->GetToken().aText) - HandleText(pText,nLevel); - else - HandleMath(pText,nLevel); - break; - } - case SmNodeType::Math: - case SmNodeType::MathIdent: - HandleMath(pNode,nLevel); - break; - case SmNodeType::SubSup: - HandleSubSupScript(static_cast< const SmSubSupNode* >(pNode), nLevel); - break; - case SmNodeType::Expression: - HandleAllSubNodes(pNode, nLevel); - break; - case SmNodeType::Table: - //Root Node, PILE equivalent, i.e. vertical stack - HandleTable(pNode,nLevel); - break; - case SmNodeType::Matrix: - HandleMatrix(static_cast< const SmMatrixNode* >(pNode), nLevel); + case SmNodeType::Attribut: + HandleAttribute(static_cast<const SmAttributNode*>(pNode), nLevel); + break; + case SmNodeType::Text: + HandleText(pNode, nLevel); + break; + case SmNodeType::VerticalBrace: + HandleVerticalBrace(static_cast<const SmVerticalBraceNode*>(pNode), nLevel); + break; + case SmNodeType::Brace: + HandleBrace(static_cast<const SmBraceNode*>(pNode), nLevel); + break; + case SmNodeType::Oper: + HandleOperator(static_cast<const SmOperNode*>(pNode), nLevel); + break; + case SmNodeType::UnHor: + HandleUnaryOperation(static_cast<const SmUnHorNode*>(pNode), nLevel); + break; + case SmNodeType::BinHor: + HandleBinaryOperation(static_cast<const SmBinHorNode*>(pNode), nLevel); + break; + case SmNodeType::BinVer: + HandleFractions(pNode, nLevel, nullptr); + break; + case SmNodeType::Root: + HandleRoot(static_cast<const SmRootNode*>(pNode), nLevel); + break; + case SmNodeType::Special: + { + auto pText = static_cast<const SmTextNode*>(pNode); + //if the token str and the result text are the same then this + //is to be seen as text, else assume it's a mathchar + if (pText->GetText() == pText->GetToken().aText) + HandleText(pText, nLevel); + else + HandleMath(pText, nLevel); + break; + } + case SmNodeType::Math: + case SmNodeType::MathIdent: + HandleMath(pNode, nLevel); + break; + case SmNodeType::SubSup: + HandleSubSupScript(static_cast<const SmSubSupNode*>(pNode), nLevel); + break; + case SmNodeType::Expression: + HandleAllSubNodes(pNode, nLevel); + break; + case SmNodeType::Table: + //Root Node, PILE equivalent, i.e. vertical stack + HandleTable(pNode, nLevel); + break; + case SmNodeType::Matrix: + HandleMatrix(static_cast<const SmMatrixNode*>(pNode), nLevel); + break; + case SmNodeType::Line: + { + // TODO + HandleAllSubNodes(pNode, nLevel); + } break; - case SmNodeType::Line: - { -// TODO - HandleAllSubNodes(pNode, nLevel); - } - break; #if 0 case SmNodeType::Align: HandleMAlign(pNode,nLevel); break; #endif - case SmNodeType::Place: - // explicitly do nothing, MSOffice treats that as a placeholder if item is missing - break; - case SmNodeType::Blank: - HandleBlank(); - break; - default: - HandleAllSubNodes(pNode, nLevel); - break; + case SmNodeType::Place: + // explicitly do nothing, MSOffice treats that as a placeholder if item is missing + break; + case SmNodeType::Blank: + HandleBlank(); + break; + default: + HandleAllSubNodes(pNode, nLevel); + break; } } @@ -120,11 +121,9 @@ void SmWordExportBase::HandleTable(const SmNode* pNode, int nLevel) void SmWordExportBase::HandleAllSubNodes(const SmNode* pNode, int nLevel) { int size = pNode->GetNumSubNodes(); - for (int i = 0; - i < size; - ++i) + for (int i = 0; i < size; ++i) { -// TODO remove when all types of nodes are handled properly + // TODO remove when all types of nodes are handled properly if (pNode->GetSubNode(i) == nullptr) { SAL_WARN("starmath.wordbase", "Subnode is NULL, parent node not handled properly"); @@ -148,11 +147,11 @@ void SmWordExportBase::HandleBinaryOperation(const SmBinHorNode* pNode, int nLev // update HandleMath() when adding new items switch (pNode->Symbol()->GetToken().eType) { - case TDIVIDEBY: - return HandleFractions(pNode, nLevel, "lin"); - default: - HandleAllSubNodes(pNode, nLevel); - break; + case TDIVIDEBY: + return HandleFractions(pNode, nLevel, "lin"); + default: + HandleAllSubNodes(pNode, nLevel); + break; } } @@ -161,13 +160,13 @@ void SmWordExportBase::HandleMath(const SmNode* pNode, int nLevel) SAL_INFO("starmath.wordbase", "Math: " << int(pNode->GetToken().eType)); switch (pNode->GetToken().eType) { - case TDIVIDEBY: - case TACUTE: - OSL_ASSERT(false); - [[fallthrough]]; // the above are handled elsewhere, e.g. when handling BINHOR - default: - HandleText(pNode, nLevel); - break; + case TDIVIDEBY: + case TACUTE: + OSL_ASSERT(false); + [[fallthrough]]; // the above are handled elsewhere, e.g. when handling BINHOR + default: + HandleText(pNode, nLevel); + break; } } diff --git a/starmath/source/wordexportbase.hxx b/starmath/source/wordexportbase.hxx index b5b0d6853cbf..4f191df2aa4e 100644 --- a/starmath/source/wordexportbase.hxx +++ b/starmath/source/wordexportbase.hxx @@ -27,31 +27,31 @@ class SmVerticalBraceNode; class SmWordExportBase { public: - explicit SmWordExportBase( const SmNode* pIn ); + explicit SmWordExportBase(const SmNode* pIn); virtual ~SmWordExportBase(); + protected: - void HandleNode( const SmNode* pNode, int nLevel ); - void HandleAllSubNodes( const SmNode* pNode, int nLevel ); - void HandleTable( const SmNode* pNode, int nLevel ); - virtual void HandleVerticalStack( const SmNode* pNode, int nLevel ) = 0; - virtual void HandleText( const SmNode* pNode, int nLevel ) = 0; - void HandleMath( const SmNode* pNode, int nLevel ); - virtual void HandleFractions( const SmNode* pNode, int nLevel, const char* type ) = 0; - void HandleUnaryOperation( const SmUnHorNode* pNode, int nLevel ); - void HandleBinaryOperation( const SmBinHorNode* pNode, int nLevel ); - virtual void HandleRoot( const SmRootNode* pNode, int nLevel ) = 0; - virtual void HandleAttribute( const SmAttributNode* pNode, int nLevel ) = 0; - virtual void HandleOperator( const SmOperNode* pNode, int nLevel ) = 0; - void HandleSubSupScript( const SmSubSupNode* pNode, int nLevel ); - virtual void HandleSubSupScriptInternal( const SmSubSupNode* pNode, int nLevel, int flags ) = 0; - virtual void HandleMatrix( const SmMatrixNode* pNode, int nLevel ) = 0; - virtual void HandleBrace( const SmBraceNode* pNode, int nLevel ) = 0; - virtual void HandleVerticalBrace( const SmVerticalBraceNode* pNode, int nLevel ) = 0; + void HandleNode(const SmNode* pNode, int nLevel); + void HandleAllSubNodes(const SmNode* pNode, int nLevel); + void HandleTable(const SmNode* pNode, int nLevel); + virtual void HandleVerticalStack(const SmNode* pNode, int nLevel) = 0; + virtual void HandleText(const SmNode* pNode, int nLevel) = 0; + void HandleMath(const SmNode* pNode, int nLevel); + virtual void HandleFractions(const SmNode* pNode, int nLevel, const char* type) = 0; + void HandleUnaryOperation(const SmUnHorNode* pNode, int nLevel); + void HandleBinaryOperation(const SmBinHorNode* pNode, int nLevel); + virtual void HandleRoot(const SmRootNode* pNode, int nLevel) = 0; + virtual void HandleAttribute(const SmAttributNode* pNode, int nLevel) = 0; + virtual void HandleOperator(const SmOperNode* pNode, int nLevel) = 0; + void HandleSubSupScript(const SmSubSupNode* pNode, int nLevel); + virtual void HandleSubSupScriptInternal(const SmSubSupNode* pNode, int nLevel, int flags) = 0; + virtual void HandleMatrix(const SmMatrixNode* pNode, int nLevel) = 0; + virtual void HandleBrace(const SmBraceNode* pNode, int nLevel) = 0; + virtual void HandleVerticalBrace(const SmVerticalBraceNode* pNode, int nLevel) = 0; virtual void HandleBlank() = 0; const SmNode* const m_pTree; }; - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits