[Libreoffice-commits] core.git: sc/source
Tamas Bunth
tamas.bunth at collabora.co.uk
Tue Jun 27 07:16:14 UTC 2017
sc/source/ui/vba/vbafont.cxx | 159 -------------------------------------------
sc/source/ui/vba/vbafont.hxx | 4 -
2 files changed, 163 deletions(-)
New commits:
commit a08c833a5d61ba806fe2875e7b84fd11b9856b58
Author: Tamas Bunth <tamas.bunth at collabora.co.uk>
Date: Sat Jun 24 16:05:16 2017 +0200
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 at gmail.com>
Tested-by: Tamás Bunth <btomi96 at gmail.com>
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 ;
More information about the Libreoffice-commits
mailing list