[Libreoffice-commits] .: Branch 'feature/cmclayout' - 5 commits - sw/Package_uiconfig.mk vcl/inc vcl/source
Caolán McNamara
caolan at kemper.freedesktop.org
Wed Jun 6 03:03:40 PDT 2012
sw/Package_uiconfig.mk | 2
vcl/inc/ilstbox.hxx | 10 +++
vcl/inc/vcl/builder.hxx | 39 ++++++++++++--
vcl/inc/vcl/layout.hxx | 22 ++++++++
vcl/source/control/ilstbox.cxx | 76 +++++++++++++++++++++++++++
vcl/source/control/lstbox.cxx | 4 -
vcl/source/window/builder.cxx | 112 +++++++++++++++++++++++++++++++++++++++--
vcl/source/window/layout.cxx | 45 +++++++++++++++-
8 files changed, 293 insertions(+), 17 deletions(-)
New commits:
commit dc746c02473ad2b777e7b2517e953891cdd5ef44
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Jun 6 10:46:49 2012 +0100
implement start and end button layouts and connect them up
diff --git a/vcl/inc/vcl/layout.hxx b/vcl/inc/vcl/layout.hxx
index c146087..e32a509 100644
--- a/vcl/inc/vcl/layout.hxx
+++ b/vcl/inc/vcl/layout.hxx
@@ -190,16 +190,38 @@ protected:
}
};
+enum VclButtonBoxStyle
+{
+ VCL_BUTTONBOX_DEFAULT_STYLE,
+ VCL_BUTTONBOX_SPREAD,
+ VCL_BUTTONBOX_EDGE,
+ VCL_BUTTONBOX_START,
+ VCL_BUTTONBOX_END,
+ VCL_BUTTONBOX_CENTER
+};
+
class VCL_DLLPUBLIC VclButtonBox : public VclBox
{
public:
VclButtonBox(Window *pParent, int nSpacing)
: VclBox(pParent, true, nSpacing)
+ , m_eLayoutStyle(VCL_BUTTONBOX_DEFAULT_STYLE)
+ {
+ }
+ void set_layout(VclButtonBoxStyle eStyle)
{
+ m_eLayoutStyle = eStyle;
}
+ VclButtonBoxStyle get_layout() const
+ {
+ return m_eLayoutStyle;
+ }
+ virtual bool set_property(const rtl::OString &rKey, const rtl::OString &rValue);
protected:
virtual Size calculateRequisition() const;
virtual void setAllocation(const Size &rAllocation);
+private:
+ VclButtonBoxStyle m_eLayoutStyle;
};
class VCL_DLLPUBLIC VclVButtonBox : public VclButtonBox
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index 98ed195..e6cf87e 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -264,6 +264,31 @@ Size VclButtonBox::calculateRequisition() const
return aSize;
}
+bool VclButtonBox::set_property(const rtl::OString &rKey, const rtl::OString &rValue)
+{
+ if (rKey.equalsL(RTL_CONSTASCII_STRINGPARAM("layout-style")))
+ {
+ VclButtonBoxStyle eStyle = VCL_BUTTONBOX_DEFAULT_STYLE;
+ if (rValue.equalsL(RTL_CONSTASCII_STRINGPARAM("start")))
+ eStyle = VCL_BUTTONBOX_START;
+ else if (rValue.equalsL(RTL_CONSTASCII_STRINGPARAM("spread")))
+ eStyle = VCL_BUTTONBOX_SPREAD;
+ else if (rValue.equalsL(RTL_CONSTASCII_STRINGPARAM("edge")))
+ eStyle = VCL_BUTTONBOX_EDGE;
+ else if (rValue.equalsL(RTL_CONSTASCII_STRINGPARAM("start")))
+ eStyle = VCL_BUTTONBOX_START;
+ else if (rValue.equalsL(RTL_CONSTASCII_STRINGPARAM("end")))
+ eStyle = VCL_BUTTONBOX_END;
+ else if (rValue.equalsL(RTL_CONSTASCII_STRINGPARAM("center")))
+ eStyle = VCL_BUTTONBOX_CENTER;
+ else
+ fprintf(stderr, "unknown layout style %s\n", rValue.getStr());
+ set_layout(eStyle);
+ }
+ else
+ return VclBox::set_property(rKey, rValue);
+ return true;
+}
void VclButtonBox::setAllocation(const Size &rAllocation)
{
@@ -289,8 +314,20 @@ void VclButtonBox::setAllocation(const Size &rAllocation)
Point aPos(0, 0);
long nPrimaryCoordinate = getPrimaryCoordinate(aPos);
- setPrimaryCoordinate(aPos, nPrimaryCoordinate + nAllocPrimaryDimension
- - getPrimaryDimension(aRequisition));
+
+ //To-Do, other layout styles
+ switch (m_eLayoutStyle)
+ {
+ case VCL_BUTTONBOX_START:
+ break;
+ default:
+ fprintf(stderr, "todo unimplemented layout style\n");
+ case VCL_BUTTONBOX_DEFAULT_STYLE:
+ case VCL_BUTTONBOX_END:
+ setPrimaryCoordinate(aPos, nPrimaryCoordinate + nAllocPrimaryDimension
+ - getPrimaryDimension(aRequisition));
+ break;
+ }
for (Window *pChild = GetWindow(WINDOW_FIRSTCHILD); pChild; pChild = pChild->GetWindow(WINDOW_NEXT))
{
@@ -506,7 +543,7 @@ bool VclGrid::set_property(const rtl::OString &rKey, const rtl::OString &rValue)
else if (rKey.equalsL(RTL_CONSTASCII_STRINGPARAM("n-rows")))
/*nothing to do*/;
else
- return Window::set_property(rKey, rValue);
+ return VclContainer::set_property(rKey, rValue);
return true;
}
@@ -641,7 +678,7 @@ bool VclAlignment::set_property(const rtl::OString &rKey, const rtl::OString &rV
else if (rKey.equalsL(RTL_CONSTASCII_STRINGPARAM("yscale")))
m_fYScale = rValue.toFloat();
else
- return Window::set_property(rKey, rValue);
+ return VclBin::set_property(rKey, rValue);
return true;
}
commit e80bcd31b76c1daea4555882b88e1f24d5be5bc7
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Jun 6 10:29:16 2012 +0100
take over selected entry text
diff --git a/vcl/inc/ilstbox.hxx b/vcl/inc/ilstbox.hxx
index fda1b38..60103c1 100644
--- a/vcl/inc/ilstbox.hxx
+++ b/vcl/inc/ilstbox.hxx
@@ -629,6 +629,7 @@ public:
sal_Bool IsUserDrawEnabled() const { return mbUserDrawEnabled; }
void DrawEntry( sal_Bool bDrawImage, sal_Bool bDrawText, sal_Bool bDrawTextAtImagePos = sal_False, bool bLayout = false );
+ virtual void take_properties(Window &rOther);
};
// -----------
diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index e7f8a0a..1dd1925 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -542,6 +542,11 @@ sal_uInt16 ImplEntryList::FindFirstSelectable( sal_uInt16 nPos, bool bForward /*
void ImplEntryList::take_properties(ImplEntryList &rOther)
{
+ mnLastSelected = rOther.mnLastSelected;
+ mnSelectionAnchor = rOther.mnSelectionAnchor;
+ mnImages = rOther.mnImages;
+ mnMRUCount = rOther.mnMRUCount;
+ mnMaxMRUCount = rOther.mnMaxMRUCount;
maEntries.swap(rOther.maEntries);
}
@@ -594,10 +599,48 @@ ImplListBoxWindow::ImplListBoxWindow( Window* pParent, WinBits nWinStyle ) :
void ImplListBoxWindow::take_properties(Window &rOther)
{
+ Control::take_properties(rOther);
+
ImplListBoxWindow &rOtherListBoxWindow = static_cast<ImplListBoxWindow&>(rOther);
mpEntryList->take_properties(*rOtherListBoxWindow.mpEntryList);
- Control::take_properties(rOther);
+ maFocusRect = rOtherListBoxWindow.maFocusRect;
+ maUserItemSize = rOtherListBoxWindow.maUserItemSize;
+ mnMaxTxtHeight = rOtherListBoxWindow.mnMaxTxtHeight;
+ mnMaxTxtWidth = rOtherListBoxWindow.mnMaxTxtWidth;
+ mnMaxImgTxtWidth = rOtherListBoxWindow.mnMaxImgTxtWidth;
+ mnMaxImgWidth = rOtherListBoxWindow.mnMaxImgWidth;
+ mnMaxImgHeight = rOtherListBoxWindow.mnMaxImgHeight;
+ mnMaxWidth = rOtherListBoxWindow.mnMaxWidth;
+ mnMaxHeight = rOtherListBoxWindow.mnMaxHeight;
+ mnCurrentPos = rOtherListBoxWindow.mnCurrentPos;
+ mnTrackingSaveSelection = rOtherListBoxWindow.mnTrackingSaveSelection;
+ mnSeparatorPos = rOtherListBoxWindow.mnSeparatorPos;
+ mnUserDrawEntry = rOtherListBoxWindow.mnUserDrawEntry;
+ mnTop = rOtherListBoxWindow.mnTop;
+ mnLeft = rOtherListBoxWindow.mnLeft;
+ mnBorder = rOtherListBoxWindow.mnBorder;
+ mnTextHeight = rOtherListBoxWindow.mnTextHeight;
+ meProminentType = rOtherListBoxWindow.meProminentType;
+ mnSelectModifier = rOtherListBoxWindow.mnSelectModifier;
+ mbHasFocusRect = rOtherListBoxWindow.mbHasFocusRect;
+ mbSort = rOtherListBoxWindow.mbSort;
+ mbTrack = rOtherListBoxWindow.mbTrack;
+ mbMulti = rOtherListBoxWindow.mbMulti;
+ mbStackMode = rOtherListBoxWindow.mbStackMode;
+ mbSimpleMode = rOtherListBoxWindow.mbSimpleMode;
+ mbImgsDiffSz = rOtherListBoxWindow.mbImgsDiffSz;
+ mbTravelSelect = rOtherListBoxWindow.mbTravelSelect;
+ mbTrackingSelect = rOtherListBoxWindow.mbTrackingSelect;
+ mbSelectionChanged = rOtherListBoxWindow.mbSelectionChanged;
+ mbMouseMoveSelect = rOtherListBoxWindow.mbMouseMoveSelect;
+ mbGrabFocus = rOtherListBoxWindow.mbGrabFocus;
+ mbUserDrawEnabled = rOtherListBoxWindow.mbUserDrawEnabled;
+ mbInUserDraw = rOtherListBoxWindow.mbInUserDraw;
+ mbReadOnly = rOtherListBoxWindow.mbReadOnly;
+ mbMirroring = rOtherListBoxWindow.mbMirroring;
+ mbRight = rOtherListBoxWindow.mbRight;
+ mbCenter = rOtherListBoxWindow.mbCenter;
}
// -----------------------------------------------------------------------
@@ -2778,6 +2821,18 @@ ImplWin::ImplWin( Window* pParent, WinBits nWinStyle ) :
mnItemPos = LISTBOX_ENTRY_NOTFOUND;
}
+void ImplWin::take_properties(Window &rOther)
+{
+ Control::take_properties(rOther);
+
+ ImplWin &rOtherImplWin = static_cast<ImplWin&>(rOther);
+ mnItemPos = rOtherImplWin.mnItemPos;
+ maString = rOtherImplWin.maString;
+ maImage = rOtherImplWin.maImage;
+ maFocusRect = rOtherImplWin.maFocusRect;
+ maUserItemSize = rOtherImplWin.maUserItemSize;
+};
+
// -----------------------------------------------------------------------
void ImplWin::MBDown()
diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx
index ebac07f..fe7f35b 100644
--- a/vcl/source/control/lstbox.cxx
+++ b/vcl/source/control/lstbox.cxx
@@ -98,6 +98,7 @@ void ListBox::take_properties(Window &rOther)
mbDDAutoSize = rOtherListBox.mbDDAutoSize;
mnLineCount = rOtherListBox.mnLineCount;
mpImplLB->take_properties(*rOtherListBox.mpImplLB);
+ mpImplWin->take_properties(*rOtherListBox.mpImplWin);
}
// -----------------------------------------------------------------------
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index dd43b93..963792b 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -707,6 +707,8 @@ void VclBuilder::mungemodel(ListBox &rTarget, ListStore &rStore)
{
rTarget.InsertEntry(rtl::OStringToOUString(*aI, RTL_TEXTENCODING_UTF8));
}
+ if (!rStore.m_aEntries.empty())
+ rTarget.SelectEntryPos(0);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 2022404f46bf6377aad301fa7e80204561bb0966
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Jun 6 09:17:26 2012 +0100
transfer contents of listboxes
diff --git a/vcl/inc/ilstbox.hxx b/vcl/inc/ilstbox.hxx
index cecf3b8..fda1b38 100644
--- a/vcl/inc/ilstbox.hxx
+++ b/vcl/inc/ilstbox.hxx
@@ -196,6 +196,8 @@ public:
first selectable entry after nPos is bForward is false.
*/
sal_uInt16 FindFirstSelectable( sal_uInt16 nPos, bool bForward = true );
+
+ void take_properties(ImplEntryList &rOther);
};
// ---------------------
@@ -388,6 +390,11 @@ public:
inline void EnableMirroring() { mbMirroring = sal_True; }
inline sal_Bool IsMirroring() const { return mbMirroring; }
+ /*
+ * Takes ownership of the rOther properties
+ */
+ virtual void take_properties(Window &rOther);
+
protected:
// ISearchableStringList
virtual ::vcl::StringEntryIdentifier CurrentEntry( String& _out_entryText ) const;
@@ -515,6 +522,8 @@ public:
// pb: #106948# explicit mirroring for calc
inline void EnableMirroring() { maLBWindow.EnableMirroring(); }
inline void SetDropTraget(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& i_xDNDListenerContainer){ mxDNDListenerContainer= i_xDNDListenerContainer; }
+
+ virtual void take_properties(Window &rOther);
};
// -----------------------------
diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index f6236b5..e7f8a0a 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -540,6 +540,11 @@ sal_uInt16 ImplEntryList::FindFirstSelectable( sal_uInt16 nPos, bool bForward /*
return LISTBOX_ENTRY_NOTFOUND;
}
+void ImplEntryList::take_properties(ImplEntryList &rOther)
+{
+ maEntries.swap(rOther.maEntries);
+}
+
// =======================================================================
ImplListBoxWindow::ImplListBoxWindow( Window* pParent, WinBits nWinStyle ) :
@@ -587,6 +592,14 @@ ImplListBoxWindow::ImplListBoxWindow( Window* pParent, WinBits nWinStyle ) :
ImplCalcMetrics();
}
+void ImplListBoxWindow::take_properties(Window &rOther)
+{
+ ImplListBoxWindow &rOtherListBoxWindow = static_cast<ImplListBoxWindow&>(rOther);
+ mpEntryList->take_properties(*rOtherListBoxWindow.mpEntryList);
+
+ Control::take_properties(rOther);
+}
+
// -----------------------------------------------------------------------
ImplListBoxWindow::~ImplListBoxWindow()
@@ -2267,6 +2280,14 @@ ImplListBox::ImplListBox( Window* pParent, WinBits nWinStyle ) :
maLBWindow.Show();
}
+void ImplListBox::take_properties(Window &rOther)
+{
+ Control::take_properties(rOther);
+
+ ImplListBox &rOtherListBoxWindow = static_cast<ImplListBox&>(rOther);
+ maLBWindow.take_properties(rOtherListBoxWindow.maLBWindow);
+}
+
// -----------------------------------------------------------------------
ImplListBox::~ImplListBox()
diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx
index edaac63..ebac07f 100644
--- a/vcl/source/control/lstbox.cxx
+++ b/vcl/source/control/lstbox.cxx
@@ -92,13 +92,12 @@ void ListBox::take_properties(Window &rOther)
Control::take_properties(rOther);
- fprintf(stderr, "ListBox::take_properties\n");
ListBox &rOtherListBox = static_cast<ListBox&>(rOther);
mnDDHeight = rOtherListBox.mnDDHeight;
mnSaveValue = rOtherListBox.mnSaveValue;
mbDDAutoSize = rOtherListBox.mbDDAutoSize;
mnLineCount = rOtherListBox.mnLineCount;
- fprintf(stderr, "ListBox::take_properties %p %d\n", this, IsVisible());
+ mpImplLB->take_properties(*rOtherListBox.mpImplLB);
}
// -----------------------------------------------------------------------
commit e3f3e466d6fa51a3ac43b51d79f3d755177ce644
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Jun 6 08:56:46 2012 +0100
import GtkListStore contents to ListBox
diff --git a/vcl/inc/vcl/builder.hxx b/vcl/inc/vcl/builder.hxx
index 6b23372..80b6536 100644
--- a/vcl/inc/vcl/builder.hxx
+++ b/vcl/inc/vcl/builder.hxx
@@ -34,6 +34,8 @@
#include <map>
#include <vector>
+class ListBox;
+
class VCL_DLLPUBLIC VclBuilder
{
private:
@@ -52,17 +54,41 @@ private:
};
std::vector<WinAndId> m_aChildren;
- struct RadioButtonGroupMap
+ struct ListStore
+ {
+ std::vector<rtl::OString> m_aEntries;
+ };
+
+ struct ModelAndId
+ {
+ rtl::OString m_sID;
+ ListStore *m_pModel;
+ ModelAndId(const rtl::OString &rId, ListStore *pListStore)
+ : m_sID(rId)
+ , m_pModel(pListStore)
+ {
+ }
+ };
+ std::vector<ModelAndId> m_aModels;
+
+ struct StringPair
{
rtl::OString m_sID;
- rtl::OString m_sGroup;
- RadioButtonGroupMap(const rtl::OString &rId, const rtl::OString &rGroup)
+ rtl::OString m_sValue;
+ StringPair(const rtl::OString &rId, const rtl::OString &rValue)
: m_sID(rId)
- , m_sGroup(rGroup)
+ , m_sValue(rValue)
{
}
};
- std::vector<RadioButtonGroupMap> m_aGroups;
+
+ typedef StringPair RadioButtonGroupMap;
+ std::vector<RadioButtonGroupMap> m_aGroupMaps;
+
+ typedef StringPair ComboBoxModelMap;
+ std::vector<ComboBoxModelMap> m_aModelMaps;
+ ListStore *get_model_by_name(rtl::OString sID);
+ static void mungemodel(ListBox &rTarget, ListStore &rStore);
rtl::OString m_sID;
Window *m_pParent;
@@ -82,6 +108,7 @@ private:
Window *insertObject(Window *pParent, const rtl::OString &rClass, const rtl::OString &rID, stringmap &rVec);
Window *makeObject(Window *pParent, const rtl::OString &rClass, const rtl::OString &rID, stringmap &rVec);
bool extractGroup(const rtl::OString &id, stringmap &rVec);
+ bool extractModel(const rtl::OString &id, stringmap &rVec);
void handleChild(Window *pParent, xmlreader::XmlReader &reader);
Window* handleObject(Window *pParent, xmlreader::XmlReader &reader);
@@ -89,6 +116,8 @@ private:
void applyPackingProperty(Window *pCurrent, xmlreader::XmlReader &reader);
void collectProperty(xmlreader::XmlReader &reader, stringmap &rVec);
+ void handleListStore(xmlreader::XmlReader &reader, const rtl::OString &rID);
+
//Helpers to retrofit all the existing code the the builder
static void swapGuts(Window &rOrig, Window &rReplacement);
static sal_uInt16 getPositionWithinParent(Window &rWindow);
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 66e1829..dd43b93 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -45,17 +45,36 @@ VclBuilder::VclBuilder(Window *pParent, rtl::OUString sUri, rtl::OString sID)
handleChild(pParent, reader);
//Set radiobutton groups when everything has been imported
- for (std::vector<RadioButtonGroupMap>::iterator aI = m_aGroups.begin(),
- aEnd = m_aGroups.end(); aI != aEnd; ++aI)
+ for (std::vector<RadioButtonGroupMap>::iterator aI = m_aGroupMaps.begin(),
+ aEnd = m_aGroupMaps.end(); aI != aEnd; ++aI)
{
RadioButton *pOne = static_cast<RadioButton*>(get_by_name(aI->m_sID));
- RadioButton *pOther = static_cast<RadioButton*>(get_by_name(aI->m_sGroup));
+ RadioButton *pOther = static_cast<RadioButton*>(get_by_name(aI->m_sValue));
SAL_WARN_IF(!pOne || !pOther, "vcl", "missing member of radiobutton group");
if (pOne && pOther)
pOne->group(*pOther);
}
//drop maps now
- std::vector<RadioButtonGroupMap>().swap(m_aGroups);
+ std::vector<RadioButtonGroupMap>().swap(m_aGroupMaps);
+
+ //Set ComboBox models when everything has been imported
+ for (std::vector<ComboBoxModelMap>::iterator aI = m_aModelMaps.begin(),
+ aEnd = m_aModelMaps.end(); aI != aEnd; ++aI)
+ {
+ ListBox *pTarget = static_cast<ListBox*>(get_by_name(aI->m_sID));
+ ListStore *pStore = static_cast<ListStore*>(get_model_by_name(aI->m_sValue));
+ SAL_WARN_IF(!pTarget || !pStore, "vcl", "missing elements of combobox/liststore");
+ if (pTarget && pStore)
+ mungemodel(*pTarget, *pStore);
+ }
+ //drop maps now
+ std::vector<ComboBoxModelMap>().swap(m_aModelMaps);
+ for (std::vector<ModelAndId>::iterator aI = m_aModels.begin(),
+ aEnd = m_aModels.end(); aI != aEnd; ++aI)
+ {
+ delete aI->m_pModel;
+ }
+ std::vector<ModelAndId>().swap(m_aModels);
//auto-show (really necessary ?, maybe drop it when complete)
for (std::vector<WinAndId>::iterator aI = m_aChildren.begin(),
@@ -138,7 +157,19 @@ bool VclBuilder::extractGroup(const rtl::OString &id, stringmap &rMap)
VclBuilder::stringmap::iterator aFind = rMap.find(rtl::OString(RTL_CONSTASCII_STRINGPARAM("group")));
if (aFind != rMap.end())
{
- m_aGroups.push_back(RadioButtonGroupMap(id, aFind->second));
+ m_aGroupMaps.push_back(RadioButtonGroupMap(id, aFind->second));
+ rMap.erase(aFind);
+ return true;
+ }
+ return false;
+}
+
+bool VclBuilder::extractModel(const rtl::OString &id, stringmap &rMap)
+{
+ VclBuilder::stringmap::iterator aFind = rMap.find(rtl::OString(RTL_CONSTASCII_STRINGPARAM("model")));
+ if (aFind != rMap.end())
+ {
+ m_aModelMaps.push_back(ComboBoxModelMap(id, aFind->second));
rMap.erase(aFind);
return true;
}
@@ -182,7 +213,10 @@ Window *VclBuilder::makeObject(Window *pParent, const rtl::OString &name, const
else if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkSpinButton")))
pWindow = new MetricField(pParent, WB_RIGHT|WB_SPIN|WB_BORDER|WB_3DLOOK);
else if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkComboBox")))
+ {
+ extractModel(id, rMap);
pWindow = new ListBox(pParent, WB_LEFT|WB_DROPDOWN|WB_VCENTER|WB_3DLOOK);
+ }
else if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkLabel")))
pWindow = new FixedText(pParent, WB_CENTER|WB_VCENTER|WB_3DLOOK);
else if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkEntry")))
@@ -348,6 +382,45 @@ void VclBuilder::handleChild(Window *pParent, xmlreader::XmlReader &reader)
}
}
+void VclBuilder::handleListStore(xmlreader::XmlReader &reader, const rtl::OString &rID)
+{
+ m_aModels.push_back(ModelAndId(rID, new ListStore));
+
+ int nLevel = 1;
+
+ while(1)
+ {
+ xmlreader::Span name;
+ int nsId;
+
+ xmlreader::XmlReader::Result res = reader.nextItem(
+ xmlreader::XmlReader::TEXT_NONE, &name, &nsId);
+
+ if (res == xmlreader::XmlReader::RESULT_DONE)
+ break;
+
+ if (res == xmlreader::XmlReader::RESULT_BEGIN)
+ {
+ ++nLevel;
+ if (name.equals(RTL_CONSTASCII_STRINGPARAM("col")))
+ {
+ reader.nextItem(
+ xmlreader::XmlReader::TEXT_NORMALIZED, &name, &nsId);
+ rtl::OString sValue(name.begin, name.length);
+ m_aModels.back().m_pModel->m_aEntries.push_back(sValue);
+ }
+ }
+
+ if (res == xmlreader::XmlReader::RESULT_END)
+ {
+ --nLevel;
+ }
+
+ if (!nLevel)
+ break;
+ }
+}
+
Window* VclBuilder::handleObject(Window *pParent, xmlreader::XmlReader &reader)
{
rtl::OString sClass;
@@ -371,6 +444,12 @@ Window* VclBuilder::handleObject(Window *pParent, xmlreader::XmlReader &reader)
}
+ if (sClass.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkListStore")))
+ {
+ handleListStore(reader, sID);
+ return NULL;
+ }
+
int nLevel = 1;
stringmap aProperties;
@@ -540,6 +619,18 @@ Window *VclBuilder::get_by_name(rtl::OString sID)
return NULL;
}
+VclBuilder::ListStore *VclBuilder::get_model_by_name(rtl::OString sID)
+{
+ for (std::vector<ModelAndId>::iterator aI = m_aModels.begin(),
+ aEnd = m_aModels.end(); aI != aEnd; ++aI)
+ {
+ if (aI->m_sID.equals(sID))
+ return aI->m_pModel;
+ }
+
+ return NULL;
+}
+
void VclBuilder::swapGuts(Window &rOrig, Window &rReplacement)
{
#if 1
@@ -609,4 +700,13 @@ bool VclBuilder::replace(rtl::OString sID, Window &rReplacement)
return false;
}
+void VclBuilder::mungemodel(ListBox &rTarget, ListStore &rStore)
+{
+ for (std::vector<rtl::OString>::iterator aI = rStore.m_aEntries.begin(), aEnd = rStore.m_aEntries.end();
+ aI != aEnd; ++aI)
+ {
+ rTarget.InsertEntry(rtl::OStringToOUString(*aI, RTL_TEXTENCODING_UTF8));
+ }
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit a10359620b00eaf23873f50b37eda9f1531390fe
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Jun 5 13:07:30 2012 +0100
put .ui file into correct location
diff --git a/sw/Package_uiconfig.mk b/sw/Package_uiconfig.mk
index 5862eba..0aca6ef 100644
--- a/sw/Package_uiconfig.mk
+++ b/sw/Package_uiconfig.mk
@@ -29,7 +29,7 @@
$(eval $(call gb_Package_Package,sw_uiconfig,$(SRCDIR)/sw/uiconfig))
$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/swriter/ui/titlepage.ui,swriter/ui/titlepage.ui))
-$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sw/ui/20705.ui,sw/ui/20705.ui))
+$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/sw/ui/20705.ui,sw/ui/20705.ui))
$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sglobal/menubar/menubar.xml,sglobal/menubar/menubar.xml))
$(eval $(call gb_Package_add_file,sw_uiconfig,xml/uiconfig/modules/sglobal/statusbar/statusbar.xml,sglobal/statusbar/statusbar.xml))
More information about the Libreoffice-commits
mailing list