[Libreoffice-commits] .: 2 commits - officecfg/registry scripting/workben sw/inc sw/sdi sw/source sw/uiconfig

Cédric Bosdonnat cbosdo at kemper.freedesktop.org
Mon Sep 12 09:10:34 PDT 2011


 officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu |    8 --
 scripting/workben/bindings/writermenubar.xml                        |    1 
 sw/inc/cmdid.h                                                      |    1 
 sw/inc/viewsh.hxx                                                   |    3 
 sw/sdi/_textsh.sdi                                                  |    6 -
 sw/sdi/swriter.sdi                                                  |   27 ------
 sw/source/core/inc/pagefrm.hxx                                      |    2 
 sw/source/core/layout/pagechg.cxx                                   |   27 ++++++
 sw/source/core/layout/paintfrm.cxx                                  |    4 -
 sw/source/core/view/viewsh.cxx                                      |    1 
 sw/source/core/view/vnew.cxx                                        |    1 
 sw/source/ui/docvw/edtwin.cxx                                       |   40 +++++++++-
 sw/source/ui/inc/edtwin.hxx                                         |    8 ++
 sw/source/ui/shells/textsh1.cxx                                     |   21 -----
 sw/uiconfig/sglobal/menubar/menubar.xml                             |    1 
 sw/uiconfig/swform/menubar/menubar.xml                              |    1 
 sw/uiconfig/swreport/menubar/menubar.xml                            |    1 
 sw/uiconfig/swriter/menubar/menubar.xml                             |    1 
 sw/uiconfig/swxform/menubar/menubar.xml                             |    1 
 19 files changed, 81 insertions(+), 74 deletions(-)

New commits:
commit ecc5249190af915d98856939281afcd648eaac2b
Author: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>
Date:   Mon Sep 12 16:46:16 2011 +0200

    Revert "n#676858: added new menu entry for headers/footers edit mode"
    
    This reverts the following commits:
      + f3e275a2123c6356951a294051d0be230c178851
      + 29a45a09ba8a21022e105f3d500a027f93a4fca0 (partly)
    
    Conflicts:
    
    	officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu

diff --git a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
index 4396294..9153d94 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
@@ -301,14 +301,6 @@
                     <value>1</value>
                 </prop>
             </node>
-            <node oor:name=".uno:EditHeaderAndFooter" oor:op="replace">
-                <prop oor:name="Label" oor:type="xs:string">
-                    <value xml:lang="en-US">Headers &amp; Footers</value>
-                </prop>
-                <prop oor:name="Properties" oor:type="xs:int">
-                    <value>1</value>
-                </prop>
-            </node>
             <node oor:name=".uno:InsertCaptionDialog" oor:op="replace">
                 <prop oor:name="Label" oor:type="xs:string">
                     <value xml:lang="en-US">Caption...</value>
diff --git a/scripting/workben/bindings/writermenubar.xml b/scripting/workben/bindings/writermenubar.xml
index 4d45280..d2d6d88 100755
--- a/scripting/workben/bindings/writermenubar.xml
+++ b/scripting/workben/bindings/writermenubar.xml
@@ -81,7 +81,6 @@
    <menu:menuitem menu:id="slot:20620" menu:helpid="20620" menu:label="AutoTe~xt..."/>
    <menu:menuseparator/>
    <menu:menuitem menu:id="slot:20309" menu:helpid="20309" menu:label="Exc~hange Database..."/>
-   <menu:menuitem menu:id="slot:20195" menu:helpid="20195" menu:label="Headers/Footers"/>
    <menu:menuitem menu:id="slot:20104" menu:helpid="20104" menu:label="F~ields..."/>
    <menu:menuitem menu:id="slot:20162" menu:helpid="20162" menu:label="Footnote~..."/>
    <menu:menuitem menu:id="slot:20123" menu:helpid="20123" menu:label="Index Entr~y..."/>
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index ae2a6eb..466e07d 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -216,7 +216,6 @@ included in c-context files, so c++ style stuff will cause problems.
 #define FN_SELECT_INDEX              (FN_EDIT + 85)  /**/
 #define FN_UP                        (FN_EDIT + 86)  /**/
 
-#define FN_EDIT_HEADER_FOOTER        (FN_EDIT + 95) /* Toggle headers/footers edition*/
 #define FN_SELECT_PARA               (FN_EDIT + 97) /* select paragraph*/
 
 #define FN_SELECT_CONTENT            (FN_EDIT + 99) /* Navigator - Content Type */
diff --git a/sw/sdi/_textsh.sdi b/sw/sdi/_textsh.sdi
index a175dae..c0f1126 100644
--- a/sw/sdi/_textsh.sdi
+++ b/sw/sdi/_textsh.sdi
@@ -373,12 +373,6 @@ interface BaseText
         StateMethod = GetState;
         DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
     ]
-    FN_EDIT_HEADER_FOOTER
-    [
-        ExecMethod = Execute ;
-        StateMethod = GetState;
-        DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
-    ]
     FN_TABLE_UNSET_READ_ONLY // status(final|play)
     [
         ExecMethod = Execute ;
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index 4d5df44..36c45e4 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -10417,30 +10417,3 @@ SfxVoidItem NavigateForward FN_NAVIGATION_FORWARD
     ToolBoxConfig = TRUE,
     GroupId = GID_NAVIGATION;
 ]
-
-//--------------------------------------------------------------------------
-SfxVoidItem EditHeaderAndFooter FN_EDIT_HEADER_FOOTER
-[
-    /* flags: */
-    AutoUpdate = FALSE,
-    Cachable = Cachable,
-    FastCall = FALSE,
-    HasCoreId = FALSE,
-    HasDialog = FALSE,
-    ReadOnlyDoc = FALSE,
-    Toggle = TRUE,
-    Container = FALSE,
-    RecordAbsolute = FALSE,
-    RecordPerSet;
-    Asynchron;
-
-    Readonly = FALSE,
-
-    /* config: */
-    AccelConfig = TRUE,
-    MenuConfig = TRUE,
-    StatusBarConfig = FALSE,
-    ToolBoxConfig = TRUE,
-    GroupId = GID_EDIT;
-]
-
diff --git a/sw/source/ui/shells/textsh1.cxx b/sw/source/ui/shells/textsh1.cxx
index 493485b..739eaa6 100644
--- a/sw/source/ui/shells/textsh1.cxx
+++ b/sw/source/ui/shells/textsh1.cxx
@@ -819,9 +819,6 @@ void SwTextShell::Execute(SfxRequest &rReq)
             }
         }
         break;
-        case FN_EDIT_HEADER_FOOTER:
-            rWrtSh.ToggleHeaderFooterEdit();
-        break;
         case SID_ATTR_BRUSH_CHAR :
         case SID_ATTR_CHAR_SCALEWIDTH :
         case SID_ATTR_CHAR_ROTATED :
@@ -1568,24 +1565,6 @@ void SwTextShell::GetState( SfxItemSet &rSet )
                 }
             }
             break;
-            case FN_EDIT_HEADER_FOOTER:
-            {
-                SfxBoolItem aBool( nWhich, rSh.IsHeaderFooterEdit() );
-                rSet.Put( aBool );
-
-                bool bHasHeaderFooter = false;
-                for ( sal_uInt16 i = 0; !bHasHeaderFooter && i < rSh.GetPageDescCnt(); i++ )
-                {
-                    const SwPageDesc& rPageDesc = rSh.GetPageDesc( i );
-                    bHasHeaderFooter = rPageDesc.GetMaster().GetHeader().IsActive() ||
-                                       rPageDesc.GetMaster().GetFooter().IsActive() ||
-                                       rPageDesc.GetLeft().GetHeader().IsActive() ||
-                                       rPageDesc.GetLeft().GetFooter().IsActive();
-                }
-                if ( !bHasHeaderFooter )
-                    rSet.DisableItem( nWhich );
-            }
-            break;
             case SID_TRANSLITERATE_HALFWIDTH:
             case SID_TRANSLITERATE_FULLWIDTH:
             case SID_TRANSLITERATE_HIRAGANA:
diff --git a/sw/uiconfig/sglobal/menubar/menubar.xml b/sw/uiconfig/sglobal/menubar/menubar.xml
index fc479ea..e643158 100755
--- a/sw/uiconfig/sglobal/menubar/menubar.xml
+++ b/sw/uiconfig/sglobal/menubar/menubar.xml
@@ -90,7 +90,6 @@
       <menu:menuitem menu:id=".uno:EditGlossary"/>
       <menu:menuseparator/>
       <menu:menuitem menu:id=".uno:ChangeDatabaseField"/>
-      <menu:menuitem menu:id=".uno:EditHeaderAndFooter"/>
       <menu:menuitem menu:id=".uno:FieldDialog"/>
       <menu:menuitem menu:id=".uno:EditFootnote"/>
       <menu:menuitem menu:id=".uno:IndexEntryDialog"/>
