summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorSzymon Kłos <eszkadev@gmail.com>2016-08-19 10:20:03 +0200
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2016-08-25 11:46:39 +0000
commit6488d249b0c5649313b6611660aca939e5c374bf (patch)
tree64646f153fd5ef2999dff69a51462dc72fd27369 /vcl
parentb9ab0dd3e5eb3c948ee9a29006637e48d5751a5e (diff)
GSoC notebookbar: container with context support
+ added sfxlo-ContextVBox + notebookbar's .ui file must contain control implementing NotebookbarContextControl interface with id "ContextContainer" Change-Id: Ice81e23c4ba742564ebceeda95be120ea3f58c99 Reviewed-on: https://gerrit.libreoffice.org/28247 Tested-by: Jenkins <ci@libreoffice.org> Tested-by: Yousuf Philips <philipz85@hotmail.com> Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/control/notebookbar.cxx14
-rw-r--r--vcl/source/window/builder.cxx4
-rw-r--r--vcl/source/window/tabpage.cxx22
3 files changed, 14 insertions, 26 deletions
diff --git a/vcl/source/control/notebookbar.cxx b/vcl/source/control/notebookbar.cxx
index cb2611dd0351..1bfef511cd0c 100644
--- a/vcl/source/control/notebookbar.cxx
+++ b/vcl/source/control/notebookbar.cxx
@@ -8,6 +8,7 @@
*/
#include <vcl/layout.hxx>
+#include <vcl/tabctrl.hxx>
#include <vcl/notebookbar.hxx>
#include <cppuhelper/queryinterface.hxx>
#include <cppuhelper/implbase.hxx>
@@ -37,7 +38,10 @@ NotebookBar::NotebookBar(Window* pParent, const OString& rID, const OUString& rU
{
SetStyle(GetStyle() | WB_DIALOGCONTROL);
m_pUIBuilder = new VclBuilder(this, getUIRootDir(), rUIXMLDescription, rID, rFrame);
- get(m_pTabControl, "notebook1");
+
+ // In the Notebookbar's .ui file must exist control handling context
+ // - implementing NotebookbarContextControl interface with id "ContextContainer"
+ m_pContextContainer = dynamic_cast<NotebookbarContextControl*>(m_pUIBuilder->get<Window>("ContextContainer"));
}
NotebookBar::~NotebookBar()
@@ -49,7 +53,6 @@ void NotebookBar::dispose()
{
disposeBuilder();
m_pEventListener.clear();
- m_pTabControl.clear();
Control::dispose();
}
@@ -92,7 +95,8 @@ void NotebookBar::setPosSizePixel(long nX, long nY, long nWidth, long nHeight, P
void NotebookBar::SetIconClickHdl(Link<NotebookBar*, void> aHdl)
{
- m_pTabControl->SetIconClickHdl(aHdl);
+ if (m_pContextContainer)
+ m_pContextContainer->SetIconClickHdl(aHdl);
}
void NotebookBar::StateChanged(StateChangedType nType)
@@ -109,8 +113,8 @@ void NotebookBar::StateChanged(StateChangedType nType)
void SAL_CALL NotebookBarContextChangeEventListener::notifyContextChangeEvent(const css::ui::ContextChangeEventObject& rEvent)
throw (css::uno::RuntimeException, std::exception)
{
- if (mpParent && mpParent->m_pTabControl)
- mpParent->m_pTabControl->SetContext(vcl::EnumContext::GetContextEnum(rEvent.ContextName));
+ if (mpParent && mpParent->m_pContextContainer)
+ mpParent->m_pContextContainer->SetContext(vcl::EnumContext::GetContextEnum(rEvent.ContextName));
}
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index f53c3207c337..ddaedf0a8fce 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -2867,9 +2867,11 @@ VclPtr<vcl::Window> VclBuilder::handleObject(vcl::Window *pParent, xmlreader::Xm
else if (name.equals("style"))
{
int nPriority = 0;
- handleStyle(reader, nPriority);
+ std::vector<vcl::EnumContext::Context> aContext = handleStyle(reader, nPriority);
if (nPriority != 0)
dynamic_cast<vcl::IPrioritable*>(pCurrentChild.get())->SetPriority(nPriority);
+ if (aContext.size() != 0)
+ dynamic_cast<vcl::IContext*>(pCurrentChild.get())->SetContext(aContext);
}
else
{
diff --git a/vcl/source/window/tabpage.cxx b/vcl/source/window/tabpage.cxx
index e09f18fe193f..0576f3af6229 100644
--- a/vcl/source/window/tabpage.cxx
+++ b/vcl/source/window/tabpage.cxx
@@ -44,8 +44,6 @@ void TabPage::ImplInit( vcl::Window* pParent, WinBits nStyle )
// otherwise they will paint with a wrong background
if( IsNativeControlSupported(ControlType::TabBody, ControlPart::Entire) && GetParent() && (GetParent()->GetType() == WINDOW_TABCONTROL) )
EnableChildTransparentMode();
-
- maContext.push_back( vcl::EnumContext::Context::Context_Any );
}
void TabPage::ImplInitSettings()
@@ -73,12 +71,14 @@ void TabPage::ImplInitSettings()
TabPage::TabPage( vcl::Window* pParent, WinBits nStyle ) :
Window( WINDOW_TABPAGE )
+ , IContext()
{
ImplInit( pParent, nStyle );
}
TabPage::TabPage(vcl::Window *pParent, const OString& rID, const OUString& rUIXMLDescription)
: Window(WINDOW_TABPAGE)
+ , IContext()
{
ImplInit(pParent, 0);
m_pUIBuilder = new VclBuilder(this, getUIRootDir(), rUIXMLDescription, rID);
@@ -223,22 +223,4 @@ void TabPage::SetPosPixel(const Point& rAllocPos)
}
}
-void TabPage::SetContext(const std::vector<vcl::EnumContext::Context>& aContext)
-{
- maContext = aContext;
-}
-
-bool TabPage::HasContext( const vcl::EnumContext::Context eContext ) const
-{
- auto aFind = std::find(maContext.begin(), maContext.end(), eContext);
- if (aFind == maContext.end())
- return false;
- return true;
-}
-
-const std::vector< vcl::EnumContext::Context >& TabPage::GetContext() const
-{
- return maContext;
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */