framework/source/layoutmanager/layoutmanager.cxx | 7 include/vcl/syswin.hxx | 3 vcl/Library_vcl.mk | 1 vcl/UIConfig_vcl.mk | 1 vcl/inc/brdwin.hxx | 6 vcl/source/window/brdwin.cxx | 51 + vcl/source/window/notebookbarwindow.cxx | 69 ++ vcl/source/window/notebookbarwindow.hxx | 32 + vcl/source/window/syswin.cxx | 7 vcl/uiconfig/ui/notebookbar.ui | 621 +++++++++++++++++++++++ 10 files changed, 786 insertions(+), 12 deletions(-)
New commits: commit dea1b890cf5901bc62ec75c722f91ba40a4b37d8 Author: Samuel Mehrbrodt <samuel.mehrbr...@cib.de> Date: Wed Nov 11 08:49:53 2015 +0100 Fix NotebookBar not showing up when directly opening a document Change-Id: I6bb154102d5e58e7c7e1f1b0d68629555a6d1697 diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index 32f207e..1c15c9f 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -784,11 +784,6 @@ void LayoutManager::implts_updateUIElementsVisibleState( bool bSetVisible ) if ( bSetVisible ) { pSysWindow->SetMenuBar(pMenuBar); - if (getenv("LO_USE_NOTEBOOKBAR")) - { - pSysWindow->CreateNotebookBar("vcl/ui/notebookbar.ui", m_xFrame); - pSysWindow->SetMenuBarMode(MenuBarMode::Hide); - } } else pSysWindow->SetMenuBar( nullptr ); @@ -1508,6 +1503,11 @@ throw (RuntimeException, std::exception) } } } + if (getenv("LO_USE_NOTEBOOKBAR")) + { + pSysWindow->CreateNotebookBar("vcl/ui/notebookbar.ui", m_xFrame); + pSysWindow->SetMenuBarMode(MenuBarMode::Hide); + } } } } commit 45ef3a22444100e2c37aa2630b71bdb108721b12 Author: Samuel Mehrbrodt <samuel.mehrbr...@cib.de> Date: Tue Oct 20 11:12:07 2015 +0200 NotebookBar: Initial "Home" tab for Writer Change-Id: I92faa8dfab7703b81ce96dafaac840cfb49ff3bb diff --git a/vcl/uiconfig/ui/notebookbar.ui b/vcl/uiconfig/ui/notebookbar.ui index 8177e7a..7997c54 100644 --- a/vcl/uiconfig/ui/notebookbar.ui +++ b/vcl/uiconfig/ui/notebookbar.ui @@ -1,38 +1,109 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.18.3 --> <interface> - <!-- interface-requires gtk+ 3.4 --> + <requires lib="gtk+" version="3.12"/> + <requires lib="LibreOffice" version="1.0"/> + <!-- interface-local-resource-path ../../../icon-themes/galaxy/cmd/ --> <object class="GtkGrid" id="NotebookBar"> <property name="visible">True</property> <property name="can_focus">False</property> <child> - <object class="GtkGrid" id="grid1"> + <object class="GtkNotebook" id="notebook1"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="vexpand">True</property> <child> - <object class="GtkNotebook" id="notebook1"> + <object class="GtkBox" id="box3"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> + <property name="can_focus">False</property> + <property name="spacing">6</property> <child> - <object class="GtkBox" id="box3"> + <object class="GtkBox" id="box4"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="orientation">vertical</property> <property name="spacing">6</property> <child> - <object class="GtkBox" id="box4"> + <object class="GtkButton" id="button-open"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="action_name">.uno:Open</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="button-save"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="action_name">.uno:Save</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkSeparator" id="separator3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box5"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkButton" id="button5"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="action_name">.uno:Paste</property> + <property name="image">image1</property> + <property name="relief">none</property> + <property name="image_position">top</property> + <property name="always_show_image">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box6"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="orientation">vertical</property> - <property name="spacing">6</property> <child> - <object class="GtkButton" id="button2"> + <object class="GtkButton" id="button-cut"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> - <property name="action_name">.uno:Open</property> + <property name="action_name">.uno:Cut</property> + <property name="relief">none</property> + <property name="xalign">0</property> + <property name="always_show_image">True</property> </object> <packing> <property name="expand">False</property> @@ -41,10 +112,14 @@ </packing> </child> <child> - <object class="GtkLabel" id="label11"> + <object class="GtkButton" id="button-copy"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">label</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="action_name">.uno:Copy</property> + <property name="relief">none</property> + <property name="xalign">0</property> + <property name="always_show_image">True</property> </object> <packing> <property name="expand">False</property> @@ -52,127 +127,61 @@ <property name="position">1</property> </packing> </child> + <child> + <object class="GtkButton" id="button-format-paintbrush"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="action_name">.uno:FormatPaintbrush</property> + <property name="relief">none</property> + <property name="xalign">0</property> + <property name="always_show_image">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">0</property> + <property name="position">1</property> </packing> </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> </child> - <child type="tab"> - <object class="GtkLabel" id="label1"> + <child> + <object class="GtkSeparator" id="separator4"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">File</property> - <property name="use_underline">True</property> + <property name="orientation">vertical</property> </object> <packing> - <property name="tab_fill">False</property> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">3</property> </packing> </child> <child> - <object class="GtkBox" id="box1"> + <object class="GtkBox" id="box9"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="spacing">6</property> + <property name="orientation">vertical</property> <child> - <object class="GtkBox" id="box2"> + <object class="GtkBox" id="box10"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> <child> - <object class="GtkBox" id="box5"> + <object class="smlo-SmFontPickListBox" id="SmFontPickListBox1"> <property name="visible">True</property> <property name="can_focus">False</property> - <child> - <object class="GtkButton" id="button5"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="action_name">.uno:Paste</property> - <property name="image">image1</property> - <property name="relief">none</property> - <property name="image_position">top</property> - <property name="always_show_image">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkBox" id="box6"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <child> - <object class="GtkButton" id="button1"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="action_name">.uno:Cut</property> - <property name="relief">none</property> - <property name="xalign">0</property> - <property name="always_show_image">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkButton" id="button3"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="action_name">.uno:Copy</property> - <property name="relief">none</property> - <property name="xalign">0</property> - <property name="always_show_image">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkButton" id="button4"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="action_name">.uno:FormatPaintbrush</property> - <property name="relief">none</property> - <property name="xalign">0</property> - <property name="always_show_image">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> </object> <packing> <property name="expand">False</property> @@ -181,17 +190,41 @@ </packing> </child> <child> - <object class="GtkLabel" id="label10"> + <placeholder/> + </child> + <child> + <object class="GtkButton" id="button-shrink-font"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Clipboard</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="action_name">.uno:Shrink</property> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">1</property> + <property name="position">2</property> </packing> </child> + <child> + <object class="GtkButton" id="button-grow-font"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="action_name">.uno:Grow</property> + <property name="xalign">0.60000002384185791</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> <packing> <property name="expand">False</property> @@ -200,150 +233,383 @@ </packing> </child> <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> + <object class="GtkBox" id="box11"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkButton" id="button-subscript"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="action_name">.uno:SubScript</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="button-superscript"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="action_name">.uno:SuperScript</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="button-strikeout"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="action_name">.uno:Strikeout</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkButton" id="button-underline"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="action_name">.uno:Underline</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> + <child> + <object class="GtkButton" id="button-italic"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="action_name">.uno:Italic</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">4</property> + </packing> + </child> + <child> + <object class="GtkButton" id="button-bold"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="action_name">.uno:Bold</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">5</property> + </packing> + </child> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> </child> </object> <packing> - <property name="position">1</property> - </packing> - </child> - <child type="tab"> - <object class="GtkLabel" id="label2"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Edit</property> - <property name="use_underline">True</property> - </object> - <packing> - <property name="position">1</property> - <property name="tab_fill">False</property> - </packing> - </child> - <child> - <placeholder/> - </child> - <child type="tab"> - <object class="GtkLabel" id="label3"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">View</property> - <property name="use_underline">True</property> - </object> - <packing> - <property name="position">2</property> - <property name="tab_fill">False</property> - </packing> - </child> - <child> - <placeholder/> - </child> - <child type="tab"> - <object class="GtkLabel" id="label4"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Insert</property> - <property name="use_underline">True</property> - </object> - <packing> - <property name="position">3</property> - <property name="tab_fill">False</property> - </packing> - </child> - <child> - <placeholder/> - </child> - <child type="tab"> - <object class="GtkLabel" id="label5"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Format</property> - <property name="use_underline">True</property> - </object> - <packing> + <property name="expand">False</property> + <property name="fill">True</property> <property name="position">4</property> - <property name="tab_fill">False</property> </packing> </child> <child> - <placeholder/> - </child> - <child type="tab"> - <object class="GtkLabel" id="label6"> + <object class="GtkSeparator" id="separator5"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">Table</property> - <property name="use_underline">True</property> + <property name="orientation">vertical</property> </object> <packing> + <property name="expand">False</property> + <property name="fill">True</property> <property name="position">5</property> - <property name="tab_fill">False</property> </packing> </child> <child> - <placeholder/> - </child> - <child type="tab"> - <object class="GtkLabel" id="label7"> + <object class="GtkBox" id="box1"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">Tools</property> - <property name="use_underline">True</property> + <property name="orientation">vertical</property> + <child> + <object class="GtkBox" id="box7"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkButton" id="button-increment-indent"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="action_name">.uno:IncrementIndent</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="button-decrement-indent"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="action_name">.uno:DecrementIndent</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box8"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkButton" id="button-left-para"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="action_name">.uno:LeftPara</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="button-center-para"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="action_name">.uno:CenterPara</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="button-right-para"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="action_name">.uno:RightPara</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkButton" id="button-justify-para"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="action_name">.uno:JustifyPara</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> </object> <packing> + <property name="expand">False</property> + <property name="fill">True</property> <property name="position">6</property> - <property name="tab_fill">False</property> </packing> </child> <child> <placeholder/> </child> - <child type="tab"> - <object class="GtkLabel" id="label8"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Window</property> - <property name="use_underline">True</property> - </object> - <packing> - <property name="position">7</property> - <property name="tab_fill">False</property> - </packing> - </child> - <child> - <placeholder/> - </child> - <child type="tab"> - <object class="GtkLabel" id="label9"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Help</property> - <property name="use_underline">True</property> - </object> - <packing> - <property name="position">8</property> - <property name="tab_fill">False</property> - </packing> - </child> + </object> + </child> + <child type="tab"> + <object class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Home</property> + <property name="use_underline">True</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> + <property name="tab_fill">False</property> </packing> </child> + <child> + <placeholder/> + </child> + <child type="tab"> + <object class="GtkLabel" id="label3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">View</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="position">1</property> + <property name="tab_fill">False</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child type="tab"> + <object class="GtkLabel" id="label4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Insert</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="position">2</property> + <property name="tab_fill">False</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child type="tab"> + <object class="GtkLabel" id="label5"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Format</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="position">3</property> + <property name="tab_fill">False</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child type="tab"> + <object class="GtkLabel" id="label6"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Table</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="position">4</property> + <property name="tab_fill">False</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child type="tab"> + <object class="GtkLabel" id="label7"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Tools</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="position">5</property> + <property name="tab_fill">False</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child type="tab"> + <object class="GtkLabel" id="label8"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Window</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="position">6</property> + <property name="tab_fill">False</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child type="tab"> + <object class="GtkLabel" id="label9"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Help</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="position">7</property> + <property name="tab_fill">False</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child type="tab"> + <placeholder/> + </child> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> commit 68d75af9c6644928ee60d21fbc8b15cd8b3bc55e Author: Jan Holesovsky <ke...@collabora.com> Date: Thu Sep 11 14:10:21 2014 +0200 vcl: Initial NotebookBar implementation. Re-introduced, this is still useful code to have :-) Change-Id: I91535c13d68261f7195989ec78bd305cf572c87c diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index eb66efe..32f207e 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -782,7 +782,14 @@ void LayoutManager::implts_updateUIElementsVisibleState( bool bSetVisible ) if ( pSysWindow ) { if ( bSetVisible ) + { pSysWindow->SetMenuBar(pMenuBar); + if (getenv("LO_USE_NOTEBOOKBAR")) + { + pSysWindow->CreateNotebookBar("vcl/ui/notebookbar.ui", m_xFrame); + pSysWindow->SetMenuBarMode(MenuBarMode::Hide); + } + } else pSysWindow->SetMenuBar( nullptr ); } diff --git a/include/vcl/syswin.hxx b/include/vcl/syswin.hxx index d31f68e..12b0f8f 100644 --- a/include/vcl/syswin.hxx +++ b/include/vcl/syswin.hxx @@ -28,6 +28,7 @@ class ModalDialog; class MenuBar; +class NotebookBarWindow; class TaskPaneList; class VclContainer; @@ -237,6 +238,8 @@ public: MenuBar* GetMenuBar() const { return mpMenuBar; } void SetMenuBarMode( MenuBarMode nMode ); + void CreateNotebookBar(const OUString& rUIXMLDescription, const css::uno::Reference<css::frame::XFrame>& rFrame); + TaskPaneList* GetTaskPaneList(); void GetWindowStateData( WindowStateData& rData ) const; diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index 7b95621..0345189 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -181,6 +181,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/window/mouse \ vcl/source/window/mouseevent \ vcl/source/window/msgbox \ + vcl/source/window/notebookbarwindow \ vcl/source/window/popupmenuwindow \ vcl/source/window/printdlg \ vcl/source/window/scrwnd \ diff --git a/vcl/UIConfig_vcl.mk b/vcl/UIConfig_vcl.mk index a81b30e..f30252c 100644 --- a/vcl/UIConfig_vcl.mk +++ b/vcl/UIConfig_vcl.mk @@ -13,6 +13,7 @@ $(eval $(call gb_UIConfig_add_uifiles,vcl,\ vcl/uiconfig/ui/cupspassworddialog \ vcl/uiconfig/ui/errornocontentdialog \ vcl/uiconfig/ui/errornoprinterdialog \ + vcl/uiconfig/ui/notebookbar \ vcl/uiconfig/ui/printdialog \ vcl/uiconfig/ui/printerdevicepage \ vcl/uiconfig/ui/printerpaperpage \ diff --git a/vcl/inc/brdwin.hxx b/vcl/inc/brdwin.hxx index d5d8fbc..5180b00 100644 --- a/vcl/inc/brdwin.hxx +++ b/vcl/inc/brdwin.hxx @@ -22,8 +22,11 @@ #include <vcl/window.hxx> +#include <com/sun/star/frame/XFrame.hpp> + class ImplBorderWindowView; enum class DrawButtonFlags; +class NotebookBarWindow; #define BORDERWINDOW_STYLE_OVERLAP ((sal_uInt16)0x0001) #define BORDERWINDOW_STYLE_BORDER ((sal_uInt16)0x0002) @@ -85,6 +88,7 @@ class ImplBorderWindow : public vcl::Window private: ImplBorderWindowView* mpBorderView; VclPtr<vcl::Window> mpMenuBarWindow; + VclPtr<NotebookBarWindow> mpNotebookBarWindow; long mnMinWidth; long mnMinHeight; long mnMaxWidth; @@ -158,6 +162,8 @@ public: void SetMenuBarWindow( vcl::Window* pWindow ); void SetMenuBarMode( bool bHide ); + void SetNotebookBarWindow(const OUString& rUIXMLDescription, const css::uno::Reference<css::frame::XFrame>& rFrame); + void SetMinOutputSize( long nWidth, long nHeight ) { mnMinWidth = nWidth; mnMinHeight = nHeight; } void SetMaxOutputSize( long nWidth, long nHeight ) diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx index 1d79dd0..cc7cb3f 100644 --- a/vcl/source/window/brdwin.cxx +++ b/vcl/source/window/brdwin.cxx @@ -36,6 +36,8 @@ #include <vcl/metric.hxx> #include <vcl/settings.hxx> +#include "notebookbarwindow.hxx" + using namespace ::com::sun::star::uno; // useful caption height for title bar buttons @@ -1832,6 +1834,7 @@ void ImplBorderWindow::dispose() delete mpBorderView; mpBorderView = nullptr; mpMenuBarWindow.clear(); + mpNotebookBarWindow.disposeAndClear(); vcl::Window::dispose(); } @@ -1912,12 +1915,14 @@ void ImplBorderWindow::Resize() { vcl::Window* pClientWindow = ImplGetClientWindow(); - if ( mpMenuBarWindow ) + sal_Int32 nLeftBorder; + sal_Int32 nTopBorder; + sal_Int32 nRightBorder; + sal_Int32 nBottomBorder; + mpBorderView->GetBorder( nLeftBorder, nTopBorder, nRightBorder, nBottomBorder ); + + if (mpMenuBarWindow) { - sal_Int32 nLeftBorder; - sal_Int32 nTopBorder; - sal_Int32 nRightBorder; - sal_Int32 nBottomBorder; long nMenuHeight = mpMenuBarWindow->GetSizePixel().Height(); if ( mbMenuHide ) { @@ -1930,11 +1935,22 @@ void ImplBorderWindow::Resize() if ( !nMenuHeight ) nMenuHeight = mnOrgMenuHeight; } - mpBorderView->GetBorder( nLeftBorder, nTopBorder, nRightBorder, nBottomBorder ); - mpMenuBarWindow->setPosSizePixel( nLeftBorder, - nTopBorder, - aSize.Width()-nLeftBorder-nRightBorder, - nMenuHeight); + mpMenuBarWindow->setPosSizePixel( + nLeftBorder, nTopBorder, + aSize.Width()-nLeftBorder-nRightBorder, + nMenuHeight); + + // shift the notebookbar down accordingly + nTopBorder += nMenuHeight; + } + + if (mpNotebookBarWindow) + { + long nNotebookBarHeight = mpNotebookBarWindow->GetSizePixel().Height(); + mpNotebookBarWindow->setPosSizePixel( + nLeftBorder, nTopBorder, + aSize.Width() - nLeftBorder - nRightBorder, + nNotebookBarHeight); } GetBorder( pClientWindow->mpWindowImpl->mnLeftBorder, pClientWindow->mpWindowImpl->mnTopBorder, @@ -2161,12 +2177,23 @@ void ImplBorderWindow::SetMenuBarMode( bool bHide ) UpdateMenuHeight(); } +void ImplBorderWindow::SetNotebookBarWindow(const OUString& rUIXMLDescription, const css::uno::Reference<css::frame::XFrame>& rFrame) +{ + mpNotebookBarWindow.reset(new NotebookBarWindow(this, "NotebookBar", rUIXMLDescription, rFrame)); + Resize(); + mpNotebookBarWindow->Show(); +} + void ImplBorderWindow::GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder, sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const { - mpBorderView->GetBorder( rLeftBorder, rTopBorder, rRightBorder, rBottomBorder ); - if ( mpMenuBarWindow && !mbMenuHide ) + mpBorderView->GetBorder(rLeftBorder, rTopBorder, rRightBorder, rBottomBorder); + + if (mpMenuBarWindow && !mbMenuHide) rTopBorder += mpMenuBarWindow->GetSizePixel().Height(); + + if (mpNotebookBarWindow) + rTopBorder += mpNotebookBarWindow->GetSizePixel().Height(); } long ImplBorderWindow::CalcTitleWidth() const diff --git a/vcl/source/window/notebookbarwindow.cxx b/vcl/source/window/notebookbarwindow.cxx new file mode 100644 index 0000000..09fc067 --- /dev/null +++ b/vcl/source/window/notebookbarwindow.cxx @@ -0,0 +1,69 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "notebookbarwindow.hxx" + +#include <vcl/layout.hxx> + +NotebookBarWindow::NotebookBarWindow(Window* pParent, const OString& rID, const OUString& rUIXMLDescription, const css::uno::Reference<css::frame::XFrame> &rFrame) + : Control(pParent) +{ + SetStyle(GetStyle() | WB_DIALOGCONTROL); + m_pUIBuilder = new VclBuilder(this, getUIRootDir(), rUIXMLDescription, rID, rFrame); +} + +NotebookBarWindow::~NotebookBarWindow() +{ + disposeOnce(); +} + +void NotebookBarWindow::dispose() +{ + disposeBuilder(); + Control::dispose(); +} + +Size NotebookBarWindow::GetOptimalSize() const +{ + if (isLayoutEnabled(this)) + return VclContainer::getLayoutRequisition(*GetWindow(GetWindowType::FirstChild)); + + return Control::GetOptimalSize(); +} + +void NotebookBarWindow::setPosSizePixel(long nX, long nY, long nWidth, long nHeight, PosSizeFlags nFlags) +{ + bool bCanHandleSmallerWidth = false; + bool bCanHandleSmallerHeight = false; + + bool bIsLayoutEnabled = isLayoutEnabled(this); + Window *pChild = GetWindow(GetWindowType::FirstChild); + + if (bIsLayoutEnabled && pChild->GetType() == WINDOW_SCROLLWINDOW) + { + WinBits nStyle = pChild->GetStyle(); + if (nStyle & (WB_AUTOHSCROLL | WB_HSCROLL)) + bCanHandleSmallerWidth = true; + if (nStyle & (WB_AUTOVSCROLL | WB_VSCROLL)) + bCanHandleSmallerHeight = true; + } + + Size aSize(GetOptimalSize()); + if (!bCanHandleSmallerWidth) + nWidth = std::max(nWidth, aSize.Width()); + if (!bCanHandleSmallerHeight) + nHeight = std::max(nHeight, aSize.Height()); + + Control::setPosSizePixel(nX, nY, nWidth, nHeight, nFlags); + + if (bIsLayoutEnabled && (nFlags & PosSizeFlags::Size)) + VclContainer::setLayoutAllocation(*pChild, Point(0, 0), Size(nWidth, nHeight)); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/notebookbarwindow.hxx b/vcl/source/window/notebookbarwindow.hxx new file mode 100644 index 0000000..0fc64a6 --- /dev/null +++ b/vcl/source/window/notebookbarwindow.hxx @@ -0,0 +1,32 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef VCL_SOURCE_WINDOW_NOTEBOOKBARWINDOW_HXX +#define VCL_SOURCE_WINDOW_NOTEBOOKBARWINDOW_HXX + +#include "menuwindow.hxx" + +#include <vcl/builder.hxx> +#include <vcl/ctrl.hxx> + +/// This implements Widget Layout-based notebook-like menu bar. +class NotebookBarWindow : public Control, public VclBuilderContainer +{ +public: + NotebookBarWindow(Window* pParent, const OString& rID, const OUString& rUIXMLDescription, const css::uno::Reference<css::frame::XFrame> &rFrame); + virtual ~NotebookBarWindow(); + virtual void dispose() SAL_OVERRIDE; + + virtual Size GetOptimalSize() const SAL_OVERRIDE; + virtual void setPosSizePixel(long nX, long nY, long nWidth, long nHeight, PosSizeFlags nFlags = PosSizeFlags::All) SAL_OVERRIDE; +}; + +#endif // VCL_SOURCE_WINDOW_NOTEBOOKBARWINDOW_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx index a167c69..8589db6 100644 --- a/vcl/source/window/syswin.cxx +++ b/vcl/source/window/syswin.cxx @@ -39,6 +39,8 @@ #include <brdwin.hxx> #include <window.h> +#include "notebookbarwindow.hxx" + using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; @@ -967,6 +969,11 @@ void SystemWindow::SetMenuBar(MenuBar* pMenuBar) } } +void SystemWindow::CreateNotebookBar(const OUString& rUIXMLDescription, const css::uno::Reference<css::frame::XFrame>& rFrame) +{ + static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->SetNotebookBarWindow(rUIXMLDescription, rFrame); +} + void SystemWindow::SetMenuBarMode( MenuBarMode nMode ) { if ( mnMenuBarMode != nMode ) diff --git a/vcl/uiconfig/ui/notebookbar.ui b/vcl/uiconfig/ui/notebookbar.ui new file mode 100644 index 0000000..8177e7a --- /dev/null +++ b/vcl/uiconfig/ui/notebookbar.ui @@ -0,0 +1,355 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + <!-- interface-requires gtk+ 3.4 --> + <object class="GtkGrid" id="NotebookBar"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkGrid" id="grid1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <child> + <object class="GtkNotebook" id="notebook1"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <child> + <object class="GtkBox" id="box3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">6</property> + <child> + <object class="GtkBox" id="box4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> + <child> + <object class="GtkButton" id="button2"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="action_name">.uno:Open</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label11"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">label</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + </object> + </child> + <child type="tab"> + <object class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">File</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="tab_fill">False</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">6</property> + <child> + <object class="GtkBox" id="box2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> + <child> + <object class="GtkBox" id="box5"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkButton" id="button5"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="action_name">.uno:Paste</property> + <property name="image">image1</property> + <property name="relief">none</property> + <property name="image_position">top</property> + <property name="always_show_image">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box6"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <child> + <object class="GtkButton" id="button1"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="action_name">.uno:Cut</property> + <property name="relief">none</property> + <property name="xalign">0</property> + <property name="always_show_image">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="button3"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="action_name">.uno:Copy</property> + <property name="relief">none</property> + <property name="xalign">0</property> + <property name="always_show_image">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="button4"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="action_name">.uno:FormatPaintbrush</property> + <property name="relief">none</property> + <property name="xalign">0</property> + <property name="always_show_image">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label10"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Clipboard</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="position">1</property> + </packing> + </child> + <child type="tab"> + <object class="GtkLabel" id="label2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Edit</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="position">1</property> + <property name="tab_fill">False</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child type="tab"> + <object class="GtkLabel" id="label3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">View</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="position">2</property> + <property name="tab_fill">False</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child type="tab"> + <object class="GtkLabel" id="label4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Insert</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="position">3</property> + <property name="tab_fill">False</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child type="tab"> + <object class="GtkLabel" id="label5"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Format</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="position">4</property> + <property name="tab_fill">False</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child type="tab"> + <object class="GtkLabel" id="label6"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Table</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="position">5</property> + <property name="tab_fill">False</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child type="tab"> + <object class="GtkLabel" id="label7"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Tools</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="position">6</property> + <property name="tab_fill">False</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child type="tab"> + <object class="GtkLabel" id="label8"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Window</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="position">7</property> + <property name="tab_fill">False</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child type="tab"> + <object class="GtkLabel" id="label9"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Help</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="position">8</property> + <property name="tab_fill">False</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + </object> + <object class="GtkImage" id="image1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="pixbuf">cmd/lc_paste.png</property> + </object> +</interface> _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits