From 4c12f9e15b56d3d3de787d4175a6fbbfa4dccb64 Mon Sep 17 00:00:00 2001
From: Vladimir Glazounov <vg@openoffice.org>
Date: Thu, 1 Oct 2009 10:20:24 +0000
Subject: CWS-TOOLING: integrate CWS impressnotes03 2009-09-28 16:30:17 +0200
 cl  r276496 : #i105382# use correct method to get master page 2009-09-28
 12:23:04 +0200 cl  r276486 : #i105266# also save text on close to avoid focus
 trouble under linux 2009-09-25 13:59:50 +0200 cl  r276456 : #i105266#
 resolved a merge conflict 2009-09-25 13:57:24 +0200 cl  r276454 : #i105266#
 resolved a merge conflict 2009-09-25 13:51:12 +0200 cl  r276450 : #i105266#
 resolved a merge conflict 2009-09-25 13:40:08 +0200 cl  r276447 : #i105266#
 resolved a merge conflict

---
 sd/sdi/drviewsh.sdi                                | 14 ++++-----
 sd/source/ui/annotations/annotationmanager.cxx     | 34 +++++++++++++++-------
 sd/source/ui/annotations/annotationmanagerimpl.hxx |  3 ++
 sd/source/ui/annotations/annotationtag.cxx         |  1 +
 sd/uiconfig/sdraw/menubar/menubar.xml              |  2 +-
 sd/uiconfig/simpress/menubar/menubar.xml           |  2 +-
 6 files changed, 36 insertions(+), 20 deletions(-)

(limited to 'sd')

diff --git a/sd/sdi/drviewsh.sdi b/sd/sdi/drviewsh.sdi
index 603a6036d711..b0dc446a6c72 100644
--- a/sd/sdi/drviewsh.sdi
+++ b/sd/sdi/drviewsh.sdi
@@ -180,17 +180,12 @@ interface ImpressEditView : DrawView
         ExecMethod = FuTemporary ;
         StateMethod = GetMenuState ;
     ]
-}
-
-shell DrawViewShell
-{
-    import ImpressEditView[Automation];
-    SID_INSERT_POSTIT
+    SID_SHOW_POSTIT
     [
         ExecMethod = ExecuteAnnotation;
         StateMethod = GetAnnotationState;
     ]
-    SID_SHOW_POSTIT
+    SID_INSERT_POSTIT
     [
         ExecMethod = ExecuteAnnotation;
         StateMethod = GetAnnotationState;
@@ -227,6 +222,11 @@ shell DrawViewShell
     ]
 }
 
+shell DrawViewShell
+{
+    import ImpressEditView[Automation];
+}
+
 
 shell PresentationViewShell
 {
diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx
index 144022d10758..bbc9bbd539f3 100644
--- a/sd/source/ui/annotations/annotationmanager.cxx
+++ b/sd/source/ui/annotations/annotationmanager.cxx
@@ -274,6 +274,21 @@ void SAL_CALL AnnotationManagerImpl::disposing( const ::com::sun::star::lang::Ev
 {
 }
 
+void AnnotationManagerImpl::ShowAnnotations( bool bShow )
+{
+    // enforce show annotations if a new annotation is inserted
+    if( mbShowAnnotations != bShow )
+    {
+        mbShowAnnotations = bShow;
+
+        SdOptions* pOptions = SD_MOD()->GetSdOptions(mpDoc->GetDocumentType());
+           if( pOptions )
+            pOptions->SetShowComments( mbShowAnnotations ? sal_True : sal_False );
+
+        UpdateTags();
+    }
+}
+
 // --------------------------------------------------------------------
 
 void AnnotationManagerImpl::ExecuteAnnotation(SfxRequest& rReq )
@@ -296,16 +311,8 @@ void AnnotationManagerImpl::ExecuteAnnotation(SfxRequest& rReq )
         ExecuteReplyToAnnotation( rReq );
         break;
     case SID_SHOW_POSTIT:
-        {
-            mbShowAnnotations = !mbShowAnnotations;
-
-               SdOptions* pOptions = SD_MOD()->GetSdOptions(mpDoc->GetDocumentType());
-               if( pOptions )
-                pOptions->SetShowComments( mbShowAnnotations ? sal_True : sal_False );
-
-            UpdateTags();
-            break;
-        }
+        ShowAnnotations( !mbShowAnnotations );
+        break;
     }
 }
 
