From 77fd448d0990adc79406e13a127b2b1834984b71 Mon Sep 17 00:00:00 2001 From: Jean-Noël Rouvignac Date: Fri, 1 Feb 2013 09:33:19 +0100 Subject: Removed several useless macros: UNISTRING, USTR, USTR_ASCII, ASCII_STR, ASCII_STRING, CONST_ASCII, ASCSTR, ASCII, DEFINE_CONST_UNICODE, DEFINE_CONST_OUSTRING Change-Id: I96d690bf9f9b319e9eeafcf218ec5ce87f21215f Reviewed-on: https://gerrit.libreoffice.org/1954 Reviewed-by: Tor Lillqvist Tested-by: Tor Lillqvist --- sdext/source/pdfimport/inc/pdfihelper.hxx | 2 - sdext/source/pdfimport/tree/drawtreevisiting.cxx | 140 ++++++++++----------- sdext/source/pdfimport/tree/pdfiprocessor.cxx | 42 +++---- sdext/source/pdfimport/tree/style.cxx | 12 +- sdext/source/pdfimport/tree/writertreevisiting.cxx | 122 +++++++++--------- 5 files changed, 157 insertions(+), 161 deletions(-) (limited to 'sdext') diff --git a/sdext/source/pdfimport/inc/pdfihelper.hxx b/sdext/source/pdfimport/inc/pdfihelper.hxx index 3749b6cdfa76..2db7b555b4cd 100644 --- a/sdext/source/pdfimport/inc/pdfihelper.hxx +++ b/sdext/source/pdfimport/inc/pdfihelper.hxx @@ -191,8 +191,6 @@ namespace pdfi com::sun::star::task::XInteractionHandler > const & handler); } -#define USTR(x) rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( x ) ) - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sdext/source/pdfimport/tree/drawtreevisiting.cxx b/sdext/source/pdfimport/tree/drawtreevisiting.cxx index 4a8e6a9d985f..8f4c16c22a5a 100644 --- a/sdext/source/pdfimport/tree/drawtreevisiting.cxx +++ b/sdext/source/pdfimport/tree/drawtreevisiting.cxx @@ -75,10 +75,10 @@ void DrawXmlEmitter::visit( HyperlinkElement& elem, const std::list< Element* >: const char* pType = dynamic_cast(elem.Children.front()) ? "draw:a" : "text:a"; PropertyMap aProps; - aProps[ USTR( "xlink:type" ) ] = USTR( "simple" ); - aProps[ USTR( "xlink:href" ) ] = elem.URI; - aProps[ USTR( "office:target-frame-name" ) ] = USTR( "_blank" ); - aProps[ USTR( "xlink:show" ) ] = USTR( "new" ); + aProps[ "xlink:type" ] = "simple"; + aProps[ "xlink:href" ] = elem.URI; + aProps[ "office:target-frame-name" ] = "_blank"; + aProps[ "xlink:show" ] = "new"; m_rEmitContext.rEmitter.beginTag( pType, aProps ); std::list< Element* >::iterator this_it = elem.Children.begin(); @@ -134,7 +134,7 @@ void DrawXmlEmitter::visit( TextElement& elem, const std::list< Element* >::cons rtl::OUString strToken= str.copy(i,1) ; if( strSpace.equals(strToken) || strNbSpace.equals(strToken)) { - aProps[ USTR( "text:c" ) ] = USTR( "1" ); + aProps[ "text:c" ] = "1"; m_rEmitContext.rEmitter.beginTag( "text:s", aProps ); m_rEmitContext.rEmitter.endTag( "text:s"); } @@ -167,7 +167,7 @@ void DrawXmlEmitter::visit( ParagraphElement& elem, const std::list< Element* >: PropertyMap aProps; if( elem.StyleId != -1 ) { - aProps[ USTR( "text:style-name" ) ] = m_rEmitContext.rStyles.getStyleName( elem.StyleId ); + aProps[ "text:style-name" ] = m_rEmitContext.rStyles.getStyleName( elem.StyleId ); } const char* pTagType = "text:p"; if( elem.Type == elem.Headline ) @@ -192,17 +192,17 @@ void DrawXmlEmitter::fillFrameProps( DrawElement& rElem, { double rel_x = rElem.x, rel_y = rElem.y; - rProps[ USTR( "draw:z-index" ) ] = rtl::OUString::valueOf( rElem.ZOrder ); - rProps[ USTR( "draw:style-name" )] = rEmitContext.rStyles.getStyleName( rElem.StyleId ); - rProps[ USTR( "svg:width" ) ] = convertPixelToUnitString( rElem.w ); - rProps[ USTR( "svg:height" ) ] = convertPixelToUnitString( rElem.h ); + rProps[ "draw:z-index" ] = rtl::OUString::valueOf( rElem.ZOrder ); + rProps[ "draw:style-name"] = rEmitContext.rStyles.getStyleName( rElem.StyleId ); + rProps[ "svg:width" ] = convertPixelToUnitString( rElem.w ); + rProps[ "svg:height" ] = convertPixelToUnitString( rElem.h ); const GraphicsContext& rGC = rEmitContext.rProcessor.getGraphicsContext( rElem.GCId ); if( rGC.Transformation.isIdentity() || bWasTransformed ) { - rProps[ USTR( "svg:x" ) ] = convertPixelToUnitString( rel_x ); - rProps[ USTR( "svg:y" ) ] = convertPixelToUnitString( rel_y ); + rProps[ "svg:x" ] = convertPixelToUnitString( rel_x ); + rProps[ "svg:y" ] = convertPixelToUnitString( rel_y ); } else { @@ -245,7 +245,7 @@ void DrawXmlEmitter::fillFrameProps( DrawElement& rElem, aBuf.append( convertPixelToUnitString( rel_y ) ); aBuf.appendAscii( " )" ); - rProps[ USTR( "draw:transform" ) ] = aBuf.makeStringAndClear(); + rProps[ "draw:transform" ] = aBuf.makeStringAndClear(); } } @@ -335,8 +335,8 @@ void DrawXmlEmitter::visit( PolyPolyElement& elem, const std::list< Element* >:: aBuf.append( convPx2mmPrec2(elem.w)*100.0 ); aBuf.append( sal_Unicode(' ') ); aBuf.append( convPx2mmPrec2(elem.h)*100.0 ); - aProps[ USTR( "svg:viewBox" ) ] = aBuf.makeStringAndClear(); - aProps[ USTR( "svg:d" ) ] = basegfx::tools::exportToSvgD( elem.PolyPoly ); + aProps[ "svg:viewBox" ] = aBuf.makeStringAndClear(); + aProps[ "svg:d" ] = basegfx::tools::exportToSvgD( elem.PolyPoly ); m_rEmitContext.rEmitter.beginTag( "draw:path", aProps ); m_rEmitContext.rEmitter.endTag( "draw:path" ); @@ -355,7 +355,7 @@ void DrawXmlEmitter::visit( ImageElement& elem, const std::list< Element* >::con void DrawXmlEmitter::visit( PageElement& elem, const std::list< Element* >::const_iterator& ) { PropertyMap aPageProps; - aPageProps[ USTR( "draw:master-page-name" ) ] = m_rEmitContext.rStyles.getStyleName( elem.StyleId ); + aPageProps[ "draw:master-page-name" ] = m_rEmitContext.rStyles.getStyleName( elem.StyleId ); m_rEmitContext.rEmitter.beginTag("draw:page", aPageProps); @@ -772,8 +772,8 @@ void DrawXmlFinalizer::visit( PolyPolyElement& elem, const std::list< Element* > // xxx TODO copied from DrawElement const GraphicsContext& rGC = m_rProcessor.getGraphicsContext(elem.GCId ); PropertyMap aProps; - aProps[ USTR( "style:family" ) ] = USTR( "graphic" ); - aProps[ USTR( "style:parent-style-name") ] = USTR( "standard" ); + aProps[ "style:family" ] = "graphic"; + aProps[ "style:parent-style-name" ] = "standard"; // generate standard graphic style if necessary m_rStyleContainer.getStandardStyleId( "graphic" ); @@ -782,8 +782,8 @@ void DrawXmlFinalizer::visit( PolyPolyElement& elem, const std::list< Element* > // TODO(F3): proper dash emulation if( elem.Action & PATH_STROKE ) { - aGCProps[ USTR("draw:stroke") ] = rGC.DashArray.empty() ? USTR("solid") : USTR("dash"); - aGCProps[ USTR("svg:stroke-color") ] = getColorString( rGC.LineColor ); + aGCProps[ "draw:stroke" ] = rGC.DashArray.empty() ? OUString("solid") : OUString("dash"); + aGCProps[ "svg:stroke-color" ] = getColorString( rGC.LineColor ); if( rGC.LineWidth != 0.0 ) { ::basegfx::B2DVector aVec(rGC.LineWidth,0); @@ -792,23 +792,23 @@ void DrawXmlFinalizer::visit( PolyPolyElement& elem, const std::list< Element* > aVec.setX ( convPx2mmPrec2( aVec.getX() )*100.0 ); aVec.setY ( convPx2mmPrec2( aVec.getY() )*100.0 ); - aGCProps[ USTR("svg:stroke-width") ] = rtl::OUString::valueOf( aVec.getLength() ); + aGCProps[ "svg:stroke-width" ] = rtl::OUString::valueOf( aVec.getLength() ); } } else { - aGCProps[ USTR("draw:stroke") ] = USTR("none"); + aGCProps[ "draw:stroke" ] = "none"; } // TODO(F1): check whether stuff could be emulated by gradient/bitmap/hatch if( elem.Action & (PATH_FILL | PATH_EOFILL) ) { - aGCProps[ USTR("draw:fill") ] = USTR("solid"); - aGCProps[ USTR("draw:fill-color") ] = getColorString( rGC.FillColor ); + aGCProps[ "draw:fill" ] = "solid"; + aGCProps[ "draw:fill-color" ] = getColorString( rGC.FillColor ); } else { - aGCProps[ USTR("draw:fill") ] = USTR("none"); + aGCProps[ "draw:fill" ] = "none"; } StyleContainer::Style aStyle( "style:style", aProps ); @@ -826,51 +826,51 @@ void DrawXmlFinalizer::visit( TextElement& elem, const std::list< Element* >::co { const FontAttributes& rFont = m_rProcessor.getFont( elem.FontId ); PropertyMap aProps; - aProps[ USTR( "style:family" ) ] = USTR( "text" ); + aProps[ "style:family" ] = "text"; PropertyMap aFontProps; // family name - aFontProps[ USTR( "fo:font-family" ) ] = rFont.familyName; - aFontProps[ USTR( "style:font-family-complex" ) ] = rFont.familyName; + aFontProps[ "fo:font-family" ] = rFont.familyName; + aFontProps[ "style:font-family-complex" ] = rFont.familyName; // bold if( rFont.isBold ) { - aFontProps[ USTR( "fo:font-weight" ) ] = USTR( "bold" ); - aFontProps[ USTR( "fo:font-weight-asian" ) ] = USTR( "bold" ); - aFontProps[ USTR( "style:font-weight-complex" ) ] = USTR( "bold" ); + aFontProps[ "fo:font-weight" ] = "bold"; + aFontProps[ "fo:font-weight-asian" ] = "bold"; + aFontProps[ "style:font-weight-complex" ] = "bold"; } // italic if( rFont.isItalic ) { - aFontProps[ USTR( "fo:font-style" ) ] = USTR( "italic" ); - aFontProps[ USTR( "fo:font-style-asian" ) ] = USTR( "italic" ); - aFontProps[ USTR( "style:font-style-complex" ) ] = USTR( "italic" ); + aFontProps[ "fo:font-style" ] = "italic"; + aFontProps[ "fo:font-style-asian" ] = "italic"; + aFontProps[ "style:font-style-complex" ] = "italic"; } // underline if( rFont.isUnderline ) { - aFontProps[ USTR( "style:text-underline-style" ) ] = USTR( "solid" ); - aFontProps[ USTR( "style:text-underline-width" ) ] = USTR( "auto" ); - aFontProps[ USTR( "style:text-underline-color" ) ] = USTR( "font-color" ); + aFontProps[ "style:text-underline-style" ] = "solid"; + aFontProps[ "style:text-underline-width" ] = "auto"; + aFontProps[ "style:text-underline-color" ] = "font-color"; } // outline if( rFont.isOutline ) { - aFontProps[ USTR( "style:text-outline" ) ] = USTR( "true" ); + aFontProps[ "style:text-outline" ] = "true"; } // size rtl::OUStringBuffer aBuf( 32 ); aBuf.append( rFont.size*72/PDFI_OUTDEV_RESOLUTION ); aBuf.appendAscii( "pt" ); rtl::OUString aFSize = aBuf.makeStringAndClear(); - aFontProps[ USTR( "fo:font-size" ) ] = aFSize; - aFontProps[ USTR( "style:font-size-asian" ) ] = aFSize; - aFontProps[ USTR( "style:font-size-complex" ) ] = aFSize; + aFontProps[ "fo:font-size" ] = aFSize; + aFontProps[ "style:font-size-asian" ] = aFSize; + aFontProps[ "style:font-size-complex" ] = aFSize; // color const GraphicsContext& rGC = m_rProcessor.getGraphicsContext( elem.GCId ); - aFontProps[ USTR( "fo:color" ) ] = getColorString( rFont.isOutline ? rGC.LineColor : rGC.FillColor ); + aFontProps[ "fo:color" ] = getColorString( rFont.isOutline ? rGC.LineColor : rGC.FillColor ); StyleContainer::Style aStyle( "style:style", aProps ); StyleContainer::Style aSubStyle( "style:text-properties", aFontProps ); @@ -882,17 +882,17 @@ void DrawXmlFinalizer::visit( ParagraphElement& elem, const std::list< Element* { PropertyMap aProps; - aProps[ USTR( "style:family" ) ] = USTR( "paragraph" ); + aProps[ "style:family" ] = "paragraph"; // generate standard paragraph style if necessary m_rStyleContainer.getStandardStyleId( "paragraph" ); PropertyMap aParProps; - aParProps[ USTR("fo:text-align")] = USTR("start"); + aParProps[ "fo:text-align"] = "start"; if (elem.bRtl) - aParProps[ USTR("style:writing-mode")] = USTR("rl-tb"); + aParProps[ "style:writing-mode"] = "rl-tb"; else - aParProps[ USTR("style:writing-mode")] = USTR("lr-tb"); + aParProps[ "style:writing-mode"] = "lr-tb"; StyleContainer::Style aStyle( "style:style", aProps ); StyleContainer::Style aSubStyle( "style:paragraph-properties", aParProps ); @@ -906,32 +906,32 @@ void DrawXmlFinalizer::visit( ParagraphElement& elem, const std::list< Element* void DrawXmlFinalizer::visit( FrameElement& elem, const std::list< Element* >::const_iterator&) { PropertyMap aProps; - aProps[ USTR( "style:family" ) ] = USTR( "graphic" ); - aProps[ USTR( "style:parent-style-name") ] = USTR( "standard" ); + aProps[ "style:family" ] = "graphic"; + aProps[ "style:parent-style-name" ] = "standard"; // generate standard graphic style if necessary m_rStyleContainer.getStandardStyleId( "graphic" ); PropertyMap aGCProps; - aGCProps[ USTR("draw:stroke") ] = USTR("none"); - aGCProps[ USTR("draw:fill") ] = USTR("none"); - aGCProps[ USTR("draw:auto-grow-height") ] = USTR("true"); - aGCProps[ USTR("draw:auto-grow-width") ] = USTR("true"); - aGCProps[ USTR("draw:textarea-horizontal-align") ] = USTR("left"); - aGCProps[ USTR("draw:textarea-vertical-align") ] = USTR("top"); - aGCProps[ USTR("fo:min-height")] = USTR("0cm"); - aGCProps[ USTR("fo:min-width")] = USTR("0cm"); - aGCProps[ USTR("fo:padding-top") ] = USTR("0cm"); - aGCProps[ USTR("fo:padding-left") ] = USTR("0cm"); - aGCProps[ USTR("fo:padding-right") ] = USTR("0cm"); - aGCProps[ USTR("fo:padding-bottom") ] = USTR("0cm"); + aGCProps[ "draw:stroke" ] = "none"; + aGCProps[ "draw:fill" ] = "none"; + aGCProps[ "draw:auto-grow-height" ] = "true"; + aGCProps[ "draw:auto-grow-width" ] = "true"; + aGCProps[ "draw:textarea-horizontal-align" ] = "left"; + aGCProps[ "draw:textarea-vertical-align" ] = "top"; + aGCProps[ "fo:min-height"] = "0cm"; + aGCProps[ "fo:min-width"] = "0cm"; + aGCProps[ "fo:padding-top" ] = "0cm"; + aGCProps[ "fo:padding-left" ] = "0cm"; + aGCProps[ "fo:padding-right" ] = "0cm"; + aGCProps[ "fo:padding-bottom" ] = "0cm"; // remark: vertical mirroring is done in current OOO by // mirroring horzontally and rotating 180 degrees // this is quaint, but unfortunately it seems // mirror=vertical is defined but not implemented in current code if( elem.MirrorVertical ) - aGCProps[ USTR("style:mirror") ] = USTR("horizontal"); + aGCProps[ "style:mirror" ] = "horizontal"; StyleContainer::Style aStyle( "style:style", aProps ); StyleContainer::Style aSubStyle( "style:graphic-properties", aGCProps ); @@ -1015,14 +1015,14 @@ void DrawXmlFinalizer::visit( PageElement& elem, const std::list< Element* >::co PropertyMap aPageProps; PropertyMap aPageLayoutProps; rtl::OUStringBuffer aBuf( 64 ); - aPageLayoutProps[ USTR( "fo:margin-top" ) ] = unitMMString( top_margin ); - aPageLayoutProps[ USTR( "fo:margin-bottom" ) ] = unitMMString( bottom_margin ); - aPageLayoutProps[ USTR( "fo:margin-left" ) ] = unitMMString( left_margin ); - aPageLayoutProps[ USTR( "fo:margin-right" ) ] = unitMMString( right_margin ); - aPageLayoutProps[ USTR( "fo:page-width" ) ] = unitMMString( page_width ); - aPageLayoutProps[ USTR( "fo:page-height" ) ] = unitMMString( page_height ); - aPageLayoutProps[ USTR( "style:print-orientation" ) ]= elem.w < elem.h ? USTR( "portrait" ) : USTR( "landscape" ); - aPageLayoutProps[ USTR( "style:writing-mode" ) ]= USTR( "lr-tb" ); + aPageLayoutProps[ "fo:margin-top" ] = unitMMString( top_margin ); + aPageLayoutProps[ "fo:margin-bottom" ] = unitMMString( bottom_margin ); + aPageLayoutProps[ "fo:margin-left" ] = unitMMString( left_margin ); + aPageLayoutProps[ "fo:margin-right" ] = unitMMString( right_margin ); + aPageLayoutProps[ "fo:page-width" ] = unitMMString( page_width ); + aPageLayoutProps[ "fo:page-height" ] = unitMMString( page_height ); + aPageLayoutProps[ "style:print-orientation" ]= elem.w < elem.h ? OUString("portrait") : OUString("landscape"); + aPageLayoutProps[ "style:writing-mode" ]= "lr-tb"; StyleContainer::Style aStyle( "style:page-layout", aPageProps); StyleContainer::Style aSubStyle( "style:page-layout-properties", aPageLayoutProps); @@ -1031,7 +1031,7 @@ void DrawXmlFinalizer::visit( PageElement& elem, const std::list< Element* >::co // create master page rtl::OUString aMasterPageLayoutName = m_rStyleContainer.getStyleName( nPageStyle ); - aPageProps[ USTR( "style:page-layout-name" ) ] = aMasterPageLayoutName; + aPageProps[ "style:page-layout-name" ] = aMasterPageLayoutName; StyleContainer::Style aMPStyle( "style:master-page", aPageProps); diff --git a/sdext/source/pdfimport/tree/pdfiprocessor.cxx b/sdext/source/pdfimport/tree/pdfiprocessor.cxx index 01585e556b99..0e9955f10192 100644 --- a/sdext/source/pdfimport/tree/pdfiprocessor.cxx +++ b/sdext/source/pdfimport/tree/pdfiprocessor.cxx @@ -80,7 +80,7 @@ namespace pdfi m_bMirrorMapperTried(false) { FontAttributes aDefFont; - aDefFont.familyName = USTR("Helvetica"); + aDefFont.familyName = "Helvetica"; aDefFont.isBold = false; aDefFont.isItalic = false; aDefFont.size = 10*PDFI_OUTDEV_RESOLUTION/72; @@ -824,26 +824,26 @@ void PDFIProcessor::emit( XmlEmitter& rEmitter, PropertyMap aProps; // document prolog #define OASIS_STR "urn:oasis:names:tc:opendocument:xmlns:" - aProps[ USTR( "xmlns:office" ) ] = USTR( OASIS_STR "office:1.0" ); - aProps[ USTR( "xmlns:style" ) ] = USTR( OASIS_STR "style:1.0" ); - aProps[ USTR( "xmlns:text" ) ] = USTR( OASIS_STR "text:1.0" ); - aProps[ USTR( "xmlns:svg" ) ] = USTR( OASIS_STR "svg-compatible:1.0" ); - aProps[ USTR( "xmlns:table" ) ] = USTR( OASIS_STR "table:1.0" ); - aProps[ USTR( "xmlns:draw" ) ] = USTR( OASIS_STR "drawing:1.0" ); - aProps[ USTR( "xmlns:fo" ) ] = USTR( OASIS_STR "xsl-fo-compatible:1.0" ); - aProps[ USTR( "xmlns:xlink" )] = USTR( "http://www.w3.org/1999/xlink" ); - aProps[ USTR( "xmlns:dc" )] = USTR( "http://purl.org/dc/elements/1.1/" ); - aProps[ USTR( "xmlns:number" )] = USTR( OASIS_STR "datastyle:1.0" ); - aProps[ USTR( "xmlns:presentation" )] = USTR( OASIS_STR "presentation:1.0" ); - aProps[ USTR( "xmlns:math" )] = USTR( "http://www.w3.org/1998/Math/MathML" ); - aProps[ USTR( "xmlns:form" )] = USTR( OASIS_STR "form:1.0" ); - aProps[ USTR( "xmlns:script" )] = USTR( OASIS_STR "script:1.0" ); - aProps[ USTR( "xmlns:dom" )] = USTR( "http://www.w3.org/2001/xml-events" ); - aProps[ USTR( "xmlns:xforms" )] = USTR( "http://www.w3.org/2002/xforms" ); - aProps[ USTR( "xmlns:xsd" )] = USTR( "http://www.w3.org/2001/XMLSchema" ); - aProps[ USTR( "xmlns:xsi" )] = USTR( "http://www.w3.org/2001/XMLSchema-instance" ); - aProps[ USTR( "office:version" ) ] = USTR( "1.0" ); - aProps[ USTR( "office:version" ) ] = USTR( "1.0" ); + aProps[ "xmlns:office" ] = OASIS_STR "office:1.0" ; + aProps[ "xmlns:style" ] = OASIS_STR "style:1.0" ; + aProps[ "xmlns:text" ] = OASIS_STR "text:1.0" ; + aProps[ "xmlns:svg" ] = OASIS_STR "svg-compatible:1.0" ; + aProps[ "xmlns:table" ] = OASIS_STR "table:1.0" ; + aProps[ "xmlns:draw" ] = OASIS_STR "drawing:1.0" ; + aProps[ "xmlns:fo" ] = OASIS_STR "xsl-fo-compatible:1.0" ; + aProps[ "xmlns:xlink"] = "http://www.w3.org/1999/xlink"; + aProps[ "xmlns:dc"] = "http://purl.org/dc/elements/1.1/"; + aProps[ "xmlns:number"] = OASIS_STR "datastyle:1.0" ; + aProps[ "xmlns:presentation"] = OASIS_STR "presentation:1.0" ; + aProps[ "xmlns:math"] = "http://www.w3.org/1998/Math/MathML"; + aProps[ "xmlns:form"] = OASIS_STR "form:1.0" ; + aProps[ "xmlns:script"] = OASIS_STR "script:1.0" ; + aProps[ "xmlns:dom"] = "http://www.w3.org/2001/xml-events"; + aProps[ "xmlns:xforms"] = "http://www.w3.org/2002/xforms"; + aProps[ "xmlns:xsd"] = "http://www.w3.org/2001/XMLSchema"; + aProps[ "xmlns:xsi"] = "http://www.w3.org/2001/XMLSchema-instance"; + aProps[ "office:version" ] = "1.0"; + aProps[ "office:version" ] = "1.0"; aContext.rEmitter.beginTag( "office:document", aProps ); diff --git a/sdext/source/pdfimport/tree/style.cxx b/sdext/source/pdfimport/tree/style.cxx index 1028eb902533..772e81f35690 100644 --- a/sdext/source/pdfimport/tree/style.cxx +++ b/sdext/source/pdfimport/tree/style.cxx @@ -31,8 +31,6 @@ using namespace pdfi; using ::rtl::OUString; using ::rtl::OUStringBuffer; -#define USTR(x) rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( x ) ) - StyleContainer::StyleContainer() : m_nNextId( 1 ) { @@ -80,8 +78,8 @@ sal_Int32 StyleContainer::impl_getStyleId( const Style& rStyle, bool bSubStyle ) sal_Int32 StyleContainer::getStandardStyleId( const rtl::OString& rName ) { PropertyMap aProps; - aProps[ USTR( "style:family" ) ] = rtl::OStringToOUString( rName, RTL_TEXTENCODING_UTF8 ); - aProps[ USTR( "style:name" ) ] = USTR( "standard" ); + aProps[ "style:family" ] = rtl::OStringToOUString( rName, RTL_TEXTENCODING_UTF8 ); + aProps[ "style:name" ] = "standard"; Style aStyle( "style:style", aProps ); return getStyleId( aStyle ); @@ -157,12 +155,12 @@ OUString StyleContainer::getStyleName( sal_Int32 nStyle ) const { const HashedStyle& rStyle = style_it->second; - PropertyMap::const_iterator name_it = rStyle.Properties.find( USTR("style:name") ); + PropertyMap::const_iterator name_it = rStyle.Properties.find( "style:name" ); if( name_it != rStyle.Properties.end() ) aRet.append( name_it->second ); else { - PropertyMap::const_iterator fam_it = rStyle.Properties.find( USTR("style:family" ) ); + PropertyMap::const_iterator fam_it = rStyle.Properties.find( "style:family" ); OUString aStyleName; if( fam_it != rStyle.Properties.end() ) { @@ -194,7 +192,7 @@ void StyleContainer::impl_emitStyle( sal_Int32 nStyleId, const HashedStyle& rStyle = it->second; PropertyMap aProps( rStyle.Properties ); if( !rStyle.IsSubStyle ) - aProps[ USTR( "style:name" ) ] = getStyleName( nStyleId ); + aProps[ "style:name" ] = getStyleName( nStyleId ); rContext.rEmitter.beginTag( rStyle.Name.getStr(), aProps ); for( unsigned int n = 0; n < rStyle.SubStyles.size(); ++n ) diff --git a/sdext/source/pdfimport/tree/writertreevisiting.cxx b/sdext/source/pdfimport/tree/writertreevisiting.cxx index 1804d4c07caf..6f7fe57b326b 100644 --- a/sdext/source/pdfimport/tree/writertreevisiting.cxx +++ b/sdext/source/pdfimport/tree/writertreevisiting.cxx @@ -41,10 +41,10 @@ void WriterXmlEmitter::visit( HyperlinkElement& elem, const std::list< Element* const char* pType = dynamic_cast(elem.Children.front()) ? "draw:a" : "text:a"; PropertyMap aProps; - aProps[ USTR( "xlink:type" ) ] = USTR( "simple" ); - aProps[ USTR( "xlink:href" ) ] = elem.URI; - aProps[ USTR( "office:target-frame-name" ) ] = USTR( "_blank" ); - aProps[ USTR( "xlink:show" ) ] = USTR( "new" ); + aProps[ "xlink:type" ] = "simple"; + aProps[ "xlink:href" ] = elem.URI; + aProps[ "office:target-frame-name" ] = "_blank"; + aProps[ "xlink:show" ] = "new"; m_rEmitContext.rEmitter.beginTag( pType, aProps ); std::list< Element* >::iterator this_it = elem.Children.begin(); @@ -85,7 +85,7 @@ void WriterXmlEmitter::visit( ParagraphElement& elem, const std::list< Element* PropertyMap aProps; if( elem.StyleId != -1 ) { - aProps[ USTR( "text:style-name" ) ] = m_rEmitContext.rStyles.getStyleName( elem.StyleId ); + aProps[ "text:style-name" ] = m_rEmitContext.rStyles.getStyleName( elem.StyleId ); } const char* pTagType = "text:p"; if( elem.Type == elem.Headline ) @@ -120,23 +120,23 @@ void WriterXmlEmitter::fillFrameProps( DrawElement& rElem, { if( dynamic_cast(pAnchor) ) { - rProps[ USTR( "text:anchor-type" ) ] = - rElem.isCharacter ? USTR( "character" ) : USTR( "paragraph" ); + rProps[ "text:anchor-type" ] = + rElem.isCharacter ? "character" : "paragraph"; } else { PageElement* pPage = dynamic_cast(pAnchor); - rProps[ USTR( "text:anchor-type" ) ] = USTR( "page" ); - rProps[ USTR( "text:anchor-page-number" ) ] = rtl::OUString::valueOf(pPage->PageNumber); + rProps[ "text:anchor-type" ] = "page"; + rProps[ "text:anchor-page-number" ] = rtl::OUString::valueOf(pPage->PageNumber); } rel_x -= pAnchor->x; rel_y -= pAnchor->y; } - rProps[ USTR( "draw:z-index" ) ] = rtl::OUString::valueOf( rElem.ZOrder ); - rProps[ USTR( "draw:style-name" )] = rEmitContext.rStyles.getStyleName( rElem.StyleId ); - rProps[ USTR( "svg:width" ) ] = convertPixelToUnitString( rElem.w ); - rProps[ USTR( "svg:height" ) ] = convertPixelToUnitString( rElem.h ); + rProps[ "draw:z-index" ] = rtl::OUString::valueOf( rElem.ZOrder ); + rProps[ "draw:style-name"] = rEmitContext.rStyles.getStyleName( rElem.StyleId ); + rProps[ "svg:width" ] = convertPixelToUnitString( rElem.w ); + rProps[ "svg:height" ] = convertPixelToUnitString( rElem.h ); const GraphicsContext& rGC = rEmitContext.rProcessor.getGraphicsContext( rElem.GCId ); @@ -144,8 +144,8 @@ void WriterXmlEmitter::fillFrameProps( DrawElement& rElem, { if( !rElem.isCharacter ) { - rProps[ USTR( "svg:x" ) ] = convertPixelToUnitString( rel_x ); - rProps[ USTR( "svg:y" ) ] = convertPixelToUnitString( rel_y ); + rProps[ "svg:x" ] = convertPixelToUnitString( rel_x ); + rProps[ "svg:y" ] = convertPixelToUnitString( rel_y ); } } else @@ -187,7 +187,7 @@ void WriterXmlEmitter::fillFrameProps( DrawElement& rElem, aBuf.appendAscii( " )" ); } - rProps[ USTR( "draw:transform" ) ] = aBuf.makeStringAndClear(); + rProps[ "draw:transform" ] = aBuf.makeStringAndClear(); } } @@ -274,8 +274,8 @@ void WriterXmlEmitter::visit( PolyPolyElement& elem, const std::list< Element* > aBuf.append( convPx2mmPrec2(elem.w)*100.0 ); aBuf.append( sal_Unicode(' ') ); aBuf.append( convPx2mmPrec2(elem.h)*100.0 ); - aProps[ USTR( "svg:viewBox" ) ] = aBuf.makeStringAndClear(); - aProps[ USTR( "svg:d" ) ] = basegfx::tools::exportToSvgD( elem.PolyPoly ); + aProps[ "svg:viewBox" ] = aBuf.makeStringAndClear(); + aProps[ "svg:d" ] = basegfx::tools::exportToSvgD( elem.PolyPoly ); m_rEmitContext.rEmitter.beginTag( "draw:path", aProps ); m_rEmitContext.rEmitter.endTag( "draw:path" ); @@ -839,15 +839,15 @@ void WriterXmlFinalizer::visit( PolyPolyElement& elem, const std::list< Element* // xxx TODO copied from DrawElement const GraphicsContext& rGC = m_rProcessor.getGraphicsContext(elem.GCId ); PropertyMap aProps; - aProps[ USTR( "style:family" ) ] = USTR( "graphic" ); + aProps[ "style:family" ] = "graphic"; PropertyMap aGCProps; // TODO(F3): proper dash emulation if( elem.Action & PATH_STROKE ) { - aGCProps[ USTR("draw:stroke") ] = rGC.DashArray.empty() ? USTR("solid") : USTR("dash"); - aGCProps[ USTR("svg:stroke-color") ] = getColorString( rGC.LineColor ); + aGCProps[ "draw:stroke" ] = rGC.DashArray.empty() ? OUString("solid") : OUString("dash"); + aGCProps[ "svg:stroke-color" ] = getColorString( rGC.LineColor ); if( rGC.LineWidth != 0.0 ) { ::basegfx::B2DVector aVec(rGC.LineWidth,0); @@ -856,23 +856,23 @@ void WriterXmlFinalizer::visit( PolyPolyElement& elem, const std::list< Element* aVec.setX ( convPx2mmPrec2( aVec.getX() )*100.0 ); aVec.setY ( convPx2mmPrec2( aVec.getY() )*100.0 ); - aGCProps[ USTR("svg:stroke-width") ] = rtl::OUString::valueOf( aVec.getLength() ); + aGCProps[ "svg:stroke-width" ] = rtl::OUString::valueOf( aVec.getLength() ); } } else { - aGCProps[ USTR("draw:stroke") ] = USTR("none"); + aGCProps[ "draw:stroke" ] = "none"; } // TODO(F1): check whether stuff could be emulated by gradient/bitmap/hatch if( elem.Action & (PATH_FILL | PATH_EOFILL) ) { - aGCProps[ USTR("draw:fill") ] = USTR("solid"); - aGCProps[ USTR("draw:fill-color") ] = getColorString( rGC.FillColor ); + aGCProps[ "draw:fill" ] = "solid"; + aGCProps[ "draw:fill-color" ] = getColorString( rGC.FillColor ); } else { - aGCProps[ USTR("draw:fill") ] = USTR("none"); + aGCProps[ "draw:fill" ] = "none"; } StyleContainer::Style aStyle( "style:style", aProps ); @@ -890,49 +890,49 @@ void WriterXmlFinalizer::visit( TextElement& elem, const std::list< Element* >:: { const FontAttributes& rFont = m_rProcessor.getFont( elem.FontId ); PropertyMap aProps; - aProps[ USTR( "style:family" ) ] = USTR( "text" ); + aProps[ "style:family" ] = "text"; PropertyMap aFontProps; // family name - aFontProps[ USTR( "fo:font-family" ) ] = rFont.familyName; + aFontProps[ "fo:font-family" ] = rFont.familyName; // bold if( rFont.isBold ) { - aFontProps[ USTR( "fo:font-weight" ) ] = USTR( "bold" ); - aFontProps[ USTR( "fo:font-weight-asian" ) ] = USTR( "bold" ); - aFontProps[ USTR( "fo:font-weight-complex" ) ] = USTR( "bold" ); + aFontProps[ "fo:font-weight" ] = "bold"; + aFontProps[ "fo:font-weight-asian" ] = "bold"; + aFontProps[ "fo:font-weight-complex" ] = "bold"; } // italic if( rFont.isItalic ) { - aFontProps[ USTR( "fo:font-style" ) ] = USTR( "italic" ); - aFontProps[ USTR( "fo:font-style-asian" ) ] = USTR( "italic" ); - aFontProps[ USTR( "fo:font-style-complex" ) ] = USTR( "italic" ); + aFontProps[ "fo:font-style" ] = "italic"; + aFontProps[ "fo:font-style-asian" ] = "italic"; + aFontProps[ "fo:font-style-complex" ] = "italic"; } // underline if( rFont.isUnderline ) { - aFontProps[ USTR( "style:text-underline-style" ) ] = USTR( "solid" ); - aFontProps[ USTR( "style:text-underline-width" ) ] = USTR( "auto" ); - aFontProps[ USTR( "style:text-underline-color" ) ] = USTR( "font-color" ); + aFontProps[ "style:text-underline-style" ] = "solid"; + aFontProps[ "style:text-underline-width" ] = "auto"; + aFontProps[ "style:text-underline-color" ] = "font-color"; } // outline if( rFont.isOutline ) { - aFontProps[ USTR( "style:text-outline" ) ] = USTR( "true" ); + aFontProps[ "style:text-outline" ] = "true"; } // size rtl::OUStringBuffer aBuf( 32 ); aBuf.append( rFont.size*72/PDFI_OUTDEV_RESOLUTION ); aBuf.appendAscii( "pt" ); rtl::OUString aFSize = aBuf.makeStringAndClear(); - aFontProps[ USTR( "fo:font-size" ) ] = aFSize; - aFontProps[ USTR( "style:font-size-asian" ) ] = aFSize; - aFontProps[ USTR( "style:font-size-complex" ) ] = aFSize; + aFontProps[ "fo:font-size" ] = aFSize; + aFontProps[ "style:font-size-asian" ] = aFSize; + aFontProps[ "style:font-size-complex" ] = aFSize; // color const GraphicsContext& rGC = m_rProcessor.getGraphicsContext( elem.GCId ); - aFontProps[ USTR( "fo:color" ) ] = getColorString( rFont.isOutline ? rGC.LineColor : rGC.FillColor ); + aFontProps[ "fo:color" ] = getColorString( rFont.isOutline ? rGC.LineColor : rGC.FillColor ); StyleContainer::Style aStyle( "style:style", aProps ); StyleContainer::Style aSubStyle( "style:text-properties", aFontProps ); @@ -969,7 +969,7 @@ void WriterXmlFinalizer::visit( ParagraphElement& elem, const std::list< Element (pPage && fabs( elem.x+elem.w/2 - (pPage->x + pPage->w/2) ) < delta) ) { bIsCenter = true; - aParaProps[ USTR( "fo:text-align" ) ] = USTR( "center" ); + aParaProps[ "fo:text-align" ] = "center"; } } if( ! bIsCenter && elem.x > p_x + p_w/10 ) @@ -978,7 +978,7 @@ void WriterXmlFinalizer::visit( ParagraphElement& elem, const std::list< Element rtl::OUStringBuffer aBuf( 32 ); aBuf.append( convPx2mm( elem.x - p_x ) ); aBuf.appendAscii( "mm" ); - aParaProps[ USTR( "fo:margin-left" ) ] = aBuf.makeStringAndClear(); + aParaProps[ "fo:margin-left" ] = aBuf.makeStringAndClear(); } // check whether to leave some space to next paragraph @@ -994,7 +994,7 @@ void WriterXmlFinalizer::visit( ParagraphElement& elem, const std::list< Element rtl::OUStringBuffer aBuf( 32 ); aBuf.append( convPx2mm( pNextPara->y - (elem.y+elem.h) ) ); aBuf.appendAscii( "mm" ); - aParaProps[ USTR( "fo:margin-bottom" ) ] = aBuf.makeStringAndClear(); + aParaProps[ "fo:margin-bottom" ] = aBuf.makeStringAndClear(); } } } @@ -1002,7 +1002,7 @@ void WriterXmlFinalizer::visit( ParagraphElement& elem, const std::list< Element if( ! aParaProps.empty() ) { PropertyMap aProps; - aProps[ USTR( "style:family" ) ] = USTR( "paragraph" ); + aProps[ "style:family" ] = "paragraph"; StyleContainer::Style aStyle( "style:style", aProps ); StyleContainer::Style aSubStyle( "style:paragraph-properties", aParaProps ); aStyle.SubStyles.push_back( &aSubStyle ); @@ -1015,12 +1015,12 @@ void WriterXmlFinalizer::visit( ParagraphElement& elem, const std::list< Element void WriterXmlFinalizer::visit( FrameElement& elem, const std::list< Element* >::const_iterator&) { PropertyMap aProps; - aProps[ USTR( "style:family" ) ] = USTR( "graphic" ); + aProps[ "style:family" ] = "graphic"; PropertyMap aGCProps; - aGCProps[ USTR("draw:stroke") ] = USTR("none"); - aGCProps[ USTR("draw:fill") ] = USTR("none"); + aGCProps[ "draw:stroke" ] = "none"; + aGCProps[ "draw:fill" ] = "none"; StyleContainer::Style aStyle( "style:style", aProps ); StyleContainer::Style aSubStyle( "style:graphic-properties", aGCProps ); @@ -1046,8 +1046,8 @@ void WriterXmlFinalizer::setFirstOnPage( ParagraphElement& rElem, aProps = *pProps; } - aProps[ USTR( "style:family" ) ] = USTR( "paragraph" ); - aProps[ USTR( "style:master-page-name" ) ] = rMasterPageName; + aProps[ "style:family" ] = "paragraph"; + aProps[ "style:master-page-name" ] = rMasterPageName; if( rElem.StyleId != -1 ) rElem.StyleId = rStyles.setProperties( rElem.StyleId, aProps ); @@ -1146,15 +1146,15 @@ void WriterXmlFinalizer::visit( PageElement& elem, const std::list< Element* >:: PropertyMap aPageProps; PropertyMap aPageLayoutProps; rtl::OUStringBuffer aBuf( 64 ); - aPageLayoutProps[ USTR( "fo:page-width" ) ] = unitMMString( page_width ); - aPageLayoutProps[ USTR( "fo:page-height" ) ] = unitMMString( page_height ); - aPageLayoutProps[ USTR( "style:print-orientation" ) ] - = elem.w < elem.h ? USTR( "portrait" ) : USTR( "landscape" ); - aPageLayoutProps[ USTR( "fo:margin-top" ) ] = unitMMString( top_margin ); - aPageLayoutProps[ USTR( "fo:margin-bottom" ) ] = unitMMString( bottom_margin ); - aPageLayoutProps[ USTR( "fo:margin-left" ) ] = unitMMString( left_margin ); - aPageLayoutProps[ USTR( "fo:margin-right" ) ] = unitMMString( right_margin ); - aPageLayoutProps[ USTR( "style:writing-mode" ) ]= USTR( "lr-tb" ); + aPageLayoutProps[ "fo:page-width" ] = unitMMString( page_width ); + aPageLayoutProps[ "fo:page-height" ] = unitMMString( page_height ); + aPageLayoutProps[ "style:print-orientation" ] + = elem.w < elem.h ? OUString("portrait") : OUString("landscape"); + aPageLayoutProps[ "fo:margin-top" ] = unitMMString( top_margin ); + aPageLayoutProps[ "fo:margin-bottom" ] = unitMMString( bottom_margin ); + aPageLayoutProps[ "fo:margin-left" ] = unitMMString( left_margin ); + aPageLayoutProps[ "fo:margin-right" ] = unitMMString( right_margin ); + aPageLayoutProps[ "style:writing-mode" ]= "lr-tb"; StyleContainer::Style aStyle( "style:page-layout", aPageProps); StyleContainer::Style aSubStyle( "style:page-layout-properties", aPageLayoutProps); @@ -1163,7 +1163,7 @@ void WriterXmlFinalizer::visit( PageElement& elem, const std::list< Element* >:: // create master page rtl::OUString aMasterPageLayoutName = m_rStyleContainer.getStyleName( nPageStyle ); - aPageProps[ USTR( "style:page-layout-name" ) ] = aMasterPageLayoutName; + aPageProps[ "style:page-layout-name" ] = aMasterPageLayoutName; StyleContainer::Style aMPStyle( "style:master-page", aPageProps ); StyleContainer::Style aHeaderStyle( "style:header", PropertyMap() ); StyleContainer::Style aFooterStyle( "style:footer", PropertyMap() ); -- cgit