From 22a550690bc7643ba1157543e15907ebba9444a0 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sun, 14 Oct 2012 14:33:21 +0100 Subject: Related: fdo#47250 catch harder Change-Id: Ie6b26670a6809fc07b344660111be44cb3e6a011 --- sfx2/source/view/viewsh.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sfx2') diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index c61e3005f8c5..f6c2eb55248f 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -2050,7 +2050,7 @@ sal_Bool SfxViewShell::TryContextMenuInterception( Menu& rIn, const ::rtl::OUStr continue; } } - catch (const uno::RuntimeException&) + catch (...) { aIt.remove(); } -- cgit From 8274df85dffad4bb3e87579e4c6e9c204ff60ebe Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 16 Oct 2012 00:20:04 +0100 Subject: make use of ability to use bold in labels Change-Id: I3989d552ef286ba2e63cbd2a9fee32a8358ca74c --- sfx2/uiconfig/ui/password.ui | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sfx2') diff --git a/sfx2/uiconfig/ui/password.ui b/sfx2/uiconfig/ui/password.ui index 93163167b181..3f48b6aad0d6 100644 --- a/sfx2/uiconfig/ui/password.ui +++ b/sfx2/uiconfig/ui/password.ui @@ -191,7 +191,7 @@ True False - Password + <b>Password</b> True @@ -287,7 +287,7 @@ True False - Second Password + <b>Second Password</b> True -- cgit From 4b313fd5661ca5ac096e60d46691b1a9857877d9 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Thu, 18 Oct 2012 16:28:20 +0200 Subject: Merge SvListEntry and SvLBoxEntry into SvTreeListEntry. Change-Id: I89cfc8c1288c00674fe64e791c149743d377d5ee --- sfx2/inc/docvor.hxx | 46 ++++----- sfx2/source/appl/newhelp.cxx | 14 +-- sfx2/source/appl/newhelp.hxx | 4 +- sfx2/source/dialog/templdlg.cxx | 42 ++++----- sfx2/source/dialog/versdlg.cxx | 6 +- sfx2/source/doc/docvor.cxx | 202 ++++++++++++++++++++-------------------- sfx2/source/view/orgmgr.cxx | 10 +- 7 files changed, 162 insertions(+), 162 deletions(-) (limited to 'sfx2') diff --git a/sfx2/inc/docvor.hxx b/sfx2/inc/docvor.hxx index 4bdc1c7c6622..6a2a001b991c 100644 --- a/sfx2/inc/docvor.hxx +++ b/sfx2/inc/docvor.hxx @@ -56,22 +56,22 @@ friend class SfxOrganizeDlg_Impl; DECL_LINK( OnAsyncExecuteDrop, ExecuteDropEvent* ); protected: - virtual sal_Bool EditingEntry( SvLBoxEntry* pEntry, Selection & ); - virtual sal_Bool EditedEntry( SvLBoxEntry* pEntry, const rtl::OUString& rNewText ); - virtual sal_Bool NotifyMoving(SvLBoxEntry *pSource, - SvLBoxEntry* pTarget, - SvLBoxEntry *&pNewParent, sal_uIntPtr &); - virtual sal_Bool NotifyCopying(SvLBoxEntry *pSource, - SvLBoxEntry* pTarget, - SvLBoxEntry *&pNewParent, sal_uIntPtr &); - virtual void RequestingChildren( SvLBoxEntry* pParent ); + virtual sal_Bool EditingEntry( SvTreeListEntry* pEntry, Selection & ); + virtual sal_Bool EditedEntry( SvTreeListEntry* pEntry, const rtl::OUString& rNewText ); + virtual sal_Bool NotifyMoving(SvTreeListEntry *pSource, + SvTreeListEntry* pTarget, + SvTreeListEntry *&pNewParent, sal_uIntPtr &); + virtual sal_Bool NotifyCopying(SvTreeListEntry *pSource, + SvTreeListEntry* pTarget, + SvTreeListEntry *&pNewParent, sal_uIntPtr &); + virtual void RequestingChildren( SvTreeListEntry* pParent ); virtual long ExpandingHdl(); - virtual sal_Bool Select( SvLBoxEntry* pEntry, sal_Bool bSelect=sal_True ); + virtual sal_Bool Select( SvTreeListEntry* pEntry, sal_Bool bSelect=sal_True ); using SvTreeListBox::ExecuteDrop; // new d&d - virtual DragDropMode NotifyStartDrag( TransferDataContainer&, SvLBoxEntry* ); - virtual sal_Bool NotifyAcceptDrop( SvLBoxEntry* ); + virtual DragDropMode NotifyStartDrag( TransferDataContainer&, SvTreeListEntry* ); + virtual sal_Bool NotifyAcceptDrop( SvTreeListEntry* ); virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ); virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ); virtual void DragFinished( sal_Int8 nDropAction ); @@ -96,27 +96,27 @@ public: virtual PopupMenu* CreateContextMenu(); private: - sal_Bool IsStandard_Impl( SvLBoxEntry *) const; + sal_Bool IsStandard_Impl( SvTreeListEntry *) const; sal_Bool MoveOrCopyTemplates(SvTreeListBox *pSourceBox, - SvLBoxEntry *pSource, - SvLBoxEntry* pTarget, - SvLBoxEntry *&pNewParent, + SvTreeListEntry *pSource, + SvTreeListEntry* pTarget, + SvTreeListEntry *&pNewParent, sal_uIntPtr &rIdx, sal_Bool bCopy); sal_Bool MoveOrCopyContents(SvTreeListBox *pSourceBox, - SvLBoxEntry *pSource, - SvLBoxEntry* pTarget, - SvLBoxEntry *&pNewParent, + SvTreeListEntry *pSource, + SvTreeListEntry* pTarget, + SvTreeListEntry *&pNewParent, sal_uIntPtr &rIdx, sal_Bool bCopy); inline sal_uInt16 GetDocLevel() const; SfxObjectShellRef GetObjectShell( const Path& ); sal_Bool IsUniqName_Impl( const String &rText, - SvLBoxEntry* pParent, SvLBoxEntry* pEntry = 0 ) const; - sal_uInt16 GetLevelCount_Impl( SvLBoxEntry* pParent ) const; + SvTreeListEntry* pParent, SvTreeListEntry* pEntry = 0 ) const; + sal_uInt16 GetLevelCount_Impl( SvTreeListEntry* pParent ) const; - SvLBoxEntry* InsertEntryByBmpType( const XubString& rText, BMPTYPE eBmpType, - SvLBoxEntry* pParent = NULL, sal_Bool bChildrenOnDemand = sal_False, + SvTreeListEntry* InsertEntryByBmpType( const XubString& rText, BMPTYPE eBmpType, + SvTreeListEntry* pParent = NULL, sal_Bool bChildrenOnDemand = sal_False, sal_uIntPtr nPos = LIST_APPEND, void* pUserData = NULL ); }; diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx index 09268a375e6c..1441c36db915 100644 --- a/sfx2/source/appl/newhelp.cxx +++ b/sfx2/source/appl/newhelp.cxx @@ -296,7 +296,7 @@ ContentListBox_Impl::ContentListBox_Impl( Window* pParent, const ResId& rResId ) ContentListBox_Impl::~ContentListBox_Impl() { sal_uInt16 nPos = 0; - SvLBoxEntry* pEntry = GetEntry( nPos++ ); + SvTreeListEntry* pEntry = GetEntry( nPos++ ); while ( pEntry ) { ::rtl::OUString aTemp( GetEntryText( pEntry ) ); @@ -325,7 +325,7 @@ void ContentListBox_Impl::InitRoot() aURL = aRow.GetToken( 0, '\t', nIdx ); sal_Unicode cFolder = aRow.GetToken( 0, '\t', nIdx ).GetChar(0); sal_Bool bIsFolder = ( '1' == cFolder ); - SvLBoxEntry* pEntry = InsertEntry( aTitle, aOpenBookImage, aClosedBookImage, NULL, sal_True ); + SvTreeListEntry* pEntry = InsertEntry( aTitle, aOpenBookImage, aClosedBookImage, NULL, sal_True ); if ( bIsFolder ) pEntry->SetUserData( new ContentEntry_Impl( aURL, sal_True ) ); } @@ -333,9 +333,9 @@ void ContentListBox_Impl::InitRoot() // ----------------------------------------------------------------------- -void ContentListBox_Impl::ClearChildren( SvLBoxEntry* pParent ) +void ContentListBox_Impl::ClearChildren( SvTreeListEntry* pParent ) { - SvLBoxEntry* pEntry = FirstChild( pParent ); + SvTreeListEntry* pEntry = FirstChild( pParent ); while ( pEntry ) { ::rtl::OUString aTemp( GetEntryText( pEntry ) ); @@ -347,7 +347,7 @@ void ContentListBox_Impl::ClearChildren( SvLBoxEntry* pParent ) // ----------------------------------------------------------------------- -void ContentListBox_Impl::RequestingChildren( SvLBoxEntry* pParent ) +void ContentListBox_Impl::RequestingChildren( SvTreeListEntry* pParent ) { try { @@ -370,7 +370,7 @@ void ContentListBox_Impl::RequestingChildren( SvLBoxEntry* pParent ) aURL = aRow.GetToken( 0, '\t', nIdx ); sal_Unicode cFolder = aRow.GetToken( 0, '\t', nIdx ).GetChar(0); sal_Bool bIsFolder = ( '1' == cFolder ); - SvLBoxEntry* pEntry = NULL; + SvTreeListEntry* pEntry = NULL; if ( bIsFolder ) { pEntry = InsertEntry( aTitle, aOpenBookImage, aClosedBookImage, pParent, sal_True ); @@ -414,7 +414,7 @@ long ContentListBox_Impl::Notify( NotifyEvent& rNEvt ) String ContentListBox_Impl::GetSelectEntry() const { String aRet; - SvLBoxEntry* pEntry = FirstSelected(); + SvTreeListEntry* pEntry = FirstSelected(); if ( pEntry && !( (ContentEntry_Impl*)pEntry->GetUserData() )->bIsFolder ) aRet = ( (ContentEntry_Impl*)pEntry->GetUserData() )->aURL; return aRet; diff --git a/sfx2/source/appl/newhelp.hxx b/sfx2/source/appl/newhelp.hxx index 74d73a32194c..cd69921be5b2 100644 --- a/sfx2/source/appl/newhelp.hxx +++ b/sfx2/source/appl/newhelp.hxx @@ -78,14 +78,14 @@ private: Image aDocumentImage; void InitRoot(); - void ClearChildren( SvLBoxEntry* pParent ); + void ClearChildren( SvTreeListEntry* pParent ); public: ContentListBox_Impl( Window* pParent, const ResId& rResId ); ~ContentListBox_Impl(); - virtual void RequestingChildren( SvLBoxEntry* pParent ); + virtual void RequestingChildren( SvTreeListEntry* pParent ); virtual long Notify( NotifyEvent& rNEvt ); inline void SetOpenHdl( const Link& rLink ) { SetDoubleClickHdl( rLink ); } diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index e92b7f085205..3e610b6600ba 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -421,7 +421,7 @@ typedef std::vector ExpandedEntries_t; class StyleTreeListBox_Impl : public DropListBox_Impl { private: - SvLBoxEntry* pCurEntry; + SvTreeListEntry* pCurEntry; Link aDoubleClickLink; Link aDropLink; String aParent; @@ -433,9 +433,9 @@ protected: virtual sal_Bool DoubleClickHdl(); virtual long ExpandingHdl(); virtual void ExpandedHdl(); - virtual sal_Bool NotifyMoving(SvLBoxEntry* pTarget, - SvLBoxEntry* pEntry, - SvLBoxEntry*& rpNewParent, + virtual sal_Bool NotifyMoving(SvTreeListEntry* pTarget, + SvTreeListEntry* pEntry, + SvTreeListEntry*& rpNewParent, sal_uIntPtr& rNewChildPos); public: StyleTreeListBox_Impl( SfxCommonTemplateDialog_Impl* pParent, WinBits nWinStyle = 0); @@ -455,8 +455,8 @@ public: void StyleTreeListBox_Impl::MakeExpanded_Impl(ExpandedEntries_t& rEntries) const { - SvLBoxEntry *pEntry; - for(pEntry=(SvLBoxEntry*)FirstVisible();pEntry;pEntry=(SvLBoxEntry*)NextVisible(pEntry)) + SvTreeListEntry *pEntry; + for(pEntry=(SvTreeListEntry*)FirstVisible();pEntry;pEntry=(SvTreeListEntry*)NextVisible(pEntry)) { if(IsExpanded(pEntry)) { @@ -520,9 +520,9 @@ long StyleTreeListBox_Impl::Notify( NotifyEvent& rNEvt ) //------------------------------------------------------------------------- -sal_Bool StyleTreeListBox_Impl::NotifyMoving(SvLBoxEntry* pTarget, - SvLBoxEntry* pEntry, - SvLBoxEntry*& rpNewParent, +sal_Bool StyleTreeListBox_Impl::NotifyMoving(SvTreeListEntry* pTarget, + SvTreeListEntry* pEntry, + SvTreeListEntry*& rpNewParent, sal_uIntPtr& lPos) /* [Description] @@ -539,7 +539,7 @@ sal_Bool StyleTreeListBox_Impl::NotifyMoving(SvLBoxEntry* pTarget, lPos=0; IntlWrapper aIntlWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() ); const CollatorWrapper* pCollator = aIntlWrapper.getCaseCollator(); - for(SvLBoxEntry *pTmpEntry=FirstChild(pTarget); + for(SvTreeListEntry *pTmpEntry=FirstChild(pTarget); pTmpEntry && COMPARE_LESS==pCollator->compareString( GetEntryText(pTmpEntry),GetEntryText(pEntry)); pTmpEntry=NextSibling(pTmpEntry),lPos++) ; @@ -578,7 +578,7 @@ void StyleTreeListBox_Impl::ExpandedHdl() */ { - SvLBoxEntry *pEntry = GetHdlEntry(); + SvTreeListEntry *pEntry = GetHdlEntry(); if(!IsExpanded(pEntry) && pCurEntry != GetCurEntry()) SelectAll( sal_False ); pCurEntry = 0; @@ -719,12 +719,12 @@ inline sal_Bool IsExpanded_Impl( const ExpandedEntries_t& rEntries, -SvLBoxEntry* FillBox_Impl(SvTreeListBox *pBox, +SvTreeListEntry* FillBox_Impl(SvTreeListBox *pBox, StyleTree_Impl* pEntry, const ExpandedEntries_t& rEntries, - SvLBoxEntry* pParent = 0) + SvTreeListEntry* pParent = 0) { - SvLBoxEntry* pNewEntry = pBox->InsertEntry(pEntry->aName, pParent); + SvTreeListEntry* pNewEntry = pBox->InsertEntry(pEntry->aName, pParent); const sal_uInt16 nCount = pEntry->pChildren ? pEntry->pChildren->size() : 0; for(sal_uInt16 i = 0; i < nCount; ++i) FillBox_Impl(pBox, (*pEntry->pChildren)[i], rEntries, pNewEntry); @@ -1072,7 +1072,7 @@ void SfxCommonTemplateDialog_Impl::SelectStyle(const String &rStr) { if ( rStr.Len() ) { - SvLBoxEntry* pEntry = pTreeBox->First(); + SvTreeListEntry* pEntry = pTreeBox->First(); while ( pEntry ) { if ( pTreeBox->GetEntryText( pEntry ) == rStr ) @@ -1092,9 +1092,9 @@ void SfxCommonTemplateDialog_Impl::SelectStyle(const String &rStr) sal_Bool bSelect = ( rStr.Len() > 0 ); if ( bSelect ) { - SvLBoxEntry* pEntry = (SvLBoxEntry*)aFmtLb.FirstVisible(); + SvTreeListEntry* pEntry = (SvTreeListEntry*)aFmtLb.FirstVisible(); while ( pEntry && aFmtLb.GetEntryText( pEntry ) != rStr ) - pEntry = (SvLBoxEntry*)aFmtLb.NextVisible( pEntry ); + pEntry = (SvTreeListEntry*)aFmtLb.NextVisible( pEntry ); if ( !pEntry ) bSelect = sal_False; else @@ -1121,13 +1121,13 @@ String SfxCommonTemplateDialog_Impl::GetSelectedEntry() const String aRet; if ( pTreeBox ) { - SvLBoxEntry* pEntry = pTreeBox->FirstSelected(); + SvTreeListEntry* pEntry = pTreeBox->FirstSelected(); if ( pEntry ) aRet = pTreeBox->GetEntryText( pEntry ); } else { - SvLBoxEntry* pEntry = aFmtLb.FirstSelected(); + SvTreeListEntry* pEntry = aFmtLb.FirstSelected(); if ( pEntry ) aRet = aFmtLb.GetEntryText( pEntry ); } @@ -1192,7 +1192,7 @@ void SfxCommonTemplateDialog_Impl::FillTreeBox() if ( nCount ) pTreeBox->Expand( pTreeBox->First() ); - for ( SvLBoxEntry* pEntry = pTreeBox->First(); pEntry; pEntry = pTreeBox->Next( pEntry ) ) + for ( SvTreeListEntry* pEntry = pTreeBox->First(); pEntry; pEntry = pTreeBox->Next( pEntry ) ) { if ( IsExpanded_Impl( aEntries, pTreeBox->GetEntryText( pEntry ) ) ) pTreeBox->Expand( pEntry ); @@ -1303,7 +1303,7 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(sal_uInt16 nFlags) EnableItem(SID_STYLE_WATERCAN,sal_False); SfxStyleSheetBase *pStyle = pStyleSheetPool->First(); - SvLBoxEntry* pEntry = aFmtLb.First(); + SvTreeListEntry* pEntry = aFmtLb.First(); std::vector aStrings; comphelper::string::NaturalStringSorter aSorter( diff --git a/sfx2/source/dialog/versdlg.cxx b/sfx2/source/dialog/versdlg.cxx index 1411287fab33..55702767d976 100644 --- a/sfx2/source/dialog/versdlg.cxx +++ b/sfx2/source/dialog/versdlg.cxx @@ -261,7 +261,7 @@ void SfxVersionDialog::Init_Impl() aEntry += pInfo->aAuthor; aEntry += '\t'; aEntry += ConvertWhiteSpaces_Impl( pInfo->aComment ); - SvLBoxEntry *pEntry = aVersionBox.InsertEntry( aEntry ); + SvTreeListEntry *pEntry = aVersionBox.InsertEntry( aEntry ); pEntry->SetUserData( pInfo ); } } @@ -290,7 +290,7 @@ void SfxVersionDialog::Open_Impl() { SfxObjectShell *pObjShell = pViewFrame->GetObjectShell(); - SvLBoxEntry *pEntry = aVersionBox.FirstSelected(); + SvTreeListEntry *pEntry = aVersionBox.FirstSelected(); sal_uIntPtr nPos = aVersionBox.GetModel()->GetRelPos( pEntry ); SfxInt16Item aItem( SID_VERSION, (short)nPos+1 ); SfxStringItem aTarget( SID_TARGETNAME, DEFINE_CONST_UNICODE("_blank") ); @@ -368,7 +368,7 @@ IMPL_LINK_NOARG(SfxVersionDialog, SelectHdl_Impl) IMPL_LINK( SfxVersionDialog, ButtonHdl_Impl, Button*, pButton ) { SfxObjectShell *pObjShell = pViewFrame->GetObjectShell(); - SvLBoxEntry *pEntry = aVersionBox.FirstSelected(); + SvTreeListEntry *pEntry = aVersionBox.FirstSelected(); if ( pButton == &aSaveCheckBox ) { diff --git a/sfx2/source/doc/docvor.cxx b/sfx2/source/doc/docvor.cxx index e976a393316b..59995db6e8d2 100644 --- a/sfx2/source/doc/docvor.cxx +++ b/sfx2/source/doc/docvor.cxx @@ -115,7 +115,7 @@ friend class SfxOrganizeListBox_Impl; // save pointer for asynchronous D&D SvTreeListBox* pSourceView; - SvLBoxEntry* pTargetEntry; + SvTreeListEntry* pTargetEntry; SfxOrganizeListBox_Impl* pFinishedBox; sal_Int8 nDropAction; bool bExecDropFinished; @@ -164,7 +164,7 @@ friend class SfxOrganizeListBox_Impl; DECL_LINK(ExportHdl, void *); DECL_LINK(AddFilesHdl, void *); - sal_Bool DontDelete_Impl( SvLBoxEntry* pEntry ); + sal_Bool DontDelete_Impl( SvTreeListEntry* pEntry ); public: SfxOrganizeDlg_Impl( SfxTemplateOrganizeDlg* pParent, SfxDocumentTemplates* pTempl ); @@ -391,7 +391,7 @@ class Path { ImpPath_Impl *pData; public: - Path(SvTreeListBox *pBox, SvLBoxEntry *pEntry); + Path(SvTreeListBox *pBox, SvTreeListEntry *pEntry); Path(const Path &rPath): pData(rPath.pData) { @@ -422,13 +422,13 @@ public: //------------------------------------------------------------------------- -Path::Path(SvTreeListBox *pBox, SvLBoxEntry *pEntry) : +Path::Path(SvTreeListBox *pBox, SvTreeListEntry *pEntry) : pData(new ImpPath_Impl) { DBG_ASSERT(pEntry != 0, "EntryPtr ist NULL"); if(!pEntry) return; - SvLBoxEntry *pParent = pBox->GetParent(pEntry); + SvTreeListEntry *pParent = pBox->GetParent(pEntry); do { pData->aUS.insert(pData->aUS.begin(), (sal_uInt16)pBox->GetModel()->GetRelPos(pEntry)); @@ -441,8 +441,8 @@ Path::Path(SvTreeListBox *pBox, SvLBoxEntry *pEntry) : //------------------------------------------------------------------------- -SvLBoxEntry *GetIndices_Impl(SvTreeListBox *pBox, - SvLBoxEntry *pEntry, +SvTreeListEntry *GetIndices_Impl(SvTreeListBox *pBox, + SvTreeListEntry *pEntry, sal_uInt16 &rRegion, sal_uInt16 &rOffset) /* [Description] @@ -452,7 +452,7 @@ SvLBoxEntry *GetIndices_Impl(SvTreeListBox *pBox, [Parameter] SvTreeListBox *pBox Listbox where the event occurred - SvLBoxEntry *pEntry Entry whose position is to be determined + SvTreeListEntry *pEntry Entry whose position is to be determined sal_uInt16 &rRegion the region within the region of the document template (Out-Parameter) sal_uInt16 &rOffset the position within the region of the @@ -477,7 +477,7 @@ SvLBoxEntry *GetIndices_Impl(SvTreeListBox *pBox, rOffset = USHRT_MAX; return pEntry; } - SvLBoxEntry *pParent = pBox->GetParent(pEntry); + SvTreeListEntry *pParent = pBox->GetParent(pEntry); rRegion = (sal_uInt16)pBox->GetModel()->GetRelPos(pParent); rOffset = (sal_uInt16)pBox->GetModel()->GetRelPos(pEntry); return pEntry; @@ -485,7 +485,7 @@ SvLBoxEntry *GetIndices_Impl(SvTreeListBox *pBox, //------------------------------------------------------------------------- -sal_Bool SfxOrganizeListBox_Impl::Select( SvLBoxEntry* pEntry, sal_Bool bSelect ) +sal_Bool SfxOrganizeListBox_Impl::Select( SvTreeListEntry* pEntry, sal_Bool bSelect ) { if(!bSelect) return SvTreeListBox::Select(pEntry,bSelect); @@ -505,9 +505,9 @@ sal_Bool SfxOrganizeListBox_Impl::Select( SvLBoxEntry* pEntry, sal_Bool bSelect //------------------------------------------------------------------------- sal_Bool SfxOrganizeListBox_Impl::MoveOrCopyTemplates(SvTreeListBox *pSourceBox, - SvLBoxEntry *pSource, - SvLBoxEntry* pTarget, - SvLBoxEntry *&pNewParent, + SvTreeListEntry *pSource, + SvTreeListEntry* pTarget, + SvTreeListEntry *&pNewParent, sal_uIntPtr &rIdx, sal_Bool bCopy) /* [Description] @@ -517,9 +517,9 @@ sal_Bool SfxOrganizeListBox_Impl::MoveOrCopyTemplates(SvTreeListBox *pSourceBox, [Parameter] SvTreeListBox *pSourceBox Source Listbox, at which the event occurred - SvLBoxEntry* pTarget Target entry, to where it will be moved - SvLBoxEntry *pSource Source entry, to be copied / moved - SvLBoxEntry *&pNewParent the parent of the target position generated + SvTreeListEntry* pTarget Target entry, to where it will be moved + SvTreeListEntry *pSource Source entry, to be copied / moved + SvTreeListEntry *&pNewParent the parent of the target position generated at entry (out parameter) sal_uIntPtr &rIdx Index of the target entry sal_Bool bCopy Flag for Copy / Move @@ -530,18 +530,18 @@ sal_Bool SfxOrganizeListBox_Impl::MoveOrCopyTemplates(SvTreeListBox *pSourceBox, [Cross-references] - - */ @@ -596,9 +596,9 @@ sal_Bool SfxOrganizeListBox_Impl::MoveOrCopyTemplates(SvTreeListBox *pSourceBox, //------------------------------------------------------------------------- sal_Bool SfxOrganizeListBox_Impl::MoveOrCopyContents(SvTreeListBox *pSourceBox, - SvLBoxEntry *pSource, - SvLBoxEntry* pTarget, - SvLBoxEntry *&pNewParent, + SvTreeListEntry *pSource, + SvTreeListEntry* pTarget, + SvTreeListEntry *&pNewParent, sal_uIntPtr &rIdx, sal_Bool bCopy) /* [Description] @@ -608,9 +608,9 @@ sal_Bool SfxOrganizeListBox_Impl::MoveOrCopyContents(SvTreeListBox *pSourceBox, [Parameter] SvTreeListBox *pSourceBox Source Listbox, at which the event occurred - SvLBoxEntry* pTarget Target entry, to where it will be moved - SvLBoxEntry *pSource Source entry, to be copied / moved - SvLBoxEntry *&pNewParent the parent of the target position generated + SvTreeListEntry* pTarget Target entry, to where it will be moved + SvTreeListEntry *pSource Source entry, to be copied / moved + SvTreeListEntry *&pNewParent the parent of the target position generated at entry (out parameter) sal_uIntPtr &rIdx Index of the target entry sal_Bool bCopy Flag for Copy / Move @@ -621,18 +621,18 @@ sal_Bool SfxOrganizeListBox_Impl::MoveOrCopyContents(SvTreeListBox *pSourceBox, [Cross-references] - - */ @@ -679,7 +679,7 @@ sal_Bool SfxOrganizeListBox_Impl::MoveOrCopyContents(SvTreeListBox *pSourceBox, // Delete duplicate entries if(bOk) { - SvLBoxEntry *pParentIter = pTarget; + SvTreeListEntry *pParentIter = pTarget; // Up to the document level as // the general reference point while(GetModel()->GetDepth(pParentIter) != nTLevel) @@ -687,7 +687,7 @@ sal_Bool SfxOrganizeListBox_Impl::MoveOrCopyContents(SvTreeListBox *pSourceBox, if(pParentIter->HasChildrenOnDemand() && !GetModel()->HasChildren(pParentIter)) RequestingChildren(pParentIter); - SvLBoxEntry *pChildIter = 0; + SvTreeListEntry *pChildIter = 0; sal_uInt16 i = 0; while(i < 2 && p[i+1] != INDEX_IGNORE) @@ -746,9 +746,9 @@ sal_Bool SfxOrganizeListBox_Impl::MoveOrCopyContents(SvTreeListBox *pSourceBox, //------------------------------------------------------------------------- -sal_Bool SfxOrganizeListBox_Impl::NotifyMoving(SvLBoxEntry *pTarget, - SvLBoxEntry* pSource, - SvLBoxEntry *&pNewParent, +sal_Bool SfxOrganizeListBox_Impl::NotifyMoving(SvTreeListEntry *pTarget, + SvTreeListEntry* pSource, + SvTreeListEntry *&pNewParent, sal_uIntPtr &rIdx) /* [Description] @@ -758,9 +758,9 @@ sal_Bool SfxOrganizeListBox_Impl::NotifyMoving(SvLBoxEntry *pTarget, [Parameter] - SvLBoxEntry* pTarget Target entry, to where it will be moved - SvLBoxEntry *pSource Source entry, to be moved - SvLBoxEntry *&pNewParent the parent of the target position generated + SvTreeListEntry* pTarget Target entry, to where it will be moved + SvTreeListEntry *pSource Source entry, to be moved + SvTreeListEntry *&pNewParent the parent of the target position generated at entry (out parameter) sal_uIntPtr &rIdx Index of the target entry @@ -770,20 +770,20 @@ sal_Bool SfxOrganizeListBox_Impl::NotifyMoving(SvLBoxEntry *pTarget, [Cross-references] - */ @@ -807,9 +807,9 @@ sal_Bool SfxOrganizeListBox_Impl::NotifyMoving(SvLBoxEntry *pTarget, //------------------------------------------------------------------------- -sal_Bool SfxOrganizeListBox_Impl::NotifyCopying(SvLBoxEntry *pTarget, - SvLBoxEntry* pSource, - SvLBoxEntry *&pNewParent, +sal_Bool SfxOrganizeListBox_Impl::NotifyCopying(SvTreeListEntry *pTarget, + SvTreeListEntry* pSource, + SvTreeListEntry *&pNewParent, sal_uIntPtr &rIdx) /* [Description] @@ -818,9 +818,9 @@ sal_Bool SfxOrganizeListBox_Impl::NotifyCopying(SvLBoxEntry *pTarget, [Parameter] - SvLBoxEntry* pTarget Target entry, to where it will be copied - SvLBoxEntry *pSource Source entry, to be copied - SvLBoxEntry *&pNewParent the parent of the target position generated + SvTreeListEntry* pTarget Target entry, to where it will be copied + SvTreeListEntry *pSource Source entry, to be copied + SvTreeListEntry *&pNewParent the parent of the target position generated at entry (out parameter) sal_uIntPtr &rIdx Index of the target entry @@ -829,20 +829,20 @@ sal_Bool SfxOrganizeListBox_Impl::NotifyCopying(SvLBoxEntry *pTarget, [Cross-references] - */ { @@ -864,7 +864,7 @@ sal_Bool SfxOrganizeListBox_Impl::NotifyCopying(SvLBoxEntry *pTarget, //------------------------------------------------------------------------- -sal_Bool SfxOrganizeListBox_Impl::EditingEntry( SvLBoxEntry* pEntry, Selection& ) +sal_Bool SfxOrganizeListBox_Impl::EditingEntry( SvTreeListEntry* pEntry, Selection& ) /* [Description] @@ -872,7 +872,7 @@ sal_Bool SfxOrganizeListBox_Impl::EditingEntry( SvLBoxEntry* pEntry, Selection& (SV-Handler) [Cross-references] - + */ { @@ -887,7 +887,7 @@ sal_Bool SfxOrganizeListBox_Impl::EditingEntry( SvLBoxEntry* pEntry, Selection& //------------------------------------------------------------------------- -sal_Bool SfxOrganizeListBox_Impl::EditedEntry(SvLBoxEntry* pEntry, const rtl::OUString& rText) +sal_Bool SfxOrganizeListBox_Impl::EditedEntry(SvTreeListEntry* pEntry, const rtl::OUString& rText) /* [Description] @@ -901,14 +901,14 @@ sal_Bool SfxOrganizeListBox_Impl::EditedEntry(SvLBoxEntry* pEntry, const rtl::OU sal_False: The name should not be changed [Cross-references] - + */ { DBG_ASSERT(pEntry, "No Entry selected"); delete pDlg->pSuspend; pDlg->pSuspend = NULL; - SvLBoxEntry* pParent = GetParent(pEntry); + SvTreeListEntry* pParent = GetParent(pEntry); if( rText.isEmpty() ) { ErrorBox aBox( this, SfxResId( MSG_ERROR_EMPTY_NAME ) ); @@ -944,7 +944,7 @@ sal_Bool SfxOrganizeListBox_Impl::EditedEntry(SvLBoxEntry* pEntry, const rtl::OU //------------------------------------------------------------------------- -DragDropMode SfxOrganizeListBox_Impl::NotifyStartDrag( TransferDataContainer&, SvLBoxEntry* pEntry ) +DragDropMode SfxOrganizeListBox_Impl::NotifyStartDrag( TransferDataContainer&, SvTreeListEntry* pEntry ) { sal_uInt16 nSourceLevel = GetModel()->GetDepth( pEntry ); if ( VIEW_FILES == GetViewType() ) @@ -959,12 +959,12 @@ DragDropMode SfxOrganizeListBox_Impl::NotifyStartDrag( TransferDataContainer&, S //------------------------------------------------------------------------- -sal_Bool SfxOrganizeListBox_Impl::NotifyAcceptDrop( SvLBoxEntry* pEntry ) +sal_Bool SfxOrganizeListBox_Impl::NotifyAcceptDrop( SvTreeListEntry* pEntry ) { if(!pEntry) return sal_False; SvTreeListBox *pSource = GetSourceView(); - SvLBoxEntry *pSourceEntry = pSource->FirstSelected(); + SvTreeListEntry *pSourceEntry = pSource->FirstSelected(); if(pEntry == pSourceEntry) return sal_False; sal_uInt16 nSourceLevel = pSource->GetModel()->GetDepth(pSourceEntry); @@ -1110,7 +1110,7 @@ SfxObjectShellRef SfxOrganizeListBox_Impl::GetObjectShell(const Path &rPath) //------------------------------------------------------------------------- -void SfxOrganizeListBox_Impl::RequestingChildren( SvLBoxEntry* pEntry ) +void SfxOrganizeListBox_Impl::RequestingChildren( SvTreeListEntry* pEntry ) /* [Description] @@ -1119,7 +1119,7 @@ void SfxOrganizeListBox_Impl::RequestingChildren( SvLBoxEntry* pEntry ) [Parameter] - SvLBoxEntry* pEntry the entry whose children is requested + SvTreeListEntry* pEntry the entry whose children is requested */ { @@ -1167,7 +1167,7 @@ void SfxOrganizeListBox_Impl::RequestingChildren( SvLBoxEntry* pEntry ) Image aClosedImage( aClosedBmp, aMaskColor ); Image aOpenedImage( aOpenedBmp, aMaskColor ); - SvLBoxEntry *pNew = SvTreeListBox::InsertEntry( + SvTreeListEntry *pNew = SvTreeListBox::InsertEntry( aText, aOpenedImage, aClosedImage, pEntry, bCanHaveChildren); pNew->SetUserData(bDeletable ? &bDeletable : 0); @@ -1191,7 +1191,7 @@ long SfxOrganizeListBox_Impl::ExpandingHdl() { if ( !(nImpFlags & SVLBOX_IS_EXPANDING) ) { - SvLBoxEntry* pEntry = GetHdlEntry(); + SvTreeListEntry* pEntry = GetHdlEntry(); const sal_uInt16 nLevel = GetModel()->GetDepth(pEntry); if((eViewType == VIEW_FILES && nLevel == 0) || (eViewType == VIEW_TEMPLATES && nLevel == 1)) @@ -1203,7 +1203,7 @@ long SfxOrganizeListBox_Impl::ExpandingHdl() else pMgr->DeleteObjectShell(aPath[0], aPath[1]); // Delete all SubEntries - SvLBoxEntry *pToDel = SvTreeListBox::GetEntry(pEntry, 0); + SvTreeListEntry *pToDel = SvTreeListBox::GetEntry(pEntry, 0); while(pToDel) { GetModel()->Remove(pToDel); @@ -1217,7 +1217,7 @@ long SfxOrganizeListBox_Impl::ExpandingHdl() //------------------------------------------------------------------------- sal_Bool SfxOrganizeListBox_Impl::IsUniqName_Impl(const String &rText, - SvLBoxEntry* pParent, SvLBoxEntry *pEntry) const + SvTreeListEntry* pParent, SvTreeListEntry *pEntry) const /* [Description] @@ -1226,7 +1226,7 @@ sal_Bool SfxOrganizeListBox_Impl::IsUniqName_Impl(const String &rText, [Parameter] const String & Name of the search entry - SvLBoxEntry* pSibling Siblings (referred to the level) + SvTreeListEntry* pSibling Siblings (referred to the level) [Return value] @@ -1234,7 +1234,7 @@ sal_Bool SfxOrganizeListBox_Impl::IsUniqName_Impl(const String &rText, */ { - SvLBoxEntry* pChild = FirstChild(pParent); + SvTreeListEntry* pChild = FirstChild(pParent); while(pChild) { const String aEntryText(GetEntryText(pChild)); if(COMPARE_EQUAL == aEntryText.CompareIgnoreCaseToAscii(rText)&&(!pEntry || pEntry!=pChild)) @@ -1246,9 +1246,9 @@ sal_Bool SfxOrganizeListBox_Impl::IsUniqName_Impl(const String &rText, //------------------------------------------------------------------------- -sal_uInt16 SfxOrganizeListBox_Impl::GetLevelCount_Impl(SvLBoxEntry* pParent) const +sal_uInt16 SfxOrganizeListBox_Impl::GetLevelCount_Impl(SvTreeListEntry* pParent) const { - SvLBoxEntry* pChild = FirstChild(pParent); + SvTreeListEntry* pChild = FirstChild(pParent); sal_uInt16 nCount = 0; while(pChild) { pChild = NextSibling(pChild); @@ -1259,16 +1259,16 @@ sal_uInt16 SfxOrganizeListBox_Impl::GetLevelCount_Impl(SvLBoxEntry* pParent) con //------------------------------------------------------------------------- -SvLBoxEntry* SfxOrganizeListBox_Impl::InsertEntryByBmpType( +SvTreeListEntry* SfxOrganizeListBox_Impl::InsertEntryByBmpType( const XubString& rText, BMPTYPE eBmpType, - SvLBoxEntry* pParent, + SvTreeListEntry* pParent, sal_Bool bChildrenOnDemand, sal_uIntPtr nPos, void* pUserData ) { - SvLBoxEntry* pEntry = NULL; + SvTreeListEntry* pEntry = NULL; const Image* pExp = NULL; const Image* pCol = NULL; @@ -1651,7 +1651,7 @@ String SfxOrganizeDlg_Impl::GetPath_Impl( sal_Bool bOpen, const String& rFileNam //------------------------------------------------------------------------- -sal_Bool SfxOrganizeDlg_Impl::DontDelete_Impl( SvLBoxEntry* pEntry ) +sal_Bool SfxOrganizeDlg_Impl::DontDelete_Impl( SvTreeListEntry* pEntry ) { sal_uInt16 nDepth = pFocusBox->GetModel()->GetDepth(pEntry); if(SfxOrganizeListBox_Impl::VIEW_FILES == @@ -1675,7 +1675,7 @@ sal_Bool SfxOrganizeDlg_Impl::DontDelete_Impl( SvLBoxEntry* pEntry ) pEntry = pFocusBox->GetParent(pEntry); --nDepth; } - SvLBoxEntry *pTemplateEntry = pEntry; + SvTreeListEntry *pTemplateEntry = pEntry; sal_uInt16 nRegion = 0, nIndex = 0; GetIndices_Impl( pFocusBox, pTemplateEntry, nRegion, nIndex ); @@ -1709,7 +1709,7 @@ sal_Bool SfxOrganizeDlg_Impl::GetServiceName_Impl( String& rName, String& rFileU { sal_Bool bRet = sal_False; const SfxDocumentTemplates* pTemplates = aMgr.GetTemplates(); - SvLBoxEntry* pEntry = pFocusBox ? pFocusBox->FirstSelected() : NULL; + SvTreeListEntry* pEntry = pFocusBox ? pFocusBox->FirstSelected() : NULL; sal_uInt16 nRegion = 0, nIndex = 0; GetIndices_Impl( pFocusBox, pEntry, nRegion, nIndex ); rFileURL = pTemplates->GetPath( nRegion, nIndex ); @@ -1752,7 +1752,7 @@ long SfxOrganizeDlg_Impl::Dispatch_Impl( sal_uInt16 nId, Menu* _pMenu ) { SuspendAccel aTmp(&aEditAcc); - SvLBoxEntry *pEntry = pFocusBox? pFocusBox->FirstSelected(): 0; + SvTreeListEntry *pEntry = pFocusBox? pFocusBox->FirstSelected(): 0; sal_Bool bHandled = sal_True; switch(nId) { @@ -1765,7 +1765,7 @@ long SfxOrganizeDlg_Impl::Dispatch_Impl( sal_uInt16 nId, Menu* _pMenu ) if(0 == pFocusBox->GetModel()->GetDepth(pEntry)) { const rtl::OUString aNoName(SFX2_RESSTR(STR_NONAME)); - SvLBoxEntry* pParent = pFocusBox->GetParent(pEntry); + SvTreeListEntry* pParent = pFocusBox->GetParent(pEntry); rtl::OUString aName(aNoName); sal_Int32 n = 1; while(!pFocusBox->IsUniqName_Impl(aName, pParent)) @@ -1896,7 +1896,7 @@ long SfxOrganizeDlg_Impl::Dispatch_Impl( sal_uInt16 nId, Menu* _pMenu ) const sal_uInt16 nDocLevel = pFocusBox->GetDocLevel(); if ( !pPrt ) pPrt = new Printer; - SvLBoxEntry *pDocEntry = pEntry; + SvTreeListEntry *pDocEntry = pEntry; while ( pFocusBox->GetModel()->GetDepth( pDocEntry ) > nDocLevel ) pDocEntry = pFocusBox->GetParent( pDocEntry ); const String aName(pFocusBox->GetEntryText(pDocEntry)); @@ -1981,7 +1981,7 @@ IMPL_LINK( SfxOrganizeDlg_Impl, AccelSelect_Impl, Accelerator *, pAccel ) */ { - SvLBoxEntry* pEntry = pFocusBox && pFocusBox->GetSelectionCount() ? + SvTreeListEntry* pEntry = pFocusBox && pFocusBox->GetSelectionCount() ? pFocusBox->FirstSelected() : NULL ; return pEntry && ( pAccel->GetCurItemId() == ID_NEW || !DontDelete_Impl( pEntry ) ) ? Dispatch_Impl( pAccel->GetCurItemId(), NULL ) : 0; @@ -2004,7 +2004,7 @@ IMPL_LINK( SfxOrganizeDlg_Impl, MenuActivate_Impl, Menu *, pMenu ) if ( pFocusBox && pFocusBox->IsEditingActive() ) pFocusBox->EndEditing( sal_False ); sal_Bool bEnable = ( pFocusBox && pFocusBox->GetSelectionCount() ); - SvLBoxEntry* pEntry = bEnable ? pFocusBox->FirstSelected() : NULL; + SvTreeListEntry* pEntry = bEnable ? pFocusBox->FirstSelected() : NULL; const sal_uInt16 nDepth = ( bEnable && pFocusBox->GetSelectionCount() ) ? pFocusBox->GetModel()->GetDepth( pEntry ) : 0; const sal_uInt16 nDocLevel = bEnable ? pFocusBox->GetDocLevel() : 0; diff --git a/sfx2/source/view/orgmgr.cxx b/sfx2/source/view/orgmgr.cxx index a2d686206ec6..fc74480a544b 100644 --- a/sfx2/source/view/orgmgr.cxx +++ b/sfx2/source/view/orgmgr.cxx @@ -467,11 +467,11 @@ sal_Bool SfxOrganizeMgr::Delete(SfxOrganizeListBox_Impl *pCaller, { // deleting of a group - SvLBoxEntry *pGroupToDelete = pCaller->GetEntry(nRegion); + SvTreeListEntry *pGroupToDelete = pCaller->GetEntry(nRegion); if ( pGroupToDelete ) { sal_uInt16 nItemNum = (sal_uInt16)( pCaller->GetModel()->GetChildCount( pGroupToDelete ) ); - typedef std::deque BoxEntries; + typedef std::deque BoxEntries; BoxEntries pEntriesToDelete; sal_uInt16 nInd = 0; @@ -504,7 +504,7 @@ sal_Bool SfxOrganizeMgr::Delete(SfxOrganizeListBox_Impl *pCaller, { bModified = 1; // Entry to be deleted. - SvLBoxEntry *pEntryToDelete = pCaller->GetEntry(pCaller->GetEntry(nRegion), nIdx); + SvTreeListEntry *pEntryToDelete = pCaller->GetEntry(pCaller->GetEntry(nRegion), nIdx); pCaller->GetModel()->Remove(pEntryToDelete); } @@ -540,7 +540,7 @@ sal_Bool SfxOrganizeMgr::InsertDir if(bOk) { bModified = 1; - SvLBoxEntry *pEntry = pCaller->InsertEntry(rText, + SvTreeListEntry *pEntry = pCaller->InsertEntry(rText, pCaller->GetOpenedBmp(0), pCaller->GetClosedBmp(0), 0, sal_True, nRegion); @@ -631,7 +631,7 @@ sal_Bool SfxOrganizeMgr::CopyFrom(SfxOrganizeListBox_Impl *pCaller, */ { - SvLBoxEntry *pParent = pCaller->FirstSelected(); + SvTreeListEntry *pParent = pCaller->FirstSelected(); if( nIdx!=USHRT_MAX ) pParent = pCaller->GetParent(pParent); if( pTemplates->CopyFrom( nRegion, nIdx, rName ) ) -- cgit From 75b8d8f597d360e8d789358ca99e78e4742749c5 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 18 Oct 2012 12:59:04 +0100 Subject: expose m_pActionArea so subclasses can add buttons to the right place Change-Id: If0169cc12dc7b2b70996a5798b8c59b2e6e2edae --- sfx2/inc/sfx2/tabdlg.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sfx2') diff --git a/sfx2/inc/sfx2/tabdlg.hxx b/sfx2/inc/sfx2/tabdlg.hxx index fe244b853aff..c3e010a86c62 100644 --- a/sfx2/inc/sfx2/tabdlg.hxx +++ b/sfx2/inc/sfx2/tabdlg.hxx @@ -68,7 +68,6 @@ friend class SfxTabDialogController; VclVBox *m_pVBox; TabControl *m_pTabCtrl; - VclHButtonBox *m_pActionArea; OKButton *m_pOKBtn; PushButton* m_pApplyBtn; PushButton* m_pUserBtn; @@ -115,6 +114,7 @@ protected: virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage ); virtual long Notify( NotifyEvent& rNEvt ); + VclHButtonBox* m_pActionArea; SfxItemSet* pExampleSet; SfxItemSet* GetInputSetImpl(); SfxTabPage* GetTabPage( sal_uInt16 nPageId ) const; -- cgit From fb741b5e1e6aeaee74cf14af4f1cc152f0ab0952 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 10 Oct 2012 10:13:18 +0200 Subject: fdo#46808, Adapt xml::sax::XWriter UNO service to new style Create a merged XWriter interface for the service. The xml.sax.Writer service already existed, it just did not have an IDL file. Change-Id: I4e6d3f3c68f9282a55fc7aa19778f97632fd8ad5 --- sfx2/source/doc/SfxDocumentMetaData.cxx | 11 ++++------- sfx2/source/doc/doctemplates.cxx | 2 +- sfx2/source/doc/doctemplateslocal.cxx | 12 +++++------- sfx2/source/doc/doctemplateslocal.hxx | 2 +- 4 files changed, 11 insertions(+), 16 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx index 0b97c0b8e19a..b530da3571e9 100644 --- a/sfx2/source/doc/SfxDocumentMetaData.cxx +++ b/sfx2/source/doc/SfxDocumentMetaData.cxx @@ -45,6 +45,7 @@ #include "com/sun/star/document/XExporter.hpp" #include "com/sun/star/document/XFilter.hpp" #include "com/sun/star/xml/sax/Parser.hpp" +#include "com/sun/star/xml/sax/Writer.hpp" #include "com/sun/star/xml/dom/XDocument.hpp" #include "com/sun/star/xml/dom/XElement.hpp" #include "com/sun/star/xml/dom/DocumentBuilder.hpp" @@ -2003,13 +2004,9 @@ SfxDocumentMetaData::storeToStorage( if (!xOutStream.is()) throw css::uno::RuntimeException(); css::uno::Reference xMsf ( m_xContext->getServiceManager()); - css::uno::Reference xSaxWriter( - xMsf->createInstanceWithContext(::rtl::OUString( - "com.sun.star.xml.sax.Writer"), m_xContext), - css::uno::UNO_QUERY_THROW); + css::uno::Reference xSaxWriter( + css::xml::sax::Writer::create(m_xContext)); xSaxWriter->setOutputStream(xOutStream); - css::uno::Reference xDocHandler ( - xSaxWriter, css::uno::UNO_QUERY_THROW); const sal_uInt64 version = SotStorage::GetVersion( xStorage ); // Oasis is also the default (0) @@ -2022,7 +2019,7 @@ SfxDocumentMetaData::storeToStorage( css::uno::Reference xPropArg = getURLProperties(Medium); css::uno::Sequence< css::uno::Any > args(2); - args[0] <<= xDocHandler; + args[0] <<= xSaxWriter; args[1] <<= xPropArg; css::uno::Reference xExp( diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx index e1f1986ea930..f4dbb6cf6749 100644 --- a/sfx2/source/doc/doctemplates.cxx +++ b/sfx2/source/doc/doctemplates.cxx @@ -1406,7 +1406,7 @@ sal_Bool SfxDocTplService_Impl::WriteUINamesForTemplateDir_Impl( const ::rtl::OU if ( !xOutStream.is() ) throw uno::RuntimeException(); - DocTemplLocaleHelper::WriteGroupLocalizationSequence( xOutStream, aUINames, mxFactory ); + DocTemplLocaleHelper::WriteGroupLocalizationSequence( xOutStream, aUINames, comphelper::getComponentContext(mxFactory)); try { // the SAX writer might close the stream xOutStream->closeOutput(); diff --git a/sfx2/source/doc/doctemplateslocal.cxx b/sfx2/source/doc/doctemplateslocal.cxx index 82452dc14a39..5f8f174384fc 100644 --- a/sfx2/source/doc/doctemplateslocal.cxx +++ b/sfx2/source/doc/doctemplateslocal.cxx @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -40,19 +41,16 @@ uno::Sequence< beans::StringPair > DocTemplLocaleHelper::ReadGroupLocalizationSe } // ----------------------------------- -void SAL_CALL DocTemplLocaleHelper::WriteGroupLocalizationSequence( const uno::Reference< io::XOutputStream >& xOutStream, const uno::Sequence< beans::StringPair >& aSequence, const uno::Reference< lang::XMultiServiceFactory > xFactory ) +void SAL_CALL DocTemplLocaleHelper::WriteGroupLocalizationSequence( const uno::Reference< io::XOutputStream >& xOutStream, const uno::Sequence< beans::StringPair >& aSequence, const uno::Reference< uno::XComponentContext > xContext ) throw( uno::Exception ) { if ( !xOutStream.is() ) throw uno::RuntimeException(); - uno::Reference< io::XActiveDataSource > xWriterSource( - xFactory->createInstance( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Writer" ) ) ), - uno::UNO_QUERY_THROW ); - uno::Reference< xml::sax::XDocumentHandler > xWriterHandler( xWriterSource, uno::UNO_QUERY_THROW ); + uno::Reference< xml::sax::XWriter > xWriterHandler( + xml::sax::Writer::create(xContext) ); - xWriterSource->setOutputStream( xOutStream ); + xWriterHandler->setOutputStream( xOutStream ); ::rtl::OUString aGroupListElement( RTL_CONSTASCII_USTRINGPARAM( "groupuinames:template-group-list" ) ); ::rtl::OUString aGroupElement( RTL_CONSTASCII_USTRINGPARAM( "groupuinames:template-group" ) ); diff --git a/sfx2/source/doc/doctemplateslocal.hxx b/sfx2/source/doc/doctemplateslocal.hxx index ba0f58af2b86..b6f7fc286b0a 100644 --- a/sfx2/source/doc/doctemplateslocal.hxx +++ b/sfx2/source/doc/doctemplateslocal.hxx @@ -60,7 +60,7 @@ public: void SAL_CALL WriteGroupLocalizationSequence( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutStream, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair >& aSequence, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory ) + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext ) throw( ::com::sun::star::uno::Exception ); // XDocumentHandler -- cgit From de574fe542ccec288c3a5e240a6888d545e8d744 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 22 Oct 2012 23:34:59 +0200 Subject: sfx2: add ERRCODE_SFX_FORMAT_ROWCOL This is similar to the error code ODF filters are using in sw/sc/sd, except that it is not specific to any application, so any UNO filter can use it. All you need to do is to throw io::WrongFormatException with a "," in the message of the exception, and then the error dialog will show it, instead of the useless general error message. Change-Id: I279c8d438f01498b44f14a6dc6aeef85f7dfa4e4 --- sfx2/source/doc/objstor.cxx | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'sfx2') diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index b9b5f0480551..3752a51dbcaf 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -2222,6 +2222,10 @@ sal_Bool SfxObjectShell::ImportFrom( SfxMedium& rMedium, bool bInsert ) { SetError( ERRCODE_IO_BROKENPACKAGE, "Badness in the underlying package format." ); } + catch (const io::WrongFormatException& rException) + { + SetError( *new StringErrorInfo( ERRCODE_SFX_FORMAT_ROWCOL, rException.Message, ERRCODE_BUTTON_OK | ERRCODE_MSG_ERROR ), ""); + } catch(...) {} } -- cgit From c988da288ec473a28f61ebb53aa3ff82bab11ef4 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 11 Oct 2012 15:43:08 +0200 Subject: fdo#46808, Adapt ui::dialogs::FolderPicker UNO service to new style Create a merged XFolderPicker2 interface for this service to implement. Which is backwards-compatible, but does not require creating a new service. Change-Id: I4a2c2a8d491a8d5633c19ddcea547f0efe75b91d --- sfx2/inc/sfx2/filedlghelper.hxx | 1 - sfx2/source/doc/templatedlg.cxx | 7 ++++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'sfx2') diff --git a/sfx2/inc/sfx2/filedlghelper.hxx b/sfx2/inc/sfx2/filedlghelper.hxx index 98c55b192f08..738f8e1e1338 100644 --- a/sfx2/inc/sfx2/filedlghelper.hxx +++ b/sfx2/inc/sfx2/filedlghelper.hxx @@ -70,7 +70,6 @@ class Window; #define FILEDIALOG_FILTER_ALL "*.*" #define FILE_OPEN_SERVICE_NAME "com.sun.star.ui.dialogs.FilePicker" -#define FOLDER_PICKER_SERVICE_NAME "com.sun.star.ui.dialogs.FolderPicker" #define FILE_OPEN_SERVICE_NAME_OOO "com.sun.star.ui.dialogs.OfficeFilePicker" namespace sfx2 { diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index ca5e0b31cd69..01a9a8a47508 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -46,7 +46,7 @@ #include #include #include -#include +#include #include "doc.hrc" #include "templatedlg.hrc" @@ -62,6 +62,7 @@ using namespace ::com::sun::star::beans; using namespace ::com::sun::star::embed; using namespace ::com::sun::star::frame; using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::uno; using namespace ::com::sun::star::ui::dialogs; static bool lcl_getServiceName (const OUString &rFileURL, OUString &rName ); @@ -838,8 +839,8 @@ void SfxTemplateManagerDlg::OnTemplateImport () void SfxTemplateManagerDlg::OnTemplateExport() { - uno::Reference xFactory(comphelper::getProcessServiceFactory()); - uno::Reference xFolderPicker(xFactory->createInstance(FOLDER_PICKER_SERVICE_NAME),uno::UNO_QUERY); + uno::Reference xContext(comphelper::getProcessComponentContext()); + uno::Reference xFolderPicker = FolderPicker::create(xContext); xFolderPicker->setDisplayDirectory(SvtPathOptions().GetWorkPath()); -- cgit From 5aa2cd1d3f85958917f47523ee430af11ac1751d Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 12 Oct 2012 08:57:24 +0200 Subject: fdo#46808, use service constructor for uri::UriReferenceFactory Change-Id: I4e72bf5880fa28cb96d93ede7730a63220af7fa6 --- sfx2/source/appl/app.cxx | 36 ++++++++++-------------- sfx2/source/doc/DocumentMetadataAccess.cxx | 11 ++------ sfx2/source/view/viewfrm.cxx | 45 ++++++++++++++---------------- 3 files changed, 39 insertions(+), 53 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx index a4ffed8510e7..f5862426afe0 100644 --- a/sfx2/source/appl/app.cxx +++ b/sfx2/source/appl/app.cxx @@ -56,7 +56,7 @@ #include #include #include -#include +#include #include #include #include @@ -527,35 +527,29 @@ sal_Bool SfxApplication::IsXScriptURL( const String& rScriptURL ) (void) rScriptURL; #else ::com::sun::star::uno::Reference - < ::com::sun::star::lang::XMultiServiceFactory > xSMgr = - ::comphelper::getProcessServiceFactory(); + < ::com::sun::star::uno::XComponentContext > xContext = + ::comphelper::getProcessComponentContext(); ::com::sun::star::uno::Reference < ::com::sun::star::uri::XUriReferenceFactory > - xFactory( xSMgr->createInstance( - ::rtl::OUString( - "com.sun.star.uri.UriReferenceFactory" ) ), - ::com::sun::star::uno::UNO_QUERY ); + xFactory = ::com::sun::star::uri::UriReferenceFactory::create( xContext ); - if ( xFactory.is() ) + try { - try - { - ::com::sun::star::uno::Reference - < ::com::sun::star::uri::XVndSunStarScriptUrl > - xUrl( xFactory->parse( rScriptURL ), - ::com::sun::star::uno::UNO_QUERY ); + ::com::sun::star::uno::Reference + < ::com::sun::star::uri::XVndSunStarScriptUrl > + xUrl( xFactory->parse( rScriptURL ), + ::com::sun::star::uno::UNO_QUERY ); - if ( xUrl.is() ) - { - result = sal_True; - } - } - catch (const ::com::sun::star::uno::RuntimeException&) + if ( xUrl.is() ) { - // ignore, will just return FALSE + result = sal_True; } } + catch (const ::com::sun::star::uno::RuntimeException&) + { + // ignore, will just return FALSE + } #endif return result; } diff --git a/sfx2/source/doc/DocumentMetadataAccess.cxx b/sfx2/source/doc/DocumentMetadataAccess.cxx index f2fbf52ae512..8ee9bfdc27b6 100644 --- a/sfx2/source/doc/DocumentMetadataAccess.cxx +++ b/sfx2/source/doc/DocumentMetadataAccess.cxx @@ -61,7 +61,7 @@ #include #include -#include +#include #include @@ -147,13 +147,8 @@ uno::Reference createBaseURI( } } - const uno::Reference xServiceFactory( - i_xContext->getServiceManager(), uno::UNO_SET_THROW); - const uno::Reference xUriFactory( - xServiceFactory->createInstanceWithContext( - ::rtl::OUString( - "com.sun.star.uri.UriReferenceFactory"), i_xContext), - uno::UNO_QUERY_THROW); + const uno::Reference xUriFactory = + uri::UriReferenceFactory::create( i_xContext); uno::Reference< uri::XUriReference > xBaseURI; const uno::Reference< uri::XUriReference > xPkgURI( diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index d9ed89314e47..09e1d55a63bd 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -56,7 +56,7 @@ #include #include #include -#include +#include #include #include #include @@ -2620,29 +2620,26 @@ void SfxViewFrame::AddDispatchMacroToBasic_Impl( const ::rtl::OUString& sMacro ) String aModuleName; String aMacroName; String aLocation; - Reference< XMultiServiceFactory > xSMgr = ::comphelper::getProcessServiceFactory(); - Reference< com::sun::star::uri::XUriReferenceFactory > xFactory( xSMgr->createInstance( - ::rtl::OUString("com.sun.star.uri.UriReferenceFactory") ), UNO_QUERY ); - if ( xFactory.is() ) - { - Reference< com::sun::star::uri::XVndSunStarScriptUrl > xUrl( xFactory->parse( aScriptURL ), UNO_QUERY ); - if ( xUrl.is() ) - { - // get name - ::rtl::OUString aName = xUrl->getName(); - sal_Unicode cTok = '.'; - sal_Int32 nIndex = 0; - aLibName = aName.getToken( 0, cTok, nIndex ); - if ( nIndex != -1 ) - aModuleName = aName.getToken( 0, cTok, nIndex ); - if ( nIndex != -1 ) - aMacroName = aName.getToken( 0, cTok, nIndex ); - - // get location - ::rtl::OUString aLocKey("location"); - if ( xUrl->hasParameter( aLocKey ) ) - aLocation = xUrl->getParameter( aLocKey ); - } + Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + Reference< com::sun::star::uri::XUriReferenceFactory > xFactory = + com::sun::star::uri::UriReferenceFactory::create( xContext ); + Reference< com::sun::star::uri::XVndSunStarScriptUrl > xUrl( xFactory->parse( aScriptURL ), UNO_QUERY ); + if ( xUrl.is() ) + { + // get name + ::rtl::OUString aName = xUrl->getName(); + sal_Unicode cTok = '.'; + sal_Int32 nIndex = 0; + aLibName = aName.getToken( 0, cTok, nIndex ); + if ( nIndex != -1 ) + aModuleName = aName.getToken( 0, cTok, nIndex ); + if ( nIndex != -1 ) + aMacroName = aName.getToken( 0, cTok, nIndex ); + + // get location + ::rtl::OUString aLocKey("location"); + if ( xUrl->hasParameter( aLocKey ) ) + aLocation = xUrl->getParameter( aLocKey ); } BasicManager* pBasMgr = 0; -- cgit From 48c9586e0797871e519d1cf68aa59bcc4ba02651 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 23 Oct 2012 14:50:24 +0200 Subject: RtfFilter::filter: not allowed to throw WrongFormatException: throw a WrappedTargetRuntimeException instead :( Change-Id: Iebf2b709beea738ba513ec5ce884874b76fbf243 --- sfx2/source/doc/objstor.cxx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 3752a51dbcaf..45b1cb28fa37 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -2222,9 +2223,14 @@ sal_Bool SfxObjectShell::ImportFrom( SfxMedium& rMedium, bool bInsert ) { SetError( ERRCODE_IO_BROKENPACKAGE, "Badness in the underlying package format." ); } - catch (const io::WrongFormatException& rException) + catch (const lang::WrappedTargetRuntimeException& rWrapped) { - SetError( *new StringErrorInfo( ERRCODE_SFX_FORMAT_ROWCOL, rException.Message, ERRCODE_BUTTON_OK | ERRCODE_MSG_ERROR ), ""); + io::WrongFormatException e; + if (rWrapped.TargetException >>= e) + { + SetError(*new StringErrorInfo(ERRCODE_SFX_FORMAT_ROWCOL, + e.Message, ERRCODE_BUTTON_OK | ERRCODE_MSG_ERROR ), ""); + } } catch(...) {} -- cgit From 432c0f491712870b82dcf5dee7b98fa5440bfa1a Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 16 Oct 2012 11:10:43 +0200 Subject: fdo#46808, use service constructor for frame::ModuleManager Change-Id: Iae2bd22a22213274d4a7697345b879f6573a30f0 --- sfx2/source/doc/sfxbasemodel.cxx | 5 +++-- sfx2/source/view/sfxbasecontroller.cxx | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 872bdbca3b59..37180abe9187 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -3833,12 +3833,13 @@ css::uno::Reference< css::frame::XTitle > SfxBaseModel::impl_getTitleHelper () if ( ! m_pData->m_xTitleHelper.is ()) { - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory (); + css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); + css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); const ::rtl::OUString SERVICENAME_DESKTOP("com.sun.star.frame.Desktop"); css::uno::Reference< css::frame::XUntitledNumbers > xDesktop(xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY_THROW); css::uno::Reference< css::frame::XModel > xThis (static_cast< css::frame::XModel* >(this), css::uno::UNO_QUERY_THROW); - ::framework::TitleHelper* pHelper = new ::framework::TitleHelper(xSMGR); + ::framework::TitleHelper* pHelper = new ::framework::TitleHelper(xContext); m_pData->m_xTitleHelper = css::uno::Reference< css::frame::XTitle >(static_cast< ::cppu::OWeakObject* >(pHelper), css::uno::UNO_QUERY_THROW); pHelper->setOwner (xThis ); pHelper->connectWithUntitledNumbers (xDesktop); diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index 7b315a6b62ed..658d887db7fb 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -1503,7 +1503,7 @@ css::uno::Reference< css::frame::XTitle > SfxBaseController::impl_getTitleHelper css::uno::Reference< css::frame::XUntitledNumbers > xUntitledProvider(xModel , css::uno::UNO_QUERY ); css::uno::Reference< css::frame::XController > xThis (static_cast< css::frame::XController* >(this), css::uno::UNO_QUERY_THROW); - ::framework::TitleHelper* pHelper = new ::framework::TitleHelper(::comphelper::getProcessServiceFactory()); + ::framework::TitleHelper* pHelper = new ::framework::TitleHelper(::comphelper::getProcessComponentContext()); m_pData->m_xTitleHelper = css::uno::Reference< css::frame::XTitle >(static_cast< ::cppu::OWeakObject* >(pHelper), css::uno::UNO_QUERY_THROW); pHelper->setOwner (xThis ); -- cgit From e8aa70b5d44a6cbedacfe0e5d1b1da2c76a3c588 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 16 Oct 2012 14:05:41 +0200 Subject: fdo#46808, convert comphelper::ConfigurationHelper to XComponentContext Convert the helper methods to take an XComponentContext parameter, instead of XMultiServiceFactory. Change-Id: I9f0098af37b91f107d8799f14caa04756eac82b1 --- sfx2/source/appl/appopen.cxx | 2 +- sfx2/source/appl/appserv.cxx | 2 +- sfx2/source/appl/newhelp.cxx | 4 ++-- sfx2/source/doc/docfac.cxx | 2 +- sfx2/source/doc/docfile.cxx | 4 ++-- sfx2/source/doc/guisaveas.cxx | 2 +- sfx2/source/view/viewfrm.cxx | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index 1d1798ffb659..348f1c11f172 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -999,7 +999,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) try { // get registered protocol handlers from configuration - Reference < XNameAccess > xAccess( ::comphelper::ConfigurationHelper::openConfig( ::comphelper::getProcessServiceFactory(), + Reference < XNameAccess > xAccess( ::comphelper::ConfigurationHelper::openConfig( ::comphelper::getProcessComponentContext(), ::rtl::OUString("org.openoffice.Office.ProtocolHandler/HandlerSet"), ::comphelper::ConfigurationHelper::E_READONLY ), UNO_QUERY ); if ( xAccess.is() ) { diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index 450da3e9eebc..c008ca2286db 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -1002,7 +1002,7 @@ static ::rtl::OUString getConfigurationStringValue( try { ::comphelper::ConfigurationHelper::readDirectKey( - comphelper::getProcessServiceFactory(), + comphelper::getProcessComponentContext(), rPackage, rRelPath, rKey, diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx index 1441c36db915..3e39f645395c 100644 --- a/sfx2/source/appl/newhelp.cxx +++ b/sfx2/source/appl/newhelp.cxx @@ -2170,7 +2170,7 @@ void SfxHelpTextWindow_Impl::InitOnStartupBox( bool bOnlyText ) { sCurrentFactory = SfxHelp::GetCurrentModuleIdentifier(); - Reference< XMultiServiceFactory > xMultiServiceFac = ::comphelper::getProcessServiceFactory(); + Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); Reference< XInterface > xConfig; ::rtl::OUString sPath( PATH_OFFICE_FACTORIES ); sPath += sCurrentFactory; @@ -2185,7 +2185,7 @@ void SfxHelpTextWindow_Impl::InitOnStartupBox( bool bOnlyText ) try { xConfiguration = ConfigurationHelper::openConfig( - xMultiServiceFac, PACKAGE_SETUP, ConfigurationHelper::E_STANDARD ); + xContext, PACKAGE_SETUP, ConfigurationHelper::E_STANDARD ); if ( xConfiguration.is() ) { Any aAny = ConfigurationHelper::readRelativeKey( xConfiguration, sPath, sKey ); diff --git a/sfx2/source/doc/docfac.cxx b/sfx2/source/doc/docfac.cxx index 4caac052801c..a183008549c9 100644 --- a/sfx2/source/doc/docfac.cxx +++ b/sfx2/source/doc/docfac.cxx @@ -224,7 +224,7 @@ void SfxObjectFactory::SetSystemTemplate( const String& rServiceName, const Stri { uno::Reference< lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); uno::Reference< uno::XInterface > xConfig = ::comphelper::ConfigurationHelper::openConfig( - xFactory, CONF_ROOT, ::comphelper::ConfigurationHelper::E_STANDARD ); + ::comphelper::getProcessComponentContext(), CONF_ROOT, ::comphelper::ConfigurationHelper::E_STANDARD ); ::rtl::OUString aActualFilter; ::comphelper::ConfigurationHelper::readRelativeKey( xConfig, CONF_PATH, PROP_ACTUAL_FILTER ) >>= aActualFilter; diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 995be9cad8fe..4d5227b73658 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -143,7 +143,7 @@ bool IsSystemFileLockingUsed() { uno::Reference< uno::XInterface > xCommonConfig = ::comphelper::ConfigurationHelper::openConfig( - ::comphelper::getProcessServiceFactory(), + ::comphelper::getProcessComponentContext(), ::rtl::OUString( "/org.openoffice.Office.Common" ), ::comphelper::ConfigurationHelper::E_STANDARD ); if ( !xCommonConfig.is() ) @@ -170,7 +170,7 @@ bool IsOOoLockFileUsed() { uno::Reference< uno::XInterface > xCommonConfig = ::comphelper::ConfigurationHelper::openConfig( - ::comphelper::getProcessServiceFactory(), + ::comphelper::getProcessComponentContext(), ::rtl::OUString( "/org.openoffice.Office.Common" ), ::comphelper::ConfigurationHelper::E_STANDARD ); if ( !xCommonConfig.is() ) diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 3add4b1aacfe..f90432f12006 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -612,7 +612,7 @@ sal_Int8 ModelData_Impl::CheckSaveAcceptable( sal_Int8 nCurStatus ) // check whether save is acceptable by the configuration // it is done only for documents that have persistence already uno::Reference< uno::XInterface > xCommonConfig = ::comphelper::ConfigurationHelper::openConfig( - m_pOwner->GetServiceFactory(), + comphelper::getComponentContext(m_pOwner->GetServiceFactory()), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common" ) ), ::comphelper::ConfigurationHelper::E_STANDARD ); if ( !xCommonConfig.is() ) diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 09e1d55a63bd..c963fe6ed345 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -2327,7 +2327,7 @@ sal_Bool impl_maxOpenDocCountReached() { css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); css::uno::Any aVal = ::comphelper::ConfigurationHelper::readDirectKey( - xSMGR, + ::comphelper::getProcessComponentContext(), ::rtl::OUString("org.openoffice.Office.Common/"), ::rtl::OUString("Misc"), ::rtl::OUString("MaxOpenDocuments"), -- cgit From 33a0f8ce656c8c5bb9c3c3deaa10c182e262b374 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 17 Oct 2012 10:52:52 +0200 Subject: fdo#46808, Adapt awt::Toolkit UNO service to new style Create a merged XToolkit2 interface for this service to implement. Which is backwards-compatible, but does not require creating a new service. Also mark sub-interfaces as non-optional. Change-Id: I278d0288e92be277033013302267cf93f7d70480 --- sfx2/workben/custompanel/ctp_panel.cxx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'sfx2') diff --git a/sfx2/workben/custompanel/ctp_panel.cxx b/sfx2/workben/custompanel/ctp_panel.cxx index 6cde8e4e5fb9..d41f2e64a847 100644 --- a/sfx2/workben/custompanel/ctp_panel.cxx +++ b/sfx2/workben/custompanel/ctp_panel.cxx @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include #include @@ -81,10 +81,7 @@ namespace sd { namespace colortoolpanel { ENSURE_OR_THROW( i_rContext.is(), "illegal component context" ); Reference< XMultiComponentFactory > xFactory( i_rContext->getServiceManager(), UNO_SET_THROW ); - Reference< XToolkit > xToolkit( xFactory->createInstanceWithContext( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.Toolkit" ) ), - i_rContext - ), UNO_QUERY_THROW ); + Reference< XToolkit2 > xToolkit = Toolkit::create(i_rContext); WindowDescriptor aWindow; aWindow.Type = WindowClass_SIMPLE; -- cgit From 13bedc55b1d533eadcfd4932ef57076e3642caaf Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 17 Oct 2012 15:00:30 +0200 Subject: fdo#46808, use service constructor for frame::GlobalEventBroadcaster Add document::XEventBroadcaster interface to XGlobalEventBroadcaster, because a client uses it, and the service always implements it. This is safe to do because we haven't released an LO version with XGlobalEventBroadcaster in it yet. --- sfx2/source/inc/eventsupplier.hxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/inc/eventsupplier.hxx b/sfx2/source/inc/eventsupplier.hxx index a7aefd20753b..2a8aea49fc04 100644 --- a/sfx2/source/inc/eventsupplier.hxx +++ b/sfx2/source/inc/eventsupplier.hxx @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include #include @@ -172,9 +172,8 @@ class ModelCollectionEnumeration : public ModelCollectionMutexBase //============================================================================= //TODO: remove support of obsolete document::XEventBroadcaster/Listener class SfxGlobalEvents_Impl : public ModelCollectionMutexBase - , public ::cppu::WeakImplHelper4< ::com::sun::star::lang::XServiceInfo + , public ::cppu::WeakImplHelper3< ::com::sun::star::lang::XServiceInfo , ::com::sun::star::frame::XGlobalEventBroadcaster - , ::com::sun::star::document::XEventBroadcaster , ::com::sun::star::document::XEventListener > { -- cgit From d3fb6d227c77198aa0b70d6f5260ff239f5d692c Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 25 Oct 2012 14:46:59 +0100 Subject: remove .ui mark-up in favor of font attributes so we can keep translations markup free, and it matches better our existing font use in controls Change-Id: Ib762030f8bf831f2b0afabdd643508e660ad9266 See: https://live.gnome.org/GnomeGoals/RemoveMarkupInMessages --- sfx2/uiconfig/ui/password.ui | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'sfx2') diff --git a/sfx2/uiconfig/ui/password.ui b/sfx2/uiconfig/ui/password.ui index 3f48b6aad0d6..dc14bd25cd7b 100644 --- a/sfx2/uiconfig/ui/password.ui +++ b/sfx2/uiconfig/ui/password.ui @@ -191,8 +191,10 @@ True False - <b>Password</b> - True + Password + + + @@ -287,8 +289,10 @@ True False - <b>Second Password</b> - True + Second Password + + + -- cgit From 6affa4be69aa31e27af9d50e9ab6bd740319c379 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sat, 27 Oct 2012 15:13:34 +0100 Subject: callcatcher: update list, stop hiding uncalled tests :-) Change-Id: I9bd81a9c5e85db4512a3e4768c9b87696c91b7bc --- sfx2/inc/sfx2/thumbnailview.hxx | 9 ----- sfx2/source/control/thumbnailview.cxx | 69 ----------------------------------- 2 files changed, 78 deletions(-) (limited to 'sfx2') diff --git a/sfx2/inc/sfx2/thumbnailview.hxx b/sfx2/inc/sfx2/thumbnailview.hxx index 12d28124f83c..084b3d13fbc3 100644 --- a/sfx2/inc/sfx2/thumbnailview.hxx +++ b/sfx2/inc/sfx2/thumbnailview.hxx @@ -179,16 +179,10 @@ public: virtual ~ThumbnailView (); - void InsertItem( sal_uInt16 nItemId, - const BitmapEx &rImage, const OUString &rStr, - size_t nPos = THUMBNAILVIEW_APPEND ); - void RemoveItem( sal_uInt16 nItemId ); void Clear(); - size_t GetItemCount() const; - size_t GetItemPos( sal_uInt16 nItemId ) const; sal_uInt16 GetItemId( size_t nPos ) const; @@ -300,13 +294,10 @@ protected: SFX2_DLLPRIVATE void ImplInitScrollBar(); SFX2_DLLPRIVATE void ImplDeleteItems(); SFX2_DLLPRIVATE void ImplDraw(); - using Window::ImplScroll; - SFX2_DLLPRIVATE bool ImplScroll( const Point& rPos ); SFX2_DLLPRIVATE size_t ImplGetItem( const Point& rPoint, bool bMove = false ) const; SFX2_DLLPRIVATE ThumbnailViewItem* ImplGetItem( size_t nPos ); SFX2_DLLPRIVATE sal_uInt16 ImplGetVisibleItemCount() const; SFX2_DLLPRIVATE ThumbnailViewItem* ImplGetVisibleItem( sal_uInt16 nVisiblePos ); - SFX2_DLLPRIVATE void ImplInsertItem( ThumbnailViewItem *const pItem, const size_t nPos ); SFX2_DLLPRIVATE void ImplFireAccessibleEvent( short nEventId, const ::com::sun::star::uno::Any& rOldValue, const ::com::sun::star::uno::Any& rNewValue ); SFX2_DLLPRIVATE bool ImplHasAccessibleListeners(); DECL_DLLPRIVATE_LINK( ImplScrollHdl, ScrollBar* ); diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx index 6741b59730d2..fd2d215b01e8 100644 --- a/sfx2/source/control/thumbnailview.cxx +++ b/sfx2/source/control/thumbnailview.cxx @@ -405,40 +405,6 @@ void ThumbnailView::CalculateItemPositions () delete pDelScrBar; } -bool ThumbnailView::ImplScroll( const Point& rPos ) -{ - if ( !mbScroll || !maItemListRect.IsInside(rPos) ) - return false; - - const long nScrollOffset = (mnItemHeight <= 16) ? SCROLL_OFFSET/2 : SCROLL_OFFSET; - bool bScroll = false; - - if ( rPos.Y() <= maItemListRect.Top()+nScrollOffset ) - { - if ( mnFirstLine > 0 ) - { - --mnFirstLine; - bScroll = true; - } - } - else if ( rPos.Y() >= maItemListRect.Bottom()-nScrollOffset ) - { - if ( mnFirstLine < static_cast(mnLines-mnVisLines) ) - { - ++mnFirstLine; - bScroll = true; - } - } - - if ( !bScroll ) - return false; - - if ( IsReallyVisible() && IsUpdateMode() ) - Invalidate(); - - return true; -} - size_t ThumbnailView::ImplGetItem( const Point& rPos, bool bMove ) const { if ( !mbHasVisibleItems ) @@ -791,36 +757,6 @@ void ThumbnailView::DataChanged( const DataChangedEvent& rDCEvt ) } } -void ThumbnailView::InsertItem( sal_uInt16 nItemId, const BitmapEx& rImage, - const OUString& rText, size_t nPos ) -{ - ThumbnailViewItem* pItem = new ThumbnailViewItem( *this, this ); - pItem->mnId = nItemId; - pItem->maPreview1 = rImage; - pItem->maTitle = rText; - pItem->setSelectClickHdl(LINK(this,ThumbnailView,OnItemSelected)); - ImplInsertItem( pItem, nPos ); -} - -void ThumbnailView::ImplInsertItem( ThumbnailViewItem *const pItem, const size_t nPos ) -{ - assert(pItem->mnId); // "ItemId == 0" - assert(GetItemPos( pItem->mnId ) == THUMBNAILVIEW_ITEM_NOTFOUND); // ItemId already exists - - if ( nPos < mItemList.size() ) { - ValueItemList::iterator it = mItemList.begin(); - ::std::advance( it, nPos ); - mItemList.insert( it, pItem ); - } else { - mItemList.push_back( pItem ); - } - - CalculateItemPositions(); - - if ( IsReallyVisible() && IsUpdateMode() ) - Invalidate(); -} - void ThumbnailView::RemoveItem( sal_uInt16 nItemId ) { size_t nPos = GetItemPos( nItemId ); @@ -863,11 +799,6 @@ void ThumbnailView::Clear() Invalidate(); } -size_t ThumbnailView::GetItemCount() const -{ - return mItemList.size(); -} - size_t ThumbnailView::GetItemPos( sal_uInt16 nItemId ) const { for ( size_t i = 0, n = mItemList.size(); i < n; ++i ) { -- cgit From 9b63e4e6e46ee7560d99c3d4cff5e085efc14949 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 17 Oct 2012 15:51:00 +0200 Subject: fdo#46808, use service constructor for frame::DispatchRecorderSupplier --- sfx2/source/view/viewfrm.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index c963fe6ed345..f039d3e2c39c 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -2833,14 +2834,14 @@ void SfxViewFrame::MiscExec_Impl( SfxRequest& rReq ) com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), com::sun::star::uno::UNO_QUERY); + com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > xContext( + ::comphelper::getProcessComponentContext()); xRecorder = com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder >( xFactory->createInstance(rtl::OUString("com.sun.star.frame.DispatchRecorder")), com::sun::star::uno::UNO_QUERY); - xSupplier = com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorderSupplier >( - xFactory->createInstance(rtl::OUString("com.sun.star.frame.DispatchRecorderSupplier")), - com::sun::star::uno::UNO_QUERY); + xSupplier = com::sun::star::frame::DispatchRecorderSupplier::create( xContext ); xSupplier->setDispatchRecorder(xRecorder); xRecorder->startRecording(xFrame); -- cgit From eebcaa02585bda0656ca1032082c4dd676de732d Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 18 Oct 2012 11:37:13 +0200 Subject: fdo#46808, use service constructor for task::JobExecutor Also remove some unnecessary fields. --- sfx2/inc/sfx2/sfxuno.hxx | 57 ++++++++++++++++++++++++++++++++++++ sfx2/source/inc/eventsupplier.hxx | 6 ++-- sfx2/source/notify/eventsupplier.cxx | 18 +++++------- 3 files changed, 66 insertions(+), 15 deletions(-) (limited to 'sfx2') diff --git a/sfx2/inc/sfx2/sfxuno.hxx b/sfx2/inc/sfx2/sfxuno.hxx index 9e68dc4f913d..103806456caf 100644 --- a/sfx2/inc/sfx2/sfxuno.hxx +++ b/sfx2/inc/sfx2/sfxuno.hxx @@ -563,6 +563,63 @@ bool GetEncryptionData_Impl( const SfxItemSet* pSet, ::com::sun::star::uno::Sequ return UNOREFERENCE< UNOXINTERFACE >( *new IMPLCLASS( xServiceManager ) ); \ } +//************************************************************************************************************************ +// implementation of XServiceInfo::getImplementationName() +// XServiceInfo::supportsService() +// XServiceInfo::getSupportedServiceNames() +// static xxx::impl_getStaticSupportedServiceNames() +// static xxx::impl_getStaticImplementationName() +// static xxx::impl_createInstance() +//************************************************************************************************************************ +#define SFX_IMPL_XSERVICEINFO_CTX( IMPLCLASS, IMPLSERVICENAME, IMPLNAME ) \ + \ + /* XServiceInfo */ \ + rtl::OUString SAL_CALL IMPLCLASS::getImplementationName() throw( UNORUNTIMEEXCEPTION ) \ + { \ + return impl_getStaticImplementationName(); \ + } \ + \ + /* XServiceInfo */ \ + sal_Bool SAL_CALL IMPLCLASS::supportsService( const rtl::OUString& sServiceName ) throw( UNORUNTIMEEXCEPTION ) \ + { \ + UNOSEQUENCE< rtl::OUString > seqServiceNames = getSupportedServiceNames(); \ + const rtl::OUString* pArray = seqServiceNames.getConstArray(); \ + for ( sal_Int32 nCounter=0; nCounter SAL_CALL IMPLCLASS::getSupportedServiceNames() throw( UNORUNTIMEEXCEPTION ) \ + { \ + return impl_getStaticSupportedServiceNames(); \ + } \ + \ + /* Helper for XServiceInfo */ \ + UNOSEQUENCE< rtl::OUString > IMPLCLASS::impl_getStaticSupportedServiceNames() \ + { \ + UNOSEQUENCE< rtl::OUString > seqServiceNames( 1 ); \ + seqServiceNames.getArray() [0] = rtl::OUString::createFromAscii( IMPLSERVICENAME ); \ + return seqServiceNames ; \ + } \ + \ + /* Helper for XServiceInfo */ \ + rtl::OUString IMPLCLASS::impl_getStaticImplementationName() \ + { \ + return rtl::OUString::createFromAscii( IMPLNAME ); \ + } \ + \ + /* Helper for registry */ \ + UNOREFERENCE< UNOXINTERFACE > SAL_CALL IMPLCLASS::impl_createInstance( const UNOREFERENCE< UNOXMULTISERVICEFACTORY >& xServiceManager ) throw( UNOEXCEPTION ) \ + { \ + return UNOREFERENCE< UNOXINTERFACE >( *new IMPLCLASS( comphelper::getComponentContext(xServiceManager) ) ); \ + } + //************************************************************************************************************************ // definition of createFactory() for MultiServices //************************************************************************************************************************ diff --git a/sfx2/source/inc/eventsupplier.hxx b/sfx2/source/inc/eventsupplier.hxx index 2a8aea49fc04..b00a2a02a41c 100644 --- a/sfx2/source/inc/eventsupplier.hxx +++ b/sfx2/source/inc/eventsupplier.hxx @@ -142,7 +142,6 @@ class ModelCollectionEnumeration : public ModelCollectionMutexBase // member //------------------------------------------------------------------------- private: - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xSMGR; TModelList m_lModels; TModelList::iterator m_pEnumerationIt; @@ -150,7 +149,7 @@ class ModelCollectionEnumeration : public ModelCollectionMutexBase // native interface //------------------------------------------------------------------------- public: - ModelCollectionEnumeration(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xSMGR); + ModelCollectionEnumeration(); virtual ~ModelCollectionEnumeration(); void setModelList(const TModelList& rList); @@ -177,7 +176,6 @@ class SfxGlobalEvents_Impl : public ModelCollectionMutexBase , ::com::sun::star::document::XEventListener > { - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xSMGR; ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > m_xEvents; ::com::sun::star::uno::WeakReference< ::com::sun::star::document::XEventListener > m_xJobExecutorListener; OINTERFACECONTAINERHELPER m_aLegacyListeners; @@ -186,7 +184,7 @@ class SfxGlobalEvents_Impl : public ModelCollectionMutexBase GlobalEventConfig* pImp; public: - SfxGlobalEvents_Impl(const com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory >& xSMGR); + SfxGlobalEvents_Impl(const com::sun::star::uno::Reference < ::com::sun::star::uno::XComponentContext >& rxContext); virtual ~SfxGlobalEvents_Impl(); SFX_DECL_XSERVICEINFO diff --git a/sfx2/source/notify/eventsupplier.cxx b/sfx2/source/notify/eventsupplier.cxx index 2b4508e891fa..625fedbd5cfa 100644 --- a/sfx2/source/notify/eventsupplier.cxx +++ b/sfx2/source/notify/eventsupplier.cxx @@ -21,6 +21,7 @@ #include +#include #include #include #include @@ -496,9 +497,8 @@ void SfxEvents_Impl::NormalizeMacro( const ::comphelper::NamedValueCollection& i } } -ModelCollectionEnumeration::ModelCollectionEnumeration(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR) +ModelCollectionEnumeration::ModelCollectionEnumeration() : ModelCollectionMutexBase( ) - , m_xSMGR (xSMGR ) , m_pEnumerationIt (m_lModels.begin()) { } @@ -545,13 +545,12 @@ css::uno::Any SAL_CALL ModelCollectionEnumeration::nextElement() return css::uno::makeAny(xModel); } -SFX_IMPL_XSERVICEINFO( SfxGlobalEvents_Impl, "com.sun.star.frame.GlobalEventBroadcaster", "com.sun.star.comp.sfx2.GlobalEventBroadcaster" ) +SFX_IMPL_XSERVICEINFO_CTX( SfxGlobalEvents_Impl, "com.sun.star.frame.GlobalEventBroadcaster", "com.sun.star.comp.sfx2.GlobalEventBroadcaster" ) SFX_IMPL_ONEINSTANCEFACTORY( SfxGlobalEvents_Impl ); //----------------------------------------------------------------------------- -SfxGlobalEvents_Impl::SfxGlobalEvents_Impl( const com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory >& xSMGR) +SfxGlobalEvents_Impl::SfxGlobalEvents_Impl( const css::uno::Reference < css::uno::XComponentContext >& rxContext) : ModelCollectionMutexBase( ) - , m_xSMGR (xSMGR ) , m_aLegacyListeners (m_aLock) , m_aDocumentListeners (m_aLock) , pImp (0 ) @@ -560,9 +559,7 @@ SfxGlobalEvents_Impl::SfxGlobalEvents_Impl( const com::sun::star::uno::Reference SFX_APP(); pImp = new GlobalEventConfig(); m_xEvents = pImp; - m_xJobExecutorListener = css::uno::Reference< css::document::XEventListener >( - xSMGR->createInstance(::rtl::OUString("com.sun.star.task.JobExecutor")), - UNO_QUERY); + m_xJobExecutorListener = css::uno::Reference< css::document::XEventListener >( css::task::JobExecutor::create( rxContext ), css::uno::UNO_QUERY_THROW ); m_refCount--; } @@ -754,7 +751,7 @@ css::uno::Reference< css::container::XEnumeration > SAL_CALL SfxGlobalEvents_Imp { // SAFE -> ::osl::ResettableMutexGuard aLock(m_aLock); - ModelCollectionEnumeration* pEnum = new ModelCollectionEnumeration(m_xSMGR); + ModelCollectionEnumeration* pEnum = new ModelCollectionEnumeration(); pEnum->setModelList(m_lModels); css::uno::Reference< css::container::XEnumeration > xEnum( static_cast< css::container::XEnumeration* >(pEnum), @@ -792,8 +789,7 @@ void SfxGlobalEvents_Impl::implts_notifyJobExecution(const css::document::EventO css::uno::Reference< css::document::XEventListener > xJobExecutor(m_xJobExecutorListener); aLock.clear(); // <- SAFE - if (xJobExecutor.is()) - xJobExecutor->notifyEvent(aEvent); + xJobExecutor->notifyEvent(aEvent); } catch(const css::uno::RuntimeException&) { throw; } -- cgit From d29818290376f10f318ba805a79643384b34986e Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Mon, 29 Oct 2012 16:22:02 +0100 Subject: fdo#46808: Fix previous commit Removing the xJobExecutor.is() check from SfxGlobalEvents_Impl::implts_notifyJobExecution was wrong, as m_xJobExecutorListener was a WeakReference. However, it appears there is no good reason for the latter, so the situation can be corrected by turning it into a plain Reference. Change-Id: I5690d226b3e8fdd97f75a37502e600b460ec674c --- sfx2/source/inc/eventsupplier.hxx | 3 +-- sfx2/source/notify/eventsupplier.cxx | 9 ++------- 2 files changed, 3 insertions(+), 9 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/inc/eventsupplier.hxx b/sfx2/source/inc/eventsupplier.hxx index b00a2a02a41c..737e3724bb99 100644 --- a/sfx2/source/inc/eventsupplier.hxx +++ b/sfx2/source/inc/eventsupplier.hxx @@ -34,7 +34,6 @@ #include #include #include -#include #include #include #include @@ -177,7 +176,7 @@ class SfxGlobalEvents_Impl : public ModelCollectionMutexBase > { ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > m_xEvents; - ::com::sun::star::uno::WeakReference< ::com::sun::star::document::XEventListener > m_xJobExecutorListener; + ::com::sun::star::uno::Reference< ::com::sun::star::document::XEventListener > m_xJobExecutorListener; OINTERFACECONTAINERHELPER m_aLegacyListeners; OINTERFACECONTAINERHELPER m_aDocumentListeners; TModelList m_lModels; diff --git a/sfx2/source/notify/eventsupplier.cxx b/sfx2/source/notify/eventsupplier.cxx index 625fedbd5cfa..21b578b7146a 100644 --- a/sfx2/source/notify/eventsupplier.cxx +++ b/sfx2/source/notify/eventsupplier.cxx @@ -551,6 +551,7 @@ SFX_IMPL_ONEINSTANCEFACTORY( SfxGlobalEvents_Impl ); //----------------------------------------------------------------------------- SfxGlobalEvents_Impl::SfxGlobalEvents_Impl( const css::uno::Reference < css::uno::XComponentContext >& rxContext) : ModelCollectionMutexBase( ) + , m_xJobExecutorListener( css::task::JobExecutor::create( rxContext ), css::uno::UNO_QUERY_THROW ) , m_aLegacyListeners (m_aLock) , m_aDocumentListeners (m_aLock) , pImp (0 ) @@ -559,7 +560,6 @@ SfxGlobalEvents_Impl::SfxGlobalEvents_Impl( const css::uno::Reference < css::uno SFX_APP(); pImp = new GlobalEventConfig(); m_xEvents = pImp; - m_xJobExecutorListener = css::uno::Reference< css::document::XEventListener >( css::task::JobExecutor::create( rxContext ), css::uno::UNO_QUERY_THROW ); m_refCount--; } @@ -784,12 +784,7 @@ void SfxGlobalEvents_Impl::implts_notifyJobExecution(const css::document::EventO { try { - // SAFE -> - ::osl::ResettableMutexGuard aLock(m_aLock); - css::uno::Reference< css::document::XEventListener > xJobExecutor(m_xJobExecutorListener); - aLock.clear(); - // <- SAFE - xJobExecutor->notifyEvent(aEvent); + m_xJobExecutorListener->notifyEvent(aEvent); } catch(const css::uno::RuntimeException&) { throw; } -- cgit From 136ae4bc2fadd558cb044217339f6b7b2e58843e Mon Sep 17 00:00:00 2001 From: Takeshi Abe Date: Tue, 30 Oct 2012 11:27:06 +0900 Subject: sal_Bool to bool Change-Id: I87d6e518aebcd0074f673b84b66df27ae9a0a15a --- sfx2/inc/sfx2/linkmgr.hxx | 6 +++--- sfx2/source/appl/linkmgr2.cxx | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'sfx2') diff --git a/sfx2/inc/sfx2/linkmgr.hxx b/sfx2/inc/sfx2/linkmgr.hxx index 03b6ca347850..39c3beda9886 100644 --- a/sfx2/inc/sfx2/linkmgr.hxx +++ b/sfx2/inc/sfx2/linkmgr.hxx @@ -137,9 +137,9 @@ public: SvLinkSourceRef CreateObj( SvBaseLink* ); - void UpdateAllLinks( sal_Bool bAskUpdate = sal_True, - sal_Bool bCallErrHdl = sal_True, - sal_Bool bUpdateGrfLinks = sal_False, + void UpdateAllLinks( bool bAskUpdate = true, + bool bCallErrHdl = true, + bool bUpdateGrfLinks = false, Window* pParentWin = 0 ); // Call for list of links (eg for link-dialog) diff --git a/sfx2/source/appl/linkmgr2.cxx b/sfx2/source/appl/linkmgr2.cxx index 4ad6a59f4f80..9564a1857208 100644 --- a/sfx2/source/appl/linkmgr2.cxx +++ b/sfx2/source/appl/linkmgr2.cxx @@ -304,9 +304,9 @@ bool LinkManager::GetDisplayNames( } void LinkManager::UpdateAllLinks( - sal_Bool bAskUpdate, - sal_Bool /*bCallErrHdl*/, - sal_Bool bUpdateGrfLinks, + bool bAskUpdate, + bool /*bCallErrHdl*/, + bool bUpdateGrfLinks, Window* pParentWin ) { // First make a copy of the array in order to update links @@ -350,7 +350,7 @@ void LinkManager::UpdateAllLinks( int nRet = QueryBox( pParentWin, WB_YES_NO | WB_DEF_YES, SfxResId( STR_QUERY_UPDATE_LINKS ).toString() ).Execute(); if( RET_YES != nRet ) return ; // nothing should be updated - bAskUpdate = sal_False; // once is enough + bAskUpdate = false; // once is enough } pLink->Update(); -- cgit From 43d9f35c2665e55cfb5ee911a554ef71933ad4d1 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 26 Oct 2012 14:24:46 +0200 Subject: fdo#46808, Adapt linguistic2::LinguServiceManager UNO service to new style Create a merged XLinguServiceManager2 interface for this service to implement. Which is backwards-compatible, but does not require creating a new service. Change-Id: I297bada1066cd74809108641b56ee4d5898112ec --- sfx2/source/menu/thessubmenu.cxx | 23 +++++++++-------------- sfx2/source/menu/thessubmenu.hxx | 4 ++-- 2 files changed, 11 insertions(+), 16 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/menu/thessubmenu.cxx b/sfx2/source/menu/thessubmenu.cxx index 3a94f5e39f8f..1a645885adb1 100644 --- a/sfx2/source/menu/thessubmenu.cxx +++ b/sfx2/source/menu/thessubmenu.cxx @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include @@ -68,9 +68,8 @@ SfxThesSubMenuHelper::SfxThesSubMenuHelper() { try { - uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); - m_xLngMgr = uno::Reference< linguistic2::XLinguServiceManager >( xMSF->createInstance( - OUString( "com.sun.star.linguistic2.LinguServiceManager" )), uno::UNO_QUERY_THROW ); + uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + m_xLngMgr = linguistic2::LinguServiceManager::create(xContext); m_xThesarus = m_xLngMgr->getThesaurus(); } catch (const uno::Exception &) @@ -140,16 +139,12 @@ bool SfxThesSubMenuHelper::GetMeanings( String SfxThesSubMenuHelper::GetThesImplName( const lang::Locale &rLocale ) const { String aRes; - DBG_ASSERT( m_xLngMgr.is(), "LinguServiceManager missing" ); - if (m_xLngMgr.is()) - { - uno::Sequence< OUString > aServiceNames = m_xLngMgr->getConfiguredServices( - OUString("com.sun.star.linguistic2.Thesaurus"), rLocale ); - // there should be at most one thesaurus configured for each language - DBG_ASSERT( aServiceNames.getLength() <= 1, "more than one thesaurus found. Should not be possible" ); - if (aServiceNames.getLength() == 1) - aRes = aServiceNames[0]; - } + uno::Sequence< OUString > aServiceNames = m_xLngMgr->getConfiguredServices( + OUString("com.sun.star.linguistic2.Thesaurus"), rLocale ); + // there should be at most one thesaurus configured for each language + DBG_ASSERT( aServiceNames.getLength() <= 1, "more than one thesaurus found. Should not be possible" ); + if (aServiceNames.getLength() == 1) + aRes = aServiceNames[0]; return aRes; } diff --git a/sfx2/source/menu/thessubmenu.hxx b/sfx2/source/menu/thessubmenu.hxx index a30883e8abc3..56f6639fe299 100644 --- a/sfx2/source/menu/thessubmenu.hxx +++ b/sfx2/source/menu/thessubmenu.hxx @@ -22,7 +22,7 @@ #define _THESSUBMENU_HXX_ #include -#include +#include #include #include @@ -31,7 +31,7 @@ namespace css = ::com::sun::star; class SfxThesSubMenuHelper { - css::uno::Reference< css::linguistic2::XLinguServiceManager > m_xLngMgr; + css::uno::Reference< css::linguistic2::XLinguServiceManager2 > m_xLngMgr; css::uno::Reference< css::linguistic2::XThesaurus > m_xThesarus; private: -- cgit From ddcf2363bad1d84874dfe4e31e4783ffd761d5bb Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 30 Oct 2012 11:40:18 +0100 Subject: fdo#46808: Improve previous commit * Removing m_xLngMgr.is() check from SfxThesSubMenuHelper::GetThesImplName was unsound with SfxThesSubMenuHelper ctor swallowing Exception; best fix appears to be to remove the swallowing. * Prefer forward declarations over #includes. Change-Id: Ie4e7dcd6cdb14046516d119605bbf78e81359768 --- sfx2/source/menu/thessubmenu.cxx | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/menu/thessubmenu.cxx b/sfx2/source/menu/thessubmenu.cxx index 1a645885adb1..f4c5f474efce 100644 --- a/sfx2/source/menu/thessubmenu.cxx +++ b/sfx2/source/menu/thessubmenu.cxx @@ -64,18 +64,12 @@ void SfxThesSubMenuHelper::GetLocale( } -SfxThesSubMenuHelper::SfxThesSubMenuHelper() +SfxThesSubMenuHelper::SfxThesSubMenuHelper(): + m_xLngMgr( + linguistic2::LinguServiceManager::create( + comphelper::getProcessComponentContext())), + m_xThesarus(m_xLngMgr->getThesaurus()) { - try - { - uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); - m_xLngMgr = linguistic2::LinguServiceManager::create(xContext); - m_xThesarus = m_xLngMgr->getThesaurus(); - } - catch (const uno::Exception &) - { - DBG_ASSERT( 0, "failed to get thesaurus" ); - } } -- cgit From bd2c14ec78a7549d4a19738154cdd5ea890f61c4 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 30 Oct 2012 12:00:01 +0000 Subject: we have to have all tabpages in all modes now Change-Id: I05a587d4b0556cb9eda49583441b3f57d923a800 --- sfx2/source/dialog/tabdlg.cxx | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx index b137cee62372..eda237570f9a 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -727,19 +727,14 @@ sal_Bool SfxTabDialog::IsApplyButtonEnabled() const void SfxTabDialog::Start_Impl() { - //If we're layout enabled, we need to force all tabs to - //exist to get overall optimal size for dialog - if (isLayoutEnabled()) + //We need to force all tabs to exist to get overall optimal size for dialog + for (sal_uInt16 n=0; n < m_pTabCtrl->GetPageCount(); ++n) { - for ( sal_uInt16 n=0; n < m_pTabCtrl->GetPageCount(); ++n) + sal_uInt16 nPageId = m_pTabCtrl->GetPageId(n); + if (!m_pTabCtrl->GetTabPage(nPageId)) { - sal_uInt16 nPageId = m_pTabCtrl->GetPageId(n); - TabPage* pTabPage = m_pTabCtrl->GetTabPage(nPageId); - if (!pTabPage) - { - m_pTabCtrl->SetCurPageId(nPageId); - ActivatePageHdl(m_pTabCtrl); - } + m_pTabCtrl->SetCurPageId(nPageId); + ActivatePageHdl(m_pTabCtrl); } } -- cgit From f7b6ff632718c448f8e74d17fdbf2e03297930dc Mon Sep 17 00:00:00 2001 From: Cédric Bosdonnat Date: Fri, 12 Oct 2012 08:22:46 +0200 Subject: InfoBars: implemented Resize Change-Id: Iad2c4b57b28cf06260b7890dfc9309df60fb5184 --- sfx2/inc/sfx2/infobar.hxx | 3 +++ sfx2/source/dialog/infobar.cxx | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) (limited to 'sfx2') diff --git a/sfx2/inc/sfx2/infobar.hxx b/sfx2/inc/sfx2/infobar.hxx index 00d521f7749b..876764a8a896 100644 --- a/sfx2/inc/sfx2/infobar.hxx +++ b/sfx2/inc/sfx2/infobar.hxx @@ -52,6 +52,7 @@ class SfxInfoBarWindow : public Window ~SfxInfoBarWindow( ); virtual void Paint( const Rectangle& ); + virtual void Resize( ); private: DECL_LINK( CloseHandler, void* ); @@ -69,6 +70,8 @@ class SfxInfoBarContainerWindow : public Window void appendInfoBar( const rtl::OUString& sMessage, std::vector< PushButton* > aButtons ); void removeInfoBar( SfxInfoBarWindow* pInfoBar ); + + virtual void Resize( ); }; diff --git a/sfx2/source/dialog/infobar.cxx b/sfx2/source/dialog/infobar.cxx index e72468ca4a47..cbcbf7f8bb3e 100644 --- a/sfx2/source/dialog/infobar.cxx +++ b/sfx2/source/dialog/infobar.cxx @@ -180,6 +180,27 @@ void SfxInfoBarWindow::Paint( const Rectangle& rPaintRect ) Window::Paint( rPaintRect ); } +void SfxInfoBarWindow::Resize( ) +{ + long nWidth = GetSizePixel().getWidth(); + m_pCloseBtn->SetPosSizePixel( Point( nWidth - 25, 15 ), Size( 10, 10 ) ); + + // Reparent the buttons and place them on the right of the bar + long nX = m_pCloseBtn->GetPosPixel( ).getX( ) - 15; + long nBtnGap = 5; + for ( vector< PushButton* >::iterator it = m_aActionBtns.begin( ); + it != m_aActionBtns.end( ); ++it ) + { + PushButton* pBtn = *it; + long nBtnWidth = pBtn->GetSizePixel( ).getWidth(); + nX -= nBtnWidth; + pBtn->SetPosSizePixel( Point( nX, 5 ), Size( nBtnWidth, 30 ) ); + nX -= nBtnGap; + } + + m_pMessage->SetPosSizePixel( Point( 10, 10 ), Size( nX - 20, 20 ) ); +} + IMPL_LINK_NOARG( SfxInfoBarWindow, CloseHandler ) { ((SfxInfoBarContainerWindow*)GetParent())->removeInfoBar( this ); @@ -245,6 +266,20 @@ void SfxInfoBarContainerWindow::removeInfoBar( SfxInfoBarWindow* pInfoBar ) m_pChildWin->Update( ); } +void SfxInfoBarContainerWindow::Resize( ) +{ + // Only need to change the width of the infobars + long nWidth = GetSizePixel( ).getWidth( ); + for ( vector< SfxInfoBarWindow * >::iterator it = m_pInfoBars.begin( ); + it != m_pInfoBars.end( ); ++it ) + { + SfxInfoBarWindow* pInfoBar = *it; + Size aSize = pInfoBar->GetSizePixel( ); + aSize.setWidth( nWidth ); + pInfoBar->SetSizePixel( aSize ); + pInfoBar->Resize( ); + } +} SFX_IMPL_POS_CHILDWINDOW_WITHID( SfxInfoBarContainerChild, SID_INFOBARCONTAINER, SFX_OBJECTBAR_OBJECT ); -- cgit From 2cc05f7b85a37be41614793ffd56755c39eb96de Mon Sep 17 00:00:00 2001 From: Cédric Bosdonnat Date: Fri, 12 Oct 2012 08:39:23 +0200 Subject: InfoBars: Hight Contrast painting Change-Id: I3ba70be099bc4364d8f6d2d0700add83353f2900 --- sfx2/source/dialog/infobar.cxx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'sfx2') diff --git a/sfx2/source/dialog/infobar.cxx b/sfx2/source/dialog/infobar.cxx index cbcbf7f8bb3e..1f979e871514 100644 --- a/sfx2/source/dialog/infobar.cxx +++ b/sfx2/source/dialog/infobar.cxx @@ -18,6 +18,7 @@ #include #include #include +#include using namespace std; @@ -49,6 +50,14 @@ namespace basegfx::BColor aLightColor( 1.0, 1.0, 191.0 / 255.0 ); basegfx::BColor aDarkColor( 217.0 / 255.0, 217.0 / 255.0, 78.0 / 255.0 ); + const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); + if ( rSettings.GetHighContrastMode() ) + { + aLightColor = rSettings.GetLightColor( ).getBColor( ); + aDarkColor = rSettings.GetDialogTextColor( ).getBColor( ); + + } + // Light background basegfx::B2DPolygon aPolygon; aPolygon.append( basegfx::B2DPoint( aRect.Left( ), aRect.Top( ) ) ); @@ -149,6 +158,16 @@ void SfxInfoBarWindow::Paint( const Rectangle& rPaintRect ) basegfx::BColor aLightColor( 1.0, 1.0, 191.0 / 255.0 ); basegfx::BColor aDarkColor( 217.0 / 255.0, 217.0 / 255.0, 78.0 / 255.0 ); + const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); + if ( rSettings.GetHighContrastMode() ) + { + aLightColor = rSettings.GetLightColor( ).getBColor( ); + aDarkColor = rSettings.GetDialogTextColor( ).getBColor( ); + } + + // Update the label background color + m_pMessage->SetBackground( Wallpaper( Color( aLightColor ) ) ); + // Light background basegfx::B2DPolygon aPolygon; aPolygon.append( basegfx::B2DPoint( aRect.Left( ), aRect.Top( ) ) ); -- cgit From 75bc673b60d3eb40713868ce3d1b4f62dd6e1208 Mon Sep 17 00:00:00 2001 From: Cédric Bosdonnat Date: Wed, 17 Oct 2012 09:41:52 +0200 Subject: Travelled MIME type through UCB for CMIS UCP to use it when creating documents Change-Id: Id067932355607d3d60994862201b531f9844506d --- sfx2/source/doc/docfile.cxx | 16 +++++++++++----- sfx2/source/doc/doctemplates.cxx | 6 ++++-- 2 files changed, 15 insertions(+), 7 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 4d5227b73658..e5380e73e4dd 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -1925,7 +1925,7 @@ void SfxMedium::Transfer_Impl() ::ucbhelper::Content aTransferContent; // Get the parent URL from the XChild if possible: why would the URL necessarily have - // a hierarchical path? It's not the case for CMIS. + // a hierarchical path? It's not always the case for CMIS. ::ucbhelper::Content aDestContent; ::ucbhelper::Content::create( aDestURL, xComEnv, comphelper::getProcessComponentContext(), aDestContent ); Reference< ::com::sun::star::container::XChild> xChild( aDestContent.get(), uno::UNO_QUERY ); @@ -1996,7 +1996,8 @@ void SfxMedium::Transfer_Impl() try { - if (!aTransferContent.transferContent( aSourceContent, ::ucbhelper::InsertOperation_COPY, aFileName, nNameClash )) + rtl::OUString aMimeType = GetFilter()->GetMimeType( ); + if (!aTransferContent.transferContent( aSourceContent, ::ucbhelper::InsertOperation_COPY, aFileName, nNameClash, aMimeType )) pImp->m_eError = ERRCODE_IO_GENERAL; } catch ( const ::com::sun::star::ucb::CommandAbortedException& ) @@ -2060,10 +2061,12 @@ void SfxMedium::DoInternalBackup_Impl( const ::ucbhelper::Content& aOriginalCont { try { + rtl::OUString sMimeType = GetFilter()->GetMimeType( ); if( aBackupCont.transferContent( aOriginalContent, ::ucbhelper::InsertOperation_COPY, aBackupName, - NameClash::OVERWRITE ) ) + NameClash::OVERWRITE, + sMimeType ) ) { pImp->m_aBackupURL = aBackObj.GetMainURL( INetURLObject::NO_DECODE ); pImp->m_bRemoveBackup = true; @@ -2146,10 +2149,12 @@ void SfxMedium::DoBackup_Impl() try { // do the transfer ( copy source file to backup dir ) + rtl::OUString sMimeType = GetFilter()->GetMimeType( ); bSuccess = aContent.transferContent( aSourceContent, ::ucbhelper::InsertOperation_COPY, aFileName, - NameClash::OVERWRITE ); + NameClash::OVERWRITE, + sMimeType ); if( bSuccess ) { pImp->m_aBackupURL = aDest.GetMainURL( INetURLObject::NO_DECODE ); @@ -3276,7 +3281,8 @@ void SfxMedium::CreateTempFile( sal_Bool bReplace ) if ( !aFileName.isEmpty() && aTmpURLObj.removeSegment() ) { ::ucbhelper::Content aTargetContent( aTmpURLObj.GetMainURL( INetURLObject::NO_DECODE ), xComEnv, comphelper::getProcessComponentContext() ); - if ( aTargetContent.transferContent( pImp->aContent, ::ucbhelper::InsertOperation_COPY, aFileName, NameClash::OVERWRITE ) ) + rtl::OUString sMimeType = GetFilter()->GetMimeType( ); + if ( aTargetContent.transferContent( pImp->aContent, ::ucbhelper::InsertOperation_COPY, aFileName, NameClash::OVERWRITE, sMimeType ) ) { SetWritableForUserOnly( aTmpURL ); bTransferSuccess = true; diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx index f4dbb6cf6749..c7194de34247 100644 --- a/sfx2/source/doc/doctemplates.cxx +++ b/sfx2/source/doc/doctemplates.cxx @@ -1418,7 +1418,8 @@ sal_Bool SfxDocTplService_Impl::WriteUINamesForTemplateDir_Impl( const ::rtl::OU aTargetContent.transferContent( aSourceContent, InsertOperation_COPY, ::rtl::OUString( "groupuinames.xml" ), - ucb::NameClash::OVERWRITE ); + ucb::NameClash::OVERWRITE, + ::rtl::OUString( "text/xml" ) ); bResult = sal_True; } catch ( uno::Exception& ) @@ -2062,7 +2063,8 @@ sal_Bool SfxDocTplService_Impl::addTemplate( const OUString& rGroupName, if( ! aTargetGroup.transferContent( aSourceContent, InsertOperation_COPY, aNewTemplateTargetName, - NameClash::OVERWRITE ) ) + NameClash::OVERWRITE, + aType ) ) return sal_False; // allow to edit the added template -- cgit From 1008e9468d32dad8dbfd7f24e6af626d766fe308 Mon Sep 17 00:00:00 2001 From: Cédric Bosdonnat Date: Wed, 17 Oct 2012 09:54:11 +0200 Subject: Load CMIS properties after saving files Change-Id: I0962f466cd46bcabbdb70100bcebb4ef940923b3 --- sfx2/source/doc/sfxbasemodel.cxx | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sfx2') diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 37180abe9187..281239f88e3c 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -1723,6 +1723,8 @@ void SAL_CALL SfxBaseModel::storeAsURL( const ::rtl::OUString& TransformItems( SID_OPENDOC, *m_pData->m_pObjectShell->GetMedium()->GetItemSet(), aSequence ); attachResource( rURL, aSequence ); + loadCmisProperties( ); + #if OSL_DEBUG_LEVEL > 0 SFX_ITEMSET_ARG( m_pData->m_pObjectShell->GetMedium()->GetItemSet(), pPasswdItem, SfxStringItem, SID_PASSWORD, sal_False); OSL_ENSURE( !pPasswdItem, "There should be no Password property in the document MediaDescriptor!" ); -- cgit From bb93b038a70ef7a810b6b9d447856ed77c590e40 Mon Sep 17 00:00:00 2001 From: Cédric Bosdonnat Date: Wed, 17 Oct 2012 17:17:27 +0200 Subject: CMIS: display errors when clicking checkout button Change-Id: I38d5cb95e1c45e1c57b11ec81523d4cca7568d34 --- sfx2/source/doc/sfxbasemodel.cxx | 6 ++---- sfx2/source/view/sfxbasecontroller.cxx | 7 +++++-- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 281239f88e3c..9c3786f532a1 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -2570,11 +2570,9 @@ void SAL_CALL SfxBaseModel::checkOut( ) throw ( uno::RuntimeException ) // Reload the CMIS properties loadCmisProperties( ); } - catch (const ucb::ContentCreationException &) - { - } - catch (const ucb::CommandAbortedException &) + catch ( const uno::Exception & e ) { + throw uno::RuntimeException( e.Message, e.Context ); } } } diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index 658d887db7fb..9fb52af07f6b 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -72,6 +72,7 @@ #include #include #include +#include #include @@ -1483,9 +1484,11 @@ IMPL_LINK( SfxBaseController, CheckOutHandler, PushButton*, pBtn ) SfxViewFrame* pViewFrame = m_pData->m_pViewShell->GetFrame(); pViewFrame->RemoveInfoBar( pInfoBar ); } - catch ( const uno::RuntimeException& ) + catch ( const uno::RuntimeException& e ) { - // TODO Handle the problem in some way? + ErrorBox* pErrorBox = new ErrorBox( &m_pData->m_pViewShell->GetFrame()->GetWindow(), WB_OK, e.Message ); + pErrorBox->Execute( ); + delete pErrorBox; } } return 0; -- cgit From 793ea6fe90209dbf2b659a44a302306a05888011 Mon Sep 17 00:00:00 2001 From: Cédric Bosdonnat Date: Thu, 18 Oct 2012 00:08:31 +0200 Subject: CMIS: don't show up checkout info bar if the document is not versionable Change-Id: I7761e0b06e151822a63a7273a4e61d5cdc648311 --- sfx2/inc/sfx2/sfxbasemodel.hxx | 2 ++ sfx2/source/doc/sfxbasemodel.cxx | 26 ++++++++++++++++++++++++++ sfx2/source/view/sfxbasecontroller.cxx | 2 +- 3 files changed, 29 insertions(+), 1 deletion(-) (limited to 'sfx2') diff --git a/sfx2/inc/sfx2/sfxbasemodel.hxx b/sfx2/inc/sfx2/sfxbasemodel.hxx index 7a3b4a592281..3cabf59a7933 100644 --- a/sfx2/inc/sfx2/sfxbasemodel.hxx +++ b/sfx2/inc/sfx2/sfxbasemodel.hxx @@ -1423,6 +1423,8 @@ public: virtual void SAL_CALL checkOut( ) throw ( ::com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL isVersionable( ) throw ( ::com::sun::star::uno::RuntimeException ); + //____________________________________________________________________________________________________ // SfxListener //____________________________________________________________________________________________________ diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 9c3786f532a1..cc2abe9ec95d 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -2577,6 +2577,32 @@ void SAL_CALL SfxBaseModel::checkOut( ) throw ( uno::RuntimeException ) } } +sal_Bool SAL_CALL SfxBaseModel::isVersionable( ) throw ( uno::RuntimeException ) +{ + sal_Bool bVersionable = sal_False; + SfxMedium* pMedium = m_pData->m_pObjectShell->GetMedium(); + if ( pMedium ) + { + try + { + ::ucbhelper::Content aContent( pMedium->GetName( ), + uno::Reference(), + comphelper::getProcessComponentContext() ); + com::sun::star::uno::Reference < beans::XPropertySetInfo > xProps = aContent.getProperties(); + ::rtl::OUString aIsVersionableProp( "IsVersionable" ); + if ( xProps->hasPropertyByName( aIsVersionableProp ) ) + { + aContent.getPropertyValue( aIsVersionableProp ) >>= bVersionable; + } + } + catch ( const uno::Exception & e ) + { + throw uno::RuntimeException( e.Message, e.Context ); + } + } + return bVersionable; +} + void SfxBaseModel::loadCmisProperties( ) { SfxMedium* pMedium = m_pData->m_pObjectShell->GetMedium(); diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index 9fb52af07f6b..26e5ee54481b 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -1442,7 +1442,7 @@ void SfxBaseController::ShowInfoBars( ) REFERENCE< document::XCmisDocument > xCmisDoc( m_pData->m_pViewShell->GetObjectShell()->GetModel(), uno::UNO_QUERY ); beans::PropertyValues aCmisProperties = xCmisDoc->getCmisPropertiesValues( ); - if ( aCmisProperties.hasElements( ) ) + if ( xCmisDoc->isVersionable( ) && aCmisProperties.hasElements( ) ) { // Loop over the CMIS Properties to find cmis:isVersionSeriesCheckedOut bool bFoundCheckedout = false; -- cgit From 23722506efd84a9b7b447578de32c0eef9bf8b98 Mon Sep 17 00:00:00 2001 From: Cédric Bosdonnat Date: Sat, 20 Oct 2012 09:42:35 -0700 Subject: CMIS: added CheckOut in the File menu Change-Id: I5f003556065cff34cec38148bc3bb4da20692e54 --- sfx2/inc/sfx2/infobar.hxx | 7 ++-- sfx2/inc/sfx2/objsh.hxx | 2 ++ sfx2/inc/sfx2/sfxcommands.h | 1 + sfx2/inc/sfx2/sfxsids.hrc | 1 + sfx2/inc/sfx2/viewfrm.hxx | 5 ++- sfx2/sdi/docslots.sdi | 5 +++ sfx2/sdi/sfx.sdi | 24 ++++++++++++++ sfx2/source/dialog/infobar.cxx | 23 +++++++++++--- sfx2/source/doc/objserv.cxx | 58 ++++++++++++++++++++++++++++++++++ sfx2/source/view/sfxbasecontroller.cxx | 21 ++---------- sfx2/source/view/viewfrm.cxx | 7 ++-- 11 files changed, 122 insertions(+), 32 deletions(-) (limited to 'sfx2') diff --git a/sfx2/inc/sfx2/infobar.hxx b/sfx2/inc/sfx2/infobar.hxx index 876764a8a896..b72dbbdb85f5 100644 --- a/sfx2/inc/sfx2/infobar.hxx +++ b/sfx2/inc/sfx2/infobar.hxx @@ -41,16 +41,18 @@ class SFX2_DLLPUBLIC SfxInfoBarContainerChild : public SfxChildWindow class SfxInfoBarWindow : public Window { private: + rtl::OUString m_sId; FixedText* m_pMessage; Button* m_pCloseBtn; std::vector< PushButton* > m_aActionBtns; public: - SfxInfoBarWindow( Window* parent, + SfxInfoBarWindow( Window* parent, const rtl::OUString& sId, const rtl::OUString& sMessage, std::vector< PushButton* > aButtons ); ~SfxInfoBarWindow( ); + virtual const rtl::OUString& getId() const { return m_sId; } virtual void Paint( const Rectangle& ); virtual void Resize( ); @@ -68,7 +70,8 @@ class SfxInfoBarContainerWindow : public Window SfxInfoBarContainerWindow( SfxInfoBarContainerChild* pChildWin ); ~SfxInfoBarContainerWindow( ); - void appendInfoBar( const rtl::OUString& sMessage, std::vector< PushButton* > aButtons ); + void appendInfoBar( const rtl::OUString& sId, const rtl::OUString& sMessage, std::vector< PushButton* > aButtons ); + SfxInfoBarWindow* getInfoBar( const rtl::OUString& sId ); void removeInfoBar( SfxInfoBarWindow* pInfoBar ); virtual void Resize( ); diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx index 331553db46a4..88a2abe87a4b 100644 --- a/sfx2/inc/sfx2/objsh.hxx +++ b/sfx2/inc/sfx2/objsh.hxx @@ -732,6 +732,8 @@ public: SAL_DLLPRIVATE void ImplSign( sal_Bool bScriptingContent = sal_False ); SAL_DLLPRIVATE sal_Bool QuerySaveSizeExceededModules_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ); + + SAL_DLLPRIVATE void CheckOut( ); }; #define SFX_GLOBAL_CLASSID \ diff --git a/sfx2/inc/sfx2/sfxcommands.h b/sfx2/inc/sfx2/sfxcommands.h index fc075b299c64..46c7ebcac274 100644 --- a/sfx2/inc/sfx2/sfxcommands.h +++ b/sfx2/inc/sfx2/sfxcommands.h @@ -44,6 +44,7 @@ #define CMD_SID_OPENHYPERLINK ".uno:OpenHyperlink" #define CMD_SID_DOCINFO_TITLE ".uno:DocInfoTitle" #define CMD_SID_OPENTEMPLATE ".uno:OpenTemplate" +#define CMD_SID_CHECKOUT ".uno:CheckOut" #define CMD_SID_OPENURL ".uno:OpenUrl" #define CMD_SID_OPTIONS ".uno:Options" #define CMD_SID_ORGANIZER ".uno:Organizer" diff --git a/sfx2/inc/sfx2/sfxsids.hrc b/sfx2/inc/sfx2/sfxsids.hrc index 0d3522bd7b14..9586dde26c50 100644 --- a/sfx2/inc/sfx2/sfxsids.hrc +++ b/sfx2/inc/sfx2/sfxsids.hrc @@ -143,6 +143,7 @@ #define SID_EXPORTDOCASPDF (SID_SFX_START + 1673) #define SID_DIRECTEXPORTDOCASPDF (SID_SFX_START + 1674) #define SID_UPDATEDOCMODE (SID_SFX_START + 1668) +#define SID_CHECKOUT (SID_SFX_START + 512) #define SID_FORCERELOAD (SID_SFX_START + 1502) #define SID_FILE_DIALOG (SID_SFX_START + 304) diff --git a/sfx2/inc/sfx2/viewfrm.hxx b/sfx2/inc/sfx2/viewfrm.hxx index c3d889364522..4373a52ae6c1 100644 --- a/sfx2/inc/sfx2/viewfrm.hxx +++ b/sfx2/inc/sfx2/viewfrm.hxx @@ -23,7 +23,6 @@ #include "sfx2/dllapi.h" #include "sal/types.h" #include -#include #include #include #include @@ -191,8 +190,8 @@ public: The buttons will be added from Right to Left at the right of the info bar. The parent, size and position of each button will be changed: only the width will remain unchanged. */ - void AppendInfoBar( const rtl::OUString& sMessage, std::vector< PushButton* > aButtons ); - void RemoveInfoBar( SfxInfoBarWindow* pInfoBar ); + void AppendInfoBar( const rtl::OUString& sId, const rtl::OUString& sMessage, std::vector< PushButton* > aButtons ); + void RemoveInfoBar( const rtl::OUString& sId ); SAL_DLLPRIVATE void SetDowning_Impl(); SAL_DLLPRIVATE void GetDocNumber_Impl(); diff --git a/sfx2/sdi/docslots.sdi b/sfx2/sdi/docslots.sdi index 291eb58dddad..6ba11a83f8e0 100644 --- a/sfx2/sdi/docslots.sdi +++ b/sfx2/sdi/docslots.sdi @@ -177,6 +177,11 @@ interface OfficeDocument : Document ExecMethod = ExecFile_Impl; StateMethod = GetState_Impl; ] + SID_CHECKOUT + [ + ExecMethod = ExecFile_Impl; + StateMethod = GetState_Impl; + ] } //========================================================================= diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index 92af180aedf3..635342a40bcc 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -4444,6 +4444,30 @@ SfxObjectItem OpenTemplate SID_OPENTEMPLATE GroupId = GID_TEMPLATE; ] +SfxVoidItem CheckOut SID_CHECKOUT +() +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = TRUE, + Toggle = FALSE, + Container = TRUE, + RecordAbsolute = FALSE, + RecordPerSet; + Asynchron; + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_DOCUMENT; +] + //-------------------------------------------------------------------------- SfxStringItem OpenUrl SID_OPENURL diff --git a/sfx2/source/dialog/infobar.cxx b/sfx2/source/dialog/infobar.cxx index 1f979e871514..f92e836abe1d 100644 --- a/sfx2/source/dialog/infobar.cxx +++ b/sfx2/source/dialog/infobar.cxx @@ -94,9 +94,10 @@ namespace } } -SfxInfoBarWindow::SfxInfoBarWindow( Window* pParent, const rtl::OUString& sMessage, - vector< PushButton* > aButtons ) : +SfxInfoBarWindow::SfxInfoBarWindow( Window* pParent, const rtl::OUString& sId, + const rtl::OUString& sMessage, vector< PushButton* > aButtons ) : Window( pParent, 0 ), + m_sId( sId ), m_pMessage( NULL ), m_pCloseBtn( NULL ), m_aActionBtns( aButtons ) @@ -243,13 +244,12 @@ SfxInfoBarContainerWindow::~SfxInfoBarContainerWindow( ) m_pInfoBars.clear( ); } -void SfxInfoBarContainerWindow::appendInfoBar( const rtl::OUString& sMessage, vector< PushButton* > aButtons ) +void SfxInfoBarContainerWindow::appendInfoBar( const rtl::OUString& sId, const rtl::OUString& sMessage, vector< PushButton* > aButtons ) { Size aSize = GetSizePixel( ); - SfxInfoBarWindow* pInfoBar = new SfxInfoBarWindow( this, sMessage, aButtons ); + SfxInfoBarWindow* pInfoBar = new SfxInfoBarWindow( this, sId, sMessage, aButtons ); pInfoBar->SetPosPixel( Point( 0, aSize.getHeight( ) ) ); - m_pInfoBars.push_back( pInfoBar ); pInfoBar->Show( ); long nHeight = pInfoBar->GetSizePixel( ).getHeight( ); @@ -257,6 +257,19 @@ void SfxInfoBarContainerWindow::appendInfoBar( const rtl::OUString& sMessage, ve SetSizePixel( aSize ); } +SfxInfoBarWindow* SfxInfoBarContainerWindow::getInfoBar( const rtl::OUString& sId ) +{ + SfxInfoBarWindow* pRet = NULL; + for ( vector< SfxInfoBarWindow* >::iterator it = m_pInfoBars.begin( ); + it != m_pInfoBars.end( ) && pRet == NULL; ++it ) + { + SfxInfoBarWindow* pBar = *it; + if ( pBar->getId( ) == sId ) + pRet = pBar; + } + return pRet; +} + void SfxInfoBarContainerWindow::removeInfoBar( SfxInfoBarWindow* pInfoBar ) { for ( vector< SfxInfoBarWindow* >::iterator it = m_pInfoBars.begin( ); diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 70a4f1dd6c48..13571881069c 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -28,11 +28,13 @@ #include #include #include +#include #include #include #include #include #include +#include #include #include #include @@ -46,6 +48,7 @@ #include #include #include +#include #include #include #include @@ -339,6 +342,25 @@ sal_Bool SfxObjectShell::APISaveAs_Impl return bOk; } +void SfxObjectShell::CheckOut( ) +{ + try + { + uno::Reference< document::XCmisDocument > xCmisDoc( GetModel(), uno::UNO_QUERY_THROW ); + xCmisDoc->checkOut( ); + + // Remove the info bar + SfxViewFrame* pViewFrame = GetFrame(); + pViewFrame->RemoveInfoBar( "checkout" ); + } + catch ( const uno::RuntimeException& e ) + { + ErrorBox* pErrorBox = new ErrorBox( &GetFrame()->GetWindow(), WB_OK, e.Message ); + pErrorBox->Execute( ); + delete pErrorBox; + } +} + //-------------------------------------------------------------------- void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) @@ -884,6 +906,12 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) break; } + + case SID_CHECKOUT: + { + CheckOut( ); + break; + } } // Prevent entry in the Pick-lists @@ -918,6 +946,36 @@ void SfxObjectShell::GetState_Impl(SfxItemSet &rSet) break; } + case SID_CHECKOUT: + { + bool bShow = false; + Reference< XCmisDocument > xCmisDoc( GetModel(), uno::UNO_QUERY ); + beans::PropertyValues aCmisProperties = xCmisDoc->getCmisPropertiesValues( ); + + if ( xCmisDoc->isVersionable( ) && aCmisProperties.hasElements( ) ) + { + // Loop over the CMIS Properties to find cmis:isVersionSeriesCheckedOut + bool bFoundCheckedout = false; + sal_Bool bCheckedOut = sal_False; + for ( sal_Int32 i = 0; i < aCmisProperties.getLength() && !bFoundCheckedout; ++i ) + { + if ( aCmisProperties[i].Name == "cmis:isVersionSeriesCheckedOut" ) + { + bFoundCheckedout = true; + aCmisProperties[i].Value >>= bCheckedOut; + } + } + bShow = !bCheckedOut; + } + + if ( !bShow ) + { + rSet.DisableItem( nWhich ); + rSet.Put( SfxVisibilityItem( nWhich, sal_False ) ); + } + } + break; + case SID_VERSION: { SfxObjectShell *pDoc = this; diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index 26e5ee54481b..54827c5d7436 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -1464,7 +1464,7 @@ void SfxBaseController::ShowInfoBars( ) PushButton* pBtn = new PushButton( &pViewFrame->GetWindow(), SfxResId( BT_CHECKOUT ) ); pBtn->SetClickHdl( LINK( this, SfxBaseController, CheckOutHandler ) ); aButtons.push_back( pBtn ); - pViewFrame->AppendInfoBar( SfxResId( STR_NONCHECKEDOUT_DOCUMENT ), aButtons ); + pViewFrame->AppendInfoBar( "checkout", SfxResId( STR_NONCHECKEDOUT_DOCUMENT ), aButtons ); } } } @@ -1473,24 +1473,7 @@ void SfxBaseController::ShowInfoBars( ) IMPL_LINK( SfxBaseController, CheckOutHandler, PushButton*, pBtn ) { if ( m_pData->m_pViewShell ) - { - try - { - REFERENCE< document::XCmisDocument > xCmisDoc( m_pData->m_pViewShell->GetObjectShell()->GetModel(), uno::UNO_QUERY_THROW ); - xCmisDoc->checkOut( ); - - // Remove the info bar - SfxInfoBarWindow* pInfoBar = ( SfxInfoBarWindow* )pBtn->GetParent( ); - SfxViewFrame* pViewFrame = m_pData->m_pViewShell->GetFrame(); - pViewFrame->RemoveInfoBar( pInfoBar ); - } - catch ( const uno::RuntimeException& e ) - { - ErrorBox* pErrorBox = new ErrorBox( &m_pData->m_pViewShell->GetFrame()->GetWindow(), WB_OK, e.Message ); - pErrorBox->Execute( ); - delete pErrorBox; - } - } + m_pData->m_pViewShell->GetObjectShell()->CheckOut( ); return 0; } diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index f039d3e2c39c..60bd2a758673 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -3348,7 +3348,7 @@ void SfxViewFrame::ActivateToolPanel_Impl( const ::rtl::OUString& i_rPanelURL ) pPanelAccess->ActivateToolPanel( i_rPanelURL ); } -void SfxViewFrame::AppendInfoBar( const rtl::OUString& sMessage, std::vector< PushButton* > aButtons ) +void SfxViewFrame::AppendInfoBar( const rtl::OUString& sId, const rtl::OUString& sMessage, std::vector< PushButton* > aButtons ) { const sal_uInt16 nId = SfxInfoBarContainerChild::GetChildWindowId(); @@ -3359,12 +3359,12 @@ void SfxViewFrame::AppendInfoBar( const rtl::OUString& sMessage, std::vector< Pu if ( pChild ) { SfxInfoBarContainerWindow* pInfoBars = ( SfxInfoBarContainerWindow* )pChild->GetWindow(); - pInfoBars->appendInfoBar( sMessage, aButtons ); + pInfoBars->appendInfoBar( sId, sMessage, aButtons ); ShowChildWindow( nId ); } } -void SfxViewFrame::RemoveInfoBar( SfxInfoBarWindow* pInfoBar ) +void SfxViewFrame::RemoveInfoBar( const rtl::OUString& sId ) { const sal_uInt16 nId = SfxInfoBarContainerChild::GetChildWindowId(); @@ -3375,6 +3375,7 @@ void SfxViewFrame::RemoveInfoBar( SfxInfoBarWindow* pInfoBar ) if ( pChild ) { SfxInfoBarContainerWindow* pInfoBars = ( SfxInfoBarContainerWindow* )pChild->GetWindow(); + SfxInfoBarWindow* pInfoBar = pInfoBars->getInfoBar( sId ); pInfoBars->removeInfoBar( pInfoBar ); ShowChildWindow( nId ); } -- cgit From 1a9261124eed5baa04b069a1cb1b51f24423ec9b Mon Sep 17 00:00:00 2001 From: Cédric Bosdonnat Date: Tue, 30 Oct 2012 11:06:18 +0100 Subject: CMIS: added cancelCheckOut and checkIn implementations and menu items Although the implementation is here, the dialogs to show when clicking on the menu items aren't there yet. Change-Id: I14886ec8ea8b97a35ca6c8474bc33e30da1a86d3 --- sfx2/inc/sfx2/docfile.hxx | 2 + sfx2/inc/sfx2/objsh.hxx | 2 + sfx2/inc/sfx2/sfxbasecontroller.hxx | 2 +- sfx2/inc/sfx2/sfxbasemodel.hxx | 8 ++ sfx2/inc/sfx2/sfxcommands.h | 2 + sfx2/inc/sfx2/sfxsids.hrc | 3 + sfx2/sdi/docslots.sdi | 10 +++ sfx2/sdi/sfx.sdi | 48 ++++++++++++ sfx2/source/appl/appuno.cxx | 3 +- sfx2/source/doc/docfile.cxx | 60 +++++++++++--- sfx2/source/doc/objserv.cxx | 78 +++++++++++++++++++ sfx2/source/doc/objstor.cxx | 22 +++++- sfx2/source/doc/sfxbasemodel.cxx | 138 +++++++++++++++++++++++++++++++-- sfx2/source/view/sfxbasecontroller.cxx | 2 +- 14 files changed, 355 insertions(+), 25 deletions(-) (limited to 'sfx2') diff --git a/sfx2/inc/sfx2/docfile.hxx b/sfx2/inc/sfx2/docfile.hxx index 9a134b651b8b..5ba00f65e830 100644 --- a/sfx2/inc/sfx2/docfile.hxx +++ b/sfx2/inc/sfx2/docfile.hxx @@ -194,6 +194,8 @@ public: sal_Bool SwitchDocumentToFile( const rtl::OUString& aURL ); ::rtl::OUString GetBaseURL( bool bForSaving=false ); + void SetInCheckIn( bool bInCheckIn ); + bool IsInCheckIn( ); #if _SOLAR__PRIVATE SAL_DLLPRIVATE sal_Bool HasStorage_Impl() const; diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx index 88a2abe87a4b..d2a3b3d76440 100644 --- a/sfx2/inc/sfx2/objsh.hxx +++ b/sfx2/inc/sfx2/objsh.hxx @@ -734,6 +734,8 @@ public: SAL_DLLPRIVATE sal_Bool QuerySaveSizeExceededModules_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ); SAL_DLLPRIVATE void CheckOut( ); + SAL_DLLPRIVATE void CancelCheckOut( ); + SAL_DLLPRIVATE void CheckIn( ); }; #define SFX_GLOBAL_CLASSID \ diff --git a/sfx2/inc/sfx2/sfxbasecontroller.hxx b/sfx2/inc/sfx2/sfxbasecontroller.hxx index b8daf8b24e88..4db98d5634bb 100644 --- a/sfx2/inc/sfx2/sfxbasecontroller.hxx +++ b/sfx2/inc/sfx2/sfxbasecontroller.hxx @@ -387,7 +387,7 @@ private: SAL_DLLPRIVATE SfxViewFrame& GetViewFrame_Impl() const; SAL_DLLPRIVATE void ShowInfoBars( ); - DECL_LINK( CheckOutHandler, PushButton * ); + DECL_LINK( CheckOutHandler, void * ); //________________________________________________________________________________________________________ // private variables diff --git a/sfx2/inc/sfx2/sfxbasemodel.hxx b/sfx2/inc/sfx2/sfxbasemodel.hxx index 3cabf59a7933..49e4dcae72be 100644 --- a/sfx2/inc/sfx2/sfxbasemodel.hxx +++ b/sfx2/inc/sfx2/sfxbasemodel.hxx @@ -1422,8 +1422,16 @@ public: throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL checkOut( ) throw ( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL cancelCheckOut( ) throw ( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL checkIn( sal_Bool bIsMajor, const rtl::OUString & rMessage ) + throw ( ::com::sun::star::uno::RuntimeException ); virtual sal_Bool SAL_CALL isVersionable( ) throw ( ::com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL canCheckOut( ) throw ( ::com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL canCancelCheckOut( ) throw ( ::com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL canCheckIn( ) throw ( ::com::sun::star::uno::RuntimeException ); + + sal_Bool getBoolPropertyValue( const rtl::OUString& rName ) throw ( ::com::sun::star::uno::RuntimeException ); //____________________________________________________________________________________________________ // SfxListener diff --git a/sfx2/inc/sfx2/sfxcommands.h b/sfx2/inc/sfx2/sfxcommands.h index 46c7ebcac274..f054ca959d90 100644 --- a/sfx2/inc/sfx2/sfxcommands.h +++ b/sfx2/inc/sfx2/sfxcommands.h @@ -45,6 +45,8 @@ #define CMD_SID_DOCINFO_TITLE ".uno:DocInfoTitle" #define CMD_SID_OPENTEMPLATE ".uno:OpenTemplate" #define CMD_SID_CHECKOUT ".uno:CheckOut" +#define CMD_SID_CANCELCHECKOUT ".uno:CancelCheckOut" +#define CMD_SID_CHECKIN ".uno:CheckIn" #define CMD_SID_OPENURL ".uno:OpenUrl" #define CMD_SID_OPTIONS ".uno:Options" #define CMD_SID_ORGANIZER ".uno:Organizer" diff --git a/sfx2/inc/sfx2/sfxsids.hrc b/sfx2/inc/sfx2/sfxsids.hrc index 9586dde26c50..0998c65b53f4 100644 --- a/sfx2/inc/sfx2/sfxsids.hrc +++ b/sfx2/inc/sfx2/sfxsids.hrc @@ -144,6 +144,8 @@ #define SID_DIRECTEXPORTDOCASPDF (SID_SFX_START + 1674) #define SID_UPDATEDOCMODE (SID_SFX_START + 1668) #define SID_CHECKOUT (SID_SFX_START + 512) +#define SID_CANCELCHECKOUT (SID_SFX_START + 513) +#define SID_CHECKIN (SID_SFX_START + 514) #define SID_FORCERELOAD (SID_SFX_START + 1502) #define SID_FILE_DIALOG (SID_SFX_START + 304) @@ -310,6 +312,7 @@ #define SID_DOCINFO_KEYWORDS (SID_SFX_START + 591) #define SID_DOCINFO_COMMENTS (SID_SFX_START + 592) #define SID_DOCINFO_AUTHOR (SID_SFX_START + 593) +#define SID_DOCINFO_MAJOR (SID_SFX_START + 594) #define SID_NEWDOCDIRECT (SID_SFX_START + 537) #define SID_DOCFRAME (SID_SFX_START + 598) #define SID_TARGETNAME (SID_SFX_START + 560) diff --git a/sfx2/sdi/docslots.sdi b/sfx2/sdi/docslots.sdi index 6ba11a83f8e0..111ba6ddf690 100644 --- a/sfx2/sdi/docslots.sdi +++ b/sfx2/sdi/docslots.sdi @@ -182,6 +182,16 @@ interface OfficeDocument : Document ExecMethod = ExecFile_Impl; StateMethod = GetState_Impl; ] + SID_CANCELCHECKOUT + [ + ExecMethod = ExecFile_Impl; + StateMethod = GetState_Impl; + ] + SID_CHECKIN + [ + ExecMethod = ExecFile_Impl; + StateMethod = GetState_Impl; + ] } //========================================================================= diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index 635342a40bcc..a7468cef6a2c 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -4468,6 +4468,54 @@ SfxVoidItem CheckOut SID_CHECKOUT GroupId = GID_DOCUMENT; ] +SfxVoidItem CancelCheckOut SID_CANCELCHECKOUT +() +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = TRUE, + Toggle = FALSE, + Container = TRUE, + RecordAbsolute = FALSE, + RecordPerSet; + Asynchron; + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_DOCUMENT; +] + +SfxVoidItem CheckIn SID_CHECKIN +(SfxStringItem VersionComment SID_DOCINFO_COMMENTS,SfxBoolItem VersionMajor SID_DOCINFO_MAJOR) +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = TRUE, + Toggle = FALSE, + Container = TRUE, + RecordAbsolute = FALSE, + RecordPerSet; + Asynchron; + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_DOCUMENT; +] + //-------------------------------------------------------------------------- SfxStringItem OpenUrl SID_OPENURL diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx index 36be7f935710..fa308568b59d 100644 --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -131,7 +131,8 @@ SfxFormalArgument aFormalArgs[] = { SFX_ARGUMENT(SID_DEFAULTFILENAME,"SuggestedSaveAsName",SfxStringItem), SFX_ARGUMENT(SID_DEFAULTFILEPATH,"SuggestedSaveAsDir",SfxStringItem), SFX_ARGUMENT(SID_DOCINFO_AUTHOR,"VersionAuthor",SfxStringItem), - SFX_ARGUMENT(SID_DOCINFO_COMMENTS,"VersionComment",SfxStringItem), + SFX_ARGUMENT(SID_DOCINFO_COMMENTS,"VersionComment",SfxBoolItem), + SFX_ARGUMENT(SID_DOCINFO_MAJOR,"VersionMajor",SfxStringItem), SFX_ARGUMENT(SID_FILE_FILTEROPTIONS,"FilterOptions",SfxStringItem), SFX_ARGUMENT(SID_FILTER_NAME,"FilterName",SfxStringItem), // SFX_ARGUMENT(SID_FILE_NAME,"FileName",SfxStringItem), diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index e5380e73e4dd..b36a44155b79 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -262,6 +262,7 @@ public: bool m_bTriedStorage:1; bool m_bRemote:1; bool m_bInputStreamIsReadOnly:1; + bool m_bInCheckIn:1; OUString m_aName; OUString m_aLogicName; @@ -336,6 +337,7 @@ SfxMedium_Impl::SfxMedium_Impl( SfxMedium* pAntiImplP ) : m_bTriedStorage(false), m_bRemote(false), m_bInputStreamIsReadOnly(false), + m_bInCheckIn(false), m_pSet(NULL), m_pURLObj(NULL), m_pFilter(NULL), @@ -1924,23 +1926,31 @@ void SfxMedium::Transfer_Impl() ::ucbhelper::Content aSourceContent; ::ucbhelper::Content aTransferContent; - // Get the parent URL from the XChild if possible: why would the URL necessarily have - // a hierarchical path? It's not always the case for CMIS. ::ucbhelper::Content aDestContent; ::ucbhelper::Content::create( aDestURL, xComEnv, comphelper::getProcessComponentContext(), aDestContent ); - Reference< ::com::sun::star::container::XChild> xChild( aDestContent.get(), uno::UNO_QUERY ); - rtl::OUString sParentUrl; - if ( xChild.is( ) ) + if ( !IsInCheckIn( ) ) { - Reference< ::com::sun::star::ucb::XContent > xParent( xChild->getParent( ), uno::UNO_QUERY ); - if ( xParent.is( ) ) + // Get the parent URL from the XChild if possible: why would the URL necessarily have + // a hierarchical path? It's not always the case for CMIS. + Reference< ::com::sun::star::container::XChild> xChild( aDestContent.get(), uno::UNO_QUERY ); + rtl::OUString sParentUrl; + if ( xChild.is( ) ) { - sParentUrl = xParent->getIdentifier( )->getContentIdentifier(); + Reference< ::com::sun::star::ucb::XContent > xParent( xChild->getParent( ), uno::UNO_QUERY ); + if ( xParent.is( ) ) + { + sParentUrl = xParent->getIdentifier( )->getContentIdentifier(); + } } - } - if ( !sParentUrl.isEmpty() ) - aDest = INetURLObject( sParentUrl ); + if ( !sParentUrl.isEmpty() ) + aDest = INetURLObject( sParentUrl ); + } + else + { + // For checkin, we need the object URL, not the parent folder + aDest = INetURLObject( aDestURL ); + } // LongName wasn't defined anywhere, only used here... get the Title instead // as it's less probably empty @@ -1997,8 +2007,24 @@ void SfxMedium::Transfer_Impl() try { rtl::OUString aMimeType = GetFilter()->GetMimeType( ); - if (!aTransferContent.transferContent( aSourceContent, ::ucbhelper::InsertOperation_COPY, aFileName, nNameClash, aMimeType )) + ::ucbhelper::InsertOperation eOperation = ::ucbhelper::InsertOperation_COPY; + bool bMajor = false; + rtl::OUString sComment; + if ( IsInCheckIn( ) ) + { + eOperation = ::ucbhelper::InsertOperation_CHECKIN; + SFX_ITEMSET_ARG( GetItemSet(), pMajor, SfxBoolItem, SID_DOCINFO_MAJOR, false ); + bMajor = pMajor && pMajor->GetValue( ); + SFX_ITEMSET_ARG( GetItemSet(), pComments, SfxStringItem, SID_DOCINFO_COMMENTS, false ); + if ( pComments ) + sComment = pComments->GetValue( ); + } + rtl::OUString sResultURL; + if (!aTransferContent.transferContent( aSourceContent, eOperation, + aFileName, nNameClash, aMimeType, bMajor, sComment, &sResultURL )) pImp->m_eError = ERRCODE_IO_GENERAL; + else if ( !sResultURL.isEmpty( ) ) // Likely to happen only for checkin + SwitchDocumentToFile( sResultURL ); } catch ( const ::com::sun::star::ucb::CommandAbortedException& ) { @@ -3694,4 +3720,14 @@ sal_Bool SfxMedium::SwitchDocumentToFile( const rtl::OUString& aURL ) return bResult; } +void SfxMedium::SetInCheckIn( bool bInCheckIn ) +{ + pImp->m_bInCheckIn = bInCheckIn; +} + +bool SfxMedium::IsInCheckIn( ) +{ + return pImp->m_bInCheckIn; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 13571881069c..116f97608c5f 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -361,6 +361,43 @@ void SfxObjectShell::CheckOut( ) } } +void SfxObjectShell::CancelCheckOut( ) +{ + try + { + uno::Reference< document::XCmisDocument > xCmisDoc( GetModel(), uno::UNO_QUERY_THROW ); + // TODO Pop up dialog to ask whether to loose data or not + xCmisDoc->cancelCheckOut( ); + } + catch ( const uno::RuntimeException& e ) + { + ErrorBox* pErrorBox = new ErrorBox( &GetFrame()->GetWindow(), WB_OK, e.Message ); + pErrorBox->Execute( ); + delete pErrorBox; + } +} + +void SfxObjectShell::CheckIn( ) +{ + try + { + uno::Reference< document::XCmisDocument > xCmisDoc( GetModel(), uno::UNO_QUERY_THROW ); + sal_Bool bIsMajor = sal_False; + rtl::OUString sComment( "Some sample comment" ); + // TODO Pop up dialog to ask for comment and major + xCmisDoc->checkIn( bIsMajor, sComment ); + uno::Reference< util::XModifiable > xModifiable( GetModel( ), uno::UNO_QUERY ); + if ( xModifiable.is( ) ) + xModifiable->setModified( sal_False ); + } + catch ( const uno::RuntimeException& e ) + { + ErrorBox* pErrorBox = new ErrorBox( &GetFrame()->GetWindow(), WB_OK, e.Message ); + pErrorBox->Execute( ); + delete pErrorBox; + } +} + //-------------------------------------------------------------------- void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) @@ -912,6 +949,16 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) CheckOut( ); break; } + case SID_CANCELCHECKOUT: + { + CancelCheckOut( ); + break; + } + case SID_CHECKIN: + { + CheckIn( ); + break; + } } // Prevent entry in the Pick-lists @@ -976,6 +1023,37 @@ void SfxObjectShell::GetState_Impl(SfxItemSet &rSet) } break; + case SID_CANCELCHECKOUT: + case SID_CHECKIN: + { + bool bShow = false; + Reference< XCmisDocument > xCmisDoc( GetModel(), uno::UNO_QUERY ); + beans::PropertyValues aCmisProperties = xCmisDoc->getCmisPropertiesValues( ); + + if ( xCmisDoc->isVersionable( ) && aCmisProperties.hasElements( ) ) + { + // Loop over the CMIS Properties to find cmis:isVersionSeriesCheckedOut + bool bFoundCheckedout = false; + sal_Bool bCheckedOut = sal_False; + for ( sal_Int32 i = 0; i < aCmisProperties.getLength() && !bFoundCheckedout; ++i ) + { + if ( aCmisProperties[i].Name == "cmis:isVersionSeriesCheckedOut" ) + { + bFoundCheckedout = true; + aCmisProperties[i].Value >>= bCheckedOut; + } + } + bShow = bCheckedOut; + } + + if ( !bShow ) + { + rSet.DisableItem( nWhich ); + rSet.Put( SfxVisibilityItem( nWhich, sal_False ) ); + } + } + break; + case SID_VERSION: { SfxObjectShell *pDoc = this; diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 45b1cb28fa37..9fe53943155e 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -1374,7 +1374,7 @@ sal_Bool SfxObjectShell::SaveTo_Impl pFilter = rMedium.GetFilter(); - const SfxStringItem *pVersionItem = pSet ? (const SfxStringItem*) + const SfxStringItem *pVersionItem = ( !rMedium.IsInCheckIn( ) && pSet ) ? (const SfxStringItem*) SfxRequest::GetItem( pSet, SID_DOCINFO_COMMENTS, sal_False, TYPE(SfxStringItem) ) : NULL; ::rtl::OUString aTmpVersionURL; @@ -1460,7 +1460,7 @@ sal_Bool SfxObjectShell::SaveTo_Impl } } - if ( bOk && pVersionItem ) + if ( bOk && pVersionItem && !rMedium.IsInCheckIn() ) { // store a version also const SfxStringItem *pAuthorItem = pSet ? (const SfxStringItem*) @@ -1624,7 +1624,12 @@ sal_Bool SfxObjectShell::SaveTo_Impl AddLog( ::rtl::OUString( OSL_LOG_PREFIX "Medium commit." ) ); + rtl::OUString sName( rMedium.GetName( ) ); bOk = rMedium.Commit(); + rtl::OUString sNewName( rMedium.GetName( ) ); + + if ( sName != sNewName ) + GetMedium( )->SwitchDocumentToFile( sNewName ); if ( bOk ) { @@ -2414,10 +2419,23 @@ sal_Bool SfxObjectShell::DoSave_Impl( const SfxItemSet* pArgs ) pSet->ClearItem( SID_VERSION ); pSet->ClearItem( SID_DOC_BASEURL ); + // copy the version comment and major items for the checkin only + if ( pRetrMedium->IsInCheckIn( ) ) + { + const SfxPoolItem* pMajor = pArgs->GetItem( SID_DOCINFO_MAJOR ); + if ( pMajor ) + pSet->Put( *pMajor ); + + const SfxPoolItem* pComments = pArgs->GetItem( SID_DOCINFO_COMMENTS ); + if ( pComments ) + pSet->Put( *pComments ); + } + // create a medium as a copy; this medium is only for writingm, because it // uses the same name as the original one writing is done through a copy, // that will be transferred to the target (of course after calling HandsOff) SfxMedium* pMediumTmp = new SfxMedium( pRetrMedium->GetName(), pRetrMedium->GetOpenMode(), pFilter, pSet ); + pMediumTmp->SetInCheckIn( pRetrMedium->IsInCheckIn( ) ); pMediumTmp->SetLongName( pRetrMedium->GetLongName() ); if ( pMediumTmp->GetErrorCode() != ERRCODE_NONE ) { diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index cc2abe9ec95d..46f0bee4debd 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -1621,11 +1621,13 @@ void SAL_CALL SfxBaseModel::storeSelf( const uno::Sequence< beans::PropertyVa m_pData->m_pObjectShell->AddLog( ::rtl::OUString( OSL_LOG_PREFIX "storeSelf" ) ); SfxSaveGuard aSaveGuard(this, m_pData, sal_False); + sal_Bool bCheckIn = sal_False; for ( sal_Int32 nInd = 0; nInd < aSeqArgs.getLength(); nInd++ ) { // check that only acceptable parameters are provided here if ( aSeqArgs[nInd].Name != "VersionComment" && aSeqArgs[nInd].Name != "Author" - && aSeqArgs[nInd].Name != "InteractionHandler" && aSeqArgs[nInd].Name != "StatusIndicator" ) + && aSeqArgs[nInd].Name != "InteractionHandler" && aSeqArgs[nInd].Name != "StatusIndicator" + && aSeqArgs[nInd].Name != "VersionMajor" && aSeqArgs[nInd].Name != "CheckIn" ) { m_pData->m_pObjectShell->AddLog( ::rtl::OUString( OSL_LOG_PREFIX "unexpected parameter for storeSelf, might be no problem if SaveAs is executed." ) ); m_pData->m_pObjectShell->StoreLog(); @@ -1634,10 +1636,34 @@ void SAL_CALL SfxBaseModel::storeSelf( const uno::Sequence< beans::PropertyVa aMessage += aSeqArgs[nInd].Name; throw lang::IllegalArgumentException( aMessage, uno::Reference< uno::XInterface >(), 1 ); } + else if ( aSeqArgs[nInd].Name == "CheckIn" ) + { + aSeqArgs[nInd].Value >>= bCheckIn; + } + } + + // Remove CheckIn property if needed + sal_uInt16 nSlotId = SID_SAVEDOC; + uno::Sequence< beans::PropertyValue > aArgs = aSeqArgs; + if ( bCheckIn ) + { + nSlotId = SID_CHECKIN; + sal_Int32 nLength = aSeqArgs.getLength( ); + aArgs = uno::Sequence< beans::PropertyValue >( nLength - 1 ); + sal_Int32 nNewI = 0; + for ( sal_Int32 i = 0; i < nLength; ++i ) + { + beans::PropertyValue aProp = aSeqArgs[i]; + if ( aProp.Name != "CheckIn" ) + { + aArgs[nNewI] = aProp; + ++nNewI; + } + } } SfxAllItemSet *pParams = new SfxAllItemSet( SFX_APP()->GetPool() ); - TransformParameters( SID_SAVEDOC, aSeqArgs, *pParams ); + TransformParameters( nSlotId, aArgs, *pParams ); SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEDOC, GlobalEventConfig::GetEventName(STR_EVENT_SAVEDOC), m_pData->m_pObjectShell ) ); @@ -1662,7 +1688,12 @@ void SAL_CALL SfxBaseModel::storeSelf( const uno::Sequence< beans::PropertyVa } } else + { + // Tell the SfxMedium if we are in checkin instead of normal save + m_pData->m_pObjectShell->GetMedium( )->SetInCheckIn( nSlotId == SID_CHECKIN ); bRet = m_pData->m_pObjectShell->Save_Impl( pParams ); + m_pData->m_pObjectShell->GetMedium( )->SetInCheckIn( nSlotId != SID_CHECKIN ); + } DELETEZ( pParams ); @@ -2577,9 +2608,81 @@ void SAL_CALL SfxBaseModel::checkOut( ) throw ( uno::RuntimeException ) } } -sal_Bool SAL_CALL SfxBaseModel::isVersionable( ) throw ( uno::RuntimeException ) +void SAL_CALL SfxBaseModel::cancelCheckOut( ) throw ( uno::RuntimeException ) { - sal_Bool bVersionable = sal_False; + SfxMedium* pMedium = m_pData->m_pObjectShell->GetMedium(); + if ( pMedium ) + { + try + { + ::ucbhelper::Content aContent( pMedium->GetName(), + uno::Reference(), + comphelper::getProcessComponentContext() ); + + uno::Any aResult = aContent.executeCommand( "cancelCheckout", uno::Any( ) ); + rtl::OUString sURL; + aResult >>= sURL; + + m_pData->m_pObjectShell->GetMedium( )->SwitchDocumentToFile( sURL ); + m_pData->m_xDocumentProperties->setTitle( getTitle( ) ); + uno::Sequence< beans::PropertyValue > aSequence ; + TransformItems( SID_OPENDOC, *pMedium->GetItemSet(), aSequence ); + attachResource( sURL, aSequence ); + + // Reload the CMIS properties + loadCmisProperties( ); + } + catch ( const uno::Exception & e ) + { + throw uno::RuntimeException( e.Message, e.Context ); + } + } +} + +void SAL_CALL SfxBaseModel::checkIn( sal_Bool bIsMajor, const rtl::OUString& rMessage ) throw ( uno::RuntimeException ) +{ + SfxMedium* pMedium = m_pData->m_pObjectShell->GetMedium(); + if ( pMedium ) + { + try + { + uno::Sequence< beans::PropertyValue > aProps( 3 ); + aProps[0].Name = "VersionMajor"; + aProps[0].Value = uno::makeAny( bIsMajor ); + aProps[1].Name = "VersionComment"; + aProps[1].Value = uno::makeAny( rMessage ); + aProps[2].Name = "CheckIn"; + aProps[2].Value = uno::makeAny( sal_True ); + + rtl::OUString sName( pMedium->GetName( ) ); + storeSelf( aProps ); + + // Refresh pMedium as it has probably changed during the storeSelf call + pMedium = m_pData->m_pObjectShell->GetMedium( ); + rtl::OUString sNewName( pMedium->GetName( ) ); + + // URL has changed, update the document + if ( sName != sNewName ) + { + m_pData->m_xDocumentProperties->setTitle( getTitle( ) ); + uno::Sequence< beans::PropertyValue > aSequence ; + TransformItems( SID_OPENDOC, *pMedium->GetItemSet(), aSequence ); + attachResource( sNewName, aSequence ); + + // Reload the CMIS properties + loadCmisProperties( ); + } + } + catch ( const uno::Exception & e ) + { + throw uno::RuntimeException( e.Message, e.Context ); + } + } +} + +sal_Bool SfxBaseModel::getBoolPropertyValue( const rtl::OUString& rName ) throw ( uno::RuntimeException ) +{ + sal_Bool bValue = sal_False; SfxMedium* pMedium = m_pData->m_pObjectShell->GetMedium(); if ( pMedium ) { @@ -2589,10 +2692,9 @@ sal_Bool SAL_CALL SfxBaseModel::isVersionable( ) throw ( uno::RuntimeException ) uno::Reference(), comphelper::getProcessComponentContext() ); com::sun::star::uno::Reference < beans::XPropertySetInfo > xProps = aContent.getProperties(); - ::rtl::OUString aIsVersionableProp( "IsVersionable" ); - if ( xProps->hasPropertyByName( aIsVersionableProp ) ) + if ( xProps->hasPropertyByName( rName ) ) { - aContent.getPropertyValue( aIsVersionableProp ) >>= bVersionable; + aContent.getPropertyValue( rName ) >>= bValue; } } catch ( const uno::Exception & e ) @@ -2600,7 +2702,27 @@ sal_Bool SAL_CALL SfxBaseModel::isVersionable( ) throw ( uno::RuntimeException ) throw uno::RuntimeException( e.Message, e.Context ); } } - return bVersionable; + return bValue; +} + +sal_Bool SAL_CALL SfxBaseModel::isVersionable( ) throw ( uno::RuntimeException ) +{ + return getBoolPropertyValue( "IsVersionable" ); +} + +sal_Bool SAL_CALL SfxBaseModel::canCheckOut( ) throw ( uno::RuntimeException ) +{ + return getBoolPropertyValue( "CanCheckOut" ); +} + +sal_Bool SAL_CALL SfxBaseModel::canCancelCheckOut( ) throw ( uno::RuntimeException ) +{ + return getBoolPropertyValue( "CanCancelCheckOut" ); +} + +sal_Bool SAL_CALL SfxBaseModel::canCheckIn( ) throw ( uno::RuntimeException ) +{ + return getBoolPropertyValue( "CanCheckIn" ); } void SfxBaseModel::loadCmisProperties( ) diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index 54827c5d7436..81638ff2076b 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -1470,7 +1470,7 @@ void SfxBaseController::ShowInfoBars( ) } } -IMPL_LINK( SfxBaseController, CheckOutHandler, PushButton*, pBtn ) +IMPL_LINK_NOARG ( SfxBaseController, CheckOutHandler ) { if ( m_pData->m_pViewShell ) m_pData->m_pViewShell->GetObjectShell()->CheckOut( ); -- cgit From 99f376d2d143fa169fbf6e2527a897277d586524 Mon Sep 17 00:00:00 2001 From: Cédric Bosdonnat Date: Wed, 31 Oct 2012 11:21:50 +0100 Subject: Fix broken sw unit introduced by commit a522818 Change-Id: I78a191e39dee00d31ddd773e7b49af73be3136cc --- sfx2/source/doc/sfxbasemodel.cxx | 30 ++++++++++++++---------- sfx2/source/view/sfxbasecontroller.cxx | 43 ++++++++++++++++++---------------- 2 files changed, 40 insertions(+), 33 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 46f0bee4debd..163929e826d4 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -2683,23 +2683,27 @@ void SAL_CALL SfxBaseModel::checkIn( sal_Bool bIsMajor, const rtl::OUString& rMe sal_Bool SfxBaseModel::getBoolPropertyValue( const rtl::OUString& rName ) throw ( uno::RuntimeException ) { sal_Bool bValue = sal_False; - SfxMedium* pMedium = m_pData->m_pObjectShell->GetMedium(); - if ( pMedium ) + if ( m_pData->m_pObjectShell ) { - try + SfxMedium* pMedium = m_pData->m_pObjectShell->GetMedium(); + if ( pMedium ) { - ::ucbhelper::Content aContent( pMedium->GetName( ), - uno::Reference(), - comphelper::getProcessComponentContext() ); - com::sun::star::uno::Reference < beans::XPropertySetInfo > xProps = aContent.getProperties(); - if ( xProps->hasPropertyByName( rName ) ) + try { - aContent.getPropertyValue( rName ) >>= bValue; + ::ucbhelper::Content aContent( pMedium->GetName( ), + uno::Reference(), + comphelper::getProcessComponentContext() ); + com::sun::star::uno::Reference < beans::XPropertySetInfo > xProps = aContent.getProperties(); + if ( xProps->hasPropertyByName( rName ) ) + { + aContent.getPropertyValue( rName ) >>= bValue; + } + } + catch ( const uno::Exception & ) + { + // Simply ignore it: it's likely the document isn't versionable in that case + bValue = sal_False; } - } - catch ( const uno::Exception & e ) - { - throw uno::RuntimeException( e.Message, e.Context ); } } return bValue; diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index 81638ff2076b..dee5ea764914 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -1440,31 +1440,34 @@ void SfxBaseController::ShowInfoBars( ) { // CMIS verifications REFERENCE< document::XCmisDocument > xCmisDoc( m_pData->m_pViewShell->GetObjectShell()->GetModel(), uno::UNO_QUERY ); - beans::PropertyValues aCmisProperties = xCmisDoc->getCmisPropertiesValues( ); - - if ( xCmisDoc->isVersionable( ) && aCmisProperties.hasElements( ) ) + if ( xCmisDoc.is( ) ) { - // Loop over the CMIS Properties to find cmis:isVersionSeriesCheckedOut - bool bFoundCheckedout = false; - sal_Bool bCheckedOut = sal_False; - for ( sal_Int32 i = 0; i < aCmisProperties.getLength() && !bFoundCheckedout; ++i ) + beans::PropertyValues aCmisProperties = xCmisDoc->getCmisPropertiesValues( ); + + if ( xCmisDoc->isVersionable( ) && aCmisProperties.hasElements( ) ) { - if ( aCmisProperties[i].Name == "cmis:isVersionSeriesCheckedOut" ) + // Loop over the CMIS Properties to find cmis:isVersionSeriesCheckedOut + bool bFoundCheckedout = false; + sal_Bool bCheckedOut = sal_False; + for ( sal_Int32 i = 0; i < aCmisProperties.getLength() && !bFoundCheckedout; ++i ) { - bFoundCheckedout = true; - aCmisProperties[i].Value >>= bCheckedOut; + if ( aCmisProperties[i].Name == "cmis:isVersionSeriesCheckedOut" ) + { + bFoundCheckedout = true; + aCmisProperties[i].Value >>= bCheckedOut; + } } - } - if ( !bCheckedOut ) - { - // Get the Frame and show the InfoBar if not checked out - SfxViewFrame* pViewFrame = m_pData->m_pViewShell->GetFrame(); - std::vector< PushButton* > aButtons; - PushButton* pBtn = new PushButton( &pViewFrame->GetWindow(), SfxResId( BT_CHECKOUT ) ); - pBtn->SetClickHdl( LINK( this, SfxBaseController, CheckOutHandler ) ); - aButtons.push_back( pBtn ); - pViewFrame->AppendInfoBar( "checkout", SfxResId( STR_NONCHECKEDOUT_DOCUMENT ), aButtons ); + if ( !bCheckedOut ) + { + // Get the Frame and show the InfoBar if not checked out + SfxViewFrame* pViewFrame = m_pData->m_pViewShell->GetFrame(); + std::vector< PushButton* > aButtons; + PushButton* pBtn = new PushButton( &pViewFrame->GetWindow(), SfxResId( BT_CHECKOUT ) ); + pBtn->SetClickHdl( LINK( this, SfxBaseController, CheckOutHandler ) ); + aButtons.push_back( pBtn ); + pViewFrame->AppendInfoBar( "checkout", SfxResId( STR_NONCHECKEDOUT_DOCUMENT ), aButtons ); + } } } } -- cgit From 918d15412980cd8e8c0bc5e2b1413907708aab1f Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 31 Oct 2012 14:10:33 +0000 Subject: fix fractured indent Change-Id: I7c7f951b352ed2e9ef7604a5be324223f21e96dd --- sfx2/source/appl/appserv.cxx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index c008ca2286db..1fc527945668 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -351,7 +351,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) RID_SVXDLG_CUSTOMIZE, NULL, &aSet, xFrame ); - if ( pDlg ) + if ( pDlg ) { const short nRet = pDlg->Execute(); @@ -528,13 +528,13 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - case SID_ABOUT: { - SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); + SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); if ( pFact ) { VclAbstractDialog* pDlg = pFact->CreateVclDialog( 0, RID_DEFAULTABOUT ); pDlg->Execute(); delete pDlg; - bDone = true; + bDone = true; } break; } @@ -1039,8 +1039,8 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) { VclAbstractDialog* pDlg = pFact->CreateFrameDialog( NULL, xFrame, rReq.GetSlot(), sPageURL ); - short nRet = pDlg->Execute(); - delete pDlg; + short nRet = pDlg->Execute(); + delete pDlg; SfxViewFrame* pView = SfxViewFrame::GetFirst(); while ( pView ) { @@ -1315,9 +1315,9 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) if ( pSet && pSet->GetItemState( pSetPool->GetWhich( SID_AUTO_CORRECT_DLG ), sal_False, &pItem ) == SFX_ITEM_SET ) aSet.Put( *pItem ); - SfxAbstractTabDialog* pDlg = pFact->CreateTabDialog( RID_OFA_AUTOCORR_DLG, NULL, &aSet, NULL ); - pDlg->Execute(); - delete pDlg; + SfxAbstractTabDialog* pDlg = pFact->CreateTabDialog( RID_OFA_AUTOCORR_DLG, NULL, &aSet, NULL ); + pDlg->Execute(); + delete pDlg; } break; -- cgit From 22e9d19d750420015771b4b92fbbdeb4bc956233 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 31 Oct 2012 14:14:19 +0000 Subject: fix old big fat leak in macro and organizer dialogs Change-Id: Ie8a6c2a8850ad3dd6cd2be878aedfbf81d2473f7 --- sfx2/source/appl/appserv.cxx | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'sfx2') diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index 1fc527945668..fc109add1382 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -1232,7 +1232,10 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) short nDialogResult = pDlg->Execute(); if ( !nDialogResult ) + { + delete pDlg; break; + } Sequence< Any > args; Sequence< sal_Int16 > outIndex; @@ -1250,6 +1253,7 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) xScriptContext = xController; SfxObjectShell::CallXScript( xScriptContext, pDlg->GetScriptURL(), args, ret, outIndex, outArgs ); + delete pDlg; } while ( false ); rReq.Done(); @@ -1275,6 +1279,7 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) if( pDlg ) { pDlg->Execute(); + delete pDlg; } else { -- cgit From 0ac9a10d312dc8f12a74720ce211823ce4addf7b Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 30 Oct 2012 14:02:56 +0200 Subject: fdo#46808, Deprecate configuration::ConfigurationProvider old-style service ...in favor of existing new-style configuration::theDefaultProvider singleton. Theoretically, ConfigurationProvider instances can be created with specific Locale and EnableAsync arguments, but this is hardly used in practice, and thus effectively all uses of the ConfigurationProvider service use the theDefaultProvider instance, anyway. theDefaultProvider is restricted to the XMultiServiceFactory interface, while ConfigurationProvider also makes available XComponent. However, dispose must not be called manually on theDefaultProvider singleton anyway, and calls to add-/removeEventListener are so few (and in dubious code that should better be cleaned up) that requiring an explicit queryInterface does not really hurt there. This commit originated as a patch by Noel Grandin to "Adapt configuration::ConfigurationProvider UNO service to new style [by creating] a merged XConfigurationProvider interface for this service to implement." It was then modified by Stephan Bergmann by deprecating ConfigurationProvider instead of adding XConfigurationProvider and by replacing calls to ConfigurationProvider::create with calls to theDefaultProvider::get. Change-Id: I9c16700afe0faff1ef6f20338a66bd7a9af990bd --- sfx2/source/appl/appdata.cxx | 2 +- sfx2/source/appl/imestatuswindow.cxx | 22 ++++++---------------- sfx2/source/appl/imestatuswindow.hxx | 6 +++--- sfx2/source/doc/doctemplates.cxx | 7 +++---- 4 files changed, 13 insertions(+), 24 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/appl/appdata.cxx b/sfx2/source/appl/appdata.cxx index dc04ea6803fa..a49e7790f8e5 100644 --- a/sfx2/source/appl/appdata.cxx +++ b/sfx2/source/appl/appdata.cxx @@ -100,7 +100,7 @@ SfxAppData_Impl::SfxAppData_Impl( SfxApplication* ) , nAutoTabPageId(0) , nRescheduleLocks(0) , nInReschedule(0) - , m_xImeStatusWindow(new sfx2::appl::ImeStatusWindow(comphelper::getProcessServiceFactory())) + , m_xImeStatusWindow(new sfx2::appl::ImeStatusWindow(comphelper::getProcessComponentContext())) , pTbxCtrlFac(0) , pStbCtrlFac(0) , pViewFrames(0) diff --git a/sfx2/source/appl/imestatuswindow.cxx b/sfx2/source/appl/imestatuswindow.cxx index 754e35d9d7a7..56631e9ba801 100644 --- a/sfx2/source/appl/imestatuswindow.cxx +++ b/sfx2/source/appl/imestatuswindow.cxx @@ -26,6 +26,7 @@ #include "com/sun/star/beans/PropertyState.hpp" #include "com/sun/star/beans/PropertyValue.hpp" #include "com/sun/star/beans/XPropertySet.hpp" +#include "com/sun/star/configuration/theDefaultProvider.hpp" #include "com/sun/star/lang/DisposedException.hpp" #include "com/sun/star/lang/XMultiServiceFactory.hpp" #include "com/sun/star/uno/Any.hxx" @@ -84,9 +85,8 @@ namespace css = com::sun::star; using sfx2::appl::ImeStatusWindow; ImeStatusWindow::ImeStatusWindow( - css::uno::Reference< css::lang::XMultiServiceFactory > const & - rServiceFactory): - m_xServiceFactory(rServiceFactory), + css::uno::Reference< css::uno::XComponentContext > const & rxContext): + m_xContext(rxContext), m_bDisposed(false) {} @@ -201,24 +201,14 @@ css::uno::Reference< css::beans::XPropertySet > ImeStatusWindow::getConfig() { if (m_bDisposed) throw css::lang::DisposedException(); - if (!m_xServiceFactory.is()) + if (!m_xContext.is()) throw css::uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "null comphelper::getProcessServiceFactory")), 0); - css::uno::Reference< css::lang::XMultiServiceFactory > xProvider( - m_xServiceFactory->createInstance( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.configuration.ConfigurationProvider"))), - css::uno::UNO_QUERY); - if (!xProvider.is()) - throw css::uno::RuntimeException( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - "null com.sun.star.configuration." - "ConfigurationProvider")), - 0); + css::uno::Reference< css::lang::XMultiServiceFactory > xProvider = + css::configuration::theDefaultProvider::get( m_xContext ); css::beans::PropertyValue aArg( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath")), -1, css::uno::makeAny( diff --git a/sfx2/source/appl/imestatuswindow.hxx b/sfx2/source/appl/imestatuswindow.hxx index 5aee577fcc54..4ab18a5841ce 100644 --- a/sfx2/source/appl/imestatuswindow.hxx +++ b/sfx2/source/appl/imestatuswindow.hxx @@ -47,7 +47,7 @@ ImeStatusWindow_Impl; class ImeStatusWindow: private ImeStatusWindow_Impl { public: - ImeStatusWindow( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > const& rServiceFactory ); + ImeStatusWindow( com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const& rxContext ); /** Set up VCL according to the configuration. @@ -103,8 +103,8 @@ private: com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > getConfig(); - com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > - m_xServiceFactory; + com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > + m_xContext; osl::Mutex m_aMutex; com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx index c7194de34247..92b91947e841 100644 --- a/sfx2/source/doc/doctemplates.cxx +++ b/sfx2/source/doc/doctemplates.cxx @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -1838,10 +1839,8 @@ sal_Bool SfxDocTplService_Impl::storeTemplate( const OUString& rGroupName, // get the actual filter name ::rtl::OUString aFilterName; - uno::Reference< lang::XMultiServiceFactory > xConfigProvider( - xFactory->createInstance( - ::rtl::OUString("com.sun.star.configuration.ConfigurationProvider") ), - uno::UNO_QUERY_THROW ); + uno::Reference< lang::XMultiServiceFactory > xConfigProvider = + configuration::theDefaultProvider::get( comphelper::getComponentContext(xFactory) ); uno::Sequence< uno::Any > aArgs( 1 ); beans::PropertyValue aPathProp; -- cgit From cba921ea0b293acc4b4e64f043f2e56d3e4cb15b Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 31 Oct 2012 18:24:23 +0100 Subject: Work around new calls to GetFilter()->GetMimeType() on null filter ...introduced with 75bc673b60d3eb40713868ce3d1b4f62dd6e1208 "Travelled MIME type through UCB for CMIS UCP to use it when creating documents" and causing crashes in sc_unoapi test. Many SfxMedium instances appear to have a null filter, so this workaround at least fixes the crashes. No idea what a good fix should look like, so will ask Cedric to review his commit. Change-Id: I27180265b6c79c7ed5f459b03c9e188ff6a0f56d --- sfx2/source/doc/docfile.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index b36a44155b79..9be89f51114a 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -314,6 +314,9 @@ public: SfxMedium_Impl( SfxMedium* pAntiImplP ); ~SfxMedium_Impl(); + + OUString getFilterMimeType() + { return m_pFilter == 0 ? OUString() : m_pFilter->GetMimeType(); } }; //------------------------------------------------------------------ @@ -2006,7 +2009,7 @@ void SfxMedium::Transfer_Impl() try { - rtl::OUString aMimeType = GetFilter()->GetMimeType( ); + rtl::OUString aMimeType = pImp->getFilterMimeType(); ::ucbhelper::InsertOperation eOperation = ::ucbhelper::InsertOperation_COPY; bool bMajor = false; rtl::OUString sComment; @@ -2087,7 +2090,7 @@ void SfxMedium::DoInternalBackup_Impl( const ::ucbhelper::Content& aOriginalCont { try { - rtl::OUString sMimeType = GetFilter()->GetMimeType( ); + rtl::OUString sMimeType = pImp->getFilterMimeType(); if( aBackupCont.transferContent( aOriginalContent, ::ucbhelper::InsertOperation_COPY, aBackupName, @@ -2175,7 +2178,7 @@ void SfxMedium::DoBackup_Impl() try { // do the transfer ( copy source file to backup dir ) - rtl::OUString sMimeType = GetFilter()->GetMimeType( ); + rtl::OUString sMimeType = pImp->getFilterMimeType(); bSuccess = aContent.transferContent( aSourceContent, ::ucbhelper::InsertOperation_COPY, aFileName, @@ -3307,7 +3310,7 @@ void SfxMedium::CreateTempFile( sal_Bool bReplace ) if ( !aFileName.isEmpty() && aTmpURLObj.removeSegment() ) { ::ucbhelper::Content aTargetContent( aTmpURLObj.GetMainURL( INetURLObject::NO_DECODE ), xComEnv, comphelper::getProcessComponentContext() ); - rtl::OUString sMimeType = GetFilter()->GetMimeType( ); + rtl::OUString sMimeType = pImp->getFilterMimeType(); if ( aTargetContent.transferContent( pImp->aContent, ::ucbhelper::InsertOperation_COPY, aFileName, NameClash::OVERWRITE, sMimeType ) ) { SetWritableForUserOnly( aTmpURL ); -- cgit From bbf1bcd9ad9cc0368aef4a4de41e9538f6ad91b0 Mon Sep 17 00:00:00 2001 From: Norbert Thiebaud Date: Tue, 23 Oct 2012 15:35:12 +0200 Subject: basic: String -> OUString in basicmanager Change-Id: I6607bfe8b6bf4d29ffd01cd88a19af5e53d616b5 --- sfx2/source/appl/appuno.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sfx2') diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx index fa308568b59d..ffb4853e7ec1 100644 --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -1908,7 +1908,7 @@ ErrCode SfxMacroLoader::loadMacro( const ::rtl::OUString& rURL, com::sun::star:: aQualifiedMethod.Erase( nArgsPos - nHashPos - 1 ); } - if ( pBasMgr->HasMacro( aQualifiedMethod ) ) + if ( pBasMgr->HasMacro( OUString(aQualifiedMethod) ) ) { Any aOldThisComponent; const bool bSetDocMacroMode = ( pDoc != NULL ) && bIsDocBasic; -- cgit From bce042ca83c7cb5cc3e3bdc07c50b60e6a1ed659 Mon Sep 17 00:00:00 2001 From: Cédric Bosdonnat Date: Sat, 3 Nov 2012 14:55:19 +0100 Subject: CMIS: added confirmation dialog for cancel checkout Change-Id: I12317bd8c91756c7960f04d2fad38dd509840932 --- sfx2/source/appl/app.hrc | 1 + sfx2/source/appl/app.src | 7 +++++++ sfx2/source/doc/objserv.cxx | 5 ++++- 3 files changed, 12 insertions(+), 1 deletion(-) (limited to 'sfx2') diff --git a/sfx2/source/appl/app.hrc b/sfx2/source/appl/app.hrc index 5cbfd7fed9a8..fb322cbf3251 100644 --- a/sfx2/source/appl/app.hrc +++ b/sfx2/source/appl/app.hrc @@ -112,6 +112,7 @@ #define RID_XMLSEC_QUERY_LOSINGSIGNATURE (RID_SFX_APP_START + 186) #define RID_XMLSEC_QUERY_SAVEBEFORESIGN (RID_SFX_APP_START + 187) +#define RID_QUERY_CANCELCHECKOUT (RID_SFX_APP_START + 188) #define RID_XMLSEC_INFO_WRONGDOCFORMAT (RID_SFX_APP_START + 190) diff --git a/sfx2/source/appl/app.src b/sfx2/source/appl/app.src index 6eae48d2f327..d1dcccd11c9f 100644 --- a/sfx2/source/appl/app.src +++ b/sfx2/source/appl/app.src @@ -432,6 +432,13 @@ QueryBox RID_XMLSEC_QUERY_SAVEBEFORESIGN Message [ en-US ] = "The document has to be saved before it can be signed.\nDo you want to save the document?" ; }; +QueryBox RID_QUERY_CANCELCHECKOUT +{ + Buttons = WB_YES_NO ; + DefButton = WB_DEF_YES ; + Message [ en-US ] = "This will discard all changes on the server since check-out.\nDo you want to proceed?" ; +}; + InfoBox RID_XMLSEC_INFO_WRONGDOCFORMAT { Message [ en-US ] = "This document must be saved in OpenDocument file format before it can be digitally signed." ; diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 116f97608c5f..490a72bf54b1 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -951,7 +951,10 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) } case SID_CANCELCHECKOUT: { - CancelCheckOut( ); + if ( QueryBox( NULL, SfxResId( RID_QUERY_CANCELCHECKOUT ) ).Execute( ) == RET_YES ) + { + CancelCheckOut( ); + } break; } case SID_CHECKIN: -- cgit From 207ed1b1a17ca6d785cad936ecadcd160acc2b83 Mon Sep 17 00:00:00 2001 From: Cédric Bosdonnat Date: Wed, 7 Nov 2012 15:18:59 +0100 Subject: CMIS: added CheckIn dialog Change-Id: Iba938986478b880b7026285f607972a2e4d72283 --- sfx2/Library_sfx.mk | 1 + sfx2/UI_sfx.mk | 1 + sfx2/inc/sfx2/checkin.hxx | 35 +++++++++++ sfx2/source/dialog/checkin.cxx | 39 ++++++++++++ sfx2/source/doc/objserv.cxx | 20 ++++--- sfx2/uiconfig/ui/checkin.ui | 132 +++++++++++++++++++++++++++++++++++++++++ 6 files changed, 220 insertions(+), 8 deletions(-) create mode 100644 sfx2/inc/sfx2/checkin.hxx create mode 100644 sfx2/source/dialog/checkin.cxx create mode 100644 sfx2/uiconfig/ui/checkin.ui (limited to 'sfx2') diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk index eae3511b8511..8a12ad9e9911 100644 --- a/sfx2/Library_sfx.mk +++ b/sfx2/Library_sfx.mk @@ -147,6 +147,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\ sfx2/source/control/unoctitm \ sfx2/source/dialog/alienwarn \ sfx2/source/dialog/basedlgs \ + sfx2/source/dialog/checkin \ sfx2/source/dialog/dinfdlg \ sfx2/source/dialog/dinfedt \ sfx2/source/dialog/dockwin \ diff --git a/sfx2/UI_sfx.mk b/sfx2/UI_sfx.mk index a084da170522..c164884df217 100644 --- a/sfx2/UI_sfx.mk +++ b/sfx2/UI_sfx.mk @@ -10,6 +10,7 @@ $(eval $(call gb_UI_UI,sfx)) $(eval $(call gb_UI_add_uifiles,sfx,\ + sfx2/uiconfig/ui/checkin \ sfx2/uiconfig/ui/password \ )) diff --git a/sfx2/inc/sfx2/checkin.hxx b/sfx2/inc/sfx2/checkin.hxx new file mode 100644 index 000000000000..65aa2e75cd1b --- /dev/null +++ b/sfx2/inc/sfx2/checkin.hxx @@ -0,0 +1,35 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +#ifndef _SFX_CHECKIN_HXX +#define _SFX_CHECKIN_HXX + +#include +#include +#include + +class SfxCheckinDialog : public ModalDialog +{ + private: + Edit* m_pCommentED; + CheckBox* m_pMajorCB; + + OKButton* m_pOKBtn; + + DECL_DLLPRIVATE_LINK(OKHdl, void *); + + public: + SfxCheckinDialog( Window* pParent ); + + rtl::OUString GetComment( ); + bool IsMajor( ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/checkin.cxx b/sfx2/source/dialog/checkin.cxx new file mode 100644 index 000000000000..a2bac2570771 --- /dev/null +++ b/sfx2/source/dialog/checkin.cxx @@ -0,0 +1,39 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include +#include + +SfxCheckinDialog::SfxCheckinDialog( Window* pParent ) : + ModalDialog( pParent, "CheckinDialog", "sfx/ui/checkin.ui" ) +{ + get( m_pCommentED, "VersionComment" ); + get( m_pMajorCB, "MajorVersion" ); + + get( m_pOKBtn, "ok" ); + m_pOKBtn->SetClickHdl( LINK( this, SfxCheckinDialog, OKHdl ) ); +} + +rtl::OUString SfxCheckinDialog::GetComment( ) +{ + return m_pCommentED->GetText( ); +} + +bool SfxCheckinDialog::IsMajor( ) +{ + return m_pMajorCB->IsChecked( ); +} + +IMPL_LINK_NOARG( SfxCheckinDialog, OKHdl ) +{ + EndDialog( RET_OK ); + return 0; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 490a72bf54b1..2412dcc7b744 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -87,6 +87,7 @@ #include "sfx2/sfxhelp.hxx" #include #include +#include #include "../appl/app.hrc" #include @@ -366,7 +367,6 @@ void SfxObjectShell::CancelCheckOut( ) try { uno::Reference< document::XCmisDocument > xCmisDoc( GetModel(), uno::UNO_QUERY_THROW ); - // TODO Pop up dialog to ask whether to loose data or not xCmisDoc->cancelCheckOut( ); } catch ( const uno::RuntimeException& e ) @@ -382,13 +382,17 @@ void SfxObjectShell::CheckIn( ) try { uno::Reference< document::XCmisDocument > xCmisDoc( GetModel(), uno::UNO_QUERY_THROW ); - sal_Bool bIsMajor = sal_False; - rtl::OUString sComment( "Some sample comment" ); - // TODO Pop up dialog to ask for comment and major - xCmisDoc->checkIn( bIsMajor, sComment ); - uno::Reference< util::XModifiable > xModifiable( GetModel( ), uno::UNO_QUERY ); - if ( xModifiable.is( ) ) - xModifiable->setModified( sal_False ); + // Pop up dialog to ask for comment and major + SfxCheckinDialog checkinDlg( &GetFrame( )->GetWindow( ) ); + if ( checkinDlg.Execute( ) == RET_OK ) + { + rtl::OUString sComment = checkinDlg.GetComment( ); + sal_Bool bMajor = checkinDlg.IsMajor( ); + xCmisDoc->checkIn( bMajor, sComment ); + uno::Reference< util::XModifiable > xModifiable( GetModel( ), uno::UNO_QUERY ); + if ( xModifiable.is( ) ) + xModifiable->setModified( sal_False ); + } } catch ( const uno::RuntimeException& e ) { diff --git a/sfx2/uiconfig/ui/checkin.ui b/sfx2/uiconfig/ui/checkin.ui new file mode 100644 index 000000000000..c97657d380fc --- /dev/null +++ b/sfx2/uiconfig/ui/checkin.ui @@ -0,0 +1,132 @@ + + + + + False + 5 + Check-in + True + center-on-parent + dialog + + + False + vertical + 2 + + + False + end + + + gtk-cancel + False + True + True + True + False + True + + + False + True + 0 + + + + + gtk-ok + False + True + True + True + False + True + + + False + True + 1 + + + + + False + True + end + 0 + + + + + True + False + vertical + + + True + False + start + 8 + Version comment + + + False + False + 0 + + + + + True + False + 6 + 12 + + + 300 + 150 + True + True + word + + + + + True + True + 1 + + + + + New major version + False + True + True + False + False + 0 + True + + + False + True + 2 + + + + + True + True + 1 + + + + + + cancel + ok + + + -- cgit From 5cc34dc91211b6173139d1a1a76c494c4a1f9a75 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 7 Nov 2012 14:39:15 +0000 Subject: using a grid instead of a box because I haven't implemented widget prop expands yet in boxes, but I have in grid, not too hard to do, just need to get around to it Change-Id: I6120df6061f622e14f8160f0bb098fcaba15abab --- sfx2/uiconfig/ui/checkin.ui | 85 +++++++++++++++++++++++++-------------------- 1 file changed, 47 insertions(+), 38 deletions(-) (limited to 'sfx2') diff --git a/sfx2/uiconfig/ui/checkin.ui b/sfx2/uiconfig/ui/checkin.ui index c97657d380fc..0585acba5fc2 100644 --- a/sfx2/uiconfig/ui/checkin.ui +++ b/sfx2/uiconfig/ui/checkin.ui @@ -39,6 +39,8 @@ False True True + True + True True False True @@ -58,61 +60,68 @@ - + True False - vertical + True + True - + + New major version + False True - False - start - 8 - Version comment + True + False + False + 0 + True - False - False - 0 + 0 + 1 + 1 + 1 - + True False - 6 - 12 + 0 + none - - 300 - 150 + True - True - word + False + 6 + 12 + + + 300 + 150 + True + True + word + + + + + + + True + False + Version comment + + + - True - True - 1 - - - - - New major version - False - True - True - False - False - 0 - True - - - False - True - 2 + 0 + 0 + 1 + 1 -- cgit From a599f5b4b51848e3b397d471c9d12b373caadcef Mon Sep 17 00:00:00 2001 From: jailletc36 Date: Thu, 8 Nov 2012 07:25:02 +0100 Subject: cppCheck: Unused variable and Redundant assignment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I67084c1cb9dc23eb77787d2a6d57a5b70126873c Signed-off-by: jailletc36 Reviewed-on: https://gerrit.libreoffice.org/1005 Reviewed-by: Radek Doulík Tested-by: Radek Doulík --- sfx2/source/bastyp/fltfnc.cxx | 1 - sfx2/source/control/dispatch.cxx | 2 -- sfx2/source/dialog/dinfdlg.cxx | 5 ----- sfx2/source/dialog/securitypage.cxx | 5 ----- 4 files changed, 13 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx index 14df8c481ed1..60de316a023c 100644 --- a/sfx2/source/bastyp/fltfnc.cxx +++ b/sfx2/source/bastyp/fltfnc.cxx @@ -1147,7 +1147,6 @@ void SfxFilterContainer::ReadFilters_Impl( sal_Bool bUpdate ) SfxFilter* pFilter; for ( size_t i = 0, n = rList.size(); i < n; ++i ) { - pFilter = NULL; pFilter = rList[ i ]; pFilter->nFormatType |= SFX_FILTER_NOTINSTALLED; } diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index 069273e8a1ac..935077c27f39 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -2073,7 +2073,6 @@ SfxPopupMenuManager* SfxDispatcher::Popup( sal_uInt16 nConfigId,Window *pWin, co SfxDispatcher &rDisp = *SFX_APP()->GetDispatcher_Impl(); sal_uInt16 nShLevel = 0; SfxShell *pSh; - nShLevel=0; if ( rDisp.pImp->bQuiet ) { @@ -2101,7 +2100,6 @@ void SfxDispatcher::ExecutePopup( sal_uInt16 nConfigId, Window *pWin, const Poin sal_uInt16 nShLevel = 0; SfxShell *pSh; - nShLevel=0; if ( rDisp.pImp->bQuiet ) { nConfigId = 0; diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index ee59b5eda131..99d7dbfa1366 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -2321,11 +2321,6 @@ CustomPropertiesControl::CustomPropertiesControl( Window* pParent, const ResId& m_aVertScroll.SetPageSize( nVisibleEntries - 1 ); m_aVertScroll.SetVisibleSize( nVisibleEntries ); - Point aPos = m_aHeaderBar.GetPosPixel(); - Size aSize = m_aHeaderBar.GetSizePixel(); - aPos = m_aVertScroll.GetPosPixel(); - aSize = m_aVertScroll.GetSizePixel(); - Link aScrollLink = LINK( this, CustomPropertiesControl, ScrollHdl ); m_aVertScroll.SetScrollHdl( aScrollLink ); } diff --git a/sfx2/source/dialog/securitypage.cxx b/sfx2/source/dialog/securitypage.cxx index ffa3a7aa50f6..b4de6af41e7a 100644 --- a/sfx2/source/dialog/securitypage.cxx +++ b/sfx2/source/dialog/securitypage.cxx @@ -200,11 +200,6 @@ SfxSecurityPage_Impl::SfxSecurityPage_Impl( SfxSecurityPage &rTabPage, const Sfx m_bEndRedliningWarningDone ( false ) { m_aChangeProtectionPB.SetText( m_aProtectSTR ); - // adjust button width if necessary - long nBtnTextWidth = 0; - long nTemp = m_aChangeProtectionPB.GetCtrlTextWidth( m_aChangeProtectionPB.GetText() ); - if (nTemp > nBtnTextWidth) - nBtnTextWidth = nTemp; // force toggle hdl called before visual change of checkbox m_aRecordChangesCB.SetStyle( m_aRecordChangesCB.GetStyle() | WB_EARLYTOGGLE ); -- cgit From 0c2206081de38a41597aadfb2255540d6308be63 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Sun, 11 Nov 2012 00:47:03 +0100 Subject: SfxMedium::GetOutputStream(): re-use existing XStream The ScExportTest::testConditionalFormatExportXLSX() fails on Windows because of how SfxMedium handles its streams: 1. SfxMedium::GetOutputStorage() creates some temp file 2. SfxMedium::GetMedium_Impl() opens a XStream on the temp file 3. SfxMedium::GetOutStream() wants to open a SvFileStream on the temp file, but because the file is already open and the sharing options are set to deny sharing, opening fails with ERROR_SHARING_VIOLATION Prevent that by re-using the already open XStream in GetOutStream. Hopefully this does not break anything, and there is already a comment in CloseInStream_Impl() indicating that m_pOutStream and xStream are related. (interestingly ERROR_SHARING_VIOLATION is documented to occur if _another_ process has the file open, but evidently it happens here on NT 6.1 for the same process...) Change-Id: I6d2ec36fd45a0317e947ddfb436472a8b86fbe26 --- sfx2/source/doc/docfile.cxx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'sfx2') diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 9be89f51114a..b1f3541c22d2 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -637,7 +637,20 @@ SvStream* SfxMedium::GetOutStream() if ( pImp->pTempFile ) { - pImp->m_pOutStream = new SvFileStream( pImp->m_aName, STREAM_STD_READWRITE ); + // try to re-use XOutStream from xStream if that exists; + // opening new SvFileStream in this situation may fail on + // Windows with ERROR_SHARING_VIOLATION + if (pImp->xStream.is()) + { + assert(pImp->xStream->getOutputStream().is()); // need that... + pImp->m_pOutStream = utl::UcbStreamHelper::CreateStream( + pImp->xStream, false); + } + else + { + pImp->m_pOutStream = new SvFileStream( + pImp->m_aName, STREAM_STD_READWRITE); + } CloseStorage(); } } -- cgit