Hi Mikhail,

Here I created a bunch of patches for the fix of i41881. As I understand, the implementations in derive classes should pass template format IDs to the second parameter of FillClass, and let SotExchange::GetFormatDataFlavor in SfxObjectShell::SetupStorage do the rest of the work? Please correct me if I did not get your idea right.

Thanks and Best Regards,
Felix.
Index: basctl/source/basicide/basdoc.cxx
===================================================================
RCS file: /cvs/script/basctl/source/basicide/basdoc.cxx,v
retrieving revision 1.21
diff -u -p -r1.21 basdoc.cxx
--- basctl/source/basicide/basdoc.cxx   11 Apr 2008 10:32:11 -0000      1.21
+++ basctl/source/basicide/basdoc.cxx   7 Jul 2008 08:54:49 -0000
@@ -134,8 +134,10 @@ void BasicDocShell::FillStatusBar( Statu
 
 }
 
-void BasicDocShell::FillClass( SvGlobalName*, sal_uInt32*, String*, String*, 
String*, sal_Int32) const
-{}
+void BasicDocShell::FillClass( SvGlobalName*, sal_uInt32*, String*, String*, 
String*, sal_Int32, sal_Bool bTemplate) const
+{
+    DBG_ASSERT( bTemplate == sal_False, "No template for Basic" );
+}
 
 void BasicDocShell::Draw( OutputDevice *, const JobSetup &, USHORT )
 {}
Index: basctl/source/basicide/basdoc.hxx
===================================================================
RCS file: /cvs/script/basctl/source/basicide/basdoc.hxx,v
retrieving revision 1.8
diff -u -p -r1.8 basdoc.hxx
--- basctl/source/basicide/basdoc.hxx   11 Apr 2008 10:32:28 -0000      1.8
+++ basctl/source/basicide/basdoc.hxx   7 Jul 2008 08:54:49 -0000
@@ -50,7 +50,8 @@ protected:
                                                           String * pAppName,
                                                           String * 
pFullTypeName,
                                String * pShortTypeName,
-                                                          sal_Int32 nVersion ) 
const;
+                               sal_Int32 nVersion,
+                               sal_Bool bTemplate = sal_False ) const;
 
 public:
                                                TYPEINFO();