@@ -313,6 +320,7 @@ void AnnotationManagerImpl::ExecuteAnnotation(SfxRequest& rReq )
 
 void AnnotationManagerImpl::ExecuteInsertAnnotation(SfxRequest& /*rReq*/)
 {
+    ShowAnnotations(true);
     InsertAnnotation();
 }
 
@@ -320,6 +328,8 @@ void AnnotationManagerImpl::ExecuteInsertAnnotation(SfxRequest& /*rReq*/)
 
 void AnnotationManagerImpl::ExecuteDeleteAnnotation(SfxRequest& rReq)
 {
+    ShowAnnotations( true );
+
     const SfxItemSet* pArgs = rReq.GetArgs();
 
     switch( rReq.GetSlot() )
@@ -640,6 +650,8 @@ void AnnotationManagerImpl::GetAnnotationState(SfxItemSet& rSet)
 
 void AnnotationManagerImpl::SelectNextAnnotation(bool bForeward)
 {
+    ShowAnnotations( true );
+
     Reference< XAnnotation > xCurrent;
     GetSelectedAnnotation( xCurrent );
     SdPage* pPage = GetCurrentPage();
@@ -1213,7 +1225,7 @@ SdPage* AnnotationManagerImpl::GetNextPage( SdPage* pPage, bool bForeward )
 
             nPageNum--;
         }
-        return static_cast< SdPage* >( mpDoc->GetMasterPage(nPageNum) );
+        return mpDoc->GetMasterSdPage(nPageNum,PK_STANDARD);
     }
 }
 
diff --git a/sd/source/ui/annotations/annotationmanagerimpl.hxx b/sd/source/ui/annotations/annotationmanagerimpl.hxx
index a64421c26262..9f2c48e875d3 100755
--- a/sd/source/ui/annotations/annotationmanagerimpl.hxx
+++ b/sd/source/ui/annotations/annotationmanagerimpl.hxx
@@ -124,6 +124,9 @@ public:
     SdPage* GetCurrentPage();
 
     SdDrawDocument* GetDoc() { return mpDoc; }
+
+    void ShowAnnotations(bool bShow);
+
 private:
     ViewShellBase& mrBase;
     SdDrawDocument* mpDoc;
diff --git a/sd/source/ui/annotations/annotationtag.cxx b/sd/source/ui/annotations/annotationtag.cxx
index af219c3aadc3..d2b9b7b56b7d 100644
--- a/sd/source/ui/annotations/annotationtag.cxx
+++ b/sd/source/ui/annotations/annotationtag.cxx
@@ -717,6 +717,7 @@ void AnnotationTag::ClosePopup()
     if( mpAnnotationWindow.get() )
     {
         mpAnnotationWindow->RemoveEventListener( LINK(this, AnnotationTag, WindowEventHandler));
+        mpAnnotationWindow->Deactivate();
         mpAnnotationWindow.reset();
     }
 }
diff --git a/sd/uiconfig/sdraw/menubar/menubar.xml b/sd/uiconfig/sdraw/menubar/menubar.xml
index fcc7246bb427..9e5d927b263e 100644
--- a/sd/uiconfig/sdraw/menubar/menubar.xml
+++ b/sd/uiconfig/sdraw/menubar/menubar.xml
@@ -105,7 +105,7 @@
                     <menu:menuitem menu:id=".uno:HelplinesFront"/>
                 </menu:menupopup>
             </menu:menu>
-      <menu:menuitem menu:id=".uno:ShowAnnotation"/>
+      <menu:menuitem menu:id=".uno:ShowAnnotations"/>
       <menu:menuseparator/>
             <menu:menuitem menu:id=".uno:Navigator"/>
             <menu:menuseparator/>
diff --git a/sd/uiconfig/simpress/menubar/menubar.xml b/sd/uiconfig/simpress/menubar/menubar.xml
index d762a075abd4..c1dacd33e0c0 100644
--- a/sd/uiconfig/simpress/menubar/menubar.xml
+++ b/sd/uiconfig/simpress/menubar/menubar.xml
@@ -119,7 +119,7 @@
                     <menu:menuitem menu:id=".uno:HelplinesFront"/>
                 </menu:menupopup>
             </menu:menu>
-      <menu:menuitem menu:id=".uno:ShowAnnotation"/>
+      <menu:menuitem menu:id=".uno:ShowAnnotations"/>
       <menu:menuseparator/>
             <menu:menuitem menu:id=".uno:Navigator"/>
             <menu:menuseparator/>
-- 
cgit