diff --git a/sw/uiconfig/swform/menubar/menubar.xml b/sw/uiconfig/swform/menubar/menubar.xml
index c9972e9..7e5f14f 100755
--- a/sw/uiconfig/swform/menubar/menubar.xml
+++ b/sw/uiconfig/swform/menubar/menubar.xml
@@ -90,7 +90,6 @@
       <menu:menuitem menu:id=".uno:EditGlossary"/>
       <menu:menuseparator/>
       <menu:menuitem menu:id=".uno:ChangeDatabaseField"/>
-      <menu:menuitem menu:id=".uno:EditHeaderAndFooter"/>
       <menu:menuitem menu:id=".uno:FieldDialog"/>
       <menu:menuitem menu:id=".uno:EditFootnote"/>
       <menu:menuitem menu:id=".uno:IndexEntryDialog"/>
diff --git a/sw/uiconfig/swreport/menubar/menubar.xml b/sw/uiconfig/swreport/menubar/menubar.xml
index c9972e9..7e5f14f 100755
--- a/sw/uiconfig/swreport/menubar/menubar.xml
+++ b/sw/uiconfig/swreport/menubar/menubar.xml
@@ -90,7 +90,6 @@
       <menu:menuitem menu:id=".uno:EditGlossary"/>
       <menu:menuseparator/>
       <menu:menuitem menu:id=".uno:ChangeDatabaseField"/>
-      <menu:menuitem menu:id=".uno:EditHeaderAndFooter"/>
       <menu:menuitem menu:id=".uno:FieldDialog"/>
       <menu:menuitem menu:id=".uno:EditFootnote"/>
       <menu:menuitem menu:id=".uno:IndexEntryDialog"/>
diff --git a/sw/uiconfig/swriter/menubar/menubar.xml b/sw/uiconfig/swriter/menubar/menubar.xml
index bb562a5..02107d0 100755
--- a/sw/uiconfig/swriter/menubar/menubar.xml
+++ b/sw/uiconfig/swriter/menubar/menubar.xml
@@ -93,7 +93,6 @@
       <menu:menuitem menu:id=".uno:EditGlossary"/>
       <menu:menuseparator/>
       <menu:menuitem menu:id=".uno:ChangeDatabaseField"/>
-      <menu:menuitem menu:id=".uno:EditHeaderAndFooter"/>
       <menu:menuitem menu:id=".uno:FieldDialog"/>
       <menu:menuitem menu:id=".uno:EditFootnote"/>
       <menu:menuitem menu:id=".uno:IndexEntryDialog"/>
diff --git a/sw/uiconfig/swxform/menubar/menubar.xml b/sw/uiconfig/swxform/menubar/menubar.xml
index 2e6cca6..ff139ef 100755
--- a/sw/uiconfig/swxform/menubar/menubar.xml
+++ b/sw/uiconfig/swxform/menubar/menubar.xml
@@ -91,7 +91,6 @@
       <menu:menuitem menu:id=".uno:EditGlossary"/>
       <menu:menuseparator/>
       <menu:menuitem menu:id=".uno:ChangeDatabaseField"/>
-      <menu:menuitem menu:id=".uno:EditHeaderAndFooter"/>
       <menu:menuitem menu:id=".uno:FieldDialog"/>
       <menu:menuitem menu:id=".uno:EditFootnote"/>
       <menu:menuitem menu:id=".uno:IndexEntryDialog"/>
commit 3d294102638b15dc04ee2bb0100e6f1921d69e1d
Author: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>
Date:   Mon Sep 12 16:31:02 2011 +0200

    Header/Footer: added a timer to show the separator
    
    When leaving the mouse over a header or footer area for 2 seconds, the
    separator is shown. This feature enables adding headers and footers
    easily without knowing anything about page styles.
    
    The separators are hidden back after 2 seconds outside the header or
    footer area.

diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index 3f95de7..3cb4748 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -156,6 +156,7 @@ class SW_DLLPUBLIC ViewShell : public Ring
     sal_Bool  bEnableSmooth    :1;  // Disable SmoothScroll, e.g. for drag
                                     // of scrollbars.
     sal_Bool  bEndActionByVirDev:1; // Paints from EndAction always via virtual device
+    sal_Bool  bShowHeaderFooterSeparator;
     sal_Bool  bHeaderFooterEdit;
                                     // (e.g. when browsing).
 
@@ -566,6 +567,8 @@ public:
 
     virtual void ToggleHeaderFooterEdit( );
     sal_Bool IsHeaderFooterEdit( ) const { return bHeaderFooterEdit; }