Index: sc/source/ui/docshell/docsh.cxx
===================================================================
RCS file: /cvs/sc/sc/source/ui/docshell/docsh.cxx,v
retrieving revision 1.100
diff -u -p -r1.100 docsh.cxx
--- sc/source/ui/docshell/docsh.cxx     15 Apr 2008 14:12:23 -0000      1.100
+++ sc/source/ui/docshell/docsh.cxx     7 Jul 2008 09:07:20 -0000
@@ -192,7 +192,8 @@ void __EXPORT ScDocShell::FillClass( SvG
                                         String* /* pAppName */,
                                                                                
String* pFullTypeName,
                                                                                
String* pShortTypeName,
-                                                                               
sal_Int32 nFileFormat ) const
+                                        sal_Int32 nFileFormat,
+                                        sal_Bool bTemplate /* = sal_False */) 
const
 {
        if ( nFileFormat == SOFFICE_FILEFORMAT_60 )
        {
@@ -204,7 +205,7 @@ void __EXPORT ScDocShell::FillClass( SvG
        else if ( nFileFormat == SOFFICE_FILEFORMAT_8 )
        {
                *pClassName             = SvGlobalName( SO3_SC_CLASSID_60 );
-               *pFormat                = SOT_FORMATSTR_ID_STARCALC_8;
+        *pFormat               = bTemplate ? 
SOT_FORMATSTR_ID_STARCALC_8_TEMPLATE : SOT_FORMATSTR_ID_STARCALC_8;
                *pFullTypeName  = String( RTL_CONSTASCII_USTRINGPARAM("calc8") 
);
                *pShortTypeName = String( ScResId( SCSTR_SHORT_SCDOC_NAME ) );
        }
Index: sc/source/ui/inc/docsh.hxx
===================================================================
RCS file: /cvs/sc/sc/source/ui/inc/docsh.hxx,v
retrieving revision 1.50
diff -u -p -r1.50 docsh.hxx
--- sc/source/ui/inc/docsh.hxx  15 Apr 2008 14:34:04 -0000      1.50
+++ sc/source/ui/inc/docsh.hxx  7 Jul 2008 09:07:21 -0000
@@ -189,7 +189,8 @@ public:
                                                           String * pAppName,
                                                           String * 
pFullTypeName,
                                                           String * 
pShortTypeName,
-                                                          sal_Int32 
nFileFormat ) const;
+                                                          sal_Int32 
nFileFormat,
+                               sal_Bool bTemplate = sal_False ) const;
 
     virtual BOOL    InitNew( const ::com::sun::star::uno::Reference< 
::com::sun::star::embed::XStorage >& );
     virtual BOOL    Load( SfxMedium& rMedium );
Index: sd/source/ui/docshell/docshel4.cxx
===================================================================
RCS file: /cvs/graphics/sd/source/ui/docshell/docshel4.cxx,v
retrieving revision 1.80
diff -u -p -r1.80 docshel4.cxx
--- sd/source/ui/docshell/docshel4.cxx  10 Apr 2008 19:59:27 -0000      1.80
+++ sd/source/ui/docshell/docshel4.cxx  8 Jul 2008 03:08:54 -0000
@@ -945,7 +945,8 @@ void DrawDocShell::FillClass(SvGlobalNam
                                                                                
String* ,
                                                                                
String* pFullTypeName,
                                         String* pShortTypeName,
-                                                                               
sal_Int32 nFileFormat ) const
+                                                                               
sal_Int32 nFileFormat,
+                                                                               
sal_Bool bTemplate /* = sal_False */) const
 {
        if (nFileFormat == SOFFICE_FILEFORMAT_60)
        {
@@ -967,13 +968,13 @@ void DrawDocShell::FillClass(SvGlobalNam
         if ( meDocType == DOCUMENT_TYPE_DRAW )
         {
                 *pClassName = SvGlobalName(SO3_SDRAW_CLASSID_60);
-                *pFormat = SOT_FORMATSTR_ID_STARDRAW_8;
+                *pFormat = bTemplate ? SOT_FORMATSTR_ID_STARDRAW_8_TEMPLATE ? 
SOT_FORMATSTR_ID_STARDRAW_8;
                 *pFullTypeName = String(RTL_CONSTASCII_USTRINGPARAM("Draw 
8"));        // HACK: method will be removed with new storage API
         }
         else
         {
                 *pClassName = SvGlobalName(SO3_SIMPRESS_CLASSID_60);
-                *pFormat = SOT_FORMATSTR_ID_STARIMPRESS_8;
+                *pFormat = bTemplate ? SOT_FORMATSTR_ID_STARIMPRESS_8_TEMPLATE 
: SOT_FORMATSTR_ID_STARIMPRESS_8;
                 *pFullTypeName = String(RTL_CONSTASCII_USTRINGPARAM("Impress 
8")); // HACK: method will be removed with new storage API
         }
        }
Index: sd/source/ui/inc/DrawDocShell.hxx
===================================================================
RCS file: /cvs/graphics/sd/source/ui/inc/DrawDocShell.hxx,v
retrieving revision 1.17
diff -u -p -r1.17 DrawDocShell.hxx
--- sd/source/ui/inc/DrawDocShell.hxx   10 Apr 2008 20:39:11 -0000      1.17
+++ sd/source/ui/inc/DrawDocShell.hxx   8 Jul 2008 03:08:54 -0000
@@ -106,7 +106,7 @@ public:
        virtual SfxStyleSheetBasePool* GetStyleSheetPool();
        virtual void            SetOrganizerSearchMask(SfxStyleSheetBasePool* 
pBasePool) const;
        virtual Size            GetFirstPageSize();
-    virtual void            FillClass(SvGlobalName* pClassName, sal_uInt32*  
pFormat, String* pAppName, String* pFullTypeName, String* pShortTypeName, 
sal_Int32 nFileFormat ) const;
+    virtual void            FillClass(SvGlobalName* pClassName, sal_uInt32*  
pFormat, String* pAppName, String* pFullTypeName, String* pShortTypeName, 
sal_Int32 nFileFormat, sal_Bool bTemplate = sal_False ) const;
        virtual void            SetModified( BOOL = TRUE );
 
        using SotObject::GetInterface;
Index: sfx2/inc/sfx2/objsh.hxx
===================================================================
RCS file: /cvs/framework/sfx2/inc/sfx2/objsh.hxx,v
retrieving revision 1.14
diff -u -p -r1.14 objsh.hxx
--- sfx2/inc/sfx2/objsh.hxx     20 May 2008 18:57:30 -0000      1.14
+++ sfx2/inc/sfx2/objsh.hxx     8 Jul 2008 02:35:51 -0000
@@ -695,7 +695,8 @@ public:
                                                           String * pAppName,
                                                           String * 
pFullTypeName,
                                                           String * 
pShortTypeName,
-                                                          sal_Int32 nVersion ) 
const = 0;
+                                                          sal_Int32 nVersion,
+                                                          sal_Bool bTemplate ) 
const = 0;
 
        // =================================
 
Index: sfx2/source/doc/objstor.cxx
===================================================================
RCS file: /cvs/framework/sfx2/source/doc/objstor.cxx,v
retrieving revision 1.212
diff -u -p -r1.212 objstor.cxx
--- sfx2/source/doc/objstor.cxx 28 May 2008 13:07:23 -0000      1.212
+++ sfx2/source/doc/objstor.cxx 8 Jul 2008 02:35:56 -0000
@@ -335,7 +335,7 @@ void SfxObjectShell::SetupStorage( const
                String aFullTypeName, aShortTypeName, aAppName;
         sal_uInt32 nClipFormat=0;
 
-        FillClass( &aName, &nClipFormat, &aAppName, &aFullTypeName, 
&aShortTypeName, nVersion );
+        FillClass( &aName, &nClipFormat, &aAppName, &aFullTypeName, 
&aShortTypeName, nVersion, bTemplate );
         if ( nClipFormat )
         {
             // basic doesn't have a ClipFormat
@@ -345,23 +345,6 @@ void SfxObjectShell::SetupStorage( const
             SotExchange::GetFormatDataFlavor( nClipFormat, aDataFlavor );
             if ( aDataFlavor.MimeType.getLength() )
             {
-                           if ( bTemplate )
-                           {
-                                   // TODO/LATER: this is a temporary solution 
for BETA to avoid incompatible change
-                                   if ( aDataFlavor.MimeType.equals( 
MIMETYPE_OASIS_OPENDOCUMENT_TEXT ) )
-                                           aDataFlavor.MimeType = 
MIMETYPE_OASIS_OPENDOCUMENT_TEXT_TEMPLATE;
-                                   else if ( aDataFlavor.MimeType.equals( 
MIMETYPE_OASIS_OPENDOCUMENT_DRAWING ) )
-                                           aDataFlavor.MimeType = 
MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_TEMPLATE;
-                                   else if ( aDataFlavor.MimeType.equals( 
MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION ) )
-                                           aDataFlavor.MimeType = 
MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_TEMPLATE;
-                                   else if ( aDataFlavor.MimeType.equals( 
MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET ) )
-                                           aDataFlavor.MimeType = 
MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_TEMPLATE;
-                                   else if ( aDataFlavor.MimeType.equals( 
MIMETYPE_OASIS_OPENDOCUMENT_CHART ) )
-                                           aDataFlavor.MimeType = 
MIMETYPE_OASIS_OPENDOCUMENT_CHART_TEMPLATE;
-                                   else if ( aDataFlavor.MimeType.equals( 
MIMETYPE_OASIS_OPENDOCUMENT_FORMULA ) )
-                                           aDataFlavor.MimeType = 
MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_TEMPLATE;
-                           }
-
                 try
                 {
                     xProps->setPropertyValue( 
::rtl::OUString::createFromAscii( "MediaType" ), uno::makeAny( 
aDataFlavor.MimeType ) );
Index: starmath/inc/document.hxx
===================================================================
RCS file: /cvs/sw/starmath/inc/document.hxx,v
retrieving revision 1.35
diff -u -p -r1.35 document.hxx
--- starmath/inc/document.hxx   10 Apr 2008 12:32:51 -0000      1.35
+++ starmath/inc/document.hxx   7 Jul 2008 09:09:07 -0000
@@ -142,7 +142,8 @@ class SmDocShell : public SfxObjectShell
                                                                  String* 
pAppName,
                                                                  String* 
pFullTypeName,
                                   String* pShortTypeName,
-                                                                 sal_Int32 
nFileFormat ) const;
+                                  sal_Int32 nFileFormat,
+                                  sal_Bool bTemplate = sal_False ) const;
 
        virtual BOOL            SetData( const String& rData );
        virtual ULONG           GetMiscStatus() const;
Index: starmath/source/document.cxx
===================================================================
RCS file: /cvs/sw/starmath/source/document.cxx,v
retrieving revision 1.94
diff -u -p -r1.94 document.cxx
--- starmath/source/document.cxx        10 Apr 2008 12:42:40 -0000      1.94
+++ starmath/source/document.cxx        7 Jul 2008 09:09:07 -0000
@@ -1351,7 +1351,8 @@ void SmDocShell::FillClass(SvGlobalName*
                            String* /*pAppName*/,
                                                   String* pFullTypeName,
                            String* pShortTypeName,
-                                                  sal_Int32 nFileFormat ) const
+                           sal_Int32 nFileFormat,
+                           sal_Bool bTemplate /* = sal_False */) const
 {
     RTL_LOGFILE_CONTEXT( aLog, "starmath: SmDocShell::FillClass" );
 
@@ -1365,7 +1366,7 @@ void SmDocShell::FillClass(SvGlobalName*
        else if (nFileFormat == SOFFICE_FILEFORMAT_8 )
        {
                *pClassName     = SvGlobalName(SO3_SM_CLASSID_60);
-               *pFormat                = SOT_FORMATSTR_ID_STARMATH_8;
+        *pFormat               = bTemplate ? 
SOT_FORMATSTR_ID_STARMATH_8_TEMPLATE : SOT_FORMATSTR_ID_STARMATH_8;
         *pFullTypeName  = String(SmResId(STR_MATH_DOCUMENT_FULLTYPE_CURRENT));
                *pShortTypeName = String(SmResId(RID_DOCUMENTSTR));
        }
Index: sw/inc/docsh.hxx
===================================================================
RCS file: /cvs/sw/sw/inc/docsh.hxx,v
retrieving revision 1.47
diff -u -p -r1.47 docsh.hxx
--- sw/inc/docsh.hxx    10 Apr 2008 10:59:26 -0000      1.47
+++ sw/inc/docsh.hxx    7 Jul 2008 09:16:25 -0000
@@ -238,7 +238,8 @@ public:
                                                                   String * 
pAppName,
                                                                   String * 
pLongUserName,
                                    String * pUserName,
-                                                                  sal_Int32 
nFileFormat ) const;
+                                   sal_Int32 nFileFormat,
+                                   sal_Bool bTemplate = sal_False ) const;
 
        virtual void LoadStyles( SfxObjectShell& rSource );
 
Index: sw/inc/globdoc.hxx
===================================================================
RCS file: /cvs/sw/sw/inc/globdoc.hxx,v
retrieving revision 1.8
diff -u -p -r1.8 globdoc.hxx
--- sw/inc/globdoc.hxx  10 Apr 2008 11:18:52 -0000      1.8
+++ sw/inc/globdoc.hxx  7 Jul 2008 09:16:25 -0000
@@ -48,7 +48,8 @@ public:
                                                                   String * 
pAppName,
                                                                   String * 
pLongUserName,
                                    String * pUserName,
-                                                                  sal_Int32 
nFileFormat ) const;
+                                   sal_Int32 nFileFormat,
+                                   sal_Bool bTemplate = sal_False ) const;
 };
 
 #endif
Index: sw/inc/wdocsh.hxx
===================================================================
RCS file: /cvs/sw/sw/inc/wdocsh.hxx,v
retrieving revision 1.12
diff -u -p -r1.12 wdocsh.hxx
--- sw/inc/wdocsh.hxx   10 Apr 2008 12:07:02 -0000      1.12
+++ sw/inc/wdocsh.hxx   7 Jul 2008 09:16:25 -0000
@@ -54,7 +54,8 @@ public:
                                                                   String * 
pAppName,
                                    String * pLongUserName,
                                    String * pUserName,
-                                                                  sal_Int32 
nFileFormat ) const;
+                                   sal_Int32 nFileFormat,
+                                   sal_Bool bTemplate = sal_False ) const;
        USHORT          GetSourcePara()const
                                                        {return nSourcePara;}
     void        SetSourcePara(USHORT nSet) {nSourcePara = nSet;}
Index: sw/source/ui/app/docsh2.cxx
===================================================================
RCS file: /cvs/sw/sw/source/ui/app/docsh2.cxx,v
retrieving revision 1.103
diff -u -p -r1.103 docsh2.cxx
--- sw/source/ui/app/docsh2.cxx 10 Apr 2008 17:50:34 -0000      1.103
+++ sw/source/ui/app/docsh2.cxx 7 Jul 2008 09:16:26 -0000
@@ -1491,7 +1491,8 @@ void SwDocShell::FillClass( SvGlobalName
                                                                   String * 
/*pAppName*/,
                                                                   String * 
pLongUserName,
                                    String * pUserName,
-                                                                  sal_Int32 
nVersion ) const
+                                   sal_Int32 nVersion,
+                                   sal_Bool bTemplate /* = sal_False */) const
 {
        if (nVersion == SOFFICE_FILEFORMAT_60)
        {
@@ -1502,7 +1503,7 @@ void SwDocShell::FillClass( SvGlobalName
        else if (nVersion == SOFFICE_FILEFORMAT_8)
        {
                *pClassName             = SvGlobalName( SO3_SW_CLASSID_60 );
-               *pClipFormat    = SOT_FORMATSTR_ID_STARWRITER_8;
+        *pClipFormat   = bTemplate ? SOT_FORMATSTR_ID_STARWRITER_8_TEMPLATE : 
SOT_FORMATSTR_ID_STARWRITER_8;
                *pLongUserName = SW_RESSTR(STR_WRITER_DOCUMENT_FULLTYPE);
        }
 
Index: sw/source/ui/globdoc/globdoc.cxx
===================================================================
RCS file: /cvs/sw/sw/source/ui/globdoc/globdoc.cxx,v
retrieving revision 1.16
diff -u -p -r1.16 globdoc.cxx
--- sw/source/ui/globdoc/globdoc.cxx    10 Apr 2008 19:41:54 -0000      1.16
+++ sw/source/ui/globdoc/globdoc.cxx    7 Jul 2008 09:17:32 -0000
@@ -68,8 +68,11 @@ void SwGlobalDocShell::FillClass( SvGlob
                                                                   String * 
/*pAppName*/,
                                                                   String * 
pLongUserName,
                                    String * pUserName,
-                                                                  sal_Int32 
nVersion ) const
+                                   sal_Int32 nVersion,
+                                   sal_Bool bTemplate /* = sal_False */) const
 {
+    DBG_ASSERT( bTemplate == sal_False, "No template for Writer Global" );
+
        if (nVersion == SOFFICE_FILEFORMAT_60)
        {
                *pClassName = SvGlobalName( SO3_SWGLOB_CLASSID_60 );
Index: sw/source/ui/web/wdocsh.cxx
===================================================================
RCS file: /cvs/sw/sw/source/ui/web/wdocsh.cxx,v
retrieving revision 1.16
diff -u -p -r1.16 wdocsh.cxx
--- sw/source/ui/web/wdocsh.cxx 10 Apr 2008 22:12:30 -0000      1.16
+++ sw/source/ui/web/wdocsh.cxx 7 Jul 2008 09:18:50 -0000
@@ -92,8 +92,11 @@ void SwWebDocShell::FillClass( SvGlobalN
                                    String * /*pAppName*/,
                                                                   String * 
pLongUserName,
                                    String * pUserName,
-                                                                  sal_Int32 
nVersion ) const
+                                   sal_Int32 nVersion,
+                                   sal_Bool bTemplate /* = sal_False */) const
 {
+    DBG_ASSERT( bTemplate == sal_False, "No template for Writer Web" );
+
        if (nVersion == SOFFICE_FILEFORMAT_60)
        {
                *pClassName = SvGlobalName( SO3_SWWEB_CLASSID_60 );
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to