[Libreoffice-commits] .: sd/source
David Tardon
dtardon at kemper.freedesktop.org
Tue Oct 19 00:41:56 PDT 2010
sd/source/ui/slidesorter/cache/SlsCacheConfiguration.cxx | 86 ++++----
sd/source/ui/slidesorter/controller/SlideSorterController.cxx | 66 +++---
sd/source/ui/unoidl/SdUnoDrawView.cxx | 28 +-
sd/source/ui/view/FormShellManager.cxx | 96 ++++------
sd/source/ui/view/ViewClipboard.cxx | 92 ++++-----
sd/source/ui/view/ViewShellManager.cxx | 94 ++++-----
6 files changed, 215 insertions(+), 247 deletions(-)
New commits:
commit 66617f31330a7aec7bd8828a735f9c63bf38b5e4
Author: David Tardon <dtardon at redhat.com>
Date: Tue Oct 19 09:41:43 2010 +0200
remove do {...} while (false) spanning whole func.
diff --git a/sd/source/ui/slidesorter/cache/SlsCacheConfiguration.cxx b/sd/source/ui/slidesorter/cache/SlsCacheConfiguration.cxx
index edce4b0..9f85869 100644
--- a/sd/source/ui/slidesorter/cache/SlsCacheConfiguration.cxx
+++ b/sd/source/ui/slidesorter/cache/SlsCacheConfiguration.cxx
@@ -86,53 +86,49 @@ CacheConfiguration::CacheConfiguration (void)
const ::rtl::OUString sPathToNode(
RTL_CONSTASCII_USTRINGPARAM(
"MultiPaneGUI/SlideSorter/PreviewCache"));
-
+
try
{
- do
- {
- // Obtain access to the configuration.
- Reference<lang::XMultiServiceFactory> xProvider (
- ::comphelper::getProcessServiceFactory()->createInstance(
- sConfigurationProviderServiceName),
- UNO_QUERY);
- if ( ! xProvider.is())
- break;
-
- // Obtain access to Impress configuration.
- Sequence<Any> aCreationArguments(3);
- aCreationArguments[0] = makeAny(beans::PropertyValue(
- ::rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("nodepath")),
- 0,
- makeAny(sPathToImpressConfigurationRoot),
- beans::PropertyState_DIRECT_VALUE));
- aCreationArguments[1] = makeAny(beans::PropertyValue(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("depth")),
- 0,
- makeAny((sal_Int32)-1),
- beans::PropertyState_DIRECT_VALUE));
- aCreationArguments[2] = makeAny(beans::PropertyValue(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("lazywrite")),
- 0,
- makeAny(true),
- beans::PropertyState_DIRECT_VALUE));
- ::rtl::OUString sAccessService (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationAccess")));
- Reference<XInterface> xRoot (xProvider->createInstanceWithArguments(
- sAccessService, aCreationArguments));
- if ( ! xRoot.is())
- break;
- Reference<container::XHierarchicalNameAccess> xHierarchy (xRoot, UNO_QUERY);
- if ( ! xHierarchy.is())
- break;
-
- // Get the node for the slide sorter preview cache.
- mxCacheNode = Reference<container::XNameAccess>(
- xHierarchy->getByHierarchicalName(sPathToNode),
- UNO_QUERY);
- }
- while (false);
+ // Obtain access to the configuration.
+ Reference<lang::XMultiServiceFactory> xProvider (
+ ::comphelper::getProcessServiceFactory()->createInstance(
+ sConfigurationProviderServiceName),
+ UNO_QUERY);
+ if ( ! xProvider.is())
+ return;
+
+ // Obtain access to Impress configuration.
+ Sequence<Any> aCreationArguments(3);
+ aCreationArguments[0] = makeAny(beans::PropertyValue(
+ ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("nodepath")),
+ 0,
+ makeAny(sPathToImpressConfigurationRoot),
+ beans::PropertyState_DIRECT_VALUE));
+ aCreationArguments[1] = makeAny(beans::PropertyValue(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("depth")),
+ 0,
+ makeAny((sal_Int32)-1),
+ beans::PropertyState_DIRECT_VALUE));
+ aCreationArguments[2] = makeAny(beans::PropertyValue(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("lazywrite")),
+ 0,
+ makeAny(true),
+ beans::PropertyState_DIRECT_VALUE));
+ ::rtl::OUString sAccessService (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.configuration.ConfigurationAccess")));
+ Reference<XInterface> xRoot (xProvider->createInstanceWithArguments(
+ sAccessService, aCreationArguments));
+ if ( ! xRoot.is())
+ return;
+ Reference<container::XHierarchicalNameAccess> xHierarchy (xRoot, UNO_QUERY);
+ if ( ! xHierarchy.is())
+ return;
+
+ // Get the node for the slide sorter preview cache.
+ mxCacheNode = Reference<container::XNameAccess>(
+ xHierarchy->getByHierarchicalName(sPathToNode),
+ UNO_QUERY);
}
catch (RuntimeException aException)
{
diff --git a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
index bb5cd4b..4dc8258 100644
--- a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
+++ b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
@@ -886,45 +886,41 @@ void SlideSorterController::PageNameHasChanged (int nPageIndex, const String& rs
// Get a pointer to the corresponding accessible object and notify
// that of the name change.
- do
- {
- ::sd::Window* pWindow = mrSlideSorter.GetActiveWindow();
- if (pWindow == NULL)
- break;
+ ::sd::Window* pWindow = mrSlideSorter.GetActiveWindow();
+ if (pWindow == NULL)
+ return;
- ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
- xAccessible (pWindow->GetAccessible(FALSE));
- if ( ! xAccessible.is())
- break;
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ xAccessible (pWindow->GetAccessible(FALSE));
+ if ( ! xAccessible.is())
+ return;
- // Now comes a small hack. We assume that the accessible object is
- // an instantiation of AccessibleSlideSorterView and cast it to that
- // class. The cleaner alternative to this cast would be a new member
- // in which we would store the last AccessibleSlideSorterView object
- // created by SlideSorterViewShell::CreateAccessibleDocumentView().
- // But then there is no guaranty that the accessible object obtained
- // from the window really is that instance last created by
- // CreateAccessibleDocumentView().
- // However, the dynamic cast together with the check of the result
- // being NULL should be safe enough.
- ::accessibility::AccessibleSlideSorterView* pAccessibleView
- = dynamic_cast< ::accessibility::AccessibleSlideSorterView*>(xAccessible.get());
- if (pAccessibleView == NULL)
- break;
+ // Now comes a small hack. We assume that the accessible object is
+ // an instantiation of AccessibleSlideSorterView and cast it to that
+ // class. The cleaner alternative to this cast would be a new member
+ // in which we would store the last AccessibleSlideSorterView object
+ // created by SlideSorterViewShell::CreateAccessibleDocumentView().
+ // But then there is no guaranty that the accessible object obtained
+ // from the window really is that instance last created by
+ // CreateAccessibleDocumentView().
+ // However, the dynamic cast together with the check of the result
+ // being NULL should be safe enough.
+ ::accessibility::AccessibleSlideSorterView* pAccessibleView
+ = dynamic_cast< ::accessibility::AccessibleSlideSorterView*>(xAccessible.get());
+ if (pAccessibleView == NULL)
+ return;
- ::accessibility::AccessibleSlideSorterObject* pChild
- = pAccessibleView->GetAccessibleChildImplementation(nPageIndex);
- if (pChild == NULL || pChild->GetPage() == NULL)
- break;
+ ::accessibility::AccessibleSlideSorterObject* pChild
+ = pAccessibleView->GetAccessibleChildImplementation(nPageIndex);
+ if (pChild == NULL || pChild->GetPage() == NULL)
+ return;
- ::rtl::OUString sOldName (rsOldName);
- ::rtl::OUString sNewName (pChild->GetPage()->GetName());
- pChild->FireAccessibleEvent(
- ::com::sun::star::accessibility::AccessibleEventId::NAME_CHANGED,
- makeAny(sOldName),
- makeAny(sNewName));
- }
- while (false);
+ ::rtl::OUString sOldName (rsOldName);
+ ::rtl::OUString sNewName (pChild->GetPage()->GetName());
+ pChild->FireAccessibleEvent(
+ ::com::sun::star::accessibility::AccessibleEventId::NAME_CHANGED,
+ makeAny(sOldName),
+ makeAny(sNewName));
}
diff --git a/sd/source/ui/unoidl/SdUnoDrawView.cxx b/sd/source/ui/unoidl/SdUnoDrawView.cxx
index f5302c0..c9552c4 100644
--- a/sd/source/ui/unoidl/SdUnoDrawView.cxx
+++ b/sd/source/ui/unoidl/SdUnoDrawView.cxx
@@ -165,25 +165,21 @@ Reference<drawing::XLayer> SdUnoDrawView::getActiveLayer (void) throw ()
void SdUnoDrawView::setActiveLayer (const Reference<drawing::XLayer>& rxLayer) throw ()
{
- do
- {
- // Get the SdrLayer object corresponding to the given reference.
- if ( ! rxLayer.is())
- break;
+ // Get the SdrLayer object corresponding to the given reference.
+ if ( ! rxLayer.is())
+ return;
- SdLayer* pLayer = SdLayer::getImplementation (rxLayer);
- if (pLayer == NULL)
- break;
+ SdLayer* pLayer = SdLayer::getImplementation (rxLayer);
+ if (pLayer == NULL)
+ return;
- SdrLayer* pSdrLayer = pLayer->GetSdrLayer();
- if (pSdrLayer == NULL)
- break;
+ SdrLayer* pSdrLayer = pLayer->GetSdrLayer();
+ if (pSdrLayer == NULL)
+ return;
- // Set the new active layer and make the change visible.
- mrView.SetActiveLayer (pSdrLayer->GetName());
- mrDrawViewShell.ResetActualLayer ();
- }
- while (false);
+ // Set the new active layer and make the change visible.
+ mrView.SetActiveLayer (pSdrLayer->GetName());
+ mrDrawViewShell.ResetActualLayer ();
}
diff --git a/sd/source/ui/view/FormShellManager.cxx b/sd/source/ui/view/FormShellManager.cxx
index f62f2b6..2bd3d95 100644
--- a/sd/source/ui/view/FormShellManager.cxx
+++ b/sd/source/ui/view/FormShellManager.cxx
@@ -158,70 +158,62 @@ FmFormShell* FormShellManager::GetFormShell (void)
void FormShellManager::RegisterAtCenterPane (void)
{
- do
- {
- ViewShell* pShell = mrBase.GetMainViewShell().get();
- if (pShell == NULL)
- break;
+ ViewShell* pShell = mrBase.GetMainViewShell().get();
+ if (pShell == NULL)
+ return;
+
+ // No form shell for the slide sorter. Besides that it is not
+ // necessary, using both together results in crashes.
+ if (pShell->GetShellType() == ViewShell::ST_SLIDE_SORTER)
+ return;
+
+ mpMainViewShellWindow = pShell->GetActiveWindow();
+ if (mpMainViewShellWindow == NULL)
+ return;
+
+ // Register at the window to get informed when to move the form
+ // shell to the bottom of the shell stack.
+ mpMainViewShellWindow->AddEventListener(
+ LINK(
+ this,
+ FormShellManager,
+ WindowEventHandler));
+
+ // Create a shell factory and with it activate the form shell.
+ OSL_ASSERT(mpSubShellFactory.get()==NULL);
+ mpSubShellFactory.reset(new FormShellManagerFactory(*pShell, *this));
+ mrBase.GetViewShellManager()->AddSubShellFactory(pShell,mpSubShellFactory);
+ mrBase.GetViewShellManager()->ActivateSubShell(*pShell, RID_FORMLAYER_TOOLBOX);
+}
+
- // No form shell for the slide sorter. Besides that it is not
- // necessary, using both together results in crashes.
- if (pShell->GetShellType() == ViewShell::ST_SLIDE_SORTER)
- break;
- mpMainViewShellWindow = pShell->GetActiveWindow();
- if (mpMainViewShellWindow == NULL)
- break;
- // Register at the window to get informed when to move the form
- // shell to the bottom of the shell stack.
- mpMainViewShellWindow->AddEventListener(
+void FormShellManager::UnregisterAtCenterPane (void)
+{
+ if (mpMainViewShellWindow != NULL)
+ {
+ // Unregister from the window.
+ mpMainViewShellWindow->RemoveEventListener(
LINK(
this,
FormShellManager,
WindowEventHandler));
-
- // Create a shell factory and with it activate the form shell.
- OSL_ASSERT(mpSubShellFactory.get()==NULL);
- mpSubShellFactory.reset(new FormShellManagerFactory(*pShell, *this));
- mrBase.GetViewShellManager()->AddSubShellFactory(pShell,mpSubShellFactory);
- mrBase.GetViewShellManager()->ActivateSubShell(*pShell, RID_FORMLAYER_TOOLBOX);
+ mpMainViewShellWindow = NULL;
}
- while (false);
-}
-
-
+ // Unregister form at the form shell.
+ SetFormShell(NULL);
-void FormShellManager::UnregisterAtCenterPane (void)
-{
- do
+ // Deactivate the form shell and destroy the shell factory.
+ ViewShell* pShell = mrBase.GetMainViewShell().get();
+ if (pShell != NULL)
{
- if (mpMainViewShellWindow != NULL)
- {
- // Unregister from the window.
- mpMainViewShellWindow->RemoveEventListener(
- LINK(
- this,
- FormShellManager,
- WindowEventHandler));
- mpMainViewShellWindow = NULL;
- }
-
- // Unregister form at the form shell.
- SetFormShell(NULL);
-
- // Deactivate the form shell and destroy the shell factory.
- ViewShell* pShell = mrBase.GetMainViewShell().get();
- if (pShell != NULL)
- {
- mrBase.GetViewShellManager()->DeactivateSubShell(*pShell, RID_FORMLAYER_TOOLBOX);
- mrBase.GetViewShellManager()->RemoveSubShellFactory(pShell, mpSubShellFactory);
- }
-
- mpSubShellFactory.reset();
+ mrBase.GetViewShellManager()->DeactivateSubShell(*pShell, RID_FORMLAYER_TOOLBOX);
+ mrBase.GetViewShellManager()->RemoveSubShellFactory(pShell, mpSubShellFactory);
}
- while (false);
+
+ mpSubShellFactory.reset();
}
diff --git a/sd/source/ui/view/ViewClipboard.cxx b/sd/source/ui/view/ViewClipboard.cxx
index 475a156..3cc0e13 100644
--- a/sd/source/ui/view/ViewClipboard.cxx
+++ b/sd/source/ui/view/ViewClipboard.cxx
@@ -140,54 +140,50 @@ void ViewClipboard::AssignMasterPage (
const SdTransferable& rTransferable,
SdPage* pMasterPage)
{
- do
- {
- if (pMasterPage == NULL)
- return;
-
- // Get the target page to which the master page is assigned.
- SdrPageView* pPageView = mrView.GetSdrPageView();
- if (pPageView == NULL)
- break;
-
- SdPage* pPage = static_cast<SdPage*>(pPageView->GetPage());
- if (pPage == NULL)
- break;
-
- SdDrawDocument* pDocument = mrView.GetDoc();
- if (pDocument == NULL)
- break;
-
- if ( ! rTransferable.HasPageBookmarks())
- break;
-
- DrawDocShell* pDataDocShell = rTransferable.GetPageDocShell();
- if (pDataDocShell == NULL)
- break;
-
- SdDrawDocument* pSourceDocument = pDataDocShell->GetDoc();
- if (pSourceDocument == NULL)
- break;
-
- // We have to remove the layout suffix from the layout name which is
- // appended again by SetMasterPage() to the given name. Don't ask.
- String sLayoutSuffix (RTL_CONSTASCII_STRINGPARAM(SD_LT_SEPARATOR));
- sLayoutSuffix.Append (SdResId(STR_LAYOUT_OUTLINE));
- USHORT nLength = sLayoutSuffix.Len();
- String sLayoutName (pMasterPage->GetLayoutName());
- if (String(sLayoutName, sLayoutName.Len()-nLength, nLength).Equals (
- sLayoutSuffix))
- sLayoutName = String(sLayoutName, 0, sLayoutName.Len()-nLength);
-
- pDocument->SetMasterPage (
- pPage->GetPageNum() / 2,
- sLayoutName,
- pSourceDocument,
- FALSE, // Exchange the master page of only the target page.
- FALSE // Keep unused master pages.
- );
- }
- while (false);
+ if (pMasterPage == NULL)
+ return;
+
+ // Get the target page to which the master page is assigned.
+ SdrPageView* pPageView = mrView.GetSdrPageView();
+ if (pPageView == NULL)
+ return;
+
+ SdPage* pPage = static_cast<SdPage*>(pPageView->GetPage());
+ if (pPage == NULL)
+ return;
+
+ SdDrawDocument* pDocument = mrView.GetDoc();
+ if (pDocument == NULL)
+ return;
+
+ if ( ! rTransferable.HasPageBookmarks())
+ return;
+
+ DrawDocShell* pDataDocShell = rTransferable.GetPageDocShell();
+ if (pDataDocShell == NULL)
+ return;
+
+ SdDrawDocument* pSourceDocument = pDataDocShell->GetDoc();
+ if (pSourceDocument == NULL)
+ return;
+
+ // We have to remove the layout suffix from the layout name which is
+ // appended again by SetMasterPage() to the given name. Don't ask.
+ String sLayoutSuffix (RTL_CONSTASCII_STRINGPARAM(SD_LT_SEPARATOR));
+ sLayoutSuffix.Append (SdResId(STR_LAYOUT_OUTLINE));
+ USHORT nLength = sLayoutSuffix.Len();
+ String sLayoutName (pMasterPage->GetLayoutName());
+ if (String(sLayoutName, sLayoutName.Len()-nLength, nLength).Equals (
+ sLayoutSuffix))
+ sLayoutName = String(sLayoutName, 0, sLayoutName.Len()-nLength);
+
+ pDocument->SetMasterPage (
+ pPage->GetPageNum() / 2,
+ sLayoutName,
+ pSourceDocument,
+ FALSE, // Exchange the master page of only the target page.
+ FALSE // Keep unused master pages.
+ );
}
diff --git a/sd/source/ui/view/ViewShellManager.cxx b/sd/source/ui/view/ViewShellManager.cxx
index 66a4943..397a825 100644
--- a/sd/source/ui/view/ViewShellManager.cxx
+++ b/sd/source/ui/view/ViewShellManager.cxx
@@ -651,34 +651,30 @@ void ViewShellManager::Implementation::ActivateSubShell (
{
::osl::MutexGuard aGuard (maMutex);
- do
- {
- // Check that the given view shell is active.
- ActiveShellList::iterator iShell (::std::find_if (
- maActiveViewShells.begin(),
- maActiveViewShells.end(),
- IsShell(&rParentShell)));
- if (iShell == maActiveViewShells.end())
- break;
+ // Check that the given view shell is active.
+ ActiveShellList::iterator iShell (::std::find_if (
+ maActiveViewShells.begin(),
+ maActiveViewShells.end(),
+ IsShell(&rParentShell)));
+ if (iShell == maActiveViewShells.end())
+ return;
- // Create the sub shell list if it does not yet exist.
- SubShellList::iterator iList (maActiveSubShells.find(&rParentShell));
- if (iList == maActiveSubShells.end())
- iList = maActiveSubShells.insert(
- SubShellList::value_type(&rParentShell,SubShellSubList())).first;
-
- // Do not activate an object bar that is already active. Requesting
- // this is not exactly an error but may be an indication of one.
- SubShellSubList& rList (iList->second);
- if (::std::find_if(rList.begin(),rList.end(), IsId(nId)) != rList.end())
- break;
+ // Create the sub shell list if it does not yet exist.
+ SubShellList::iterator iList (maActiveSubShells.find(&rParentShell));
+ if (iList == maActiveSubShells.end())
+ iList = maActiveSubShells.insert(
+ SubShellList::value_type(&rParentShell,SubShellSubList())).first;
+
+ // Do not activate an object bar that is already active. Requesting
+ // this is not exactly an error but may be an indication of one.
+ SubShellSubList& rList (iList->second);
+ if (::std::find_if(rList.begin(),rList.end(), IsId(nId)) != rList.end())
+ return;
- // Add just the id of the sub shell. The actual shell is created
- // later in CreateShells().
- UpdateLock aLock (*this);
- rList.push_back(ShellDescriptor(NULL, nId));
- }
- while (false);
+ // Add just the id of the sub shell. The actual shell is created
+ // later in CreateShells().
+ UpdateLock aLock (*this);
+ rList.push_back(ShellDescriptor(NULL, nId));
}
@@ -690,34 +686,30 @@ void ViewShellManager::Implementation::DeactivateSubShell (
{
::osl::MutexGuard aGuard (maMutex);
- do
- {
- // Check that the given view shell is active.
- SubShellList::iterator iList (maActiveSubShells.find(&rParentShell));
- if (iList == maActiveSubShells.end())
- break;
+ // Check that the given view shell is active.
+ SubShellList::iterator iList (maActiveSubShells.find(&rParentShell));
+ if (iList == maActiveSubShells.end())
+ return;
- // Look up the sub shell.
- SubShellSubList& rList (iList->second);
- SubShellSubList::iterator iShell (
- ::std::find_if(rList.begin(),rList.end(), IsId(nId)));
- if (iShell == rList.end())
- break;
- SfxShell* pShell = iShell->mpShell;
- if (pShell == NULL)
- break;
-
- UpdateLock aLock (*this);
+ // Look up the sub shell.
+ SubShellSubList& rList (iList->second);
+ SubShellSubList::iterator iShell (
+ ::std::find_if(rList.begin(),rList.end(), IsId(nId)));
+ if (iShell == rList.end())
+ return;
+ SfxShell* pShell = iShell->mpShell;
+ if (pShell == NULL)
+ return;
- ShellDescriptor aDescriptor(*iShell);
- // Remove the sub shell from both the internal structure as well as the
- // SFX shell stack above and including the sub shell.
- rList.erase(iShell);
- TakeShellsFromStack(pShell);
+ UpdateLock aLock (*this);
- DestroySubShell(rParentShell, aDescriptor);
- }
- while (false);
+ ShellDescriptor aDescriptor(*iShell);
+ // Remove the sub shell from both the internal structure as well as the
+ // SFX shell stack above and including the sub shell.
+ rList.erase(iShell);
+ TakeShellsFromStack(pShell);
+
+ DestroySubShell(rParentShell, aDescriptor);
}
More information about the Libreoffice-commits
mailing list