+    sal_Bool IsShowHeaderFooterSeparator( ) { return bShowHeaderFooterSeparator; }
+    void SetShowHeaderFooterSeparator( sal_Bool bShow ) { bShowHeaderFooterSeparator = bShow; }
 };
 
 //---- class CurrShell manages global ShellPointer -------------------
diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx
index d45d4be..e2e7ef5 100644
--- a/sw/source/core/inc/pagefrm.hxx
+++ b/sw/source/core/inc/pagefrm.hxx
@@ -374,6 +374,8 @@ public:
     // in case this is am empty page, this function returns the 'reference' page
     const SwPageFrm& GetFormatPage() const;
 
+    bool IsOverHeaderFooterArea( const Point& rPt ) const;
+
     // return font used to paint the "empty page" string
     static const Font& GetEmptyPageFont();
 
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index 263facb..e028d27 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -2451,4 +2451,31 @@ const SwPageFrm& SwPageFrm::GetFormatPage() const
     return *pRet;
 }
 
+bool SwPageFrm::IsOverHeaderFooterArea( const Point& rPt ) const
+{
+    long nUpperLimit = 0;
+    long nLowerLimit = 0;
+    const SwFrm* pFrm = Lower();
+    while ( pFrm )
+    {
+        if ( pFrm->IsBodyFrm() )
+        {
+            nUpperLimit = pFrm->Frm().Top();
+            nLowerLimit = pFrm->Frm().Bottom();
+        }
+        else if ( pFrm->IsFtnContFrm() )
+            nLowerLimit = pFrm->Frm().Bottom();
+
+        pFrm = pFrm->GetNext();
+    }
+
+    SwRect aHeaderArea( Frm().TopLeft(),
+           Size( Frm().Width(), nUpperLimit - Frm().Top() ) );
+
+    SwRect aFooterArea( Point( Frm().Left(), nLowerLimit ),
+           Size( Frm().Width(), Frm().Bottom() - nLowerLimit ) );
+
+    return aHeaderArea.IsInside( rPt ) || aFooterArea.IsInside( rPt );
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index e868cba..f384bcc 100755
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -3333,7 +3333,7 @@ void SwPageFrm::PaintBreak( ) const
                 //      header/footer marker
                 //    * Non-printing characters are shown, as this is more consistent
                 //      with other formatting marks
-                if ( !pGlobalShell->IsHeaderFooterEdit() &&
+                if ( !pGlobalShell->IsShowHeaderFooterSeparator() &&
                       pGlobalShell->GetViewOptions()->IsShowHiddenChar( ) )
                 {
                     SwRect aRect( pCnt->Prt() );
@@ -3404,7 +3404,7 @@ void SwPageFrm::PaintDecorators( ) const
             if ( !pGlobalShell->GetViewOptions()->IsPrinting() &&
                  !pGlobalShell->GetViewOptions()->IsPDFExport() &&
                  !pGlobalShell->IsPreView() &&
-                 pGlobalShell->IsHeaderFooterEdit( ) )
+                 pGlobalShell->IsShowHeaderFooterSeparator( ) )
             {
                 drawinglayer::processor2d::BaseProcessor2D* pProcessor = CreateProcessor2D();
 
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 912a327..c831abb 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -98,6 +98,7 @@ using namespace ::com::sun::star;
 
 void ViewShell::ToggleHeaderFooterEdit( ) {
     bHeaderFooterEdit = !bHeaderFooterEdit;
+    SetShowHeaderFooterSeparator( bHeaderFooterEdit );
     // Repaint everything to update the colors of the selected area
     Paint( VisArea().SVRect() );
 }
diff --git a/sw/source/core/view/vnew.cxx b/sw/source/core/view/vnew.cxx
index 3bc3012..5b4708e 100644
--- a/sw/source/core/view/vnew.cxx
+++ b/sw/source/core/view/vnew.cxx
@@ -153,6 +153,7 @@ ViewShell::ViewShell( SwDoc& rDocument, Window *pWindow,
     mpTmpRef( 0 ),
     pOpt( 0 ),
     pAccOptions( new SwAccessibilityOptions ),
+    bShowHeaderFooterSeparator( sal_False ),
     bHeaderFooterEdit( sal_False ),
     mpTargetPaintWindow(0),
     mpBufferedOut(0),
diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx
index 034b063..e7aa37d 100644
--- a/sw/source/ui/docvw/edtwin.cxx
+++ b/sw/source/ui/docvw/edtwin.cxx
@@ -3410,6 +3410,10 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt)
 {
     MouseEvent rMEvt(_rMEvt);
 
+    // Mouse went out of the edit window: don't show the header/footer marker
+    if ( rMEvt.IsLeaveWindow() )
+        aOverHeaderFooterTimer.Stop();
+
     //ignore key modifiers for format paintbrush
     {
         sal_Bool bExecFormatPaintbrush = pApplyTempl && pApplyTempl->pFormatClipboard
@@ -3775,10 +3779,10 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt)
         case 0:
         {
             if ( pApplyTempl )
-                        {
+            {
                 UpdatePointer(aDocPt, 0); // maybe a frame has to be marked here
-                                break;
-                        }
+                break;
+            }
             // change ui if mouse is over SwPostItField
             // TODO: do the same thing for redlines SW_REDLINE
             SwRect aFldRect;
@@ -3796,6 +3800,21 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt)
             else
                 rView.GetPostItMgr()->SetShadowState(0,false);
                 // no break;
+
+            // Are we over a header or footer area?
+            const SwPageFrm* pPageFrm = rSh.GetLayout()->GetPageAtPos( aDocPt );
+            if ( pPageFrm )
+            {
+                bool bOverHeadFoot = pPageFrm->IsOverHeaderFooterArea( aDocPt );
+                if ( bOverHeadFoot )
+                    aOverHeaderFooterTimer.Start();
+                else
+                {
+                    aOverHeaderFooterTimer.Stop();
+                    if ( !rSh.IsHeaderFooterEdit() && rSh.IsShowHeaderFooterSeparator() )
+                        aOverHeaderFooterTimer.Start();
+                }
+            }
         }
         case KEY_SHIFT:
         case KEY_MOD2:
@@ -4555,6 +4574,9 @@ SwEditWin::SwEditWin(Window *pParent, SwView &rMyView):
     aKeyInputFlushTimer.SetTimeout( 200 );
     aKeyInputFlushTimer.SetTimeoutHdl(LINK(this, SwEditWin, KeyInputFlushHandler));
 
+    aOverHeaderFooterTimer.SetTimeout( 2000 );
+    aOverHeaderFooterTimer.SetTimeoutHdl(LINK(this, SwEditWin, OverHeaderFooterHandler));
+
     // TemplatePointer for colors should be resetted without
     // selection after single click
     aTemplateTimer.SetTimeout(400);
@@ -5376,6 +5398,18 @@ IMPL_LINK( SwEditWin, KeyInputTimerHandler, Timer *, EMPTYARG )
     return 0;
 }
 
+IMPL_LINK( SwEditWin, OverHeaderFooterHandler, Timer *, EMPTYARG )
+{
+    if ( !GetView().GetWrtShell().IsHeaderFooterEdit() )
+    {
+        // Toggle the Header/Footer separator
+        sal_Bool bShown = GetView().GetWrtShell().IsShowHeaderFooterSeparator( );
+        GetView().GetWrtShell().SetShowHeaderFooterSeparator( !bShown );
+        Invalidate();
+    }
+    return 0;
+}
+
 void SwEditWin::_InitStaticData()
 {
     pQuickHlpData = new QuickHelpData();
diff --git a/sw/source/ui/inc/edtwin.hxx b/sw/source/ui/inc/edtwin.hxx
index 6468f51..f85b2f1 100644
--- a/sw/source/ui/inc/edtwin.hxx
+++ b/sw/source/ui/inc/edtwin.hxx
@@ -102,6 +102,11 @@ friend void     PageNumNotify(  ViewShell* pVwSh,
     Timer           aKeyInputTimer;
     // timer for ANY-KeyInut question without a following KeyInputEvent
     Timer           aKeyInputFlushTimer;
+    /*
+     * timer for showing the Header/Footer separators when the mouse
+     * stays over a header or footer area for several seconds.
+     */
+    Timer           aOverHeaderFooterTimer;
 
     String          aInBuffer;
     LanguageType    eBufferLanguage;
@@ -196,6 +201,9 @@ friend void     PageNumNotify(  ViewShell* pVwSh,
     // timer for overlapping KeyInputs (e.g. for tables)
     DECL_LINK( KeyInputTimerHandler, Timer * );
 
+    // timer for hovering header/footer areas
+    DECL_LINK( OverHeaderFooterHandler, Timer * );
+
     // timer for ApplyTemplates via mouse (in disguise Drag&Drop)
     DECL_LINK( TemplateTimerHdl, Timer* );
 


More information about the Libreoffice-commits mailing list