/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * 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/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #include #include #include #include #include using namespace ::com::sun::star::uno; using namespace ::com::sun::star::text; using namespace ::com::sun::star::beans; namespace oox::drawingml { TextBody::TextBody() : mbHasNoninheritedBodyProperties( false ) { } TextBody::TextBody( const TextBodyPtr& pBody ) : mbHasNoninheritedBodyProperties( false ) { if( pBody ) { maTextProperties = pBody->maTextProperties; maTextListStyle = pBody->maTextListStyle; } } TextParagraph& TextBody::addParagraph() { auto xPara = std::make_shared(); maParagraphs.push_back( xPara ); return *xPara; } void TextBody::insertAt( const ::oox::core::XmlFilterBase& rFilterBase, const Reference < XText > & xText, const Reference < XTextCursor > & xAt, const TextCharacterProperties& rTextStyleProperties, const TextListStylePtr& pMasterTextListStylePtr ) const { TextListStyle aMasterTextStyle(*pMasterTextListStylePtr); Reference xPropertySet(xAt, UNO_QUERY); float nCharHeight = xPropertySet->getPropertyValue("CharHeight").get(); size_t nIndex = 0; for (auto const& paragraph : maParagraphs) { paragraph->insertAt(rFilterBase, xText, xAt, rTextStyleProperties, aMasterTextStyle, maTextListStyle, (nIndex == 0), nCharHeight); ++nIndex; } } bool TextBody::isEmpty() const { if (maParagraphs.empty()) return true; if ( maParagraphs.size() > 1 ) return false; const TextRunVector& rRuns = maParagraphs[0]->getRuns(); if ( rRuns.empty() ) return true; if ( rRuns.size() > 1 ) return false; return rRuns[0]->getText().isEmpty(); } OUString TextBody::toString() const { if (!isEmpty()) { const TextRunVector& rRuns = maParagraphs.front()->getRuns(); if(!rRuns.empty()) return rRuns.front()->getText(); } return OUString(); } bool TextBody::hasVisualRunProperties() const { for ( auto& pTextParagraph : getParagraphs() ) { if ( pTextParagraph->hasVisualRunProperties() ) return true; } return false; } bool TextBody::hasParagraphProperties() const { for ( auto& pTextParagraph : getParagraphs() ) { if ( pTextParagraph->hasProperties() ) return true; } return false; } void TextBody::ApplyStyleEmpty( const ::oox::core::XmlFilterBase& rFilterBase, const Reference < XText > & xText, const TextCharacterProperties& rTextStyleProperties, const TextListStylePtr& pMasterTextListStylePtr) const { assert(isEmpty()); if (maParagraphs.empty()) return; // Apply character properties PropertySet aPropSet(xText); TextCharacterProperties aTextCharacterProps(maParagraphs[0]->getCharacterStyle( rTextStyleProperties, *pMasterTextListStylePtr, maTextListStyle)); aTextCharacterProps.pushToPropSet(aPropSet, rFilterBase); // Apply paragraph properties TextListStyle aCombinedTextStyle; aCombinedTextStyle.apply(*pMasterTextListStylePtr); aCombinedTextStyle.apply(maTextListStyle); TextParagraphProperties* pTextParagraphStyle = maParagraphs[0]->getParagraphStyle(aCombinedTextStyle); if (pTextParagraphStyle) { Reference< XPropertySet > xProps(xText, UNO_QUERY); PropertyMap aioBulletList; aioBulletList.setProperty< sal_Int32 >(PROP_LeftMargin, 0); // Init bullets left margin to 0 (no bullets). float nCharHeight = xProps->getPropertyValue("CharHeight").get(); TextParagraphProperties aParaProp; aParaProp.apply(*pTextParagraphStyle); aParaProp.pushToPropSet(&rFilterBase, xProps, aioBulletList, &pTextParagraphStyle->getBulletList(), true, nCharHeight, true); } } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ tion> LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Expand)Author
2024-11-10com::sun::star -> cssMike Kaganski
2024-03-23tdf#157664 Drop redundant operator != in basegfx moduleRMZeroFour
2024-01-21tdf#157664 Drop operator != where respective == is definedAkshayWarrier
2023-09-21tdf#146619 Recheck include/basegfx with IWYUGabor Kelemen
2023-05-18improved B2DHomMatrixNoel Grandin
2023-05-16tdf#63130 flatten the extra ImplMatLine into ImplHomMatrixTemplateNoel Grandin
2023-05-16simplify ImplMatLine constructorNoel Grandin
2023-05-16tdf#63130 make B2DHomMatrix a flat objectNoel Grandin
2022-06-21basegfx: extend basegfx::B2DHomMatrix::decompose() documentationMiklos Vajna
2022-05-27clang-tidy modernize-pass-by-value in basegfxNoel Grandin
2021-12-01improve the script for reducing symbol exportsNoel Grandin
2021-09-30loplugin:constmethod handle more casesNoel Grandin
2021-08-27clang-tidy:readability-redundant-member-initNoel Grandin
2020-05-12basegfx: simplify namespaces in ALL basegfx headersTomaž Vajngerl
2020-05-12use pragma once in include/basegfx headersTomaž Vajngerl
2020-03-30remove Matrix class from basegfx, convert B2DHomMatrix testsTomaž Vajngerl
2020-03-29basegfx: Fix the problem with Matrix Concatinate and TransformTomaž Vajngerl
2020-03-29basegfx: add convenience access. and creator to B2DHomMatrixTomaž Vajngerl
2020-03-29add convenience accessors to Matrix.hxxTomaž Vajngerl
2020-03-28svdpdf: move Matrix to basegfx just to get it separatedTomaž Vajngerl
2018-10-15tdf#42949 Fix IWYU warnings in include/basegfx/*Gabor Kelemen
2018-08-13Fix typosAndrea Gelmini
2018-05-04Removed executable permission on data filesAndrea Gelmini
2018-04-07SOSAW080: Added first bunch of basic changes to helpersArmin Le Grand
2018-04-06Revert "SOSAW080: Added first bunch of basic changes to helpers"Armin Le Grand
2018-04-06SOSAW080: Added first bunch of basic changes to helpersArmin Le Grand
2018-01-25loplugin:unused-returns in basegfx..cppcanvasNoel Grandin
2017-10-20RotGrfFlyFrame: Implemented Handle Update on rotation changeArmin Le Grand
2017-10-20RotGrfFlyFrame: Adapt Crop functionality to rotated GraphicArmin Le Grand
2017-10-04Revert "check for unnecessary DLLPUBLIC annotations"Stephan Bergmann
2017-09-29check for unnecessary DLLPUBLIC annotationsNoel Grandin
2017-09-26Rename the basegfx::tools namespace to basegfx::utilsTor Lillqvist
2017-09-15borderline: Preparing further to use CellCoordinateSystemArmin Le Grand
2017-04-28Printing of some more basegfx typesStephan Bergmann
2017-01-31more SAL_WARN_UNUSEDNoel Grandin
2016-09-13Remove nonsense comments: // bitfieldTor Lillqvist
2016-08-29cid#1371223 Missing move assignment operatorNoel Grandin
2016-08-25cid#1371285 Missing move assignment operatorNoel Grandin
2016-05-06Refactor 3D renderer to use multithreadingArmin Le Grand
2016-02-09Remove excess newlinesChris Sherlock
2015-10-27loplugin:unusedmethodsNoel Grandin
2015-07-06loplugin:unusedmethods sax,shell,stoc,basegfxNoel Grandin
2015-07-03Revert "loplugin:unusedmethods sax,shell,stoc,basegfx"Michael Stahl
2015-07-03loplugin:unusedmethods sax,shell,stoc,basegfxNoel Grandin
2015-03-04V813: Decreased performanceCaolán McNamara
2014-03-01Remove visual noise from includeAlexander Wilms