This is an automated email from the ASF dual-hosted git repository.

mseidel pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit ef3bfc8d89ed493f4c272b0ab80307b7ef857f60
Author: mseidel <[email protected]>
AuthorDate: Sat May 10 22:52:24 2025 +0200

    Add logic for disabling entry in popup menu.
    
    This fixes Bugziolla issue #128547
---
 .../ui/sidebar/RecentMasterPagesSelector.cxx       | 34 ++++++++++------------
 1 file changed, 15 insertions(+), 19 deletions(-)

diff --git a/main/sd/source/ui/sidebar/RecentMasterPagesSelector.cxx 
b/main/sd/source/ui/sidebar/RecentMasterPagesSelector.cxx
index 2a37ef24ff..8acf1e8283 100644
--- a/main/sd/source/ui/sidebar/RecentMasterPagesSelector.cxx
+++ b/main/sd/source/ui/sidebar/RecentMasterPagesSelector.cxx
@@ -1,5 +1,5 @@
 /**************************************************************
- * 
+ *
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -7,16 +7,16 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
- * 
+ *
  *************************************************************/
 
 #include "precompiled_sd.hxx"
@@ -38,7 +38,6 @@
 
 namespace sd { namespace sidebar {
 
-
 MasterPagesSelector* RecentMasterPagesSelector::Create (
     ::Window* pParent,
     ViewShellBase& rViewShellBase,
@@ -49,10 +48,10 @@ MasterPagesSelector* RecentMasterPagesSelector::Create (
         return NULL;
 
     ::boost::shared_ptr<MasterPageContainer> pContainer (new 
MasterPageContainer());
-    
+
     MasterPagesSelector* pSelector(
         new RecentMasterPagesSelector (
-            pParent, 
+            pParent,
             *pDocument,
             rViewShellBase,
             pContainer,
@@ -65,7 +64,6 @@ MasterPagesSelector* RecentMasterPagesSelector::Create (
 
 
 
-
 RecentMasterPagesSelector::RecentMasterPagesSelector (
     ::Window* pParent,
     SdDrawDocument& rDocument,
@@ -78,7 +76,6 @@ RecentMasterPagesSelector::RecentMasterPagesSelector (
 
 
 
-
 RecentMasterPagesSelector::~RecentMasterPagesSelector (void)
 {
     RecentlyUsedMasterPages::Instance().RemoveEventListener (
@@ -87,7 +84,6 @@ RecentMasterPagesSelector::~RecentMasterPagesSelector (void)
 
 
 
-
 void RecentMasterPagesSelector::LateInit (void)
 {
     MasterPagesSelector::LateInit();
@@ -99,7 +95,6 @@ void RecentMasterPagesSelector::LateInit (void)
 
 
 
-
 IMPL_LINK(RecentMasterPagesSelector,MasterPageListListener, void*, EMPTYARG)
 {
     MasterPagesSelector::Fill();
@@ -108,7 +103,6 @@ IMPL_LINK(RecentMasterPagesSelector,MasterPageListListener, 
void*, EMPTYARG)
 
 
 
-
 void RecentMasterPagesSelector::Fill (ItemList& rItemList)
 {
     // Create a set of names of the master pages used by the document.
@@ -136,7 +130,7 @@ void RecentMasterPagesSelector::Fill (ItemList& rItemList)
         if (aToken != MasterPageContainer::NIL_TOKEN)
         {
             String sStyleName (mpContainer->GetStyleNameForToken(aToken));
-            if (sStyleName.Len()==0 
+            if (sStyleName.Len()==0
                 || aCurrentNames.find(sStyleName) == aCurrentNames.end())
             {
                 rItemList.push_back(aToken);
@@ -147,13 +141,12 @@ void RecentMasterPagesSelector::Fill (ItemList& rItemList)
 
 
 
-
 void RecentMasterPagesSelector::AssignMasterPageToPageList (
     SdPage* pMasterPage,
     const ::boost::shared_ptr<std::vector<SdPage*> >& rpPageList)
 {
        sal_uInt16 nSelectedItemId = PreviewValueSet::GetSelectItemId();
-    
+
     MasterPagesSelector::AssignMasterPageToPageList(pMasterPage, rpPageList);
 
     // Restore the selection.
@@ -168,14 +161,17 @@ void 
RecentMasterPagesSelector::AssignMasterPageToPageList (
 
 
 
-
 void RecentMasterPagesSelector::ProcessPopupMenu (Menu& rMenu)
 {
     if (rMenu.GetItemPos(SID_TP_EDIT_MASTER) != MENU_ITEM_NOTFOUND)
         rMenu.EnableItem(SID_TP_EDIT_MASTER, sal_False);
+    // Disable some entries
+    if (mpContainer->GetPreviewSize() == MasterPageContainer::SMALL)
+        rMenu.EnableItem(SID_TP_SHOW_SMALL_PREVIEW, sal_False);
+    else
+        rMenu.EnableItem(SID_TP_SHOW_LARGE_PREVIEW, sal_False);
 }
 
-
-
-
 } } // end of namespace sd::sidebar
+
+/* vim: set noet sw=4 ts=4: */

Reply via email to