summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-12-16 14:07:08 +0000
committerCaolán McNamara <caolanm@redhat.com>2014-12-17 12:35:54 +0000
commit48c15285c52f6554f1aadab6068c076c2139ef89 (patch)
tree35360eb56a9177528d0de813e20bc5bdc1454a79 /starmath
parentf4804a6cf1fa2a1941f43829a9801638bd456e2c (diff)
implement loading docking windows from .ui format
Change-Id: I90375232aefbe40412614ca0f30ba467cf393f2e
Diffstat (limited to 'starmath')
-rw-r--r--starmath/UIConfig_smath.mk1
-rw-r--r--starmath/inc/ElementsDockingWindow.hxx8
-rw-r--r--starmath/inc/starmath.hrc1
-rw-r--r--starmath/source/ElementsDockingWindow.cxx60
-rw-r--r--starmath/source/smres.src29
-rw-r--r--starmath/uiconfig/smath/ui/dockingelements.ui53
6 files changed, 94 insertions, 58 deletions
diff --git a/starmath/UIConfig_smath.mk b/starmath/UIConfig_smath.mk
index 0841d47433eb..8eb535d9940c 100644
--- a/starmath/UIConfig_smath.mk
+++ b/starmath/UIConfig_smath.mk
@@ -26,6 +26,7 @@ $(eval $(call gb_UIConfig_add_toolbarfiles,modules/smath,\
$(eval $(call gb_UIConfig_add_uifiles,modules/smath,\
starmath/uiconfig/smath/ui/alignmentdialog \
starmath/uiconfig/smath/ui/catalogdialog \
+ starmath/uiconfig/smath/ui/dockingelements \
starmath/uiconfig/smath/ui/floatingelements \
starmath/uiconfig/smath/ui/fontdialog \
starmath/uiconfig/smath/ui/fontsizedialog \
diff --git a/starmath/inc/ElementsDockingWindow.hxx b/starmath/inc/ElementsDockingWindow.hxx
index 013b6cd30e7b..85b27a4f9a6b 100644
--- a/starmath/inc/ElementsDockingWindow.hxx
+++ b/starmath/inc/ElementsDockingWindow.hxx
@@ -107,13 +107,15 @@ class SmElementsControl : public Control
void build();
public:
- SmElementsControl(vcl::Window *pParent, const ResId& rResId);
+ SmElementsControl(vcl::Window *pParent);
virtual ~SmElementsControl();
void setElementSetId(sal_uInt16 aSetId);
void setVerticalMode(bool bVertical);
+ Size GetOptimalSize() const SAL_OVERRIDE;
+
DECL_LINK( ScrollHdl, void* );
void DoScroll(long nDelta);
@@ -124,8 +126,8 @@ class SmElementsDockingWindow : public SfxDockingWindow
{
static const sal_uInt16 aCategories[];
- SmElementsControl maElementsControl;
- ListBox maElementListBox;
+ SmElementsControl* mpElementsControl;
+ ListBox* mpElementListBox;
virtual void Resize() SAL_OVERRIDE;
SmViewShell* GetView();
diff --git a/starmath/inc/starmath.hrc b/starmath/inc/starmath.hrc
index e5aab1968642..7196b26dd269 100644
--- a/starmath/inc/starmath.hrc
+++ b/starmath/inc/starmath.hrc
@@ -94,7 +94,6 @@
#define RID_SYMBOLFILESSTR (RID_APP_START + 809)
#define RID_ALLFILESSTR (RID_APP_START + 810)
#define RID_STATUSBAR (RID_APP_START + 816)
-#define RID_ELEMENTSDOCKINGWINDOW (RID_APP_START + 817)
#define STR_MATH_DOCUMENT_FULLTYPE_CURRENT (RID_APP_START + 821)
#define STR_STATSTR_READING (RID_APP_START + 823)
diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx
index 3aaac1e4f9c7..4cb086968cb7 100644
--- a/starmath/source/ElementsDockingWindow.cxx
+++ b/starmath/source/ElementsDockingWindow.cxx
@@ -216,8 +216,8 @@ const sal_uInt16 SmElementsControl::aOthers[][2] =
{RID_DOTSUP, RID_DOTSUP_HELP}, {RID_DOTSDOWN, RID_DOTSDOWN_HELP}
};
-SmElementsControl::SmElementsControl(vcl::Window *pParent, const ResId& rResId)
- : Control(pParent, rResId)
+SmElementsControl::SmElementsControl(vcl::Window *pParent)
+ : Control(pParent, WB_TABSTOP)
, mpDocShell(new SmDocShell(SFXOBJECTSHELL_STD_NORMAL))
, maCurrentSetId(0)
, mpCurrentElement(NULL)
@@ -622,6 +622,11 @@ void SmElementsControl::build()
Invalidate();
}
+Size SmElementsControl::GetOptimalSize() const
+{
+ return LogicToPixel(Size(300, 300), MapMode(MAP_APPFONT));
+}
+
const sal_uInt16 SmElementsDockingWindow::aCategories[] = {
RID_CATEGORY_UNARY_BINARY_OPERATORS,
RID_CATEGORY_RELATIONS,
@@ -636,32 +641,36 @@ const sal_uInt16 SmElementsDockingWindow::aCategories[] = {
};
SmElementsDockingWindow::SmElementsDockingWindow(SfxBindings* pInputBindings, SfxChildWindow* pChildWindow, vcl::Window* pParent) :
- SfxDockingWindow(pInputBindings, pChildWindow, pParent, SmResId(RID_ELEMENTSDOCKINGWINDOW)),
- maElementsControl (this, SmResId(1)),
- maElementListBox (this, SmResId(1))
+ SfxDockingWindow(pInputBindings, pChildWindow, pParent, "DockingElements",
+ "modules/smath/ui/dockingelements.ui")
{
- maElementsControl.SetBorderStyle( WindowBorderStyle::MONO );
+ mpElementsControl = new SmElementsControl(get<vcl::Window>("box"));
+ mpElementsControl->set_hexpand(true);
+ mpElementsControl->set_vexpand(true);
+ mpElementsControl->Show();
+ get(mpElementListBox, "listbox");
+
+ mpElementsControl->SetBorderStyle( WindowBorderStyle::MONO );
- maElementListBox.SetDropDownLineCount( SAL_N_ELEMENTS(aCategories) );
+ mpElementListBox->SetDropDownLineCount( SAL_N_ELEMENTS(aCategories) );
for (sal_uInt16 i = 0; i < SAL_N_ELEMENTS(aCategories) ; i++)
{
- maElementListBox.InsertEntry(SM_RESSTR(aCategories[i]));
+ mpElementListBox->InsertEntry(SM_RESSTR(aCategories[i]));
}
- maElementListBox.SetSelectHdl(LINK(this, SmElementsDockingWindow, ElementSelectedHandle));
- maElementListBox.SelectEntry(SM_RESSTR(RID_CATEGORY_UNARY_BINARY_OPERATORS));
+ mpElementListBox->SetSelectHdl(LINK(this, SmElementsDockingWindow, ElementSelectedHandle));
+ mpElementListBox->SelectEntry(SM_RESSTR(RID_CATEGORY_UNARY_BINARY_OPERATORS));
- maElementsControl.SetBackground( Color( COL_WHITE ) );
- maElementsControl.SetTextColor( Color( COL_BLACK ) );
- maElementsControl.setElementSetId(RID_CATEGORY_UNARY_BINARY_OPERATORS);
- maElementsControl.selectedSignal.connect( boost::bind( &SmElementsDockingWindow::SelectClickHandler, this, _1 ) );
-
- FreeResource();
+ mpElementsControl->SetBackground( Color( COL_WHITE ) );
+ mpElementsControl->SetTextColor( Color( COL_BLACK ) );
+ mpElementsControl->setElementSetId(RID_CATEGORY_UNARY_BINARY_OPERATORS);
+ mpElementsControl->selectedSignal.connect( boost::bind( &SmElementsDockingWindow::SelectClickHandler, this, _1 ) );
}
SmElementsDockingWindow::~SmElementsDockingWindow ()
{
+ delete mpElementsControl;
}
void SmElementsDockingWindow::ToggleFloatingMode()
@@ -678,7 +687,7 @@ void SmElementsDockingWindow::EndDocking( const Rectangle& rReactangle, bool bFl
{
SfxDockingWindow::EndDocking(rReactangle, bFloatMode);
bool bVertical = ( GetAlignment() == SFX_ALIGN_TOP || GetAlignment() == SFX_ALIGN_BOTTOM );
- maElementsControl.setVerticalMode(bVertical);
+ mpElementsControl->setVerticalMode(bVertical);
}
void SmElementsDockingWindow::SelectClickHandler( SmElement* pElement )
@@ -701,7 +710,7 @@ IMPL_LINK( SmElementsDockingWindow, ElementSelectedHandle, ListBox*, pList)
OUString aCurrentCategoryString = SM_RESSTR(aCurrentCategory);
if (aCurrentCategoryString == pList->GetSelectEntry())
{
- maElementsControl.setElementSetId(aCurrentCategory);
+ mpElementsControl->setElementSetId(aCurrentCategory);
return 0;
}
}
@@ -717,8 +726,8 @@ SmViewShell* SmElementsDockingWindow::GetView()
void SmElementsDockingWindow::Resize()
{
bool bVertical = ( GetAlignment() == SFX_ALIGN_TOP || GetAlignment() == SFX_ALIGN_BOTTOM );
- maElementsControl.setVerticalMode(bVertical);
-
+ mpElementsControl->setVerticalMode(bVertical);
+#if 0
sal_uInt32 aWidth = GetOutputSizePixel().Width();
sal_uInt32 aHeight = GetOutputSizePixel().Height();
@@ -727,12 +736,12 @@ void SmElementsDockingWindow::Resize()
Rectangle aRect1 = Rectangle(aPadding, aPadding, aWidth - aPadding, aElementsSetsHeight + aPadding);
- maElementListBox.SetPosSizePixel(aRect1.TopLeft(), aRect1.GetSize());
+ mpElementListBox->SetPosSizePixel(aRect1.TopLeft(), aRect1.GetSize());
Rectangle aRect = Rectangle(aPadding, aElementsSetsHeight + aPadding + aPadding, aWidth - aPadding, aHeight - aPadding);
- maElementsControl.SetPosSizePixel(aRect.TopLeft(), aRect.GetSize());
-
+ mpElementsControl->SetPosSizePixel(aRect.TopLeft(), aRect.GetSize());
+#endif
SfxDockingWindow::Resize();
Invalidate();
}
@@ -744,8 +753,9 @@ SmElementsDockingWindowWrapper::SmElementsDockingWindowWrapper(
SfxBindings *pBindings, SfxChildWinInfo *pInfo) :
SfxChildWindow(pParentWindow, nId)
{
- pWindow = new SmElementsDockingWindow(pBindings, this, pParentWindow);
- SmElementsDockingWindow* pDialog = static_cast<SmElementsDockingWindow*>(pWindow);
+ SmElementsDockingWindow* pDialog = new SmElementsDockingWindow(pBindings, this, pParentWindow);
+ pWindow = pDialog;
+ pDialog->setDeferredProperties();
pDialog->SetPosSizePixel(Point(0, 0), Size(300, 0));
pDialog->Show();
diff --git a/starmath/source/smres.src b/starmath/source/smres.src
index 6f7a2e655122..114d81be6d08 100644
--- a/starmath/source/smres.src
+++ b/starmath/source/smres.src
@@ -121,35 +121,6 @@ DockingWindow RID_CMDBOXWINDOW\
CMDBOXWINDOW_TEXT
};
-DockingWindow RID_ELEMENTSDOCKINGWINDOW
-{
- OutputSize = TRUE ;
- Hide = FALSE ;
- SVLook = TRUE ;
- Size = MAP_APPFONT ( 300 , 300 ) ;
- Sizeable = TRUE ;
- Moveable = TRUE ;
- Closeable = TRUE ;
- Zoomable = TRUE ;
- Dockable = TRUE ;
-
- Control 1
- {
- Border = FALSE ;
- };
-
- ListBox 1
- {
- Border = TRUE ;
- TabStop = TRUE ;
- Sort = FALSE ;
- DropDown = TRUE ;
- VScroll = TRUE ;
- };
-
- Text [ en-US ] = "Elements Dock" ;
-};
-
String STR_BLACK
{
Text [ en-US ] = "black" ;
diff --git a/starmath/uiconfig/smath/ui/dockingelements.ui b/starmath/uiconfig/smath/ui/dockingelements.ui
new file mode 100644
index 000000000000..b9630544eac2
--- /dev/null
+++ b/starmath/uiconfig/smath/ui/dockingelements.ui
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.16.1 -->
+<interface>
+ <requires lib="gtk+" version="3.0"/>
+ <object class="GtkWindow" id="DockingElements">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="border_width">6</property>
+ <property name="title" translatable="yes">Elements Dock</property>
+ <property name="type_hint">dock</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>
+ <property name="row_spacing">12</property>
+ <child>
+ <object class="GtkComboBoxText" id="listbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</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>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="box">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>