diff options
Diffstat (limited to 'sd/source/ui/toolpanel')
-rwxr-xr-x[-rw-r--r--] | sd/source/ui/toolpanel/ControlContainer.cxx | 55 | ||||
-rwxr-xr-x | sd/source/ui/toolpanel/LayoutMenu.cxx | 4 | ||||
-rwxr-xr-x | sd/source/ui/toolpanel/ScrollPanel.cxx | 23 | ||||
-rwxr-xr-x | sd/source/ui/toolpanel/SubToolPanel.cxx | 29 | ||||
-rwxr-xr-x | sd/source/ui/toolpanel/TestPanel.cxx | 6 | ||||
-rwxr-xr-x | sd/source/ui/toolpanel/ToolPanelViewShell.cxx | 35 | ||||
-rwxr-xr-x | sd/source/ui/toolpanel/controls/DocumentHelper.cxx | 93 | ||||
-rwxr-xr-x[-rw-r--r--] | sd/source/ui/toolpanel/controls/MasterPageContainerQueue.cxx | 2 | ||||
-rwxr-xr-x | sd/source/ui/toolpanel/controls/MasterPagesPanel.cxx | 19 | ||||
-rwxr-xr-x | sd/source/ui/toolpanel/controls/MasterPagesSelector.cxx | 4 | ||||
-rwxr-xr-x | sd/source/ui/toolpanel/controls/MasterPagesSelector.hxx | 3 |
11 files changed, 103 insertions, 170 deletions
diff --git a/sd/source/ui/toolpanel/ControlContainer.cxx b/sd/source/ui/toolpanel/ControlContainer.cxx index cb8b6c41f5c3..78e4125b024d 100644..100755 --- a/sd/source/ui/toolpanel/ControlContainer.cxx +++ b/sd/source/ui/toolpanel/ControlContainer.cxx @@ -218,14 +218,6 @@ sal_uInt32 ControlContainer::GetControlIndex (TreeNode* pControlToExpand) const -sal_uInt32 ControlContainer::GetActiveControlIndex (void) const -{ - return mnActiveControlIndex; -} - - - - void ControlContainer::ListHasChanged (void) { } @@ -375,53 +367,6 @@ sal_uInt32 ControlContainer::GetNextIndex ( -sal_uInt32 ControlContainer::GetFirstIndex (bool bIncludeHidden) -{ - sal_uInt32 nIndex = 0; - - if (maControlList.size() == 0) - { - // The list is empty so there is no first element. - nIndex = maControlList.size(); - } - else if ( ! bIncludeHidden - && ! maControlList[nIndex]->GetWindow()->IsVisible()) - { - // The first element is not visible. Go the next visible one. - nIndex = GetNextIndex (nIndex, bIncludeHidden, false); - } - - return nIndex; -} - - - - -sal_uInt32 ControlContainer::GetLastIndex (bool bIncludeHidden) -{ - sal_uInt32 nIndex; - - if (maControlList.size() == 0) - { - // The list is empty so there is no last element. - nIndex = maControlList.size(); - } - else - { - nIndex = maControlList.size() - 1; - if ( ! bIncludeHidden - && ! maControlList[nIndex]->GetWindow()->IsVisible()) - { - // The last element is not visible. Go the previous visible one. - nIndex = GetPreviousIndex (nIndex, bIncludeHidden, false); - } - } - return nIndex; -} - - - - void ControlContainer::SetMultiSelection (bool bFlag) { mbMultiSelection = bFlag; diff --git a/sd/source/ui/toolpanel/LayoutMenu.cxx b/sd/source/ui/toolpanel/LayoutMenu.cxx index ec4eb1e43d4d..ef621db2a22d 100755 --- a/sd/source/ui/toolpanel/LayoutMenu.cxx +++ b/sd/source/ui/toolpanel/LayoutMenu.cxx @@ -221,7 +221,7 @@ void LayoutMenu::implConstruct( DrawDocShell& rDocumentShell ) | ::sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_NORMAL | ::sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_MASTER); - SetSmartHelpId(SmartId(HID_SD_TASK_PANE_PREVIEW_LAYOUTS)); + Window::SetHelpId(HID_SD_TASK_PANE_PREVIEW_LAYOUTS); SetAccessibleName(SdResId(STR_TASKPANEL_LAYOUT_MENU_TITLE)); Link aStateChangeLink (LINK(this,LayoutMenu,StateChangeHandler)); @@ -231,7 +231,7 @@ void LayoutMenu::implConstruct( DrawDocShell& rDocumentShell ) ::rtl::OUString::createFromAscii(".uno:VerticalTextState")); // Add this new object as shell to the shell factory. - GetShellManager()->AddSubShell(HID_SD_TASK_PANE_PREVIEW_LAYOUTS,this,this); + GetShellManager()->AddSubShell(SHELLID_SD_TASK_PANE_PREVIEW_LAYOUTS,this,this); } diff --git a/sd/source/ui/toolpanel/ScrollPanel.cxx b/sd/source/ui/toolpanel/ScrollPanel.cxx index 6b10ed889424..9c1c087c8ab1 100755 --- a/sd/source/ui/toolpanel/ScrollPanel.cxx +++ b/sd/source/ui/toolpanel/ScrollPanel.cxx @@ -41,25 +41,6 @@ namespace sd { namespace toolpanel { ScrollPanel::ScrollPanel ( - TreeNode* pParent) - : Control (pParent->GetWindow(), WB_DIALOGCONTROL), - TreeNode(pParent), - maScrollWindow(this, WB_DIALOGCONTROL), - maVerticalScrollBar(this, WB_VERT), - maHorizontalScrollBar(this, WB_HORZ), - maScrollBarFiller(this), - maScrollWindowFiller(&maScrollWindow), - mbIsRearrangePending(true), - mbIsLayoutPending(true), - mnChildrenWidth(0), - mnVerticalBorder(2), - mnVerticalGap(3), - mnHorizontalBorder(2) -{ - Construct(); -} - -ScrollPanel::ScrollPanel ( ::Window& i_rParentWindow) : Control (&i_rParentWindow, WB_DIALOGCONTROL), TreeNode(NULL), @@ -137,7 +118,7 @@ ScrollPanel::~ScrollPanel (void) TitledControl* ScrollPanel::AddControl ( ::std::auto_ptr<TreeNode> pControl, const String& rTitle, - ULONG nHelpId) + const rtl::OString& rHelpId) { // We are interested only in the title. The control itself is // managed by the content object. @@ -147,7 +128,7 @@ TitledControl* ScrollPanel::AddControl ( rTitle, TitledControlStandardClickHandler(GetControlContainer(), ControlContainer::ES_TOGGLE), TitleBar::TBT_SUB_CONTROL_HEADLINE); - pTitledControl->GetTitleBar()->SetHelpId(nHelpId); + pTitledControl->GetTitleBar()->SetHelpId(rHelpId); AddControl(::std::auto_ptr<TreeNode>(pTitledControl)); diff --git a/sd/source/ui/toolpanel/SubToolPanel.cxx b/sd/source/ui/toolpanel/SubToolPanel.cxx index 73783b0f0a41..4e85d8c9fec9 100755 --- a/sd/source/ui/toolpanel/SubToolPanel.cxx +++ b/sd/source/ui/toolpanel/SubToolPanel.cxx @@ -42,35 +42,6 @@ namespace sd { namespace toolpanel { SubToolPanel::SubToolPanel ( - TreeNode* pParent) - : Control (pParent->GetWindow(), WB_DIALOGCONTROL), - TreeNode(pParent), - maWindowFiller(this), - mbIsRearrangePending(true), - mbIsLayoutPending(true), - mnChildrenWidth(0), - mnVerticalBorder(0), - mnVerticalGap(3), - mnHorizontalBorder(2) -{ - SetAccessibleName ( - ::rtl::OUString::createFromAscii("Sub Task Panel")); - mpControlContainer->SetMultiSelection (true); - - SetBorderStyle (WINDOW_BORDER_NORMAL); - SetMapMode (MapMode(MAP_PIXEL)); - - // To reduce flickering during repaints make the container windows - // transparent and rely on their children to paint the whole area. - SetBackground(Wallpaper()); - maWindowFiller.SetBackground( - Application::GetSettings().GetStyleSettings().GetWindowColor()); -} - - - - -SubToolPanel::SubToolPanel ( Window& i_rParentWindow) : Control (&i_rParentWindow, WB_DIALOGCONTROL), TreeNode(NULL), diff --git a/sd/source/ui/toolpanel/TestPanel.cxx b/sd/source/ui/toolpanel/TestPanel.cxx index 044b40dcdb4f..8fb24dd83bc2 100755 --- a/sd/source/ui/toolpanel/TestPanel.cxx +++ b/sd/source/ui/toolpanel/TestPanel.cxx @@ -129,7 +129,7 @@ TestPanel::TestPanel (::Window& i_rParent) ::std::auto_ptr<TreeNode>(new Wrapper ( pScrollPanel, Size (200,300), pBox, true)), String::CreateFromAscii ("First ListBox"), - 0); + ""); pBox = new ListBox (pScrollPanel->GetWindow()); for (i=1; i<=20; i++) @@ -143,7 +143,7 @@ TestPanel::TestPanel (::Window& i_rParent) ::std::auto_ptr<TreeNode>(new Wrapper ( pScrollPanel, Size (200,300), pBox, true)), String::CreateFromAscii ("Second ListBox"), - 0); + ""); AddControl (::std::auto_ptr<TreeNode>(pScrollPanel)); @@ -153,7 +153,7 @@ TestPanel::TestPanel (::Window& i_rParent) ::std::auto_ptr<TreeNode>(new Wrapper ( this, Size (100,30), pButton, false)), String::CreateFromAscii ("Button Area"), - 0); + ""); } diff --git a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx index c62faf29ca50..fbbcebe7ab7f 100755 --- a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx +++ b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx @@ -512,12 +512,25 @@ ToolPanelViewShell::ToolPanelViewShell( SfxViewFrame* pFrame, ViewShellBase& rVi SetName( String( RTL_CONSTASCII_USTRINGPARAM( "ToolPanelViewShell" ) ) ); + // enforce the creation of the Accessible object here. + // In some not-always-to-reproduce situations, creating the accessible on demand only leads to some + // cycliy parenthood references between the involved objects, which make some AT tools (accerciser, in particular) + // loop (which is /not/ a bug in the tool, of course). + // However, since those situations were not reproducible anymore, we deliberately leave the Accessible creation + // (which originally was intended as a workaround) herein. Better to be safe ... + // Note that this is not a performance problem: The implementation of the ToolPanelDeck's Accessible + // is separated from the implementation of its AccessibleContext (which even is in a separate library) - we only + // create the former here, the latter is still created on demand, when somebody requests it. + // #i113671# / 2010-09-17 / frank.schoenheit@oracle.com + if (mpContentWindow.get()) + mpContentWindow->GetAccessible( TRUE ); + // For accessibility we have to shortly hide the content window. This // triggers the construction of a new accessibility object for the new // view shell. (One is created earlier while the construtor of the base // class is executed. At that time the correct accessibility object can // not be constructed.) - if ( mpContentWindow.get() ) + if (mpContentWindow.get()) { mpContentWindow->Hide(); mpContentWindow->Show(); @@ -599,18 +612,6 @@ SdPage* ToolPanelViewShell::getCurrentPage() const } // --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell::Execute( SfxRequest& ) -{ - OSL_ENSURE( false, "ToolPanelViewShell::Execute: not to be called! (right?)" ); -} - -// --------------------------------------------------------------------------------------------------------------------- -void ToolPanelViewShell::GetState( SfxItemSet& ) -{ - OSL_ENSURE( false, "ToolPanelViewShell::GetState: not to be called! (right?)" ); -} - -// --------------------------------------------------------------------------------------------------------------------- TaskPaneShellManager& ToolPanelViewShell::GetSubShellManager() const { return *mpSubShellManager.get(); @@ -680,10 +681,10 @@ namespace struct PanelFactory { ControlFactoryFactory pFactory; - ULONG nHelpID; - PanelFactory( const ControlFactoryFactory i_pFactory, const ULONG i_nHelpID ) + rtl::OString sHelpID; + PanelFactory( const ControlFactoryFactory i_pFactory, const rtl::OString& i_nHelpID ) :pFactory( i_pFactory ) - ,nHelpID( i_nHelpID ) + ,sHelpID( i_nHelpID ) { } }; @@ -721,7 +722,7 @@ Reference< XUIElement > ToolPanelViewShell::CreatePanelUIElement( const Referenc ::std::auto_ptr< TreeNode > pNode( pControlFactory->CreateControl( mpImpl->GetToolPanelDeck().GetPanelWindowAnchor() ) ); ENSURE_OR_THROW( ( pNode.get() != NULL ) && ( pNode->GetWindow() != NULL ), "illegal node returned by the control factory" ); - pNode->GetWindow()->SetHelpId( aPanelFactory.nHelpID ); + pNode->GetWindow()->SetHelpId( aPanelFactory.sHelpID ); // create an XToolPanel Reference< XToolPanel > xPanel( new ToolPanel( pNode ) ); diff --git a/sd/source/ui/toolpanel/controls/DocumentHelper.cxx b/sd/source/ui/toolpanel/controls/DocumentHelper.cxx index b9040e72283f..c5919b7aa7ee 100755 --- a/sd/source/ui/toolpanel/controls/DocumentHelper.cxx +++ b/sd/source/ui/toolpanel/controls/DocumentHelper.cxx @@ -503,45 +503,78 @@ SdPage* DocumentHelper::ProvideMasterPage ( SdPage* pMasterPage, const ::boost::shared_ptr<std::vector<SdPage*> >& rpPageList) { - SdPage* pMasterPageInDocument = NULL; - - // Get notes master page. + // Make sure that both the master page and its notes master exist + // in the source document. If one is missing then return without + // making any changes. + if (pMasterPage == NULL) + { + // The caller should make sure that the master page is valid. + OSL_ASSERT(pMasterPage != NULL); + return NULL; + } SdDrawDocument* pSourceDocument = static_cast<SdDrawDocument*>(pMasterPage->GetModel()); + if (pSourceDocument == NULL) + return NULL; SdPage* pNotesMasterPage = static_cast<SdPage*>( - pSourceDocument->GetMasterPage (pMasterPage->GetPageNum()+1)); - if (pNotesMasterPage != NULL) + pSourceDocument->GetMasterPage(pMasterPage->GetPageNum()+1)); + if (pNotesMasterPage == NULL) { - // When the given master page or its associated notes master page do - // not already belong to the document we have to create copies of - // them and insert them into the document. - - // Determine the position where the new master pages are inserted. - // By default they are inserted at the end. When we assign to a - // master page then insert after the last of the (selected) pages. - USHORT nInsertionIndex = rTargetDocument.GetMasterPageCount(); - if (rpPageList->front()->IsMasterPage()) + // The model is not in a valid state. Maybe a new master page + // is being (not finished yet) created? Return without making + // any changes. + return NULL; + } + + SdPage* pMasterPageInDocument = NULL; + // Search for a master page with the same name as the given one in + // the target document. + const XubString sMasterPageLayoutName (pMasterPage->GetLayoutName()); + for (USHORT nIndex=0,nCount=rTargetDocument.GetMasterPageCount(); nIndex<nCount; ++nIndex) + { + SdPage* pCandidate = static_cast<SdPage*>(rTargetDocument.GetMasterPage(nIndex)); + if (pCandidate!=NULL + && sMasterPageLayoutName==pCandidate->GetLayoutName()) { - nInsertionIndex = rpPageList->back()->GetPageNum(); + // The requested master page does already exist in the + // target document, return it. + return pCandidate; } + } - if (pMasterPage->GetModel() != &rTargetDocument) - { - pMasterPageInDocument = AddMasterPage (rTargetDocument, pMasterPage, nInsertionIndex); - if( rTargetDocument.IsUndoEnabled() ) + // The given master page does not already belong to the target + // document so we have to create copies and insert them into the + // targer document. + + // Determine the position where the new master pages are inserted. + // By default they are inserted at the end. When we assign to a + // master page then insert after the last of the (selected) pages. + USHORT nInsertionIndex = rTargetDocument.GetMasterPageCount(); + if (rpPageList->front()->IsMasterPage()) + { + nInsertionIndex = rpPageList->back()->GetPageNum(); + } + + // Clone the master page. + if (pMasterPage->GetModel() != &rTargetDocument) + { + pMasterPageInDocument = AddMasterPage (rTargetDocument, pMasterPage, nInsertionIndex); + if( rTargetDocument.IsUndoEnabled() ) rTargetDocument.AddUndo( rTargetDocument.GetSdrUndoFactory().CreateUndoNewPage(*pMasterPageInDocument)); - } - else - pMasterPageInDocument = pMasterPage; - if (pNotesMasterPage->GetModel() != &rTargetDocument) - { - SdPage* pClonedNotesMasterPage - = AddMasterPage (rTargetDocument, pNotesMasterPage, nInsertionIndex+1); - if( rTargetDocument.IsUndoEnabled() ) - rTargetDocument.AddUndo( - rTargetDocument.GetSdrUndoFactory().CreateUndoNewPage(*pClonedNotesMasterPage)); - } } + else + pMasterPageInDocument = pMasterPage; + + // Clone the notes master. + if (pNotesMasterPage->GetModel() != &rTargetDocument) + { + SdPage* pClonedNotesMasterPage + = AddMasterPage (rTargetDocument, pNotesMasterPage, nInsertionIndex+1); + if( rTargetDocument.IsUndoEnabled() ) + rTargetDocument.AddUndo( + rTargetDocument.GetSdrUndoFactory().CreateUndoNewPage(*pClonedNotesMasterPage)); + } + return pMasterPageInDocument; } diff --git a/sd/source/ui/toolpanel/controls/MasterPageContainerQueue.cxx b/sd/source/ui/toolpanel/controls/MasterPageContainerQueue.cxx index 35b02497575e..94940d19ebd1 100644..100755 --- a/sd/source/ui/toolpanel/controls/MasterPageContainerQueue.cxx +++ b/sd/source/ui/toolpanel/controls/MasterPageContainerQueue.cxx @@ -153,7 +153,7 @@ bool MasterPageContainerQueue::RequestPreview (const SharedMasterPageDescriptor& PreviewCreationRequest::CompareToken(rpDescriptor->maToken))); // When a request for the same token exists then the lowest of the // two priorities is used. - if (HasRequest(rpDescriptor->maToken)) + if (iRequest != mpRequestQueue->end()) if (iRequest->mnPriority < nPriority) { mpRequestQueue->erase(iRequest); diff --git a/sd/source/ui/toolpanel/controls/MasterPagesPanel.cxx b/sd/source/ui/toolpanel/controls/MasterPagesPanel.cxx index 8dab51e93a58..d7c96252136c 100755 --- a/sd/source/ui/toolpanel/controls/MasterPagesPanel.cxx +++ b/sd/source/ui/toolpanel/controls/MasterPagesPanel.cxx @@ -45,6 +45,7 @@ #include "sdresid.hxx" #include "helpids.h" #include <svtools/valueset.hxx> +#include "app.hrc" namespace sd { namespace toolpanel { namespace controls { @@ -73,9 +74,9 @@ void MasterPagesPanel::impl_construct( ViewShellBase& rBase ) rBase, pContainer)); pSelector->LateInit(); - pSelector->SetSmartHelpId( SmartId(HID_SD_TASK_PANE_PREVIEW_CURRENT) ); + pSelector->SetHelpId( HID_SD_TASK_PANE_PREVIEW_CURRENT ); GetShellManager()->AddSubShell( - HID_SD_TASK_PANE_PREVIEW_CURRENT, + SHELLID_SD_TASK_PANE_PREVIEW_CURRENT, pSelector.get(), pSelector->GetWindow()); pTitledControl = AddControl ( @@ -90,9 +91,9 @@ void MasterPagesPanel::impl_construct( ViewShellBase& rBase ) rBase, pContainer)); pSelector->LateInit(); - pSelector->SetSmartHelpId( SmartId(HID_SD_TASK_PANE_PREVIEW_RECENT) ); + pSelector->SetHelpId( HID_SD_TASK_PANE_PREVIEW_RECENT ); GetShellManager()->AddSubShell( - HID_SD_TASK_PANE_PREVIEW_RECENT, + SHELLID_SD_TASK_PANE_PREVIEW_RECENT, pSelector.get(), pSelector->GetWindow()); pTitledControl = AddControl ( @@ -108,9 +109,9 @@ void MasterPagesPanel::impl_construct( ViewShellBase& rBase ) *pDrawViewShell, pContainer)); pSelector->LateInit(); - pSelector->SetSmartHelpId( SmartId(HID_SD_TASK_PANE_PREVIEW_ALL) ); + pSelector->SetHelpId( HID_SD_TASK_PANE_PREVIEW_ALL ); GetShellManager()->AddSubShell( - HID_SD_TASK_PANE_PREVIEW_ALL, + SHELLID_SD_TASK_PANE_PREVIEW_ALL, pSelector.get(), pSelector->GetWindow()); pTitledControl = AddControl ( @@ -129,9 +130,9 @@ MasterPagesPanel::~MasterPagesPanel (void) OSL_ENSURE( pShellManager, "MasterPagesPanel::~MasterPagesPanel: no shell manager anymore - cannot remove sub shells!" ); if ( pShellManager ) { - pShellManager->RemoveSubShell( HID_SD_TASK_PANE_PREVIEW_CURRENT ); - pShellManager->RemoveSubShell( HID_SD_TASK_PANE_PREVIEW_RECENT ); - pShellManager->RemoveSubShell( HID_SD_TASK_PANE_PREVIEW_ALL ); + pShellManager->RemoveSubShell( SHELLID_SD_TASK_PANE_PREVIEW_CURRENT ); + pShellManager->RemoveSubShell( SHELLID_SD_TASK_PANE_PREVIEW_RECENT ); + pShellManager->RemoveSubShell( SHELLID_SD_TASK_PANE_PREVIEW_ALL ); } } diff --git a/sd/source/ui/toolpanel/controls/MasterPagesSelector.cxx b/sd/source/ui/toolpanel/controls/MasterPagesSelector.cxx index b321dbf8dd14..6c59f5fa2b51 100755 --- a/sd/source/ui/toolpanel/controls/MasterPagesSelector.cxx +++ b/sd/source/ui/toolpanel/controls/MasterPagesSelector.cxx @@ -757,11 +757,11 @@ void MasterPagesSelector::ClearPageSet (void) -void MasterPagesSelector::SetSmartHelpId( const SmartId& aId, SmartIdUpdateMode aMode ) +void MasterPagesSelector::SetHelpId( const rtl::OString& aId ) { const ::osl::MutexGuard aGuard (maMutex); - mpPageSet->SetSmartHelpId( aId, aMode ); + mpPageSet->SetHelpId( aId ); } diff --git a/sd/source/ui/toolpanel/controls/MasterPagesSelector.hxx b/sd/source/ui/toolpanel/controls/MasterPagesSelector.hxx index a2df51f2bd4b..bc3c87f7a6c9 100755 --- a/sd/source/ui/toolpanel/controls/MasterPagesSelector.hxx +++ b/sd/source/ui/toolpanel/controls/MasterPagesSelector.hxx @@ -121,7 +121,8 @@ public: */ void ClearPageSet (void); - void SetSmartHelpId( const SmartId& aId, SmartIdUpdateMode aMode = SMART_SET_SMART ); + using SfxShell::SetHelpId; + void SetHelpId( const rtl::OString& aId ); /** Mark the preview that belongs to the given index as not up-to-date anymore with respect to page content or preview size. |