diff options
author | Tamas Bunth <tamas.bunth@collabora.co.uk> | 2017-06-24 16:05:16 +0200 |
---|---|---|
committer | Tamás Bunth <btomi96@gmail.com> | 2017-06-27 09:15:53 +0200 |
commit | a08c833a5d61ba806fe2875e7b84fd11b9856b58 (patch) | |
tree | d4b2b71d856ff063264237f40a57b9ccb5d9ab28 /sc | |
parent | 99cde7238ec2e7c961f62e8353f2266f11fea0ce (diff) |
Use base class to set/get super/sub script
Looks like some obsolete code
Change-Id: If600609ccd0baf3c10261cc850ac5ddc3c046401
Reviewed-on: https://gerrit.libreoffice.org/39216
Reviewed-by: Tamás Bunth <btomi96@gmail.com>
Tested-by: Tamás Bunth <btomi96@gmail.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/vba/vbafont.cxx | 159 | ||||
-rw-r--r-- | sc/source/ui/vba/vbafont.hxx | 4 |
2 files changed, 0 insertions, 163 deletions
diff --git a/sc/source/ui/vba/vbafont.cxx b/sc/source/ui/vba/vbafont.cxx index 369d95ee0375..da38074e316d 100644 --- a/sc/source/ui/vba/vbafont.cxx +++ b/sc/source/ui/vba/vbafont.cxx @@ -58,165 +58,6 @@ ScVbaFont::~ScVbaFont() { } -/// @throws css::uno::RuntimeException -static uno::Reference< beans::XPropertySet > lcl_TextProperties( uno::Reference< table::XCell >& xIf ) -{ - uno::Reference< text::XTextRange > xTxtRange( xIf, uno::UNO_QUERY_THROW ); - uno::Reference< text::XSimpleText > xTxt( xTxtRange->getText(), uno::UNO_QUERY_THROW ) ; - uno::Reference< beans::XPropertySet > xProps( xTxt->createTextCursor(), uno::UNO_QUERY_THROW ); - return xProps; -} -void SAL_CALL -ScVbaFont::setSuperscript( const uno::Any& aValue ) -{ - // #FIXEME create some sort of generic get/set code where - // you can pass a functor - // get/set - Super/sub script code is exactly the same - // except for the call applied at each cell position - uno::Reference< table::XCell> xCell( mxFont, uno::UNO_QUERY ); - uno::Reference< table::XCellRange > xCellRange( mxFont, uno::UNO_QUERY ); - if ( !xCell.is() ) - { - uno::Reference< table::XColumnRowRange > xColumnRowRange(xCellRange, uno::UNO_QUERY_THROW ); - sal_Int32 nCols = xColumnRowRange->getColumns()->getCount(); - sal_Int32 nRows = xColumnRowRange->getRows()->getCount(); - for ( sal_Int32 col = 0; col < nCols; ++col ) - { - for ( sal_Int32 row = 0; row < nRows; ++row ) - { - uno::Reference< beans::XPropertySet > xProps( xCellRange->getCellByPosition( col, row ) , uno::UNO_QUERY_THROW ); - rtl::Reference< ScVbaFont > aFont( new ScVbaFont( getParent(), mxContext, mPalette, xProps ) ); - aFont->setSuperscript( aValue ); - } - } - return; - - } - xCell.set( xCellRange->getCellByPosition( 0,0 ) ); - - uno::Reference< beans::XPropertySet > xProps = lcl_TextProperties( xCell ); - bool bValue = false; - aValue >>= bValue; - sal_Int16 nValue = NORMAL; - sal_Int8 nValue2 = NORMALHEIGHT; - - if( bValue ) - { - nValue = SUPERSCRIPT; - nValue2 = SUPERSCRIPTHEIGHT; - } - xProps->setPropertyValue("CharEscapement", uno::Any(nValue) ); - xProps->setPropertyValue("CharEscapementHeight", uno::Any(nValue2) ); -} - -uno::Any SAL_CALL -ScVbaFont::getSuperscript() -{ - uno::Reference< table::XCell> xCell( mxFont, uno::UNO_QUERY ); - uno::Reference< table::XCellRange > xCellRange( mxFont, uno::UNO_QUERY ); - if ( !xCell.is() ) - { - uno::Reference< table::XColumnRowRange > xColumnRowRange(xCellRange, uno::UNO_QUERY_THROW ); - sal_Int32 nCols = xColumnRowRange->getColumns()->getCount(); - sal_Int32 nRows = xColumnRowRange->getRows()->getCount(); - uno::Any aRes; - for ( sal_Int32 col = 0; col < nCols; ++col ) - { - for ( sal_Int32 row = 0; row < nRows; ++row ) - { - uno::Reference< beans::XPropertySet > xProps( xCellRange->getCellByPosition( col, row ), uno::UNO_QUERY_THROW ); - rtl::Reference< ScVbaFont > aFont( new ScVbaFont( getParent(), mxContext, mPalette, xProps ) ); - if ( !col && !row ) - aRes = aFont->getSuperscript(); - else if ( aRes != aFont->getSuperscript() ) - return aNULL(); - } - } - return aRes; - - } - xCell.set( xCellRange->getCellByPosition( 0,0 ) ); - uno::Reference< beans::XPropertySet > xProps = lcl_TextProperties( xCell ); - short nValue = 0; - xProps->getPropertyValue("CharEscapement") >>= nValue; - return uno::makeAny( ( nValue == SUPERSCRIPT ) ); -} - -void SAL_CALL -ScVbaFont::setSubscript( const uno::Any& aValue ) -{ - uno::Reference< table::XCell> xCell( mxFont, uno::UNO_QUERY ); - uno::Reference< table::XCellRange > xCellRange( mxFont, uno::UNO_QUERY ); - if ( !xCell.is() ) - { - uno::Reference< table::XColumnRowRange > xColumnRowRange(xCellRange, uno::UNO_QUERY_THROW ); - sal_Int32 nCols = xColumnRowRange->getColumns()->getCount(); - sal_Int32 nRows = xColumnRowRange->getRows()->getCount(); - for ( sal_Int32 col = 0; col < nCols; ++col ) - { - for ( sal_Int32 row = 0; row < nRows; ++row ) - { - uno::Reference< beans::XPropertySet > xProps( xCellRange->getCellByPosition( col, row ) , uno::UNO_QUERY_THROW ); - rtl::Reference< ScVbaFont > aFont( new ScVbaFont( getParent(), mxContext, mPalette, xProps ) ); - aFont->setSubscript( aValue ); - } - } - return; - - } - xCell.set( xCellRange->getCellByPosition( 0,0 ) ); - uno::Reference< beans::XPropertySet > xProps = lcl_TextProperties( xCell ); - - bool bValue = false; - aValue >>= bValue; - sal_Int16 nValue = NORMAL; - sal_Int8 nValue2 = NORMALHEIGHT; - - if( bValue ) - { - nValue= SUBSCRIPT; - nValue2 = SUBSCRIPTHEIGHT; - } - - xProps->setPropertyValue("CharEscapementHeight", uno::Any(nValue2) ); - xProps->setPropertyValue("CharEscapement", uno::Any(nValue) ); - -} - -uno::Any SAL_CALL -ScVbaFont::getSubscript() -{ - uno::Reference< table::XCell> xCell( mxFont, uno::UNO_QUERY ); - uno::Reference< table::XCellRange > xCellRange( mxFont, uno::UNO_QUERY ); - if ( !xCell.is() ) - { - uno::Reference< table::XColumnRowRange > xColumnRowRange(xCellRange, uno::UNO_QUERY_THROW ); - sal_Int32 nCols = xColumnRowRange->getColumns()->getCount(); - sal_Int32 nRows = xColumnRowRange->getRows()->getCount(); - uno::Any aRes; - for ( sal_Int32 col = 0; col < nCols; ++col ) - { - for ( sal_Int32 row = 0; row < nRows; ++row ) - { - uno::Reference< beans::XPropertySet > xProps( xCellRange->getCellByPosition( col, row ), uno::UNO_QUERY_THROW ); - rtl::Reference< ScVbaFont > aFont( new ScVbaFont( getParent(), mxContext, mPalette, xProps ) ); - if ( !col && !row ) - aRes = aFont->getSubscript(); - else if ( aRes != aFont->getSubscript() ) - return aNULL(); - } - } - return aRes; - - } - xCell.set( xCellRange->getCellByPosition( 0,0 ) ); - uno::Reference< beans::XPropertySet > xProps = lcl_TextProperties( xCell ); - - short nValue = NORMAL; - xProps->getPropertyValue("CharEscapement") >>= nValue; - return uno::makeAny( ( nValue == SUBSCRIPT ) ); -} - uno::Any SAL_CALL ScVbaFont::getSize() { diff --git a/sc/source/ui/vba/vbafont.hxx b/sc/source/ui/vba/vbafont.hxx index 4a460e70b3b8..f5d7d7bcdcd0 100644 --- a/sc/source/ui/vba/vbafont.hxx +++ b/sc/source/ui/vba/vbafont.hxx @@ -62,10 +62,6 @@ public: virtual css::uno::Any SAL_CALL getStrikethrough() override; virtual css::uno::Any SAL_CALL getShadow() override; virtual css::uno::Any SAL_CALL getItalic() override; - virtual css::uno::Any SAL_CALL getSubscript() override; - virtual void SAL_CALL setSubscript( const css::uno::Any& _subscript ) override; - virtual css::uno::Any SAL_CALL getSuperscript() override; - virtual void SAL_CALL setSuperscript( const css::uno::Any& _superscript ) override; virtual css::uno::Any SAL_CALL getName() override; virtual css::uno::Any SAL_CALL getColor() override ; virtual css::uno::Any SAL_CALL getOutlineFont() override ; |