Tag: cws_src680_hsqlcsv
User: fs      
Date: 2006/10/30 03:06:10

Modified:
   dba/dbaccess/source/ext/hsqlui/linkedtableeditor.cxx

Log:
 initialize the 'relative path' setting

File Changes:

Directory: /dba/dbaccess/source/ext/hsqlui/
===========================================

File [changed]: linkedtableeditor.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ext/hsqlui/linkedtableeditor.cxx?r1=1.1.2.1&r2=1.1.2.2
Delta lines:  +52 -2
--------------------
--- linkedtableeditor.cxx       23 Oct 2006 07:21:50 -0000      1.1.2.1
+++ linkedtableeditor.cxx       30 Oct 2006 11:06:07 -0000      1.1.2.2
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: linkedtableeditor.cxx,v $
  *
- *  $Revision: 1.1.2.1 $
+ *  $Revision: 1.1.2.2 $
  *
- *  last change: $Author: fs $ $Date: 2006/10/23 07:21:50 $
+ *  last change: $Author: fs $ $Date: 2006/10/30 11:06:07 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -302,10 +302,60 @@
     }
 
     //=========================================================================
+    //= RelativePathSetting
+    //=========================================================================
+    class RelativePathSetting : public TableSettingPersistence
+    {
+    public:
+        RelativePathSetting( TextTableSettings& _rSettings, SlotId _nSlotId )
+            :TableSettingPersistence( _rSettings, _nSlotId )
+        {
+        }
+
+    public:
+        // IItemPersistence overridables
+        virtual void    storeItemValue( const SfxPoolItem& _rItem );
+        virtual void    loadItemValue( SfxItemSet& _rSet );
+    };
+
+    //-------------------------------------------------------------------------
+    void RelativePathSetting::storeItemValue( const SfxPoolItem& _rItem )
+    {
+        OSL_ENSURE( false, "RelativePathSetting::storeItemValue: not 
implemented, yet." );
+        // TODO
+    }
+
+    //-------------------------------------------------------------------------
+    void RelativePathSetting::loadItemValue( SfxItemSet& _rSet )
+    {
+        // the complete (already-resolved) file path
+        String sFilePath = getSettings().getFilePath();
+        // the file path as denoted in the options string
+        String sDefinition( getSettings().getDefinition() );
+        String sDefinedPath = sDefinition.GetToken( 0, ';' );
+
+        xub_StrLen nFilePathLen = sFilePath.Len();
+        xub_StrLen nDefinedPathLen = sDefinedPath.Len();
+
+        bool bIsAbsolutePath = ( nFilePathLen == nDefinedPathLen );
+
+        OSL_ENSURE( ( nFilePathLen >= nDefinedPathLen )
+                &&  ( sFilePath.Copy( nFilePathLen - nDefinedPathLen 
).ToUpperAscii() == sDefinedPath.ToUpperAscii() ),
+                "RelativePathSetting::loadItemValue: inconsistent file path 
settings!" );
+        // either, both the file path in the definition string and the one 
returned in getFilePath
+        // are absolute - in this case they should be identical.
+        // Or, the former is relative - in this case, the latter should end 
with the former.
+        // (the ToUpperAscii() is a large cudgel for driver letters being 
different-case on Windows, possibly.)
+
+        _rSet.Put( SfxBoolItem( getSlotId(), !bIsAbsolutePath ) );
+    }
+
+    //=========================================================================
     void lcl_createItemPersistences( TextTableSettings& _rSettings, 
ItemPersistenceArray& _rAll )
     {
         _rAll.clear();
         _rAll.push_back( PItemPersistence( new StringTableSetting ( 
_rSettings, LSID_FILE_PATH,       &TextTableSettings::getFilePath, 
&TextTableSettings::setFilePath ) ) );
+        _rAll.push_back( PItemPersistence( new RelativePathSetting( 
_rSettings, LSID_RELATIVE_PATH ) ) );
         _rAll.push_back( PItemPersistence( new BooleanTableSetting( 
_rSettings, LSID_HEADER_LINE,     &TextTableSettings::getIgnoreFirstLine, 
&TextTableSettings::setIgnoreFirstLine ) ) );
         _rAll.push_back( PItemPersistence( new TextEncodingSetting( 
_rSettings, LSID_ENCODING ) ) );
         _rAll.push_back( PItemPersistence( new StringTableSetting ( 
_rSettings, LSID_FIELD_SEPARATOR, &TextTableSettings::getFieldSeparator, 
&TextTableSettings::setFieldSeparator) ) );




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to