ooo-build r12504 - in branches/ooo-build-2-4: . patches/src680



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

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



Modified:
   branches/ooo-build-2-4/ChangeLog
   branches/ooo-build-2-4/patches/src680/svg-import-filter.diff

Modified: branches/ooo-build-2-4/patches/src680/svg-import-filter.diff
==============================================================================
--- branches/ooo-build-2-4/patches/src680/svg-import-filter.diff	(original)
+++ branches/ooo-build-2-4/patches/src680/svg-import-filter.diff	Fri May  9 13:24:16 2008
@@ -1794,7 +1794,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
@@ -2006,7 +2006,7 @@
 +	    	              maCurrState.maCTM.get(1,2));
 +        
 +    	    	// if necessary, serialize to automatic-style section
-+        		writeStyle(xElem);
++        		writeStyle(xElem,nTagId);
 +			}
 +		}	
 +    }
@@ -2047,7 +2047,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() );
@@ -2085,7 +2085,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"));
@@ -2108,6 +2108,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") );
@@ -2116,7 +2131,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() && 
@@ -2135,14 +2150,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;
@@ -2800,20 +2815,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]