officecfg/registry/schema/org/openoffice/Office/Impress.xcs        |   11 +--
 sd/source/core/sdpage.cxx                                          |   31 
+++++-----
 sd/xml/layoutlist.xml                                              |    4 -
 test/user-template/user/config/soffice.cfg/simpress/layoutlist.xml |    8 ++
 4 files changed, 31 insertions(+), 23 deletions(-)

New commits:
commit d5a552ee01d491e85b76dbb9c373a019ce18a06a
Author: Vishv Brahmbhatt <vishvbrahmbhat...@gmail.com>
Date:   Fri Jul 5 19:25:28 2013 +0530

    Working version of XML parser from configuration file path
    
    Added some changes in the "getRootElement" and new "layoutlist.xml" is 
added for "unit-test" module.
    XML parser works perfectly in the installation,only the failure of 
"unit-test" is left to be solved.
    Some refactoring related to "layoutlist.xml" will be updated soon.
    
    Change-Id: If7ed3af40e9b6df26e20881728181eb6c82936d8

diff --git a/officecfg/registry/schema/org/openoffice/Office/Impress.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Impress.xcs
index fcb0e74..61c7cab1 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Impress.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Impress.xcs
@@ -468,20 +468,19 @@
           <label>List of files containing object effects</label>
         </info>
         <value 
oor:separator=";">vnd.sun.star.expand:$BRAND_BASE_DIR/share/config/soffice.cfg/simpress/effects.xml</value>
+      </prop>
       <prop oor:name="LayoutListFiles" oor:type="oor:string-list" 
oor:nillable="false">
-        <!-- OldPath: -->
-        <!-- OldLocation: -->
-        <!-- UIHints: List of files containing object effects -->
         <info>
           <desc>
-            Contains a list of layout type.It contains 
+            Contains a list of layout type.It contains
             properties of presobj like their Position,
-            Height and Width
+            Height and Width.Values are put through
+            macro expansion, so, vnd.sun.star.expand prefix
+            is allowed.
           </desc>
           <label>List of files containing list of layouts</label>
         </info>
         <value 
oor:separator=";">vnd.sun.star.expand:$BRAND_BASE_DIR/share/config/soffice.cfg/simpress/layoutlist.xml</value>
-      </prop>        
       </prop>
       <prop oor:name="PreviewNewEffects" oor:type="xs:boolean" 
oor:nillable="false">
         <!-- OldPath: -->
diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index 1bcda69..96961a0 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -66,6 +66,7 @@
 #include <unotools/streamwrap.hxx>
 #include <rtl/uri.hxx>
 #include <unotools/ucbstreamhelper.hxx>
+#include <osl/file.h>
 
 #include "../ui/inc/DrawDocShell.hxx"
 #include "Outliner.hxx"
