update dev300-m57
[ooovba.git] / applied_patches / 0352-vba-templateobject.diff
blobe907190439bcc261c42c3890ca7c94324141a27a
1 diff --git oovbaapi/ooo/vba/word/XDocument.idl oovbaapi/ooo/vba/word/XDocument.idl
2 index 32cf6d8..2502846 100644
3 --- oovbaapi/ooo/vba/word/XDocument.idl
4 +++ oovbaapi/ooo/vba/word/XDocument.idl
5 @@ -47,6 +47,7 @@ module ooo { module vba { module word {
6 interface XDocument : com::sun::star::uno::XInterface
8 [attribute, readonly] XRange Content;
9 + [attribute] any AttachedTemplate;
11 XRange Range( [in] any Start, [in] any End );
12 any BuiltInDocumentProperties( [in] any index );
13 diff --git oovbaapi/ooo/vba/word/XTemplate.idl oovbaapi/ooo/vba/word/XTemplate.idl
14 new file mode 100644
15 index 0000000..1913118
16 --- /dev/null
17 +++ oovbaapi/ooo/vba/word/XTemplate.idl
18 @@ -0,0 +1,54 @@
19 +/*************************************************************************
20 + *
21 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
22 + *
23 + * Copyright 2008 by Sun Microsystems, Inc.
24 + *
25 + * OpenOffice.org - a multi-platform office productivity suite
26 + *
27 + * $RCSfile:
28 + * $Revision:
29 + *
30 + * This file is part of OpenOffice.org.
31 + *
32 + * OpenOffice.org is free software: you can redistribute it and/or modify
33 + * it under the terms of the GNU Lesser General Public License version 3
34 + * only, as published by the Free Software Foundation.
35 + *
36 + * OpenOffice.org is distributed in the hope that it will be useful,
37 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
38 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
39 + * GNU Lesser General Public License version 3 for more details
40 + * (a copy is included in the LICENSE file that accompanied this code).
41 + *
42 + * You should have received a copy of the GNU Lesser General Public License
43 + * version 3 along with OpenOffice.org. If not, see
44 + * <http://www.openoffice.org/license.html>
45 + * for a copy of the LGPLv3 License.
46 + *
47 + ************************************************************************/
48 +#ifndef __ooo_vba_word_XTemplate_idl__
49 +#define __ooo_vba_word_XTemplate_idl__
51 +#ifndef __com_sun_star_uno_XInterface_idl__
52 +#include <com/sun/star/uno/XInterface.idl>
53 +#endif
55 +#ifndef __ooo_vba_XHelperInterface_idl__
56 +#include <ooo/vba/XHelperInterface.idl>
57 +#endif
59 +module ooo { module vba { module word {
61 +interface XTemplate
63 + interface ooo::vba::XHelperInterface;
65 + [attribute, readonly] string Name;
66 +};
68 +}; }; };
70 +#endif
73 diff --git oovbaapi/ooo/vba/word/makefile.mk oovbaapi/ooo/vba/word/makefile.mk
74 index 646e623..c638476 100644
75 --- oovbaapi/ooo/vba/word/makefile.mk
76 +++ oovbaapi/ooo/vba/word/makefile.mk
77 @@ -56,6 +56,7 @@ IDLFILES= XGlobals.idl\
78 XPanes.idl \
79 XOptions.idl \
80 XSelection.idl \
81 + XTemplate.idl \
83 # ------------------------------------------------------------------
85 --- sw/inc/docsh.hxx
86 +++ sw/inc/docsh.hxx
87 @@ -85,6 +85,7 @@ class SW_DLLPUBLIC SwDocShell: public SfxObjectShell, public SfxListener
88 comphelper::EmbeddedObjectContainer* pOLEChildList;
89 sal_Int16 nUpdateDocMode; // contains the com::sun::star::document::UpdateDocMode
90 bool bInUpdateFontList; //prevent nested calls of UpdateFontList
91 + bool bIsATemplate; //prevent nested calls of UpdateFontList
92 // Methoden fuer den Zugriff aufs Doc
93 SW_DLLPRIVATE void AddLink();
94 SW_DLLPRIVATE void RemoveLink();
95 @@ -299,6 +300,8 @@ public:
96 GetController();
98 SfxInPlaceClient* GetIPClient( const ::svt::EmbeddedObjectRef& xObjRef );
99 + SW_DLLPRIVATE sal_Bool IsTemplate() { return bIsATemplate; }
100 + SW_DLLPRIVATE void SetIsTemplate( bool bValue ) { bIsATemplate = bValue; }
102 virtual const ::sfx2::IXmlIdRegistry* GetXmlIdRegistry() const;
104 diff --git sw/inc/unomap.hxx sw/inc/unomap.hxx
105 index 92feb78..1e842ab 100644
106 --- sw/inc/unomap.hxx
107 +++ sw/inc/unomap.hxx
108 @@ -262,6 +262,7 @@
109 #define WID_DOC_LOCK_UPDATES 1016
110 #define WID_DOC_HAS_VALID_SIGNATURES 1017
111 #define WID_DOC_BUILDID 1024
112 +#define WID_DOC_ISTEMPLATEID 1025
113 // --> OD 2006-03-21 #b6375613#
114 #define WID_APPLY_WORKAROUND_FOR_B6375613 1070
115 // <--
116 --- sw/inc/unoprnms.hxx
117 +++ sw/inc/unoprnms.hxx
118 @@ -804,7 +804,8 @@ enum SwPropNameIds
119 // --> OD 2009-07-13 #i73249#
120 /* 0737 */ UNO_NAME_DESCRIPTION,
121 // <--
122 -/* 0738 */ SW_PROPNAME_END
123 +/* 0738 */ UNO_NAME_IS_TEMPLATE,
124 +/* 0739 */ SW_PROPNAME_END
128 diff --git sw/source/core/unocore/unomap.cxx sw/source/core/unocore/unomap.cxx
129 index abc341b..14ff14e 100644
130 --- sw/source/core/unocore/unomap.cxx
131 +++ sw/source/core/unocore/unomap.cxx
132 @@ -1703,6 +1703,7 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP
133 { SW_PROP_NMID(UNO_NAME_RECORD_CHANGES), WID_DOC_CHANGES_RECORD, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
134 { SW_PROP_NMID(UNO_NAME_SHOW_CHANGES), WID_DOC_CHANGES_SHOW, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
135 { SW_PROP_NMID(UNO_NAME_WORD_COUNT), WID_DOC_WORD_COUNT, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::READONLY, 0},
136 + { SW_PROP_NMID(UNO_NAME_IS_TEMPLATE), WID_DOC_ISTEMPLATEID, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::READONLY, 0},
137 { SW_PROP_NMID(UNO_NAME_WORD_SEPARATOR), WID_DOC_WORD_SEPARATOR, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
138 { SW_PROP_NMID(UNO_NAME_HIDE_FIELD_TIPS), WID_DOC_HIDE_TIPS, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
139 { SW_PROP_NMID(UNO_NAME_REDLINE_DISPLAY_TYPE), WID_DOC_REDLINE_DISPLAY, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
140 --- sw/source/core/unocore/unoprnms.cxx
141 +++ sw/source/core/unocore/unoprnms.cxx
142 @@ -778,7 +778,8 @@ const SwPropNameTab aPropNameTab = {
143 /* 0734 CHAR_OVERLINE_COLOR */ {MAP_CHAR_LEN("CharOverlineColor")},
144 /* 0735 CHAR_OVERLINE_HAS_COLOR */ {MAP_CHAR_LEN("CharOverlineHasColor")},
145 /* 0736 UNO_NAME_OUTLINE_LEVEL */ {MAP_CHAR_LEN("OutlineLevel")},//#outline level,add<-zhaojianwei Outlinelevel
146 -/* 0737 UNO_NAME_DESCRIPTION */ {MAP_CHAR_LEN("Description")}
147 +/* 0737 UNO_NAME_DESCRIPTION */ {MAP_CHAR_LEN("Description")},
148 +/* 0738 UNO_NAME_IS_TEMPLATE */ {MAP_CHAR_LEN("IsTemplate")}
151 const SwPropNameLen& SwGetPropName( USHORT nId )
152 diff --git sw/source/filter/ww8/ww8par.cxx sw/source/filter/ww8/ww8par.cxx
153 index 714c63a..e6cca0f 100644
154 --- sw/source/filter/ww8/ww8par.cxx
155 +++ sw/source/filter/ww8/ww8par.cxx
156 @@ -140,6 +140,7 @@
157 #include <iostream>
158 #include <dbgoutsw.hxx>
159 #endif
160 +#include <unotools/localfilehelper.hxx>
162 #define MM_250 1417 // WW-Default fuer Hor. Seitenraender: 2.5 cm
163 #define MM_200 1134 // WW-Default fuer u.Seitenrand: 2.0 cm
164 @@ -219,6 +220,80 @@ bool registerDocEvent( SfxObjectShell* pShell )
165 return result;
168 +class Sttb : TBBase
170 +struct SBBItem
172 + sal_uInt16 cchData;
173 + rtl::OUString data;
174 + SBBItem() : cchData(0){}
176 + sal_uInt16 fExtend;
177 + sal_uInt16 cData;
178 + sal_uInt16 cbExtra;
180 + std::vector< SBBItem > dataItems;
182 + Sttb(const Sttb&);
183 + Sttb& operator = ( const Sttb&);
184 +public:
185 + Sttb();
186 + ~Sttb();
187 + bool Read(SvStream *pS);
188 + void Print( FILE* fp );
189 + rtl::OUString getStringAtIndex( sal_Int32 );
192 +Sttb::Sttb() : fExtend( 0 )
193 +,cData( 0 )
194 +,cbExtra( 0 )
198 +Sttb::~Sttb()
202 +bool Sttb::Read( SvStream* pS )
204 + OSL_TRACE("Sttb::Read() stream pos 0x%x", pS->Tell() );
205 + nOffSet = pS->Tell();
206 + *pS >> fExtend >> cData >> cbExtra;
207 + if ( cData )
209 + for ( sal_Int32 index = 0; index < cData; ++index )
211 + SBBItem aItem;
212 + *pS >> aItem.cchData;
213 + aItem.data = readUnicodeString( pS, aItem.cchData );
214 + dataItems.push_back( aItem );
217 + return true;
220 +void Sttb::Print( FILE* fp )
222 + fprintf( fp, "[ 0x%x ] Sttb - dump\n", nOffSet);
223 + fprintf( fp, " fExtend 0x%x [expected 0xFFFF ]\n", fExtend );
224 + fprintf( fp, " cData no. or string data items %d (0x%x)\n", cData, cData );
226 + if ( cData )
228 + for ( sal_Int32 index = 0; index < cData; ++index )
229 + fprintf(fp," string dataItem[ %d(0x%x) ] has name %s\n", static_cast< int >( index ), static_cast< unsigned int >( index ), rtl::OUStringToOString( dataItems[ index ].data, RTL_TEXTENCODING_UTF8 ).getStr() );
234 +rtl::OUString
235 +Sttb::getStringAtIndex( sal_Int32 index )
237 + rtl::OUString aRet;
238 + if ( index < dataItems.size() )
239 + aRet = dataItems[ index ].data;
240 + return aRet;
243 SwMSDffManager::SwMSDffManager( SwWW8ImplReader& rRdr )
244 : SvxMSDffManager(*rRdr.pTableStream, rRdr.GetBaseURL(), rRdr.pWwFib->fcDggInfo,
245 @@ -3725,6 +3800,41 @@ void SwWW8ImplReader::ReadDocInfo()
246 DBG_ASSERT(xDocProps.is(), "DocumentProperties is null");
248 if (xDocProps.is()) {
249 + if ( pWwFib->fDot )
251 + rtl::OUString sTemplateURL;
252 + SfxMedium* pMedium = mpDocShell->GetMedium();
253 + if ( pMedium )
255 + rtl::OUString aName = pMedium->GetName();
256 + INetURLObject aURL( aName );
257 + sTemplateURL = aURL.GetMainURL(INetURLObject::DECODE_TO_IURI);
258 + if ( sTemplateURL.getLength() > 0 )
259 + xDocProps->setTemplateURL( sTemplateURL );
262 + else // not a template
264 + long nCur = pTableStream->Tell();
265 + Sttb aSttb;
266 + pTableStream->Seek( pWwFib->fcSttbfAssoc ); // point at tgc record
267 + if (!aSttb.Read( pTableStream ) )
268 + OSL_TRACE("** Read of SttbAssoc data failed!!!! ");
269 + pTableStream->Seek( nCur ); // return to previous position, is that necessary?
270 +#if DEBUG
271 + aSttb.Print( stderr );
272 +#endif
273 + String sPath = aSttb.getStringAtIndex( 0x1 );
274 + String aURL;
275 + // attempt to convert to url ( won't work for obvious reasons on linux
276 + if ( sPath.Len() )
277 + ::utl::LocalFileHelper::ConvertPhysicalNameToURL( sPath, aURL );
278 + if ( aURL.Len() )
279 + xDocProps->setTemplateURL( aURL );
280 + else
281 + xDocProps->setTemplateURL( sPath );
284 sfx2::LoadOlePropertySet(xDocProps, pStg);
287 @@ -3987,6 +3987,8 @@ ULONG SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
289 if (mbNewDoc && pStg && !pGloss) /*meaningless for a glossary, cmc*/
292 + mpDocShell->SetIsTemplate( pWwFib->fDot ); // point at tgc record
293 const SvtFilterOptions* pVBAFlags = SvtFilterOptions::Get();
294 maTracer.EnterEnvironment(sw::log::eMacros);
295 // Create and insert Excel vba Globals
296 diff --git sw/source/ui/uno/unotxdoc.cxx sw/source/ui/uno/unotxdoc.cxx
297 index fc3b8b9..356efaf 100644
298 --- sw/source/ui/uno/unotxdoc.cxx
299 +++ sw/source/ui/uno/unotxdoc.cxx
300 @@ -2147,6 +2147,9 @@ Any SwXTextDocument::getPropertyValue(const OUString& rPropertyName)
301 Any aAny;
302 switch(pMap->nWID)
304 + case WID_DOC_ISTEMPLATEID :
305 + aAny <<= pDocShell->IsTemplate();
306 + break;
307 case WID_DOC_CHAR_COUNT :
308 case WID_DOC_PARA_COUNT :
309 case WID_DOC_WORD_COUNT :
310 diff --git sw/source/ui/vba/makefile.mk sw/source/ui/vba/makefile.mk
311 index e789fde..42a9bbc 100644
312 --- sw/source/ui/vba/makefile.mk
313 +++ sw/source/ui/vba/makefile.mk
314 @@ -69,6 +69,7 @@ SLOFILES= \
315 $(SLO)$/vbapanes.obj \
316 $(SLO)$/vbaoptions.obj \
317 $(SLO)$/vbaselection.obj \
318 + $(SLO)$/vbatemplate.obj \
320 # --- Targets ------------------------------------------------------
322 diff --git sw/source/ui/vba/vbadocument.cxx sw/source/ui/vba/vbadocument.cxx
323 index c6b1c25..9e9fdc4 100644
324 --- sw/source/ui/vba/vbadocument.cxx
325 +++ sw/source/ui/vba/vbadocument.cxx
326 @@ -35,8 +35,12 @@
327 #include "vbavariables.hxx"
328 #include <com/sun/star/text/XBookmarksSupplier.hpp>
329 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
330 +#include <com/sun/star/document/XDocumentInfoSupplier.hpp>
331 #include <com/sun/star/document/XDocumentProperties.hpp>
332 #include <vbahelper/helperdecl.hxx>
333 +#include <wordvbahelper.hxx>
334 +#include <docsh.hxx>
335 +#include "vbatemplate.hxx"
337 using namespace ::ooo::vba;
338 using namespace ::com::sun::star;
339 @@ -161,6 +165,25 @@ SwVbaDocument::getServiceImplName()
340 static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaDocument") );
341 return sImplName;
343 +uno::Any SAL_CALL
344 +SwVbaDocument::getAttachedTemplate() throw (uno::RuntimeException)
346 + SwDocShell* pDocShell = word::getDocShell( getModel() );
347 + uno::Reference< word::XTemplate > xTemplate;
348 + uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( getModel(), uno::UNO_QUERY_THROW );
349 + uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSupp( xDocInfoSupp->getDocumentInfo(), uno::UNO_QUERY_THROW );
350 + uno::Reference< document::XDocumentProperties > xDocProps( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW );
351 + rtl::OUString sTemplateName = xDocProps->getTemplateName();
353 + xTemplate = new SwVbaTemplate( this, mxContext, getModel(), sTemplateName );
354 + return uno::makeAny( xTemplate );
357 +void SAL_CALL
358 +SwVbaDocument::setAttachedTemplate( const css::uno::Any& _attachedtemplate ) throw (uno::RuntimeException)
360 + throw uno::RuntimeException();
363 uno::Sequence< rtl::OUString >
364 SwVbaDocument::getServiceNames()
365 diff --git sw/source/ui/vba/vbadocument.hxx sw/source/ui/vba/vbadocument.hxx
366 index 0f696ce..a82503b 100644
367 --- sw/source/ui/vba/vbadocument.hxx
368 +++ sw/source/ui/vba/vbadocument.hxx
369 @@ -55,6 +55,9 @@ public:
370 virtual css::uno::Any SAL_CALL CustomDocumentProperties( const css::uno::Any& index ) throw (css::uno::RuntimeException);
371 virtual css::uno::Any SAL_CALL Bookmarks( const css::uno::Any& rIndex ) throw ( css::uno::RuntimeException );
372 virtual css::uno::Any SAL_CALL Variables( const css::uno::Any& rIndex ) throw ( css::uno::RuntimeException );
373 + virtual css::uno::Any SAL_CALL getAttachedTemplate() throw (css::uno::RuntimeException);
374 + virtual void SAL_CALL setAttachedTemplate( const css::uno::Any& _attachedtemplate ) throw (css::uno::RuntimeException);
377 // XHelperInterface
378 virtual rtl::OUString& getServiceImplName();
379 diff --git sw/source/ui/vba/vbatemplate.cxx sw/source/ui/vba/vbatemplate.cxx
380 new file mode 100644
381 index 0000000..11c1a59
382 --- /dev/null
383 +++ sw/source/ui/vba/vbatemplate.cxx
384 @@ -0,0 +1,70 @@
385 +/*************************************************************************
387 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
388 + *
389 + * Copyright 2008 by Sun Microsystems, Inc.
391 + * OpenOffice.org - a multi-platform office productivity suite
393 + * $RCSfile:
394 + * $Revision:
396 + * This file is part of OpenOffice.org.
398 + * OpenOffice.org is free software: you can redistribute it and/or modify
399 + * it under the terms of the GNU Lesser General Public License version 3
400 + * only, as published by the Free Software Foundation.
402 + * OpenOffice.org is distributed in the hope that it will be useful,
403 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
404 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
405 + * GNU Lesser General Public License version 3 for more details
406 + * (a copy is included in the LICENSE file that accompanied this code).
408 + * You should have received a copy of the GNU Lesser General Public License
409 + * version 3 along with OpenOffice.org. If not, see
410 + * <http://www.openoffice.org/license.html>
411 + * for a copy of the LGPLv3 License.
413 + ************************************************************************/
414 +#include "vbatemplate.hxx"
415 +#include <vbahelper/vbahelper.hxx>
416 +#include "wordvbahelper.hxx"
418 +using namespace ::ooo::vba;
419 +using namespace ::com::sun::star;
421 +SwVbaTemplate::SwVbaTemplate( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& rModel, const rtl::OUString& rName )
422 + : SwVbaTemplate_BASE( rParent, rContext ), mxModel( rModel ), msName( rName )
427 +SwVbaTemplate::~SwVbaTemplate()
431 +rtl::OUString
432 +SwVbaTemplate::getName() throw ( css::uno::RuntimeException )
434 + return msName;
436 +rtl::OUString&
437 +SwVbaTemplate::getServiceImplName()
439 + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaTemplate") );
440 + return sImplName;
443 +uno::Sequence< rtl::OUString >
444 +SwVbaTemplate::getServiceNames()
446 + static uno::Sequence< rtl::OUString > aServiceNames;
447 + if ( aServiceNames.getLength() == 0 )
449 + aServiceNames.realloc( 1 );
450 + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Template" ) );
452 + return aServiceNames;
455 diff --git sw/source/ui/vba/vbatemplate.hxx sw/source/ui/vba/vbatemplate.hxx
456 new file mode 100644
457 index 0000000..63a2f26
458 --- /dev/null
459 +++ sw/source/ui/vba/vbatemplate.hxx
460 @@ -0,0 +1,54 @@
461 +/*************************************************************************
463 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
464 + *
465 + * Copyright 2008 by Sun Microsystems, Inc.
467 + * OpenOffice.org - a multi-platform office productivity suite
469 + * $RCSfile:
470 + * $Revision:
472 + * This file is part of OpenOffice.org.
474 + * OpenOffice.org is free software: you can redistribute it and/or modify
475 + * it under the terms of the GNU Lesser General Public License version 3
476 + * only, as published by the Free Software Foundation.
478 + * OpenOffice.org is distributed in the hope that it will be useful,
479 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
480 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
481 + * GNU Lesser General Public License version 3 for more details
482 + * (a copy is included in the LICENSE file that accompanied this code).
484 + * You should have received a copy of the GNU Lesser General Public License
485 + * version 3 along with OpenOffice.org. If not, see
486 + * <http://www.openoffice.org/license.html>
487 + * for a copy of the LGPLv3 License.
489 + ************************************************************************/
490 +#ifndef SW_VBA_TEMPLATE_HXX
491 +#define SW_VBA_TEMPLATE_HXX
493 +#include <ooo/vba/word/XTemplate.hpp>
494 +#include <vbahelper/vbahelperinterface.hxx>
496 +typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XTemplate > SwVbaTemplate_BASE;
498 +class SwVbaTemplate : public SwVbaTemplate_BASE
500 +private:
501 + css::uno::Reference< css::frame::XModel > mxModel;
502 + rtl::OUString msName;
503 +public:
504 + SwVbaTemplate( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext,
505 + const css::uno::Reference< css::frame::XModel >& rModel, const rtl::OUString& );
506 + virtual ~SwVbaTemplate();
508 + // XTemplate
509 + virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
510 + // XHelperInterface
511 + virtual rtl::OUString& getServiceImplName();
512 + virtual css::uno::Sequence<rtl::OUString> getServiceNames();
514 +#endif /* SW_VBA_TEMPLATE_HXX */
515 diff --git sfx2/source/doc/objcont.cxx sfx2/source/doc/objcont.cxx
516 index 3d1668b..9bb525f 100644
517 --- sfx2/source/doc/objcont.cxx
518 +++ sfx2/source/doc/objcont.cxx
519 @@ -1471,31 +1471,35 @@ sal_Bool SfxObjectShell::IsHelpDocument() const
521 void SfxObjectShell::ResetFromTemplate( const String& rTemplateName, const String& rFileName )
523 - uno::Reference<document::XDocumentProperties> xDocProps(getDocProperties());
524 - xDocProps->setTemplateURL( ::rtl::OUString() );
525 - xDocProps->setTemplateName( ::rtl::OUString() );
526 - xDocProps->setTemplateDate( util::DateTime() );
527 - xDocProps->resetUserData( ::rtl::OUString() );
529 - // TODO/REFACTOR:
530 - // Title?
532 - if( ::utl::LocalFileHelper::IsLocalFile( rFileName ) )
534 - String aFoundName;
535 - if( SFX_APP()->Get_Impl()->GetDocumentTemplates()->GetFull( String(), rTemplateName, aFoundName ) )
537 - INetURLObject aObj( rFileName );
538 - xDocProps->setTemplateURL( aObj.GetMainURL(INetURLObject::DECODE_TO_IURI) );
539 - xDocProps->setTemplateName( rTemplateName );
541 - ::DateTime now;
542 - xDocProps->setTemplateDate( util::DateTime(
543 - now.Get100Sec(), now.GetSec(), now.GetMin(),
544 - now.GetHour(), now.GetDay(), now.GetMonth(),
545 - now.GetYear() ) );
547 - SetQueryLoadTemplate( sal_True );
548 + // only care about reseting this data for openoffice formats otherwise
549 + if ( IsOwnStorageFormat_Impl( *GetMedium()) )
551 + uno::Reference<document::XDocumentProperties> xDocProps(getDocProperties());
552 + xDocProps->setTemplateURL( ::rtl::OUString() );
553 + xDocProps->setTemplateName( ::rtl::OUString() );
554 + xDocProps->setTemplateDate( util::DateTime() );
555 + xDocProps->resetUserData( ::rtl::OUString() );
557 + // TODO/REFACTOR:
558 + // Title?
560 + if( ::utl::LocalFileHelper::IsLocalFile( rFileName ) )
562 + String aFoundName;
563 + if( SFX_APP()->Get_Impl()->GetDocumentTemplates()->GetFull( String(), rTemplateName, aFoundName ) )
565 + INetURLObject aObj( rFileName );
566 + xDocProps->setTemplateURL( aObj.GetMainURL(INetURLObject::DECODE_TO_IURI) );
567 + xDocProps->setTemplateName( rTemplateName );
569 + ::DateTime now;
570 + xDocProps->setTemplateDate( util::DateTime(
571 + now.Get100Sec(), now.GetSec(), now.GetMin(),
572 + now.GetHour(), now.GetDay(), now.GetMonth(),
573 + now.GetYear() ) );
575 + SetQueryLoadTemplate( sal_True );