ooo-build r12503 - in trunk: . patches/dev300



Author: thorstenb
Date: Fri May  9 13:21:03 2008
New Revision: 12503
URL: http://svn.gnome.org/viewvc/ooo-build?rev=12503&view=rev

Log:
	* patches/dev300/svg-import-filter.diff: fixed svg text import -
	text boxes should now adapt to content size



Modified:
   trunk/ChangeLog
   trunk/patches/dev300/svg-import-filter.diff

Modified: trunk/patches/dev300/svg-import-filter.diff
==============================================================================
--- trunk/patches/dev300/svg-import-filter.diff	(original)
+++ trunk/patches/dev300/svg-import-filter.diff	Fri May  9 13:21:03 2008
@@ -1788,7 +1788,7 @@
      
 --- filter/source/svg/svgreader.cxx	1970-01-01 01:00:00.000000000 +0100
 +++ filter/source/svg/svgreader.cxx	2008-04-11 09:33:30.000000000 +0200
-@@ -0,0 +1,1499 @@
+@@ -0,0 +1,1516 @@
 +/*************************************************************************
 + *
 + *    OpenOffice.org - a multi-platform office productivity suite
@@ -2000,7 +2000,7 @@
 +	    	              maCurrState.maCTM.get(1,2));
 +        
 +    	    	// if necessary, serialize to automatic-style section
-+        		writeStyle(xElem);
++        		writeStyle(xElem,nTagId);
 +			}
 +		}	
 +    }
@@ -2041,7 +2041,7 @@
 +        return aBuf.makeStringAndClear();
 +    }
 +
-+    bool writeStyle(const State& rState)
++    bool writeStyle(const State& rState, sal_Int32 nTagId)
 +    {
 +        rtl::Reference<SvXMLAttributeList> xAttrs( new SvXMLAttributeList() );
 +        uno::Reference<xml::sax::XAttributeList> xUnoAttrs( xAttrs.get() );
@@ -2079,7 +2079,7 @@
 +        if( rState.meStrokeType != NONE )
 +        {
 +            xAttrs->AddAttribute( USTR( "draw:stroke" ), USTR("solid"));
-+            xAttrs->AddAttribute( USTR( "draw:stroke-color" ), getOdfColor(rState.maStrokeColor));
++            xAttrs->AddAttribute( USTR( "svg:stroke-color" ), getOdfColor(rState.maStrokeColor));
 +        }
 +        else
 +            xAttrs->AddAttribute( USTR( "draw:stroke" ), USTR("none"));
@@ -2102,6 +2102,21 @@
 +            xAttrs->AddAttribute( USTR( "draw:stroke-linejoin"), USTR("bevel"));
 +        if( maCurrState.mnStrokeOpacity != 1.0 )
 +            xAttrs->AddAttribute( USTR("svg:stroke-opacity"), rtl::OUString::valueOf(maCurrState.mnStrokeOpacity));
++
++        // beef up text box style with some auto-magic
++        if( nTagId == XML_TEXT )
++        {
++            xAttrs->AddAttribute( USTR( "draw:auto-grow-height"), USTR("true"));
++            xAttrs->AddAttribute( USTR( "draw:auto-grow-width"), USTR("true"));
++            xAttrs->AddAttribute( USTR( "draw:textarea-horizontal-align"), USTR("left"));
++            xAttrs->AddAttribute( USTR( "textarea-vertical-align"), USTR("top"));
++            xAttrs->AddAttribute( USTR( "fo:padding-top"), USTR("0cm"));
++            xAttrs->AddAttribute( USTR( "fo:padding-top"), USTR("0cm"));
++            xAttrs->AddAttribute( USTR( "fo:padding-left"), USTR("0cm"));
++            xAttrs->AddAttribute( USTR( "fo:padding-right"), USTR("0cm"));
++            xAttrs->AddAttribute( USTR( "fo:padding-bottom"), USTR("0cm"));
++        }
++
 +        mxDocumentHandler->startElement( USTR("style:graphic-properties"), 
 +                                         xUnoAttrs );
 +        mxDocumentHandler->endElement( USTR("style:graphic-properties") );
@@ -2110,7 +2125,7 @@
 +        return true; // newly written
 +    }
 +
-+    void writeStyle(const uno::Reference<xml::dom::XElement>& xElem)
++    void writeStyle(const uno::Reference<xml::dom::XElement>& xElem, sal_Int32 nTagId)
 +    {
 +        sal_Int32 nEmulatedStyleId=0;
 +        if( maCurrState.maDashArray.size() && 
@@ -2129,14 +2144,14 @@
 +            aEmulatedStrokeState.meFillRule = EVEN_ODD;
 +            aEmulatedStrokeState.meStrokeType = NONE;
 +
-+            if( writeStyle(aEmulatedStrokeState) )
++            if( writeStyle(aEmulatedStrokeState,nTagId) )
 +                nEmulatedStyleId = mnCurrStateId;
 +            else
 +                nEmulatedStyleId = mrStates.find(aEmulatedStrokeState)->mnStyleId;
 +        }
 +
 +        sal_Int32 nStyleId=0;
-+        if( writeStyle(maCurrState) )
++        if( writeStyle(maCurrState,nTagId) )
 +            nStyleId = mnCurrStateId;
 +        else
 +            nStyleId = mrStates.find(maCurrState)->mnStyleId;
@@ -2794,20 +2809,22 @@
 +                xAttrs->Clear();
 +                xAttrs->AddAttribute( USTR( "svg:x" ), rtl::OUString::valueOf(x/100.0)+USTR("mm"));
 +                xAttrs->AddAttribute( USTR( "svg:y" ), rtl::OUString::valueOf(y/100.0)+USTR("mm"));
-+                xAttrs->AddAttribute( USTR( "svg:width" ), rtl::OUString::valueOf(width/100.0)+USTR("mm"));
-+                xAttrs->AddAttribute( USTR( "svg:height" ), rtl::OUString::valueOf(height/100.0)+USTR("mm"));
++#if 0
++                xAttrs->AddAttribute( USTR( "svg:width" ), rtl::OUString::valueOf(std::max(10.0,width/100.0))+USTR("mm"));
++                xAttrs->AddAttribute( USTR( "svg:height" ), rtl::OUString::valueOf(std::max(10.0,height/100.0))+USTR("mm"));
++#else
++                xAttrs->AddAttribute( USTR( "svg:width" ), USTR("100mm"));
++                xAttrs->AddAttribute( USTR( "svg:height" ), USTR("100mm"));
++#endif
++                xAttrs->AddAttribute( USTR( "draw:style-name" ), USTR("svggraphicstyle")+sStyleId );
 +
 +                mxDocumentHandler->startElement(USTR("draw:frame"),xUnoAttrs);
 +
 +                xAttrs->Clear();
 +                mxDocumentHandler->startElement(USTR("draw:text-box"),xUnoAttrs);
-+                mxDocumentHandler->startElement(USTR("text:p"),xUnoAttrs);
 +                // TODO: put text style in here
-+                mxDocumentHandler->startElement(USTR("text:span"),xUnoAttrs);
-+
++                mxDocumentHandler->startElement(USTR("text:p"),xUnoAttrs);
 +                mxDocumentHandler->characters(sText.makeStringAndClear());
-+
-+                mxDocumentHandler->endElement(USTR("text:span"));
 +                mxDocumentHandler->endElement(USTR("text:p"));
 +                mxDocumentHandler->endElement(USTR("draw:text-box"));
 +                mxDocumentHandler->endElement(USTR("draw:frame"));



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]