@@ -1192,12 +1193,11 @@ static const LayoutDescriptor& GetLayoutDescriptor( 
AutoLayout eLayout )
 //to get the root element of the xml file
 Reference<XElement> getRootElement()
 {
-    rtl::OUString filepath="/home/vishv/layoutlist.xml";
     const Reference<css::uno::XComponentContext> 
xContext(comphelper_getProcessComponentContext());
     Reference< XMultiServiceFactory > 
xServiceFactory(xContext->getServiceManager(), UNO_QUERY_THROW );
     Reference< util::XMacroExpander > xMacroExpander 
=util::theMacroExpander::get(xContext);
     Reference< XMultiServiceFactory > xConfigProvider 
=configuration::theDefaultProvider::get( xContext );
-       // read path to transition effects files from config
+
     Any propValue = uno::makeAny(
         beans::PropertyValue(
             "nodepath", -1,
@@ -1208,31 +1208,32 @@ Reference<XElement> getRootElement()
         xConfigProvider->createInstanceWithArguments(
             "com.sun.star.configuration.ConfigurationAccess",
             Sequence<Any>( &propValue, 1 ) ), UNO_QUERY_THROW );
-    uno::Sequence< OUString > aFiles;
+    Sequence< rtl::OUString > aFiles;
     xNameAccess->getByName( "LayoutListFiles" ) >>= aFiles;
-
+    rtl::OUString aURL;
     for( sal_Int32 i=0; i<aFiles.getLength(); ++i )
     {
-        OUString aURL = aFiles[i];
+        aURL = aFiles[i];
         if( aURL.startsWith( EXPAND_PROTOCOL ) )
         {
             // cut protocol
-            OUString aMacro( aURL.copy( sizeof ( EXPAND_PROTOCOL ) -1 ) );
+            rtl::OUString aMacro( aURL.copy( sizeof ( EXPAND_PROTOCOL ) -1 ) );
             // decode uric class chars
             aMacro = rtl::Uri::decode( aMacro, rtl_UriDecodeWithCharset, 
RTL_TEXTENCODING_UTF8 );
             // expand macro string
             aURL = xMacroExpander->expandMacros( aMacro );
         }
-        SvStream*   pIStm = ::utl::UcbStreamHelper::CreateStream( aURL, 
STREAM_READ );
-        ::utl::OInputStreamWrapper* isw=new ::utl::OInputStreamWrapper( pIStm);
-        Reference<XInputStream> xIs(isw);
-
-        rtl::OUString sServName = 
rtl::OUString::createFromAscii("com.sun.star.xml.dom.DocumentBuilder");
-        Reference<XDocumentBuilder> xDb( 
xServiceFactory->createInstance(sServName), UNO_QUERY);
-        const Reference<XDocument> xDom(xDb->parse(xIs), UNO_QUERY_THROW );
-        const Reference<XElement> xRoot( 
xDom->getDocumentElement(),UNO_QUERY_THROW );
-        return xRoot;//this loops seems to work only once,so temporary 
returning the root element
     }
+    if( aURL.startsWith( "file://" ) )
+    {
+        rtl::OUString aSysPath;
+        if( osl_getSystemPathFromFileURL( aURL.pData, &aSysPath.pData ) == 
osl_File_E_None )
+            aURL = aSysPath;
+    }
+    const Reference<XDocumentBuilder> 
xDocBuilder(css::xml::dom::DocumentBuilder::create(comphelper::getComponentContext(xServiceFactory)));
+    const Reference<XDocument> xDoc = xDocBuilder->parseURI(aURL);
+    const Reference<XElement> xRoot = xDoc->getDocumentElement();
+    return xRoot;//this loops seems to work only once,so temporary returning 
the root element
 }
 
 //read the information from XML file(traversing from layout node)
diff --git a/sd/xml/layoutlist.xml b/sd/xml/layoutlist.xml
index 0b1e9d9..61b863d 100644
--- a/sd/xml/layoutlist.xml
+++ b/sd/xml/layoutlist.xml
@@ -1,8 +1,8 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0"?>
 <!-- At present I am not sure about corect XML namespace,so once I am aware of 
it.I am ready to add it.
 -->
 <layout-list>
 <layout type="AUTOLAYOUT_TITLE_CONTENT"><presobj kind="PRESOBJ_TITLE" 
layout-pos-x="1400" layout-pos-y="837" layout-size-height="4400" 
layout-size-width="25600"/><presobj kind="PRESOBJ_OUTLINE1" layout-pos-x="1400" 
layout-pos-y="4914" layout-size-height="25200" 
layout-size-width="12180"/></layout>
 <layout type="AUTOLAYOUT_TITLE_2VTEXT"><presobj kind="PRESOBJ_TITLE" 
layout-pos-x="1400" layout-pos-y="837" layout-size-height="4400" 
layout-size-width="25600"/><presobj kind="PRESOBJ_OUTLINE1" layout-pos-x="1400" 
layout-pos-y="4914" layout-size-height="12297" 
layout-size-width="12180"/><presobj kind="PRESOBJ_OUTLINE2" 
layout-pos-x="14311" layout-pos-y="4914" layout-size-height="12297" 
layout-size-width="12180"/></layout>
 <layout type="AUTOLAYOUT_TITLE_CONTENT_OVER_CONTENT"><presobj 
kind="PRESOBJ_TITLE" layout-pos-x="1400" layout-pos-y="837" 
layout-size-height="4400" layout-size-width="25600"/><presobj 
kind="PRESOBJ_OUTLINE1" layout-pos-x="1400" layout-pos-y="4914" 
layout-size-height="25200" layout-size-width="5809"/><presobj 
kind="PRESOBJ_OUTLINE2" layout-pos-x="1400" layout-pos-y="11274" 
layout-size-height="25200" layout-size-width="5809"/></layout>
-</layout-list>
+</layout-list>
\ No newline at end of file
diff --git a/test/user-template/user/config/soffice.cfg/simpress/layoutlist.xml 
b/test/user-template/user/config/soffice.cfg/simpress/layoutlist.xml
new file mode 100644
index 0000000..61b863d
--- /dev/null
+++ b/test/user-template/user/config/soffice.cfg/simpress/layoutlist.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<!-- At present I am not sure about corect XML namespace,so once I am aware of 
it.I am ready to add it.
+-->
+<layout-list>
+<layout type="AUTOLAYOUT_TITLE_CONTENT"><presobj kind="PRESOBJ_TITLE" 
layout-pos-x="1400" layout-pos-y="837" layout-size-height="4400" 
layout-size-width="25600"/><presobj kind="PRESOBJ_OUTLINE1" layout-pos-x="1400" 
layout-pos-y="4914" layout-size-height="25200" 
layout-size-width="12180"/></layout>
+<layout type="AUTOLAYOUT_TITLE_2VTEXT"><presobj kind="PRESOBJ_TITLE" 
layout-pos-x="1400" layout-pos-y="837" layout-size-height="4400" 
layout-size-width="25600"/><presobj kind="PRESOBJ_OUTLINE1" layout-pos-x="1400" 
layout-pos-y="4914" layout-size-height="12297" 
layout-size-width="12180"/><presobj kind="PRESOBJ_OUTLINE2" 
layout-pos-x="14311" layout-pos-y="4914" layout-size-height="12297" 
layout-size-width="12180"/></layout>
+<layout type="AUTOLAYOUT_TITLE_CONTENT_OVER_CONTENT"><presobj 
kind="PRESOBJ_TITLE" layout-pos-x="1400" layout-pos-y="837" 
layout-size-height="4400" layout-size-width="25600"/><presobj 
kind="PRESOBJ_OUTLINE1" layout-pos-x="1400" layout-pos-y="4914" 
layout-size-height="25200" layout-size-width="5809"/><presobj 
kind="PRESOBJ_OUTLINE2" layout-pos-x="1400" layout-pos-y="11274" 
layout-size-height="25200" layout-size-width="5809"/></layout>
+</layout-list>
\ No newline at end of file
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to