From 55131d409d903496b9d6ec5dee39e33983bf1043 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Wed, 10 Apr 2013 18:17:00 +0200 Subject: add msfilter::util::ConvertColor to avoid copy&paste Change-Id: Ia5507f8d1ec18a45d3128c809d03f8f41849f93c --- sw/source/filter/ww8/docxattributeoutput.cxx | 41 +++++++--------------------- 1 file changed, 10 insertions(+), 31 deletions(-) (limited to 'sw') diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 5f5934f156ca..86058dd68883 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -191,7 +191,6 @@ class FieldMarkParamsHelper return bResult; } }; -static OString impl_ConvertColor( const Color &rColor ); void DocxAttributeOutput::RTLAndCJKState( bool bIsRTL, sal_uInt16 /*nScript*/ ) { if (bIsRTL) @@ -276,7 +275,7 @@ void lcl_TextFrameShadow(FSHelperPtr pSerializer, const SwFrmFmt& rFrmFmt) if (aOffset.isEmpty()) return; - OString aShadowColor = impl_ConvertColor(aShadowItem.GetColor()); + OString aShadowColor = msfilter::util::ConvertColor(aShadowItem.GetColor()); pSerializer->singleElementNS(XML_v, XML_shadow, XML_on, "t", XML_color, "#" + aShadowColor, @@ -1400,26 +1399,6 @@ void DocxAttributeOutput::ParagraphStyle( sal_uInt16 nStyle ) m_pSerializer->singleElementNS( XML_w, XML_pStyle, FSNS( XML_w, XML_val ), aStyleId.getStr(), FSEND ); } -static OString impl_ConvertColor( const Color &rColor ) -{ - OString color( "auto" ); - if ( rColor.GetColor() != COL_AUTO ) - { - const char pHexDigits[] = "0123456789ABCDEF"; - char pBuffer[] = "000000"; - - pBuffer[0] = pHexDigits[ ( rColor.GetRed() >> 4 ) & 0x0F ]; - pBuffer[1] = pHexDigits[ rColor.GetRed() & 0x0F ]; - pBuffer[2] = pHexDigits[ ( rColor.GetGreen() >> 4 ) & 0x0F ]; - pBuffer[3] = pHexDigits[ rColor.GetGreen() & 0x0F ]; - pBuffer[4] = pHexDigits[ ( rColor.GetBlue() >> 4 ) & 0x0F ]; - pBuffer[5] = pHexDigits[ rColor.GetBlue() & 0x0F ]; - - color = OString( pBuffer ); - } - return color; -} - static void impl_borderLine( FSHelperPtr pSerializer, sal_Int32 elementToken, const SvxBorderLine* pBorderLine, sal_uInt16 nDist ) { FastAttributeList* pAttr = pSerializer->createAttrList(); @@ -1512,7 +1491,7 @@ static void impl_borderLine( FSHelperPtr pSerializer, sal_Int32 elementToken, co pAttr->add( FSNS( XML_w, XML_space ), OString::valueOf( sal_Int32( nDist / 20 ) ) ); // Get the color code as an RRGGBB hex value - OString sColor( impl_ConvertColor( pBorderLine->GetColor( ) ) ); + OString sColor( msfilter::util::ConvertColor( pBorderLine->GetColor( ) ) ); pAttr->add( FSNS( XML_w, XML_color ), sColor ); } @@ -1932,7 +1911,7 @@ void DocxAttributeOutput::TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_ else aColor = COL_AUTO; - OString sColor = impl_ConvertColor( aColor ); + OString sColor = msfilter::util::ConvertColor( aColor ); m_pSerializer->singleElementNS( XML_w, XML_shd, FSNS( XML_w, XML_fill ), sColor.getStr( ), FSNS( XML_w, XML_val ), "clear", @@ -2397,7 +2376,7 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size // Distance is measured diagonally from corner double nShadowDist = sqrt((aShadowItem.GetWidth()*aShadowItem.GetWidth())*2.0); OString aShadowDist( OString::valueOf( TwipsToEMU( nShadowDist ) ) ); - OString aShadowColor = impl_ConvertColor( aShadowItem.GetColor() ); + OString aShadowColor = msfilter::util::ConvertColor( aShadowItem.GetColor() ); sal_uInt32 nShadowDir = 0; switch ( aShadowItem.GetLocation() ) { @@ -3356,7 +3335,7 @@ void DocxAttributeOutput::CharColor( const SvxColorItem& rColor ) const Color aColor( rColor.GetValue() ); OString aColorString; - aColorString = impl_ConvertColor( aColor ); + aColorString = msfilter::util::ConvertColor( aColor ); m_pSerializer->singleElementNS( XML_w, XML_color, FSNS( XML_w, XML_val ), aColorString.getStr(), FSEND ); @@ -3553,7 +3532,7 @@ void DocxAttributeOutput::CharAnimatedText( const SvxBlinkItem& rBlink ) void DocxAttributeOutput::CharBackground( const SvxBrushItem& rBrush ) { m_pSerializer->singleElementNS( XML_w, XML_shd, - FSNS( XML_w, XML_fill ), impl_ConvertColor( rBrush.GetColor() ).getStr(), + FSNS( XML_w, XML_fill ), msfilter::util::ConvertColor( rBrush.GetColor() ).getStr(), FSNS( XML_w, XML_val ), "clear", FSEND ); } @@ -4623,7 +4602,7 @@ void DocxAttributeOutput::FormatAnchor( const SwFmtAnchor& ) void DocxAttributeOutput::FormatBackground( const SvxBrushItem& rBrush ) { - OString sColor = impl_ConvertColor( rBrush.GetColor( ) ); + OString sColor = msfilter::util::ConvertColor( rBrush.GetColor( ) ); if (m_bTextFrameSyntax) m_pFlyAttrList->add(XML_fillcolor, "#" + sColor); else if ( !m_rExport.bOutPageDescs ) @@ -4648,9 +4627,9 @@ void DocxAttributeOutput::FormatFillGradient( const XFillGradientItem& rFillGrad m_pFlyFillAttrList->add(XML_type, "gradient"); const XGradient& rGradient = rFillGradient.GetGradientValue(); - OString sStartColor = impl_ConvertColor(rGradient.GetStartColor()); + OString sStartColor = msfilter::util::ConvertColor(rGradient.GetStartColor()); m_pFlyFillAttrList->add(XML_color2, "#" + sStartColor); - OString sEndColor = impl_ConvertColor(rGradient.GetEndColor()); + OString sEndColor = msfilter::util::ConvertColor(rGradient.GetEndColor()); m_pFlyAttrList->add(XML_fillcolor, "#" + sEndColor); switch (rGradient.GetGradientStyle()) @@ -4679,7 +4658,7 @@ void DocxAttributeOutput::FormatBox( const SvxBoxItem& rBox ) if (pLeft && pRight && pTop && pBottom && *pLeft == *pRight && *pLeft == *pTop && *pLeft == *pBottom) { - OString sColor("#" + impl_ConvertColor(pTop->GetColor())); + OString sColor("#" + msfilter::util::ConvertColor(pTop->GetColor())); m_pFlyAttrList->add(XML_strokecolor, sColor); double const fConverted(editeng::ConvertBorderWidthToWord(pTop->GetBorderLineStyle(), pTop->GetWidth())); -- cgit /libreoffice-5-2+backports LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
path: root/readlicense_oo
AgeCommit message (Expand)Author
2014-10-20fdo#85042 Windows XP SP2 is requiredAndras Timar
2014-10-19update creditsChristian Lohmaier
2014-10-16update creditsChristian Lohmaier
2014-10-14fdo#81523 Bump the requirement for Mac in the Readme to 10.8Norbert Thiebaud
2014-08-26update creditsChristian Lohmaier
2014-07-23update creditsChristian Lohmaier
2014-07-16update creditsChristian Lohmaier
2014-06-26libgltf: fix typo in licenseZolnai Tamás
2014-06-25Update libgltf: new build system and various fixesZolnai Tamás
2014-06-22fdo#80103 - A superlative adjective without an article in README_en-USJoren De Cuyper
2014-06-19fdo#80108 keep at least the version in syncDavid Tardon
2014-06-11update creditsChristian Lohmaier
2014-06-02restore 2 deleted lines in CREDITSAndras Timar
2014-05-15fix license for Czech thesaurusDavid Tardon
2014-04-30Many spelling fixes: some more files.Pedro Giffuni
2014-04-17remove executable bitAndras Timar
2014-03-25update creditsChristian Lohmaier
2014-03-25fdo#76568 remove BerkeleyDB from license textAndras Timar
2014-02-23Update readme.xrmDouglas Mencken
2014-01-03Update copyright in NOTICE to 2014Caolán McNamara
2014-01-03Update of LICENSE documentAndras Timar
2013-12-13Targetted text updates, with seasonable changes before l10n freeze.Michael Meeks
2013-11-17bugs.freedesktop.org -> bugs.libreoffice.orgAndras Timar
2013-11-08instsetoo_native: shouldn't need instdir in include pathMichael Stahl
2013-10-31readlicense_oo: stop delivering files to OUTDIRMichael Stahl
2013-10-28gbuild: set Package default target to INSTDIRMichael Stahl
2013-10-16Resolves: #i123481# - Paragraph should have a language to mark it localizableAriel Constenla-Haile
2013-09-11tweak README for Linux a bitMichael Stahl
2013-09-11Bin outdated and overly specific "requirements" for OS X and WindowsTor Lillqvist
2013-09-10use $(PRODUCTNAME) variable for READMEMichael Stahl
2013-09-09install whole sdk using filelistsMatúš Kukan
2013-09-07s/wiki.services.openoffice.org/wiki.openoffice.org/gAndras Timar
2013-07-19fdo#67061 bring install readme in sync with changed realityLionel Elie Mamane
2013-06-28credits: add back "developers not committing code since 2010-09-28"Christian Lohmaier
2013-06-23update creditsChristian Lohmaier
2013-06-20remove last uses of config 'GUI' variableMatúš Kukan
2013-06-05Update LICENSE documentAndras Timar
2013-05-04nuke MathMLDTDDavid Tardon
2013-04-29fdo#33370 Readme file could be easier to followJan Bobisud
2013-03-25Remove unneeded project and projectroot parametersZolnai Tamás
2013-03-14remove legacy build.pl prj/build.lst files.Michael Meeks
2013-02-28remove all d.lstMichael Stahl