1d119d52dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3d119d52dSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4d119d52dSAndrew Rist * or more contributor license agreements. See the NOTICE file
5d119d52dSAndrew Rist * distributed with this work for additional information
6d119d52dSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7d119d52dSAndrew Rist * to you under the Apache License, Version 2.0 (the
8d119d52dSAndrew Rist * "License"); you may not use this file except in compliance
9d119d52dSAndrew Rist * with the License. You may obtain a copy of the License at
10cdf0e10cSrcweir *
11d119d52dSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
13d119d52dSAndrew Rist * Unless required by applicable law or agreed to in writing,
14d119d52dSAndrew Rist * software distributed under the License is distributed on an
15d119d52dSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16d119d52dSAndrew Rist * KIND, either express or implied. See the License for the
17d119d52dSAndrew Rist * specific language governing permissions and limitations
18d119d52dSAndrew Rist * under the License.
19cdf0e10cSrcweir *
20d119d52dSAndrew Rist *************************************************************/
21d119d52dSAndrew Rist
22d119d52dSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sfx2.hxx"
26cdf0e10cSrcweir #include <com/sun/star/embed/XStorage.hpp>
27cdf0e10cSrcweir #include <com/sun/star/embed/XTransactedObject.hpp>
28cdf0e10cSrcweir #include <com/sun/star/embed/ElementModes.hpp>
29cdf0e10cSrcweir
30cdf0e10cSrcweir #ifndef _MSGBOX_HXX //autogen
31cdf0e10cSrcweir #include <vcl/msgbox.hxx>
32cdf0e10cSrcweir #endif
33cdf0e10cSrcweir #include <tools/urlobj.hxx>
34cdf0e10cSrcweir #ifndef GCC
35cdf0e10cSrcweir #endif
36cdf0e10cSrcweir
37cdf0e10cSrcweir #ifndef _UNOTOOLS_PROCESSFACTORY_HXX
38cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
39cdf0e10cSrcweir #endif
40cdf0e10cSrcweir #include <unotools/intlwrapper.hxx>
41cdf0e10cSrcweir
42cdf0e10cSrcweir #include <comphelper/storagehelper.hxx>
43cdf0e10cSrcweir
44cdf0e10cSrcweir #include <sfx2/app.hxx>
45cdf0e10cSrcweir #include <sfx2/objsh.hxx>
46cdf0e10cSrcweir #include <sfx2/docfile.hxx>
47cdf0e10cSrcweir #include <sfx2/docfac.hxx>
48cdf0e10cSrcweir #include <sfx2/doctempl.hxx>
49cdf0e10cSrcweir #include "docvor.hxx"
50cdf0e10cSrcweir #include "orgmgr.hxx"
51cdf0e10cSrcweir #include "sfxtypes.hxx"
52cdf0e10cSrcweir #include "sfx2/sfxresid.hxx"
53cdf0e10cSrcweir #include "view.hrc"
54cdf0e10cSrcweir #include <sfx2/docfilt.hxx>
55cdf0e10cSrcweir #include "fltfnc.hxx"
56cdf0e10cSrcweir
57cdf0e10cSrcweir using namespace ::com::sun::star;
58cdf0e10cSrcweir
59cdf0e10cSrcweir //=========================================================================
60cdf0e10cSrcweir
61cdf0e10cSrcweir /* [Beschreibung]
62cdf0e10cSrcweir
63cdf0e10cSrcweir Implementierungsklasse; einzelner Eintrag in der Dateiansicht
64cdf0e10cSrcweir
65cdf0e10cSrcweir */
66cdf0e10cSrcweir
67cdf0e10cSrcweir struct _FileListEntry
68cdf0e10cSrcweir {
69cdf0e10cSrcweir String aFileName; // Dateiname mit komplettem Pfad
70cdf0e10cSrcweir String aBaseName; // Dateiname
71cdf0e10cSrcweir const CollatorWrapper* pCollator;
72cdf0e10cSrcweir SfxObjectShellLock aDocShell; // ObjectShell als Ref-Klasse
73cdf0e10cSrcweir
74cdf0e10cSrcweir //REMOVE SvStorageRef aStor; // Referenz auf Storage, wenn wir diesen geoeffnet haben
75cdf0e10cSrcweir //uno::Reference< embed::XStorage > xStorage;
76cdf0e10cSrcweir
77cdf0e10cSrcweir sal_Bool bFile; // als Datei auf Platte
78cdf0e10cSrcweir // (!= unbenannt1, nicht als Dok. geladen;
79cdf0e10cSrcweir // diese werden nicht gespeichert!)
80cdf0e10cSrcweir sal_Bool bOwner; // selbst erzeugt
81cdf0e10cSrcweir sal_Bool bNoName;
82cdf0e10cSrcweir sal_Bool bOwnFormat;
83cdf0e10cSrcweir
84cdf0e10cSrcweir _FileListEntry( const String& rFileName,
85cdf0e10cSrcweir const CollatorWrapper* pColl, const String* pTitle = NULL );
86cdf0e10cSrcweir ~_FileListEntry();
87cdf0e10cSrcweir
88cdf0e10cSrcweir int operator==( const _FileListEntry &rCmp) const;
89cdf0e10cSrcweir int operator< ( const _FileListEntry &rCmp) const;
90cdf0e10cSrcweir sal_Bool DeleteObjectShell();
91cdf0e10cSrcweir };
92cdf0e10cSrcweir
93cdf0e10cSrcweir //-------------------------------------------------------------------------
94cdf0e10cSrcweir
operator ==(const _FileListEntry & rCmp) const95cdf0e10cSrcweir inline int _FileListEntry::operator==(const _FileListEntry &rCmp) const
96cdf0e10cSrcweir {
97cdf0e10cSrcweir DBG_ASSERT( pCollator, "invalid CollatorWrapper" );
98cdf0e10cSrcweir return COMPARE_EQUAL == pCollator->compareString(aBaseName, rCmp.aBaseName);
99cdf0e10cSrcweir }
100cdf0e10cSrcweir
101cdf0e10cSrcweir //-------------------------------------------------------------------------
102cdf0e10cSrcweir
operator <(const _FileListEntry & rCmp) const103cdf0e10cSrcweir inline int _FileListEntry::operator< (const _FileListEntry &rCmp) const
104cdf0e10cSrcweir {
105cdf0e10cSrcweir DBG_ASSERT( pCollator, "invalid CollatorWrapper" );
106cdf0e10cSrcweir return COMPARE_LESS == pCollator->compareString(aBaseName, rCmp.aBaseName);
107cdf0e10cSrcweir }
108cdf0e10cSrcweir
109cdf0e10cSrcweir //-------------------------------------------------------------------------
110cdf0e10cSrcweir
_FileListEntry(const String & rFileName,const CollatorWrapper * pColl,const String * pTitle)111cdf0e10cSrcweir _FileListEntry::_FileListEntry( const String& rFileName,
112cdf0e10cSrcweir const CollatorWrapper* pColl, const String* pTitle ) :
113cdf0e10cSrcweir
114cdf0e10cSrcweir aFileName ( rFileName ),
115cdf0e10cSrcweir pCollator ( pColl ),
116cdf0e10cSrcweir bFile ( sal_False ),
117cdf0e10cSrcweir bOwner ( sal_False ),
118cdf0e10cSrcweir bNoName ( sal_True ),
119cdf0e10cSrcweir bOwnFormat ( sal_True )
120cdf0e10cSrcweir {
121cdf0e10cSrcweir if ( pTitle )
122cdf0e10cSrcweir aBaseName = *pTitle;
123cdf0e10cSrcweir else
124cdf0e10cSrcweir {
125cdf0e10cSrcweir INetURLObject aObj( rFileName, INET_PROT_FILE );
126cdf0e10cSrcweir aBaseName = aObj.getName( INetURLObject::LAST_SEGMENT, true,
127cdf0e10cSrcweir INetURLObject::DECODE_WITH_CHARSET );
128cdf0e10cSrcweir }
129cdf0e10cSrcweir }
130cdf0e10cSrcweir
131cdf0e10cSrcweir //-------------------------------------------------------------------------
132cdf0e10cSrcweir
~_FileListEntry()133cdf0e10cSrcweir _FileListEntry::~_FileListEntry()
134cdf0e10cSrcweir {
135cdf0e10cSrcweir DeleteObjectShell();
136cdf0e10cSrcweir }
137cdf0e10cSrcweir
138cdf0e10cSrcweir //-------------------------------------------------------------------------
139cdf0e10cSrcweir
SV_IMPL_OP_PTRARR_SORT(_SfxObjectList,_FileListEntry *)140cdf0e10cSrcweir SV_IMPL_OP_PTRARR_SORT(_SfxObjectList, _FileListEntry*)
141cdf0e10cSrcweir
142cdf0e10cSrcweir //=========================================================================
143cdf0e10cSrcweir
144cdf0e10cSrcweir sal_Bool _FileListEntry::DeleteObjectShell()
145cdf0e10cSrcweir
146cdf0e10cSrcweir /* [Beschreibung]
147cdf0e10cSrcweir
148cdf0e10cSrcweir Freigabe der DokumentShell
149cdf0e10cSrcweir
150cdf0e10cSrcweir [Returnwert] sal_True: alles Ok
151cdf0e10cSrcweir sal_False: es ist ein Fehler aufgetreten (das
152cdf0e10cSrcweir Dokument konnte nicht gesichert werden)
153cdf0e10cSrcweir
154cdf0e10cSrcweir */
155cdf0e10cSrcweir
156cdf0e10cSrcweir {
157cdf0e10cSrcweir sal_Bool bRet = sal_True;
158cdf0e10cSrcweir //Falls wir die Shell angelegt haben und sie veraendert wurde
159cdf0e10cSrcweir if(bOwner && aDocShell.Is() && aDocShell->IsModified())
160cdf0e10cSrcweir {
161cdf0e10cSrcweir //Mussten wir konvertieren?
162cdf0e10cSrcweir if( bOwnFormat )
163cdf0e10cSrcweir {
164cdf0e10cSrcweir if(!aDocShell->Save() )
165cdf0e10cSrcweir bRet = sal_False;
166cdf0e10cSrcweir else
167cdf0e10cSrcweir {
168cdf0e10cSrcweir try {
169cdf0e10cSrcweir uno::Reference< embed::XTransactedObject > xTransact( aDocShell->GetStorage(), uno::UNO_QUERY );
170cdf0e10cSrcweir OSL_ENSURE( xTransact.is(), "Storage must implement XTransactedObject!\n" );
171cdf0e10cSrcweir if ( !xTransact.is() )
172cdf0e10cSrcweir throw uno::RuntimeException();
173cdf0e10cSrcweir
174cdf0e10cSrcweir xTransact->commit();
175cdf0e10cSrcweir }
176cdf0e10cSrcweir catch( uno::Exception& )
177cdf0e10cSrcweir {
178cdf0e10cSrcweir }
179cdf0e10cSrcweir
180cdf0e10cSrcweir // aDocShell->SfxObjectShell::DoSaveCompleted();
181cdf0e10cSrcweir }
182cdf0e10cSrcweir }
183cdf0e10cSrcweir else
184cdf0e10cSrcweir {
185cdf0e10cSrcweir // Falls konvertiert im eigenen Format speichern
186cdf0e10cSrcweir INetURLObject aObj( aFileName );
187cdf0e10cSrcweir String aTitle = aObj.getName( INetURLObject::LAST_SEGMENT, true,
188cdf0e10cSrcweir INetURLObject::DECODE_WITH_CHARSET );
189cdf0e10cSrcweir bRet = aDocShell->PreDoSaveAs_Impl(
190cdf0e10cSrcweir aTitle, aDocShell->GetFactory().GetFilterContainer()->GetAnyFilter( SFX_FILTER_IMPORT | SFX_FILTER_EXPORT )->GetFilterName(), 0 );
191cdf0e10cSrcweir }
192cdf0e10cSrcweir }
193cdf0e10cSrcweir
194cdf0e10cSrcweir if( bOwner)
195cdf0e10cSrcweir {
196cdf0e10cSrcweir aDocShell.Clear();
197cdf0e10cSrcweir }
198cdf0e10cSrcweir
199cdf0e10cSrcweir return bRet;
200cdf0e10cSrcweir }
201cdf0e10cSrcweir
202cdf0e10cSrcweir //-------------------------------------------------------------------------
203cdf0e10cSrcweir
SfxObjectList()204cdf0e10cSrcweir SfxObjectList::SfxObjectList()
205cdf0e10cSrcweir {
206cdf0e10cSrcweir }
207cdf0e10cSrcweir
208cdf0e10cSrcweir //-------------------------------------------------------------------------
209cdf0e10cSrcweir
~SfxObjectList()210cdf0e10cSrcweir SfxObjectList::~SfxObjectList()
211cdf0e10cSrcweir {
212cdf0e10cSrcweir DeleteAndDestroy(0, Count());
213cdf0e10cSrcweir }
214cdf0e10cSrcweir
215cdf0e10cSrcweir //-------------------------------------------------------------------------
216cdf0e10cSrcweir
GetBaseName(sal_uInt16 i) const217cdf0e10cSrcweir const String &SfxObjectList::GetBaseName(sal_uInt16 i) const
218cdf0e10cSrcweir {
219cdf0e10cSrcweir return (*this)[i]->aBaseName;
220cdf0e10cSrcweir }
221cdf0e10cSrcweir
222cdf0e10cSrcweir //-------------------------------------------------------------------------
223cdf0e10cSrcweir
GetFileName(sal_uInt16 i) const224cdf0e10cSrcweir const String& SfxObjectList::GetFileName( sal_uInt16 i ) const
225cdf0e10cSrcweir {
226cdf0e10cSrcweir return (*this)[i]->aFileName;
227cdf0e10cSrcweir }
228cdf0e10cSrcweir
229cdf0e10cSrcweir //-------------------------------------------------------------------------
230cdf0e10cSrcweir
SfxOrganizeMgr(SfxOrganizeListBox_Impl * pLeft,SfxOrganizeListBox_Impl * pRight,SfxDocumentTemplates * pTempl)231cdf0e10cSrcweir SfxOrganizeMgr::SfxOrganizeMgr( SfxOrganizeListBox_Impl *pLeft,
232cdf0e10cSrcweir SfxOrganizeListBox_Impl *pRight,
233cdf0e10cSrcweir SfxDocumentTemplates *pTempl) :
234cdf0e10cSrcweir pImpl(new SfxOrganizeMgr_Impl),
235cdf0e10cSrcweir pTemplates(pTempl? pTempl: new SfxDocumentTemplates),
236cdf0e10cSrcweir pLeftBox(pLeft),
237cdf0e10cSrcweir pRightBox(pRight),
238cdf0e10cSrcweir bDeleteTemplates(pTempl == 0),
239cdf0e10cSrcweir bModified(0)
240cdf0e10cSrcweir
241cdf0e10cSrcweir /* [Beschreibung]
242cdf0e10cSrcweir
243cdf0e10cSrcweir Konstruktor
244cdf0e10cSrcweir
245cdf0e10cSrcweir Das aktuelle Dokument wird in die Liste der Dokumente
246cdf0e10cSrcweir aufgenommen.
247cdf0e10cSrcweir
248cdf0e10cSrcweir */
249cdf0e10cSrcweir {
250cdf0e10cSrcweir pImpl->pDocList = new SfxObjectList;
251cdf0e10cSrcweir pImpl->pIntlWrapper = new IntlWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
252cdf0e10cSrcweir const CollatorWrapper* pCollator = pImpl->pIntlWrapper->getCaseCollator();
253cdf0e10cSrcweir for ( SfxObjectShell* pTmp = SfxObjectShell::GetFirst(); pTmp; pTmp = SfxObjectShell::GetNext(*pTmp) )
254cdf0e10cSrcweir {
255cdf0e10cSrcweir if ( pTmp->GetCreateMode() != SFX_CREATE_MODE_STANDARD ||
256cdf0e10cSrcweir !( pTmp->GetFlags() & SFXOBJECTSHELL_HASOPENDOC ) || !pTmp->GetStyleSheetPool() )
257cdf0e10cSrcweir continue;
258cdf0e10cSrcweir _FileListEntry* pNewEntry = NULL;
259cdf0e10cSrcweir String aTitle = pTmp->GetTitle( SFX_TITLE_TITLE );
260cdf0e10cSrcweir pNewEntry = new _FileListEntry( pTmp->GetMedium()->GetName(), pCollator, &aTitle );
261cdf0e10cSrcweir pNewEntry->aDocShell = pTmp;
262cdf0e10cSrcweir pImpl->pDocList->C40_PTR_INSERT( _FileListEntry, pNewEntry );
263cdf0e10cSrcweir }
264cdf0e10cSrcweir }
265cdf0e10cSrcweir
266cdf0e10cSrcweir //-------------------------------------------------------------------------
267cdf0e10cSrcweir
~SfxOrganizeMgr()268cdf0e10cSrcweir SfxOrganizeMgr::~SfxOrganizeMgr()
269cdf0e10cSrcweir {
270cdf0e10cSrcweir if ( bDeleteTemplates )
271cdf0e10cSrcweir delete pTemplates;
272cdf0e10cSrcweir delete pImpl->pDocList;
273cdf0e10cSrcweir delete pImpl->pIntlWrapper;
274cdf0e10cSrcweir delete pImpl;
275cdf0e10cSrcweir pLeftBox = pRightBox = NULL;
276cdf0e10cSrcweir }
277cdf0e10cSrcweir
278cdf0e10cSrcweir //-------------------------------------------------------------------------
279cdf0e10cSrcweir
CreateObjectShell(sal_uInt16 nIdx)280cdf0e10cSrcweir SfxObjectShellRef SfxOrganizeMgr::CreateObjectShell( sal_uInt16 nIdx )
281cdf0e10cSrcweir
282cdf0e10cSrcweir /* [Beschreibung]
283cdf0e10cSrcweir
284cdf0e10cSrcweir Zugriff auf die DokumentShell an der Position nIdx
285cdf0e10cSrcweir
286cdf0e10cSrcweir [Returnwert] Referenz auf die DokumentShell
287cdf0e10cSrcweir
288cdf0e10cSrcweir */
289cdf0e10cSrcweir
290cdf0e10cSrcweir {
291cdf0e10cSrcweir _FileListEntry* pEntry = (*pImpl->pDocList)[nIdx];
292cdf0e10cSrcweir // andernfalls Doc-Shell anlegen
293cdf0e10cSrcweir if ( !pEntry->aDocShell.Is() )
294cdf0e10cSrcweir {
295cdf0e10cSrcweir //(mba)/task SfxWaitCursor aWaitCursor;
296cdf0e10cSrcweir INetURLObject aFileObj( pEntry->aFileName );
297cdf0e10cSrcweir sal_Bool bDum = sal_False;
298cdf0e10cSrcweir SfxApplication* pSfxApp = SFX_APP();
299cdf0e10cSrcweir String aFilePath = aFileObj.GetMainURL( INetURLObject::NO_DECODE );
300cdf0e10cSrcweir pEntry->aDocShell = pSfxApp->DocAlreadyLoaded( aFilePath, sal_False, bDum );
301cdf0e10cSrcweir if ( !pEntry->aDocShell.Is() )
302cdf0e10cSrcweir {
303cdf0e10cSrcweir pEntry->bOwner = sal_True;
304cdf0e10cSrcweir SfxMedium* pMed = new SfxMedium(
305cdf0e10cSrcweir aFilePath, ( STREAM_READ | STREAM_SHARE_DENYWRITE ), sal_False, 0 );
306cdf0e10cSrcweir const SfxFilter* pFilter = NULL;
307cdf0e10cSrcweir pMed->UseInteractionHandler(sal_True);
308cdf0e10cSrcweir if (
309cdf0e10cSrcweir pSfxApp->GetFilterMatcher().GuessFilter(*pMed, &pFilter, SFX_FILTER_TEMPLATE, 0) ||
310cdf0e10cSrcweir (pFilter && !pFilter->IsOwnFormat()) ||
311cdf0e10cSrcweir (pFilter && !pFilter->UsesStorage())
312cdf0e10cSrcweir )
313cdf0e10cSrcweir {
314cdf0e10cSrcweir pSfxApp->LoadTemplate( pEntry->aDocShell, aFilePath );
315cdf0e10cSrcweir pEntry->bOwnFormat = sal_False;
316cdf0e10cSrcweir delete pMed;
317cdf0e10cSrcweir if ( pEntry->aDocShell.Is() )
318cdf0e10cSrcweir return (SfxObjectShellRef)(SfxObjectShell*)(pEntry->aDocShell);
319cdf0e10cSrcweir }
320cdf0e10cSrcweir else
321cdf0e10cSrcweir {
322cdf0e10cSrcweir if ( pFilter )
323cdf0e10cSrcweir {
324cdf0e10cSrcweir pEntry->bOwnFormat = sal_True;
325cdf0e10cSrcweir pEntry->aDocShell = SfxObjectShell::CreateObject( pFilter->GetServiceName(), SFX_CREATE_MODE_ORGANIZER );
326cdf0e10cSrcweir if ( pEntry->aDocShell.Is() )
327cdf0e10cSrcweir {
328cdf0e10cSrcweir pEntry->aDocShell->DoInitNew(0);
329cdf0e10cSrcweir pEntry->aDocShell->LoadFrom( *pMed );
330cdf0e10cSrcweir // Medium is now owned by DocShell
331cdf0e10cSrcweir pEntry->aDocShell->DoSaveCompleted( pMed );
332cdf0e10cSrcweir }
333cdf0e10cSrcweir }
334cdf0e10cSrcweir }
335cdf0e10cSrcweir }
336cdf0e10cSrcweir }
337cdf0e10cSrcweir return ( SfxObjectShellRef )(SfxObjectShell*)(pEntry->aDocShell);
338cdf0e10cSrcweir }
339cdf0e10cSrcweir
340cdf0e10cSrcweir //-------------------------------------------------------------------------
341cdf0e10cSrcweir
DeleteObjectShell(sal_uInt16 nIdx)342cdf0e10cSrcweir sal_Bool SfxOrganizeMgr::DeleteObjectShell(sal_uInt16 nIdx)
343cdf0e10cSrcweir
344cdf0e10cSrcweir /* [Beschreibung]
345cdf0e10cSrcweir
346cdf0e10cSrcweir Freigabe der DokumentShell an der Position nIdx
347cdf0e10cSrcweir
348cdf0e10cSrcweir [Returnwert] sal_True: alles Ok
349cdf0e10cSrcweir sal_False: es ist ein Fehler aufgetreten (das
350cdf0e10cSrcweir Dokument konnte nicht gesichert werden)
351cdf0e10cSrcweir
352cdf0e10cSrcweir */
353cdf0e10cSrcweir {
354cdf0e10cSrcweir return (*pImpl->pDocList)[nIdx]->DeleteObjectShell();
355cdf0e10cSrcweir }
356cdf0e10cSrcweir
357cdf0e10cSrcweir //-------------------------------------------------------------------------
358cdf0e10cSrcweir
CreateObjectShell(sal_uInt16 nRegion,sal_uInt16 nIdx)359cdf0e10cSrcweir SfxObjectShellRef SfxOrganizeMgr::CreateObjectShell(sal_uInt16 nRegion,
360cdf0e10cSrcweir sal_uInt16 nIdx)
361cdf0e10cSrcweir /* [Beschreibung]
362cdf0e10cSrcweir
363cdf0e10cSrcweir Zugriff auf die DokumentShell an der Position nIdx im Bereich
364cdf0e10cSrcweir nRegion (Dokumentvorlage)
365cdf0e10cSrcweir
366cdf0e10cSrcweir [Returnwert] Referenz auf die DokumentShell
367cdf0e10cSrcweir
368cdf0e10cSrcweir */
369cdf0e10cSrcweir {
370cdf0e10cSrcweir //(mba)/task SfxWaitCursor aWaitCursor;
371cdf0e10cSrcweir return pTemplates->CreateObjectShell(nRegion, nIdx);
372cdf0e10cSrcweir }
373cdf0e10cSrcweir
374cdf0e10cSrcweir //-------------------------------------------------------------------------
375cdf0e10cSrcweir
DeleteObjectShell(sal_uInt16 nRegion,sal_uInt16 nIdx)376cdf0e10cSrcweir sal_Bool SfxOrganizeMgr::DeleteObjectShell(sal_uInt16 nRegion, sal_uInt16 nIdx)
377cdf0e10cSrcweir
378cdf0e10cSrcweir /* [Beschreibung]
379cdf0e10cSrcweir
380cdf0e10cSrcweir Freigabe der DokumentShell an der Position nIdx im Bereich
381cdf0e10cSrcweir nRegion (Dokumentvorlage)
382cdf0e10cSrcweir
383cdf0e10cSrcweir [Returnwert] sal_True: alles Ok
384cdf0e10cSrcweir sal_False: es ist ein Fehler aufgetreten (das
385cdf0e10cSrcweir Dokument konnte nicht gesichert werden)
386cdf0e10cSrcweir
387cdf0e10cSrcweir */
388cdf0e10cSrcweir
389cdf0e10cSrcweir {
390cdf0e10cSrcweir return pTemplates->DeleteObjectShell(nRegion, nIdx);
391cdf0e10cSrcweir }
392cdf0e10cSrcweir
393cdf0e10cSrcweir //-------------------------------------------------------------------------
394cdf0e10cSrcweir
Copy(sal_uInt16 nTargetRegion,sal_uInt16 nTargetIdx,sal_uInt16 nSourceRegion,sal_uInt16 nSourceIdx)395cdf0e10cSrcweir sal_Bool SfxOrganizeMgr::Copy(sal_uInt16 nTargetRegion,
396cdf0e10cSrcweir sal_uInt16 nTargetIdx,
397cdf0e10cSrcweir sal_uInt16 nSourceRegion,
398cdf0e10cSrcweir sal_uInt16 nSourceIdx)
399cdf0e10cSrcweir
400cdf0e10cSrcweir /* [Beschreibung]
401cdf0e10cSrcweir
402cdf0e10cSrcweir Kopieren einer Dokumentvorlage
403cdf0e10cSrcweir
404cdf0e10cSrcweir [Parameter]
405cdf0e10cSrcweir
406cdf0e10cSrcweir sal_uInt16 nTargetRegion Index des Zielbereiches
407cdf0e10cSrcweir sal_uInt16 nTargetIdx Index Zielposition
408cdf0e10cSrcweir sal_uInt16 nSourceRegion Index des Quellbereiches
409cdf0e10cSrcweir sal_uInt16 nSourceIdx Index der zu kopierenden / z uverschiebenden
410cdf0e10cSrcweir Dokumentvorlage
411cdf0e10cSrcweir
412cdf0e10cSrcweir [R"uckgabewert] Erfolg (TRUE) oder Mi"serfolg (FALSE)
413cdf0e10cSrcweir
414cdf0e10cSrcweir
415cdf0e10cSrcweir [Querverweise]
416cdf0e10cSrcweir
417cdf0e10cSrcweir <SfxDocumentTemplates::Copy(sal_uInt16 nTargetRegion,
418cdf0e10cSrcweir sal_uInt16 nTargetIdx,
419cdf0e10cSrcweir sal_uInt16 nSourceRegion,
420cdf0e10cSrcweir sal_uInt16 nSourceIdx)>
421cdf0e10cSrcweir
422cdf0e10cSrcweir */
423cdf0e10cSrcweir
424cdf0e10cSrcweir {
425cdf0e10cSrcweir if(nSourceIdx == USHRT_MAX) // keine Verzeichnisse kopieren
426cdf0e10cSrcweir return sal_False ;
427cdf0e10cSrcweir const sal_Bool bOk = pTemplates->Copy(nTargetRegion, nTargetIdx,
428cdf0e10cSrcweir nSourceRegion, nSourceIdx);
429cdf0e10cSrcweir if(bOk)
430cdf0e10cSrcweir bModified = 1;
431cdf0e10cSrcweir return bOk;
432cdf0e10cSrcweir }
433cdf0e10cSrcweir
434cdf0e10cSrcweir //-------------------------------------------------------------------------
435cdf0e10cSrcweir
Move(sal_uInt16 nTargetRegion,sal_uInt16 nTargetIdx,sal_uInt16 nSourceRegion,sal_uInt16 nSourceIdx)436cdf0e10cSrcweir sal_Bool SfxOrganizeMgr::Move(sal_uInt16 nTargetRegion,
437cdf0e10cSrcweir sal_uInt16 nTargetIdx,
438cdf0e10cSrcweir sal_uInt16 nSourceRegion,
439cdf0e10cSrcweir sal_uInt16 nSourceIdx)
440cdf0e10cSrcweir
441cdf0e10cSrcweir /* [Beschreibung]
442cdf0e10cSrcweir
443cdf0e10cSrcweir Verschieben einer Dokumentvorlage
444cdf0e10cSrcweir
445cdf0e10cSrcweir [Parameter]
446cdf0e10cSrcweir
447cdf0e10cSrcweir sal_uInt16 nTargetRegion Index des Zielbereiches
448cdf0e10cSrcweir sal_uInt16 nTargetIdx Index Zielposition
449cdf0e10cSrcweir sal_uInt16 nSourceRegion Index des Quellbereiches
450cdf0e10cSrcweir sal_uInt16 nSourceIdx Index der zu kopierenden / z uverschiebenden
451cdf0e10cSrcweir Dokumentvorlage
452cdf0e10cSrcweir
453cdf0e10cSrcweir [R"uckgabewert] Erfolg (TRUE) oder Mi"serfolg (FALSE)
454cdf0e10cSrcweir
455cdf0e10cSrcweir
456cdf0e10cSrcweir [Querverweise]
457cdf0e10cSrcweir
458cdf0e10cSrcweir <SfxDocumentTemplates::Move(sal_uInt16 nTargetRegion,
459cdf0e10cSrcweir sal_uInt16 nTargetIdx,
460cdf0e10cSrcweir sal_uInt16 nSourceRegion,
461cdf0e10cSrcweir sal_uInt16 nSourceIdx)>
462cdf0e10cSrcweir
463cdf0e10cSrcweir */
464cdf0e10cSrcweir
465cdf0e10cSrcweir {
466cdf0e10cSrcweir if(nSourceIdx == USHRT_MAX) // keine Verzeichnisse verschieben
467cdf0e10cSrcweir return sal_False ;
468cdf0e10cSrcweir const sal_Bool bOk = pTemplates->Move(nTargetRegion, nTargetIdx,
469cdf0e10cSrcweir nSourceRegion, nSourceIdx);
470cdf0e10cSrcweir if(bOk)
471cdf0e10cSrcweir bModified = 1;
472cdf0e10cSrcweir return bOk;
473cdf0e10cSrcweir }
474cdf0e10cSrcweir
475cdf0e10cSrcweir //-------------------------------------------------------------------------
476cdf0e10cSrcweir
Delete(SfxOrganizeListBox_Impl * pCaller,sal_uInt16 nRegion,sal_uInt16 nIdx)477cdf0e10cSrcweir sal_Bool SfxOrganizeMgr::Delete(SfxOrganizeListBox_Impl *pCaller,
478cdf0e10cSrcweir sal_uInt16 nRegion, sal_uInt16 nIdx)
479cdf0e10cSrcweir
480cdf0e10cSrcweir /* [Beschreibung]
481cdf0e10cSrcweir
482cdf0e10cSrcweir "oschen einer Dokumentvorlage
483cdf0e10cSrcweir
484cdf0e10cSrcweir [Parameter]
485cdf0e10cSrcweir
486cdf0e10cSrcweir SfxOrganizeListBox *pCaller rufende ListBox; da dieses
487cdf0e10cSrcweir Event durch das Men"u oder
488cdf0e10cSrcweir durch das Keyboard angetriggert wird,
489cdf0e10cSrcweir mu"s das Model der ListBox anschlie"send
490cdf0e10cSrcweir aktualisiert werden.
491cdf0e10cSrcweir sal_uInt16 nRegion Index des Bereiches
492cdf0e10cSrcweir sal_uInt16 nIdx Index der Dokumentvorlage
493cdf0e10cSrcweir
494cdf0e10cSrcweir [R"uckgabewert] Erfolg (TRUE) oder Mi"serfolg (FALSE)
495cdf0e10cSrcweir
496cdf0e10cSrcweir
497cdf0e10cSrcweir [Querverweise]
498cdf0e10cSrcweir
499cdf0e10cSrcweir <SfxDocumentTemplates::Delete(sal_uInt16 nRegion, sal_uInt16 nIdx)>
500cdf0e10cSrcweir
501cdf0e10cSrcweir */
502cdf0e10cSrcweir
503cdf0e10cSrcweir {
504cdf0e10cSrcweir sal_Bool bOk = sal_False;
505cdf0e10cSrcweir
506cdf0e10cSrcweir if ( USHRT_MAX == nIdx )
507cdf0e10cSrcweir {
508cdf0e10cSrcweir // deleting of a group
509cdf0e10cSrcweir
510cdf0e10cSrcweir SvLBoxEntry *pGroupToDelete = pCaller->SvLBox::GetEntry(nRegion);
511cdf0e10cSrcweir if ( pGroupToDelete )
512cdf0e10cSrcweir {
513cdf0e10cSrcweir sal_uInt16 nItemNum = (sal_uInt16)( pCaller->GetModel()->GetChildCount( pGroupToDelete ) );
514cdf0e10cSrcweir sal_uInt16 nToDeleteNum = 0;
515cdf0e10cSrcweir SvLBoxEntry **pEntriesToDelete = new SvLBoxEntry*[nItemNum];
516cdf0e10cSrcweir
517cdf0e10cSrcweir sal_uInt16 nInd = 0;
518cdf0e10cSrcweir for ( nInd = 0; nInd < nItemNum; nInd++ )
519cdf0e10cSrcweir pEntriesToDelete[nInd] = NULL;
520cdf0e10cSrcweir
521cdf0e10cSrcweir for ( nInd = 0; nInd < nItemNum; nInd++ )
522cdf0e10cSrcweir {
523cdf0e10cSrcweir // TODO/LATER: check that nInd is the same index that is used in pTemplates
524cdf0e10cSrcweir if ( pTemplates->Delete( nRegion, nInd ) )
525cdf0e10cSrcweir {
526cdf0e10cSrcweir bModified = 1;
527cdf0e10cSrcweir pEntriesToDelete[nToDeleteNum++] = pCaller->SvLBox::GetEntry( pGroupToDelete, nInd );
528cdf0e10cSrcweir }
529cdf0e10cSrcweir }
530cdf0e10cSrcweir
531cdf0e10cSrcweir for ( nInd = 0; nInd < nToDeleteNum; nInd++ )
532cdf0e10cSrcweir if ( pEntriesToDelete[nInd] )
533cdf0e10cSrcweir pCaller->GetModel()->Remove( pEntriesToDelete[nInd] );
534*0a999d18SHerbert Dürr delete[] pEntriesToDelete;
535cdf0e10cSrcweir
536cdf0e10cSrcweir if ( !pCaller->GetModel()->GetChildCount( pGroupToDelete ) )
537cdf0e10cSrcweir {
538cdf0e10cSrcweir bOk = pTemplates->Delete( nRegion, nIdx );
539cdf0e10cSrcweir if ( bOk )
540cdf0e10cSrcweir pCaller->GetModel()->Remove( pGroupToDelete );
541cdf0e10cSrcweir }
542cdf0e10cSrcweir }
543cdf0e10cSrcweir }
544cdf0e10cSrcweir else
545cdf0e10cSrcweir {
546cdf0e10cSrcweir // deleting of a template
547cdf0e10cSrcweir bOk = pTemplates->Delete(nRegion, nIdx);
548cdf0e10cSrcweir if(bOk)
549cdf0e10cSrcweir {
550cdf0e10cSrcweir bModified = 1;
551cdf0e10cSrcweir // zu loeschender Eintrag
552cdf0e10cSrcweir SvLBoxEntry *pEntryToDelete = pCaller->SvLBox::GetEntry(pCaller->SvLBox::GetEntry(nRegion), nIdx);
553cdf0e10cSrcweir
554cdf0e10cSrcweir pCaller->GetModel()->Remove(pEntryToDelete);
555cdf0e10cSrcweir }
556cdf0e10cSrcweir }
557cdf0e10cSrcweir
558cdf0e10cSrcweir return bOk;
559cdf0e10cSrcweir }
560cdf0e10cSrcweir
561cdf0e10cSrcweir //-------------------------------------------------------------------------
562cdf0e10cSrcweir
InsertDir(SfxOrganizeListBox_Impl * pCaller,const String & rText,sal_uInt16 nRegion)563cdf0e10cSrcweir sal_Bool SfxOrganizeMgr::InsertDir
564cdf0e10cSrcweir (
565cdf0e10cSrcweir SfxOrganizeListBox_Impl* pCaller,/* rufende ListBox; da dieses Event
566cdf0e10cSrcweir durch das Men"u oder durch das
567cdf0e10cSrcweir Keyboard angetriggert wird,
568cdf0e10cSrcweir mu\s das Model der ListBox
569cdf0e10cSrcweir anschlie\send aktualisiert werden */
570cdf0e10cSrcweir const String& rText, // logischer Name des Bereiches
571cdf0e10cSrcweir sal_uInt16 nRegion // Index des Bereiches
572cdf0e10cSrcweir )
573cdf0e10cSrcweir
574cdf0e10cSrcweir /* [Beschreibung]
575cdf0e10cSrcweir
576cdf0e10cSrcweir Einf"ugen eines Bereiches
577cdf0e10cSrcweir
578cdf0e10cSrcweir
579cdf0e10cSrcweir [R"uckgabewert]
580cdf0e10cSrcweir
581cdf0e10cSrcweir Erfolg (sal_True) oder Mi\serfolg (sal_False)
582cdf0e10cSrcweir
583cdf0e10cSrcweir
584cdf0e10cSrcweir [Querverweise]
585cdf0e10cSrcweir
586cdf0e10cSrcweir <SfxDocumentTemplates::InsertDir(const String &, sal_uInt16 nRegion)>
587cdf0e10cSrcweir */
588cdf0e10cSrcweir
589cdf0e10cSrcweir {
590cdf0e10cSrcweir const sal_Bool bOk = pTemplates->InsertDir(rText, nRegion);
591cdf0e10cSrcweir if(bOk)
592cdf0e10cSrcweir {
593cdf0e10cSrcweir bModified = 1;
594cdf0e10cSrcweir SvLBoxEntry *pEntry = pCaller->InsertEntry(rText,
595cdf0e10cSrcweir pCaller->GetOpenedBmp(0),
596cdf0e10cSrcweir pCaller->GetClosedBmp(0),
597cdf0e10cSrcweir 0, sal_True, nRegion);
598cdf0e10cSrcweir pCaller->Update();
599cdf0e10cSrcweir pCaller->EditEntry(pEntry);
600cdf0e10cSrcweir }
601cdf0e10cSrcweir return bOk;
602cdf0e10cSrcweir }
603cdf0e10cSrcweir
604cdf0e10cSrcweir //-------------------------------------------------------------------------
605cdf0e10cSrcweir
SetName(const String & rName,sal_uInt16 nRegion,sal_uInt16 nIdx)606cdf0e10cSrcweir sal_Bool SfxOrganizeMgr::SetName(const String &rName,
607cdf0e10cSrcweir sal_uInt16 nRegion, sal_uInt16 nIdx)
608cdf0e10cSrcweir
609cdf0e10cSrcweir /* [Beschreibung]
610cdf0e10cSrcweir
611cdf0e10cSrcweir "Andern eines (logischen) Namens
612cdf0e10cSrcweir
613cdf0e10cSrcweir [Parameter]
614cdf0e10cSrcweir
615cdf0e10cSrcweir const String &rName der neue Name
616cdf0e10cSrcweir sal_uInt16 nRegion Index des Bereiches
617cdf0e10cSrcweir sal_uInt16 nIdx Index der Dokumentvorlage
618cdf0e10cSrcweir
619cdf0e10cSrcweir [R"uckgabewert] Erfolg (TRUE) oder Mi"serfolg (FALSE)
620cdf0e10cSrcweir
621cdf0e10cSrcweir
622cdf0e10cSrcweir [Querverweise]
623cdf0e10cSrcweir
624cdf0e10cSrcweir <SfxDocumentTemplates::SetName(const String &, sal_uInt16 nRegion, sal_uInt16 nIdx)>
625cdf0e10cSrcweir
626cdf0e10cSrcweir */
627cdf0e10cSrcweir
628cdf0e10cSrcweir {
629cdf0e10cSrcweir const sal_Bool bOk = pTemplates->SetName(rName, nRegion, nIdx);
630cdf0e10cSrcweir if(bOk)
631cdf0e10cSrcweir bModified = 1;
632cdf0e10cSrcweir return bOk;
633cdf0e10cSrcweir }
634cdf0e10cSrcweir
635cdf0e10cSrcweir //-------------------------------------------------------------------------
636cdf0e10cSrcweir
CopyTo(sal_uInt16 nRegion,sal_uInt16 nIdx,const String & rName) const637cdf0e10cSrcweir sal_Bool SfxOrganizeMgr::CopyTo(sal_uInt16 nRegion, sal_uInt16 nIdx, const String &rName) const
638cdf0e10cSrcweir
639cdf0e10cSrcweir /* [Beschreibung]
640cdf0e10cSrcweir
641cdf0e10cSrcweir Export einer Vorlage
642cdf0e10cSrcweir
643cdf0e10cSrcweir [Parameter]
644cdf0e10cSrcweir
645cdf0e10cSrcweir sal_uInt16 nRegion Index des Bereiches
646cdf0e10cSrcweir sal_uInt16 nIdx Index der Dokumentvorlage
647cdf0e10cSrcweir const String &rName Dateiname
648cdf0e10cSrcweir
649cdf0e10cSrcweir [R"uckgabewert] Erfolg (TRUE) oder Mi"serfolg (FALSE)
650cdf0e10cSrcweir
651cdf0e10cSrcweir
652cdf0e10cSrcweir [Querverweise]
653cdf0e10cSrcweir
654cdf0e10cSrcweir <SfxDocumentTemplates::CopyTo( sal_uInt16 nRegion, sal_uInt16 nIdx, const String &)>
655cdf0e10cSrcweir
656cdf0e10cSrcweir */
657cdf0e10cSrcweir
658cdf0e10cSrcweir {
659cdf0e10cSrcweir return pTemplates->CopyTo(nRegion, nIdx, rName);
660cdf0e10cSrcweir }
661cdf0e10cSrcweir
662cdf0e10cSrcweir //-------------------------------------------------------------------------
663cdf0e10cSrcweir
CopyFrom(SfxOrganizeListBox_Impl * pCaller,sal_uInt16 nRegion,sal_uInt16 nIdx,String & rName)664cdf0e10cSrcweir sal_Bool SfxOrganizeMgr::CopyFrom(SfxOrganizeListBox_Impl *pCaller,
665cdf0e10cSrcweir sal_uInt16 nRegion, sal_uInt16 nIdx, String &rName)
666cdf0e10cSrcweir
667cdf0e10cSrcweir /* [Beschreibung]
668cdf0e10cSrcweir
669cdf0e10cSrcweir Import einer Vorlage
670cdf0e10cSrcweir
671cdf0e10cSrcweir [Parameter]
672cdf0e10cSrcweir
673cdf0e10cSrcweir SfxOrganizeListBox *pCaller rufende ListBox; da dieses
674cdf0e10cSrcweir Event durch das Men"u angetriggert wird,
675cdf0e10cSrcweir mu"s das Model der ListBox anschlie"send
676cdf0e10cSrcweir aktualisiert werden.
677cdf0e10cSrcweir sal_uInt16 nRegion Index des Bereiches
678cdf0e10cSrcweir sal_uInt16 nIdx Index der Dokumentvorlage
679cdf0e10cSrcweir String &rName Dateiname
680cdf0e10cSrcweir
681cdf0e10cSrcweir [R"uckgabewert] Erfolg (TRUE) oder Mi"serfolg (FALSE)
682cdf0e10cSrcweir
683cdf0e10cSrcweir
684cdf0e10cSrcweir [Querverweise]
685cdf0e10cSrcweir
686cdf0e10cSrcweir <SfxDocumentTemplates::CopyFrom( sal_uInt16 nRegion, sal_uInt16 nIdx, const String &)>
687cdf0e10cSrcweir
688cdf0e10cSrcweir */
689cdf0e10cSrcweir
690cdf0e10cSrcweir {
691cdf0e10cSrcweir SvLBoxEntry *pParent = pCaller->FirstSelected();
692cdf0e10cSrcweir if( nIdx!=USHRT_MAX )
693cdf0e10cSrcweir pParent = pCaller->GetParent(pParent);
694cdf0e10cSrcweir if( pTemplates->CopyFrom( nRegion, nIdx, rName ) )
695cdf0e10cSrcweir {
696cdf0e10cSrcweir // pCaller aktualisieren
697cdf0e10cSrcweir if( nIdx == USHRT_MAX )
698cdf0e10cSrcweir nIdx = 0;
699cdf0e10cSrcweir else nIdx++;
700cdf0e10cSrcweir
701cdf0e10cSrcweir pCaller->InsertEntry( rName,
702cdf0e10cSrcweir pCaller->GetOpenedBmp(1),
703cdf0e10cSrcweir pCaller->GetClosedBmp(1),
704cdf0e10cSrcweir pParent,
705cdf0e10cSrcweir sal_True,
706cdf0e10cSrcweir nIdx);
707cdf0e10cSrcweir pCaller->Update();
708cdf0e10cSrcweir // pCaller->EditEntry( pEntry );
709cdf0e10cSrcweir pCaller->Expand( pParent );
710cdf0e10cSrcweir bModified = sal_True;
711cdf0e10cSrcweir return sal_True;
712cdf0e10cSrcweir }
713cdf0e10cSrcweir return sal_False;
714cdf0e10cSrcweir }
715cdf0e10cSrcweir
716cdf0e10cSrcweir //-------------------------------------------------------------------------
717cdf0e10cSrcweir
InsertFile(SfxOrganizeListBox_Impl * pCaller,const String & rFileName)718cdf0e10cSrcweir sal_Bool SfxOrganizeMgr::InsertFile( SfxOrganizeListBox_Impl* pCaller, const String& rFileName )
719cdf0e10cSrcweir
720cdf0e10cSrcweir /* [Beschreibung]
721cdf0e10cSrcweir
722cdf0e10cSrcweir Eine Datei in der Dateiansicht hinzuf"ugen
723cdf0e10cSrcweir
724cdf0e10cSrcweir [Parameter]
725cdf0e10cSrcweir
726cdf0e10cSrcweir SfxOrganizeListBox *pCaller rufende ListBox; da dieses
727cdf0e10cSrcweir Event durch das Men"u angetriggert wird,
728cdf0e10cSrcweir mu"s das Model der ListBox anschlie"send
729cdf0e10cSrcweir aktualisiert werden.
730cdf0e10cSrcweir const String &rFileName Name der hinzuf"ugenden Datei
731cdf0e10cSrcweir
732cdf0e10cSrcweir [R"uckgabewert] Erfolg (TRUE) oder Mi"serfolg (FALSE)
733cdf0e10cSrcweir
734cdf0e10cSrcweir */
735cdf0e10cSrcweir
736cdf0e10cSrcweir {
737cdf0e10cSrcweir const CollatorWrapper* pCollator = pImpl->pIntlWrapper->getCaseCollator();
738cdf0e10cSrcweir _FileListEntry* pEntry = new _FileListEntry( rFileName, pCollator );
739cdf0e10cSrcweir if ( pImpl->pDocList->C40_PTR_INSERT( _FileListEntry, pEntry ) )
740cdf0e10cSrcweir {
741cdf0e10cSrcweir sal_uInt16 nPos = 0;
742cdf0e10cSrcweir pImpl->pDocList->Seek_Entry( pEntry, &nPos );
743cdf0e10cSrcweir pCaller->InsertEntry( pEntry->aBaseName, pCaller->GetOpenedBmp(1),
744cdf0e10cSrcweir pCaller->GetClosedBmp(1), 0, sal_True, nPos );
745cdf0e10cSrcweir return sal_True;
746cdf0e10cSrcweir }
747cdf0e10cSrcweir return sal_False;
748cdf0e10cSrcweir }
749cdf0e10cSrcweir
750cdf0e10cSrcweir //-------------------------------------------------------------------------
751cdf0e10cSrcweir
Rescan()752cdf0e10cSrcweir sal_Bool SfxOrganizeMgr::Rescan()
753cdf0e10cSrcweir
754cdf0e10cSrcweir /* [Beschreibung]
755cdf0e10cSrcweir
756cdf0e10cSrcweir Aktualisieren der Datenbasis
757cdf0e10cSrcweir
758cdf0e10cSrcweir [R"uckgabewert]
759cdf0e10cSrcweir
760cdf0e10cSrcweir sal_True es bestanden Unterschiede
761cdf0e10cSrcweir FALSE keine "Anderung
762cdf0e10cSrcweir
763cdf0e10cSrcweir [Querverweise]
764cdf0e10cSrcweir
765cdf0e10cSrcweir <SfxDocumentTemplates::Rescan()>
766cdf0e10cSrcweir */
767cdf0e10cSrcweir
768cdf0e10cSrcweir {
769cdf0e10cSrcweir if(pTemplates->Rescan())
770cdf0e10cSrcweir {
771cdf0e10cSrcweir bModified = sal_True;
772cdf0e10cSrcweir return sal_True;
773cdf0e10cSrcweir }
774cdf0e10cSrcweir return sal_False;
775cdf0e10cSrcweir }
776cdf0e10cSrcweir
777cdf0e10cSrcweir //-------------------------------------------------------------------------
778cdf0e10cSrcweir
SaveAll(Window * pParent)779cdf0e10cSrcweir void SfxOrganizeMgr::SaveAll(Window *pParent)
780cdf0e10cSrcweir
781cdf0e10cSrcweir /* [Beschreibung]
782cdf0e10cSrcweir
783cdf0e10cSrcweir Schreiben aller ge"anderten Dokumente
784cdf0e10cSrcweir
785cdf0e10cSrcweir [Parameter]
786cdf0e10cSrcweir
787cdf0e10cSrcweir Window *pParent Parent der Boxen f"ur Fehlermeldungen
788cdf0e10cSrcweir
789cdf0e10cSrcweir */
790cdf0e10cSrcweir
791cdf0e10cSrcweir {
792cdf0e10cSrcweir sal_uInt16 nRangeCount = pTemplates->GetRegionCount();
793cdf0e10cSrcweir sal_uInt16 i;
794cdf0e10cSrcweir for(i = 0; i < nRangeCount; ++i)
795cdf0e10cSrcweir {
796cdf0e10cSrcweir if( pTemplates->IsRegionLoaded( i ))
797cdf0e10cSrcweir {
798cdf0e10cSrcweir const sal_uInt16 nCount = pTemplates->GetCount(i);
799cdf0e10cSrcweir for(sal_uInt16 j = 0; j < nCount; ++j)
800cdf0e10cSrcweir {
801cdf0e10cSrcweir if(!pTemplates->DeleteObjectShell(i, j))
802cdf0e10cSrcweir {
803cdf0e10cSrcweir String aText = String(SfxResId(STR_ERROR_SAVE_TEMPLATE));
804cdf0e10cSrcweir aText += pTemplates->GetName(i, j);
805cdf0e10cSrcweir ErrorBox aBox(pParent,
806cdf0e10cSrcweir WinBits(WB_OK_CANCEL | WB_DEF_CANCEL),
807cdf0e10cSrcweir aText);
808cdf0e10cSrcweir if(RET_CANCEL == aBox.Execute())
809cdf0e10cSrcweir break;
810cdf0e10cSrcweir }
811cdf0e10cSrcweir }
812cdf0e10cSrcweir }
813cdf0e10cSrcweir }
814cdf0e10cSrcweir nRangeCount = pImpl->pDocList->Count();
815cdf0e10cSrcweir for(i = 0; i < nRangeCount; ++i)
816cdf0e10cSrcweir {
817cdf0e10cSrcweir _FileListEntry *pEntry = (*pImpl->pDocList)[i];
818cdf0e10cSrcweir if(!pEntry->DeleteObjectShell())
819cdf0e10cSrcweir {
820cdf0e10cSrcweir String aText(SfxResId(STR_ERROR_SAVE_TEMPLATE));
821cdf0e10cSrcweir aText += pEntry->aBaseName;
822cdf0e10cSrcweir ErrorBox aBox(pParent, WinBits(WB_OK_CANCEL | WB_DEF_CANCEL), aText);
823cdf0e10cSrcweir if(RET_CANCEL == aBox.Execute())
824cdf0e10cSrcweir break;
825cdf0e10cSrcweir }
826cdf0e10cSrcweir }
827cdf0e10cSrcweir }
828cdf0e10cSrcweir
829cdf0e10cSrcweir
830