diff options
Diffstat (limited to 'sfx2/source/view/orgmgr.cxx')
-rw-r--r-- | sfx2/source/view/orgmgr.cxx | 292 |
1 files changed, 125 insertions, 167 deletions
diff --git a/sfx2/source/view/orgmgr.cxx b/sfx2/source/view/orgmgr.cxx index 21bc74affd70..b33684a4e6f4 100644 --- a/sfx2/source/view/orgmgr.cxx +++ b/sfx2/source/view/orgmgr.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,16 +32,10 @@ #include <com/sun/star/embed/XTransactedObject.hpp> #include <com/sun/star/embed/ElementModes.hpp> -#ifndef _MSGBOX_HXX //autogen #include <vcl/msgbox.hxx> -#endif #include <tools/urlobj.hxx> -#ifndef GCC -#endif -#ifndef _UNOTOOLS_PROCESSFACTORY_HXX #include <comphelper/processfactory.hxx> -#endif #include <unotools/intlwrapper.hxx> #include <comphelper/storagehelper.hxx> @@ -62,26 +57,22 @@ using namespace ::com::sun::star; //========================================================================= -/* [Beschreibung] - - Implementierungsklasse; einzelner Eintrag in der Dateiansicht +/* [Description] + Implementation class, single entry in the file view. */ struct _FileListEntry { - String aFileName; // Dateiname mit komplettem Pfad - String aBaseName; // Dateiname + String aFileName; // File Name with complete path + String aBaseName; // File Name const CollatorWrapper* pCollator; - SfxObjectShellLock aDocShell; // ObjectShell als Ref-Klasse - -//REMOVE SvStorageRef aStor; // Referenz auf Storage, wenn wir diesen geoeffnet haben - //uno::Reference< embed::XStorage > xStorage; + SfxObjectShellLock aDocShell; // ObjectShell as reference class - sal_Bool bFile; // als Datei auf Platte - // (!= unbenannt1, nicht als Dok. geladen; - // diese werden nicht gespeichert!) - sal_Bool bOwner; // selbst erzeugt + sal_Bool bFile; // As File on disk + // (!= not processed, not loaded as document + // these are not saved!) + sal_Bool bOwner; // self-generated sal_Bool bNoName; sal_Bool bOwnFormat; @@ -147,22 +138,21 @@ SV_IMPL_OP_PTRARR_SORT(_SfxObjectList, _FileListEntry*) sal_Bool _FileListEntry::DeleteObjectShell() -/* [Beschreibung] - - Freigabe der DokumentShell +/* [Description] - [Returnwert] sal_True: alles Ok - sal_False: es ist ein Fehler aufgetreten (das - Dokument konnte nicht gesichert werden) + Release of ther DocumentShell + [Return value] TRUE: Everything is ok + FALSE: An error occured + (the document could not be saved) */ { sal_Bool bRet = sal_True; - //Falls wir die Shell angelegt haben und sie veraendert wurde + if(bOwner && aDocShell.Is() && aDocShell->IsModified()) { - //Mussten wir konvertieren? + // Converted? if( bOwnFormat ) { if(!aDocShell->Save() ) @@ -181,12 +171,11 @@ sal_Bool _FileListEntry::DeleteObjectShell() { } -// aDocShell->SfxObjectShell::DoSaveCompleted(); } } else { - // Falls konvertiert im eigenen Format speichern + // If converted save in native format INetURLObject aObj( aFileName ); String aTitle = aObj.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET ); @@ -242,13 +231,9 @@ SfxOrganizeMgr::SfxOrganizeMgr( SfxOrganizeListBox_Impl *pLeft, bDeleteTemplates(pTempl == 0), bModified(0) -/* [Beschreibung] - - Konstruktor - - Das aktuelle Dokument wird in die Liste der Dokumente - aufgenommen. +/* [Description] + Constructor. The current document is added to the list of documents. */ { pImpl->pDocList = new SfxObjectList; @@ -283,20 +268,19 @@ SfxOrganizeMgr::~SfxOrganizeMgr() SfxObjectShellRef SfxOrganizeMgr::CreateObjectShell( sal_uInt16 nIdx ) -/* [Beschreibung] +/* [Description] - Zugriff auf die DokumentShell an der Position nIdx + Access to the DocumentShell at the position nIdx. - [Returnwert] Referenz auf die DokumentShell + [Return value] Reference to the DocumentShell */ { _FileListEntry* pEntry = (*pImpl->pDocList)[nIdx]; - // andernfalls Doc-Shell anlegen + // otherwise create Doc-Shell if ( !pEntry->aDocShell.Is() ) { -//(mba)/task SfxWaitCursor aWaitCursor; INetURLObject aFileObj( pEntry->aFileName ); sal_Bool bDum = sal_False; SfxApplication* pSfxApp = SFX_APP(); @@ -345,14 +329,13 @@ SfxObjectShellRef SfxOrganizeMgr::CreateObjectShell( sal_uInt16 nIdx ) sal_Bool SfxOrganizeMgr::DeleteObjectShell(sal_uInt16 nIdx) -/* [Beschreibung] +/* [Description] - Freigabe der DokumentShell an der Position nIdx - - [Returnwert] sal_True: alles Ok - sal_False: es ist ein Fehler aufgetreten (das - Dokument konnte nicht gesichert werden) + Release DocumentShell at position nIdx + [Return value] TRUE: Everything is ok + FALSE: An error occured + (the document could not be saved) */ { return (*pImpl->pDocList)[nIdx]->DeleteObjectShell(); @@ -362,16 +345,15 @@ sal_Bool SfxOrganizeMgr::DeleteObjectShell(sal_uInt16 nIdx) SfxObjectShellRef SfxOrganizeMgr::CreateObjectShell(sal_uInt16 nRegion, sal_uInt16 nIdx) -/* [Beschreibung] +/* [Description] - Zugriff auf die DokumentShell an der Position nIdx im Bereich - nRegion (Dokumentvorlage) + Access to the DocumentShell at Position nIdx in Region + nRegion (Document template) - [Returnwert] Referenz auf die DokumentShell + [Return value] Reference to the DocumentShell */ { -//(mba)/task SfxWaitCursor aWaitCursor; return pTemplates->CreateObjectShell(nRegion, nIdx); } @@ -379,15 +361,14 @@ SfxObjectShellRef SfxOrganizeMgr::CreateObjectShell(sal_uInt16 nRegion, sal_Bool SfxOrganizeMgr::DeleteObjectShell(sal_uInt16 nRegion, sal_uInt16 nIdx) -/* [Beschreibung] - - Freigabe der DokumentShell an der Position nIdx im Bereich - nRegion (Dokumentvorlage) +/* [Description] - [Returnwert] sal_True: alles Ok - sal_False: es ist ein Fehler aufgetreten (das - Dokument konnte nicht gesichert werden) + Release of the DocumentShell at Position nIdx in Region + nRegion (Document template) + [Return value] TRUE: Everything is ok + FALSE: An error occured + (the document could not be saved) */ { @@ -401,22 +382,22 @@ sal_Bool SfxOrganizeMgr::Copy(sal_uInt16 nTargetRegion, sal_uInt16 nSourceRegion, sal_uInt16 nSourceIdx) -/* [Beschreibung] +/* [Description] - Kopieren einer Dokumentvorlage + Copy of a Document Template [Parameter] - sal_uInt16 nTargetRegion Index des Zielbereiches - sal_uInt16 nTargetIdx Index Zielposition - sal_uInt16 nSourceRegion Index des Quellbereiches - sal_uInt16 nSourceIdx Index der zu kopierenden / z uverschiebenden - Dokumentvorlage + sal_uInt16 nTargetRegion Index of the Target Region + sal_uInt16 nTargetIdx Index of the Target Position + sal_uInt16 nSourceRegion Index of the Source Region + sal_uInt16 nSourceIdx Index of the template to be + copied/moved. - [R"uckgabewert] Erfolg (TRUE) oder Mi"serfolg (FALSE) + [Return value] Success (TRUE) or Failure (FALSE) - [Querverweise] + [Cross-reference] <SfxDocumentTemplates::Copy(sal_uInt16 nTargetRegion, sal_uInt16 nTargetIdx, @@ -426,7 +407,7 @@ sal_Bool SfxOrganizeMgr::Copy(sal_uInt16 nTargetRegion, */ { - if(nSourceIdx == USHRT_MAX) // keine Verzeichnisse kopieren + if(nSourceIdx == USHRT_MAX) // No directories copied return sal_False ; const sal_Bool bOk = pTemplates->Copy(nTargetRegion, nTargetIdx, nSourceRegion, nSourceIdx); @@ -442,32 +423,30 @@ sal_Bool SfxOrganizeMgr::Move(sal_uInt16 nTargetRegion, sal_uInt16 nSourceRegion, sal_uInt16 nSourceIdx) -/* [Beschreibung] +/* [Description] - Verschieben einer Dokumentvorlage + Moving a template [Parameter] - sal_uInt16 nTargetRegion Index des Zielbereiches - sal_uInt16 nTargetIdx Index Zielposition - sal_uInt16 nSourceRegion Index des Quellbereiches - sal_uInt16 nSourceIdx Index der zu kopierenden / z uverschiebenden - Dokumentvorlage - - [R"uckgabewert] Erfolg (TRUE) oder Mi"serfolg (FALSE) + sal_uInt16 nTargetRegion Index of the Target Region + sal_uInt16 nTargetIdx Index of the Target Position + sal_uInt16 nSourceRegion Index of the Source Region + sal_uInt16 nSourceIdx Index of the template to be + copied/moved. + [Return value] Success (TRUE) or Failure (FALSE) - [Querverweise] + [Cross-reference] <SfxDocumentTemplates::Move(sal_uInt16 nTargetRegion, sal_uInt16 nTargetIdx, sal_uInt16 nSourceRegion, sal_uInt16 nSourceIdx)> - */ { - if(nSourceIdx == USHRT_MAX) // keine Verzeichnisse verschieben + if(nSourceIdx == USHRT_MAX) // No directory moved return sal_False ; const sal_Bool bOk = pTemplates->Move(nTargetRegion, nTargetIdx, nSourceRegion, nSourceIdx); @@ -481,24 +460,21 @@ sal_Bool SfxOrganizeMgr::Move(sal_uInt16 nTargetRegion, sal_Bool SfxOrganizeMgr::Delete(SfxOrganizeListBox_Impl *pCaller, sal_uInt16 nRegion, sal_uInt16 nIdx) -/* [Beschreibung] +/* [Description] - "oschen einer Dokumentvorlage + Delete a Document Template [Parameter] - SfxOrganizeListBox *pCaller rufende ListBox; da dieses - Event durch das Men"u oder - durch das Keyboard angetriggert wird, - mu"s das Model der ListBox anschlie"send - aktualisiert werden. - sal_uInt16 nRegion Index des Bereiches - sal_uInt16 nIdx Index der Dokumentvorlage - - [R"uckgabewert] Erfolg (TRUE) oder Mi"serfolg (FALSE) + SfxOrganizeListBox *pCaller calling ListBox, since this event + is triggered by the menu or the + keyboard, the ListBox must be updated. + sal_uInt16 nRegion Index for Region + sal_uInt16 nIdx Index of Document template + [Return value] Success (TRUE) or Failure (FALSE) - [Querverweise] + [Cross-reference] <SfxDocumentTemplates::Delete(sal_uInt16 nRegion, sal_uInt16 nIdx)> @@ -515,26 +491,22 @@ sal_Bool SfxOrganizeMgr::Delete(SfxOrganizeListBox_Impl *pCaller, if ( pGroupToDelete ) { sal_uInt16 nItemNum = (sal_uInt16)( pCaller->GetModel()->GetChildCount( pGroupToDelete ) ); - sal_uInt16 nToDeleteNum = 0; - SvLBoxEntry **pEntriesToDelete = new SvLBoxEntry*[nItemNum]; + typedef std::deque<SvLBoxEntry*> BoxEntries; + BoxEntries pEntriesToDelete; sal_uInt16 nInd = 0; for ( nInd = 0; nInd < nItemNum; nInd++ ) - pEntriesToDelete[nInd] = NULL; - - for ( nInd = 0; nInd < nItemNum; nInd++ ) { // TODO/LATER: check that nInd is the same index that is used in pTemplates if ( pTemplates->Delete( nRegion, nInd ) ) { bModified = 1; - pEntriesToDelete[nToDeleteNum++] = pCaller->SvLBox::GetEntry( pGroupToDelete, nInd ); + pEntriesToDelete.push_back( pCaller->SvLBox::GetEntry( pGroupToDelete, nInd ) ); } } - for ( nInd = 0; nInd < nToDeleteNum; nInd++ ) - if ( pEntriesToDelete[nInd] ) - pCaller->GetModel()->Remove( pEntriesToDelete[nInd] ); + for ( BoxEntries::const_iterator aIt( pEntriesToDelete.begin() ), aEnd( pEntriesToDelete.end() ); aIt != aEnd; ++aIt ) + pCaller->GetModel()->Remove( *aIt ); if ( !pCaller->GetModel()->GetChildCount( pGroupToDelete ) ) { @@ -551,7 +523,7 @@ sal_Bool SfxOrganizeMgr::Delete(SfxOrganizeListBox_Impl *pCaller, if(bOk) { bModified = 1; - // zu loeschender Eintrag + // Entry to be deleted. SvLBoxEntry *pEntryToDelete = pCaller->SvLBox::GetEntry(pCaller->SvLBox::GetEntry(nRegion), nIdx); pCaller->GetModel()->Remove(pEntryToDelete); @@ -565,26 +537,20 @@ sal_Bool SfxOrganizeMgr::Delete(SfxOrganizeListBox_Impl *pCaller, sal_Bool SfxOrganizeMgr::InsertDir ( - SfxOrganizeListBox_Impl* pCaller,/* rufende ListBox; da dieses Event - durch das Men"u oder durch das - Keyboard angetriggert wird, - mu\s das Model der ListBox - anschlie\send aktualisiert werden */ - const String& rText, // logischer Name des Bereiches - sal_uInt16 nRegion // Index des Bereiches + SfxOrganizeListBox_Impl* pCaller, /* calling ListBox, since this event + is triggered by the menu or the + keyboard, the ListBox must be updated. */ + const String& rText, // logical Name of Region + sal_uInt16 nRegion // Index of Region ) -/* [Beschreibung] - - Einf"ugen eines Bereiches +/* [Description] + Insert Region. - [R"uckgabewert] + [Return value] Success (TRUE) or Failure (FALSE) - Erfolg (sal_True) oder Mi\serfolg (sal_False) - - - [Querverweise] + [Cross-reference] <SfxDocumentTemplates::InsertDir(const String &, sal_uInt16 nRegion)> */ @@ -609,23 +575,21 @@ sal_Bool SfxOrganizeMgr::InsertDir sal_Bool SfxOrganizeMgr::SetName(const String &rName, sal_uInt16 nRegion, sal_uInt16 nIdx) -/* [Beschreibung] +/* [Description] - "Andern eines (logischen) Namens + Set (logical) Name [Parameter] - const String &rName der neue Name - sal_uInt16 nRegion Index des Bereiches - sal_uInt16 nIdx Index der Dokumentvorlage - - [R"uckgabewert] Erfolg (TRUE) oder Mi"serfolg (FALSE) + const String &rName The new Name + sal_uInt16 nRegion Index of Region + sal_uInt16 nIdx Index of Document template + [Return value] Success (TRUE) or Failure (FALSE) - [Querverweise] + [Cross-reference] <SfxDocumentTemplates::SetName(const String &, sal_uInt16 nRegion, sal_uInt16 nIdx)> - */ { @@ -639,23 +603,21 @@ sal_Bool SfxOrganizeMgr::SetName(const String &rName, sal_Bool SfxOrganizeMgr::CopyTo(sal_uInt16 nRegion, sal_uInt16 nIdx, const String &rName) const -/* [Beschreibung] +/* [Description] - Export einer Vorlage + Export of a Template [Parameter] - sal_uInt16 nRegion Index des Bereiches - sal_uInt16 nIdx Index der Dokumentvorlage - const String &rName Dateiname - - [R"uckgabewert] Erfolg (TRUE) oder Mi"serfolg (FALSE) + sal_uInt16 nRegion Index of Region + sal_uInt16 nIdx Index of Document Template + const String &rName File name + [Return value] Success (TRUE) or Failure (FALSE) - [Querverweise] + [Cross-reference] <SfxDocumentTemplates::CopyTo( sal_uInt16 nRegion, sal_uInt16 nIdx, const String &)> - */ { @@ -667,27 +629,25 @@ sal_Bool SfxOrganizeMgr::CopyTo(sal_uInt16 nRegion, sal_uInt16 nIdx, const Strin sal_Bool SfxOrganizeMgr::CopyFrom(SfxOrganizeListBox_Impl *pCaller, sal_uInt16 nRegion, sal_uInt16 nIdx, String &rName) -/* [Beschreibung] +/* [Description] - Import einer Vorlage + Import of Document Template [Parameter] - SfxOrganizeListBox *pCaller rufende ListBox; da dieses - Event durch das Men"u angetriggert wird, - mu"s das Model der ListBox anschlie"send - aktualisiert werden. - sal_uInt16 nRegion Index des Bereiches - sal_uInt16 nIdx Index der Dokumentvorlage - String &rName Dateiname + SfxOrganizeListBox *pCaller calling ListBox, since this event + is triggered by the menu or the + keyboard, the ListBox must be updated. - [R"uckgabewert] Erfolg (TRUE) oder Mi"serfolg (FALSE) + sal_uInt16 nRegion Index of Region + sal_uInt16 nIdx Index of Document Template + String &rName File name + [Return value] Success (TRUE) or Failure (FALSE) - [Querverweise] + [Cross-reference] <SfxDocumentTemplates::CopyFrom( sal_uInt16 nRegion, sal_uInt16 nIdx, const String &)> - */ { @@ -696,7 +656,7 @@ sal_Bool SfxOrganizeMgr::CopyFrom(SfxOrganizeListBox_Impl *pCaller, pParent = pCaller->GetParent(pParent); if( pTemplates->CopyFrom( nRegion, nIdx, rName ) ) { - // pCaller aktualisieren + // Update pCaller if( nIdx == USHRT_MAX ) nIdx = 0; else nIdx++; @@ -708,7 +668,6 @@ sal_Bool SfxOrganizeMgr::CopyFrom(SfxOrganizeListBox_Impl *pCaller, sal_True, nIdx); pCaller->Update(); - // pCaller->EditEntry( pEntry ); pCaller->Expand( pParent ); bModified = sal_True; return sal_True; @@ -720,20 +679,19 @@ sal_Bool SfxOrganizeMgr::CopyFrom(SfxOrganizeListBox_Impl *pCaller, sal_Bool SfxOrganizeMgr::InsertFile( SfxOrganizeListBox_Impl* pCaller, const String& rFileName ) -/* [Beschreibung] +/* [Description] - Eine Datei in der Dateiansicht hinzuf"ugen + Insert a file in the file view. [Parameter] - SfxOrganizeListBox *pCaller rufende ListBox; da dieses - Event durch das Men"u angetriggert wird, - mu"s das Model der ListBox anschlie"send - aktualisiert werden. - const String &rFileName Name der hinzuf"ugenden Datei + SfxOrganizeListBox *pCaller calling ListBox, since this event + is triggered by the menu or the + keyboard, the ListBox must be updated. - [R"uckgabewert] Erfolg (TRUE) oder Mi"serfolg (FALSE) + const String &rFileName Name of inserted File. + [Return value] Success (TRUE) or Failure (FALSE) */ { @@ -754,16 +712,16 @@ sal_Bool SfxOrganizeMgr::InsertFile( SfxOrganizeListBox_Impl* pCaller, const Str sal_Bool SfxOrganizeMgr::Rescan() -/* [Beschreibung] +/* [Description] - Aktualisieren der Datenbasis + Updating the database. - [R"uckgabewert] + [Return value] - sal_True es bestanden Unterschiede - FALSE keine "Anderung + TRUE Changes were made + FALSE No changes - [Querverweise] + [Cross-reference] <SfxDocumentTemplates::Rescan()> */ @@ -781,14 +739,13 @@ sal_Bool SfxOrganizeMgr::Rescan() void SfxOrganizeMgr::SaveAll(Window *pParent) -/* [Beschreibung] +/* [Description] - Schreiben aller ge"anderten Dokumente + Save all Documents that have been modified [Parameter] - Window *pParent Parent der Boxen f"ur Fehlermeldungen - + Window *pParent Parent of the Error message Box */ { @@ -830,3 +787,4 @@ void SfxOrganizeMgr::SaveAll(Window *pParent) } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |