/* -*- 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 "progressbar.hxx" #include #include #include #include #include #include #include #include using namespace ::cppu ; using namespace ::osl ; using namespace ::rtl ; using namespace ::com::sun::star::uno ; using namespace ::com::sun::star::lang ; using namespace ::com::sun::star::awt ; namespace unocontrols{ //____________________________________________________________________________________________________________ // construct/destruct //____________________________________________________________________________________________________________ ProgressBar::ProgressBar( const Reference< XMultiServiceFactory >& xFactory ) : BaseControl ( xFactory ) , m_bHorizontal ( PROGRESSBAR_DEFAULT_HORIZONTAL ) , m_aBlockSize ( PROGRESSBAR_DEFAULT_BLOCKDIMENSION ) , m_nForegroundColor ( PROGRESSBAR_DEFAULT_FOREGROUNDCOLOR ) , m_nBackgroundColor ( PROGRESSBAR_DEFAULT_BACKGROUNDCOLOR ) , m_nMinRange ( PROGRESSBAR_DEFAULT_MINRANGE ) , m_nMaxRange ( PROGRESSBAR_DEFAULT_MAXRANGE ) , m_nBlockValue ( PROGRESSBAR_DEFAULT_BLOCKVALUE ) , m_nValue ( PROGRESSBAR_DEFAULT_VALUE ) { } ProgressBar::~ProgressBar() { } //____________________________________________________________________________________________________________ // XInterface //____________________________________________________________________________________________________________ Any SAL_CALL ProgressBar::queryInterface( const Type& rType ) throw( RuntimeException ) { // Attention: // Don't use mutex or guard in this method!!! Is a method of XInterface. Any aReturn ; Reference< XInterface > xDel = BaseControl::impl_getDelegator(); if ( xDel.is() ) { // If an delegator exist, forward question to his queryInterface. // Delegator will ask his own queryAggregation! aReturn = xDel->queryInterface( rType ); } else { // If an delegator unknown, forward question to own queryAggregation. aReturn = queryAggregation( rType ); } return aReturn ; } //____________________________________________________________________________________________________________ // XInterface //____________________________________________________________________________________________________________ void SAL_CALL ProgressBar::acquire() throw() { // Attention: // Don't use mutex or guard in this method!!! Is a method of XInterface. // Forward to baseclass BaseControl::acquire(); } //____________________________________________________________________________________________________________ // XInterface //____________________________________________________________________________________________________________ void SAL_CALL ProgressBar::release() throw() { // Attention: // Don't use mutex or guard in this method!!! Is a method of XInterface. // Forward to baseclass BaseControl::release(); } //____________________________________________________________________________________________________________ // XTypeProvider //____________________________________________________________________________________________________________ Sequence< Type > SAL_CALL ProgressBar::getTypes() throw( RuntimeException ) { // Optimize this method ! // We initialize a static variable only one time. And we don't must use a mutex at every call! // For the first call; pTypeCollection is NULL - for the second call pTypeCollection is different from NULL! static OTypeCollection* pTypeCollection = NULL ; if ( pTypeCollection == NULL ) { // Ready for multithreading; get global mutex for first call of this method only! see before MutexGuard aGuard( Mutex::getGlobalMutex() ); // Control these pointer again ... it can be, that another instance will be faster then these! if ( pTypeCollection == NULL ) { // Create a static typecollection ... static OTypeCollection aTypeCollection ( ::getCppuType(( const Reference< XControlModel >*) NULL ) , ::getCppuType(( const Reference< XProgressBar >*) NULL ) , BaseControl::getTypes() ); // ... and set his address to static pointer! pTypeCollection = &aTypeCollection ; } } return pTypeCollection->getTypes(); } //____________________________________________________________________________________________________________ // XAggregation //____________________________________________________________________________________________________________ Any SAL_CALL ProgressBar::queryAggregation( const Type& aType ) throw( RuntimeException ) { // Ask for my own supported interfaces ... // Attention: XTypeProvider and XInterface are supported by OComponentHelper! Any aReturn ( ::cppu::queryInterface( aType , static_cast< XControlModel* > ( this ) , static_cast< XProgressBar* > ( this ) ) ); // If searched interface not supported by this class ... if ( aReturn.hasValue() == sal_False ) { // ... ask baseclasses. aReturn = BaseControl::queryAggregation( aType ); } return aReturn ; } //____________________________________________________________________________________________________________ // XProgressBar //____________________________________________________________________________________________________________ void SAL_CALL ProgressBar::setForegroundColor( sal_Int32 nColor ) throw( RuntimeException ) { // Ready for multithreading MutexGuard aGuard (m_aMutex) ; // Safe color for later use. m_nForegroundColor = nColor ; // Repaint control impl_paint ( 0, 0, impl_getGraphicsPeer() ) ; } //____________________________________________________________________________________________________________ // XProgressBar //____________________________________________________________________________________________________________ void SAL_CALL ProgressBar::setBackgroundColor ( sal_Int32 nColor ) throw( RuntimeException ) { // Ready for multithreading MutexGuard aGuard (m_aMutex) ; // Safe color for later use. m_nBackgroundColor = nColor ; // Repaint control impl_paint ( 0, 0, impl_getGraphicsPeer() ) ; } //____________________________________________________________________________________________________________ // XProgressBar //____________________________________________________________________________________________________________ void SAL_CALL ProgressBar::setValue ( sal_Int32 nValue ) throw( RuntimeException ) { // This method is defined for follow things: // 1) Values >= _nMinRange // 2) Values <= _nMaxRange // Ready for multithreading MutexGuard aGuard (m_aMutex) ; // save impossible cases // This method is only defined for valid values DBG_ASSERT ( (( nValue >= m_nMinRange ) && ( nValue <= m_nMaxRange )), "ProgressBar::setValue()\nNot valid value.\n" ) ; // If new value not valid ... do nothing in release version! if ( ( nValue >= m_nMinRange ) && ( nValue <= m_nMaxRange ) ) { // New value is ok => save this m_nValue = nValue ; // Repaint to display changes impl_paint ( 0, 0, impl_getGraphicsPeer() ) ; } } //____________________________________________________________________________________________________________ // XProgressBar //____________________________________________________________________________________________________________ void SAL_CALL ProgressBar::setRange ( sal_Int32 nMin, sal_Int32 nMax ) throw( RuntimeException ) { // This method is defined for follow things: // 1) All values of sal_Int32 // 2) Min < Max // 3) Min > Max // save impossible cases // This method is only defined for valid values // If you ignore this, the release version wil produce an error "division by zero" in "ProgressBar::setValue()"! DBG_ASSERT ( ( nMin != nMax ) , "ProgressBar::setRange()\nValues for MIN and MAX are the same. This is not allowed!\n" ) ; // Ready for multithreading MutexGuard aGuard (m_aMutex) ; // control the values for min and max if ( nMin < nMax ) { // Take correct Min and Max m_nMinRange = nMin ; m_nMaxRange = nMax ; } else { // Change Min and Max automaticly m_nMinRange = nMax ; m_nMaxRange = nMin ; } // assure that m_nValue is within the range if (!(m_nMinRange < m_nValue && m_nValue < m_nMaxRange)) m_nValue = m_nMinRange; impl_recalcRange () ; // Do not repaint the control at this place!!! // An old "m_nValue" is set and can not be correct for this new range. // Next call of "ProgressBar::setValue()" do this. } //____________________________________________________________________________________________________________ // XProgressBar //____________________________________________________________________________________________________________ sal_Int32 SAL_CALL ProgressBar::getValue () throw( RuntimeException ) { // Ready for multithreading MutexGuard aGuard (m_aMutex) ; return ( m_nValue ) ; } //____________________________________________________________________________________________________________ // XWindow //____________________________________________________________________________________________________________ void SAL_CALL ProgressBar::setPosSize ( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int16 nFlags ) throw( RuntimeException ) { // Take old size BEFORE you set the new values at baseclass! // You will control changes. At the other way, the values are the same! Rectangle aBasePosSize = getPosSize () ; BaseControl::setPosSize (nX, nY, nWidth, nHeight, nFlags) ; // Do only, if size has changed. if ( ( nWidth != aBasePosSize.Width ) || ( nHeight != aBasePosSize.Height ) ) { impl_recalcRange ( ) ; impl_paint ( 0, 0, impl_getGraphicsPeer () ) ; } } //____________________________________________________________________________________________________________ // XControl //____________________________________________________________________________________________________________ sal_Bool SAL_CALL ProgressBar::setModel( const Reference< XControlModel >& /*xModel*/ ) throw( RuntimeException ) { // A model is not possible for this control. return sal_False ; } //____________________________________________________________________________________________________________ // XControl //____________________________________________________________________________________________________________ Reference< XControlModel > SAL_CALL ProgressBar::getModel() throw( RuntimeException ) { // A model is not possible for this control. return Reference< XControlModel >(); } //____________________________________________________________________________________________________________ // impl but public method to register service //____________________________________________________________________________________________________________ const Sequence< OUString > ProgressBar::impl_getStaticSupportedServiceNames() { MutexGuard aGuard( Mutex::getGlobalMutex() ); Sequence< OUString > seqServiceNames( 1 ); seqServiceNames.getArray() [0] = SERVICENAME_PROGRESSBAR; return seqServiceNames ; } //____________________________________________________________________________________________________________ // impl but public method to register service //____________________________________________________________________________________________________________ const OUString ProgressBar::impl_getStaticImplementationName() { return OUString(IMPLEMENTATIONNAME_PROGRESSBAR ); } //____________________________________________________________________________________________________________ // protected method //____________________________________________________________________________________________________________ void ProgressBar::impl_paint ( sal_Int32 nX, sal_Int32 nY, const Reference< XGraphics > & rGraphics ) { // save impossible cases DBG_ASSERT ( rGraphics.is(), "ProgressBar::paint()\nCalled with invalid Reference< XGraphics > ." ) ; // This paint method ist not buffered !! // Every request paint the completely control. ( but only, if peer exist ) if ( rGraphics.is () ) { MutexGuard aGuard (m_aMutex) ; // Clear background // (same color for line and fill) rGraphics->setFillColor ( m_nBackgroundColor ) ; rGraphics->setLineColor ( m_nBackgroundColor ) ; rGraphics->drawRect ( nX, nY, impl_getWidth(), impl_getHeight() ) ; // same color for line and fill for blocks rGraphics->setFillColor ( m_nForegroundColor ) ; rGraphics->setLineColor ( m_nForegroundColor ) ; sal_Int32 nBlockStart = 0 ; // = left site of new block sal_Int32 nBlockCount = m_nBlockValue!=0.00 ? (sal_Int32)((m_nValue-m_nMinRange)/m_nBlockValue) : 0 ; // = number of next block // Draw horizontal progressbar // decision in "recalcRange()" if (m_bHorizontal) { // Step to left side of window nBlockStart = nX ; for ( sal_Int16 i=1; i<=nBlockCount; ++i ) { // step free field nBlockStart += PROGRESSBAR_FREESPACE ; // paint block rGraphics->drawRect (nBlockStart, nY+PROGRESSBAR_FREESPACE, m_aBlockSize.Width, m_aBlockSize.Height) ; // step next free field nBlockStart += m_aBlockSize.Width ; } } // draw vertikal progressbar // decision in "recalcRange()" else { // step to bottom side of window nBlockStart = nY+impl_getHeight() ; nBlockStart -= m_aBlockSize.Height ; for ( sal_Int16 i=1; i<=nBlockCount; ++i ) { // step free field nBlockStart -= PROGRESSBAR_FREESPACE ; // paint block rGraphics->drawRect (nX+PROGRESSBAR_FREESPACE, nBlockStart, m_aBlockSize.Width, m_aBlockSize.Height) ; // step next free field nBlockStart -= m_aBlockSize.Height; } } // Paint shadow border around the progressbar rGraphics->setLineColor ( PROGRESSBAR_LINECOLOR_SHADOW ) ; rGraphics->drawLine ( nX, nY, impl_getWidth(), nY ) ; rGraphics->drawLine ( nX, nY, nX , impl_getHeight() ) ; rGraphics->setLineColor ( PROGRESSBAR_LINECOLOR_BRIGHT ) ; rGraphics->drawLine ( impl_getWidth()-1, impl_getHeight()-1, impl_getWidth()-1, nY ) ; rGraphics->drawLine ( impl_getWidth()-1, impl_getHeight()-1, nX , impl_getHeight()-1 ) ; } } //____________________________________________________________________________________________________________ // protected method //____________________________________________________________________________________________________________ void ProgressBar::impl_recalcRange () { MutexGuard aGuard (m_aMutex) ; sal_Int32 nWindowWidth = impl_getWidth() ; sal_Int32 nWindowHeight = impl_getHeight() ; double fBlockHeight ; double fBlockWidth ; double fMaxBlocks ; if( nWindowWidth > nWindowHeight ) { m_bHorizontal = sal_True ; fBlockHeight = (nWindowHeight-(2*PROGRESSBAR_FREESPACE)) ; fBlockWidth = fBlockHeight ; fMaxBlocks = nWindowWidth/(fBlockWidth+PROGRESSBAR_FREESPACE); } else { m_bHorizontal = sal_False ; fBlockWidth = (nWindowWidth-(2*PROGRESSBAR_FREESPACE)) ; fBlockHeight = fBlockWidth ; fMaxBlocks = nWindowHeight/(fBlockHeight+PROGRESSBAR_FREESPACE); } double fRange = m_nMaxRange-m_nMinRange ; double fBlockValue = fRange/fMaxBlocks ; m_nBlockValue = fBlockValue ; m_aBlockSize.Height = (sal_Int32)fBlockHeight; m_aBlockSize.Width = (sal_Int32)fBlockWidth ; } } // namespace unocontrols /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ round-color LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2024-11-27sc: use SAL_RET_MAYBENULL in GetDocument()Xisco Fauli
mpDoc can be nullptr while at it, prefix it as a member Change-Id: I48233bc4bfcd87a382e29ba9b9ee053612ba6bd8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177258 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Tested-by: Jenkins
2023-12-30move IsFuzzing to comphelperCaolán McNamara
and try something a bit more generic Change-Id: I1d8256576cd02f0a589df350ba7b53059dd586a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161250 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-11-24use more concrete UNO in scNoel Grandin
Change-Id: Id486b94464bfa49ed471bcb825acee7bddeacb8c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159873 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-11-08Related: tdf#124098: sc import, more optimization for row heightsBalazs Varga
follow-up for: e8fae4d0fb2994a7b4ac00e9da35e1deccb296dd (tdf#124098: sc, ods import: do not recalculate row heights) Change-Id: Id80c0c6bfbc437f8b2a480c590e407e84b5d7b64 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142376 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com>
2022-10-13tdf#124098: sc, ods import: do not recalculate row heightsBalazs Varga
if we have already optimal heights in the xml, because it is not necessary and it takes a lot of time loading a file. Citing here for completeness: a) if there is no height attribute and the "use_optimal-row-height" attribute is set then calculate the row height b) if there is a height attribute just use it and do not recalculate. Maybe TODO for later: optimize row height calculation more in sc Change-Id: I9d964aad744970e5d36f239c0ce39ce98c00f273 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141204 Tested-by: Jenkins Tested-by: Balazs Varga <balazs.varga.extern@allotropia.de> Reviewed-by: Balazs Varga <balazs.varga.extern@allotropia.de>
2022-05-04Just use Any ctor instead of makeAny in scStephan Bergmann
Change-Id: I5c2363ff03ae02274f3c334cc262977c834950d5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133788 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-09-15Use <comphelper/servicehelper.hxx> implementing XUnoTunnel part 1Mike Kaganski
The header got some changes: 1. Move UnoTunnelIdInit and isUnoTunnelId into 'comphelper' namespace 2. Rename UnoTunnelIdInit to UnoIdInit, as a precondition to replace of uses of OImplementationId with it, including in XTypeProvider 3. Introduce convenience functions 'getSomething_cast' to cast between sal_Int64 and object pointers uniformly. 4. Rename getUnoTunnelImplementation to getFromUnoTunnel, both to make it a bit shorter, and to reflect its function better. Templatize it to take also css::uno::Any for convenience. 5. Introduce getSomethingImpl, inspired by sw::UnoTunnelImpl; allow it handle cases both with and without fallback to parent. 6. Adjust UNO3_GETIMPLEMENTATION_* macros TODO (in separate commits): - Drop sw::UnoTunnelImpl and sw::UnoTunnelGetImplementation - Replace all uses of OImplementationId in core with UnoIdInit - Deprecate OImplementationId in <cppuhelper/typeprovider.hxx> - Change implementations of getSomething to use getSomethingImpl - Revise uses of getSomething to use getFromUnoTunnel Change-Id: If4a3cb024130f1f552f988f0479589da1cd066e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122022 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-08-02convert #defines to OUStringLiteralNoel Grandin
mostly by doing $ git grep -l '#define.*\"' -- *.cxx | xargs perl -pi -e 's/^#define\s+(\w+)\s+(\".*\")/constexpr OUStringLiteral \1 = u\2;/g' Change-Id: I7467f9067085ac89b98a0398811396c448339b4a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119840 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-02-08ofz#27846 restrict number-rows-repeated when fuzzingCaolán McNamara
to avoid uninteresting timeouts Change-Id: I20876b10589558a4431433ffd04668b17aea16cb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110518 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-09-09sc: rowcol: convert more use of MAXROWCOUNTNoel Grandin
this is part of the very large(jumbo) sheet work Change-Id: Ia5c1246e908d3c81d7ec7eff39a3580d5362969c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94889 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-08-14rename xmlnmspe -> xmlnamespaceNoel Grandin
Change-Id: I8fdf9833dede6f4c9ba4bbb76b9ab9b6b419f155 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100722 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-07-29loplugin:flatten in sc/filter/xmlNoel Grandin
Change-Id: I93117f601a8f450ebfcde32c156802137b87da76 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99701 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-04-28move the castToFastAttributeList functionNoel Grandin
to the slightly higher namespace, to make it easy and more readable to use directly in a for-loop-range expression. And make it return a reference rather than a pointer, since it is never allowed to be nullptr. Change-Id: I15d0b32493ef65cfc601b247c272b318f1eadfd8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93049 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-02-15convert XML_STYLE_FAMILY to scoped enumNoel Grandin
Change-Id: I5335b0190a2f5a8111993c0c9c224c8a6a8f0cfb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88723 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-01-07extract some common code from ImportContext classesNoel Grandin
which reduces code bloat, and lets us log when elements are ignored Change-Id: I5ca12bc1fcbfa3bea49ebde819fd80bd233a96a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86338 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-11-25sc: rowcol: tdf#50916 convert segmenttreeNoel Grandin
Change-Id: Ia05d1bc60a76a8bbf65afe5b0459ce213be9bfbe Reviewed-on: https://gerrit.libreoffice.org/83646 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-31sc: rowcol: tdf#50916 convert filter/*Aron Budea
filter/excel has not been touched here Change-Id: I2ee15c0899157603ce0005a77b768cddf890261a Reviewed-on: https://gerrit.libreoffice.org/81739 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-08-23loplugin:returnconstval in saxNoel Grandin
Change-Id: Icf5c337164b71aab10dd960815eee516822c276c Reviewed-on: https://gerrit.libreoffice.org/77990 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-06-18tdf#39593 Remove ScModelObj::getImplementationArkadiy Illarionov
Replace with comphelper::getUnoTunnelImplementation. Change-Id: I06a8db37b5c5c38c52a15a76e6e2df3b431a2040 Reviewed-on: https://gerrit.libreoffice.org/74237 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-03-26flatten TabRangesNoel Grandin
no need to declare this separately, saves one pointer hop Change-Id: I14fd82a9448c43ddfa0b6179a3b79cf6d364130d Reviewed-on: https://gerrit.libreoffice.org/69687 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-01-10tdf#42949 Fix IWYU warnings in sc/source/filter/xml/*cxxGabor Kelemen
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: I39b7da64f92520f1fb583b2a2f038955e5de2f24 Reviewed-on: https://gerrit.libreoffice.org/65690 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2018-11-29tdf#42949 Fix IWYU warnings in include/vcl/[i-m]*Gabor Kelemen
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: If1b2e04872eb0dd6725802c1709a9085f4cd8c91 Reviewed-on: https://gerrit.libreoffice.org/64141 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2018-06-08tdf#62268: allow row height recalculation on document loadVasily Melenchuk
During document load rows with style:use-optimal-row-height="true" should recalculate it's height. Change-Id: Ib38b5b753d9ff8352116d77851d228c5d77bd530 Reviewed-on: https://gerrit.libreoffice.org/52521 Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de> Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2018-01-12More loplugin:cstylecast: scStephan Bergmann
auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable loplugin:cstylecast for some more cases" plus solenv/clang-format/reformat-formatted-files Change-Id: I987ac3a6d062600a5e21c3462c70595dfaa51796
2017-10-23loplugin:includeform: scStephan Bergmann
Change-Id: I2ed763e0584a188032c80fde60890de3c6985cbd
2017-08-30Refactoring fastcontexts code:Mohammed Abdul Azeem
Moved all the casts inside ::createFastChildContext and used reference to it as an argument in the constructors. This avoids spreading the cast statements all over the place. Also removed some of the empty createFastChildContext(), they are unnecessary as the parent class already has it. Change-Id: I344ede732a53878a7e265c0178b07d73b5398237 Reviewed-on: https://gerrit.libreoffice.org/41178 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2017-07-11Helper function to cast to FastAttributeList:Mohammed Abdul Azeem
Refactoring codes that cast XFastAttributeList reference to FastAttributeList pointer using the helper function. Change-Id: Iecf4b815d6556b0992d638b633260fbd459c0dc4 Reviewed-on: https://gerrit.libreoffice.org/39723 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2017-07-10Adding an overloaded IsXMLToken method:Mohammed Abdul Azeem
Passing FastAttributeIter to the method makes the code much cleaner and easy to read. Change-Id: I227e9dc378dfba51168c29452667576a779dc215 Reviewed-on: https://gerrit.libreoffice.org/39730 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2017-06-29Added find function to FastAttributeList:Mohammed Abdul Azeem
It returns a FastAttributeIter, which can be used to obtain value in different formats directly. Also, avoids one unnecessary iteration. Change-Id: Ic28e0177100738bbd71a3a89634cae9f1f7ee996 Reviewed-on: https://gerrit.libreoffice.org/39380 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2017-06-29Using range-for instead of iterator loop:Mohammed Abdul Azeem
It's much easier to write and looks cleaner. And this doesn't affect performance, I think. Change-Id: Ia946b068979b9cef04ac2479c9179a70b6775dea Reviewed-on: https://gerrit.libreoffice.org/39370 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mohammed Abdul Azeem <azeemmysore@gmail.com>
2017-06-27Using fast tokens directly:Mohammed Abdul Azeem
Replacing integer-to-integer mapped tokens with fast Tokens direcly for branching. Adding a macro XML_ELEMENT that combines namespace and element tokens. Change-Id: I8701c8af9607392843460fe726bffb6556cf9b33 Reviewed-on: https://gerrit.libreoffice.org/39275 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2017-05-10loplugin:checkunusedparams in sc(part3)Noel Grandin
Change-Id: I61fc2ba762983d7bafb6ed8baafba458590af59a Reviewed-on: https://gerrit.libreoffice.org/37458 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-04-06Improved loplugin:redundantcast, static_cast on arithmetic types: scStephan Bergmann
Change-Id: Id56d3e3d7c4485e24dc8fe6349631837101e86fe
2017-02-08Adding an iterator for fastattributes:Mohammed Abdul Azeem
This helps to avoid the expensive allocation and freeing of OUString at some places. Change-Id: I7d49974ce13799fcf62b989ce5d3c61b01316190 Reviewed-on: https://gerrit.libreoffice.org/34011 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com>
2017-01-26Remove dynamic exception specificationsStephan Bergmann
...(for now, from LIBO_INTERNAL_CODE only). See the mail thread starting at <https://lists.freedesktop.org/archives/libreoffice/2017-January/076665.html> "Dynamic Exception Specifications" for details. Most changes have been done automatically by the rewriting loplugin:dynexcspec (after enabling the rewriting mode, to be committed shortly). The way it only removes exception specs from declarations if it also sees a definition, it identified some dead declarations-w/o-definitions (that have been removed manually) and some cases where a definition appeared in multiple include files (which have also been cleaned up manually). There's also been cases of macro paramters (that were used to abstract over exception specs) that have become unused now (and been removed). Furthermore, some code needed to be cleaned up manually (avmedia/source/quicktime/ and connectivity/source/drivers/kab/), as I had no configurations available that would actually build that code. Missing @throws documentation has not been applied in such manual clean-up. Change-Id: I3408691256c9b0c12bc5332de976743626e13960 Reviewed-on: https://gerrit.libreoffice.org/33574 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-01-25ScXMLTableRowCellContext implements fast interfaces:Mohammed Abdul Azeem
Implementation of fast interfaces for contexts in path from ScXMLImport::CreateFastContext to ScXMLTableRowCellContext. FastParser is enabled and duplicates are avoided at all possible places. OOoXML filters still need those legacy paths we removed, so I had to temporarily map them to fast elements, which would increase their load time, but hopefully it should help us in the long run. Change-Id: Ie997a9a8b72787da2356abc99ea2cd57c2e5b670 Reviewed-on: https://gerrit.libreoffice.org/28648 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com>
2016-11-19tdf#48140 Remove not used UNO headers from filtersBartosz Kosiorek
Change-Id: I66e775b60343fe8ac772d8c0287ca19be58a7236 Reviewed-on: https://gerrit.libreoffice.org/30966 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
2016-11-07inherit from ScXMLImportContextNoel Grandin
and drop a bunch of redundant code Change-Id: I187273ad9eebeaf2446e09b2e3442e963d8ae4f4 Reviewed-on: https://gerrit.libreoffice.org/30568 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-02-15tdf#94858, avoid O(n^2) algorithm during outline importMarkus Mohrhard
The old code set called the outline visibility code for each row. Now we are just calling it once at the end of the import. Change-Id: Ie19f8bd538495cb50a7618156aed8de832885c2a Reviewed-on: https://gerrit.libreoffice.org/22239 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
2015-11-10loplugin:nullptr (automatic rewrite)Stephan Bergmann
Change-Id: I765d2a600f9c57da50c85354688e3ae796750d94
2015-11-04loplugin:stringconstantNoel Grandin
Change-Id: I9d3b60bb9f0d8c09968e2be1035fb8e654ac9c95 Reviewed-on: https://gerrit.libreoffice.org/19769 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2015-10-28com::sun::star->css in scNoel Grandin
Change-Id: I7774890f46f9343e944e34db27af8bce3b1d0915
2015-08-14loplugin: defaultparamsNoel Grandin
Change-Id: Id5cdb8516db9e9017de06c3ab6e25f272c945677